/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:         #f0f2ff;
    --bg2:        #ffffff;
    --bg3:        #e8ebff;
    --accent:     #6c2bd9;
    --accent2:    #ff6b35;
    --accent3:    #4f46e5;
    --text:       #1a1a2e;
    --text-muted: #6b7280;
    --glow:       0 0 20px rgba(108,43,217,0.3);
    --glow2:      0 0 20px rgba(255,107,53,0.3);
    --radius:     12px;
    --font:       'Tajawal', sans-serif;
}

html {
    overflow-x: hidden;
    max-width: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    min-height: 100vh;
    overflow-x: hidden;
    max-width: 100%;
}

/* ===== COLORFUL BACKGROUND ===== */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 10% 20%, rgba(108,43,217,0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 90% 80%, rgba(255,107,53,0.10) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(79,70,229,0.07) 0%, transparent 70%),
        linear-gradient(135deg, #f0f2ff 0%, #e8ebff 50%, #fdf0ff 100%);
    pointer-events: none;
    z-index: 0;
}

/* ===== NAVBAR ===== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255,255,255,0.88);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(108,43,217,0.15);
    box-shadow: 0 2px 20px rgba(108,43,217,0.08);
    padding: 0 2rem;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-logo {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}
.logo-text {
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--accent);
    text-shadow: var(--glow);
    letter-spacing: 2px;
}
.logo-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-user {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.badge-admin {
    background: linear-gradient(135deg, var(--accent3), #a855f7);
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 700;
}

.btn-nav {
    color: var(--text);
    text-decoration: none;
    padding: 6px 16px;
    border-radius: 8px;
    border: 1px solid rgba(108,43,217,0.25);
    font-size: 0.9rem;
    transition: all 0.2s;
}
.btn-nav:hover { border-color: var(--accent); color: var(--accent); }
.btn-nav-accent {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #000 !important;
    border-color: transparent !important;
    font-weight: 700;
}
.btn-nav-accent:hover { opacity: 0.85; color: #000; }

.btn-nav-logout {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid rgba(108,43,217,0.2);
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font);
    font-size: 0.9rem;
    transition: all 0.2s;
}
.btn-nav-logout:hover { border-color: #ef4444; color: #ef4444; }

/* ===== HOME PAGE ===== */
.hero {
    position: relative;
    z-index: 1;
    min-height: calc(100vh - 64px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
}

.hero-badge {
    display: inline-block;
    background: rgba(108,43,217,0.08);
    border: 1px solid rgba(108,43,217,0.25);
    color: var(--accent);
    padding: 6px 20px;
    border-radius: 30px;
    font-size: 0.85rem;
    margin-bottom: 2rem;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.hero-title {
    font-size: clamp(3rem, 10vw, 7rem);
    font-weight: 900;
    line-height: 1;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--accent3) 0%, var(--accent) 50%, var(--accent2) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 30px rgba(108,43,217,0.25));
}

.hero-subtitle {
    font-size: clamp(1rem, 3vw, 1.4rem);
    color: var(--text-muted);
    max-width: 500px;
    margin: 0 auto 2rem;
    line-height: 1.6;
}

.hero-guest-note {
    margin-top: 1.5rem;
    background: rgba(108,43,217,0.07);
    border: 1px solid rgba(108,43,217,0.18);
    border-radius: 30px;
    padding: 8px 22px;
    font-size: 0.88rem;
    color: var(--text-muted);
    display: inline-block;
}

.hero-buttons {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-hero {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 16px 40px;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 1.1rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.1);
    transform: translateX(-100%);
    transition: transform 0.3s;
}
.btn-hero:hover::before { transform: translateX(0); }

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #fff;
    box-shadow: 0 8px 32px rgba(108,43,217,0.35);
}
.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(108,43,217,0.45);
    color: #fff;
}

.btn-secondary {
    background: linear-gradient(135deg, var(--accent3), #a855f7);
    color: #fff;
    box-shadow: 0 8px 32px rgba(124,58,237,0.35);
}
.btn-secondary:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(124,58,237,0.5);
}

/* ===== GAME CARDS ===== */
.games-section {
    position: relative;
    z-index: 1;
    padding: 4rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.section-title {
    text-align: center;
    font-size: 2rem;
    font-weight: 900;
    color: var(--accent);
    margin-bottom: 2.5rem;
    text-shadow: var(--glow);
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.game-card {
    background: var(--bg2);
    border: 1px solid rgba(108,43,217,0.12);
    border-radius: 16px;
    padding: 2rem;
    text-decoration: none;
    color: var(--text);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(108,43,217,0.07);
}
.game-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent, rgba(108,43,217,0.05));
    opacity: 0;
    transition: opacity 0.3s;
}
.game-card:hover { transform: translateY(-6px); border-color: var(--accent); box-shadow: 0 12px 40px rgba(108,43,217,0.15); }
.game-card:hover::before { opacity: 1; }

.game-card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}
.game-card-title {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--accent);
}
.game-card-desc { color: var(--text-muted); font-size: 0.95rem; line-height: 1.5; margin-bottom: 1rem; }

.game-card-active { border-color: rgba(108,43,217,0.3) !important; }
.game-card-match  { border-color: rgba(255,107,53,0.25) !important; }
.game-card-soon   { opacity: 0.55; cursor: default; pointer-events: none; }

.game-card-badge-live {
    display: inline-block; background: rgba(16,185,129,0.1);
    border: 1px solid rgba(16,185,129,0.3); color: #059669;
    font-size: 0.72rem; font-weight: 700; padding: 2px 10px;
    border-radius: 20px; margin-bottom: 0.75rem;
}
.game-card-badge-admin {
    display: inline-block; background: rgba(255,107,53,0.1);
    border: 1px solid rgba(255,107,53,0.3); color: var(--accent2);
    font-size: 0.72rem; font-weight: 700; padding: 2px 10px;
    border-radius: 20px; margin-bottom: 0.75rem;
}
.game-card-footer {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: auto; padding-top: 0.5rem;
}
.game-players { font-size: 0.8rem; color: var(--text-muted); }
.game-card-play { font-size: 0.9rem; font-weight: 800; color: var(--accent); }

/* ===== HOW TO PLAY ===== */
.how-section {
    position: relative; z-index: 1;
    padding: 3rem 2rem 4rem;
    max-width: 1200px; margin: 0 auto;
}
.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
}
.step-card {
    background: var(--bg2);
    border: 1px solid rgba(108,43,217,0.12);
    border-radius: 16px; padding: 1.5rem;
    text-align: center;
    box-shadow: 0 4px 20px rgba(108,43,217,0.05);
}
.step-num {
    width: 48px; height: 48px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent3), var(--accent));
    color: #fff; font-size: 1.3rem; font-weight: 900;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1rem;
}
.step-title { font-weight: 800; font-size: 1rem; margin-bottom: 0.4rem; }
.step-desc { color: var(--text-muted); font-size: 0.88rem; line-height: 1.5; }

/* ===== AUTH FORMS ===== */
.auth-page {
    position: relative;
    z-index: 1;
    min-height: calc(100vh - 64px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    background: var(--bg2);
    border: 1px solid rgba(108,43,217,0.2);
    border-radius: 20px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(108,43,217,0.12);
}

.auth-title {
    text-align: center;
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--accent);
    margin-bottom: 2rem;
    text-shadow: var(--glow);
}

.form-group {
    margin-bottom: 1.2rem;
}
.form-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.form-group input {
    width: 100%;
    background: var(--bg3);
    border: 1px solid rgba(108,43,217,0.2);
    border-radius: 10px;
    padding: 12px 16px;
    color: var(--text);
    font-family: var(--font);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}
.form-group input:focus { border-color: var(--accent); }
.form-group input::placeholder { color: var(--text-muted); }

.form-error {
    color: #ef4444;
    font-size: 0.82rem;
    margin-top: 4px;
}

.btn-submit {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #000;
    font-family: var(--font);
    font-size: 1.05rem;
    font-weight: 800;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: all 0.3s;
}
.btn-submit:hover { opacity: 0.88; transform: translateY(-2px); }

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.auth-footer a { color: var(--accent); text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }

/* ===== WALA KALMA PAGE ===== */
.wk-page {
    position: relative;
    z-index: 1;
    min-height: calc(100vh - 64px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.wk-header {
    margin-bottom: 3rem;
}

.wk-title {
    font-size: clamp(2.5rem, 8vw, 5rem);
    font-weight: 900;
    background: linear-gradient(135deg, #a855f7, var(--accent3), #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.wk-subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.wk-game-area {
    background: var(--bg2);
    border: 1px solid rgba(108,43,217,0.2);
    border-radius: 20px;
    padding: 3rem 2rem;
    max-width: 700px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(108,43,217,0.12);
}

.wk-word-display {
    font-size: clamp(2rem, 6vw, 4rem);
    font-weight: 900;
    color: var(--accent);
    letter-spacing: 6px;
    text-shadow: var(--glow);
    margin-bottom: 2rem;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wk-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.wk-btn {
    padding: 12px 28px;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}
.wk-btn-start {
    background: linear-gradient(135deg, var(--accent3), #a855f7);
    color: #fff;
    box-shadow: 0 6px 24px rgba(124,58,237,0.4);
}
.wk-btn-start:hover { transform: translateY(-3px); box-shadow: 0 10px 32px rgba(124,58,237,0.5); }
.wk-btn-skip {
    background: var(--bg3);
    color: var(--text-muted);
    border: 1px solid rgba(108,43,217,0.2);
}
.wk-btn-skip:hover { border-color: var(--accent2); color: var(--accent2); }

.wk-score {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin-top: 1.5rem;
}
.score-item {
    text-align: center;
}
.score-value {
    font-size: 2rem;
    font-weight: 900;
    color: var(--accent);
}
.score-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.wk-timer {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: conic-gradient(var(--accent3) var(--progress, 100%), var(--bg3) 0);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--text);
    position: relative;
}
.wk-timer::before {
    content: '';
    position: absolute;
    inset: 6px;
    background: var(--bg2);
    border-radius: 50%;
    z-index: 0;
}
.wk-timer span { position: relative; z-index: 1; }

/* ===== ALERTS ===== */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.alert-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }

/* ===== COMING SOON CARD ===== */
.coming-soon-badge {
    display: inline-block;
    background: rgba(255,107,53,0.1);
    border: 1px solid rgba(255,107,53,0.3);
    color: var(--accent2);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

/* ===== GLOW PULSE ANIMATION ===== */
@keyframes glow-pulse {
    0%, 100% { filter: drop-shadow(0 0 10px rgba(108,43,217,0.3)); }
    50% { filter: drop-shadow(0 0 25px rgba(108,43,217,0.6)) drop-shadow(0 0 50px rgba(79,70,229,0.2)); }
}
.glow-pulse { animation: glow-pulse 2.5s ease-in-out infinite; }

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

/* ===== ADMIN PAGES ===== */
.admin-page {
    position: relative; z-index: 1;
    max-width: 1200px; margin: 0 auto;
    padding: 2rem;
}
.admin-header {
    display: flex; align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem;
}
.admin-header-actions { display: flex; gap: 0.75rem; }
.admin-title { font-size: 1.8rem; font-weight: 900; color: var(--text); }
.admin-sub { color: var(--text-muted); font-size: 0.9rem; }

.btn-primary-sm {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #fff; font-family: var(--font); font-weight: 700;
    padding: 8px 20px; border-radius: 10px;
    text-decoration: none; font-size: 0.9rem;
    border: none; cursor: pointer; transition: all 0.2s;
    display: inline-block;
}
.btn-primary-sm:hover { opacity: 0.88; transform: translateY(-1px); }

.btn-outline-sm {
    background: transparent; color: var(--accent);
    border: 1px solid var(--accent); font-family: var(--font);
    font-weight: 700; padding: 8px 20px; border-radius: 10px;
    text-decoration: none; font-size: 0.9rem;
    cursor: pointer; transition: all 0.2s;
    display: inline-block;
}
.btn-outline-sm:hover { background: var(--accent); color: #fff; }

.empty-state {
    text-align: center; padding: 4rem 2rem;
    color: var(--text-muted);
}
.empty-icon { font-size: 4rem; margin-bottom: 1rem; }

/* ===== MATCHES GRID ===== */
.matches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}
.match-card {
    background: var(--bg2);
    border: 1px solid rgba(108,43,217,0.12);
    border-radius: 16px; padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(108,43,217,0.06);
    transition: all 0.3s;
}
.match-card:hover { transform: translateY(-4px); box-shadow: 0 10px 30px rgba(108,43,217,0.12); }
.match-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.match-status-badge {
    font-size: 0.75rem; padding: 3px 10px; border-radius: 20px;
    background: rgba(108,43,217,0.08); color: var(--accent); font-weight: 700;
}
.match-rounds { font-size: 0.8rem; color: var(--text-muted); }
.match-name { font-size: 1.2rem; font-weight: 800; margin-bottom: 0.75rem; }
.match-teams { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.team-chip {
    background: rgba(108,43,217,0.08); color: var(--accent);
    padding: 3px 12px; border-radius: 20px; font-size: 0.82rem; font-weight: 700;
}
.match-meta { display: flex; justify-content: space-between; color: var(--text-muted); font-size: 0.8rem; margin-bottom: 1rem; }
.match-actions { display: flex; gap: 0.5rem; }
.btn-sm {
    background: var(--bg3); color: var(--text);
    border: 1px solid rgba(108,43,217,0.15);
    padding: 6px 14px; border-radius: 8px;
    text-decoration: none; font-size: 0.85rem;
    font-family: var(--font); cursor: pointer;
    transition: all 0.2s;
}
.btn-sm:hover { border-color: var(--accent); color: var(--accent); }
.btn-gold { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff !important; border-color: transparent !important; }
.mt-1 { margin-top: 0.5rem; }

/* ===== GAME MANAGE PAGE ===== */
.game-manage-page { position: relative; z-index: 1; max-width: 1200px; margin: 0 auto; padding: 1.5rem; }
.game-topbar {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem;
}
.game-title { font-size: 1.6rem; font-weight: 900; }
.status-pill {
    display: inline-block; padding: 4px 14px; border-radius: 20px;
    font-size: 0.8rem; font-weight: 700; margin-top: 4px;
}
.status-pending  { background: rgba(245,158,11,0.1); color: #d97706; }
.status-active   { background: rgba(239,68,68,0.1); color: #ef4444; }
.status-finished { background: rgba(16,185,129,0.1); color: #059669; }

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.25rem;
}
.game-panel {
    background: var(--bg2);
    border: 1px solid rgba(108,43,217,0.12);
    border-radius: 16px; padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(108,43,217,0.06);
}
.game-panel.full-width { grid-column: 1 / -1; }
.panel-title { font-size: 1rem; font-weight: 800; color: var(--text); margin-bottom: 1.2rem; }

/* Scoreboard */
.scoreboard { display: flex; flex-direction: column; gap: 0.75rem; }
.score-row {
    display: flex; justify-content: space-between; align-items: center;
    background: var(--bg3); border-radius: 10px; padding: 12px 16px;
}
.score-team-name { font-weight: 700; font-size: 1rem; }
.score-points {
    font-size: 2rem; font-weight: 900;
    color: var(--accent); min-width: 60px; text-align: center;
}
.rounds-info { text-align: center; color: var(--text-muted); font-size: 0.85rem; margin-top: 1rem; }

/* QR */
.qr-wrapper { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; }
.qr-link { font-size: 0.72rem; color: var(--text-muted); word-break: break-all; text-align: center; max-width: 200px; }

/* Controls */
.btn-control {
    display: block; width: 100%; padding: 14px;
    border: none; border-radius: 12px; cursor: pointer;
    font-family: var(--font); font-size: 1rem; font-weight: 700;
    transition: all 0.3s; text-align: center; text-decoration: none;
}
.btn-green  { background: linear-gradient(135deg, #10b981, #059669); color: #fff; }
.btn-blue   { background: linear-gradient(135deg, var(--accent3), var(--accent)); color: #fff; }
.btn-red    { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; }
.btn-gold   { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; }
.btn-control:hover { opacity: 0.88; transform: translateY(-2px); }

.round-status-box {
    margin-top: 1.25rem;
    background: var(--bg3); border-radius: 12px;
    padding: 1.25rem; text-align: center;
}
.round-team { font-weight: 800; font-size: 1rem; color: var(--accent); margin-bottom: 0.75rem; }
.big-timer { font-size: 3.5rem; font-weight: 900; color: var(--text); }
.timer-bar-wrap { height: 8px; background: var(--bg2); border-radius: 99px; overflow: hidden; margin: 0.5rem 0; }
.timer-bar { height: 100%; background: #10b981; border-radius: 99px; transition: width 0.5s, background 0.5s; width: 100%; }
.round-word-label { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.5rem; }
.round-answered { font-size: 0.9rem; color: var(--text-muted); }

/* Rounds history */
.round-row {
    display: flex; align-items: center; gap: 1rem;
    padding: 10px 0; border-bottom: 1px solid var(--bg3);
    font-size: 0.9rem;
}
.round-row:last-child { border-bottom: none; }
.round-pts { margin-right: auto; font-weight: 800; color: var(--accent); }
.round-status-tag { font-size: 0.75rem; color: var(--text-muted); }

/* ===== CREATE MATCH FORM ===== */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ===== QUESTIONS PAGE ===== */
.questions-layout { display: grid; grid-template-columns: 320px 1fr; gap: 1.5rem; align-items: start; }
@media(max-width:768px) { .questions-layout { grid-template-columns: 1fr; } }
.add-question-card, .questions-list-card {
    background: var(--bg2); border: 1px solid rgba(108,43,217,0.12);
    border-radius: 16px; padding: 1.5rem;
}
.questions-list { max-height: 600px; overflow-y: auto; }
.question-item {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 10px 12px; border-radius: 10px;
    border-bottom: 1px solid var(--bg3);
}
.question-item.inactive { opacity: 0.4; }
.q-cat {
    font-size: 0.72rem; background: rgba(108,43,217,0.08);
    color: var(--accent); padding: 2px 8px; border-radius: 20px;
    white-space: nowrap;
}
.q-word { flex: 1; font-weight: 600; }
.q-actions { display: flex; gap: 0.4rem; }
.btn-xs {
    font-family: var(--font); font-size: 0.72rem; font-weight: 700;
    padding: 3px 9px; border-radius: 6px; border: none;
    cursor: pointer; transition: all 0.2s;
}
.btn-xs-warn  { background: rgba(245,158,11,0.1); color: #d97706; }
.btn-xs-green { background: rgba(16,185,129,0.1); color: #059669; }
.btn-xs-red   { background: rgba(239,68,68,0.1); color: #ef4444; }
.alert-success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3); color: #059669; }
.pagination-wrap { margin-top: 1rem; }

/* ===== REFEREE PAGE ===== */
.referee-page {
    position: relative; z-index: 1;
    min-height: calc(100vh - 64px);
    display: flex; flex-direction: column; align-items: center;
    padding: 1.5rem; max-width: 480px; margin: 0 auto;
}
.referee-header { text-align: center; margin-bottom: 1.5rem; }
.referee-title { font-size: 1.8rem; font-weight: 900; color: var(--accent); }
.referee-match { color: var(--text-muted); }

.referee-state { width: 100%; text-align: center; }

/* Waiting state */
.state-icon { font-size: 4rem; margin-bottom: 1rem; display: block; }
.mini-scoreboard { display: flex; gap: 1rem; justify-content: center; margin-top: 1.5rem; flex-wrap: wrap; }
.mini-score {
    background: var(--bg2); border: 1px solid rgba(108,43,217,0.12);
    border-radius: 10px; padding: 10px 20px;
    display: flex; flex-direction: column; gap: 4px;
}
.mini-score strong { font-size: 1.5rem; color: var(--accent); }

/* Active state */
.ref-round-info {
    display: flex; align-items: center; justify-content: center;
    gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap;
}
.team-badge {
    background: linear-gradient(135deg, var(--accent3), var(--accent));
    color: #fff; padding: 4px 16px; border-radius: 20px;
    font-weight: 700; font-size: 0.9rem;
}

.ref-timer-wrap {
    position: relative; width: 130px; height: 130px;
    margin: 0 auto 1.5rem;
}
.ref-timer-svg { width: 100%; height: 100%; }
.ref-timer-text {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%,-50%);
    font-size: 2.2rem; font-weight: 900; color: var(--text);
}

.ref-word-card {
    background: var(--bg2); border: 2px solid rgba(108,43,217,0.2);
    border-radius: 20px; padding: 2rem 1.5rem;
    margin-bottom: 1rem; transition: all 0.3s;
    box-shadow: 0 8px 30px rgba(108,43,217,0.08);
}
.ref-word-card.flash-correct { background: rgba(16,185,129,0.15); border-color: #10b981; }
.ref-word-card.flash-wrong   { background: rgba(239,68,68,0.15); border-color: #ef4444; }
.ref-word-card.flash-skip    { background: rgba(245,158,11,0.15); border-color: #f59e0b; }
.ref-word { font-size: clamp(2rem, 8vw, 3.5rem); font-weight: 900; color: var(--text); }
.ref-category { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.5rem; }
.ref-answered-info { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 1rem; }

.ref-buttons { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.ref-btn {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 16px 24px; border-radius: 16px;
    border: none; cursor: pointer; font-family: var(--font);
    font-weight: 700; font-size: 0.9rem;
    min-width: 90px; transition: all 0.2s;
}
.ref-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }
.ref-btn:not(:disabled):hover { transform: translateY(-3px); }
.ref-btn-icon { font-size: 1.8rem; }
.ref-btn-correct { background: linear-gradient(135deg, #10b981, #059669); color: #fff; box-shadow: 0 6px 20px rgba(16,185,129,0.3); }
.ref-btn-wrong   { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; box-shadow: 0 6px 20px rgba(239,68,68,0.3); }
.ref-btn-skip    { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; box-shadow: 0 6px 20px rgba(245,158,11,0.3); }

/* Finished state */
.final-scores { margin-top: 1.5rem; }
.final-score-row {
    background: var(--bg2); border: 1px solid rgba(108,43,217,0.12);
    border-radius: 10px; padding: 12px 20px; margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

/* ===== RESULTS PAGE ===== */
.results-page {
    position: relative; z-index: 1;
    max-width: 700px; margin: 0 auto;
    padding: 2rem; text-align: center;
}
.results-header { margin-bottom: 2rem; }
.results-title { font-size: 2.5rem; font-weight: 900; color: var(--accent); }
.results-match-name { font-size: 1.1rem; color: var(--text-muted); }
.results-draw { font-size: 1.5rem; font-weight: 800; margin: 1.5rem 0; }

.results-winner {
    background: linear-gradient(135deg, rgba(108,43,217,0.08), rgba(255,107,53,0.08));
    border: 2px solid var(--accent); border-radius: 20px;
    padding: 2rem; margin-bottom: 2rem;
}
.winner-crown { font-size: 3rem; }
.winner-name  { font-size: 2rem; font-weight: 900; color: var(--accent); }
.winner-pts   { font-size: 1.2rem; color: var(--text-muted); }

.results-scores { margin-bottom: 2rem; }
.results-score-row {
    display: flex; align-items: center; gap: 1rem;
    background: var(--bg2); border: 1px solid rgba(108,43,217,0.12);
    border-radius: 12px; padding: 14px 20px; margin-bottom: 0.75rem;
}
.results-score-row.winner-row { border-color: var(--accent); }
.rank-num { font-size: 1.3rem; font-weight: 900; width: 32px; }
.results-team-name { flex: 1; font-weight: 800; text-align: right; }
.results-pts { font-size: 1.5rem; font-weight: 900; color: var(--accent); }

.results-rounds { background: var(--bg2); border: 1px solid rgba(108,43,217,0.12); border-radius: 16px; padding: 1.5rem; margin-bottom: 2rem; text-align: right; }
.results-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
