/* AYHEM GAME HUB - Perfectly Balanced Classroom Projection Layout */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&family=Outfit:wght@600;800;900&display=swap');

:root {
    --bg-dark: #0a0a16;
    --bg-card: rgba(255, 255, 255, 0.07);
    --bg-card-border: rgba(255, 255, 255, 0.15);
    --gold: #ffb703;
    --gold-glow: rgba(255, 183, 3, 0.4);
    
    /* Teams */
    --team-blue: #3a86ef;
    --team-blue-glow: rgba(58, 134, 239, 0.5);
    --team-red: #ff0054;
    --team-red-glow: rgba(255, 0, 84, 0.5);
    --team-green: #38b000;
    --team-green-glow: rgba(56, 176, 0, 0.5);
    --team-yellow: #ffb703;
    --team-yellow-glow: rgba(255, 183, 3, 0.5);
    
    --text-light: #ffffff;
    --text-muted: #a0a5c0;
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Fredoka', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

html, body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: radial-gradient(circle at center, #1b1035 0%, #0a0a16 100%);
    font-family: var(--font-body);
    color: var(--text-light);
}

/* App Container */
#app {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Header & Scoreboard */
header {
    height: 56px;
    min-height: 56px;
    background: rgba(10, 10, 22, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 2px solid var(--bg-card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 50;
    flex-shrink: 0;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.app-title {
    font-family: var(--font-heading);
    font-size: 1.45rem;
    font-weight: 900;
    background: linear-gradient(135deg, #ffb703, #fb8500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: 1px;
    filter: drop-shadow(0 2px 8px var(--gold-glow));
}

.round-badge {
    background: linear-gradient(135deg, #7209b7, #4361ee);
    color: #fff;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 800;
    padding: 0.25rem 0.8rem;
    border-radius: 20px;
    border: 2px solid rgba(255,255,255,0.2);
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 0 10px rgba(67, 97, 238, 0.4);
}

/* Scoreboard */
.scoreboard {
    display: flex;
    gap: 0.7rem;
}

.team-score-card {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 1rem;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid transparent;
    font-size: 1.05rem;
    font-weight: 800;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.team-score-card.active-turn {
    transform: scale(1.08);
    box-shadow: 0 0 18px rgba(255, 255, 255, 0.7) !important;
}

.team-score-card.t1 {
    border-color: var(--team-blue);
    box-shadow: 0 0 8px var(--team-blue-glow);
}

.team-score-card.t2 {
    border-color: var(--team-red);
    box-shadow: 0 0 8px var(--team-red-glow);
}

.team-score-card.t3 {
    border-color: var(--team-green);
    box-shadow: 0 0 8px var(--team-green-glow);
}

.team-score-card.t4 {
    border-color: var(--team-yellow);
    box-shadow: 0 0 8px var(--team-yellow-glow);
}

.score-num {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 900;
    color: var(--gold);
}

/* Header Controls */
.header-actions {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--bg-card-border);
    background: var(--bg-card);
    color: #fff;
    font-size: 1.15rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: rgba(255,255,255,0.18);
    transform: scale(1.05);
}

/* Main Viewport Screen Layout */
main {
    flex: 1;
    height: calc(100vh - 56px);
    position: relative;
    overflow: hidden;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    transform: scale(0.98);
    overflow: hidden;
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

.screen-title {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #ffffff, #a0a5c0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.2rem;
    text-align: center;
}

.screen-subtitle {
    font-size: 1.15rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-weight: 600;
    text-align: center;
}

/* LANDING HERO SUBJECT PANELS */
.hub-panels {
    display: flex;
    gap: 1.8rem;
    width: 90%;
    max-width: 1000px;
    justify-content: center;
}

.hub-panel {
    flex: 1;
    height: 280px;
    border-radius: 28px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 15px 35px rgba(0,0,0,0.5);
}

.hub-math {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    border: 3.5px solid #3a86ef;
}

.hub-english {
    background: linear-gradient(135deg, #7209b7 0%, #4361ee 100%);
    border: 3.5px solid #f72585;
}

.hub-panel:hover {
    transform: translateY(-8px) scale(1.03);
    box-shadow: 0 20px 40px rgba(0,0,0,0.6);
}

.hub-panel-icon {
    font-size: 4.2rem;
    margin-bottom: 0.4rem;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.4));
}

.hub-panel-title {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 900;
    color: #fff;
    letter-spacing: 1.2px;
}

.hub-panel-sub {
    font-size: 1.1rem;
    color: rgba(255,255,255,0.85);
    font-weight: 600;
    margin-top: 0.2rem;
}

.hub-panel-arrow {
    margin-top: 1rem;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--gold);
    background: rgba(0,0,0,0.3);
    padding: 0.4rem 1.4rem;
    border-radius: 20px;
    border: 2px solid rgba(255,255,255,0.2);
}

/* Subject Back Row */
.subject-back-row {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    margin-bottom: 0.3rem;
}

.btn-back-hub {
    background: rgba(255,255,255,0.1);
    border: 2px solid var(--bg-card-border);
    border-radius: 14px;
    padding: 0.5rem 1.2rem;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-back-hub:hover {
    background: rgba(255,255,255,0.25);
}

/* Games Grid */
.games-grid {
    display: grid;
    gap: 1.4rem;
    width: 92%;
    max-width: 1050px;
}

.grid-3-cols {
    grid-template-columns: repeat(3, 1fr);
}

.game-card {
    background: var(--bg-card);
    border: 3px solid var(--bg-card-border);
    border-radius: 24px;
    padding: 1.6rem 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.game-card:hover {
    border-color: var(--gold);
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), 0 0 20px var(--gold-glow);
    background: rgba(255, 255, 255, 0.12);
}

.game-icon {
    font-size: 3.4rem;
    margin-bottom: 0.6rem;
    filter: drop-shadow(0 3px 8px rgba(0,0,0,0.3));
}

.game-card-title {
    font-family: var(--font-heading);
    font-size: 1.55rem;
    font-weight: 900;
    color: #fff;
    margin-bottom: 0.3rem;
}

.game-card-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.3;
}

/* Settings Box */
.settings-box {
    background: var(--bg-card);
    border: 3px solid var(--bg-card-border);
    border-radius: 24px;
    padding: 1.6rem 2.2rem;
    width: 90%;
    max-width: 680px;
    text-align: center;
    margin-bottom: 0.8rem;
}

.settings-heading {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--gold);
    margin-bottom: 1.1rem;
}

.team-count-options {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.team-count-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    border: 3px solid var(--bg-card-border);
    border-radius: 18px;
    padding: 1rem 0.5rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    transition: all 0.2s ease;
}

.team-count-btn span {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 900;
    color: #fff;
}

.team-count-btn small {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.team-count-btn.active, .team-count-btn:hover {
    border-color: var(--gold);
    background: rgba(255, 183, 3, 0.15);
    transform: translateY(-2px);
}

/* Difficulty Buttons */
.difficulty-options {
    display: flex;
    gap: 1.4rem;
    margin-bottom: 1.5rem;
}

.diff-btn {
    padding: 1.1rem 2.4rem;
    border-radius: 20px;
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 900;
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
}

.diff-btn.easy { background: linear-gradient(135deg, #38b000, #70e000); }
.diff-btn.medium { background: linear-gradient(135deg, #ffb703, #fb8500); }
.diff-btn.hard { background: linear-gradient(135deg, #ff0054, #9e0059); }

.diff-btn:hover {
    transform: translateY(-3px) scale(1.03);
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, #ffb703, #fb8500);
    color: #1b1035;
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 900;
    padding: 0.85rem 2.4rem;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(251, 133, 0, 0.4);
    transition: all 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    padding: 0.7rem 1.8rem;
    border-radius: 16px;
    border: 2px solid var(--bg-card-border);
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Gameplay Arena */
.game-play-area {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.6rem;
    border-radius: 24px;
    overflow: hidden;
}

/* MEMORY MATRIX 4X4 GRID SYSTEM */
.memory-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    grid-template-rows: repeat(4, 1fr) !important;
    gap: 0.9rem !important;
    width: 90% !important;
    max-width: 920px !important;
    height: 480px !important;
    margin: 0 auto;
}

.memory-card {
    background: var(--bg-card);
    border: 3px solid var(--bg-card-border);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    user-select: none;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

.memory-card:hover {
    transform: scale(1.04);
    border-color: var(--gold);
    box-shadow: 0 10px 25px var(--gold-glow);
}

.memory-card.flipped {
    background: rgba(67, 97, 238, 0.25);
    border-color: #4361ee;
    box-shadow: 0 0 20px rgba(67, 97, 238, 0.5);
}

.memory-card.matched {
    background: linear-gradient(135deg, rgba(56, 176, 0, 0.3), rgba(16, 185, 129, 0.3));
    border-color: var(--team-green);
    box-shadow: 0 0 25px var(--team-green-glow);
    pointer-events: none;
}

/* STAGE CARD (FLAGS, CARS, GRAMMAR, TRIVIA) */
.flag-stage-card {
    width: 90%;
    max-width: 980px;
    background: var(--bg-card);
    border: 3.5px solid var(--bg-card-border);
    border-radius: 26px;
    padding: 1.2rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.9rem;
    box-shadow: 0 15px 40px rgba(0,0,0,0.5);
}

.flag-image-frame {
    width: 380px;
    height: 200px;
    border-radius: 20px;
    border: 5px solid #ffffff;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    overflow: hidden;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flag-image-frame img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.flag-answer-reveal-box {
    width: 100%;
    min-height: 58px;
    background: rgba(255, 183, 3, 0.12);
    border: 3px dashed var(--gold);
    border-radius: 18px;
    padding: 0.5rem 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.flag-answer-reveal-box.revealed {
    background: linear-gradient(135deg, #ffb703, #fb8500);
    border-style: solid;
    box-shadow: 0 0 25px var(--gold-glow);
}

.flag-country-title {
    font-family: var(--font-heading);
    font-size: 2.1rem;
    font-weight: 900;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    text-align: center;
}

/* Turn Action Buttons */
.turn-action-buttons {
    display: flex;
    gap: 1.2rem;
    width: 100%;
    justify-content: center;
}

.btn-turn-act {
    padding: 0.75rem 2rem;
    border-radius: 16px;
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 900;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 6px 18px rgba(0,0,0,0.4);
    transition: all 0.2s ease;
}

.btn-turn-act.correct-btn {
    background: linear-gradient(135deg, #15803d, #22c55e);
}

.btn-turn-act.wrong-btn {
    background: linear-gradient(135deg, #9f1239, #f43f5e);
}

.btn-turn-act.reveal-btn {
    background: linear-gradient(135deg, #7209b7, #4361ee);
}

.btn-turn-act:hover {
    transform: translateY(-3px) scale(1.02);
}

.btn-turn-act:active {
    transform: scale(0.95);
}

/* Question Display Box */
.question-box {
    background: var(--bg-card);
    border: 3px solid var(--bg-card-border);
    border-radius: 20px;
    padding: 1.4rem 2rem;
    width: 100%;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.question-text {
    font-family: var(--font-heading);
    font-size: 2.3rem;
    font-weight: 900;
    line-height: 1.25;
    color: #fff;
}

/* Answers Grid */
.answers-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.1rem;
    width: 90%;
    max-width: 980px;
}

.answer-btn {
    background: var(--bg-card);
    border: 3px solid var(--bg-card-border);
    border-radius: 20px;
    padding: 1.2rem;
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 800;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    min-height: 80px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

/* Modals & Overlays */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 10, 22, 0.85);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.scoring-modal {
    background: #121124;
    border: 3.5px solid var(--gold);
    border-radius: 24px;
    padding: 1.8rem;
    width: 90%;
    max-width: 580px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6), 0 0 30px var(--gold-glow);
    text-align: center;
}

.scoring-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 900;
    color: var(--gold);
    margin-bottom: 1.2rem;
}

.scoring-teams {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.score-team-btn {
    flex: 1;
    min-width: 110px;
    height: 80px;
    border-radius: 18px;
    border: 3px solid transparent;
    color: #fff;
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    transition: transform 0.15s ease;
}

.score-team-btn.t1 { background: linear-gradient(135deg, #1d4ed8, #3b82f6); border-color: var(--team-blue); }
.score-team-btn.t2 { background: linear-gradient(135deg, #be123c, #f43f5e); border-color: var(--team-red); }
.score-team-btn.t3 { background: linear-gradient(135deg, #15803d, #22c55e); border-color: var(--team-green); }
.score-team-btn.t4 { background: linear-gradient(135deg, #d97706, #fbbf24); border-color: var(--team-yellow); color: #1b1035; }

/* Countdown Overlay */
.countdown-num {
    font-family: var(--font-heading);
    font-size: 8.5rem;
    font-weight: 900;
    color: var(--gold);
    text-shadow: 0 0 35px var(--gold-glow);
}

/* Floating Teacher Button */
.teacher-floating-btn {
    position: fixed;
    bottom: 18px;
    right: 18px;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7209b7, #4361ee);
    border: 2.5px solid #fff;
    color: #fff;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,0.5);
    z-index: 90;
}

/* Teacher Menu Panel */
.teacher-panel {
    background: #121124;
    border: 3.5px solid #4361ee;
    border-radius: 24px;
    padding: 1.8rem;
    width: 90%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.teacher-panel-title {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 900;
    text-align: center;
    color: #4361ee;
    margin-bottom: 0.6rem;
}

.teacher-action-btn {
    width: 100%;
    height: 48px;
    border-radius: 14px;
    border: 2px solid var(--bg-card-border);
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
}

/* Confetti Canvas */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 120;
}
