/* ============================================================
   Czech Flash — styles
   Paper white + forest green. System fonts only (offline-safe).
   ============================================================ */

:root { --bg: #F4F1EC; --surface: #FFFFFF; --surface-2: #EDE9E1; --border: #DCD6CB; --border-strong: #C2BBAD; --text: #1F1B17; --text-muted:#5F594F; --text-soft: #8A8478; --accent: #2E5E4E; --accent-2: #3D7A66; --warn: #B85C3E; --danger: #A03A2C; --lvl1: #C2BBAD; --lvl2: #8FA2A9; --lvl3: #5B8893; --lvl4: #3D7A66; --lvl5: #2E5E4E; --radius: 14px; --radius-lg: 22px; --shadow-sm: 0 1px 2px rgba(20, 18, 14, 0.04); --shadow: 0 4px 18px rgba(20, 18, 14, 0.08); --t-fast: 140ms; --t-med: 280ms; --ease: cubic-bezier(0.22, 0.61, 0.36, 1); --font-serif: ui-serif, Georgia, 'Times New Roman', serif; --font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; --tabbar-h: 64px; }
@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #161412;
    --surface:   #221F1B;
    --surface-2: #2B2823;
    --border:    #383430;
    --border-strong: #4A453F;
    --text:      #F1ECE3;
    --text-muted:#B5AEA1;
    --text-soft: #847E72;
    --accent:    #6BB39A;
    --accent-2:  #7FC2AB;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }

/* ---------- App shell ---------- */
.app {
  min-height: 100dvh;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}

.view {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 20px 8px;
}

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed;
  inset: auto 0 0 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in oklab, var(--surface) 92%, transparent);
  backdrop-filter: saturate(140%) blur(14px);
  border-top: 1px solid var(--border);
  z-index: 10;
}
.tabbar__btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-soft);
  transition: color var(--t-fast) var(--ease);
}
.tabbar__btn.is-active { color: var(--accent); }
.tabbar__icon { font-size: 18px; line-height: 1; }
.tabbar__label { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }

/* ---------- Learn view ---------- */
.learn { display: flex; flex-direction: column; min-height: calc(100dvh - var(--tabbar-h) - 48px); }
.learn__header { margin-bottom: 18px; }

.meter {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-muted);
}
.meter__item b {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-right: 4px;
}

/* ---- Flashcard ---- */
.card-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 24px 0;
  transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--ease);
}
.card-stage.enter { opacity: 0; transform: translateY(8px); }
.card-stage.exit  { opacity: 0; transform: translateY(-8px); }

.card {
  width: 100%;
  min-height: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 36px 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.card:active { transform: scale(0.99); }
.card.is-flipped { box-shadow: 0 4px 18px rgba(46, 94, 78, 0.18); }

.card__face { width: 100%; }
.card__pos {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
  min-height: 14px;
}
.card__word {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(2.4rem, 9vw, 3.4rem);
  line-height: 1.1;
  color: var(--text);
  letter-spacing: -0.02em;
}
.card__word--en { color: var(--accent); }
.card__hint {
  margin-top: 24px;
  font-size: 13px;
  color: var(--text-soft);
}

/* ---- Rating row ---- */
.ratings {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.rating {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 6px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.rating:active { transform: scale(0.97); }
.rating__label { font-size: 14px; font-weight: 600; }
.rating__key {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--text-soft);
}
.rating--again { border-color: color-mix(in oklab, var(--warn) 40%, var(--border)); }
.rating--again .rating__label { color: var(--warn); }
.rating--hard  .rating__label { color: var(--text-muted); }
.rating--good  { border-color: color-mix(in oklab, var(--accent) 40%, var(--border)); }
.rating--good  .rating__label { color: var(--accent); }
.rating--easy  { background: var(--accent); border-color: var(--accent); }
.rating--easy  .rating__label,
.rating--easy  .rating__key { color: #fff; }

/* ---- Empty state ---- */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty h2 {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  margin-bottom: 8px;
  color: var(--text);
}
.empty .btn { margin-top: 20px; }
.practice-row { display: inline-flex; align-items: center; gap: 8px; margin-top: 20px; }
.practice-row .btn { margin-top: 0; }
.practice-size {
  width: 56px;
  padding: 8px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  text-align: center;
}

/* ---- Time stats ---- */
.time-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.time-row:last-child { border-bottom: none; }
.time-label { color: var(--text-muted); font-size: 0.9rem; }
.time-value { font-weight: 600; font-size: 1.05rem; }

/* ---------- Stats / Settings shared panel ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.panel__title {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.panel__lede {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 8px;
}

.stats__title, .settings__title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 2rem;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}

/* ---- Today panel ---- */
.today-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.today-stat {
  background: var(--surface-2);
  border-radius: calc(var(--radius) - 2px);
  padding: 12px 14px;
}
.today-stat__value {
  font-size: 1.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.02em;
}
.today-stat__label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 5px;
}

/* ---- Coverage panel ---- */
.coverage__row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
}
.coverage__big {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 3rem;
  color: var(--accent);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.coverage__sub { color: var(--text-muted); font-size: 14px; }
.coverage__bar {
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.coverage__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--lvl3), var(--lvl5));
  transition: width var(--t-med) var(--ease);
}
.coverage__meta { font-size: 13px; color: var(--text-soft); margin-top: 8px; }

.tiers { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.tier__head {
  display: flex; justify-content: space-between;
  font-size: 13px; color: var(--text-muted);
  margin-bottom: 4px;
}
.tier__count { font-variant-numeric: tabular-nums; color: var(--text); }
.tier__bar {
  height: 6px; border-radius: 999px;
  background: var(--surface-2); overflow: hidden;
}
.tier__fill { height: 100%; background: var(--accent); }

/* ---- Level drill-down ---- */
.dist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0;
}
.dist-header .panel__title { margin-bottom: 12px; }
.dist-back {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 12px;
}
.dist-back:hover { opacity: 0.75; }

.level-word-list {
  max-height: 380px;
  overflow-y: auto;
}
.level-word-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.level-word-row:last-child { border-bottom: none; }
.level-word-row__native {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text);
  flex-shrink: 0;
}
.level-word-row__en {
  font-size: 13px;
  color: var(--text-muted);
  text-align: right;
}
.level-word-list__empty {
  font-size: 14px;
  color: var(--text-muted);
  padding: 12px 0;
}

/* ---- Charts ---- */
.chart svg { width: 100%; height: auto; display: block; }
.chart__caption, .chart__empty {
  text-align: center;
  font-size: 13px;
  color: var(--text-soft);
  margin-top: 6px;
}
.chart__axis {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text-soft);
  margin-top: 4px;
}

.bar         { fill: var(--lvl3); transition: fill var(--t-fast) var(--ease); }
.bar--lvl1   { fill: var(--lvl1); }
.bar--lvl2   { fill: var(--lvl2); }
.bar--lvl3   { fill: var(--lvl3); }
.bar--lvl4   { fill: var(--lvl4); }
.bar--lvl5   { fill: var(--lvl5); }
.bar__label  { font-size: 10px; fill: var(--text-soft); text-anchor: middle; font-family: var(--font-sans); }
.bar__value  { font-size: 11px; fill: var(--text); text-anchor: middle; font-family: var(--font-sans); font-weight: 600; }

.spark__line { stroke: var(--accent); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.spark__area { fill: color-mix(in oklab, var(--accent) 18%, transparent); stroke: none; }
.spark__dot  { fill: var(--accent); }

/* ---- Settings ---- */
.settings .seg-ctrl {
  width: fit-content;
  grid-template-columns: repeat(2, auto);
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 14px; font-weight: 600; }
.field__hint  { font-size: 13px; color: var(--text-muted); }
.field__input {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  max-width: 120px;
}

.btn {
  display: inline-block;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  margin-right: 8px;
  margin-bottom: 8px;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.btn:hover { border-color: var(--border-strong); }
.btn--ghost { color: var(--text-muted); }
.btn--danger { color: var(--danger); border-color: color-mix(in oklab, var(--danger) 40%, var(--border)); }

/* ---- Responsive ---- */
@media (min-width: 720px) {
  .view { padding: 32px 24px 12px; }
  .card { min-height: 380px; padding: 56px 40px; }
}

/* ---------- Verbs view ---------- */
.verbs { display: flex; flex-direction: column; min-height: calc(100dvh - var(--tabbar-h) - 48px); }
.verbs__title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 2rem;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}
.verbs__progress {
  font-size: 13px;
  color: var(--text-soft);
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
  min-height: 20px;
}

.seg-ctrl {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  gap: 3px;
  margin-bottom: 8px;
}
.seg-ctrl__btn {
  padding: 8px 6px;
  font-size: 13px;
  font-weight: 600;
  border-radius: calc(var(--radius) - 4px);
  color: var(--text-muted);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.seg-ctrl__btn.is-active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(0,0,0,0.10);
}

.verbs-card__face { width: 100%; text-align: center; }
.verbs-card__inf {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 8vw, 2.8rem);
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.verbs-card__en { font-size: 15px; color: var(--accent); margin-top: 4px; }
.verbs-card__pronoun { margin-top: 20px; font-size: 1.2rem; font-weight: 600; color: var(--text-muted); }
.verbs-card__hint { margin-top: 12px; font-size: 13px; color: var(--text-soft); }
.verbs-card__answer {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 7vw, 2.4rem);
  font-weight: 500;
  color: var(--accent);
  letter-spacing: -0.01em;
}

.verbs-ratings {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.verbs-rating {
  padding: 14px 6px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.verbs-rating:active { transform: scale(0.97); }
.verbs-rating--again { border-color: color-mix(in oklab, var(--warn) 40%, var(--border)); color: var(--warn); }
.verbs-rating--good  { border-color: color-mix(in oklab, var(--accent) 40%, var(--border)); color: var(--accent); }
.verbs-rating--easy  { background: var(--accent); border-color: var(--accent); color: #fff; }

.verbs-empty { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.verbs-empty__msg {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  color: var(--text);
  margin-bottom: 8px;
}

.verbs__subtitle { font-size: 15px; color: var(--text-muted); margin-bottom: 20px; }
.verbs__back-btn {
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  padding: 6px 0;
  margin-bottom: 12px;
  background: none;
  border: none;
  cursor: pointer;
}
.verbs__back-btn:hover { opacity: 0.8; }

.verb-mode-btns { display: flex; flex-direction: column; gap: 12px; }
.verb-mode-btn {
  width: 100%;
  padding: 18px 20px;
  font-size: 16px;
  font-weight: 600;
  text-align: left;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.verb-mode-btn:hover { border-color: var(--border-strong); }
.verb-mode-btn:active { transform: scale(0.98); }
.verb-mode-btn--accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.verb-mode-btn--accent:hover { background: var(--accent-2); border-color: var(--accent-2); }

.verb-list { display: flex; flex-direction: column; gap: 8px; }
.verb-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: left;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.verb-list__item:hover { border-color: var(--border-strong); }
.verb-list__item:active { transform: scale(0.98); }
.verb-list__cz { font-family: var(--font-serif); font-size: 1.15rem; font-weight: 500; color: var(--text); }
.verb-list__en { font-size: 14px; color: var(--accent); }
.verb-list__empty { font-size: 15px; color: var(--text-muted); padding: 20px 0; }

/* ---------- Lists view ---------- */
.lists { display: flex; flex-direction: column; min-height: calc(100dvh - var(--tabbar-h) - 48px); }
.lists__title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 2rem;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}
.lists__back-btn {
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  padding: 6px 0;
  margin-bottom: 12px;
  background: none;
  border: none;
  cursor: pointer;
}
.lists__back-btn:hover { opacity: 0.8; }
.lists__list-name {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 500;
  margin-bottom: 16px;
}
.lists__progress {
  font-size: 13px;
  color: var(--text-soft);
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
  min-height: 20px;
}

.lists-category { margin-bottom: 20px; }
.lists-category__label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
  margin-bottom: 8px;
}
.lists-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: left;
  margin-bottom: 6px;
  transition: border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.lists-row:hover { border-color: var(--border-strong); }
.lists-row:active { transform: scale(0.98); }
.lists-row__name { font-size: 15px; font-weight: 500; color: var(--text); }
.lists-row__count {
  font-size: 12px;
  color: var(--text-soft);
  background: var(--surface-2);
  border-radius: 10px;
  padding: 2px 8px;
}

.list-mode-btns { display: flex; gap: 10px; margin-bottom: 16px; }
.list-mode-btn {
  flex: 1;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.list-mode-btn:hover { border-color: var(--border-strong); }
.list-mode-btn:active { transform: scale(0.98); }
.list-mode-btn--accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.list-mode-btn--accent:hover { background: var(--accent-2); border-color: var(--accent-2); }

.list-table { width: 100%; border-collapse: collapse; }
.list-table__cz {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text);
  padding: 11px 12px 11px 0;
  border-bottom: 1px solid var(--border);
  width: 48%;
}
.list-table__en {
  font-size: 14px;
  color: var(--text-muted);
  padding: 11px 0 11px 12px;
  border-bottom: 1px solid var(--border);
}

.lists-card__face { width: 100%; text-align: center; }
.lists-card__cz {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 8vw, 2.8rem);
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.lists-card__hint { margin-top: 12px; font-size: 13px; color: var(--text-soft); }
.lists-card__en {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 7vw, 2.4rem);
  font-weight: 500;
  color: var(--accent);
  letter-spacing: -0.01em;
}

.lists-actions { display: flex; justify-content: flex-end; margin-top: 12px; }
#ls-next { flex: none; }
.lists-empty { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.lists-empty__msg {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  color: var(--text);
  margin-bottom: 8px;
}

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