/* ============================================================
   CARL'S GAMES — Parchment Theme
   Warm cream backgrounds, serif typography, golden accents.
   Adapted from the Frieren design language.
   ============================================================ */

/* ── Design Tokens ────────────────────────────────────────── */
:root {
    --parchment:      #F8F5F0;
    --parchment-warm: #F0EBE2;
    --parchment-deep: #E4D8C2;
    --card-bg:        #FFFCF7;
    --card-hover:     #FFFFFF;
    --card-border:    rgba(26,26,46,0.10);
    --ink:            #1A1A2E;
    --ink-soft:       #2A2A3E;
    --muted:          #38333E;
    --dim:            #58525E;
    --accent:         #4A78CC;
    --accent-hover:   #3A68B8;
    --accent-dim:     rgba(74,120,204,0.10);
    --accent-pale:    #B8C8E8;
    --gold:           #9A7A2A;
    --gold-light:     #C9A84C;
    --gold-dim:       rgba(154,122,42,0.10);
    --meadow:         #3E7A4E;
    --rose:           #A83A58;
    --teal:           #2D5258;
    --border:         rgba(74,120,204,0.08);
    --border-strong:  rgba(74,120,204,0.15);
    --shadow-sm:  0 1px 4px rgba(26,26,46,0.04);
    --shadow:     0 4px 24px rgba(26,26,46,0.05), 0 1px 3px rgba(26,26,46,0.03);
    --shadow-lg:  0 12px 40px rgba(74,120,204,0.08), 0 2px 8px rgba(26,26,46,0.04);
    --radius:     6px;
    --radius-sm:  4px;
    --ease:       cubic-bezier(0.22, 0.61, 0.36, 1);
    --dur:        0.35s;
    --max:        1100px;
    --font-display: 'Cormorant Garamond', 'Georgia', serif;
    --font-body:    'EB Garamond', 'Georgia', serif;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
img, svg { display: block; max-width: 100%; }

/* ── Base Typography ──────────────────────────────────────── */
body {
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 1.75;
    color: var(--ink);
    background: var(--parchment);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

h1, h2, h3 {
    font-family: var(--font-display);
    line-height: 1.25;
    color: var(--ink);
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.3s var(--ease);
}
a:hover { color: var(--teal); }

/* ── Paper Texture ────────────────────────────────────────── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle 0.5px at 20% 30%, rgba(140,120,80,0.018) 50%, transparent 50%),
        radial-gradient(circle 0.7px at 60% 70%, rgba(140,120,80,0.015) 50%, transparent 50%),
        radial-gradient(circle 0.4px at 80% 20%, rgba(140,120,80,0.020) 50%, transparent 50%),
        radial-gradient(circle 0.6px at 40% 80%, rgba(140,120,80,0.016) 50%, transparent 50%),
        radial-gradient(ellipse 80% 80% at 50% 50%, transparent 50%, rgba(100,90,70,0.035) 100%);
    background-size: 4px 4px, 6px 6px, 5px 5px, 7px 7px, 100% 100%;
    pointer-events: none;
    z-index: 0;
}

/* ── Golden Hour Light ────────────────────────────────────── */
.atmosphere {
    position: fixed;
    inset: 0;
    background:
        linear-gradient(145deg, transparent 0%, transparent 50%, rgba(201,168,76,0.035) 65%, rgba(232,196,122,0.05) 78%, transparent 100%),
        radial-gradient(ellipse 130% 130% at 50% 35%, rgba(255,255,255,0.05) 0%, transparent 75%);
    pointer-events: none;
    z-index: 0;
}

/* ── Page Frame ───────────────────────────────────────────── */
.page-frame {
    position: fixed;
    top: 12px; left: 12px; right: 12px; bottom: 12px;
    border: 1px solid rgba(74,120,204,0.08);
    pointer-events: none;
    z-index: 60;
    border-radius: var(--radius-sm);
}

/* ── Nav ──────────────────────────────────────────────────── */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(248,245,240,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid transparent;
    transition: border-color 0.4s var(--ease), box-shadow 0.4s var(--ease);
}

.nav-inner {
    max-width: var(--max);
    margin: 0 auto;
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 22px;
    color: var(--ink);
}
.nav-logo:hover { color: var(--ink); }

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

.nav-link {
    font-family: var(--font-body);
    font-size: 16px;
    color: var(--ink-soft);
    letter-spacing: 0.02em;
    position: relative;
}
.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0; right: 0;
    height: 1px;
    background: var(--accent);
    transform: scaleX(0);
    transition: transform 0.3s var(--ease);
}
.nav-link:hover { color: var(--accent); }
.nav-link:hover::after { transform: scaleX(1); }

.nav-user {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
    font-family: var(--font-body);
    font-size: 17px;
    font-weight: 500;
    padding: 13px 30px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s var(--ease);
    border: 1.5px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.02em;
    text-decoration: none;
}

.btn-accent {
    background: var(--accent);
    color: var(--parchment);
    border-color: var(--accent);
}
.btn-accent:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: var(--parchment);
    box-shadow: 0 4px 16px rgba(74,120,204,0.22);
}

.btn-outline {
    background: transparent;
    color: var(--accent);
    border-color: var(--accent);
}
.btn-outline:hover {
    background: var(--accent-dim);
    box-shadow: 0 4px 16px rgba(74,120,204,0.12);
}

.btn-small { padding: 8px 20px; font-size: 15px; }
.btn-large { padding: 15px 36px; font-size: 18px; }

/* ── Hero ─────────────────────────────────────────────────── */
.hero {
    max-width: 1000px;
    margin: 0 auto;
    padding: 60px 32px 48px;
    position: relative;
    z-index: 3;
}

.hero-inner {
    display: flex;
    align-items: center;
    gap: 3rem;
}

.hero-text { flex: 1; }

.hero h1 {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(2rem, 4vw, 2.8rem);
    line-height: 1.25;
    color: var(--ink);
    margin-bottom: 16px;
}

.hero h1 em {
    font-style: italic;
    background: linear-gradient(135deg, var(--accent), var(--teal));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 19px;
    color: var(--muted);
    max-width: 520px;
    line-height: 1.75;
    margin-bottom: 28px;
}

.hero-actions {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.hero-carl {
    flex: 0 0 auto;
    align-self: center;
}

.hero-carl-img {
    display: block;
    height: 300px;
    width: auto;
    object-fit: contain;
    opacity: 0.85;
}

/* ── Divider ──────────────────────────────────────────────── */
.divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 8px 0;
    color: var(--dim);
    opacity: 0.45;
    position: relative;
    z-index: 3;
}
.divider::before, .divider::after {
    content: '';
    width: 60px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--dim), transparent);
}

/* ── Shelf Sections ───────────────────────────────────────── */
.feed {
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 32px 48px;
    position: relative;
    z-index: 3;
}

.shelf-section {
    margin-bottom: 2.5rem;
    max-width: var(--max);
    margin-left: auto;
    margin-right: auto;
    padding: 0 32px;
    position: relative;
    z-index: 3;
}

.shelf-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 1.25rem;
}

.shelf-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
}

.shelf-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border-strong), transparent);
}

.shelf-row {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.5rem;
    scrollbar-width: none;
}
.shelf-row::-webkit-scrollbar { display: none; }

/* ── Game Cards ───────────────────────────────────────────── */
.game-card {
    flex: 0 0 260px;
    scroll-snap-align: start;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow-sm);
    transition: all var(--dur) var(--ease);
    position: relative;
}

/* Golden hover line at top */
.game-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--gold), var(--accent), var(--gold-light));
    opacity: 0;
    transition: opacity var(--dur) var(--ease);
    z-index: 1;
}

.game-card:hover {
    background: var(--card-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    color: inherit;
}
.game-card:hover::before { opacity: 1; }

.game-card-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.game-card-thumb svg {
    width: 56px;
    height: 56px;
    opacity: 0.9;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.2));
    transition: transform 0.4s var(--ease);
}

.game-card:hover .game-card-thumb svg { transform: scale(1.12); }

/* Game gradients */
.thumb-chess       { background: linear-gradient(145deg, #9A7A2A, #6E5420); }
.thumb-checkers    { background: linear-gradient(145deg, #A83A58, #7A2840); }
.thumb-dice-game   { background: linear-gradient(145deg, #3E7A4E, #2D5258); }
.thumb-calculator  { background: linear-gradient(145deg, #4A78CC, #3A5EA0); }
.thumb-asteroids   { background: linear-gradient(145deg, #4A5CC0, #1a1a2e); }
.thumb-shatter     { background: linear-gradient(145deg, #CC5A4A, #7A2840); }
.thumb-paddle      { background: linear-gradient(145deg, #00B8D4, #0A0A2E); }
.thumb-just-chess  { background: linear-gradient(145deg, #5C5C5C, #2A2A2A); }
.thumb-snake       { background: linear-gradient(145deg, #22C55E, #0F172A); }
.thumb-lander      { background: linear-gradient(145deg, #2A5A8E, #0A0A2E); }
.thumb-final-intercept { background: linear-gradient(145deg, #8B2020, #1A0A2E); }
.thumb-fathom  { background: linear-gradient(145deg, #0A3A6E, #020618); }
.thumb-gridlock { background: linear-gradient(145deg, #6B2FA0, #0f0f23); }
.thumb-stories\/challenge001 { background: linear-gradient(145deg, #4A78CC, #1c1c44); }
.thumb-stories\/challenge002 { background: linear-gradient(145deg, #9A7A2A, #1c1c44); }
.thumb-stories\/challenge003 { background: linear-gradient(145deg, #3E7A4E, #1c1c44); }
.thumb-stories\/challenge004 { background: linear-gradient(145deg, #A83A58, #1c1c44); }
.thumb-stories\/challenge005 { background: linear-gradient(145deg, #2D5258, #1c1c44); }
.thumb-default     { background: linear-gradient(145deg, #4A78CC, #3A4D7A); }

.game-card-body { padding: 16px 18px; }

.game-card-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--ink);
}

.game-card-hook {
    font-size: 0.9375rem;
    color: var(--muted);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Badges ───────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 40px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.02em;
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid rgba(74,120,204,0.15);
}
.badge.genre-puzzle    { background: var(--accent-dim); color: var(--accent); }
.badge.genre-action    { background: rgba(168,58,88,0.10); color: var(--rose); }
.badge.genre-arcade    { background: rgba(110,104,144,0.10); color: #6E6890; }
.badge.genre-strategy  { background: rgba(62,122,78,0.10); color: var(--meadow); }

/* ── All Games Grid ───────────────────────────────────────── */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}
.games-grid .game-card { flex: none; width: auto; }

/* ── Game Detail Page ─────────────────────────────────────── */
.detail-hero {
    padding: 2.5rem 32px 3rem;
    color: #ffffff;
    position: relative;
    z-index: 3;
}

.detail-hero-inner { max-width: 900px; margin: 0 auto; }

.detail-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255,255,255,0.65);
    font-size: 16px;
    margin-bottom: 1.75rem;
    transition: color 0.2s var(--ease);
}
.detail-back:hover { color: #ffffff; }

.detail-hero-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
    align-items: center;
}

.detail-screenshot { border-radius: var(--radius); overflow: hidden; box-shadow: 0 8px 30px rgba(0,0,0,0.3); }
.detail-screenshot-img { width: 100%; display: block; aspect-ratio: 16/10; object-fit: cover; }
.detail-screenshot-placeholder {
    width: 100%; aspect-ratio: 16/10;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius);
}
.detail-screenshot-label { font-size: 14px; color: rgba(255,255,255,0.4); }

.detail-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 400;
    margin-bottom: 8px;
    line-height: 1.2;
    color: #ffffff;
}
.detail-hook { font-size: 19px; font-weight: 400; color: rgba(255,255,255,0.75); margin-bottom: 1.25rem; line-height: 1.5; }

.detail-meta-row { display: flex; align-items: center; gap: 8px; margin-bottom: 1.75rem; flex-wrap: wrap; }
.detail-meta-item { font-size: 14px; color: rgba(255,255,255,0.55); text-transform: capitalize; }
.detail-meta-sep { color: rgba(255,255,255,0.2); font-size: 12px; }

.detail-actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }

.btn-play {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 14px 36px;
    background: #ffffff; color: var(--ink);
    font-family: var(--font-body); font-size: 18px; font-weight: 500;
    border-radius: var(--radius); border: none;
    cursor: pointer; transition: all 0.3s var(--ease);
    text-decoration: none; letter-spacing: 0.02em;
}
.btn-play:hover { transform: scale(1.04); box-shadow: 0 4px 20px rgba(0,0,0,0.3); color: var(--ink); }
.btn-play svg { width: 20px; height: 20px; }

.btn-hero-outline {
    display: inline-flex; align-items: center;
    padding: 12px 28px;
    background: transparent; color: rgba(255,255,255,0.8);
    font-family: var(--font-body); font-size: 17px; font-weight: 500;
    border-radius: var(--radius); border: 1.5px solid rgba(255,255,255,0.3);
    cursor: pointer; transition: all 0.3s var(--ease);
    text-decoration: none; letter-spacing: 0.02em;
}
.btn-hero-outline:hover { background: rgba(255,255,255,0.1); color: #ffffff; border-color: rgba(255,255,255,0.6); }

/* Detail content */
.detail-content { max-width: 900px; margin: 0 auto; padding: 0 32px 2rem; position: relative; z-index: 3; }
.detail-article { padding-top: 2.5rem; }
.detail-section { margin-bottom: 2.5rem; }

.detail-section h2 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 1rem;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--gold-light);
    display: inline-block;
}

.detail-prose { font-size: 18px; color: var(--ink-soft); line-height: 1.8; }
.detail-prose p { margin-bottom: 1.25rem; }
.detail-prose p:last-child { margin-bottom: 0; }

.detail-how-to-play {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.detail-controls-quick {
    background: var(--ink);
    color: #ffffff;
    padding: 14px 24px;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.detail-controls-label {
    font-family: var(--font-body);
    font-weight: 600;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.1em;
}
.detail-how-to-play .detail-prose { padding: 24px; }

.detail-facts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1px;
    background: var(--card-border);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}
.detail-fact { background: var(--card-bg); padding: 16px 20px; display: flex; flex-direction: column; gap: 4px; }
.detail-fact-label { font-size: 11px; font-weight: 600; color: var(--dim); text-transform: uppercase; letter-spacing: 0.1em; }
.detail-fact-value { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; color: var(--ink); text-transform: capitalize; }

.detail-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-tag {
    display: inline-block; padding: 5px 16px;
    border-radius: 40px; font-size: 15px;
    background: var(--card-bg); color: var(--muted);
    border: 1px solid var(--card-border);
    transition: border-color 0.2s var(--ease);
}
.detail-tag:hover { border-color: var(--border-strong); }

/* Carl recommendation */
.carl-recommend { display: flex; align-items: flex-end; gap: 1.25rem; justify-content: center; margin-bottom: 1.5rem; }
.carl-recommend-img { width: 100px; height: auto; flex-shrink: 0; opacity: 0.85; }
.carl-speech {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px 16px 16px 4px;
    padding: 16px 20px;
    box-shadow: var(--shadow);
    max-width: 340px;
}
.carl-speech p { font-size: 17px; color: var(--muted); line-height: 1.6; margin: 0; font-style: italic; }

.detail-cta { text-align: center; padding: 2.5rem 0 1rem; border-top: 1px solid var(--border); }

/* ── Game Page — Immersive ────────────────────────────────── */
.page-game .nav { display: none; }
.page-game .atmosphere, .page-game .page-frame { display: none; }

.game-bar {
    height: 48px;
    background: var(--ink);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px;
    position: relative; z-index: 200;
}
.game-bar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.game-bar-back {
    display: flex; align-items: center; gap: 6px;
    color: rgba(255,255,255,0.65); font-family: var(--font-body);
    font-size: 15px; text-decoration: none;
    padding: 4px 8px; border-radius: var(--radius-sm);
    transition: all 0.2s var(--ease);
}
.game-bar-back:hover { color: #ffffff; background: rgba(255,255,255,0.08); }
.game-bar-back svg { width: 16px; height: 16px; }
.game-bar-title { font-family: var(--font-display); font-size: 17px; font-weight: 600; color: #ffffff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-bar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.game-bar-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 5px 14px; border-radius: var(--radius);
    font-family: var(--font-body); font-size: 15px; font-weight: 500;
    border: 1px solid rgba(255,255,255,0.2);
    background: transparent; color: rgba(255,255,255,0.75);
    cursor: pointer; transition: all 0.3s var(--ease);
}
.game-bar-btn:hover { background: rgba(255,255,255,0.1); color: #ffffff; border-color: rgba(255,255,255,0.4); }
.game-bar-btn svg { width: 14px; height: 14px; }

.game-player { height: calc(100vh - 48px); background: #000; }
.game-player iframe { width: 100%; height: 100%; border: none; display: block; }

/* Controls toast */
.controls-toast {
    position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
    background: var(--ink); border-radius: var(--radius);
    padding: 10px 24px; font-size: 15px; color: rgba(255,255,255,0.85);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3); z-index: 150;
    display: flex; align-items: center; gap: 12px; max-width: 90vw;
    animation: toastIn 0.3s ease;
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.controls-toast.hiding { opacity: 0; transform: translateX(-50%) translateY(10px); }
.controls-toast-label { color: rgba(255,255,255,0.4); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; }
.controls-toast-dismiss { background: none; border: none; color: rgba(255,255,255,0.3); cursor: pointer; font-size: 18px; line-height: 1; }
.controls-toast-dismiss:hover { color: #ffffff; }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* Slide-out panel */
.panel-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 300; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.panel {
    position: fixed; top: 0; right: 0; width: 380px; max-width: 85vw; height: 100vh;
    background: var(--parchment); border-left: 1px solid var(--border);
    z-index: 301; overflow-y: auto; animation: slideIn 0.25s ease; display: flex; flex-direction: column;
}
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.panel-header h2 { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; }
.panel-close { background: none; border: none; color: var(--dim); cursor: pointer; font-size: 20px; padding: 4px; }
.panel-close:hover { color: var(--ink); }
.panel-body { padding: 24px; flex: 1; overflow-y: auto; }
.panel-section { margin-bottom: 2rem; }
.panel-section-title { font-family: var(--font-body); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--dim); margin-bottom: 12px; }

.next-up-card {
    display: flex; gap: 12px; align-items: center; padding: 12px;
    background: var(--card-bg); border: 1px solid var(--card-border);
    border-radius: var(--radius); text-decoration: none; color: inherit;
    transition: all 0.3s var(--ease); margin-bottom: 8px;
}
.next-up-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); color: inherit; }
.next-up-thumb { width: 56px; height: 36px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.next-up-thumb svg { width: 20px; height: 20px; opacity: 0.9; }
.next-up-info { flex: 1; min-width: 0; }
.next-up-title { font-family: var(--font-display); font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.next-up-hook { font-size: 13px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.panel-game-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.panel-controls { font-size: 15px; color: var(--muted); line-height: 1.5; }
.panel-controls strong { color: var(--dim); }

/* ── Account Page ─────────────────────────────────────────── */
.page-content { max-width: 560px; margin: 3rem auto; padding: 0 32px; position: relative; z-index: 3; }
.page-content > h1 { font-family: var(--font-display); font-size: 1.8rem; font-weight: 400; margin-bottom: 2rem; }

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 28px;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}
.card h2 { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; margin-bottom: 1rem; }
.card-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; }
.card-row + .card-row { border-top: 1px solid var(--border); }
.card-label { color: var(--dim); font-size: 16px; }
.card-value { font-weight: 600; }

.tier-badge { display: inline-block; padding: 4px 14px; border-radius: 40px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.tier-free { background: var(--parchment-warm); color: var(--dim); border: 1px solid var(--border); }
.tier-subscriber { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(74,120,204,0.2); }

/* ── Footer ───────────────────────────────────────────────── */
.footer {
    background: var(--parchment-deep);
    border-top: 1px solid var(--border);
    position: relative;
    z-index: 3;
    text-align: center;
    padding: 40px 32px;
}

.footer-links {
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--ink-soft);
    margin-bottom: 12px;
    display: flex;
    justify-content: center;
    gap: 24px;
}
.footer-links a { color: var(--ink-soft); letter-spacing: 0.02em; }
.footer-links a:hover { color: var(--accent); }

.footer p {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 16px;
    color: var(--muted);
}

/* ── Loading ──────────────────────────────────────────────── */
.loading { text-align: center; padding: 4rem; color: var(--dim); font-size: 16px; }
.loading::after {
    content: ''; display: inline-block; width: 18px; height: 18px;
    border: 2px solid var(--border-strong); border-top-color: var(--accent);
    border-radius: 50%; animation: spin 0.7s linear infinite;
    margin-left: 10px; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
    .hero { padding: 40px 24px 36px; }
    .hero-inner { flex-direction: column; text-align: center; gap: 1.5rem; }
    .hero-actions { justify-content: center; }
    .hero p { margin-left: auto; margin-right: auto; }
    .hero-carl-img { height: 200px; }
    .game-card { flex: 0 0 220px; }
    .nav-inner { padding: 14px 20px; }
    .feed { padding: 0 20px 40px; }
    .shelf-section { padding: 0 20px; }
    .detail-hero { padding: 2rem 24px 2.5rem; }
    .detail-hero-layout { grid-template-columns: 1fr; gap: 1.5rem; }
    .detail-content { padding: 0 24px 2rem; }
    .detail-facts { grid-template-columns: repeat(2, 1fr); }
    .carl-recommend { flex-direction: column; align-items: center; }
    .carl-speech { border-radius: 16px; }
    .page-frame { display: none; }
}

@media (max-width: 480px) {
    .hero h1 { font-size: 1.6rem; }
    .hero-actions { flex-direction: column; align-items: stretch; }
    .btn { text-align: center; }
    .game-card { flex: 0 0 200px; }
    .nav-actions { gap: 14px; }
    .nav-link { font-size: 14px; }
    .detail-title { font-size: 1.6rem; }
    .detail-facts { grid-template-columns: 1fr 1fr; }
}

/* ── Code Playground ───────────────────────────────────────── */
.playground {
    border: 1px solid var(--card-border);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    margin: 1.5rem 0;
}

.playground-toolbar {
    background: var(--ink);
    color: #ffffff;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.playground-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.45);
}

.playground-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.playground-btn {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    padding: 5px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.15);
    background: transparent;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    transition: all 0.2s var(--ease);
    display: flex;
    align-items: center;
    gap: 5px;
}
.playground-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #ffffff;
}
.playground-btn-run {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}
.playground-btn-run:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.playground-editor {
    width: 100%;
    border: none;
    outline: none;
    resize: vertical;
    padding: 16px 20px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--card-bg);
    tab-size: 2;
    border-bottom: 1px solid var(--card-border);
}
.playground-editor::placeholder { color: var(--dim); }
.playground-editor:focus { box-shadow: inset 0 0 0 2px rgba(74,120,204,0.15); }

.playground-output-label {
    background: var(--parchment-warm);
    padding: 6px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--dim);
    border-bottom: 1px solid var(--card-border);
}

.playground-output {
    padding: 14px 20px;
    min-height: 60px;
    max-height: 240px;
    overflow-y: auto;
    background: var(--card-bg);
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.6;
}

.playground-hint { color: var(--dim); font-style: italic; }
.playground-line { padding: 1px 0; }
.playground-line-log { color: var(--ink); }
.playground-line-error { color: #c53030; }
.playground-line-warn { color: #9A7A2A; }

/* ── Story Page ───────────────────────────────────────────── */
.story-hero-img {
    width: 100%;
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.story-section {
    margin: 2rem 0;
    padding: 24px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    background: rgba(255,255,255,0.05);
    line-height: 1.8;
}

.story-section p { margin-bottom: 1rem; }
.story-section p:last-child { margin-bottom: 0; }

.story-section blockquote {
    padding-left: 20px;
    border-left: 3px solid var(--gold-light);
    font-style: italic;
    font-size: 1.1rem;
    margin: 1rem 0;
    color: rgba(255,255,255,0.85);
}

.story-code-section {
    margin: 2rem 0;
}

.code-explain {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 20px 24px;
    margin: 1rem 0;
}

.code-explain code {
    background: rgba(74,120,204,0.08);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 0.9em;
    color: var(--accent);
}

.code-explain .title {
    font-weight: 600;
    margin-bottom: 4px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
