:root {
    --bg: #070b12;
    --bg2: #0d1420;
    --surface: rgba(22, 32, 48, 0.85);
    --surface-solid: #162030;
    --surface2: #1e2d42;
    --text: #eef4ff;
    --muted: #8fa3bf;
    --accent: #5eb3ff;
    --accent-glow: rgba(94, 179, 255, 0.35);
    --accent2: #5ddea8;
    --purple: #a78bfa;
    --border: rgba(120, 150, 190, 0.18);
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    --radius: 16px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: "Inter", "Segoe UI", system-ui, sans-serif;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(94, 179, 255, 0.15), transparent),
        radial-gradient(ellipse 60% 40% at 100% 0%, rgba(167, 139, 250, 0.08), transparent),
        linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; transition: color 0.15s; }
a:hover { color: #9fd0ff; text-decoration: none; }

.container { width: min(1200px, 92vw); margin: 0 auto; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border);
    background: rgba(7, 11, 18, 0.82);
    backdrop-filter: blur(16px);
    padding: 1rem 0;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.logo {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    display: grid;
    place-items: center;
    font-size: 1rem;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.tagline { margin: 0; color: var(--muted); font-size: 0.9rem; }

.nav-stats {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.stat-pill {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.35rem 0.85rem;
    font-size: 0.82rem;
    color: var(--muted);
}

.stat-pill strong { color: var(--accent2); }

.hero {
    text-align: center;
    padding: 4rem 0 2.5rem;
}

.hero-badge {
    display: inline-block;
    background: rgba(94, 179, 255, 0.12);
    border: 1px solid rgba(94, 179, 255, 0.3);
    color: var(--accent);
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 1rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 0 0 0.75rem;
    background: linear-gradient(135deg, #fff 30%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    color: var(--muted);
    max-width: 580px;
    margin: 0 auto 2rem;
    font-size: 1.05rem;
}

.search-wrap {
    position: relative;
    max-width: 680px;
    margin: 0 auto;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.35rem 0.35rem 0.35rem 1rem;
    box-shadow: var(--shadow);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box:focus-within {
    border-color: rgba(94, 179, 255, 0.5);
    box-shadow: 0 0 0 4px rgba(94, 179, 255, 0.12), var(--shadow);
}

.search-icon { color: var(--muted); font-size: 1.1rem; flex-shrink: 0; }

#game-search {
    flex: 1;
    padding: 0.85rem 0;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 1.05rem;
    outline: none;
}

#game-search::placeholder { color: #5a7088; }

.search-hint {
    margin-top: 0.65rem;
    font-size: 0.82rem;
    color: var(--muted);
}

#search-results {
    position: absolute;
    left: 0; right: 0; top: calc(100% + 0.5rem);
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    z-index: 50;
    display: none;
    box-shadow: var(--shadow);
    max-height: 380px;
    overflow-y: auto;
}

#search-results.active { display: block; }

.search-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.8rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.12s;
}

.search-item:last-child { border-bottom: none; }
.search-item:hover, .search-item.focused { background: var(--surface2); }

.search-item img {
    width: 64px;
    height: 30px;
    object-fit: cover;
    border-radius: 5px;
    background: #000;
    flex-shrink: 0;
}

.search-item-info { flex: 1; min-width: 0; }
.search-item-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-item-meta { font-size: 0.78rem; color: var(--muted); }

.section { margin: 3rem 0; }

.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.section h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.section-sub { color: var(--muted); font-size: 0.9rem; margin: 0; }

.filter-bar {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.filter-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
}

.filter-btn:hover, .filter-btn.active {
    background: rgba(94, 179, 255, 0.15);
    border-color: rgba(94, 179, 255, 0.4);
    color: var(--accent);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.1rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    color: inherit;
    text-decoration: none;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-4px);
    border-color: rgba(94, 179, 255, 0.45);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    text-decoration: none;
}

.card-image-wrap { position: relative; overflow: hidden; }

.card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

.card:hover img { transform: scale(1.04); }

.card-badge {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    background: rgba(7, 11, 18, 0.85);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
    font-size: 0.72rem;
    color: var(--accent2);
    font-weight: 600;
}

.card-body { padding: 1rem 1.1rem 1.15rem; flex: 1; display: flex; flex-direction: column; }
.card-body h3 { margin: 0 0 0.4rem; font-size: 1rem; font-weight: 700; color: var(--text); line-height: 1.3; }
.card-body p { margin: 0; color: var(--muted); font-size: 0.88rem; }
.card-genres { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-top: auto; padding-top: 0.65rem; }

.mini-pill {
    font-size: 0.7rem;
    background: var(--surface2);
    border-radius: 999px;
    padding: 0.15rem 0.5rem;
    color: var(--muted);
}

.game-hero {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 2rem;
    margin: 2.5rem 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.game-hero img {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.game-hero h1 { margin: 0 0 0.5rem; font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; }

.meta { color: var(--muted); font-size: 0.92rem; }

.genres { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0.85rem 0; }

.genre-pill {
    background: rgba(94, 179, 255, 0.1);
    border: 1px solid rgba(94, 179, 255, 0.25);
    border-radius: 999px;
    padding: 0.25rem 0.7rem;
    font-size: 0.82rem;
    color: var(--accent);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.7rem 1.15rem;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, var(--accent), #3d8fd9);
    color: #041018;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.92rem;
    transition: transform 0.15s, box-shadow 0.15s;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--accent-glow);
    color: #041018;
}

.btn-secondary {
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover { box-shadow: none; color: var(--text); }

.tutorial-list { list-style: none; padding: 0; display: grid; gap: 0.75rem; }

.tutorial-list li {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.15rem;
    transition: border-color 0.15s;
}

.tutorial-list li:hover { border-color: rgba(94, 179, 255, 0.35); }

.tutorial-list a { font-weight: 600; font-size: 1.02rem; }

.tutorial-page-header { margin: 2rem 0 1.5rem; }

.tutorial-page-header h1 {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0.5rem 0;
}

.tutorial-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem 2rem;
    box-shadow: var(--shadow);
}

.tutorial-content ol {
    line-height: 1.8;
    padding-left: 1.4rem;
    margin: 0;
    counter-reset: steps;
}

.tutorial-content li {
    margin-bottom: 1.1rem;
    padding-left: 0.5rem;
}

.tutorial-content li::marker {
    color: var(--accent);
    font-weight: 700;
}

.sources-panel {
    margin-top: 2rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
}

.sources-toggle {
    width: 100%;
    text-align: left;
    padding: 1.1rem 1.25rem;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sources-toggle::after { content: "▼"; font-size: 0.75rem; color: var(--muted); transition: transform 0.2s; }
.sources-list.open + .sources-toggle::after,
.sources-panel:has(.sources-list.open) .sources-toggle::after { transform: rotate(180deg); }

.sources-list {
    display: none;
    padding: 0 1.25rem 1.25rem;
    border-top: 1px solid var(--border);
}

.sources-list.open { display: block; }

.source-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border);
}

.source-item:last-child { border-bottom: none; }

.badge {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    background: var(--surface2);
    color: var(--muted);
    flex-shrink: 0;
    font-weight: 700;
}

.badge-wiki { color: #7dd3fc; }
.badge-youtube { color: #f87171; }
.badge-steam_guide { color: #86efac; }
.badge-gamefaqs { color: #fcd34d; }

.notice {
    background: rgba(94, 179, 255, 0.08);
    border: 1px solid rgba(94, 179, 255, 0.25);
    border-radius: 12px;
    padding: 1rem 1.15rem;
    color: var(--muted);
}

.browse-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}

.browse-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem 0.9rem;
    font-size: 0.88rem;
    color: var(--text);
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.browse-item:hover {
    border-color: rgba(94, 179, 255, 0.4);
    background: var(--surface2);
    color: var(--accent);
}

.site-footer {
    margin-top: 4rem;
    padding: 2rem 0;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.88rem;
    text-align: center;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.back-link:hover { color: var(--accent); }

.loading {
    text-align: center;
    padding: 3rem;
    color: var(--muted);
}

@media (max-width: 768px) {
    .game-hero { grid-template-columns: 1fr; padding: 1rem; }
    .header-inner { flex-direction: column; align-items: flex-start; }
    .tutorial-content { padding: 1.25rem; }
}
