/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #0f1117;
    --bg-card: #1a1d27;
    --bg-card-hover: #222632;
    --border: #2a2e3a;
    --text: #e4e6eb;
    --text-muted: #8b8fa3;
    --accent: #4ecdc4;
    --accent-hover: #3dbdb5;
    --danger: #ff6b6b;
    --success: #51cf66;
    --warning: #fcc419;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --max-w: 720px;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-hover);
}

.container {
    width: 100%;
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 1rem;
}

/* ===== Navbar ===== */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.5px;
}

.logo-accent {
    color: var(--accent);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.nav-user {
    color: var(--text-muted);
    font-weight: 500;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font);
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-size: 0.95rem;
    padding: 0.6rem 1.25rem;
}

.btn-sm {
    font-size: 0.85rem;
    padding: 0.4rem 0.85rem;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg);
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: var(--bg);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-block {
    width: 100%;
}

/* ===== Main content ===== */
main.container {
    flex: 1;
    padding-top: 2rem;
    padding-bottom: 2rem;
}

/* ===== Auth Card ===== */
.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    max-width: 420px;
    margin: 2rem auto;
    box-shadow: var(--shadow);
}

.auth-card h1 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.auth-form .form-group {
    margin-bottom: 1rem;
}

.auth-form label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.auth-form input[type="text"],
.auth-form input[type="password"] {
    width: 100%;
    padding: 0.65rem 0.85rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--accent);
}

.auth-form .btn {
    margin-top: 0.5rem;
}

.auth-switch {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ===== Alerts ===== */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-error {
    background: rgba(255, 107, 107, 0.12);
    border: 1px solid rgba(255, 107, 107, 0.3);
    color: var(--danger);
}

.alert-success {
    background: rgba(81, 207, 102, 0.12);
    border: 1px solid rgba(81, 207, 102, 0.3);
    color: var(--success);
}

/* ===== Game Section ===== */
.game-section {
    max-width: 640px;
    margin: 0 auto;
}

.game-title {
    font-size: 1.75rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1.5rem;
}

.no-question {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.no-question h2 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

/* ===== Hints Panel ===== */
.hints-panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.hint-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    transition: all 0.3s ease;
}

.hint-card.revealed {
    border-color: var(--accent);
    border-left: 4px solid var(--accent);
}

.hint-card.locked {
    opacity: 0.5;
    border-style: dashed;
}

.hint-card.hint-animate {
    animation: hintReveal 0.4s ease-out;
}

@keyframes hintReveal {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hint-badge {
    display: inline-block;
    background: rgba(78, 205, 196, 0.15);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.hint-locked-text {
    color: var(--text-muted);
    font-style: italic;
}

/* ===== Guess Form ===== */
.guess-form {
    margin-bottom: 1rem;
}

.guess-input-row {
    display: flex;
    gap: 0.5rem;
}

.guess-input-row input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.guess-input-row input:focus {
    outline: none;
    border-color: var(--accent);
}

.guess-input-row .btn {
    flex-shrink: 0;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.guess-counter {
    text-align: center;
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.guess-counter strong {
    color: var(--accent);
    font-size: 1.1rem;
}

/* ===== Wrong Guesses ===== */
.wrong-guesses {
    margin-bottom: 1rem;
}

.wrong-guesses h3 {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.wrong-guesses ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.wrong-guesses li {
    background: rgba(255, 107, 107, 0.12);
    color: var(--danger);
    font-size: 0.85rem;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 107, 107, 0.25);
}

/* ===== Game Result ===== */
.game-result {
    text-align: center;
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-top: 1rem;
}

.result-success {
    background: rgba(81, 207, 102, 0.1);
    border: 1px solid rgba(81, 207, 102, 0.3);
}

.result-success h2 {
    color: var(--success);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.result-fail {
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
}

.result-fail h2 {
    color: var(--danger);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.result-answer {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.result-points {
    color: var(--text-muted);
}

.login-hint {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    background: var(--bg-card);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px dashed var(--border);
}

/* ===== Leaderboard ===== */
.leaderboard-section h1 {
    font-size: 1.75rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 0.85rem 1rem;
    text-align: left;
}

.leaderboard-table th {
    background: rgba(78, 205, 196, 0.08);
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.leaderboard-table tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.leaderboard-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.leaderboard-table tbody tr:last-child {
    border-bottom: none;
}

.rank-col {
    width: 3.5rem;
    text-align: center;
    font-weight: 700;
}

.rank-1 { color: #ffd700; }
.rank-2 { color: #c0c0c0; }
.rank-3 { color: #cd7f32; }

.points-col {
    text-align: right;
    font-weight: 600;
    color: var(--accent);
}

.games-col {
    text-align: right;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.leaderboard-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid var(--border);
    color: var(--text-muted);
    transition: all 0.2s;
}

.pagination a:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.pagination .active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
    font-weight: 700;
}

/* ===== Footer ===== */
.site-footer {
    text-align: center;
    padding: 1.5rem 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    margin-top: auto;
}

/* ===== Archive Page ===== */
.archive-section {
    max-width: 720px;
    margin: 0 auto;
}

.archive-header {
    text-align: center;
    margin-bottom: 2rem;
}

.archive-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.archive-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.archive-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}

.archive-card {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
    min-height: 90px;
}

.archive-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    color: var(--text);
}

.archive-card-won  { border-left: 3px solid var(--success); }
.archive-card-lost { border-left: 3px solid var(--danger);  }

.archive-card-date {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.archive-card-answer {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}

.archive-card-status {
    margin-top: auto;
}

.status-pill {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
}

.status-won  { background: rgba(81, 207, 102, 0.15); color: var(--success); }
.status-lost { background: rgba(255, 107, 107, 0.12); color: var(--danger); }

.archive-card-locked {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}

.archive-lock {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-muted);
    opacity: 0.4;
}

.archive-play-label {
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 600;
}

.archive-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

/* ===== Play (archive question) page ===== */
.play-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
}

.play-breadcrumb a {
    color: var(--text-muted);
}

.play-breadcrumb a:hover {
    color: var(--accent);
}

.play-date-badge {
    display: inline-block;
    background: rgba(78, 205, 196, 0.12);
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.2rem 0.65rem;
    border-radius: 20px;
    letter-spacing: 0.3px;
}

.archive-points-notice {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-muted);
    background: rgba(78, 205, 196, 0.06);
    border: 1px dashed rgba(78, 205, 196, 0.3);
    border-radius: var(--radius-sm);
    padding: 0.6rem 1rem;
    margin-bottom: 1.25rem;
}

.play-nav-actions {
    text-align: center;
    margin-top: 1.5rem;
}

/* ===== Team Page ===== */
.team-section {
    max-width: 720px;
    margin: 0 auto;
}

.team-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.team-header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.4rem;
}

.team-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.team-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.team-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.team-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.team-card-dev {
    border-color: rgba(78, 205, 196, 0.3);
}

.team-photo-wrap {
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
}

.team-card-dev .team-photo-wrap {
    aspect-ratio: 1 / 1;
}

.team-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    display: block;
}

.team-info {
    padding: 1.1rem 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.team-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.team-bio {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.65;
}

/* ===== Hamburger / Mobile Nav ===== */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 2.25rem;
    height: 2.25rem;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}

.nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: all 0.25s;
}

.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===== Responsive ===== */
@media (max-width: 640px) {
    /* Navbar */
    .nav-inner {
        flex-wrap: nowrap;
        justify-content: space-between;
        position: relative;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        position: absolute;
        top: calc(100% + 0.75rem);
        left: 0;
        right: 0;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        padding: 0.5rem;
        z-index: 200;
        box-shadow: var(--shadow);
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links a,
    .nav-links .nav-user {
        display: block;
        padding: 0.7rem 0.85rem;
        border-radius: var(--radius-sm);
        font-size: 0.95rem;
        text-align: left;
    }

    .nav-links a:hover {
        background: var(--bg-card-hover);
    }

    .nav-links .btn-sm {
        padding: 0.7rem 0.85rem;
        font-size: 0.95rem;
        border-radius: var(--radius-sm);
        width: 100%;
        justify-content: flex-start;
    }

    /* Game */
    .game-title {
        font-size: 1.35rem;
    }

    .hint-card {
        padding: 0.75rem 1rem;
    }

    .hint-badge {
        font-size: 0.7rem;
    }

    .guess-input-row {
        flex-direction: column;
    }

    .guess-input-row .btn {
        width: 100%;
        padding: 0.85rem;
    }

    .guess-input-row input {
        font-size: 1rem;
        padding: 0.85rem 1rem;
    }

    /* Auth */
    .auth-card {
        margin: 0.75rem;
        padding: 1.35rem;
    }

    /* Leaderboard */
    .leaderboard-table th,
    .leaderboard-table td {
        padding: 0.65rem 0.5rem;
        font-size: 0.85rem;
    }

    /* Archive */
    .archive-grid {
        gap: 0.65rem;
    }

    .archive-card {
        padding: 0.85rem;
    }

    /* Play breadcrumb */
    .play-breadcrumb {
        flex-wrap: wrap;
    }

    /* Team */
    .team-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 380px) {
    .archive-grid {
        grid-template-columns: 1fr;
    }
}
