/* CyberMinute2 - Clean Mobile-First Redesign */

:root {
    --bg: #0a0f1c;
    --card: #111827;
    --accent: #22d3ee;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --success: #4ade80;
    --danger: #f87171;
    --matrix-green: #4ade80;
    --glass-bg: rgba(17, 24, 39, 0.05);
    --glass-border: rgba(148, 163, 184, 0.22);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

/* Matrix-style background canvas */
#matrix-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.26;
    pointer-events: none;
}

.app-container {
    width: 100%;
    max-width: 420px;
    background-color: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(6px);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

/* Screens */
.screen {
    display: none;
    padding: 32px 24px;
    min-height: 520px;
    flex-direction: column;
}

.screen.active {
    display: flex;
}

/* Start & End Screens */
.start-content, .end-content {
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}


h1 {
    font-size: 2.4rem;
    margin: 16px 0 8px;
    font-weight: 700;
}

.tagline {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 40px;
}

.logo {
    max-width: 120px;
    margin: 0 auto 24px;
}

/* Buttons */
.btn {
    display: block;
    width: 100%;
    padding: 16px 24px;
    font-size: 1.05rem;
    font-weight: 600;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 12px;
}

.btn-primary {
    background-color: var(--accent);
    color: #0f172a;
}

.btn-secondary {
    background-color: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
}

.btn-answer {
    flex: 1;
    padding: 20px;
    font-size: 1.3rem;
    background-color: #334155;
    color: white;
}

.btn-answer.true:hover { background-color: #166534; }
.btn-answer.false:hover { background-color: #7f1d1d; }

.btn-next {
    background-color: #334155;
    color: var(--accent);
    margin-top: 16px;
}

/* Question */
.question-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
    gap: 8px;
}

.question {
    font-size: 1.4rem;
    line-height: 1.45;
    text-align: center;
    padding: 0 8px;
}
/* Category label shown only in Study mode - intentionally subtle */
.question-category {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    opacity: 0.65;
    text-align: center;
    /* No margin needed — gap on parent handles spacing */
}

.question-category.hidden {
    display: none;
}

/* Answer Section */
.answer-section {
    margin-top: auto;
}

.answer-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

/* Feedback */
.feedback {
    text-align: center;
}

#feedback-text {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 16px;
    padding: 12px;
    border-radius: 12px;
}

#feedback-text.correct {
    color: var(--success);
    background-color: rgba(74, 222, 128, 0.1);
}

#feedback-text.incorrect {
    color: var(--danger);
    background-color: rgba(248, 113, 113, 0.1);
}

/* Countdown */
.countdown {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.countdown-number {
    font-size: 8rem;
    font-weight: 700;
    color: var(--accent);
}

/* High Score */
.high-score-box {
    margin-top: 40px;
    padding: 16px;
    background-color: #0f172a;
    border-radius: 12px;
}

.high-score-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}

/* Final Score */
.final-score {
    margin: 32px 0;
    font-size: 1.2rem;
    line-height: 1.5;
}

/* Category label on Study Mode end screen */
.end-category {
    font-size: 0.95rem;
    color: var(--text-muted, #94a3b8);
    margin: -12px 0 16px;
    text-align: center;
    font-weight: 500;
}

.big-number {
    display: block;
    font-size: 4rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
}

/* Hidden */
.hidden {
    display: none !important;
}

/* Phase 3+ Polish - Improved buttons and feedback */
.btn-answer {
    transition: all 0.15s ease;
    font-weight: 600;
}

.btn-answer:active {
    transform: scale(0.96);
}

#feedback-text {
    transition: all 0.2s ease;
    font-weight: 600;
}

/* Study mode correct answer highlight */
#feedback-text.correct {
    background-color: rgba(74, 222, 128, 0.15);
    border: 1px solid rgba(74, 222, 128, 0.3);
}

#feedback-text.incorrect {
    background-color: rgba(248, 113, 113, 0.12);
    border: 1px solid rgba(248, 113, 113, 0.25);
}

/* Final micro-animations */
.screen { transition: opacity 0.2s ease; }
.app-container { transition: box-shadow 0.3s ease; }
.btn { transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); }
.btn:active { transform: translateY(1px); }


/* v2 badge styling - improved */
.v2-badge {
    font-size: 0.6em;
    background: linear-gradient(135deg, #22d3ee, #67e8f9);
    color: #0a0f1c;
    padding: 3px 9px;
    border-radius: 6px;
    vertical-align: middle;
    font-weight: 800;
    margin-left: 8px;
    letter-spacing: 0.5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    display: inline-block;
}

/* Modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 24px 28px;
    text-align: center;
    max-width: 320px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.modal-text {
    font-size: 1.1rem;
    margin-bottom: 20px;
    color: #f1f5f9;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}


.modal-buttons .btn {
    flex: 1;
    padding: 10px 16px;
    font-size: 0.95rem;
}

.btn-success {
    background: #4ade80;
    color: #0a0f1c;
    border: none;
}

.btn-danger {
    background: #f87171;
    color: #0a0f1c;
    border: none;
}



.btn-answer.true {
    background-color: #a3e635 !important;
    color: #1a2e05 !important;
    border: none !important;
}

.btn-answer.false {
    background-color: #fb7185 !important;
    color: #3f0f1f !important;
    border: none !important;
}

.modal-content {
    background: rgba(17, 24, 39, 0.05) !important;
    backdrop-filter: blur(6px);
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Leaderboard Submit Score Section */
.submit-score {
    margin: 16px 0 8px;
    padding: 12px;
    background: rgba(17, 24, 39, 0.4);
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.submit-header {
    font-size: 0.85rem;
    margin-bottom: 8px;
    color: #94a3b8;
    font-weight: 600;
}

.submit-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.submit-form input {
    flex: 1;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: rgba(15, 23, 42, 0.6);
    color: #e2e8f0;
    font-size: 0.9rem;
}

.submit-form input:focus {
    outline: none;
    border-color: #67e8f9;
}

.submit-note {
    font-size: 0.7rem;
    color: #64748b;
    margin-top: 6px;
    margin-bottom: 0;
}

/* Leaderboard Modal Styles */
.leaderboard-modal {
    max-width: 480px;
    width: 95%;
}

.leaderboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.leaderboard-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.btn-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 8px;
}

.btn-close:hover {
    color: #e2e8f0;
}

.leaderboard-tabs {
    display: flex;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    margin-bottom: 12px;
}

.tab-button {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 0.9rem;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
}

.tab-button.active {
    color: #67e8f9;
    border-bottom-color: #67e8f9;
    font-weight: 600;
}

.leaderboard-content {
    max-height: 420px;
    overflow-y: auto;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 8px 6px;
    text-align: left;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.leaderboard-table th {
    color: #64748b;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.leaderboard-table td.score {
    font-weight: 700;
    color: #a3e635;
}

.leaderboard-table tr:last-child td {
    border-bottom: none;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #64748b;
}

.error-message {
    color: #fb7185;
    text-align: center;
    padding: 12px;
}

.submit-success {
    text-align: center;
    padding: 12px;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    border-radius: 8px;
    color: #4ade80;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* New success button that opens leaderboard after submission */
.submit-success-btn {
    text-align: center;
    padding: 14px 16px;
    background: rgba(16, 185, 129, 0.18);
    border: 1px solid rgba(16, 185, 129, 0.45);
    border-radius: 10px;
    color: #4ade80;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.35;
}

.submit-success-btn:hover {
    background: rgba(16, 185, 129, 0.28);
    border-color: rgba(16, 185, 129, 0.6);
    transform: translateY(-1px);
}

.submit-success-btn:active {
    transform: translateY(0);
}

.success-top {
    font-size: 0.9rem;
    margin-bottom: 4px;
    opacity: 0.95;
}

.success-view {
    font-size: 1.15rem; /* ~4pt larger than 0.9rem */
    font-weight: 600;
    line-height: 1.2;
}

/* ========================================
   GRID-BASED HEADER REDESIGN (different method)
   Strict 3-column: Timer | Score | Menu
   ======================================== */

.game-header {
    display: grid !important;
    grid-template-columns: auto 1fr auto !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    margin-bottom: 12px !important;
}

/* Timer - strictly left */
.game-header > .timer {
    grid-column: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    font-size: 2.4rem !important;
    font-weight: 700 !important;
    color: #67e8f9 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
}

.game-header > .timer .timer-label {
    font-size: 0.52rem !important;
    color: #64748b !important;
    text-transform: uppercase !important;
    letter-spacing: 0.6px !important;
    margin-bottom: 1px !important;
    font-weight: 600 !important;
}

/* Score - strictly centered via the middle grid column */
.game-header > .score {
    grid-column: 2 !important;
    text-align: center !important;
    font-size: 1.9rem !important;
    font-weight: 700 !important;
    color: #67e8f9 !important;
    line-height: 1 !important;
}

.game-header > .score .score-label {
    display: block !important;
    font-size: 0.52rem !important;
    font-weight: 700 !important;
    color: #f87171 !important;
    letter-spacing: 0.6px !important;
    margin-bottom: 0 !important;
    text-transform: uppercase !important;
}

/* Menu button - strictly right column, content-sized only */
.game-header > .btn-menu {
    grid-column: 3 !important;
    justify-self: end !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    flex: none !important;
    margin-left: 0 !important;
}

.btn-menu {
    font-size: 0.68rem !important;
    padding: 4px 10px !important;
    background: rgba(148, 163, 184, 0.12) !important;
    border: 1px solid rgba(148, 163, 184, 0.22) !important;
    color: #cbd5e1 !important;
    border-radius: 9999px !important;
    white-space: nowrap !important;
    line-height: 1 !important;
    min-height: 26px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: fit-content !important;
    max-width: 68px !important;   /* hard safety cap */
    box-sizing: border-box !important;
    cursor: pointer !important;
}

.btn-menu:hover {
    background: rgba(148, 163, 184, 0.22) !important;
    border-color: rgba(148, 163, 184, 0.35) !important;
}

/* ============================================
   Study Category Picker Modal (STUDY_MODE_CATEGORIES_PLAN.md)
   ============================================ */

.study-category-modal {
    max-width: 420px;
    padding: 24px;
}

.study-category-modal .modal-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 8px 0 20px;
    text-align: center;
}

.study-all-btn {
    width: 100%;
    margin-bottom: 16px;
    padding: 14px 20px;
    font-size: 1.05rem;
    font-weight: 600;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.category-btn {
    background: rgba(148, 163, 184, 0.12);
    border: 1px solid rgba(148, 163, 184, 0.25);
    color: var(--text);
    padding: 12px 10px;
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.category-btn:hover {
    background: rgba(34, 211, 238, 0.15);
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
}

.category-btn:active {
    transform: scale(0.98);
}

/* Optional: slightly different treatment for "All" if needed */
