:root {
    --ink: #0a1020;
    --muted: #4a5670;
    --line: #c8d2e3;
    --panel: #f0f4fa;
    --accent: #0b6fb8;
    --ok: #116b34;
    --bad: #b3123c;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 17px;
    line-height: 1.5;
    color: var(--ink);
    background: #fff;
}

main { max-width: 1100px; margin: 0 auto; padding: 20px; }
main.narrow { max-width: 560px; }

h1 { font-size: 28px; margin: 18px 0 12px; }
h2 { font-size: 21px; margin: 22px 0 10px; }
h3 { font-size: 18px; margin: 0 0 10px; font-weight: 600; }

a { color: var(--accent); }
code, .mono { font-family: Consolas, "Courier New", monospace; }
code { background: var(--panel); padding: 1px 5px; border-radius: 4px; font-size: 0.95em; }

.topbar {
    display: flex; align-items: center; gap: 18px;
    padding: 10px 20px; background: var(--ink); color: #fff;
}
.topbar a { color: #fff; text-decoration: none; }
.topbar.admin { background: #3b1f6b; }
.topbar nav { display: flex; gap: 16px; }
.brand { font-weight: 700; font-size: 19px; }
.who { opacity: 0.9; }
.spacer { flex: 1; }

.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card {
    background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
    padding: 16px 18px; margin: 12px 0;
}
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.faded { opacity: 0.55; }

label { display: block; margin: 10px 0; font-weight: 500; }
label.check, label.choice { font-weight: 400; }
input[type=text], input[type=password], input[type=number], input[type=datetime-local] {
    display: block; width: 100%; margin-top: 4px; padding: 9px 10px;
    font-size: 17px; border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
.row input[type=text] { width: 180px; }
input.upper { text-transform: uppercase; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 14px 0; padding: 8px 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }

button, .button {
    display: inline-block; padding: 9px 16px; font-size: 16px; border-radius: 6px;
    border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; text-decoration: none;
}
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
button.big { font-size: 19px; padding: 12px 28px; margin: 10px 0 40px; }
button.link { background: none; border: none; color: inherit; text-decoration: underline; padding: 0; }
.topbar button.link { color: #fff; }
form.inline { display: inline; }

.msg { padding: 10px 14px; border-radius: 6px; }
.msg.error { background: #fde8ec; color: var(--bad); }
.msg.ok { background: #e6f4ea; color: var(--ok); }
#save-status.error { color: var(--bad); font-weight: 600; }

table { width: 100%; border-collapse: collapse; margin: 10px 0; }
th, td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line); }
th { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }

.sticky {
    position: sticky; top: 0; z-index: 5; display: flex; gap: 20px; align-items: center;
    background: #fff; border-bottom: 2px solid var(--line); padding: 10px 0;
}
#timer { font-family: Consolas, monospace; font-size: 20px; }
#timer.warn { color: var(--bad); }

.question .choice {
    display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; margin: 6px 0;
    border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer;
}
.question .choice input { margin-top: 5px; }
.question ul { margin: 6px 0 0; }
main.wide { max-width: 820px; }
.question h3 { font-size: 21px; margin-bottom: 14px; }
.question button.choice {
    display: block; width: 100%; text-align: left; font-size: 18px; line-height: 1.4;
    padding: 14px 16px; margin: 10px 0; background: #fff;
}
.question button.choice:hover, .question button.choice:focus { border-color: var(--accent); background: #eef6fc; }
.sending button.choice { opacity: 0.6; cursor: wait; }

.question button.skip {
    display: block; width: 100%; margin: 18px 0 4px; padding: 12px 16px; font-size: 17px;
    background: var(--panel); border: 1px dashed var(--muted); color: var(--muted); min-height: 48px;
}
.question button.skip:hover, .question button.skip:focus { background: #e6ebf3; color: var(--ink); }
.review.none { border-left: 6px solid var(--line); }
.review.none .mark { color: var(--muted); }
.review.good { border-left: 6px solid var(--ok); }
.review.bad { border-left: 6px solid var(--bad); }
.review .mark { font-weight: 700; margin-right: 4px; }
.review.good .mark { color: var(--ok); }
.review.bad .mark { color: var(--bad); }
ul.answers { list-style: none; padding: 0; margin: 0; }
ul.answers li { padding: 8px 12px; margin: 6px 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
ul.answers li.right { border: 2px solid var(--ok); background: #e6f4ea; }
ul.answers li.chosen:not(.right) { border: 2px solid var(--bad); background: #fde8ec; }
ul.answers .tag { font-size: 13px; font-weight: 600; margin-left: 8px; color: var(--muted); text-transform: uppercase; }
ul.answers li.right .tag { color: var(--ok); }
ul.answers li.chosen:not(.right) .tag { color: var(--bad); }

button, .button, .question button.choice { touch-action: manipulation; }
.question button.choice { min-height: 52px; }

/* Mobil, álló kijelző */
@media (max-width: 640px) {
    body { font-size: 16px; }
    main, main.narrow, main.wide { max-width: none; padding: 10px 12px 24px; }
    h1 { font-size: 22px; margin: 12px 0 8px; }
    h2 { font-size: 19px; }
    .card { padding: 12px 12px; border-radius: 8px; }

    .topbar { flex-wrap: wrap; gap: 6px 12px; padding: 8px 12px; }
    .brand { font-size: 17px; }
    .who { font-size: 14px; order: 3; width: 100%; }
    .topbar nav { gap: 12px; font-size: 15px; flex-wrap: wrap; }

    .row { flex-direction: column; align-items: stretch; }
    .row input[type=text], .row input[type=file] { width: 100%; }
    .row button, .row .button { width: 100%; text-align: center; }
    button.primary { width: 100%; padding: 13px 16px; font-size: 17px; }
    input[type=text], input[type=password], input[type=number], input[type=datetime-local] { font-size: 17px; padding: 11px 10px; }

    .sticky { gap: 10px; padding: 8px 0; font-size: 15px; }
    .bar-title, .label-long { display: none; }
    #timer { font-size: 19px; }

    .question h3 { font-size: 18px; line-height: 1.4; }
    .question button.choice { font-size: 17px; padding: 14px 12px; margin: 10px 0; }

    .score { font-size: 34px; }
    ul.answers li { padding: 8px 10px; }
    ul.answers .tag { display: block; margin: 4px 0 0; }

    table { display: block; overflow-x: auto; white-space: nowrap; }
    th, td { padding: 6px 8px; }
    .grid4 { grid-template-columns: repeat(2, 1fr); }
    dl.facts { grid-template-columns: 1fr; gap: 2px; }
    dl.facts dd { margin-bottom: 8px; }
}
li.correct { color: var(--ok); font-weight: 600; }

.score { font-size: 40px; font-weight: 700; margin: 6px 0; }
.grade { font-size: 24px; margin: 4px 0; }

dl.facts { display: grid; grid-template-columns: 220px 1fr; gap: 6px 14px; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }
dd.big { font-size: 24px; font-weight: 700; }
