/* EU trénink — vizuální styl: klidný papír, inkoust, hluboká zeleň, zlaté hvězdy */

:root {
  --paper: #f7f5f0;
  --paper-2: #efece4;
  --card: #fffdfa;
  --ink: #161b1f;
  --ink-2: #4a5257;
  --ink-3: #7d858a;
  --line: rgba(22, 27, 31, .12);
  --line-soft: rgba(22, 27, 31, .07);
  --accent: #135c46;
  --accent-ink: #0d3f30;
  --accent-soft: #e3efe9;
  --gold: #c8a24a;
  --ok: #16764d;
  --ok-soft: #e2f2e9;
  --bad: #a52b1f;
  --bad-soft: #fbe9e6;
  --shadow: 0 1px 2px rgba(22,27,31,.04), 0 12px 32px -18px rgba(22,27,31,.28);
  --shadow-lg: 0 2px 4px rgba(22,27,31,.05), 0 24px 60px -28px rgba(22,27,31,.35);
  --radius: 18px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, ui-serif, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --maxw: 760px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14181d;
    --paper-2: #1a1f25;
    --card: #1c2228;
    --ink: #eef1ee;
    --ink-2: #b3bcbd;
    --ink-3: #828d8e;
    --line: rgba(255, 255, 255, .13);
    --line-soft: rgba(255, 255, 255, .07);
    --accent: #5fbf9a;
    --accent-ink: #9fe0c5;
    --accent-soft: #183329;
    --gold: #e0be6e;
    --ok: #66c79a;
    --ok-soft: #14322a;
    --bad: #ef8d80;
    --bad-soft: #381f1d;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 16px 40px -22px rgba(0,0,0,.7);
    --shadow-lg: 0 2px 6px rgba(0,0,0,.4), 0 30px 70px -30px rgba(0,0,0,.8);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 15% -10%, color-mix(in srgb, var(--gold) 9%, transparent), transparent 60%),
    radial-gradient(900px 500px at 110% 5%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 62%),
    var(--paper);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ---------- topbar ---------- */

.topbar {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 22px 20px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -.01em;
}
.brand-mark { color: var(--accent); display: grid; place-items: center; }
.brand-text em { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--ink-2); }
.topnav { display: flex; gap: 4px; }
.tnav {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 14px;
  transition: background .16s, color .16s;
}
.tnav:hover { background: var(--paper-2); color: var(--ink); }

/* ---------- layout ---------- */

#app {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px 20px 72px;
}

.screen { display: none; }
.screen.is-active { display: block; animation: rise .34s cubic-bezier(.2,.7,.3,1) both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.eyebrow {
  margin: 26px 0 10px;
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
}

h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(34px, 7vw, 52px);
  line-height: 1.04;
  letter-spacing: -.02em;
  margin: 0 0 14px;
}
h1 em { font-style: italic; color: var(--accent); }

.h1sm { font-size: clamp(28px, 5.5vw, 40px); margin-top: 26px; }

.lede {
  color: var(--ink-2);
  font-size: 16.5px;
  max-width: 58ch;
  margin: 0 0 30px;
}

/* ---------- panels ---------- */

.panel {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel h2 { font-size: 14px; letter-spacing: .02em; margin: 0; font-weight: 650; }
.hint { margin: 0; font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.note {
  margin: 11px 2px 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-3);
}
.note:empty { display: none; }
.note--tight { margin-top: 8px; }
.switch + .switch { margin-top: 10px; }

/* segmented control */
.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: var(--paper-2);
  border-radius: 13px;
  padding: 5px;
}
.seg {
  border: 0;
  background: transparent;
  border-radius: 9px;
  padding: 11px 8px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink-2);
  transition: background .16s, color .16s, box-shadow .16s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.seg small { font-weight: 500; font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.seg:hover { color: var(--ink); }
.seg.is-on {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,.07);
}
.seg.is-on small { color: var(--accent); }
.segmented--sm .seg { padding: 9px 6px; font-size: 13.5px; }

/* modes */
.modes { display: grid; gap: 8px; }
@media (min-width: 640px) { .modes { grid-template-columns: repeat(3, 1fr); } }

.mode {
  text-align: left;
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: transparent;
  transition: border-color .16s, background .16s, transform .16s;
}
.mode:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); transform: translateY(-1px); }
.mode.is-on { border-color: var(--accent); background: var(--accent-soft); }
.mode.is-on .mode-ico { color: var(--accent); }
.mode:disabled { opacity: .42; cursor: not-allowed; transform: none; }
.mode-ico { font-size: 16px; line-height: 1.5; color: var(--ink-3); }
.mode-t { display: grid; gap: 3px; }
.mode-t strong { font-size: 14.5px; font-weight: 650; }
.mode-t small { color: var(--ink-2); font-size: 12.5px; line-height: 1.45; }

/* switch */
.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-size: 14px;
  color: var(--ink-2);
  width: fit-content;
  cursor: pointer;
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-ui {
  width: 38px; height: 22px; border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 18%, transparent);
  position: relative; transition: background .18s;
  flex: none;
}
.switch-ui::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  transition: transform .18s cubic-bezier(.3,.8,.3,1);
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch input:checked + .switch-ui { background: var(--accent); }
.switch input:checked + .switch-ui::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--accent); outline-offset: 3px; }

/* cta */
.cta {
  width: 100%;
  margin-top: 18px;
  padding: 17px 24px;
  border: 0;
  border-radius: 15px;
  background: var(--accent);
  color: #fff;
  font-size: 16.5px;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 10px 24px -12px color-mix(in srgb, var(--accent) 70%, transparent);
  transition: transform .16s, filter .16s;
}
.cta:hover { transform: translateY(-1px); filter: brightness(1.06); }
.cta:active { transform: none; }
.cta:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.cta.ghost {
  background: transparent; color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  box-shadow: none;
}
@media (prefers-color-scheme: dark) { .cta { color: #0c1b15; } }

.footnote { color: var(--ink-3); font-size: 12.5px; line-height: 1.6; margin: 18px 2px 0; max-width: 62ch; }
.footnote em { font-style: normal; color: var(--ink-2); }

/* ---------- quiz ---------- */

.quizbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0 14px;
  background: linear-gradient(var(--paper) 62%, transparent);
}
.iconbtn {
  border: 1px solid var(--line);
  background: var(--card);
  width: 34px; height: 34px; flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--ink-2); font-size: 14px;
  transition: color .16s, border-color .16s;
}
.iconbtn:hover { color: var(--ink); border-color: var(--ink-3); }

.progress { flex: 1; height: 5px; background: var(--paper-2); border-radius: 999px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .3s cubic-bezier(.3,.8,.3,1); }

.scorepill {
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  background: var(--card); border: 1px solid var(--line-soft);
  padding: 5px 11px; border-radius: 999px;
  min-width: 58px; text-align: center;
}
.scorepill-sep { color: var(--ink-3); margin: 0 2px; }
.scorepill .up { color: var(--ok); }

.qcard {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.qmeta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.badge {
  font-size: 11px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 7px;
  background: var(--accent-soft); color: var(--accent);
}
.badge.ghost { background: transparent; color: var(--ink-3); border: 1px solid var(--line);
  text-transform: none; letter-spacing: 0; font-size: 11.5px; font-weight: 600; }
.badge.src { background: transparent; color: var(--ink-3); border: 1px dashed var(--line); text-transform: none; letter-spacing: 0; font-weight: 500; }

.qtext {
  font-family: var(--serif);
  font-size: clamp(19px, 3.4vw, 23px);
  line-height: 1.4;
  font-weight: 400;
  letter-spacing: -.005em;
  margin: 0 0 20px;
}
.qtext.long {
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.6;
  letter-spacing: 0;
}
.qtext.long .qlead { display: block; margin-bottom: 8px; }
.qtext .pre { display: block; font-family: var(--sans); font-size: 14.5px; color: var(--ink-2); margin-bottom: 10px; }

.options { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.opt {
  width: 100%;
  display: flex; gap: 12px; align-items: flex-start;
  text-align: left;
  padding: 13px 14px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: transparent;
  transition: border-color .14s, background .14s, transform .14s;
}
.opt:hover:not(:disabled) { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: color-mix(in srgb, var(--accent) 4%, transparent); }
.opt:disabled { cursor: default; }
.opt-k {
  flex: none; width: 24px; height: 24px; border-radius: 7px;
  display: grid; place-items: center;
  background: var(--paper-2); color: var(--ink-2);
  font-size: 12.5px; font-weight: 700;
  transition: background .14s, color .14s;
}
.opt-t { font-size: 15px; line-height: 1.45; }
.opt.is-ok { border-color: var(--ok); background: var(--ok-soft); }
.opt.is-ok .opt-k { background: var(--ok); color: #fff; }
.opt.is-bad { border-color: var(--bad); background: var(--bad-soft); }
.opt.is-bad .opt-k { background: var(--bad); color: #fff; }
.opt.is-dim { opacity: .5; }

.textanswer { display: flex; gap: 8px; margin-top: 4px; }
.textanswer input {
  flex: 1; min-width: 0;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 15px;
}
.textanswer input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.textanswer input:disabled { opacity: .7; }
.btn-primary {
  border: 0; border-radius: 12px; padding: 13px 18px;
  background: var(--accent); color: #fff; font-weight: 650; font-size: 14.5px;
  flex: none; transition: filter .16s;
}
.btn-primary:hover { filter: brightness(1.07); }
@media (prefers-color-scheme: dark) { .btn-primary { color: #0c1b15; } }

.feedback { margin-top: 18px; border-radius: 14px; padding: 15px 16px; border: 1px solid; animation: rise .26s ease both; }
.feedback.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.feedback.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.fb-head { font-size: 14.5px; font-weight: 700; margin: 0 0 6px; }
.feedback.ok .fb-head { color: var(--ok); }
.feedback.bad .fb-head { color: var(--bad); }
.fb-body { font-size: 14.5px; color: var(--ink-2); line-height: 1.55; margin: 0; }
.fb-body strong { color: var(--ink); font-weight: 650; }
.fb-accepted { margin: 8px 0 0; font-size: 13px; color: var(--ink-3); }

.quizfoot { display: flex; justify-content: flex-end; margin-top: 16px; }
.quizfoot .btn-primary { padding: 14px 26px; font-size: 15px; }
.kbdhint { margin-right: auto; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); }
kbd {
  font-family: var(--mono); font-size: 10.5px; padding: 2px 5px; border-radius: 5px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink-2);
}
@media (max-width: 560px) { .kbdhint { display: none; } }

/* ---------- result ---------- */

.scorehero { text-align: center; padding: 26px 0 8px; }
.ring { width: 148px; height: 148px; margin: 0 auto 18px; position: relative; }
.ring svg { transform: rotate(-90deg); }
.ring-val {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 33px; line-height: 1; letter-spacing: -.02em;
}
.ring-val small { font-family: var(--sans); font-size: 11px; color: var(--ink-3); margin-top: 7px; line-height: 1.2; }
.scorehero h2 { font-family: var(--serif); font-weight: 400; font-size: 30px; margin: 0 0 6px; letter-spacing: -.02em; }
.scorehero p { color: var(--ink-2); margin: 0; }

.topicrows { display: grid; gap: 9px; margin-top: 6px; }
.trow { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; font-size: 13.5px; }
.trow-bar { height: 6px; border-radius: 999px; background: var(--paper-2); overflow: hidden; margin-top: 5px; }
.trow-bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.trow-val { color: var(--ink-3); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.trow-name { color: var(--ink-2); }

.wronglist { display: grid; gap: 10px; }
.wrongitem { border: 1px solid var(--line-soft); border-radius: 13px; padding: 14px; background: var(--paper); }
.wrongitem .wq { font-size: 14.5px; line-height: 1.5; margin: 0 0 8px; }
.wrongitem .wg { font-size: 13px; color: var(--ink-2); margin: 0; display: grid; gap: 3px; }
.wrongitem .wg b.bad { color: var(--bad); font-weight: 600; }
.wrongitem .wg b.good { color: var(--ok); font-weight: 600; }
.result-actions { display: grid; gap: 10px; margin-top: 20px; }

/* ---------- read ---------- */

.readhead { margin-top: 8px; }
.readtools { display: grid; gap: 10px; margin: 10px 0 20px; }
.readtools input {
  width: 100%; padding: 13px 15px; border-radius: 13px;
  border: 1px solid var(--line); background: var(--card); font-size: 15px;
}
.readtools input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: transparent; color: var(--ink-2);
  padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  transition: background .16s, color .16s, border-color .16s;
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip.is-on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
@media (prefers-color-scheme: dark) { .chip.is-on { background: var(--ink); color: #14181d; } }

.readlist { display: grid; gap: 10px; }

.rcard { border: 1px solid var(--line-soft); border-radius: 15px; background: var(--card); box-shadow: var(--shadow); overflow: hidden; }
.rcard > summary {
  list-style: none; cursor: pointer;
  padding: 15px 16px;
  display: grid; gap: 8px;
  transition: background .16s;
}
.rcard > summary::-webkit-details-marker { display: none; }
.rcard > summary:hover { background: color-mix(in srgb, var(--accent) 3%, transparent); }
.rcard .rq { font-size: 15px; line-height: 1.5; margin: 0; padding-right: 22px; position: relative; }
.rcard .rq::after {
  content: "+"; position: absolute; right: 0; top: -2px;
  font-size: 18px; color: var(--ink-3); font-weight: 400;
}
.rcard[open] .rq::after { content: "–"; }
.rcard .rmeta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ranswer {
  border-top: 1px dashed var(--line);
  padding: 14px 16px 16px;
  display: grid; gap: 10px;
}
.ranswer .row { display: grid; gap: 4px; font-size: 14px; line-height: 1.5; }
.ranswer .row .lab { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); font-weight: 650; }
.ranswer .row.good .val { color: var(--ok); font-weight: 600; }
.ranswer .row.exp .val { color: var(--ink-2); }
.ranswer .row .val { white-space: pre-wrap; }

.empty { text-align: center; color: var(--ink-3); padding: 44px 0; font-size: 14.5px; }

/* ---------- stats ---------- */

.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 18px 0 14px; }
.stat { background: var(--card); border: 1px solid var(--line-soft); border-radius: 15px; padding: 16px; box-shadow: var(--shadow); }
.stat-v { font-family: var(--serif); font-size: 30px; line-height: 1.1; letter-spacing: -.02em; }
.stat-l { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.dangerbtn {
  border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent);
  color: var(--bad); background: transparent; border-radius: 11px;
  padding: 10px 15px; font-size: 13.5px; font-weight: 600; margin-top: 8px;
}
.dangerbtn:hover { background: var(--bad-soft); }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
  background: var(--ink); color: var(--paper);
  padding: 11px 18px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .22s, transform .22s;
  z-index: 40; box-shadow: var(--shadow-lg);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
