:root {
    --ink: #252a34;
    --ink-soft: rgba(37, 42, 52, 0.54);
    --ink-faint: rgba(37, 42, 52, 0.055);
    --muted: #687184;
    --paper: #edf2f8;
    --card: rgba(255, 255, 255, 0.74);
    --card-strong: rgba(255, 255, 255, 0.88);
    --surface: rgba(255, 255, 255, 0.92);
    --line: rgba(37, 42, 52, 0.16);
    --bar: rgba(248, 250, 254, 0.76);
    --error: #b3402f;
    --green: #4c8a62;
    --accent: #5964d7;
    --accent-strong: #424db5;
    --accent-soft: rgba(89, 100, 215, 0.12);
    --atmosphere-a: rgba(255, 255, 255, 0.3);
    --atmosphere-b: rgba(101, 119, 221, 0.16);
    --vignette: rgba(24, 34, 58, 0.14);
    --hand: "Segoe Print", "Ink Free", "Comic Sans MS", cursive;
    --hand-head: "Ink Free", "Segoe Print", "Comic Sans MS", cursive;
    --sans: "Trebuchet MS", "Segoe UI", sans-serif;
    --scrawl-lg: 24px;
    --scrawl-md: 16px;
    --scrawl-sm: 12px;
    --pencil-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.72),
        0 18px 46px rgba(35, 48, 84, 0.16),
        0 5px 14px rgba(35, 48, 84, 0.08);
    --pencil-shadow-hover:
        inset 0 1px 0 rgba(255, 255, 255, 0.78),
        0 22px 56px rgba(35, 48, 84, 0.21),
        0 7px 18px rgba(35, 48, 84, 0.1);
    --control-shadow: 0 8px 20px rgba(35, 48, 84, 0.11);

    /* sky: defaults = clear day */
    --sky-top: #58a6e8;
    --sky-mid: #9ecdf3;
    --sky-bottom: #e8f4fd;
    --cloud: rgba(255, 255, 255, 0.92);
    --clouds-front: 0.3;
    --clouds-back: 0.18;
    --glow-color: rgba(255, 255, 255, 0.35);
    --glow-opacity: 0;
    --stars-opacity: 0;
    --birds-opacity: 0;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background-color: var(--paper);
    font-family: var(--sans);
}

/* ---------- sky ---------- */

.sky {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 58%, var(--sky-bottom) 100%);
}

.sky::before,
.sky::after {
    content: "";
    position: absolute;
    pointer-events: none;
}

.sky::before {
    inset: -18%;
    z-index: 3;
    background:
        radial-gradient(circle at 18% 30%, var(--atmosphere-a) 0, transparent 31%),
        radial-gradient(circle at 82% 64%, var(--atmosphere-b) 0, transparent 34%);
    filter: blur(24px);
    opacity: 0.76;
    animation: atmosphereDrift 28s ease-in-out infinite alternate;
}

.sky::after {
    inset: 0;
    z-index: 4;
    background:
        linear-gradient(112deg, transparent 28%, rgba(255, 255, 255, 0.09) 46%, transparent 64%),
        radial-gradient(ellipse at center, transparent 48%, var(--vignette) 100%);
    background-size: 190% 100%, 100% 100%;
    opacity: 0.58;
    animation: atmosphereSweep 42s linear infinite;
}

@keyframes atmosphereDrift {
    from { transform: translate3d(-3%, -1%, 0) scale(1.03); }
    to { transform: translate3d(4%, 2%, 0) scale(1.1); }
}

@keyframes atmosphereSweep {
    from { background-position: 130% 0, 0 0; }
    to { background-position: -90% 0, 0 0; }
}

.sky__layer {
    position: absolute;
    inset: 0;
}

.sky__gl {
    width: 100%;
    height: 100%;
}

/* когда работает WebGL-небо, CSS-облака и свечение не нужны */
.sky--gl .sky__clouds,
.sky--gl .sky__glow {
    display: none;
}

.sky__glow {
    opacity: var(--glow-opacity);
    background: radial-gradient(62% 48% at 50% 102%, var(--glow-color), transparent 72%);
    transition: opacity 3s ease;
}

.sky__clouds {
    background-repeat: repeat-x;
    transition: opacity 3s ease;
    animation: cloudDrift linear infinite;
}

.sky__clouds--front {
    opacity: var(--clouds-front);
    background-image:
        radial-gradient(340px 105px at 250px 24%, var(--cloud) 0%, transparent 68%),
        radial-gradient(230px 80px at 590px 42%, var(--cloud) 0%, transparent 70%),
        radial-gradient(430px 125px at 1030px 18%, var(--cloud) 0%, transparent 66%),
        radial-gradient(290px 95px at 1430px 50%, var(--cloud) 0%, transparent 70%);
    background-size: 1700px 100%;
    animation-duration: 280s;
}

.sky__clouds--back {
    opacity: var(--clouds-back);
    background-image:
        radial-gradient(240px 70px at 150px 34%, var(--cloud) 0%, transparent 70%),
        radial-gradient(190px 60px at 520px 14%, var(--cloud) 0%, transparent 72%),
        radial-gradient(280px 80px at 900px 46%, var(--cloud) 0%, transparent 70%),
        radial-gradient(210px 65px at 1300px 26%, var(--cloud) 0%, transparent 72%),
        radial-gradient(170px 55px at 1710px 58%, var(--cloud) 0%, transparent 74%);
    background-size: 1980px 100%;
    animation-duration: 460s;
}

@keyframes cloudDrift {
    from { background-position: 0 0; }
    to { background-position: -1980px 0; }
}

.sky__clouds--front {
    animation-name: cloudDriftFront;
}

@keyframes cloudDriftFront {
    from { background-position: 0 0; }
    to { background-position: -1700px 0; }
}

.sky__stars {
    opacity: var(--stars-opacity);
    background-image:
        radial-gradient(1.3px 1.3px at 24px 34px, rgba(255, 255, 255, 0.95), transparent),
        radial-gradient(1px 1px at 112px 142px, rgba(255, 255, 255, 0.75), transparent),
        radial-gradient(1.7px 1.7px at 196px 64px, rgba(255, 255, 255, 0.95), transparent),
        radial-gradient(1px 1px at 268px 188px, rgba(255, 255, 255, 0.65), transparent),
        radial-gradient(1.2px 1.2px at 334px 96px, rgba(255, 255, 255, 0.85), transparent);
    background-size: 380px 260px;
    transition: opacity 3s ease;
}

.sky__stars--twinkle {
    background-image:
        radial-gradient(1.1px 1.1px at 64px 210px, rgba(255, 255, 255, 0.8), transparent),
        radial-gradient(1.5px 1.5px at 158px 118px, rgba(255, 255, 255, 0.9), transparent),
        radial-gradient(1px 1px at 244px 22px, rgba(255, 255, 255, 0.7), transparent),
        radial-gradient(1.3px 1.3px at 410px 158px, rgba(255, 255, 255, 0.85), transparent);
    background-size: 460px 300px;
    animation: twinkle 6s ease-in-out infinite alternate;
}

@keyframes twinkle {
    from { opacity: calc(var(--stars-opacity) * 0.35); }
    to { opacity: var(--stars-opacity); }
}

.sky__moon {
    opacity: var(--stars-opacity);
    background:
        radial-gradient(circle 30px at 82% 16%, #f2f5ff 0 28px, transparent 31px),
        radial-gradient(circle 96px at 82% 16%, rgba(214, 226, 255, 0.22), transparent 72%);
    transition: opacity 3s ease;
}

/* млечный путь — мягкая диагональная полоса, видна только ночью */
.sky__milkyway {
    opacity: var(--stars-opacity);
    background: linear-gradient(
        115deg,
        transparent 30%,
        rgba(190, 205, 255, 0.08) 42%,
        rgba(222, 232, 255, 0.14) 50%,
        rgba(190, 205, 255, 0.08) 58%,
        transparent 70%
    );
    transition: opacity 3s ease;
}

/* птицы — редкие силуэты, пролетают днём (opacity через --birds-opacity) */
.sky__birds {
    position: absolute;
    width: 120px;
    height: 60px;
    opacity: var(--birds-opacity);
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="120" height="60" viewBox="0 0 120 60"><g fill="none" stroke="%232b3038" stroke-width="2" stroke-linecap="round"><path d="M10 22 q6 -8 12 0 q6 -8 12 0"/><path d="M58 36 q5 -7 10 0 q5 -7 10 0" opacity="0.75"/><path d="M92 14 q4 -6 8 0 q4 -6 8 0" opacity="0.6"/></g></svg>');
    background-repeat: no-repeat;
    pointer-events: none;
    transition: opacity 3s ease;
}

.sky__birds--a {
    top: 16%;
    animation: birdsFly 95s linear infinite;
}

.sky__birds--b {
    top: 32%;
    animation: birdsFly 140s linear infinite 45s;
}

@keyframes birdsFly {
    from { transform: translate(-140px, 0) scale(1); }
    to { transform: translate(calc(100vw + 140px), -50px) scale(0.82); }
}

/* падающие звёзды — видны только ночью (opacity завязана на --stars-opacity) */
.sky__shooting {
    position: absolute;
    width: 120px;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.95), transparent 75%);
    opacity: 0;
    pointer-events: none;
}

.sky__shooting--a {
    top: 14%;
    left: 68%;
    animation: shootingA 13s linear infinite 4s;
}

.sky__shooting--b {
    top: 34%;
    left: 22%;
    width: 90px;
    animation: shootingB 19s linear infinite 11s;
}

@keyframes shootingA {
    0%, 95% {
        opacity: 0;
        transform: rotate(155deg) translateX(0);
    }
    96.5% {
        opacity: var(--stars-opacity);
    }
    100% {
        opacity: 0;
        transform: rotate(155deg) translateX(300px);
    }
}

@keyframes shootingB {
    0%, 96% {
        opacity: 0;
        transform: rotate(200deg) translateX(0);
    }
    97.2% {
        opacity: var(--stars-opacity);
    }
    100% {
        opacity: 0;
        transform: rotate(200deg) translateX(260px);
    }
}

/* ---------- sky phases ---------- */

body.sky-morning {
    --sky-top: #86a9d6;
    --sky-mid: #f0ca9e;
    --sky-bottom: #fde4bd;
    --cloud: rgba(255, 238, 218, 0.92);
    --clouds-front: 0.6;
    --clouds-back: 0.4;
    --glow-color: rgba(255, 214, 150, 0.85);
    --glow-opacity: 0.6;
    --atmosphere-a: rgba(255, 239, 216, 0.38);
    --atmosphere-b: rgba(255, 182, 130, 0.18);
}

body.sky-day {
    --birds-opacity: 0.45;
}

body.sky-midday {
    --clouds-front: 0.85;
    --clouds-back: 0.55;
}

body.sky-evening {
    --sky-top: #6d76b4;
    --sky-mid: #e39a83;
    --sky-bottom: #ffd6a0;
    --cloud: rgba(255, 219, 184, 0.92);
    --clouds-front: 0.65;
    --clouds-back: 0.45;
    --glow-color: rgba(255, 165, 96, 0.9);
    --glow-opacity: 0.7;
    --atmosphere-a: rgba(255, 205, 172, 0.3);
    --atmosphere-b: rgba(126, 113, 196, 0.24);
    --ink: #363240;
    --ink-soft: rgba(54, 50, 64, 0.44);
    --ink-faint: rgba(84, 69, 96, 0.045);
    --muted: #746d7e;
    --card: rgba(255, 249, 246, 0.7);
    --card-strong: rgba(255, 250, 247, 0.84);
    --surface: rgba(255, 252, 249, 0.9);
    --line: rgba(76, 61, 86, 0.1);
    --bar: rgba(255, 247, 244, 0.7);
    --accent: #6f68b2;
    --accent-strong: #57518f;
    --accent-soft: rgba(111, 104, 178, 0.11);
    --vignette: rgba(61, 45, 76, 0.12);
    --pencil-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.66),
        0 18px 46px rgba(73, 54, 91, 0.12),
        0 5px 14px rgba(92, 59, 70, 0.06);
    --pencil-shadow-hover:
        inset 0 1px 0 rgba(255, 255, 255, 0.74),
        0 22px 56px rgba(73, 54, 91, 0.16),
        0 7px 18px rgba(92, 59, 70, 0.08);
    --control-shadow: 0 8px 20px rgba(73, 54, 91, 0.08);
}

body.sky-night {
    --sky-top: #070b1d;
    --sky-mid: #101731;
    --sky-bottom: #1a2340;
    --clouds-front: 0;
    --clouds-back: 0;
    --glow-opacity: 0;
    --stars-opacity: 1;

    --ink: #e8edf8;
    --ink-soft: rgba(232, 237, 248, 0.5);
    --ink-faint: rgba(232, 237, 248, 0.07);
    --muted: #a3adc6;
    --paper: #0d1226;
    --card: rgba(15, 21, 42, 0.72);
    --card-strong: rgba(22, 30, 56, 0.88);
    --surface: rgba(31, 40, 72, 0.94);
    --line: rgba(232, 237, 248, 0.16);
    --bar: rgba(10, 15, 32, 0.78);
    --error: #ff9b85;
    --accent: #9ba5ff;
    --accent-strong: #bac1ff;
    --accent-soft: rgba(155, 165, 255, 0.14);
    --atmosphere-a: rgba(92, 110, 205, 0.18);
    --atmosphere-b: rgba(74, 121, 188, 0.14);
    --vignette: rgba(1, 4, 14, 0.42);
    --pencil-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 18px 46px rgba(0, 0, 0, 0.34),
        0 5px 14px rgba(0, 0, 0, 0.22);
    --pencil-shadow-hover:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 22px 56px rgba(0, 0, 0, 0.44),
        0 7px 18px rgba(0, 0, 0, 0.28);
    --control-shadow: 0 8px 20px rgba(0, 0, 0, 0.24);
}

body.sky-night .primary-action img,
body.sky-night .download-rail img {
    filter: brightness(0);
}

body.sky-night .side-nav__item img,
body.sky-night .icon-button img,
body.sky-night .search img,
body.sky-night .heading-icon,
body.sky-night .stub-panel img,
body.sky-night .download-panel img,
body.sky-night .secondary-action img,
body.sky-night .view-all img,
body.sky-night .robux-card img {
    filter: invert(1);
}

body.sky-night .game-art,
body.sky-night .item-art {
    filter: saturate(0.65) brightness(0.98);
}

.auth-wrap,
.app-shell {
    position: relative;
    z-index: 1;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

[data-page],
.person-avatar,
.person-meta a,
.profile-friend,
.profile-stats a,
.profile-panel__heading a {
    color: inherit;
    text-decoration: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 3px solid var(--accent-soft);
    outline-offset: 3px;
}

button:disabled {
    cursor: wait;
    opacity: 0.64;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 236px 1fr;
    grid-template-rows: 70px 1fr;
}

/* ---------- topbar ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 22px;
    padding: 0 24px;
    border-bottom: 1px solid var(--line);
    background: var(--bar);
    -webkit-backdrop-filter: blur(18px) saturate(1.08);
    backdrop-filter: blur(18px) saturate(1.08);
    box-shadow: 0 10px 30px rgba(28, 42, 78, 0.08);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--ink);
    transform: rotate(-0.8deg);
}

.brand img {
    width: 52px;
    height: auto;
    display: block;
}

.brand span {
    font-family: var(--hand-head);
    font-size: 30px;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.topnav {
    display: flex;
    align-items: center;
    gap: 24px;
}

.topnav__item,
.view-all,
.side-nav__item {
    border: 0;
    background: transparent;
    color: var(--ink);
    font-family: var(--sans);
}

.topnav__item {
    position: relative;
    padding: 10px 0;
    font-size: 15px;
    font-weight: 700;
}

.topnav__item::after {
    content: "";
    position: absolute;
    left: -3px;
    right: -3px;
    bottom: 2px;
    height: 3px;
    border-radius: 999px;
    background: var(--accent);
    transform: scaleX(0);
    transition: transform 160ms ease;
}

.topnav__item:hover::after,
.topnav__item.is-active::after {
    transform: scaleX(1);
}

.search {
    width: min(520px, 32vw);
    min-width: 300px;
    height: 42px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 15px;
    border: 1px solid var(--line);
    border-radius: var(--scrawl-sm);
    background: var(--card);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.54);
    transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.search:focus-within {
    border-color: var(--accent);
    background: var(--surface);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.search img {
    width: 21px;
    height: 21px;
    opacity: 0.75;
}

.search input {
    border: 0;
    outline: 0;
    width: 100%;
    color: var(--ink);
    background: transparent;
    font-size: 16px;
}

.search input::placeholder {
    color: var(--muted);
}

.wallet {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 5px 11px 5px 7px;
    border: 1px solid transparent;
    border-radius: 14px;
    background: transparent;
    color: var(--ink);
    font-size: 18px;
    font-weight: 700;
    font-family: var(--sans);
    transition: border-color 160ms ease, background 160ms ease;
}

.wallet:hover {
    border-color: var(--line);
    background: var(--card);
}

.wallet__coin {
    position: relative;
    width: 32px;
    height: 32px;
    display: inline-block;
    flex: 0 0 auto;
    border: 0;
    border-radius: 9px;
    background: linear-gradient(145deg, var(--accent), var(--accent-strong));
    box-shadow:
        inset 0 0 0 2px rgba(255, 255, 255, 0.24),
        0 5px 12px rgba(47, 57, 145, 0.24);
    color: transparent;
    font-size: 0;
    transform: rotate(12deg);
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.wallet__coin::after {
    content: "";
    position: absolute;
    width: 10px;
    height: 10px;
    left: 50%;
    top: 50%;
    border-radius: 3px;
    background: var(--surface);
    box-shadow: inset 0 1px 3px rgba(24, 31, 56, 0.28);
    transform: translate(-50%, -50%);
}

.wallet:hover .wallet__coin {
    box-shadow:
        inset 0 0 0 2px rgba(255, 255, 255, 0.3),
        0 7px 16px rgba(47, 57, 145, 0.3);
    transform: rotate(18deg) translateY(-1px);
}

.wallet__coin--big {
    width: 52px;
    height: 52px;
    border-radius: 14px;
}

.wallet__coin--big::after {
    width: 17px;
    height: 17px;
    border-radius: 5px;
}

.icon-button {
    position: relative;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: var(--scrawl-sm);
    background: var(--card);
    box-shadow: var(--control-shadow);
    transition: transform 160ms ease;
}

.icon-button:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.icon-button img {
    width: 23px;
    height: 23px;
    display: block;
}

.icon-button .badge {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 21px;
    height: 21px;
    display: grid;
    place-items: center;
    border-radius: 52% 48% 50% 50% / 48% 52% 48% 52%;
    background: var(--ink);
    color: var(--paper);
    font-size: 12px;
    font-weight: 700;
}

.settings-menu {
    position: relative;
    flex: 0 0 auto;
}

.settings-menu__popover,
.profile-overflow__menu {
    position: absolute;
    z-index: 40;
    right: 0;
    top: calc(100% + 8px);
    width: 168px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--card-strong);
    box-shadow: var(--pencil-shadow-hover);
}

.settings-menu__popover a,
.settings-menu__popover button,
.profile-overflow__menu a,
.profile-overflow__menu button {
    width: 100%;
    min-height: 42px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    border: 0;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    background: transparent;
    text-align: left;
    font: 650 14px var(--sans);
}

.settings-menu__popover > *:last-child,
.profile-overflow__menu > *:last-child {
    border-bottom: 0;
}

.settings-menu__popover a:hover,
.settings-menu__popover button:hover,
.profile-overflow__menu a:hover,
.profile-overflow__menu button:hover {
    background: var(--accent-soft);
}

.profile-overflow__menu button:disabled {
    cursor: not-allowed;
    color: var(--muted);
    opacity: 0.62;
}

/* ---------- sidebar ---------- */

.sidebar {
    position: sticky;
    top: 70px;
    height: calc(100vh - 70px);
    padding: 18px 14px;
    border-right: 1px solid var(--line);
    background: var(--bar);
    -webkit-backdrop-filter: blur(18px) saturate(1.08);
    backdrop-filter: blur(18px) saturate(1.08);
    box-shadow: 12px 0 34px rgba(28, 42, 78, 0.07);
}

.user-chip {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 9px 10px;
    border: 1px solid transparent;
    border-radius: var(--scrawl-md);
    background: transparent;
    color: var(--ink);
    text-align: left;
    transition: border-color 160ms ease, transform 160ms ease;
}

.user-chip:hover {
    border-color: var(--line);
    background: var(--card);
}

.user-chip__avatar {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
}

.user-chip__meta {
    display: grid;
    gap: 2px;
}

.user-chip__meta strong {
    font-family: var(--sans);
    font-size: 16px;
}

.user-chip__meta span {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.side-nav {
    display: grid;
    gap: 5px;
}

.side-nav__item {
    height: 44px;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: var(--scrawl-md);
    font-size: 15px;
    font-weight: 600;
    text-align: left;
    transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.side-nav__item img {
    width: 23px;
    height: 23px;
    object-fit: contain;
    opacity: 0.85;
}

.side-nav__item:hover,
.side-nav__item.is-active {
    border-color: var(--accent-soft);
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.side-nav__item:hover {
    transform: translateX(2px);
}

.side-nav__item:nth-child(even):hover {
    transform: translateX(2px);
}

.download-rail {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 20px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border: 0;
    border-radius: var(--scrawl-md);
    color: var(--paper);
    background: var(--accent);
    box-shadow: var(--pencil-shadow);
    font-family: var(--sans);
    font-size: 15px;
    font-weight: 700;
    transition: background 160ms ease, transform 160ms ease;
}

.download-rail:hover {
    background: var(--accent-strong);
    transform: translateY(-2px);
}

.download-rail img {
    width: 26px;
    filter: brightness(0) invert(1);
}

/* ---------- content / pages ---------- */

.content {
    padding: 30px clamp(20px, 3vw, 48px) 84px;
    overflow: hidden;
}

.page {
    display: none;
    animation: pageIn 320ms ease-out both;
}

.page.is-active {
    display: block;
}

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

.hero-card,
.page-card {
    border: 1px solid var(--line);
    border-radius: var(--scrawl-lg);
    background: var(--card);
    box-shadow: var(--pencil-shadow);
    -webkit-backdrop-filter: blur(18px) saturate(1.06);
    backdrop-filter: blur(18px) saturate(1.06);
}

.hero-card {
    position: relative;
    min-height: 210px;
    display: flex;
    align-items: center;
    gap: 34px;
    padding: 30px 40px;
    background: linear-gradient(135deg, var(--card-strong), var(--card));
}

.avatar-orb {
    position: relative;
    flex: 0 0 auto;
    width: 150px;
    height: 150px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    box-shadow: 0 10px 30px rgba(35, 48, 84, 0.1);
    display: grid;
    place-items: center;
    overflow: hidden;
    color: var(--accent-strong);
    font: 800 46px var(--sans);
}

.avatar-orb img {
    position: absolute;
    top: -50%;
    left: 50%;
    width: 360%;
    height: 360%;
    max-width: none;
    object-fit: contain;
    transform: translateX(-50%);
}

.avatar-orb--small {
    width: 132px;
    height: 132px;
    border-width: 2.5px;
}

.hero-profile {
    display: grid;
    gap: 10px;
}

.hero-profile p {
    color: var(--muted);
    font-size: 16px;
    font-weight: 600;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-family: var(--hand-head);
    font-size: clamp(34px, 4vw, 46px);
    font-weight: 700;
    letter-spacing: 0.04em;
}

h2 {
    font-family: var(--hand-head);
    font-size: 25px;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.empty-state__icon {
    width: 42px;
    height: 42px;
    opacity: 0.7;
}

.primary-action,
.secondary-action {
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border-radius: var(--scrawl-sm);
    padding: 0 22px;
    font-family: var(--sans);
    font-size: 15px;
    font-weight: 700;
    transition: transform 160ms ease;
}

.primary-action:hover,
.secondary-action:hover {
    transform: translateY(-2px);
}

.primary-action:hover {
    background: var(--accent-strong);
}

.primary-action {
    border: 1px solid var(--accent);
    color: var(--paper);
    background: var(--accent);
    box-shadow: var(--pencil-shadow);
    text-decoration: none;
}

.secondary-action {
    border: 1px solid var(--line);
    color: var(--ink);
    background: var(--surface);
    box-shadow: var(--pencil-shadow);
}

.primary-action img,
.secondary-action img {
    width: 23px;
    height: 23px;
    object-fit: contain;
}

.primary-action img {
    filter: brightness(0) invert(1);
}

.online-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--green);
}

.stub-panel {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 34px 28px;
    border: 1px dashed var(--ink-soft);
    border-radius: var(--scrawl-md);
    background: var(--card);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: var(--muted);
    font-size: 15px;
    font-weight: 600;
}

.stub-panel img {
    width: 34px;
    height: 34px;
    opacity: 0.6;
}

.home-section {
    margin-top: 32px;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 16px;
}

.section-heading h2 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.heading-icon {
    width: 23px;
    height: 23px;
    opacity: 0.8;
}

.view-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 16px;
    font-weight: 600;
    border-bottom: 2px dashed var(--ink-soft);
    padding-bottom: 2px;
}

.view-all img {
    width: 17px;
    opacity: 0.7;
}

/* ---------- game / item cards ---------- */

.popular-grid,
.catalog-grid {
    display: grid;
    gap: 24px;
}

.popular-grid {
    grid-template-columns: repeat(4, minmax(170px, 1fr));
    gap: 16px;
}

.catalog-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.item-card {
    border: 1px solid var(--line);
    border-radius: var(--scrawl-md);
    background: var(--card-strong);
    box-shadow: var(--control-shadow);
    overflow: hidden;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.item-card:nth-child(odd) {
    transform: none;
}

.item-card:nth-child(even) {
    transform: none;
}

.item-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--pencil-shadow-hover);
}

.game-art {
    height: 130px;
    margin: 12px 12px 0;
    border: 0;
    border-radius: var(--scrawl-sm);
    background:
        radial-gradient(circle at 20% 22%, rgba(255,255,255,0.9), transparent 10%),
        linear-gradient(135deg, var(--art-a), var(--art-b));
    filter: saturate(0.6) brightness(1.12);
    position: relative;
    overflow: hidden;
}

.game-card {
    min-width: 0;
}

.game-card:hover .game-art {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(22, 31, 56, 0.18);
}

.game-art::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(130deg, transparent 0 42%, rgba(255,255,255,0.18) 43% 47%, transparent 48%),
        radial-gradient(circle at 80% 70%, rgba(0,0,0,0.28), transparent 36%);
}

.game-art::after {
    content: "";
    position: absolute;
    left: 12%;
    right: 8%;
    bottom: 0;
    height: 40%;
    background: linear-gradient(180deg, transparent, rgba(10, 18, 30, 0.5));
    clip-path: polygon(0 90%, 14% 45%, 26% 76%, 40% 30%, 54% 78%, 69% 38%, 84% 72%, 100% 20%, 100% 100%, 0 100%);
}

.game-card__body {
    padding: 8px 1px 0;
}

.game-card h3 {
    min-height: 38px;
    margin: 0 0 5px;
    overflow: hidden;
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 800;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.game-card h3 a {
    color: inherit;
}

.game-card__link {
    display: block;
}

.game-card__metrics {
    display: flex;
    align-items: center;
    gap: 13px;
    color: var(--muted);
    font: 750 12px var(--sans);
}

.game-card__metrics span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.game-card__metrics img {
    width: 14px;
    height: 14px;
    opacity: 0.72;
}

.progress-row,
.stats-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.progress {
    flex: 1;
    height: 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    overflow: hidden;
}

.progress span {
    display: block;
    height: 100%;
    width: var(--progress);
    background: repeating-linear-gradient(
        -55deg,
        var(--ink) 0 3px,
        transparent 3px 7px
    );
}

.continue-button {
    border: 1px solid var(--line);
    border-radius: var(--scrawl-sm);
    background: var(--surface);
    padding: 6px 14px;
    color: var(--ink);
    font-family: var(--sans);
    font-weight: 700;
    transition: transform 140ms ease;
}

.continue-button:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.stats-row {
    justify-content: flex-start;
    gap: 8px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
}

/* ---------- page cards ---------- */

.page-card {
    padding: 32px;
}

.page-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}

.eyebrow {
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.muted {
    max-width: 680px;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.65;
}

/* второстепенный текст — чистым шрифтом, рукописный оставляем заголовкам и навигации */
.muted,
.eyebrow,
.item-price,
.stats-row,
.user-chip__meta span,
.search input,
.auth-field,
.auth-error,
.stub-panel,
.hero-profile p {
    font-family: var(--sans);
}

.item-art {
    height: 150px;
    display: grid;
    place-items: center;
    margin: 12px 12px 0;
    border: 0;
    border-radius: var(--scrawl-sm);
    background:
        radial-gradient(circle at 24% 20%, rgba(255, 255, 255, 0.35), transparent 42%),
        linear-gradient(135deg, var(--art-a), var(--art-b));
    filter: saturate(0.6) brightness(1.12);
}

.item-art img {
    width: 56px;
    height: 56px;
    filter: brightness(0) invert(1);
    opacity: 0.92;
}

.item-card h3 {
    margin: 14px 16px 5px;
    font-family: var(--sans);
    font-size: 17px;
    font-weight: 700;
}

.item-price {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 16px 16px;
    font-size: 16px;
    font-weight: 700;
}

.item-price .wallet__coin {
    width: 25px;
    height: 25px;
    border-radius: 7px;
}

.item-price .wallet__coin::after {
    width: 8px;
    height: 8px;
    border-radius: 2px;
}

/* ---------- live API surfaces ---------- */

.games-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.game-art--image,
.item-art--image {
    background: var(--surface);
    filter: none;
}

.game-card .game-art {
    height: auto;
    aspect-ratio: 16 / 9;
    margin: 0;
    border-radius: 9px;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.game-art--image::before,
.game-art--image::after {
    display: none;
}

.game-art--image img,
.item-art--image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: none;
    opacity: 1;
}

.item-card__body {
    display: grid;
    gap: 8px;
    padding: 14px 16px 16px;
}

.item-card__body h3,
.item-card__body .item-price {
    margin: 0;
}

.item-type {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.card-copy {
    min-height: 40px;
    margin: -4px 0 12px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.compact-action {
    height: 36px;
    min-width: 84px;
    padding: 0 14px;
    font-size: 13px;
}

button:disabled {
    cursor: default;
    opacity: 0.58;
    transform: none !important;
}

.inline-empty {
    grid-column: 1 / -1;
    padding: 28px;
    border: 1px dashed var(--ink-soft);
    border-radius: var(--scrawl-md);
    color: var(--muted);
    background: var(--card);
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 650;
    text-align: center;
}

.avatar-editor,
.friends-page {
    display: grid;
    gap: 24px;
}

.avatar-editor__header {
    margin-bottom: 0;
}

.avatar-editor__actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-workspace {
    display: grid;
    grid-template-columns: minmax(250px, 286px) minmax(0, 1fr);
    align-items: start;
    gap: 20px;
}

.avatar-preview-panel,
.avatar-library {
    border: 1px solid var(--line);
    background: var(--card);
    box-shadow: var(--control-shadow);
}

.avatar-preview-panel {
    position: sticky;
    top: 96px;
    display: grid;
    gap: 10px;
    padding: 10px;
    border-radius: 16px;
}

.avatar-preview {
    position: relative;
    display: grid;
    gap: 9px;
}

.avatar-preview__mode {
    position: absolute;
    z-index: 6;
    top: 12px;
    right: 12px;
    display: inline-flex;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--control-shadow);
    backdrop-filter: blur(10px);
}

.avatar-preview__mode-button {
    min-width: 42px;
    height: 32px;
    padding: 0 10px;
    border: 0;
    border-radius: 8px 7px 9px 7px;
    color: var(--muted);
    background: transparent;
    font: 800 12px var(--sans);
    cursor: pointer;
}

.avatar-preview__mode-button:hover,
.avatar-preview__mode-button.is-active {
    color: #fff;
    background: var(--accent);
}

.avatar-preview__mode-button:focus-visible {
    outline-color: rgba(89, 100, 215, 0.42);
    outline-offset: 2px;
}

.avatar-preview-stage {
    position: relative;
    height: auto;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background:
        radial-gradient(circle at 50% 25%, rgba(255, 255, 255, 0.9), transparent 34%),
        linear-gradient(155deg, var(--accent-soft), var(--surface) 60%, rgba(177, 188, 214, 0.42));
}

.avatar-preview-stage::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(115deg, rgba(255, 255, 255, 0.26), transparent 38%),
        linear-gradient(0deg, rgba(80, 58, 41, 0.16), transparent 31%);
}

.avatar-preview__image,
.avatar-preview__canvas {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    user-select: none;
}

.avatar-preview__canvas {
    cursor: grab;
    touch-action: none;
}

.avatar-preview__canvas:focus-visible {
    outline: 3px solid rgba(89, 100, 215, 0.52);
    outline-offset: -5px;
    border-radius: 14px 18px 15px 20px;
}

.avatar-preview.is-dragging .avatar-preview__canvas {
    cursor: grabbing;
}

.avatar-preview__loading,
.avatar-preview__error {
    position: absolute;
    z-index: 4;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    padding: 36px 24px;
    color: var(--muted);
    background: var(--card-strong);
    font: 750 13px/1.45 var(--sans);
    text-align: center;
    backdrop-filter: blur(7px);
}

.avatar-preview__error strong {
    color: var(--ink);
    font: 800 18px var(--sans);
}

.avatar-preview__error span {
    max-width: 230px;
}

.avatar-preview[data-preview-state="offline"] .avatar-preview__error {
    background: var(--surface);
}

.avatar-preview__spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(89, 100, 215, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: avatarSpinner 800ms linear infinite;
}

@keyframes avatarSpinner {
    to { transform: rotate(360deg); }
}

.avatar-preview__hint {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}

.avatar-preview-panel__meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.avatar-preview-panel__meta > div {
    display: grid;
    gap: 3px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: var(--scrawl-sm);
    background: var(--surface);
}

.avatar-preview-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
    text-transform: uppercase;
}

.avatar-preview-panel__meta strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}

.avatar-redraw {
    width: 100%;
    min-height: 39px;
}

.avatar-preview--compact .avatar-preview-stage {
    aspect-ratio: 1 / 1;
}

.avatar-preview--compact .avatar-preview__mode,
.avatar-preview--profile .avatar-preview__mode {
    top: 9px;
    right: 9px;
}

.avatar-preview--compact .avatar-preview__mode-button,
.avatar-preview--profile .avatar-preview__mode-button {
    min-width: 36px;
    height: 28px;
    padding: 0 7px;
}

.avatar-library {
    min-width: 0;
    overflow: hidden;
    border-radius: 17px 21px 15px 19px;
}

.avatar-category-nav {
    position: relative;
    z-index: 12;
}

.avatar-tabs {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    border-bottom: 1px solid var(--line);
    background: var(--bar);
    overscroll-behavior-inline: contain;
}

.avatar-tab,
.friends-tab {
    position: relative;
    min-height: 54px;
    border: 0;
    color: var(--muted);
    background: transparent;
    font: 800 13px var(--sans);
    cursor: pointer;
}

.avatar-tab {
    padding: 0 19px 0 10px;
    white-space: nowrap;
}

.avatar-tab::before {
    content: "";
    position: absolute;
    top: 50%;
    right: 9px;
    width: 6px;
    height: 6px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-70%) rotate(45deg);
    opacity: 0.7;
}

.avatar-tab::after,
.friends-tab::after {
    content: "";
    position: absolute;
    right: 16%;
    bottom: 0;
    left: 16%;
    height: 3px;
    border-radius: 999px 700px 999px 620px;
    background: transparent;
    transform: rotate(-0.4deg);
}

.avatar-tab:hover,
.avatar-tab.is-active,
.friends-tab:hover,
.friends-tab.is-active {
    color: var(--ink);
    background: var(--ink-faint);
}

.avatar-tab.is-active::after,
.friends-tab.is-active::after {
    background: var(--accent);
}

.avatar-category-flyout {
    position: absolute;
    z-index: 30;
    top: calc(100% - 1px);
    left: 8px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    width: max-content;
    max-width: calc(100% - 16px);
    max-height: 176px;
    overflow: auto;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 0 0 12px 10px;
    background: var(--surface);
    box-shadow: var(--pencil-shadow-hover);
    backdrop-filter: blur(16px);
    animation: avatarFlyoutIn 120ms ease-out;
}

@keyframes avatarFlyoutIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.avatar-subtab {
    min-height: 34px;
    padding: 0 11px;
    border: 1px solid transparent;
    border-radius: 9px 7px 10px 8px;
    color: var(--muted);
    background: transparent;
    font: 750 12px var(--sans);
    cursor: pointer;
}

.avatar-subtab:hover,
.avatar-subtab:focus-visible,
.avatar-subtab.is-active {
    border-color: var(--line);
    color: var(--accent-strong);
    background: var(--accent-soft);
}

.avatar-library__heading,
.friends-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.avatar-library__heading {
    padding: 20px 18px 13px;
}

.avatar-library__heading h2,
.friends-toolbar h2 {
    margin: 3px 0 0;
}

.avatar-library__heading .eyebrow,
.friends-toolbar .eyebrow {
    margin: 0;
}

.avatar-item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 12px;
    padding: 0 18px 20px;
}

.avatar-item-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 13px 16px 12px 15px;
    background: var(--card-strong);
    box-shadow: 0 7px 16px rgba(35, 48, 84, 0.08);
    transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.avatar-item-card:hover {
    border-color: var(--accent);
    box-shadow: var(--control-shadow);
    transform: translateY(-2px) rotate(-0.15deg);
}

.avatar-item-card.is-equipped {
    border-color: rgba(89, 100, 215, 0.48);
}

.avatar-item-card__art {
    position: relative;
    height: 134px;
    padding: 7px;
    border-bottom: 1px solid var(--line);
    background:
        radial-gradient(circle at 28% 20%, rgba(255, 255, 255, 0.55), transparent 38%),
        var(--accent-soft);
}

.avatar-item-card__art img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.avatar-item-card__check {
    position: absolute;
    top: 9px;
    right: 9px;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 9px 7px 10px 8px;
    color: var(--paper);
    background: var(--accent);
    box-shadow: var(--control-shadow);
    font-size: 16px;
    font-weight: 900;
}

.avatar-item-card__body {
    display: grid;
    gap: 7px;
    padding: 10px;
}

.avatar-item-card__body h3 {
    min-height: 36px;
    margin: 0;
    overflow: hidden;
    font: 750 14px/1.35 var(--sans);
}

.avatar-item-card__body .compact-action {
    width: 100%;
}

.import-panel {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(210px, 320px) auto;
    align-items: center;
    gap: 20px;
    padding: 22px;
    border: 1px dashed var(--ink-soft);
    border-radius: var(--scrawl-md);
    background: var(--card);
}

.import-panel h2,
.inventory-heading h2 {
    margin: 0 0 6px;
}

.avatar-import-panel {
    border-style: solid;
}

.inline-field input,
.friend-search input {
    width: 100%;
    height: 46px;
    border: 1px solid var(--line);
    border-radius: var(--scrawl-sm);
    padding: 0 15px;
    color: var(--ink);
    background: var(--surface);
    box-shadow: var(--control-shadow);
    font: 650 14px var(--sans);
    outline: none;
}

.inline-field input:focus,
.friend-search input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft), var(--control-shadow);
}

.inline-message {
    padding: 12px 15px;
    border-left: 3px solid var(--accent);
    color: var(--muted);
    background: var(--accent-soft);
    font: 650 14px/1.5 var(--sans);
}

.friend-search {
    display: grid;
    grid-template-columns: minmax(210px, 360px) auto;
    gap: 12px;
    justify-content: start;
}

.friends-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 15px 18px 12px 16px;
    background: var(--bar);
}

.friends-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-count {
    min-width: 24px;
    height: 24px;
    display: inline-grid;
    place-items: center;
    padding: 0 6px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    background: var(--surface);
    font-size: 11px;
}

.friends-panel {
    display: grid;
    gap: 20px;
}

.friends-panel[hidden] {
    display: none;
}

.friends-toolbar {
    min-height: 54px;
}

.friend-search-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}

.friend-search-results:empty {
    display: none;
}

.people-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
}

.people-grid:empty,
.friend-search-results:empty {
    display: none;
}

.person-card {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px 18px 13px 16px;
    background: var(--card-strong);
    box-shadow: var(--control-shadow);
}

.person-avatar {
    position: relative;
    flex: 0 0 auto;
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--paper);
    background:
        radial-gradient(circle at 32% 25%, rgba(255, 255, 255, 0.42), transparent 33%),
        linear-gradient(145deg, var(--accent), var(--accent-strong));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.46), 0 7px 15px rgba(35, 48, 84, 0.13);
    font: 800 23px var(--hand-head);
    overflow: hidden;
}

.person-avatar-link {
    width: 64px;
    height: 64px;
    display: block;
}

.person-avatar img {
    position: absolute;
    top: -50%;
    left: 50%;
    width: 360%;
    height: 360%;
    max-width: none;
    object-fit: contain;
    transform: translateX(-50%);
}

.person-meta {
    min-width: 0;
    display: grid;
    gap: 3px;
    margin-right: auto;
}

.person-meta strong,
.person-meta span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.person-meta span {
    color: var(--muted);
    font-size: 12px;
}

.person-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 8px;
}

.person-actions > button {
    flex: 1;
}

.outgoing-requests {
    display: grid;
    gap: 12px;
    padding-top: 4px;
}

.outgoing-requests[hidden] {
    display: none;
}

.app-notice {
    position: fixed;
    z-index: 100;
    right: 24px;
    bottom: 24px;
    max-width: min(420px, calc(100vw - 32px));
    padding: 14px 18px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--green);
    border-radius: var(--scrawl-sm);
    color: var(--ink);
    background: var(--card-strong);
    box-shadow: var(--pencil-shadow-hover);
    font: 700 14px/1.45 var(--sans);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
}

.app-notice.is-error {
    border-left-color: #c84b54;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- robux ---------- */

.robux-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    max-width: 860px;
}

.robux-card {
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 30px 22px;
    border: 1px solid var(--line);
    border-radius: var(--scrawl-md);
    background: var(--card-strong);
    text-align: center;
    box-shadow: var(--control-shadow);
    transform: none;
}

.robux-card:nth-child(even) {
    transform: none;
}

.robux-card--featured {
    background:
        repeating-linear-gradient(-55deg, var(--ink-faint) 0 5px, transparent 5px 12px),
        var(--surface);
    box-shadow: var(--pencil-shadow-hover);
}

.robux-card img {
    width: 44px;
    height: 44px;
    opacity: 0.85;
}

.robux-card h3 {
    margin: 0;
    font-family: var(--hand-head);
    font-size: 30px;
    font-weight: 700;
}

/* ---------- download / profile / empty ---------- */

.download-page {
    display: grid;
    gap: 28px;
}

.download-panel {
    display: flex;
    align-items: center;
    gap: 18px;
    max-width: 720px;
    padding: 22px;
    border: 1px dashed var(--ink-soft);
    border-radius: var(--scrawl-md);
    background: var(--card);
}

.download-panel img {
    width: 46px;
}

.download-panel .primary-action {
    margin-left: auto;
}

.inventory-page,
.profile-page {
    display: grid;
    gap: 24px;
}

.inventory-page__header,
.inventory-content__header,
.profile-panel__heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.inventory-page__header h1,
.inventory-content__header h2,
.inventory-sidebar h2,
.profile-panel h2 {
    margin: 0;
}

.inventory-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    min-height: 560px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 18px 15px 20px 16px;
    background: var(--card);
    box-shadow: var(--control-shadow);
}

.inventory-sidebar {
    padding: 18px 13px;
    border-right: 1px solid var(--line);
    background: var(--bar);
}

.inventory-avatar-preview {
    margin: -5px -1px 16px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--line);
}

.inventory-sidebar h2 {
    padding: 0 10px 12px;
    font-size: 17px;
}

.inventory-category {
    position: relative;
    width: 100%;
    min-height: 43px;
    padding: 0 29px 0 12px;
    border: 1px solid transparent;
    border-radius: 10px 8px 11px 9px;
    color: var(--muted);
    background: transparent;
    font: 750 13px var(--sans);
    text-align: left;
}

.inventory-category::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 13px;
    width: 6px;
    height: 6px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-50%) rotate(-45deg);
}

.inventory-category:hover,
.inventory-category.is-active {
    border-color: var(--line);
    color: var(--ink);
    background: var(--surface);
}

.inventory-category.is-active {
    box-shadow: inset 3px 0 0 var(--accent);
}

.inventory-content {
    min-width: 0;
    padding: 22px;
}

.inventory-content__header {
    margin-bottom: 14px;
}

.inventory-breadcrumb {
    margin: 0 0 5px;
    color: var(--muted);
    font: 700 12px var(--sans);
}

.inventory-subcategories {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 18px;
    padding-bottom: 13px;
    border-bottom: 1px solid var(--line);
}

.inventory-subcategories[hidden] {
    display: none;
}

.inventory-subcategory {
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 9px 7px 10px 8px;
    color: var(--muted);
    background: var(--card);
    font: 750 12px var(--sans);
}

.inventory-subcategory:hover,
.inventory-subcategory.is-active {
    color: var(--accent-strong);
    background: var(--accent-soft);
}

.inventory-subcategory[aria-disabled="true"] {
    opacity: 0.42;
    cursor: default;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 15px;
}

.inventory-item-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px 17px 13px 16px;
    background: var(--card-strong);
    box-shadow: 0 8px 18px rgba(35, 48, 84, 0.08);
    transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.inventory-item-card:hover {
    border-color: var(--accent);
    box-shadow: var(--control-shadow);
    transform: translateY(-2px);
}

.inventory-item-card__art {
    position: relative;
    height: 170px;
    padding: 10px;
    border-bottom: 1px solid var(--line);
    background:
        radial-gradient(circle at 30% 21%, rgba(255, 255, 255, 0.34), transparent 38%),
        var(--accent-soft);
}

.inventory-item-card__art img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.inventory-wearing {
    position: absolute;
    top: 9px;
    right: 9px;
    padding: 5px 8px;
    border-radius: 8px 7px 9px 7px;
    color: var(--paper);
    background: var(--accent);
    font: 800 10px var(--sans);
    text-transform: uppercase;
}

.inventory-item-card__body {
    display: grid;
    gap: 6px;
    padding: 11px 12px 13px;
}

.inventory-item-card__body h3,
.inventory-item-card__body p {
    margin: 0;
    overflow: hidden;
}

.inventory-item-card__body h3 {
    text-overflow: ellipsis;
    white-space: nowrap;
    font: 800 14px var(--sans);
}

.inventory-item-card__body p {
    min-height: 36px;
    display: -webkit-box;
    color: var(--muted);
    font: 600 12px/1.45 var(--sans);
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.profile-page {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    gap: 16px;
}

.profile-summary {
    position: relative;
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    align-items: center;
    gap: 26px;
    min-height: 190px;
    padding: 20px 8px 26px;
    border-bottom: 1px solid var(--line);
}

.profile-portrait {
    position: relative;
    width: 150px;
    height: 150px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
}

.profile-portrait img {
    position: absolute;
    top: -50%;
    left: 50%;
    width: 360%;
    height: 360%;
    max-width: none;
    object-fit: contain;
    transform: translateX(-50%);
}

.profile-overflow {
    position: absolute;
    top: 18px;
    right: 8px;
}

.profile-overflow__button {
    width: 42px;
    height: 34px;
    display: grid;
    place-items: center;
    padding: 0 0 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--ink);
    background: transparent;
    font: 800 22px/1 var(--sans);
    letter-spacing: 2px;
}

.profile-overflow__button:hover,
.profile-overflow__button[aria-expanded="true"] {
    border-color: var(--line);
    background: var(--card);
}

.profile-portrait span {
    color: var(--accent-strong);
    font: 800 48px var(--sans);
}

.profile-identity h1 {
    margin: 0;
    font: 750 clamp(28px, 3vw, 36px)/1.15 var(--sans);
}

.profile-handle {
    margin: 5px 0 0;
    color: var(--muted);
    font: 600 14px var(--sans);
}

.profile-stats {
    display: flex;
    align-items: center;
    gap: 0;
    margin-top: 22px;
}

.profile-stats > a,
.profile-stats > .profile-stat {
    min-width: 92px;
    display: grid;
    justify-items: center;
    gap: 2px;
    padding: 0 22px;
    border-right: 1px solid var(--line);
}

.profile-stats > *:first-child {
    padding-left: 0;
}

.profile-stats > *:last-child {
    border-right: 0;
}

.profile-stats > a:hover strong,
.profile-stats > a:hover span {
    color: var(--accent-strong);
}

.profile-stats > * > strong {
    font: 750 18px var(--sans);
}

.profile-stats > * > span {
    color: var(--muted);
    font: 600 13px var(--sans);
}

.profile-tabs {
    display: flex;
    border-bottom: 1px solid var(--line);
}

.profile-tabs a,
.profile-tabs span {
    min-width: 0;
    flex: 1 1 50%;
    padding: 13px 22px 11px;
    border-bottom: 3px solid transparent;
    color: var(--muted);
    text-align: center;
    font: 700 14px var(--sans);
}

.profile-tabs a:hover,
.profile-tabs .is-active {
    border-bottom-color: var(--accent);
    color: var(--ink);
}

.profile-sections {
    display: grid;
    gap: 14px;
    padding-top: 14px;
}

.profile-panel {
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--card);
}

.profile-panel h2 {
    font: 750 20px var(--sans);
}

.profile-panel__heading {
    margin-bottom: 16px;
}

.profile-panel__heading a {
    color: var(--accent-strong);
    font: 700 13px var(--sans);
}

.profile-about p {
    margin: 13px 0 0;
    color: var(--muted);
    line-height: 1.65;
}

.profile-wearing {
    min-height: 300px;
    display: grid;
    grid-template-columns: minmax(260px, 42%) minmax(0, 1fr);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--surface);
}

.profile-wearing__avatar {
    position: relative;
    min-height: 330px;
    padding: 14px;
    overflow: hidden;
    border-right: 1px solid var(--line);
    background:
        radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.58), transparent 36%),
        linear-gradient(145deg, var(--surface), var(--accent-soft));
}

.profile-wearing__avatar .avatar-preview,
.profile-wearing__avatar .avatar-preview-stage {
    width: 100%;
    height: 100%;
}

.profile-wearing__avatar .avatar-preview-stage {
    min-height: 300px;
    aspect-ratio: auto;
}

.profile-wearing__items {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-content: start;
    gap: 12px;
    padding: 16px;
    background: var(--accent-soft);
}

.profile-friends {
    display: flex;
    gap: 18px;
    overflow-x: auto;
    padding: 2px 0 5px;
    scrollbar-width: thin;
}

.profile-friend {
    min-width: 0;
    flex: 0 0 94px;
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 8px 4px;
    border-radius: 6px;
}

.profile-friend:hover {
    background: var(--surface);
}

.profile-friend__portrait {
    position: relative;
    width: 76px;
    height: 76px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--paper);
    background: var(--surface);
}

.profile-friend__portrait img {
    position: absolute;
    top: -73%;
    left: 50%;
    width: 400%;
    height: 400%;
    max-width: none;
    object-fit: contain;
    transform: translateX(-50%);
}

.profile-friend__fallback {
    background: var(--accent);
    font: 750 22px var(--sans);
}

.profile-friend strong {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
}

.profile-inventory {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 5px;
    scrollbar-width: thin;
}

.profile-inventory-item {
    min-width: 0;
    flex: 0 0 126px;
    display: grid;
    gap: 7px;
}

.profile-wearing__items .profile-inventory-item {
    width: auto;
    min-width: 0;
}

.profile-inventory-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
}

.profile-inventory-item strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
}

.profile-compact-empty {
    min-height: 72px;
    width: 100%;
    display: grid;
    place-items: center;
    margin: 0;
    color: var(--muted);
    text-align: center;
    font: 650 13px/1.45 var(--sans);
}

.profile-wearing__items .profile-compact-empty {
    grid-column: 1 / -1;
    min-height: 240px;
}

.profile-statistics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 16px 0 0;
    border-top: 1px solid var(--line);
}

.profile-statistics > div {
    display: grid;
    gap: 6px;
    padding: 18px 20px 4px;
    border-right: 1px solid var(--line);
    text-align: center;
}

.profile-statistics > div:last-child {
    border-right: 0;
}

.profile-statistics dt {
    color: var(--muted);
    font: 650 13px var(--sans);
}

.profile-statistics dd {
    margin: 0;
    color: var(--ink);
    font: 700 15px var(--sans);
}

/* ---------- account settings ---------- */

.settings-page,
.game-detail {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}

.settings-page__header {
    margin-bottom: 18px;
}

.settings-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bar);
}

.settings-tab {
    position: relative;
    min-height: 50px;
    border: 0;
    color: var(--muted);
    background: transparent;
    font: 700 14px var(--sans);
}

.settings-tab::after {
    content: "";
    position: absolute;
    right: 18px;
    bottom: 0;
    left: 18px;
    height: 3px;
    border-radius: 999px 999px 0 0;
    background: var(--accent);
    transform: scaleX(0);
}

.settings-tab.is-active {
    color: var(--ink);
}

.settings-tab.is-active::after {
    transform: scaleX(1);
}

.settings-panel {
    display: grid;
    gap: 16px;
}

.settings-section {
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    box-shadow: var(--control-shadow);
}

.settings-section h2 {
    margin-bottom: 16px;
    font: 750 22px var(--sans);
}

.settings-account-row {
    min-height: 46px;
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    border-top: 1px solid var(--line);
    font-size: 14px;
}

.settings-account-row > span,
.settings-help {
    color: var(--muted);
}

.text-action {
    border: 0;
    color: var(--accent-strong);
    background: transparent;
    font-weight: 700;
}

.settings-password-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
    align-items: end;
    gap: 12px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.settings-password-form label,
.settings-field {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font: 650 13px var(--sans);
}

.settings-password-form input,
.settings-field textarea,
.birthday-fields select,
.birthday-fields input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--ink);
    background: var(--surface);
    font: 600 14px var(--sans);
    outline: 0;
}

.settings-password-form input,
.birthday-fields select,
.birthday-fields input {
    height: 44px;
    padding: 0 12px;
}

.settings-field textarea {
    min-height: 108px;
    resize: vertical;
    padding: 12px;
    line-height: 1.5;
}

.settings-password-form input:focus,
.settings-field textarea:focus,
.birthday-fields select:focus,
.birthday-fields input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.settings-help {
    margin: 7px 0 16px;
    font-size: 12px;
}

.birthday-fields,
.gender-fields {
    display: grid;
    grid-template-columns: 1.4fr 0.7fr 0.9fr;
    gap: 10px;
    margin: 0 0 14px;
    padding: 0;
    border: 0;
}

.birthday-fields legend,
.gender-fields legend {
    grid-column: 1 / -1;
    margin-bottom: 7px;
    color: var(--muted);
    font: 650 13px var(--sans);
}

.gender-fields {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.gender-fields label {
    position: relative;
}

.gender-fields input {
    position: absolute;
    opacity: 0;
}

.gender-fields span {
    min-height: 42px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--muted);
    background: var(--surface);
    font: 650 13px var(--sans);
}

.gender-fields input:checked + span {
    border-color: var(--accent);
    color: var(--ink);
    background: var(--accent-soft);
}

.settings-form-actions {
    display: flex;
    justify-content: flex-end;
}

.secure-signout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.secure-signout h2 {
    margin-bottom: 5px;
}

/* ---------- game details ---------- */

.game-detail {
    display: grid;
    gap: 22px;
}

.game-detail__hero {
    display: grid;
    grid-template-columns: minmax(0, 1.72fr) minmax(280px, 0.78fr);
    gap: 18px;
}

.game-detail__media,
.game-detail__sidebar,
.game-detail__panel {
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--card);
    box-shadow: var(--control-shadow);
}

.game-detail__media {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: linear-gradient(145deg, var(--surface), var(--accent-soft));
}

.game-detail__media img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.game-detail__media-shade {
    position: absolute;
    inset: auto 0 0;
    height: 22%;
    pointer-events: none;
    background: linear-gradient(transparent, rgba(5, 8, 18, 0.2));
}

.game-detail__sidebar {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 34px;
    padding: clamp(20px, 3vw, 30px);
}

.game-detail__identity h1 {
    margin: 0 0 10px;
    font: 800 clamp(25px, 3vw, 34px) / 1.08 var(--sans);
    letter-spacing: -0.025em;
}

.game-detail__identity p {
    margin: 5px 0;
    color: var(--muted);
    font-size: 13px;
}

.game-detail__identity a {
    color: var(--ink);
    font-weight: 750;
    text-decoration: none;
}

.game-detail__identity a:hover {
    text-decoration: underline;
}

.game-detail__launch {
    display: grid;
    gap: 13px;
}

.game-detail__play {
    width: 100%;
    min-height: 58px;
    justify-content: center;
    gap: 10px;
    border-radius: 8px;
    font-size: 18px;
}

.game-detail__play .game-icon {
    width: 26px;
    height: 26px;
}

.game-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
}

.game-action {
    min-width: 0;
    min-height: 73px;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 3px;
    padding: 7px 3px;
    border: 0;
    border-radius: 7px;
    color: var(--muted);
    background: transparent;
    font: 650 10px var(--sans);
}

.game-action:hover {
    color: var(--ink);
    background: var(--accent-soft);
}

.game-action[aria-pressed="true"] {
    color: var(--accent-strong);
    background: var(--accent-soft);
}

.game-action strong {
    min-height: 13px;
    color: currentColor;
    font-size: 10px;
}

.game-icon {
    width: 22px;
    height: 22px;
    display: inline-block;
    flex: 0 0 auto;
    background: currentColor;
    -webkit-mask: var(--game-icon) center / contain no-repeat;
    mask: var(--game-icon) center / contain no-repeat;
}

.game-icon--play { --game-icon: url("/site/icons/lucide/play.svg"); }
.game-icon--star { --game-icon: url("/site/icons/lucide/star.svg"); }
.game-icon--bell { --game-icon: url("/site/icons/lucide/bell.svg"); }
.game-icon--thumbs-up { --game-icon: url("/site/icons/lucide/thumbs-up.svg"); }
.game-icon--thumbs-down { --game-icon: url("/site/icons/lucide/thumbs-down.svg"); }
.game-icon--store { --game-icon: url("/site/icons/lucide/gamepad-2.svg"); }

.game-detail__tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bar);
}

.game-detail__tab {
    position: relative;
    min-height: 48px;
    border: 0;
    color: var(--muted);
    background: transparent;
    font: 750 14px var(--sans);
}

.game-detail__tab::after {
    content: "";
    position: absolute;
    right: 13%;
    bottom: -1px;
    left: 13%;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: var(--accent);
    transform: scaleX(0);
    transition: transform 150ms ease;
}

.game-detail__tab:hover,
.game-detail__tab.is-active {
    color: var(--ink);
}

.game-detail__tab.is-active::after {
    transform: scaleX(1);
}

.game-detail__panel {
    position: relative;
    padding: clamp(20px, 3vw, 30px);
}

.game-detail__panel[hidden] {
    display: none;
}

.game-detail__panel h2 {
    margin: 0 0 10px;
    font: 800 18px var(--sans);
}

.game-detail__description {
    max-width: 920px;
    min-height: 26px;
    margin: 0 0 22px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.65;
    white-space: pre-wrap;
}

.game-detail__maturity {
    width: fit-content;
    display: flex;
    align-items: center;
    gap: 11px;
    margin: 0 0 22px;
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--bar);
    font-size: 12px;
}

.game-detail__maturity span:last-child {
    color: var(--muted);
}

.game-detail__stats {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin: 0 0 8px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.game-detail__stats > div {
    display: grid;
    align-content: center;
    gap: 6px;
    min-height: 72px;
    padding: 12px 8px;
    text-align: center;
}

.game-detail__stats dt {
    color: var(--muted);
    font: 650 10px var(--sans);
}

.game-detail__stats dd {
    margin: 0;
    overflow-wrap: anywhere;
    font: 750 12px var(--sans);
}

.game-detail__report {
    display: block;
    margin-left: auto;
    border: 0;
    color: var(--muted);
    background: transparent;
    font-size: 11px;
}

.game-tab-empty {
    min-height: 230px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 10px;
    color: var(--muted);
    text-align: center;
}

.game-tab-empty .game-icon {
    width: 36px;
    height: 36px;
    color: var(--accent);
}

.game-tab-empty h2,
.game-tab-empty p {
    margin: 0;
}

.game-server-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 26px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bar);
}

.game-server-card h2 {
    margin: 6px 0 3px;
    font-size: 17px;
}

.game-server-card p,
.game-server-card__players span {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
}

.game-server-card__status {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.game-server-card__status i {
    width: 7px;
    height: 7px;
    display: inline-block;
    margin-right: 5px;
    border-radius: 50%;
    background: var(--green);
}

.game-server-card__players {
    display: grid;
    gap: 3px;
    text-align: center;
}

.game-server-card__players strong {
    font: 800 16px var(--sans);
}

.empty-state {
    min-height: 380px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 14px;
    text-align: center;
}

/* ---------- auth screen ---------- */

.auth-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: min(450px, 94vw);
    display: grid;
    gap: 18px;
    padding: 42px 40px;
    border: 1px solid var(--line);
    border-radius: var(--scrawl-lg);
    background: var(--card-strong);
    box-shadow: var(--pencil-shadow);
    -webkit-backdrop-filter: blur(18px) saturate(1.06);
    backdrop-filter: blur(18px) saturate(1.06);
}

.auth-brand {
    font-family: var(--hand-head);
    font-size: 46px;
    letter-spacing: 0.08em;
    transform: rotate(-0.8deg);
}

.auth-tabs {
    display: flex;
    gap: 24px;
}

.auth-tab {
    position: relative;
    padding: 8px 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-family: var(--sans);
    font-size: 16px;
    font-weight: 700;
}

.auth-tab::after {
    content: "";
    position: absolute;
    left: -3px;
    right: -3px;
    bottom: 2px;
    height: 4px;
    border-radius: 999px;
    background: var(--accent);
    transform: scaleX(0);
    transition: transform 160ms ease;
}

.auth-tab.is-active {
    color: var(--ink);
}

.auth-tab:hover::after,
.auth-tab.is-active::after {
    transform: scaleX(1);
}

#authForm {
    display: grid;
    gap: 16px;
}

.auth-field {
    display: grid;
    gap: 6px;
    font-size: 16px;
    font-weight: 700;
}

.auth-field input {
    height: 48px;
    padding: 0 15px;
    border: 1px solid var(--line);
    border-radius: var(--scrawl-sm);
    background: var(--surface);
    color: var(--ink);
    font-size: 16px;
    outline: none;
}

.auth-field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.auth-error {
    margin: 0;
    color: var(--error);
    font-size: 15px;
    font-weight: 700;
}

.auth-submit {
    justify-self: start;
}

.logout-button {
    margin-top: 16px;
    height: 48px;
    font-size: 15px;
}

/* ---------- responsive ---------- */

@media (max-width: 1280px) {
    .app-shell {
        grid-template-columns: 210px 1fr;
    }

    .popular-grid {
        grid-template-columns: repeat(3, minmax(160px, 1fr));
    }
}

@media (max-width: 860px) {
    .app-shell {
        display: block;
    }

    .topbar {
        flex-wrap: wrap;
        height: auto;
        padding: 12px 16px;
        gap: 14px;
    }

    .topnav {
        order: 3;
        width: 100%;
        overflow-x: auto;
        gap: 22px;
    }

    .search {
        width: 100%;
        min-width: 0;
        flex: 1 1 100%;
        order: 4;
    }

    .sidebar {
        position: static;
        height: auto;
        border-right: 0;
        border-bottom: 2px solid var(--line);
    }

    .side-nav {
        grid-template-columns: repeat(4, 1fr);
    }

    .side-nav__item {
        justify-content: center;
        font-size: 0;
    }

    .download-rail {
        position: static;
        margin-top: 12px;
    }

    .content {
        padding: 22px 14px 90px;
    }

    .hero-card {
        padding: 24px;
        flex-direction: column;
        text-align: center;
    }

    .hero-actions {
        justify-content: center;
    }

    .popular-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px 10px;
    }

    .catalog-grid,
    .avatar-workspace,
    .import-panel,
    .inventory-layout {
        grid-template-columns: 1fr;
    }

    .inventory-sidebar {
        display: grid;
        grid-template-columns: repeat(6, max-content);
        gap: 7px;
        overflow-x: auto;
        padding: 12px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .inventory-avatar-preview {
        width: min(280px, calc(100vw - 56px));
        grid-column: 1 / -1;
        justify-self: center;
        margin: 0 auto 8px;
    }

    .inventory-sidebar h2 {
        display: none;
    }

    .inventory-category {
        width: auto;
        flex: 0 0 auto;
        padding: 0 12px;
    }

    .inventory-category::after {
        display: none;
    }

    .profile-summary {
        grid-template-columns: 130px minmax(0, 1fr);
        gap: 20px;
    }

    .profile-portrait {
        width: 130px;
        height: 130px;
    }

    .profile-wearing {
        grid-template-columns: minmax(230px, 38%) minmax(0, 1fr);
    }

    .profile-wearing__items {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .avatar-preview-panel {
        position: static;
    }

    .avatar-preview-stage {
        height: auto;
    }

    .avatar-tabs {
        display: flex;
        overflow-x: auto;
        scrollbar-width: thin;
        scroll-snap-type: x proximity;
    }

    .avatar-tab {
        flex: 0 0 auto;
        min-width: 116px;
        padding: 0 16px;
        scroll-snap-align: start;
    }

    .friend-search {
        grid-template-columns: 1fr;
    }

    .friends-tabs {
        display: flex;
        overflow-x: auto;
        scrollbar-width: thin;
    }

    .friends-tab {
        min-width: 150px;
        flex: 1 0 150px;
    }

    .settings-password-form {
        grid-template-columns: 1fr;
    }

    .game-detail__hero {
        grid-template-columns: 1fr;
    }

    .game-detail__sidebar {
        min-height: 280px;
    }

    .game-detail__stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .page-card__header,
    .avatar-library__heading,
    .friends-toolbar,
    .profile-page {
        align-items: flex-start;
        flex-direction: column;
    }

    .person-card {
        grid-template-columns: 54px minmax(0, 1fr);
    }

    .person-avatar {
        width: 54px;
        height: 54px;
    }

    .person-actions {
        width: 100%;
        justify-content: flex-end;
    }

}

@media (max-width: 560px) {
    .avatar-editor,
    .friends-page {
        gap: 16px;
    }

    .avatar-editor__actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .avatar-editor__actions .primary-action {
        flex: 1 1 120px;
    }

    .inventory-page__header,
    .inventory-content__header {
        align-items: flex-start;
    }

    .inventory-content {
        padding: 16px 12px;
    }

    .inventory-grid {
        grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
        gap: 10px;
    }

    .inventory-item-card__art {
        height: 138px;
    }

    .profile-summary {
        grid-template-columns: 92px minmax(0, 1fr);
        align-items: start;
        gap: 14px;
        padding: 10px 0 18px;
    }

    .profile-portrait {
        width: 92px;
        height: 92px;
    }

    .profile-stats {
        grid-column: 1 / -1;
        margin-top: 17px;
    }

    .profile-stats > a,
    .profile-stats > .profile-stat {
        min-width: 0;
        padding: 0 10px;
    }

    .profile-wearing {
        grid-template-columns: 1fr;
    }

    .profile-wearing__avatar {
        min-height: 280px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .profile-wearing__avatar .avatar-preview-stage {
        min-height: min(82vw, 330px);
    }

    .profile-wearing__items {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .profile-friends {
        gap: 10px;
    }

    .profile-statistics {
        grid-template-columns: 1fr;
    }

    .profile-statistics > div {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .profile-statistics > div:last-child {
        border-bottom: 0;
    }

    .profile-overflow {
        top: 6px;
        right: 0;
    }

    .profile-identity {
        padding-right: 36px;
    }

    .birthday-fields,
    .gender-fields {
        grid-template-columns: 1fr;
    }

    .game-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .game-detail__stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .game-detail__maturity {
        align-items: flex-start;
        flex-direction: column;
    }

    .game-server-card {
        grid-template-columns: 1fr auto;
    }

    .game-server-card .primary-action {
        grid-column: 1 / -1;
        justify-content: center;
    }

    .settings-account-row {
        grid-template-columns: 100px minmax(0, 1fr) auto;
    }

    .secure-signout {
        align-items: stretch;
        flex-direction: column;
    }

    .avatar-preview-panel {
        padding: 10px;
    }

    .avatar-preview-stage {
        height: auto;
    }

    .avatar-preview__mode {
        top: 12px;
        right: 12px;
    }

    .avatar-category-flyout {
        max-height: 152px;
        padding: 7px;
    }

    .avatar-item-grid {
        grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
        gap: 9px;
        padding: 0 12px 16px;
    }

    .avatar-library__heading {
        padding: 17px 12px 12px;
    }

}

@media (max-width: 480px) {
    .game-card h3 {
        font-size: 13px;
    }

    .game-card__metrics {
        gap: 9px;
        font-size: 11px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sky::before,
    .sky::after,
    .sky__clouds,
    .sky__stars--twinkle,
    .sky__shooting,
    .sky__birds,
    .page {
        animation: none;
    }

    .avatar-preview__spinner,
    .avatar-category-flyout {
        animation: none;
    }

    .avatar-item-card {
        transition: none;
    }

    .avatar-item-card:hover {
        transform: none;
    }
}


.avatar-body-colors {
    display: grid;
    gap: 8px;
    margin-top: 12px;
    /* rendered inside .avatar-item-grid, so take the whole row */
    grid-column: 1 / -1;
}

.avatar-color-slots {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.avatar-color-slot {
    display: grid;
    justify-items: center;
    gap: 4px;
    padding: 6px 4px;
    border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    font: inherit;
    color: inherit;
}

.avatar-color-slot:hover { border-color: var(--accent, #6ea8fe); }

.avatar-color-slot.is-active {
    border-color: var(--accent, #6ea8fe);
    box-shadow: 0 0 0 1px var(--accent, #6ea8fe) inset;
}

.avatar-color-slot__chip {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.25);
}

.avatar-color-slot__label {
    font-size: 10px;
    line-height: 1.1;
    text-align: center;
    opacity: 0.75;
}

.avatar-color-palette {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(22px, 1fr));
    gap: 5px;
}

.avatar-color-swatch {
    aspect-ratio: 1 / 1;
    min-height: 22px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.28);
    cursor: pointer;
    padding: 0;
}

.avatar-color-swatch:hover { transform: scale(1.12); }

.avatar-color-swatch.is-active {
    box-shadow: 0 0 0 2px var(--accent, #6ea8fe);
}