/* ============================================================
   ГЕКОН — личная ОС. Тёмная, плотная, каждый апп со своей
   световой identity. Unbounded (бренд) + Manrope (текст).
   ============================================================ */

:root {
    --bg:        #070708;
    --tile:      #101013;
    --tile-edge: rgba(255,255,255,0.055);
    --tile-edge-hi: rgba(255,255,255,0.11);

    --text:      #F7F7F5;
    --text-soft: #C9C9CE;
    --muted:     #8B8B93;
    --muted-weak:#5B5B63;

    --gecko-1:   #D6FF5C;
    --gecko-2:   #5CE0A8;

    --font-brand: 'Unbounded', sans-serif;
    --font-body:  'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;

    --r-md: 16px;
    --r-lg: 24px;
    --r-xl: 30px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    height: 100%;
}

body {
    padding: calc(env(safe-area-inset-top, 0px) + 22px) 18px 44px;
    overscroll-behavior: none;
    max-width: 560px;
    margin: 0 auto;
}

/* ---------- атмосфера ---------- */
.atmo {
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background:
        radial-gradient(55vw 55vw at 85% -8%, rgba(214,255,92,0.07) 0%, transparent 60%),
        radial-gradient(70vw 55vw at -15% 30%, rgba(255,122,198,0.06) 0%, transparent 60%),
        radial-gradient(80vw 70vw at 50% 115%, rgba(92,224,168,0.05) 0%, transparent 65%);
}

.grain {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0.5;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.04 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- шапка ---------- */
.top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.paw { width: 26px; height: 26px; }

.wordmark {
    font-family: var(--font-brand);
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    background: linear-gradient(100deg, #D6FF5C, #5CE0A8 70%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--tile-edge-hi);
    background: rgba(255,255,255,0.03);
    color: var(--muted);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: color 0.2s, transform 0.1s;
}
.icon-btn:active { transform: scale(0.92); }

/* ---------- приветствие ---------- */
.hello {
    margin: 34px 2px 26px;
    animation: rise 0.55s 0.06s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.hello h1 {
    font-family: var(--font-brand);
    font-weight: 500;
    font-size: clamp(24px, 6.6vw, 30px);
    letter-spacing: -0.01em;
    line-height: 1.15;
}

.hello p {
    margin-top: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
    letter-spacing: 0.02em;
}

/* ---------- тайлы ---------- */
.tiles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.tile {
    --a1: #fff;
    --a2: #999;
    position: relative;
    border-radius: var(--r-lg);
    background: var(--tile);
    border: 1px solid var(--tile-edge);
    padding: 18px 16px 16px;
    min-height: 168px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    font: inherit;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    overflow: hidden;
    isolation: isolate;
    transition: transform 0.14s cubic-bezier(0.3, 0.7, 0.4, 1.2), border-color 0.25s;
    animation: rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.tile:nth-child(1) { animation-delay: 0.10s; }
.tile:nth-child(2) { animation-delay: 0.16s; }
.tile:nth-child(3) { animation-delay: 0.22s; }
.tile:nth-child(4) { animation-delay: 0.28s; }

.tile:active { transform: scale(0.965); }
.tile:hover { border-color: var(--tile-edge-hi); }

/* свечение своего цвета из угла */
.tile::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: radial-gradient(120% 90% at 18% 0%, color-mix(in srgb, var(--a1) 16%, transparent) 0%, transparent 58%);
}
/* тонкая цветная кромка сверху */
.tile::after {
    content: '';
    position: absolute;
    top: 0;
    left: 18px;
    right: 55%;
    height: 1px;
    background: linear-gradient(90deg, var(--a1), transparent);
    opacity: 0.85;
}

.tile .app-icon {
    width: 46px;
    height: 46px;
    border-radius: 15px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--a1) 22%, #131316),
        color-mix(in srgb, var(--a2) 14%, #101013));
    border: 1px solid color-mix(in srgb, var(--a1) 32%, transparent);
    color: var(--a1);
    box-shadow: 0 6px 22px -8px color-mix(in srgb, var(--a1) 55%, transparent);
}
.tile .app-icon svg { width: 24px; height: 24px; }

.tile h3 {
    font-family: var(--font-brand);
    font-weight: 500;
    font-size: 14.5px;
    letter-spacing: 0.01em;
    margin-top: 16px;
}

.tile .sub {
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    margin-top: 5px;
    line-height: 1.45;
}

.tile .state {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--muted);
}
.tile .state .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gecko-2);
    box-shadow: 0 0 8px var(--gecko-2);
}
.tile .state.off .dot { background: #F4C97B; box-shadow: 0 0 8px rgba(244,201,123,0.8); }
.tile .state.off { color: #F4C97B; }

.tile.disabled { cursor: default; }
.tile.disabled .app-icon { filter: saturate(0.4); opacity: 0.7; }
.tile.disabled h3, .tile.disabled .sub { color: var(--muted); }
.tile.disabled:active { transform: none; }

.tile .soon {
    position: absolute;
    top: 14px;
    right: 14px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 4px 9px;
    border-radius: 999px;
    color: var(--gecko-1);
    border: 1px solid color-mix(in srgb, var(--gecko-1) 40%, transparent);
    background: color-mix(in srgb, var(--gecko-1) 9%, transparent);
}

@keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- полноэкранные фреймы ---------- */
.frame-host {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: var(--bg);
    animation: frame-in 0.28s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes frame-in {
    from { opacity: 0; transform: translateY(3%) scale(0.985); }
    to   { opacity: 1; transform: none; }
}

.frame-wrap { position: absolute; inset: 0; display: none; }
.frame-wrap.active { display: block; }
.frame-wrap iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: var(--bg);
}

/* ---------- лапка-возврат ---------- */
.home-pill {
    position: fixed;
    z-index: 50;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 1px solid color-mix(in srgb, var(--gecko-1) 45%, transparent);
    background: rgba(10, 10, 12, 0.78);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    color: var(--gecko-1);
    display: grid;
    place-items: center;
    cursor: pointer;
    touch-action: none;
    transition: opacity 0.45s ease, transform 0.12s;
    box-shadow:
        0 0 0 4px rgba(214,255,92,0.06),
        0 8px 28px rgba(0,0,0,0.55),
        0 0 22px -4px rgba(214,255,92,0.35);
    animation: pill-pop 0.4s 0.15s cubic-bezier(0.3, 1.4, 0.5, 1) both;
}
@keyframes pill-pop {
    from { opacity: 0; transform: scale(0.5); }
    to   { opacity: 1; transform: scale(1); }
}
.home-pill.dim { opacity: 0.55; }
.home-pill:active { transform: scale(0.9); }

.pill-hint {
    position: fixed;
    z-index: 50;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 26px);
    transform: translateX(-50%);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-soft);
    background: rgba(12,12,14,0.88);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid var(--tile-edge-hi);
    border-radius: 999px;
    padding: 10px 16px;
    white-space: nowrap;
    animation: rise 0.4s 0.5s both;
}

/* ---------- настройки ---------- */
.sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(0,0,0,0.6);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}

.sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 61;
    background: #121215;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    border-top: 1px solid var(--tile-edge-hi);
    padding: 10px 22px calc(env(safe-area-inset-bottom, 0px) + 26px);
    max-width: 560px;
    margin: 0 auto;
    animation: sheet-up 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes sheet-up {
    from { transform: translateY(40px); opacity: 0; }
    to   { transform: none; opacity: 1; }
}

.sheet-handle {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: var(--tile-edge-hi);
    margin: 8px auto 18px;
}

.sheet h2 {
    font-family: var(--font-brand);
    font-weight: 500;
    font-size: 17px;
}

.sheet-hint {
    font-size: 13px;
    color: var(--muted);
    margin-top: 8px;
    line-height: 1.5;
}
.sheet-hint code {
    font-family: ui-monospace, monospace;
    color: var(--gecko-1);
}

.sheet-fields { margin: 20px 0 22px; display: grid; gap: 16px; }

.field label {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-soft);
    margin-bottom: 7px;
}
.field label span.ok { color: var(--gecko-2); font-weight: 600; }

.field input {
    width: 100%;
    background: #0B0B0D;
    border: 1px solid var(--tile-edge-hi);
    border-radius: var(--r-md);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    padding: 13px 15px;
    outline: none;
    transition: border-color 0.2s;
}
.field input:focus { border-color: var(--gecko-2); }

.btn-primary {
    width: 100%;
    border: 0;
    border-radius: var(--r-md);
    padding: 15px;
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.03em;
    color: #10130A;
    background: linear-gradient(120deg, var(--gecko-1), var(--gecko-2));
    cursor: pointer;
    box-shadow: 0 8px 30px -10px rgba(214,255,92,0.5);
}
.btn-primary:active { transform: scale(0.98); }
