/* ──────────────────────────────────────────────────────────────────────────
   Sam Ngo — Universal Design System  (Web-Game implementation)
   Follows design.md verbatim. When this file and design.md disagree,
   update design.md first, then this file.
   ────────────────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Space+Mono:ital,wght@0,400;0,700;1,400&family=JetBrains+Mono:wght@400;500;600&family=Noto+Serif+TC:wght@700&display=swap');

/* ── Theme variables ─────────────────────────────────────────────────────── */

:root {
    /* Surfaces & text */
    --bg-primary:     #000000;
    --bg-card:        #13131a;
    --bg-card-alt:    #1a1a24;
    --text-primary:   #e8e8ed;
    --text-secondary: #9ca3af;
    --text-muted:     #6b7280;

    /* Accent triplet */
    --accent:         #FF6B00;
    --accent-hover:   #FF8C42;
    --accent-glow:    rgba(255, 107, 0, 0.15);

    --border:         #1f1f2e;
    --border-strong:  #2a2a3a;
    --tag-bg:         #1a1a24;
    --tag-text:       #FF6B00;

    --shadow:         0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-hover:   0 8px 30px rgba(0, 0, 0, 0.3);

    /* Nav */
    --nav-bg:         rgba(0, 0, 0, 0.92);
    --nav-text:       #e8e8ed;

    /* Hero */
    --hero-bg:               #000000;
    --hero-text:             #e8e8ed;
    --hero-muted:            #6b7280;
    --hero-orbit:            rgba(255, 107, 0, 0.12);
    --hero-orbit-lg:         rgba(255, 107, 0, 0.06);
    --hero-btn-border:       rgba(255, 255, 255, 0.2);
    --hero-pic-shadow:       0 0 30px rgba(255, 107, 0, 0.15), 0 20px 60px rgba(0, 0, 0, 0.5);
    --hero-pic-shadow-hover: 0 0 40px rgba(255, 107, 0, 0.25), 0 20px 60px rgba(0, 0, 0, 0.5);

    --timeline-line: var(--border-strong);

    --grain-opacity: 0.04;
}

[data-theme="light"] {
    --bg-primary:     #f5f5f0;
    --bg-card:        #ffffff;
    --bg-card-alt:    #f0efe8;
    --text-primary:   #1a1a1f;
    --text-secondary: #4a4a55;
    --text-muted:     #8a8a95;

    --accent:         #D95A00;
    --accent-hover:   #FF6B00;
    --accent-glow:    rgba(217, 90, 0, 0.10);

    --border:         #e8e6e1;
    --border-strong:  #d0cdc6;
    --tag-bg:         #f0ede6;
    --tag-text:       #8A3500;

    --shadow:         0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-hover:   0 8px 30px rgba(0, 0, 0, 0.08);

    --nav-bg:         rgba(245, 245, 240, 0.92);
    --nav-text:       #1a1a1f;

    --hero-bg:               #f5f5f0;
    --hero-text:             #1a1a1f;
    --hero-muted:            #6b7280;
    --hero-orbit:            rgba(217, 90, 0, 0.10);
    --hero-orbit-lg:         rgba(217, 90, 0, 0.05);
    --hero-btn-border:       rgba(26, 26, 31, 0.18);
    --hero-pic-shadow:       0 0 30px rgba(217, 90, 0, 0.12), 0 12px 40px rgba(0, 0, 0, 0.1);
    --hero-pic-shadow-hover: 0 0 40px rgba(217, 90, 0, 0.2), 0 12px 40px rgba(0, 0, 0, 0.12);

    --grain-opacity: 0.03;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */

* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 18px; }

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background 0.4s ease, color 0.4s ease;
    min-height: 100vh;
    overflow-x: hidden;
}

img { max-width: 100%; display: block; }

/* Subtle dot-grain overlay — engineered-paper texture */
body::after {
    content: '';
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: var(--grain-opacity);
    background-image: radial-gradient(circle, var(--text-muted) 0.5px, transparent 0.5px);
    background-size: 24px 24px;
}

/* Accessible focus ring */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Skip link — visible on focus only */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 8px;
    background: var(--accent);
    color: #0a0a0f;
    padding: 8px 16px;
    border-radius: 4px;
    z-index: 10000;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    text-decoration: none;
}
.skip-link:focus { left: 8px; }

/* Visually hidden — preserved for screen readers */
.sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0);
    white-space: nowrap; border: 0;
}

/* ── Typography ──────────────────────────────────────────────────────────── */

h1 {
    font-size: clamp(2.8rem, 6vw, 4.2rem);
    font-weight: 900;
    font-family: 'Space Mono', monospace;
    letter-spacing: -0.03em;
    line-height: 1.05;
}
h2 {
    font-size: 1.3rem;
    font-weight: 700;
    font-family: 'Space Mono', monospace;
    letter-spacing: -0.02em;
}
h3 {
    font-size: 1.05rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    letter-spacing: -0.01em;
}
h4 {
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
}
p { color: var(--text-secondary); }

.meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.76rem;
    color: var(--text-muted);
    letter-spacing: 0.01em;
}
.small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

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

/* CJK brand mark */
.brand-cjk {
    font-family: 'Songti TC', 'Songti SC', 'Noto Serif TC', 'Noto Serif CJK TC',
                 'PingFang TC', 'Microsoft JhengHei', serif;
}

/* ── Navbar ──────────────────────────────────────────────────────────────── */

.navbar {
    position: fixed; top: 0; left: 0; right: 0;
    z-index: 1000;
    background: var(--nav-bg);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid transparent;
    padding: 0 32px;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.navbar.scrolled {
    border-bottom-color: var(--border);
    box-shadow: 0 1px 12px rgba(0, 0, 0, 0.06);
}

.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.nav-brand {
    color: var(--accent);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.01em;
}
.nav-brand svg { color: var(--accent); flex-shrink: 0; }

.nav-links {
    display: flex; align-items: center; gap: 32px;
    list-style: none;
}
.nav-links a {
    color: var(--nav-text);
    font-family: 'Outfit', sans-serif;
    font-size: 0.92rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    text-decoration: none;
    opacity: 0.65;
    transition: opacity 0.25s;
    position: relative;
}
.nav-links a:hover,
.nav-links a.active {
    opacity: 1;
    color: var(--nav-text);
}
.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -4px; left: 0; right: 0;
    height: 1.5px;
    background: var(--accent);
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: var(--nav-text);
    font-size: 0.95rem;
    transition: background 0.2s, border-color 0.2s;
}
.theme-toggle:hover {
    background: var(--accent-glow);
    border-color: var(--accent);
}

.nav-hamburger {
    display: none;
    background: none; border: none;
    font-size: 1.3rem; padding: 4px;
    cursor: pointer;
    color: var(--nav-text);
}

@media (max-width: 768px) {
    .navbar { padding: 0 20px; }
    .nav-hamburger { display: block; }
    .nav-links {
        display: none;
        position: absolute;
        top: 60px; left: 0; right: 0;
        background: var(--nav-bg);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        flex-direction: column;
        padding: 16px 24px;
        gap: 18px;
        border-bottom: 1px solid var(--border);
    }
    .nav-links.open { display: flex; }
}

/* ── Hero ────────────────────────────────────────────────────────────────── */

header.hero {
    background: var(--hero-bg);
    color: var(--hero-text);
    padding: 140px 32px 80px;
    position: relative;
    overflow: hidden;
}

header.hero::before {
    content: '';
    position: absolute;
    top: -120px; right: -80px;
    width: 400px; height: 400px;
    border: 1px solid var(--hero-orbit);
    border-radius: 50%;
    animation: orbit-slow 25s linear infinite;
    pointer-events: none;
}
header.hero::after {
    content: '';
    position: absolute;
    bottom: -200px; left: -100px;
    width: 500px; height: 500px;
    border: 1px solid var(--hero-orbit-lg);
    border-radius: 50%;
    animation: orbit-slow 35s linear infinite reverse;
    pointer-events: none;
}

@keyframes orbit-slow {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.hero-canvas {
    position: fixed; top: 0; left: 0;
    width: 100vw; height: 100vh;
    pointer-events: none;
    z-index: 0;
}

.hero-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 48px;
    align-items: center;
    position: relative;
    z-index: 1;
}

.hero-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--accent);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.hero-label::before {
    content: '';
    width: 24px; height: 1px;
    background: var(--accent);
}

header.hero h1 {
    color: var(--hero-text);
    margin-bottom: 20px;
}
header.hero h1 em {
    font-style: italic;
    color: var(--accent);
}

header.hero .headline {
    font-size: 1.1rem;
    color: var(--hero-muted);
    max-width: 440px;
    line-height: 1.6;
    margin-bottom: 8px;
}

header.hero .location {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: var(--hero-muted);
    margin-top: 8px;
    letter-spacing: 0.02em;
    margin-bottom: 28px;
}

.header-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.contact-bar {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--hero-muted);
}
.contact-bar a {
    color: var(--hero-muted);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}
.contact-bar a:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.hero-photo {
    display: flex;
    justify-content: center;
    align-items: center;
}
.profile-pic {
    width: 200px; height: 200px;
    border-radius: 12px;
    object-fit: cover;
    border: 2px solid rgba(255, 107, 0, 0.4);
    box-shadow: var(--hero-pic-shadow);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}
.profile-pic:hover {
    transform: scale(1.02);
    box-shadow: var(--hero-pic-shadow-hover);
}

/* Decorative tile fallback when no profile image (e.g. games hub).
   Mirrors .profile-pic geometry: 200×200, 12px rounded, orange border at 0.4
   alpha. No dashed inset — the reference profile-pic doesn't have one and the
   inset reads as a "missing image placeholder" rather than a clean tile. */
.hero-tile {
    width: 200px; height: 200px;
    border-radius: 12px;
    background: var(--bg-card);
    border: 2px solid rgba(255, 107, 0, 0.4);
    display: flex; align-items: center; justify-content: center;
    font-family: 'Songti TC', 'Songti SC', 'Noto Serif TC', serif;
    font-size: 5rem;
    color: var(--accent);
    box-shadow: var(--hero-pic-shadow);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}
.hero-tile:hover {
    transform: scale(1.02);
    box-shadow: var(--hero-pic-shadow-hover);
}

@keyframes float-gentle {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}
.float-gentle { animation: float-gentle 6s ease-in-out infinite; }

@media (max-width: 768px) {
    header.hero { padding: 110px 20px 60px; }
    .hero-inner { grid-template-columns: 1fr; gap: 32px; }
    .hero-photo { order: -1; }
    .profile-pic,
    .hero-tile { width: 120px; height: 120px; }
    .hero-tile { font-size: 3rem; }
}

/* ── Main + sections ─────────────────────────────────────────────────────── */

main {
    max-width: 800px;
    margin: 0 auto;
    padding: 48px 24px;
    position: relative;
    z-index: 1;
}
main.wide { max-width: 1000px; }
main.extra-wide { max-width: 1200px; }

section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 36px 40px;
    margin-bottom: 20px;
    transition: background 0.3s, border-color 0.3s;
    position: relative;
}

section h2 {
    color: var(--text-primary);
    margin-bottom: 24px;
    margin-left: -40px;
    margin-right: -40px;
    padding: 0 40px 12px;
    border-bottom: 1px solid var(--border);
    letter-spacing: -0.02em;
}
section h2::before {
    content: '// ';
    color: var(--accent);
    font-weight: 400;
}

@media (max-width: 768px) {
    main { padding: 32px 16px; }
    section { padding: 28px 24px; }
    section h2 {
        margin-left: -24px; margin-right: -24px;
        padding: 0 24px 10px;
    }
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 24px;
    border-radius: 4px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.25s ease;
    border: none;
    cursor: pointer;
    letter-spacing: 0.01em;
    min-height: 44px;
}

.btn-primary {
    background: var(--accent);
    color: #0a0a0f;
}
.btn-primary:hover {
    background: var(--accent-hover);
    color: #0a0a0f;
    box-shadow: 0 4px 20px rgba(255, 107, 0, 0.3);
}

.btn-outline {
    background: transparent;
    color: var(--hero-text);
    border: 1px solid var(--hero-btn-border);
}
.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(255, 107, 0, 0.06);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-ghost:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}

/* ── Cards / grids ───────────────────────────────────────────────────────── */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 28px 24px;
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    text-decoration: none;
    color: inherit;
    display: block;
    position: relative;
    overflow: hidden;
}
.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 2px;
    height: 0;
    background: var(--accent);
    transition: height 0.35s ease;
}
.card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow), var(--shadow-hover);
    transform: translateY(-4px);
    color: inherit;
}
.card:hover::before { height: 100%; }
.card h3 { margin-bottom: 8px; color: var(--text-primary); }
.card p  { color: var(--text-secondary); font-size: 0.92rem; line-height: 1.55; }

.card-icon {
    font-size: 1.6rem;
    margin-bottom: 12px;
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
}

.card-meta {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.card-tag {
    font-family: 'JetBrains Mono', monospace;
    background: var(--tag-bg);
    color: var(--tag-text);
    padding: 3px 10px;
    border-radius: 2px;
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    display: inline-block;
}

/* ── Forms ───────────────────────────────────────────────────────────────── */

.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 2px;
    font-size: 0.9rem;
    font-family: 'Outfit', sans-serif;
    background: var(--bg-card-alt);
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    outline: none;
}

/* ── Filter pills ────────────────────────────────────────────────────────── */

.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}
.filter-pills button {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 36px;
}
.filter-pills button:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.filter-pills button.active {
    background: var(--accent);
    color: #0a0a0f;
    border-color: var(--accent);
}

/* ── Search ──────────────────────────────────────────────────────────────── */

.search-container {
    position: relative;
    margin-bottom: 28px;
}
.search-input {
    width: 100%;
    padding: 12px 48px 12px 44px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-card-alt);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    outline: none;
}
.search-input::placeholder { color: var(--text-muted); }
.search-icon {
    position: absolute;
    left: 14px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
    pointer-events: none;
}
.search-shortcut {
    position: absolute;
    right: 12px; top: 50%;
    transform: translateY(-50%);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 2px 6px;
}

/* ── Stats strip ─────────────────────────────────────────────────────────── */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}
.stat-card {
    background: var(--bg-card-alt);
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 24px;
    text-align: center;
    transition: border-color 0.25s;
}
.stat-card:hover { border-color: var(--accent); }
.stat-card .num {
    font-family: 'Space Mono', monospace;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}
.stat-card .label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ── Game tiles (specialised .card variant) ──────────────────────────────── */

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

.game-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 22px 22px 18px;
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 200px;
}
.game-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 2px;
    height: 0;
    background: var(--accent);
    transition: height 0.35s ease;
}
.game-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 0 20px var(--accent-glow), var(--shadow-hover);
}
.game-card:hover::before { height: 100%; }
.game-card:hover .game-icon { color: var(--accent); }

.game-icon {
    font-size: 1.8rem;
    margin-bottom: 12px;
    color: var(--text-secondary);
    transition: color 0.25s;
    line-height: 1;
}
.game-info { flex: 1; display: flex; flex-direction: column; }
.game-info h3 {
    margin-bottom: 8px;
    color: var(--text-primary);
}
.game-info p {
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.55;
    margin-bottom: 16px;
    flex: 1;
}

.play-btn {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-decoration: none;
    transition: all 0.2s;
}
.play-btn::after { content: '→'; transition: transform 0.2s; }
.play-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #0a0a0f;
}
.play-btn:hover::after { transform: translateX(3px); }

/* ── Section header (filter + search row) ────────────────────────────────── */

.section-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */

footer {
    text-align: center;
    padding: 48px 24px 32px;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    position: relative;
    z-index: 1;
}

.footer-logo { margin-bottom: 8px; display: flex; justify-content: center; }
.footer-logo svg {
    color: var(--accent);
    opacity: 0.6;
}

.footer-tagline {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    margin-bottom: 16px;
    opacity: 0.6;
    text-transform: uppercase;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 28px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.footer-links a {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
footer a {
    color: var(--text-muted);
    transition: color 0.2s;
    text-decoration: none;
}
footer a:hover { color: var(--accent); }

/* ── Motion ──────────────────────────────────────────────────────────────── */

.fade-in {
    opacity: 0.15;
    transform: translateY(12px);
    transition: opacity 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}
.fade-in:nth-child(2) { transition-delay: 0.06s; }
.fade-in:nth-child(3) { transition-delay: 0.12s; }
.fade-in:nth-child(4) { transition-delay: 0.18s; }
.fade-in:nth-child(5) { transition-delay: 0.24s; }
.fade-in:nth-child(6) { transition-delay: 0.30s; }

.hero-reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.hero-reveal.visible {
    opacity: 1;
    transform: translateY(0);
}
.hero-reveal:nth-child(1) { transition-delay: 0.0s; }
.hero-reveal:nth-child(2) { transition-delay: 0.1s; }
.hero-reveal:nth-child(3) { transition-delay: 0.2s; }
.hero-reveal:nth-child(4) { transition-delay: 0.3s; }
.hero-reveal:nth-child(5) { transition-delay: 0.4s; }

/* Section-accent divider (use sparingly) */
.section-accent-divider {
    width: 60px;
    height: 1px;
    background: var(--accent);
    margin: 32px auto;
    opacity: 0.6;
}

/* ── Reduced motion ──────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    .fade-in,
    .hero-reveal { opacity: 1; transform: none; }
}

/* ── Back-to-top FAB ─────────────────────────────────────────────────────── */

.back-to-top {
    position: fixed;
    bottom: 24px; right: 24px;
    width: 44px; height: 44px;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--accent);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 900;
    font-size: 1.1rem;
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.back-to-top.visible { display: flex; }
.back-to-top:hover {
    border-color: var(--accent);
    background: var(--accent-glow);
    transform: translateY(-2px);
}

/* ── Tables (admin / leaderboard) ────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
}
table.data-table th {
    text-align: left;
    padding: 12px 14px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
table.data-table td {
    padding: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
}
table.data-table tbody tr { transition: background 0.2s; }
table.data-table tbody tr:hover { background: var(--bg-card-alt); }
table.data-table .rank-1 { color: var(--accent); font-weight: 700; }
table.data-table .rank-2,
table.data-table .rank-3 { color: var(--accent-hover); font-weight: 600; }

/* ── Empty / loading states ──────────────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
}

.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-card) 0%,
        var(--bg-card-alt) 50%,
        var(--bg-card) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.6s ease-in-out infinite;
}
@keyframes skeleton-shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ── Leaderboard runtime-emitted markup ──────────────────────────────────── */

.game-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 24px;
    margin-bottom: 16px;
    position: relative;
    transition: border-color 0.25s;
}
.game-section:hover { border-color: var(--accent); }

.game-section .game-title {
    font-family: 'Space Mono', monospace;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Outfit', sans-serif;
}
.leaderboard-table th {
    text-align: left;
    padding: 10px 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.leaderboard-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text-primary);
}
.leaderboard-table tbody tr:last-child td { border-bottom: 0; }
.leaderboard-table tbody tr { transition: background 0.2s; }
.leaderboard-table tbody tr:hover { background: var(--bg-card-alt); }
.leaderboard-table .rank {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    width: 56px;
}
.leaderboard-table .rank-1 { color: var(--accent); }
.leaderboard-table .rank-2,
.leaderboard-table .rank-3 { color: var(--accent-hover); }
.leaderboard-table .player-name { font-weight: 600; }
.leaderboard-table .score {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent);
    font-weight: 600;
}
.leaderboard-table .date {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Legacy `.filter-btn` (preserved buttons inside .filter-pills) — adopt pill styling */
.filter-pills .filter-btn,
.controls.filter-pills button {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 8px 14px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 36px;
}
.filter-pills .filter-btn:hover,
.controls.filter-pills button:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.filter-pills .filter-btn.active,
.filter-pills .filter-btn[aria-pressed="true"],
.controls.filter-pills button.active {
    background: var(--accent);
    color: #0a0a0f;
    border-color: var(--accent);
}

/* The legacy controls block emitted from the runtime is one big flex wrap */
.controls.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Period indicator */
.period-indicator {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Empty state button used by the legacy runtime */
.empty-state-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    margin-top: 12px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: all 0.2s;
}
.empty-state-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}

/* ── Game shell (shared by every games/*.html page) ──────────────────────── */
/* Used to wrap the game canvas + HUD with the design system's nav/footer
   without forcing per-game layout rewrites. */

.game-shell {
    min-height: calc(100vh - 60px);
    padding: 80px 16px 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    position: relative;
    z-index: 1;
}

.game-frame {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 16px;
    box-shadow: var(--shadow);
    max-width: 100%;
}

.game-meta-bar {
    width: 100%;
    max-width: 900px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.game-meta-bar .game-title-mono {
    color: var(--accent);
    font-weight: 600;
}

.home-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.home-button::before { content: '←'; transition: transform 0.2s; }
.home-button:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}
.home-button:hover::before { transform: translateX(-3px); }
