:root {
  --bg: #f4eedc;
  --paper: #fbf7ec;
  --ink: #1d2a44;
  --ink-soft: #4b5670;
  --accent: #7a2620;
  --line: #d6c9a8;
  --focus: #1d4f8c;
  --btn-bg: #7a2620;
  --btn-fg: #fffaf0;
  --good: #2d6a3a;
  --bad: #8a2a1f;
  --good-bg: #e2eedb;
  --bad-bg: #f5ddd7;
  --shadow: 0 6px 18px rgba(60, 40, 10, 0.12);
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16171e;
    --paper: #1f212b;
    --ink: #ece4cf;
    --ink-soft: #b8b2a0;
    --accent: #ebab96;
    --line: #3a3d4a;
    --focus: #a9c8ff;
    --btn-bg: #d9a58f;
    --btn-fg: #1a1410;
    --good: #a6d7ae;
    --bad: #f2a99c;
    --good-bg: #223626;
    --bad-bg: #3d2623;
    --shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 1.06rem/1.6 var(--sans);
  overflow-x: hidden;
}

h1, h2, h3 { font-family: var(--serif); line-height: 1.25; margin: 0.4em 0 0.5em; }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; margin-top: 1.2em; }
p { margin: 0.5em 0; }

.skip {
  position: absolute;
  left: 16px;
  top: -60px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  padding: 8px 14px;
  border-radius: 8px;
  z-index: 10;
}
.skip:focus { top: 8px; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Horní lišta */

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 12px 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.brand { font: 700 1.1rem/1.2 var(--serif); margin: 0; flex: 1 1 auto; color: var(--accent); }
.lesson-pick { display: flex; align-items: center; gap: 8px; max-width: 100%; }
.lesson-pick select { min-height: 44px; max-width: 220px; font: inherit; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.settings { position: relative; }
.settings summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; padding: 0 8px; }
.settings-body { position: absolute; right: 0; top: 100%; width: 260px; max-width: calc(100vw - 32px); padding: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); z-index: 5; }

/* Navigace režimů */

.modes {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--paper);
  border-top: 1px solid var(--line);
  z-index: 4;
}
.modes a {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 2px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.9rem;
  text-align: center;
}
.modes a[aria-current="page"] {
  color: var(--accent);
  font-weight: 700;
  box-shadow: inset 0 3px 0 var(--accent);
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 16px 104px;
}

.view > .lead { color: var(--ink-soft); }
.hint { color: var(--ink-soft); font-size: 0.92rem; }
.step-label { font-size: 0.92rem; color: var(--ink-soft); font-weight: 600; letter-spacing: 0.02em; }
.field-label { display: block; font-weight: 600; margin-top: 16px; }

.notice {
  padding: 12px 14px;
  border-left: 4px solid var(--accent);
  background: var(--paper);
  border-radius: 8px;
}
.notice.error { border-color: var(--bad); }

/* Tlačítka */

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, border-color 0.2s;
}
button:hover, .btn:hover { border-color: var(--accent); }
button:active, .btn:active { transform: scale(0.98); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.primary { background: var(--btn-bg); color: var(--btn-fg); border-color: transparent; }
button.big { min-height: 56px; padding: 12px 22px; font-size: 1.05rem; }
button.danger { color: var(--bad); }
button.good { border-color: var(--good); color: var(--good); }
button.bad { border-color: var(--bad); color: var(--bad); }
button[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-fg); border-color: transparent; }
button.bad[aria-pressed="true"] { background: var(--bad); }
button.good[aria-pressed="true"] { background: var(--good); }

.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0; }
.controls.transport button { flex: 1 1 0; }
.controls.verdict button { flex: 1 1 140px; }

/* Domů */

.hub-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
#recommend-msg:empty { display: none; }
#recommend-msg { margin-top: 12px; }
.hub > h2 { font-size: 1.1rem; color: var(--accent); margin-top: 24px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.path { margin: 16px 0; padding: 16px; background: var(--paper); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; }
.path .controls { margin: 10px 0 0; }
.path-title { font: 700 1.2rem/1.3 var(--serif); margin: 4px 0 0; }
.lesson-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 10px; }
.lesson-btn { width: 100%; display: flex; align-items: flex-start; justify-content: flex-start; gap: 12px; text-align: left; padding: 12px 14px; }
.lesson-btn[aria-current="true"] { border: 2px solid var(--accent); }
.num { flex: 0 0 auto; display: inline-grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%; background: var(--bg); color: var(--accent); font-weight: 700; }
.lesson-body { display: flex; flex-direction: column; min-width: 0; }
.lesson-title { font: 700 1.05rem/1.3 var(--serif); }
.lesson-desc { font-size: 0.95rem; color: var(--ink); }
.lesson-meta { font-size: 0.88rem; color: var(--ink-soft); font-weight: 400; }

.detail {
  margin-top: 26px;
  padding: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.eyebrow { font-size: 0.85rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.06em; margin: 0; }
.detail-title { font-size: 1.45rem; margin-top: 4px; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 14px 0; }
.stats div { background: var(--bg); border-radius: 10px; padding: 8px 12px; }
.stats dt { font-size: 0.85rem; color: var(--ink-soft); }
.stats dd { margin: 0; font-weight: 700; }
.mode-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tahacek { list-style: none; padding: 0 0 0 14px; border-left: 3px solid var(--accent); }
.tahacek li { margin: 0.5em 0; }

/* Poslech */

.options { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin: 14px 0; display: flex; flex-wrap: wrap; gap: 8px 18px; }
.options legend { padding: 0 6px; color: var(--ink-soft); }
.options label, .check { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; cursor: pointer; }
input[type="radio"], input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }

.player {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.listen-text { font: 1.2rem/1.6 var(--serif); min-height: 7em; margin: 10px 0 14px; }
.pause-box { padding: 12px; border-radius: 10px; background: var(--bg); margin-bottom: 12px; }
.field { display: grid; gap: 6px; margin: 16px 0 4px; font-weight: 600; }
.field input[type="range"] { width: 100%; min-height: 44px; accent-color: var(--accent); }
.field select { min-height: 44px; font: inherit; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); max-width: 240px; }

/* Kartičky */

.card {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 26px 22px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  text-align: center;
}
.card-label { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); margin: 0; }
.card-text { font: 1.4rem/1.4 var(--serif); margin: 10px 0 0; }
.card.turn { animation: turn 0.4s ease; }
@keyframes turn {
  from { transform: rotateX(-80deg); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* Zkoušení */

.question-box { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; justify-content: space-between; }
.question { font-size: 1.3rem; flex: 1 1 260px; }
textarea {
  width: 100%;
  min-height: 140px;
  font: inherit;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  resize: vertical;
}
.checklist { list-style: none; padding: 0; margin: 8px 0; }
.checklist li { padding: 4px 0; }
.checklist label { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.checklist input { margin-top: 5px; }
.model { background: var(--paper); border-left: 4px solid var(--accent); padding: 12px 14px; border-radius: 8px; }

/* Test */

.quiz { border: none; padding: 0; margin: 10px 0; }
.quiz .question { margin-bottom: 12px; }
.option {
  display: flex;
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  margin-bottom: 10px;
  min-height: 52px;
}
.option.right { border-color: var(--good); background: var(--good-bg); color: var(--good); }
.option.wrong { border-color: var(--bad); background: var(--bad-bg); color: var(--bad); }
.feedback { min-height: 1.6em; font-weight: 600; }
.feedback.good { color: var(--good); }
.feedback.bad { color: var(--bad); }
.score { font: 700 1.6rem/1.3 var(--serif); }
.plain { list-style: none; padding: 0; }
.plain li { padding: 6px 0; border-bottom: 1px solid var(--line); }

@media (min-width: 900px) {
  .topbar { padding: 14px 32px; flex-wrap: nowrap; }
  .modes {
    position: static;
    grid-template-columns: repeat(5, max-content);
    justify-content: center;
    gap: 6px;
    padding: 0 16px;
    border-top: none;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
  }
  .modes a { min-height: 52px; padding: 8px 18px; font-size: 1rem; }
  .modes a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--accent); }
  main { padding: 28px 32px 64px; max-width: 880px; }
  .lesson-list { grid-template-columns: repeat(2, 1fr); }
  body.no-data .modes { display: none; }
}

body.no-data .modes,
body.no-data .lesson-pick,
body.no-data .settings { display: none; }


@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
