:root {
  --bg: #f3efe4;
  --surface: #fffdf8;
  --ink: #2b2a24;
  --muted: #807c6e;
  --primary: #1f6f5c;
  --primary-dark: #165544;
  --accent: #c2703d;
  --accent-soft: #f6e9dd;
  --line: #e7e1d3;
  --good: #2e8b57;
  --bad: #c0492f;
  --radius: 16px;
  --shadow: 0 4px 18px rgba(60,50,30,.07);
  --shadow-sm: 0 2px 8px rgba(60,50,30,.05);
  --sans: ui-sans-serif, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: .92rem; }
.error { color: var(--bad); }
.success { color: var(--good); font-weight: 600; }
.center { text-align: center; }

.screen { min-height: 100vh; }
.screen.center { display: flex; align-items: center; justify-content: center; padding: 20px; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  width: 100%;
  max-width: 460px;
}
.login-card h1 { margin-top: 0; }

h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; margin: 0 0 12px; }
h3 { font-size: 1.05rem; }

input, select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-size: 1rem;
  margin: 8px 0;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus { outline: none; border-color: var(--primary); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 10px; padding: 12px 18px;
  font-size: 1rem; font-weight: 600; cursor: pointer;
  background: #eceae4; color: var(--ink); transition: filter .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn:hover { filter: brightness(.97); }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); }
.btn.small { padding: 7px 12px; font-size: .85rem; }
.btn.big { padding: 14px 22px; font-size: 1.05rem; }
.btn.full { width: 100%; }

hr { border: none; border-top: 1px solid var(--line); margin: 20px 0; }

/* Profily */
.profiles-list { display: grid; gap: 10px; margin: 12px 0; }
.profile-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 10px;
  cursor: pointer; background: #fff;
}
.profile-item:hover { border-color: var(--primary); }
.profile-item .meta { font-size: .85rem; color: var(--muted); }

/* Topbar */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px; background: var(--surface); box-shadow: var(--shadow);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-family: var(--display); font-weight: 700; font-size: 1.25rem; cursor: pointer; letter-spacing: -.01em; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill {
  background: #eef0ea; border-radius: 999px; padding: 5px 11px; font-size: .85rem; font-weight: 600;
}

/* Tabs */
.tabs {
  display: flex; gap: 4px; padding: 8px 12px; background: var(--surface);
  border-top: 1px solid var(--line); overflow-x: auto; position: sticky; top: 56px; z-index: 9;
}
.tab {
  border: none; background: transparent; padding: 8px 14px; border-radius: 8px;
  font-size: .95rem; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.tab.active { background: #e8f0ec; color: var(--primary); }
.badge {
  background: var(--accent); color: #fff; border-radius: 999px;
  padding: 1px 7px; font-size: .75rem; margin-left: 4px;
}

/* Skill bar */
.skillbar { max-width: 760px; margin: 0 auto; padding: 12px 16px 0; }
.skillbar-info { display: flex; justify-content: space-between; align-items: baseline; font-size: .85rem; font-weight: 600; margin-bottom: 5px; }
.progress-wrap.thin { height: 8px; }

/* Toast */
.toast {
  position: fixed; left: 50%; top: 70px; transform: translateX(-50%);
  background: var(--primary); color: #fff; padding: 12px 20px; border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0,0,0,.2); font-weight: 600; z-index: 50;
  transition: opacity .3s, transform .3s; opacity: 1;
}
.toast.hidden { opacity: 0; pointer-events: none; transform: translate(-50%, -10px); }
.xp-gain { color: var(--accent); font-weight: 700; }

.content { max-width: 760px; margin: 0 auto; padding: 14px 16px 60px; }
.block {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 16px;
}
.loading, .empty { text-align: center; padding: 40px 20px; color: var(--muted); }

/* Progress */
.progress-wrap { background: #e3e0d8; border-radius: 999px; height: 10px; overflow: hidden; margin-bottom: 16px; }
.progress-bar { height: 100%; width: 0; background: var(--primary); transition: width .4s; }

/* Vocab */
.vocab-list { display: grid; gap: 10px; }
.vocab-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.vocab-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.vocab-en { font-size: 1.15rem; font-weight: 700; }
.vocab-ipa { color: var(--muted); font-size: .9rem; }
.vocab-cs { color: var(--primary-dark); font-weight: 600; }
.vocab-example { margin-top: 6px; font-size: .92rem; }
.vocab-example .cs { color: var(--muted); }
.speak {
  border: none; background: #eef0ea; border-radius: 8px; cursor: pointer;
  padding: 4px 9px; font-size: .95rem; margin-left: auto;
}
.speak:hover { background: #dfe6e0; }

/* Grammar */
.q { border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 12px; }
.q-prompt { font-weight: 600; margin-bottom: 10px; }
.options { display: grid; gap: 8px; }
.option {
  text-align: left; border: 1.5px solid var(--line); background: #fff; border-radius: 9px;
  padding: 10px 12px; cursor: pointer; font-size: .98rem;
}
.option:hover { border-color: var(--primary); }
.option.correct { border-color: var(--good); background: #eaf6ef; }
.option.wrong { border-color: var(--bad); background: #fbeae6; }
.option:disabled { cursor: default; }
.feedback { margin-top: 10px; font-size: .9rem; padding: 10px; border-radius: 8px; background: #f4f5f1; }
.feedback.ok { background: #eaf6ef; }
.feedback.no { background: #fbeae6; }

/* Translation */
.tr { border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 12px; }
.tr-cs { font-weight: 600; }
.tr-hint { font-size: .82rem; color: var(--muted); margin: 4px 0 8px; }
.tr-row { display: flex; gap: 8px; }
.tr-row input { margin: 0; }

/* Listening */
.listen-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.listen-item:last-child { border-bottom: none; }

/* Flashcard */
.flashcard {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  min-height: 200px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 30px; text-align: center; margin-bottom: 14px; gap: 10px;
}
.flash-front { font-size: 1.8rem; font-weight: 700; }
.flash-back { font-size: 1.3rem; color: var(--primary-dark); }
.flash-back .ex { font-size: .95rem; color: var(--muted); font-weight: 400; margin-top: 8px; }
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grade.again { background: #f3d6cf; }
.grade.hard { background: #f5e3c8; }
.grade.good { background: #d7ebdc; }
.grade.easy { background: #cfe6ef; }

.day-footer { text-align: center; margin-top: 8px; }

/* Zamčený stav po dokončení dne */
.done-panel {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 36px 24px; text-align: center; margin-top: 8px;
}
.done-emoji { font-size: 3rem; }
.done-panel h2 { margin: 8px 0; }
.done-recap { font-weight: 600; color: var(--primary-dark); margin: 14px 0; }
.done-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }

/* ===== Knížka / přehledy ===== */
.ref-cats { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.ref-cat {
  border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 8px 15px; cursor: pointer; font-size: .9rem; font-weight: 600; color: var(--ink);
  transition: all .15s;
}
.ref-cat:hover { border-color: var(--primary); }
.ref-cat.active { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: var(--shadow-sm); }

/* Hlavička kapitoly — knižní styl */
.chapter {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 30px 28px; border: 1px solid var(--line);
}
.chapter-head { text-align: center; margin-bottom: 22px; }
.chapter-kicker { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.chapter-title { font-family: var(--display); font-size: 2rem; font-weight: 600; margin: 6px 0 0; letter-spacing: -.02em; }
.chapter-rule { width: 56px; height: 3px; background: var(--accent); border-radius: 2px; margin: 14px auto 16px; opacity: .7; }
.chapter-intro {
  font-family: var(--serif); font-size: 1.12rem; line-height: 1.7; color: #4a473d;
  max-width: 56ch; margin: 0 auto; text-align: center;
}

/* Slovníkové heslo */
.entry { padding: 16px 0; border-bottom: 1px solid var(--line); }
.entry:last-child { border-bottom: none; }
.entry-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.entry-en { font-family: var(--display); font-weight: 600; font-size: 1.25rem; }
.entry-ipa { color: var(--muted); font-size: .9rem; font-style: italic; }
.entry-cs { color: var(--primary-dark); font-weight: 600; }
.entry .speak { margin-left: auto; }
.entry-ex {
  font-family: var(--serif); font-size: 1.05rem; margin-top: 8px; color: #3c392f;
  padding-left: 14px; border-left: 3px solid var(--accent-soft);
}
.entry-ex .cs { color: var(--muted); font-style: italic; }
.entry-ex .speak { border: none; background: none; padding: 0 4px; cursor: pointer; }

/* Nepravidelná slovesa — tvary jako chipy */
.verb-forms { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.vform {
  font-family: var(--display); font-weight: 600; font-size: 1.05rem;
  background: var(--accent-soft); color: #7a4a22; padding: 2px 10px; border-radius: 7px;
}
.vform.base { background: #e3efe9; color: var(--primary-dark); }
.varrow { color: var(--muted); font-size: .85rem; }

/* Předložky — skupiny */
.ref-group { margin-bottom: 22px; }
.ref-group h3 { font-family: var(--display); margin: 0 0 10px; color: var(--primary-dark); }
.ref-group .gr-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.ref-group .gr-row:last-child { border-bottom: none; }
.ref-group .gr-en { font-family: var(--serif); font-size: 1.02rem; }
.ref-group .gr-cs { color: var(--muted); font-size: .9rem; text-align: right; white-space: nowrap; }

/* Gramatika — karty */
.gram-card { padding: 18px 0; border-bottom: 1px solid var(--line); }
.gram-card:last-child { border-bottom: none; }
.gram-card h3 { font-family: var(--display); margin: 0 0 4px; color: var(--ink); font-size: 1.2rem; }
.gram-card .g-use { font-size: .98rem; }
.gram-card .g-form { font-size: .85rem; color: var(--accent); margin: 8px 0; font-family: ui-monospace, monospace; }
.gram-card .g-ex {
  font-family: var(--serif); font-size: 1.05rem; background: var(--accent-soft);
  border-radius: 10px; padding: 10px 14px;
}
.gram-card .g-ex .cs { color: var(--muted); font-style: italic; }
.gram-card .g-ex .speak { border: none; background: none; cursor: pointer; }

@media (max-width: 520px) {
  .vocab-en { font-size: 1.05rem; }
  .grades { grid-template-columns: repeat(2, 1fr); }
  .brand span { display: none; }
}
