/* Shared look of the lektury quizzes (js/quiz/). Each quiz sets the colour
 * variables below in its own theme.css (light + dark) and may add decoration. */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

:root {
  --bg: #fff9f0; --card: #ffffff; --card2: #fef3c7; --b2: rgba(245,158,11,.22);
  --primary: #f59e0b; --primary2: #d97706; --accent: #fb923c; --second: #d97706;
  --on-primary: #ffffff; --on-second: #ffffff;   /* text on --primary (and the --accent end of its gradient), on --second */
  --c-correct: #16a34a; --c-wrong: #dc2626;
  --ok-tint: rgba(62,201,138,.12); --bad-tint: rgba(224,85,106,.12);
  --p-tint: rgba(245,158,11,.12); --p-glow: rgba(245,158,11,.4);
  --text: #2d1b06; --muted: #8a6d3b;
  --shadow: 0 8px 30px rgba(146,64,14,.12);
  --nav-bg: rgba(146,64,14,.88);
  --r: 14px; --r2: 22px;
}

[hidden] { display: none !important; }
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Nunito', sans-serif; background-color: var(--bg); color: var(--text); min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; padding: 66px 14px 40px;
}
button { font-family: inherit; }

/* nav bar */
#nav-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000; display: flex; justify-content: space-between;
  align-items: center; padding: 8px 16px; background: var(--nav-bg); backdrop-filter: blur(6px);
}
.nav-l { display: flex; gap: 8px; align-items: center; }
#nav-bar a {
  font-size: .95rem; font-weight: 800; color: #fff; background: rgba(255,255,255,.18);
  border-radius: 12px; padding: 5px 14px; text-decoration: none; white-space: nowrap;
}
#nav-bar a:hover { background: rgba(255,255,255,.32); }

/* screens */
.screen { position: relative; z-index: 1; width: 100%; max-width: 660px; display: none; }
.screen.active { display: flex; flex-direction: column; align-items: center; gap: 14px; }

/* menu */
.logo { text-align: center; margin-bottom: 6px; }
.logo-ico { font-size: 4rem; line-height: 1; margin-bottom: 4px; }
.hero-img { display: block; width: clamp(140px, 36vw, 200px); margin: 0 auto 8px; }
.logo-title { font-weight: 900; font-size: clamp(1.8rem, 5vw, 2.6rem); line-height: 1.1; color: var(--primary2); }
.logo-sub { font-size: .95rem; color: var(--muted); margin-top: 8px; font-weight: 700; }
.start-btn {
  display: block; width: 100%; background: linear-gradient(135deg, var(--primary), var(--accent));
  border: none; border-radius: 50px; padding: 17px; font-size: 1.35rem; font-weight: 900; color: var(--on-primary);
  cursor: pointer; transition: all .2s; letter-spacing: .5px; box-shadow: 0 4px 18px var(--p-glow);
}
.start-btn:hover:not(:disabled) { transform: translateY(-2px); }
.start-btn:disabled { opacity: .6; cursor: default; }
.load-err { text-align: center; }
.card {
  background: var(--card); border: 2px solid var(--b2); border-radius: var(--r2); padding: 24px 22px;
  width: 100%; box-shadow: var(--shadow);
}
.card h2 { font-weight: 900; font-size: 1.15rem; margin-bottom: 12px; }
.lbl {
  font-size: .72rem; font-weight: 900; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted);
  margin-bottom: 8px; display: block;
}
.opt { margin-bottom: 14px; }
.opt-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.link-btn {
  background: none; border: none; color: var(--primary2); font-weight: 800; font-size: .8rem;
  cursor: pointer; text-decoration: underline; padding: 0 0 8px;
}
.ch-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
@media (max-width: 520px) { .ch-list { grid-template-columns: 1fr; } }
.ch-item { font-size: .88rem; font-weight: 700; display: flex; gap: 6px; align-items: flex-start; cursor: pointer; }
.ch-item input { margin-top: 3px; accent-color: var(--primary); }
.ch-n { color: var(--muted); font-weight: 600; }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  padding: 9px 16px; border-radius: 50px; border: 2px solid var(--b2); background: var(--card2);
  font-size: .95rem; font-weight: 800; color: var(--text); cursor: pointer; transition: all .18s;
}
.pill:hover:not(:disabled) { border-color: var(--primary); background: var(--p-tint); }
.pill.on { background: var(--primary); color: var(--on-primary); border-color: var(--primary); transform: scale(1.05); }
.pill:disabled { opacity: .4; cursor: default; }
.note { font-size: .82rem; font-weight: 800; color: var(--c-wrong); margin-top: 6px; }
.note:empty { display: none; }
.badge-row { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.badge {
  display: inline-flex; align-items: center; gap: 7px; background: var(--p-tint); color: var(--primary2);
  border-radius: 50px; padding: 7px 14px; font-size: .82rem; font-weight: 800; width: fit-content;
}
.btn-help {
  font-weight: 800; font-size: .92rem; background: transparent; border: 2px dashed var(--b2);
  border-radius: var(--r); padding: 11px 14px; color: var(--muted); cursor: pointer; width: 100%;
  margin: 0 0 14px; transition: .15s; display: block;
}
.btn-help:hover { border-color: var(--primary); color: var(--primary); }
.sep {
  display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 800; font-size: .82rem;
  margin: 20px 0 12px; text-transform: uppercase; letter-spacing: .03em;
}
.sep::before, .sep::after { content: ''; flex: 1; border-top: 1px solid var(--b2); }
.btn-secondary {
  font-weight: 800; font-size: .95rem; background: var(--second); color: var(--on-second); border: none;
  border-radius: 12px; padding: 11px 18px; cursor: pointer; width: 100%;
}
.print-panel { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--b2); }
.field-row { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; font-size: .88rem; }
.field-row.top { align-items: flex-start; }
.field-row > label, .field-l { font-weight: 700; }
.field-row input[type=number] {
  width: 64px; padding: 5px 6px; border: 1px solid var(--b2); border-radius: 8px;
  background: var(--card); color: var(--text); font: inherit;
}
.radio-inline { display: flex; gap: 14px; flex-wrap: wrap; }
.radio-col { display: flex; flex-direction: column; gap: 6px; }

/* nav footer */
.nav-footer { display: flex; justify-content: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.btn-nav {
  font-weight: 700; font-size: .95rem; background: transparent; border: 2px solid var(--b2); border-radius: 12px;
  padding: 10px 18px; color: var(--muted); cursor: pointer; text-decoration: none; transition: all .2s;
  display: inline-block;
}
.btn-nav:hover { border-color: var(--primary); color: var(--primary); }

/* game: scorebar + progress */
.scorebar {
  background: var(--card); border: 2px solid var(--b2); border-radius: 18px; padding: 12px 16px; width: 100%;
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px;
  box-shadow: var(--shadow);
}
.sc { font-size: 1rem; font-weight: 900; white-space: nowrap; }
.sc-g { color: var(--c-correct); }
.sc-b { color: var(--c-wrong); }
.chapter-badge {
  font-size: .7rem; padding: 4px 10px; border-radius: 10px; font-weight: 800; background: var(--p-tint);
  color: var(--primary2); border: 1px solid var(--b2); max-width: 50%; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
}
.qcnt { font-size: .85rem; font-weight: 800; color: var(--muted); }
.hud-tools { display: flex; gap: 4px; align-items: center; }
.progress-wrap { height: 6px; background: var(--card2); border-radius: 3px; overflow: hidden; width: 100%; }
.progress-bar {
  height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width .4s ease; width: 0%;
}

/* game: question, options, feedback */
.q-card {
  background: var(--card); border: 2px solid var(--b2); border-radius: var(--r2); padding: 24px; width: 100%;
  box-shadow: var(--shadow); min-height: 130px; display: flex; flex-direction: column; gap: 8px;
}
.q-text { font-weight: 900; font-size: clamp(1.05rem, 2.8vw, 1.25rem); line-height: 1.45; }
.q-text:focus { outline: none; }
@keyframes qIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.q-in { animation: qIn .3s ease; }
.options { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.opt-btn {
  background: var(--card); border: 2px solid var(--b2); border-radius: var(--r); padding: 13px 14px;
  text-align: left; font-size: .98rem; font-weight: 800; color: var(--text); cursor: pointer;
  display: flex; align-items: center; gap: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.06); transition: all .18s;
  -webkit-tap-highlight-color: transparent;
}
.opt-btn:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--primary); }
.opt-btn:active:not(:disabled) { transform: scale(.98); }
.opt-btn:disabled { cursor: default; box-shadow: none; }
.opt-btn.correct { background: var(--ok-tint); border-color: var(--c-correct); color: var(--c-correct); }
.opt-btn.wrong { background: var(--bad-tint); border-color: var(--c-wrong); color: var(--c-wrong); }
.opt-label {
  background: var(--primary); color: var(--on-primary); border-radius: 8px; min-width: 28px; height: 28px; display: flex;
  align-items: center; justify-content: center; font-size: .82rem; font-weight: 900; flex-shrink: 0;
}
.opt-btn.correct .opt-label { background: var(--c-correct); color: #fff; }
.opt-btn.wrong .opt-label { background: var(--c-wrong); color: #fff; }
.exp-box {
  width: 100%; border-radius: 16px; padding: 14px 16px; font-size: .92rem; font-weight: 700; line-height: 1.55;
  border: 2px solid var(--b2); display: none;
}
.exp-box.ok { display: block; background: var(--ok-tint); border-color: var(--c-correct); color: var(--c-correct); }
.exp-box.bad { display: block; background: var(--bad-tint); border-color: var(--c-wrong); color: var(--c-wrong); }
.exp-box.vis { animation: qIn .3s ease; }
.feedback { font-weight: 900; font-size: 1.15rem; margin-bottom: 6px; display: block; }
.exp-text { display: block; }
.bot-row { display: flex; gap: 10px; width: 100%; align-items: center; }
.btn-next {
  flex: 1; padding: 15px; background: var(--primary); color: var(--on-primary); border: none; border-radius: 50px;
  font-weight: 900; font-size: 1.05rem; cursor: pointer; box-shadow: 0 4px 16px var(--p-glow);
  transition: all .2s; display: none;
}
.btn-next.vis { display: block; animation: qIn .3s ease; }
.btn-next:hover { transform: translateY(-2px); }
.back-lnk {
  background: none; border: none; color: var(--muted); font-size: .82rem; font-weight: 800; cursor: pointer;
  padding: 6px 8px; margin-top: 4px; display: block; width: 100%; text-align: center;
}
.back-lnk:hover { color: var(--primary); }

/* end screen */
.end-card {
  background: var(--card); border: 2px solid var(--b2); border-radius: var(--r2); padding: 36px 24px;
  text-align: center; width: 100%; box-shadow: var(--shadow);
}
.end-hero { width: clamp(120px, 30vw, 160px); margin: 0 auto 6px; display: block; }
.end-emoji { font-size: 3.8rem; margin-bottom: 6px; display: block; }
.end-title { font-weight: 900; font-size: 1.9rem; color: var(--primary2); margin-bottom: 6px; }
.end-stars { font-size: 1.7rem; letter-spacing: 3px; margin-bottom: 18px; }
.end-score { font-weight: 900; font-size: 3rem; color: var(--primary); margin: 14px 0 2px; line-height: 1; }
.end-of { font-size: .88rem; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.end-pct { font-size: .9rem; font-weight: 700; color: var(--muted); margin-bottom: 22px; }
.end-msg { font-size: .95rem; color: var(--muted); font-weight: 700; margin-bottom: 16px; line-height: 1.5; }
.about-box { background: var(--card2); border-radius: 14px; padding: 14px; margin-bottom: 20px; text-align: left; }
.about-label {
  font-size: .7rem; font-weight: 900; color: var(--muted); text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 8px;
}
.about-text { font-size: .88rem; font-weight: 700; line-height: 1.55; }
.btn-again {
  display: block; width: 100%; padding: 16px; background: linear-gradient(135deg, var(--primary), var(--accent));
  color: var(--on-primary); border: none; border-radius: 50px; font-weight: 900; font-size: 1.2rem; cursor: pointer;
  box-shadow: 0 4px 18px var(--p-glow); transition: all .2s;
}
.btn-again:hover { transform: translateY(-2px); }

@media (max-width: 480px) {
  .opt-btn { font-size: .93rem; padding: 12px; }
  .q-card { padding: 18px; }
  .card { padding: 20px 16px; }
  .end-card { padding: 28px 18px; }
  .chapter-badge { order: 3; flex-basis: 100%; max-width: 100%; text-align: center; }
}

/* visually hidden, still read by screen readers */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* mute + help buttons */
.muteb {
  background: transparent; border: none; font-size: 1.15rem; cursor: pointer; padding: 2px 4px;
  line-height: 1; color: inherit;
}
#nav-bar button.muteb { background: rgba(255,255,255,.2); color: #fff; border-radius: 12px; padding: 5px 10px; font-size: 1rem; }
#nav-bar button.muteb:hover { background: rgba(255,255,255,.35); }

/* help overlay */
.ovl {
  position: fixed; inset: 0; z-index: 1100; display: none; align-items: center; justify-content: center;
  background: rgba(0,0,0,.55); backdrop-filter: blur(3px); padding: 16px;
}
.ovl.show { display: flex; }
.ovl-card {
  background: var(--card); border: 1px solid var(--b2); border-radius: var(--r2); max-width: 440px; width: 100%;
  padding: 24px 22px; position: relative; color: var(--text); max-height: 86vh; overflow: auto;
}
.ovl-x {
  position: absolute; top: 10px; right: 12px; background: transparent; border: none; font-size: 1.2rem;
  font-weight: 900; color: var(--muted); cursor: pointer; line-height: 1;
}
.ovl-h { font-weight: 900; font-size: 1.5rem; margin: 0 0 12px; color: var(--primary); }
.ovl-list { margin: 0 0 14px; padding-left: 20px; font-weight: 700; line-height: 1.5; }
.ovl-list li { margin-bottom: 6px; }
.ovl-sub { font-weight: 900; color: var(--primary); margin: 6px 0 4px; }
.ovl-note { font-weight: 700; color: var(--muted); font-size: .92rem; margin: 2px 0 14px; }

/* print preview (lives outside .screen so @media print can show it) */
.print-area { position: relative; z-index: 1; width: 100%; max-width: 660px; scroll-margin-top: 72px; }
.print-note { margin-top: 10px; font-size: .85rem; font-weight: 700; color: var(--c-wrong); }
#print-actions { margin-top: 12px; }
#print-preview { margin-top: 18px; }
.pv-page {
  background: var(--card); border: 1px solid var(--b2); border-radius: 14px; padding: 22px 24px;
  margin-bottom: 20px; color: var(--text);
}
.pv-page h2 { text-align: center; margin: 0 0 4px; }
.pv-sub { text-align: center; color: var(--muted); font-size: .82rem; margin-bottom: 16px; }
.pv-field-row { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.pv-field { flex: 1 1 180px; }
.pv-field .lbl { font-size: .78rem; color: var(--muted); margin-bottom: 2px; text-transform: none; letter-spacing: 0; }
.pv-field .blank, .pv-field .fixed { border-bottom: 1.5px solid var(--b2); height: 20px; }
.pv-field .fixed { font-weight: 800; }
.pv-q { margin-bottom: 14px; break-inside: avoid; page-break-inside: avoid; }
.pv-q-text { font-weight: 700; margin-bottom: 4px; }
.pv-opt { margin: 2px 0 2px 8px; font-size: .92rem; }
.pv-ch { margin-bottom: 8px; }
.pv-ch-title {
  font-weight: 800; border-bottom: 1.5px solid var(--b2); padding-bottom: 3px; margin: 12px 0 10px;
  break-after: avoid; page-break-after: avoid;
}
.pv-key-row { margin: 2px 0 2px 8px; }

/* score toast from /js/submit.js (same as css/scoreboard.css) */
.sb-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #065f46; color: #fff;
  padding: 10px 22px; border-radius: 30px; font-weight: 700; font-size: 15px; z-index: 9998;
  animation: toastSlide .25s ease, toastFade .4s ease 2.6s forwards; white-space: nowrap;
  pointer-events: none; font-family: inherit;
}
@keyframes toastSlide { from { transform: translateX(-50%) translateY(16px); opacity: 0; } to { transform: translateX(-50%) translateY(0); opacity: 1; } }
@keyframes toastFade { to { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .hero-img, .q-in, .exp-box.vis, .btn-next.vis { animation: none !important; }
}

@media print {
  body { padding: 0; display: block; background: #fff !important; background-image: none !important; color: #000; }
  html::before, html::after, body::before, body::after { display: none !important; }
  #nav-bar, .screen, .no-print, .sb-toast, .ovl { display: none !important; }
  .print-area { display: block !important; max-width: none; }
  .print-area[hidden] { display: none !important; }
  .pv-page {
    background: #fff !important; color: #000 !important; box-shadow: none; border: none; border-radius: 0;
    margin: 0; padding: 12mm; page-break-after: always;
  }
  .pv-page:last-child { page-break-after: auto; }
  .pv-sub, .pv-field .lbl { color: #555 !important; }
  .pv-ch-title { color: #000 !important; border-bottom-color: #999 !important; }
  .pv-field .blank, .pv-field .fixed { border-bottom-color: #999 !important; }
}
