:root {
    --ink: #18311d;
    --ink-soft: rgba(24, 49, 29, 0.78);
    --cream: #fff7e8;
    --card: rgba(255, 250, 240, 0.93);
    --line: rgba(24, 49, 29, 0.12);
    --green: #5f8128;
    --green-deep: #284b2d;
    --orange: #e8a03f;
    --shadow: 0 22px 60px rgba(15, 35, 17, 0.18);
    --correct: #2d7a2d;
    --wrong: #b83232;
    --timer-full: #5f8128;
    --timer-low: #c94f1a;
}

* { box-sizing: border-box; }

body {
    margin: 0; min-height: 100vh;
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(232, 160, 63, 0.35), transparent 26%),
        radial-gradient(circle at top right, rgba(95, 129, 40, 0.28), transparent 22%),
        linear-gradient(180deg, #16361f 0%, #2f6a3d 23%, #dce6bf 58%, #f5e8ce 100%);
}

a { color: inherit; }

.game-page { width: min(1280px, calc(100% - 2rem)); margin: 0 auto; padding: 1.25rem 0 2rem; }

.game-panel, .card, .overlay-card {
    background: var(--card); backdrop-filter: blur(12px);
    border: 1px solid var(--line); box-shadow: var(--shadow);
}

.control-button, .primary-button { border-radius: 999px; }

.layout {
    display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: 1.25rem; margin-top: 1.25rem;
}

.game-panel { border-radius: 1.8rem; padding: 1.4rem; display: flex; flex-direction: column; gap: 1rem; }
.title-row { display: flex; justify-content: space-between; align-items: start; gap: 1rem; flex-wrap: wrap; }
.title-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }

.eyebrow { margin: 0; color: #75510a; letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.82rem; font-weight: 700; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; }
h1 { margin: 0.25rem 0 0; font-size: clamp(1.8rem, 4vw, 3rem); line-height: 0.98; }
.lead { margin: 0; color: var(--ink-soft); line-height: 1.6; font-size: 1rem; }

/* HUD */
.hud { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.hud-item {
    display: flex; flex-direction: column; align-items: center;
    background: rgba(95, 129, 40, 0.12); border-radius: 0.75rem;
    padding: 0.5rem 1rem; min-width: 5rem; flex: 1;
}
.hud-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); font-weight: 600; }
.hud-item strong { font-size: 1.5rem; font-weight: 700; color: var(--green-deep); }

/* TF shell */
.tf-shell {
    position: relative; border-radius: 1.2rem; overflow: hidden;
    background: rgba(255, 252, 244, 0.6); border: 1px solid var(--line);
    min-height: 400px; display: flex; flex-direction: column;
}

/* Timer */
.timer-bar-bg { height: 8px; background: rgba(24, 49, 29, 0.1); border-radius: 4px 4px 0 0; overflow: hidden; }
.timer-bar { height: 100%; width: 100%; background: var(--timer-full); transition: width 0.25s linear, background-color 0.5s ease; border-radius: 4px; }
.timer-bar.low { background: var(--timer-low); }

/* Overlay */
.overlay {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    background: rgba(22, 54, 31, 0.55); backdrop-filter: blur(6px);
    border-radius: inherit; z-index: 10; padding: 1rem;
}
.overlay.hidden { display: none; }
.overlay-card { border-radius: 1.2rem; padding: 2rem; max-width: 440px; width: 100%; text-align: center; display: flex; flex-direction: column; gap: 0.75rem; background: #fff7e8; }
.overlay-brand { display: flex; align-items: center; justify-content: center; gap: 0.5rem; margin-bottom: 0.25rem; }
.overlay-brand-icon { width: 32px; height: 32px; border-radius: 8px; }
.overlay-brand-name { font-size: 0.85rem; font-weight: 700; color: #3d5a2e; }
.overlay-kicker { margin: 0; font-size: 0.88rem; text-transform: uppercase; letter-spacing: 0.08em; color: #c07b1a; font-weight: 700; }
.overlay-card h2 { margin: 0; font-size: clamp(1.4rem, 3vw, 2rem); color: #18311d; }
.overlay-card p { margin: 0; color: #3a5230; line-height: 1.6; font-size: 0.96rem; }
.overlay-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; margin-top: 0.5rem; }

/* Question area */
.question-area { flex: 1; padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; align-items: center; }
.question-number { margin: 0; font-size: 0.82rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); }

.statement-text {
    margin: 0; font-family: Georgia, serif;
    font-size: clamp(1.1rem, 2.8vw, 1.5rem); line-height: 1.45;
    font-weight: 600; color: var(--green-deep);
    text-align: center; max-width: 600px;
    padding: 1rem; background: rgba(255, 250, 240, 0.85);
    border: 1px solid var(--line); border-radius: 1rem;
}

/* T/F buttons */
.tf-buttons { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.tf-btn {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 1rem 2.5rem; border-radius: 1rem;
    font-size: 1.15rem; font-weight: 700; font-family: inherit;
    cursor: pointer; border: 3px solid transparent;
    transition: transform 0.12s, border-color 0.15s, background 0.15s;
}
.tf-btn:hover:not(:disabled) { transform: translateY(-2px); }
.tf-btn:disabled { cursor: default; opacity: 0.7; }
.tf-icon { font-size: 1.3rem; }

.tf-true { background: rgba(45, 122, 45, 0.12); color: var(--correct); border-color: rgba(45, 122, 45, 0.3); }
.tf-true:hover:not(:disabled) { background: rgba(45, 122, 45, 0.2); border-color: var(--correct); }
.tf-true.selected { background: rgba(45, 122, 45, 0.25); border-color: var(--correct); }

.tf-false { background: rgba(184, 50, 50, 0.1); color: var(--wrong); border-color: rgba(184, 50, 50, 0.25); }
.tf-false:hover:not(:disabled) { background: rgba(184, 50, 50, 0.18); border-color: var(--wrong); }
.tf-false.selected { background: rgba(184, 50, 50, 0.22); border-color: var(--wrong); }

.tf-btn.correct-answer { border-color: var(--correct) !important; background: rgba(45, 122, 45, 0.25) !important; }
.tf-btn.wrong-answer { border-color: var(--wrong) !important; background: rgba(184, 50, 50, 0.2) !important; }

/* Feedback */
.answer-feedback { margin: 0; font-size: 1rem; font-weight: 700; min-height: 1.4rem; transition: color 0.2s; text-align: center; }
.answer-feedback.correct { color: var(--correct); }
.answer-feedback.wrong { color: var(--wrong); }
.answer-feedback.timeout { color: var(--wrong); }

.fact-box {
    background: rgba(95, 129, 40, 0.1); border-left: 3px solid var(--green);
    border-radius: 0 0.5rem 0.5rem 0; padding: 0.6rem 0.8rem;
    font-size: 0.9rem; color: var(--ink-soft); line-height: 1.5;
    display: none; max-width: 600px; text-align: left;
}
.fact-box.visible { display: block; }

/* Fullscreen button */
.canvas-fullscreen-button {
    background: rgba(24, 49, 29, 0.1); border: 1px solid var(--line);
    border-radius: 0.5rem; width: 2.2rem; height: 2.2rem;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    padding: 0; transition: background 0.15s; fill: var(--ink); flex-shrink: 0;
}
.canvas-fullscreen-button:hover { background: rgba(24, 49, 29, 0.2); }

/* Buttons */
.primary-button {
    background: #284b2d; color: #fffaf0; border: none;
    padding: 0.72rem 1.5rem; font-size: 0.96rem; font-weight: 700;
    font-family: inherit; cursor: pointer; transition: background 0.18s, transform 0.1s;
}
.primary-button:hover { background: #1a3320; transform: translateY(-1px); }
.primary-button:active { transform: none; }

.control-button {
    background: rgba(24, 49, 29, 0.08); border: 1px solid var(--line);
    color: var(--ink); padding: 0.5rem 1rem; font-size: 0.9rem;
    font-family: inherit; cursor: pointer; transition: background 0.15s;
}
.control-button:hover { background: rgba(24, 49, 29, 0.15); }
.hidden-action { display: none; }

/* Sidebar */
.sidebar { display: flex; flex-direction: column; gap: 1rem; }
.card { border-radius: 1.2rem; padding: 1.2rem; }
.card-heading { margin: 0 0 0.75rem; font-size: 1rem; font-weight: 700; color: var(--green-deep); }

/* Leaderboard */
.leaderboard-tabs { display: flex; gap: 0.4rem; margin-bottom: 0.75rem; }
.leaderboard-tab {
    padding: 0.35rem 0.75rem; border-radius: 999px; border: 1px solid var(--line);
    background: transparent; font-family: inherit; font-size: 0.82rem;
    cursor: pointer; color: var(--ink-soft); transition: background 0.15s, color 0.15s;
}
.leaderboard-tab.active, .leaderboard-tab:hover { background: var(--green); color: #fff; border-color: var(--green); }
.leaderboard-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.3rem; max-height: 220px; overflow-y: auto; }
.leaderboard-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.88rem; padding: 0.3rem 0.4rem; border-radius: 0.4rem; }
.leaderboard-item:nth-child(odd) { background: rgba(95, 129, 40, 0.06); }
.lb-rank { min-width: 1.5rem; font-weight: 700; color: var(--ink-soft); font-size: 0.8rem; text-align: right; }
.lb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-weight: 700; color: var(--green-deep); white-space: nowrap; }
.leaderboard-empty { color: var(--ink-soft); font-size: 0.9rem; padding: 0.5rem 0; text-align: center; }
.refresh-button { margin-top: 0.5rem; font-size: 0.82rem; padding: 0.35rem 0.7rem; }

/* Submit card */
.form-label { display: block; font-size: 0.88rem; font-weight: 600; margin-bottom: 0.4rem; }
.form-input {
    width: 100%; padding: 0.5rem 0.75rem; border: 1px solid var(--line);
    border-radius: 0.5rem; font-family: inherit; font-size: 0.95rem;
    background: rgba(255, 252, 244, 0.9); color: var(--ink); margin-bottom: 0.6rem;
}
.form-input:focus { outline: 2px solid var(--green); outline-offset: 1px; }
#leaderboard-form { display: flex; flex-direction: column; gap: 0; }
.leaderboard-status { margin: 0.5rem 0 0; font-size: 0.85rem; color: var(--ink-soft); min-height: 1.2rem; }

.share-card .social-share-container { margin: 0; }

.how-list { padding: 0; margin: 0; list-style: none; font-size: .88rem; color: var(--ink-soft); display: flex; flex-direction: column; gap: .4rem; }
.how-list li { display: flex; gap: .5rem; line-height: 1.5; align-items: flex-start; }
.how-list li::before { content: "›"; color: var(--green); font-weight: 700; flex-shrink: 0; min-width: 1.2rem; text-align: center; }

.result-banner { display: flex; flex-direction: column; align-items: center; padding: 1.5rem 1rem; gap: 0.4rem; text-align: center; }
.result-emoji { font-size: 3rem; line-height: 1; }
.result-label { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; color: var(--ink-soft); }
.result-score { font-size: 3rem; font-weight: 700; color: var(--green-deep); font-family: Georgia, serif; }
.result-sub { font-size: 0.96rem; color: var(--ink-soft); }

/* FULLSCREEN MODE */
.tf-shell:fullscreen, .tf-shell:-webkit-full-screen {
    background: #1a3d22; border-radius: 0; display: flex; flex-direction: column; justify-content: center; padding: 2rem;
}
.tf-shell:fullscreen .question-area, .tf-shell:-webkit-full-screen .question-area {
    background: var(--card); border-radius: 1.2rem; max-width: 860px; margin: 0 auto; width: 100%;
}

@media (max-width: 720px) {
    .layout { grid-template-columns: 1fr; }
    .game-page { width: calc(100% - 1rem); }
    h1 { font-size: 1.8rem; }
    .tf-buttons { flex-direction: column; }
    .tf-btn { justify-content: center; }
}
