:root{
    --bg0:#070a12;
    --bg1:#0b1020;

    --cardA:rgba(255,255,255,.07);
    --cardB:rgba(255,255,255,.03);
    --stroke:rgba(255,255,255,.12);

    --text:rgba(255,255,255,.92);
    --muted:rgba(255,255,255,.68);

    --shadow: 0 18px 50px rgba(0,0,0,.45);
    --radius: 22px;

    --acc1:#7c3aed;
    --acc2:#22c55e;
    --acc3:#3b82f6;
}

/* Secret mode overrides */
body.quack{
    --acc1:#f59e0b;
    --acc2:#10b981;
    --acc3:#60a5fa;
}

*{box-sizing:border-box}
/*html,body{height:100%}*/
body {
    margin: 0;
    /* Используем min-height вместо height, чтобы фон тянулся за контентом */
    min-height: 100dvh;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji","Segoe UI Emoji";
    color: var(--text);

    /* Ваш существующий градиент */
    background: linear-gradient(180deg, var(--bg0), var(--bg1));

    display: flex;
    align-items: center;
    justify-content: center;

    /* Защита от наплыва "челки" и индикатора Home на iPhone */
    padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);

    overflow-x: hidden;
    position: relative;
}

/* ===== Background ===== */
#dust{
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -3;
}

.aurora{
    position: fixed;
    inset: -30%;
    z-index: -2;
    pointer-events: none;
    background:
            radial-gradient(1200px 700px at 15% 10%, color-mix(in srgb, var(--acc1) 70%, transparent) , transparent 60%),
            radial-gradient(900px 600px at 85% 20%, color-mix(in srgb, var(--acc2) 65%, transparent) , transparent 60%),
            radial-gradient(1000px 700px at 50% 95%, color-mix(in srgb, var(--acc3) 55%, transparent) , transparent 65%),
            conic-gradient(from 180deg at 50% 50%,
            rgba(255,255,255,.08),
            rgba(255,255,255,0),
            rgba(255,255,255,.06),
            rgba(255,255,255,0),
            rgba(255,255,255,.08)
            );
    filter: blur(42px) saturate(1.25);
    opacity: .85;
    transform: translate3d(0,0,0);
    animation: auroraDrift 18s ease-in-out infinite;
    mix-blend-mode: screen;
}

@keyframes auroraDrift{
    0%   { transform: translate(-1.5%, -1%) scale(1.02) rotate(0deg); }
    45%  { transform: translate(1.6%, 1.2%) scale(1.08) rotate(6deg); }
    100% { transform: translate(-1.5%, -1%) scale(1.02) rotate(0deg); }
}

/* ===== Content ===== */
.wrap{
    width:min(760px, 100%);
    position:relative;
    z-index: 1;
    perspective: 900px;
}

.glass{
    position: relative;
    border:1px solid var(--stroke);
    background: linear-gradient(180deg, var(--cardA), var(--cardB));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow:hidden;
    transform-style: preserve-3d;
    will-change: transform;
}

/* glossy highlight */
.glass::before{
    content:"";
    position:absolute;
    inset:-30%;
    background:
            radial-gradient(550px 280px at var(--mx, 50%) var(--my, 30%),
            rgba(255,255,255,.22), rgba(255,255,255,0) 60%);
    opacity:.45;
    transform: translateZ(1px);
    pointer-events:none;
    transition: opacity .2s ease;
}
body.quack .glass::before{ opacity: .55; }

header{
    padding:22px 22px 14px;
    display:flex;
    gap:16px;
    align-items:center;
    transform: translateZ(10px);
}

.avatar{
    width:54px;height:54px;
    border-radius:16px;
    background:
            radial-gradient(18px 18px at 25% 25%, rgba(255,255,255,.35), transparent 60%),
            linear-gradient(135deg, color-mix(in srgb, var(--acc1) 85%, white), color-mix(in srgb, var(--acc2) 65%, black));
    border:1px solid rgba(255,255,255,.18);
    box-shadow: 0 10px 25px rgba(0,0,0,.35);
    flex:0 0 auto;
    cursor: pointer;
    transition: transform .12s ease;
}
.iconPng{
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 8px 12px rgba(0,0,0,.25));
}
.avatar:hover{ transform: translateY(-1px) scale(1.03); }
.avatar:active{ transform: translateY(0px) scale(0.98); }

.title h1{
    font-size:18px;
    margin:0;
    letter-spacing:.2px;
    line-height:1.2;
}
.title p{
    margin:6px 0 0;
    color:var(--muted);
    font-size:13.5px;
}

.grid{
    padding: 6px 22px 18px;
    display:grid;
    grid-template-columns: 1fr;
    gap:10px;
    transform: translateZ(8px);
}

.link{
    text-decoration:none;
    color:var(--text);
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:14px;
    padding:14px 14px;
    border-radius: 16px;
    border:1px solid rgba(255,255,255,.12);
    background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.02));
    transition: transform .15s ease, background .15s ease, border-color .15s ease;
    min-height: 78px;
    align-items: center;
}
.link:hover{
    transform: translateY(-1px);
    border-color: rgba(255,255,255,.20);
    background: linear-gradient(180deg, rgba(255,255,255,.11), rgba(255,255,255,.03));
}

.left{
    display:flex;
    align-items:center;
    gap:12px;
    min-width:0;
}
.icon{
    width:36px;height:36px;
    border-radius: 14px;
    display:grid;
    place-items:center;
    border:1px solid rgba(255,255,255,.14);
    background: rgba(255,255,255,.06);
    flex:0 0 auto;
}
.icon svg{width:18px;height:18px;opacity:.92}

.meta{min-width:0}
.meta .name{
    font-size:14.5px;
    font-weight:600;
    letter-spacing:.2px;
    white-space: normal;
    overflow: visible;

    display: -webkit-box;
    -webkit-line-clamp: 2;      /* максимум 2 строки */
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
}

.meta .desc{
    margin-top:3px;
    font-size:12.5px;
    color:var(--muted);
    white-space: normal;
    overflow: visible;

    display: -webkit-box;
    -webkit-line-clamp: 2;      /* максимум 2 строки */
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
}

.arrow{
    opacity:.55;
    transition: opacity .15s ease, transform .15s ease;
    flex:0 0 auto;
}
.link:hover .arrow{opacity:.9; transform: translateX(2px);}

footer{
    padding: 10px 22px 18px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    color:var(--muted);
    font-size:12px;
    border-top:1px solid rgba(255,255,255,.08);
    transform: translateZ(6px);
}
.badge{
    display:inline-flex;
    align-items:center;
    gap:8px;
    padding:8px 10px;
    border-radius: 999px;
    border:1px solid rgba(255,255,255,.10);
    background: rgba(255,255,255,.04);
}
.dot{
    width:8px;height:8px;border-radius:50%;
    background: linear-gradient(135deg, var(--acc1), var(--acc2));
    box-shadow: 0 0 18px color-mix(in srgb, var(--acc1) 55%, transparent);
}

@media (min-width: 720px){
    .grid{ grid-template-columns: 1fr 1fr; }
}

/* ===== HUD (hidden until QUACK MODE) ===== */
.hud{
    position: fixed;
    right: 14px;
    top: 14px;
    z-index: 50;
    display:flex;
    align-items:center;
    gap:10px;
    user-select:none;
    pointer-events:none;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity .2s ease, transform .2s ease;
}
body.quack .hud{
    opacity: 1;
    transform: translateY(0);
}
.pill{
    display:inline-flex;
    align-items:center;
    gap:8px;
    padding:10px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.14);
    background: rgba(0,0,0,.28);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 14px 40px rgba(0,0,0,.35);
    font-size:12.5px;
    color: rgba(255,255,255,.88);
}
.pill strong{ font-weight: 700; letter-spacing: .2px; }
.tag{
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.06);
    color: rgba(255,255,255,.78);
}
.tag.on{ background: color-mix(in srgb, var(--acc1) 22%, rgba(255,255,255,.06)); border-color: rgba(255,255,255,.18); }

/* ===== Duck & Comet (only appear in QUACK MODE via JS) ===== */
.duck{
    position: fixed;
    z-index: 60;
    font-size: 40px;
    user-select: none;
    cursor: pointer;
    transform: translate3d(0,0,0);
    filter: drop-shadow(0 16px 22px rgba(0,0,0,.45));
    animation: duckFly var(--dur, 6s) linear forwards;
    will-change: transform;
}
.duck.gold{ font-size: 46px; }
@keyframes duckFly{
    0%   { transform: translate3d(var(--x0, -20vw), var(--y0, 30vh), 0) rotate(var(--r0,-8deg)); opacity: 0; }
    10%  { opacity: 1; }
    55%  { transform: translate3d(var(--x1, 40vw), var(--y1, 20vh), 0) rotate(var(--r1,6deg)); }
    100% { transform: translate3d(var(--x2, 120vw), var(--y2, 35vh), 0) rotate(var(--r2,10deg)); opacity: 0; }
}

.pop{
    position: fixed;
    z-index: 70;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .2px;
    color: rgba(255,255,255,.92);
    text-shadow: 0 10px 20px rgba(0,0,0,.45);
    user-select:none;
    pointer-events:none;
    animation: popUp .9s ease-out forwards;
}
@keyframes popUp{
    0% { transform: translateY(0) scale(.98); opacity: 0; }
    15%{ opacity: 1; }
    100%{ transform: translateY(-26px) scale(1.02); opacity: 0; }
}

.comet{
    position: fixed;
    z-index: 55;
    width: 220px;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,.9), rgba(255,255,255,0));
    filter: drop-shadow(0 16px 20px rgba(0,0,0,.45));
    opacity: .9;
    cursor: pointer;
    transform: rotate(-18deg);
    animation: cometFly 1.45s linear forwards;
}
.comet::before{
    content:"";
    position:absolute;
    left: 70%;
    top: 50%;
    width: 10px;
    height: 10px;
    transform: translate(-50%,-50%);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,1), rgba(255,255,255,0) 70%);
    box-shadow: 0 0 26px rgba(255,255,255,.65);
}
@keyframes cometFly{
    0%   { transform: translate3d(-25vw, -10vh, 0) rotate(-18deg); opacity: 0; }
    10%  { opacity: .95; }
    100% { transform: translate3d(125vw, 110vh, 0) rotate(-18deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce){
    .aurora{ animation:none !important; }
}
/* ===== Mobile: flat background, no aurora/dust ===== */
@media (max-width: 520px){
    body{
        background:
                radial-gradient(900px 520px at 50% 0%,
                rgba(124,58,237,.45),
                transparent 65%
                ),
                radial-gradient(1000px 620px at 50% 110%,
                rgba(59,130,246,.40),
                transparent 70%
                ),
                #070a12 !important;
        min-height: 100svh;                 /* стабильнее чем 100dvh на iOS */
        padding:
                calc(env(safe-area-inset-top) + 12px)
                12px
                calc(env(safe-area-inset-bottom) + 12px)
                12px;
        /*align-items: flex-start;            !* чтобы карточка была сверху (как app) *!*/
    }

    /* убираем эффекты, которые могут давать “кашу” и странности */
    .aurora{ display:none !important; }
    #dust{ display:none !important; }

    /* немного компактнее карточка на мобилке */
    header{ padding: 16px 16px 10px; }
    .grid{ padding: 6px 16px 14px; gap: 10px; }
    footer{ padding: 10px 16px 14px; }
    .link{ min-height: 68px; }
}
body.gyro .glass{
     transition: none !important;
 }