:root {
    --accent: #7c3aed;
    --accent-dark: #5b21b6;
    --bg: #0f0d1a;
    --surface: #1a1628;
    --surface-2: #241d38;
    --text: #f1edfa;
    --muted: #a79fc4;
    --border: #352b52;
    --radius: 12px;
    --shadow: 0 4px 16px rgb(0 0 0 / 0.35);
    --gold: #f5c518;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Tahoma, Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
}

a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

.container { max-width: 1080px; margin-inline: auto; padding-inline: 16px; }

.site-main { padding-block: 32px 48px; }

/* Header */
.site-header {
    background: rgb(15 13 26 / 0.92);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(8px);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.25rem; color: var(--text); text-decoration: none; }
.brand__mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff; font-size: 0.85rem; letter-spacing: 0.05em;
}
.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav a { color: var(--text); text-decoration: none; padding: 8px 12px; border-radius: 8px; }
.site-nav a:hover { background: var(--surface-2); }
.nav-toggle { display: none; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; font-size: 1.25rem; padding: 6px 12px; cursor: pointer; }
.locale-switcher { display: inline-flex; align-items: center; gap: 8px; margin-inline-start: 12px; padding-inline-start: 12px; border-inline-start: 1px solid var(--border); font-size: 0.9rem; }
.locale-switcher a { color: var(--muted); }

/* Hero */
.hero {
    background:
        radial-gradient(60% 120% at 50% 0%, rgb(124 58 237 / 0.35), transparent 70%),
        var(--bg);
    padding-block: 56px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}
.hero__kicker { color: var(--gold); font-weight: 700; letter-spacing: 0.08em; margin: 0 0 8px; }
.hero__title { font-size: clamp(1.75rem, 4vw, 2.75rem); margin: 0 0 8px; }
.hero__lead { color: var(--muted); max-width: 640px; margin: 0 auto 24px; }
.hero-search { display: flex; gap: 8px; max-width: 560px; margin-inline: auto; }
.hero-search__input {
    flex: 1; font-size: 16px; padding: 12px 16px;
    border-radius: var(--radius); border: 1px solid var(--border);
    background: var(--surface); color: var(--text);
}
.hero-search__btn { white-space: nowrap; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Stats */
.stats-strip { padding-block: 24px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px; text-align: center;
}
.stat-card__num { display: block; font-size: 1.75rem; font-weight: 800; color: var(--gold); }
.stat-card__label { color: var(--muted); font-size: 0.95rem; }

/* Sections + cards */
.section-block { padding-block: 8px 24px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-head h2 { margin: 0; font-size: 1.4rem; }
.section-head__more { font-size: 0.95rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.game-card { transition: transform 0.15s ease, border-color 0.15s ease; }
.game-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card__title { margin: 0 0 8px; font-size: 1.15rem; }
.card__title a { color: var(--text); text-decoration: none; }
.card__title a:hover { color: var(--accent); }
.card__meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.85rem; margin-bottom: 8px; }
.badge {
    display: inline-block; background: var(--surface-2); color: var(--gold);
    border: 1px solid var(--border); border-radius: 999px;
    padding: 2px 10px; font-size: 0.8rem; text-decoration: none;
}
.card__excerpt { color: var(--muted); margin: 0 0 12px; }
.card__more { margin: 0; }

/* Single / page */
.single__header h1, .page h1, .archive__header h1 { margin-top: 0; }
.single__date { color: var(--muted); font-size: 0.9rem; }
.single__body { margin-top: 16px; }
.richtext { overflow-wrap: anywhere; }
.single__fields { display: grid; gap: 8px; margin-top: 24px; padding: 0; }
.field-row { display: grid; grid-template-columns: 160px 1fr; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; }
.field-row dt { color: var(--muted); margin: 0; }
.field-row dd { margin: 0; }
.single__terms { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }

/* Search */
.search__form { display: flex; gap: 8px; margin-bottom: 20px; }
.search__input {
    flex: 1; font-size: 16px; padding: 12px 16px;
    border-radius: var(--radius); border: 1px solid var(--border);
    background: var(--surface); color: var(--text);
}
.search__error { color: #f87171; }
.search__count { color: var(--muted); }
.search__results { display: grid; gap: 10px; padding: 0; list-style: none; }
.search__results li { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; }
.search__results a { color: var(--text); text-decoration: none; }
.empty { color: var(--muted); }

/* Buttons */
.btn {
    display: inline-block; background: var(--accent); color: #fff;
    padding: 10px 20px; border: 0; border-radius: 8px;
    font-size: 16px; font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--accent-dark); }

/* Pagination */
.pagination { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 32px; }
.page-link { color: var(--text); text-decoration: none; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; }
.page-status { color: var(--muted); }

/* 404 */
.notfound { text-align: center; padding-block: 48px; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding-block: 28px; color: var(--muted); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer-inner p { margin: 0; }
.footer-nav { display: flex; gap: 16px; }
.footer-nav a { color: var(--muted); text-decoration: none; }

.hero__play { margin: 20px 0 0; }
.hero__play-btn {
    display: inline-block;
    text-decoration: none;
    background: var(--gold);
    color: #1a1408;
    font-weight: 700;
    border: 0;
    border-radius: 10px;
    padding: 12px 22px;
}

/* WebGL play shell */
body.play-layout { background: #0a0814; }
.play-main { min-height: 100vh; }
.play-stage {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.play-stage__bar {
    padding: 12px 16px 8px;
    border-bottom: 1px solid var(--border);
    background: rgb(15 13 26 / 0.95);
}
.play-stage__back {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
}
.play-stage__title {
    margin: 6px 0 4px;
    font-size: 1.35rem;
}
.play-stage__hint {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}
.play-stage__frame-wrap {
    flex: 1;
    min-height: 70vh;
    background: #000;
}
.play-stage__frame {
    display: block;
    width: 100%;
    min-width: 320px;
    min-height: 480px;
    height: min(86vh, 920px);
    border: 0;
    background: #000;
}

/* Mobile nav */
@media (max-width: 640px) {
    .nav-toggle { display: inline-block; }
    .site-nav { display: none; position: absolute; inset-inline: 0; top: 100%; background: var(--surface); border-bottom: 1px solid var(--border); flex-direction: column; align-items: stretch; padding: 8px 16px 16px; }
    .site-header { position: sticky; }
    .header-inner { position: relative; }
    .site-nav.open { display: flex; }
    .hero-search { flex-direction: column; }
    .field-row { grid-template-columns: 1fr; }
    .footer-inner { flex-direction: column; text-align: center; }
}
