:root {
    --bg: #eff6ff;
    --card: #ffffff;
    --ink: #172033;
    --muted: #667085;
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --ok: #15803d;
    --bad: #b91c1c;
    --line: #d9e2f2;
    --soft: #dbeafe;
    --shadow: 0 18px 40px rgba(30, 64, 175, 0.14);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--ink);
    background: radial-gradient(circle at top, #ffffff 0, var(--bg) 45%, #e0ecff 100%);
}

.app-shell {
    width: min(980px, 94vw);
    margin: 0 auto;
    padding: 28px 0 40px;
}

.hero-card,
.game-card,
.result-card,
.leaderboard-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 18px;
}

.hero-card {
    text-align: center;
}

.badge {
    display: inline-block;
    padding: 8px 12px;
    background: var(--soft);
    color: var(--primary-dark);
    border-radius: 999px;
    font-weight: 700;
    font-size: 14px;
}

h1 {
    margin: 16px 0 8px;
    font-size: clamp(34px, 6vw, 58px);
    line-height: 1.05;
}

h2 {
    margin: 0 0 12px;
}

.lead {
    font-size: 20px;
    color: var(--muted);
    margin: 0 auto 20px;
}

.instructions {
    max-width: 760px;
    margin: 20px auto;
    padding: 16px;
    background: #f8fbff;
    border: 1px solid var(--line);
    border-radius: 18px;
    text-align: left;
}

.instructions p { margin-bottom: 0; }

.label {
    display: block;
    font-weight: 700;
    margin: 12px 0 8px;
}

.text-input {
    width: min(420px, 100%);
    padding: 14px 16px;
    border: 2px solid var(--line);
    border-radius: 14px;
    font-size: 18px;
    outline: none;
}

.text-input:focus {
    border-color: var(--primary);
}

.primary-button,
.secondary-button,
.tiny-button,
.answer-button {
    border: 0;
    border-radius: 16px;
    cursor: pointer;
    font-weight: 800;
    transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}

.primary-button {
    display: block;
    margin: 16px auto 0;
    padding: 14px 26px;
    background: var(--primary);
    color: white;
    font-size: 18px;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.25);
}

.secondary-button {
    padding: 13px 22px;
    background: var(--primary);
    color: white;
    font-size: 17px;
    margin-top: 16px;
}

.tiny-button {
    padding: 8px 12px;
    background: var(--soft);
    color: var(--primary-dark);
}

.primary-button:hover,
.secondary-button:hover,
.tiny-button:hover,
.answer-button:hover {
    transform: translateY(-1px);
}

.primary-button:active,
.secondary-button:active,
.tiny-button:active,
.answer-button:active {
    transform: translateY(0);
}

.small-note {
    color: var(--muted);
    font-size: 14px;
}

.game-topbar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}

.game-topbar > div {
    background: #f8fbff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px;
    text-align: center;
}

.question-box {
    padding: 18px;
    border-radius: 20px;
    background: linear-gradient(135deg, #eef5ff, #ffffff);
    border: 1px solid var(--line);
}

.category-pill {
    display: inline-block;
    padding: 6px 10px;
    background: #fff7ed;
    color: #9a3412;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 10px;
}

.dialogue {
    white-space: pre-line;
    font-size: 21px;
    line-height: 1.5;
    margin-bottom: 0;
}

.answers {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.answer-button {
    min-height: 72px;
    padding: 16px;
    background: #f8fbff;
    border: 2px solid var(--line);
    color: var(--ink);
    font-size: 17px;
    text-align: left;
}

.answer-button.correct {
    border-color: var(--ok);
    background: #dcfce7;
}

.answer-button.wrong {
    border-color: var(--bad);
    background: #fee2e2;
}

.answer-button:disabled {
    cursor: default;
}

.feedback {
    margin-top: 16px;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: #f8fbff;
    font-size: 17px;
    line-height: 1.45;
}

.feedback.ok { border-color: #86efac; background: #f0fdf4; }
.feedback.bad { border-color: #fecaca; background: #fff1f2; }

.result-text {
    font-size: 20px;
    line-height: 1.5;
}

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

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
    border-radius: 16px;
}

th, td {
    border-bottom: 1px solid var(--line);
    padding: 12px;
    text-align: left;
}

th {
    background: #eef5ff;
}

td:first-child, th:first-child,
td:nth-child(3), th:nth-child(3),
td:nth-child(4), th:nth-child(4) {
    text-align: center;
}

.hidden { display: none !important; }

@media (max-width: 700px) {
    .game-topbar,
    .answers {
        grid-template-columns: 1fr;
    }

    .hero-card,
    .game-card,
    .result-card,
    .leaderboard-card {
        padding: 18px;
        border-radius: 18px;
    }
}
