﻿:root {
    --tb-page: #f6f8f7;
    --tb-card: #ffffff;
    --tb-ink: #20312c;
    --tb-muted: #73817b;
    --tb-border: #e2e9e5;
    --tb-green: #287d62;
    --tb-green-dark: #1f674f;
    --tb-green-soft: #e7f5ed;
    --tb-mint: #f1faf4;
    --tb-red: #b93e46;
    --tb-red-soft: #fff0ef;
    --tb-yellow: #f7c85d;
    --tb-shadow: 0 8px 26px rgb(31 64 49 / 5%);
}

* { box-sizing: border-box; }

html, body {
    min-height: 100%;
    margin: 0;
    background: var(--tb-page);
    color: var(--tb-ink);
    font-family: 'Nunito', 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
}

body { font-size: 16px; line-height: 1.55; }
button, input, select, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
    outline: 3px solid #8bc9b0;
    outline-offset: 3px;
}
h1, h2, h3, h4, p { overflow-wrap: anywhere; }
h1, h2, h3 { letter-spacing: -.035em; }
h1 { font-size: clamp(1.75rem, 4vw, 2.45rem); line-height: 1.18; font-weight: 900; }
h2 { font-weight: 850; }
a { color: var(--tb-green-dark); }

.tester-home, .tester-page {
    width: min(100% - 3rem, 980px);
    margin: 0 auto;
    padding: 2.5rem 0 3rem;
}
.home-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.home-header h1 { margin: 0; }
.eyebrow {
    margin: 0 0 .55rem;
    color: var(--tb-green);
    font-size: .76rem;
    font-weight: 900;
    letter-spacing: .13em;
    text-transform: uppercase;
}
.subtitle { max-width: 42rem; margin: .65rem 0 0; color: var(--tb-muted); line-height: 1.65; }
.home-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }

.primary-button, .secondary-button, .delete-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 44px;
    border: 0;
    border-radius: .85rem;
    padding: .7rem 1rem;
    font-weight: 850;
    line-height: 1.25;
    text-decoration: none;
    cursor: pointer;
    transition: transform .12s ease, background .12s ease, box-shadow .12s ease;
}
.primary-button {
    color: #fff;
    background: var(--tb-green);
    box-shadow: inset 0 -3px 0 rgb(0 0 0 / 12%);
}
.primary-button:hover:not(:disabled) { background: var(--tb-green-dark); transform: translateY(-1px); }
.secondary-button { color: #34463e; background: #edf1ee; }
.secondary-button:hover:not(:disabled) { background: #e1e9e4; }
.delete-button { color: #a8323a; background: #fff0ef; }
.delete-button:hover:not(:disabled) { background: #ffe1df; }
.primary-button:disabled, .secondary-button:disabled, .delete-button:disabled { opacity: .55; cursor: not-allowed; }
.import-button { position: relative; overflow: hidden; cursor: pointer; }
.import-button input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

.bank-count { margin: 0 0 .85rem; color: var(--tb-muted); font-size: .9rem; font-weight: 750; }
.bank-list { display: grid; gap: 1rem; }
.bank-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: .8rem 1rem;
    padding: 1.25rem;
    border: 1px solid var(--tb-border);
    border-radius: 1.15rem;
    background: var(--tb-card);
    box-shadow: var(--tb-shadow);
    transition: border-color .15s ease, transform .15s ease;
}
.bank-card:hover { border-color: #c5ded1; }
.bank-icon, .empty-icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 1rem;
    background: var(--tb-green-soft);
}
.bank-icon { width: 3.2rem; height: 3.2rem; font-size: 1.45rem; }
.bank-details { min-width: 0; }
.bank-details h2 { margin: .15rem 0 .25rem; font-size: 1.18rem; }
.bank-details p { margin: .25rem 0; color: var(--tb-muted); }
.question-count { display: inline-block; margin-top: .3rem; color: var(--tb-muted); font-size: .84rem; font-weight: 750; }
.bank-card-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .55rem; padding-top: .25rem; }
.bank-card-actions .primary-button { margin-right: auto; }

.empty-state {
    padding: 3.25rem 1.5rem;
    text-align: center;
    border: 2px dashed #d2e1d8;
    border-radius: 1.25rem;
    background: rgba(255,255,255,.65);
}
.empty-icon { width: 4rem; height: 4rem; margin: 0 auto 1rem; font-size: 1.8rem; }
.empty-state h2 { margin: 0 0 .5rem; }
.empty-state p { max-width: 28rem; margin: 0 auto 1.5rem; color: var(--tb-muted); line-height: 1.65; }

.status-message, .error-message {
    margin: 0 0 1rem;
    padding: .85rem 1rem;
    border-radius: .8rem;
    overflow-wrap: anywhere;
}
.status-message { color: #225d42; background: #e8f6ed; }
.error-message { color: #8a252b; background: var(--tb-red-soft); border: 1px solid #f1d1ce; }
.loading-card { padding: 1rem; color: var(--tb-muted); }
.loading-dot { display: inline-block; width: .65rem; height: .65rem; margin-right: .5rem; border-radius: 50%; background: var(--tb-green); }

/* Editors */
.text-button {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    margin: 0 0 1rem;
    padding: .45rem 0;
    border: 0;
    background: transparent;
    color: var(--tb-green-dark);
    font-weight: 850;
    cursor: pointer;
}
.page-header { margin: 1rem 0 1.5rem; }
.page-header h1 { margin: 0; }
.editor-panel {
    display: grid;
    gap: .75rem;
    padding: clamp(1rem, 3vw, 1.5rem);
    margin-bottom: 2rem;
    border: 1px solid var(--tb-border);
    border-radius: 1.15rem;
    background: #fff;
    box-shadow: var(--tb-shadow);
}
.editor-panel label { margin-top: .2rem; color: #34463e; font-weight: 850; }
.text-input {
    width: 100%;
    min-height: 46px;
    padding: .75rem .85rem;
    border: 1px solid #d5dfd9;
    border-radius: .75rem;
    background: #fff;
    color: var(--tb-ink);
    font: inherit;
}
.text-input:focus { border-color: #83bda1; outline: 3px solid #d8f0e1; }
textarea.text-input { resize: vertical; }
.section-heading, .question-card, .question-actions, .form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}
.section-heading { margin-bottom: 1rem; }
.section-heading h2, .question-card h3 { margin: 0 0 .25rem; }
.section-heading p { margin: 0; color: var(--tb-muted); }
.question-list { display: grid; gap: .75rem; }
.question-card {
    padding: 1rem;
    border: 1px solid var(--tb-border);
    border-radius: .9rem;
    background: #fff;
}
.question-details { min-width: 0; overflow-wrap: anywhere; }
.question-details h3 { font-size: 1rem; }
.question-actions { flex-shrink: 0; }
.form-actions { justify-content: flex-start; flex-wrap: wrap; margin-top: .5rem; }
.question-form h2 { margin: 1rem 0 0; font-size: 1.2rem; }

/* Quiz setup and practice */
.quiz-page { max-width: 820px; }
.quiz-start-card {
    max-width: 690px;
    margin: 1.5rem auto 0;
    padding: clamp(1.25rem, 4vw, 2.5rem);
    border: 1px solid var(--tb-border);
    border-radius: 1.5rem;
    background: #fff;
    box-shadow: 0 16px 44px rgb(31 64 49 / 7%);
    text-align: center;
}
.quiz-start-card h1 { margin: .3rem 0; }
.quiz-start-card .subtitle { margin: .7rem auto 1.4rem; }
.quiz-start-icon, .results-celebration {
    display: grid;
    place-items: center;
    width: 4.1rem;
    height: 4.1rem;
    margin: .5rem auto 1rem;
    border-radius: 1.25rem;
    color: #9a6c05;
    background: #fff4d6;
    font-size: 2rem;
}
.quiz-start-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: 1.5rem 0; }
.quiz-start-stats > div { display: grid; gap: .1rem; padding: .9rem .4rem; border-radius: .85rem; background: #f6f8f7; }
.quiz-start-stats strong { color: var(--tb-ink); font-size: 1.15rem; font-weight: 900; }
.quiz-start-stats span { color: var(--tb-muted); font-size: .78rem; font-weight: 750; }
.quiz-settings { margin: 1.4rem 0; border-top: 1px solid var(--tb-border); text-align: left; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem .15rem; border-bottom: 1px solid var(--tb-border); cursor: pointer; }
.setting-copy { display: grid; gap: .2rem; }
.setting-copy strong { font-weight: 850; }
.setting-copy small { color: var(--tb-muted); line-height: 1.45; }
.setting-row input { flex: 0 0 auto; width: 1.25rem; height: 1.25rem; accent-color: var(--tb-green); }
.quiz-start-button { width: min(100%, 360px); min-height: 52px; margin-top: .25rem; font-size: 1.03rem; }

.quiz-header { margin: 1rem 0 1.5rem; }
.quiz-title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.quiz-title-row h1 { margin: 0; font-size: clamp(1.45rem, 4vw, 2rem); }
.question-counter { flex: 0 0 auto; color: var(--tb-muted); white-space: nowrap; }
.question-counter strong { color: var(--tb-green-dark); font-size: 1.25rem; }
.quiz-progress { display: flex; align-items: center; gap: 1rem; color: var(--tb-muted); font-size: .84rem; font-weight: 750; }
.progress-track { flex: 1; height: 10px; overflow: hidden; border-radius: 999px; background: #e1e9e4; }
.progress-fill { height: 100%; border-radius: inherit; background: var(--tb-green); transition: width .25s ease; }
.quiz-question-panel {
    padding: clamp(1.15rem, 4vw, 2rem);
    border: 1px solid var(--tb-border);
    border-radius: 1.3rem;
    background: #fff;
    box-shadow: var(--tb-shadow);
}
.question-kicker { margin: 0 0 .5rem; color: var(--tb-muted); font-size: .76rem; font-weight: 900; letter-spacing: .12em; }
.quiz-question-panel > h2 { margin: 0 0 1.4rem; font-size: clamp(1.2rem, 3vw, 1.55rem); line-height: 1.5; }
.answer-instruction { margin: 0 0 .75rem; color: var(--tb-muted); font-size: .9rem; }
.answer-options { display: grid; gap: .7rem; }
.answer-option {
    display: flex;
    align-items: center;
    gap: .85rem;
    width: 100%;
    min-height: 64px;
    padding: .85rem 1rem;
    border: 2px solid #dce5df;
    border-radius: .95rem;
    background: #fff;
    color: var(--tb-ink);
    text-align: left;
    font: inherit;
    font-weight: 750;
    cursor: pointer;
    transition: border-color .12s ease, background .12s ease, transform .12s ease;
}
.answer-option:not(:disabled):hover { border-color: #9bcab1; background: #f7fcf8; transform: translateY(-1px); }
.answer-option:disabled { cursor: default; }
.option-letter {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    border: 2px solid #dce5df;
    border-radius: .65rem;
    color: #65766d;
    font-size: .9rem;
    font-weight: 900;
}
.option-text { min-width: 0; }
.selected-option { border-color: var(--tb-green); background: var(--tb-green-soft); }
.correct-option { border-color: #329567; background: #eaf8ef; color: #205f40; }
.correct-option .option-letter { border-color: #329567; color: #205f40; background: #d2f0dd; }
.incorrect-option { border-color: #dc7778; background: var(--tb-red-soft); color: #8d2e33; }
.incorrect-option .option-letter { border-color: #dc7778; color: #8d2e33; background: #ffe1df; }
.answer-indicator { display: grid; place-items: center; flex: 0 0 auto; width: 1.7rem; height: 1.7rem; margin-left: auto; border-radius: 50%; font-size: 1.1rem; font-weight: 900; }
.quiz-submit { width: 100%; min-height: 52px; margin-top: 1.25rem; font-size: 1rem; }

.answer-feedback { margin-top: 1.2rem; padding: 1rem; border-radius: 1rem; line-height: 1.6; animation: feedback-in .18s ease-out; }
.feedback-correct { background: #eaf8ef; color: #205f40; }
.feedback-incorrect { background: #fff1ef; color: #81343a; }
.feedback-heading { display: flex; align-items: flex-start; gap: .8rem; }
.feedback-symbol { display: grid; place-items: center; flex: 0 0 auto; width: 2.25rem; height: 2.25rem; border-radius: .7rem; background: rgb(255 255 255 / 75%); font-size: 1.15rem; font-weight: 900; }
.feedback-heading h3 { margin: 0; font-size: 1.2rem; font-weight: 900; }
.feedback-heading p { margin: .15rem 0 0; }
.rationale-block { margin-top: 1rem; padding-top: .9rem; border-top: 1px solid currentColor; border-color: rgb(32 95 64 / 18%); }
.rationale-block h4 { margin: 0 0 .35rem; font-size: .92rem; font-weight: 900; }
.rationale-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

.quiz-results { max-width: 620px; margin: 1.5rem auto; padding: 1rem 0 2rem; text-align: center; }
.results-celebration { color: var(--tb-green-dark); background: var(--tb-green-soft); font-size: 2.1rem; }
.quiz-results h1 { margin: 0; }
.quiz-results .subtitle { margin: .7rem auto; }
.score-panel { margin: 1.5rem auto; padding: 1.5rem; border: 1px solid var(--tb-border); border-radius: 1.3rem; background: #fff; box-shadow: var(--tb-shadow); }
.score-label { margin: 0; color: var(--tb-muted); font-weight: 800; }
.score-value { margin: .25rem 0 0; font-size: 3rem; line-height: 1.2; font-weight: 900; }
.score-value span { color: var(--tb-muted); font-size: 1.3rem; font-weight: 700; }
.score-percentage { margin: .2rem 0 .8rem; color: var(--tb-green-dark); font-size: 1.5rem; font-weight: 900; }
.result-progress-track { height: 12px; overflow: hidden; border-radius: 999px; background: #e3eae5; }
.result-progress-fill { height: 100%; border-radius: inherit; background: var(--tb-green); }
.score-message { margin: .9rem 0 0; color: var(--tb-muted); }
.results-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: .7rem; }

@keyframes feedback-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 760px) {
    .tester-home, .tester-page { width: min(100% - 2rem, 980px); padding: 1.5rem 0 2rem; }
    .home-header { align-items: stretch; flex-direction: column; gap: 1rem; margin-bottom: 1.4rem; }
    .home-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .home-actions > * { width: 100%; }
    .home-actions .primary-button { grid-column: 1 / -1; }
    .bank-card { padding: 1rem; }
    .bank-card-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .bank-card-actions .primary-button { margin-right: 0; }
    .bank-card-actions button { width: 100%; }
    .question-card, .section-heading { align-items: stretch; flex-direction: column; }
    .question-actions { justify-content: flex-start; }
    .quiz-start-card { margin-top: .5rem; border-radius: 1.1rem; }
    .quiz-title-row { align-items: flex-start; }
    .quiz-progress { align-items: flex-start; flex-direction: column; gap: .45rem; }
    .progress-track { width: 100%; flex: none; }
    .answer-option { min-height: 60px; padding: .75rem; gap: .65rem; }
    .answer-indicator { width: 1.5rem; height: 1.5rem; }
    .results-actions { flex-direction: column; }
    .results-actions button { width: 100%; }
}
@media (max-width: 420px) {
    .home-actions { grid-template-columns: 1fr; }
    .home-actions .primary-button { grid-column: auto; }
    .bank-card { grid-template-columns: auto minmax(0, 1fr); gap: .7rem; }
    .bank-icon { width: 2.7rem; height: 2.7rem; }
    .bank-card-actions { grid-column: 1 / -1; }
    .quiz-start-stats { gap: .35rem; }
    .quiz-start-stats > div { padding: .75rem .2rem; }
    .quiz-start-stats strong { font-size: 1rem; }
    .quiz-start-stats span { font-size: .72rem; }
    .setting-row { align-items: flex-start; }
    .setting-row input { margin-top: .2rem; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}


/* Optional per-answer aliases in the question editor */
.alias-input { min-height: 4.5rem; resize: vertical; }
.field-hint { margin: -0.25rem 0 1rem; color: var(--muted, #64748b); font-size: 0.9rem; }

.alias-toggle-row { margin: -.35rem 0 .75rem; }
.alias-toggle-button { min-height: 36px; padding: .45rem .75rem; font-size: .9rem; }
.alias-count { color: var(--tb-muted); font-weight: 750; }
