:root {
  --bg: #f8fafc;   /* slate-50 */
  --bg-soft: #eef1f8;
  --card: #ffffff;
  --line: #dde2ee;
  --text: #0f172a;   /* slate-900 */
  --muted: #6b7387;
  --accent: #3b5bdb;
  --accent-hi: #2f4bc4;
  --accent-soft: #e8edfd;
  --ok: #1f9d55;
  --ok-soft: #e7f6ed;
  --ok-line: #bde3cb;
  --bad: #d6455d;
  --bad-soft: #fdeced;
  --bad-line: #f4c6cc;
  --warn: #a5691a;
  --warn-soft: #fdf3e2;
  --warn-line: #f0dcb6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(28, 34, 51, .05), 0 4px 10px rgba(28, 34, 51, .055);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.1rem; }
p { margin: 0 0 .8em; }
code { background: var(--bg-soft); padding: .1em .35em; border-radius: 5px; font-size: .9em; }
kbd {
  display: inline-block; min-width: 1.5em; margin-left: .3em;
  padding: .05em .3em; border: 1px solid currentColor; border-radius: 5px;
  font: inherit; font-size: .78em; line-height: 1.4; opacity: .8;
}

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.back-row { margin-bottom: 1.1rem; }
.back-row .btn { margin-left: -.7rem; }   /* popisek lícuje s h1 pod ním */
.btn.off { opacity: .6; }

main {
  max-width: 850px;
  margin: 0 auto;
  padding: clamp(2.2rem, 6vw, 4rem) clamp(.8rem, 3vw, 2rem) 1.2rem;
}

/* Tiráž: rok a autor – tak potichu, aby to nekonkurovalo obsahu. */
.footer {
  padding: 0 clamp(.8rem, 3vw, 2rem) 2.5rem;
  text-align: center;
  font-size: .78rem;
  color: var(--muted);
  opacity: .75;
}
.footer a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); }
.footer a:hover { color: var(--text); border-bottom-color: var(--muted); }

.hero {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: .6rem 1.2rem; flex-wrap: wrap; margin-bottom: 1.2rem;
}
.hero h1 { margin: 0; }
.hero-stats { margin: 0; font-size: .9rem; color: var(--muted); }
.hero-stats strong { color: var(--text); font-weight: 600; }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-bottom: 1rem; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: .7rem; }
.card-head h2 { margin: 0; }
.filters {
  display: flex; align-items: center; justify-content: flex-end;
  gap: .6rem; flex: 1 1 auto; flex-wrap: wrap;
}
.filters #words-search { flex: 0 1 240px; }
.check {
  display: flex; align-items: center; gap: .35rem; flex: none;
  font-size: .85rem; color: var(--muted); white-space: nowrap; cursor: pointer;
  -webkit-user-select: none; user-select: none;
}
.check input { width: auto; accent-color: var(--accent); }

.big-card { margin-bottom: 0; display: flex; flex-direction: column; }
.big-card-head { display: flex; align-items: center; gap: .6rem; }
.big-card-head #btn-sound { margin-left: auto; }
.big-card-head h2 { margin: 0; font-size: 1.25rem; }
.big-card .emoji { font-size: 1.6rem; }
.stats { margin: .8rem 0 0; font-size: .9rem; color: var(--muted); }
.stats strong { color: var(--text); font-weight: 600; }
.big-card .btn.block { margin-top: .7rem; }
#home-next-due { margin: .7rem 0 0; text-align: center; }
#home-next-due:empty { display: none; }
.big-card.wide { margin-bottom: 1rem; }

/* ---------- controls ---------- */
.btn {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .6rem 1rem;
  font-size: .95rem;
  font-family: inherit;
  cursor: pointer;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { background: var(--bg-soft); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent-hi); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--bg-soft); color: var(--text); }
.btn.small { padding: .35rem .7rem; font-size: .85rem; }
.btn.block { width: 100%; margin-top: .8rem; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; font-weight: 600; }
.btn.bad { background: var(--bad); border-color: var(--bad); color: #fff; font-weight: 600; }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }

input[type=text], input[type=search], select, textarea {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: .6rem .75rem;
  font-family: inherit;
  font-size: .95rem;
  width: 100%;
}
input::placeholder, textarea::placeholder { color: #a3aabb; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
textarea { resize: vertical; }

.row-form { display: flex; gap: .5rem; flex-wrap: wrap; }
.row-form input { flex: 1 1 160px; }
.form-msg { font-size: .88rem; margin: .6rem 0 0; }
.form-msg:empty { display: none; }
.form-msg.ok { color: var(--ok); }
.form-msg.err { color: var(--bad); }

.bulk { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .8rem; }
.bulk summary { cursor: pointer; color: var(--muted); }
.bulk p { margin: .5rem 0 .4rem; }
.bulk textarea { margin-top: 0; }

/* ---------- seznamy slovíček (přehled i nejhorší slovíčka) ---------- */
.wlist { display: flex; flex-direction: column; }
.witem {
  display: flex; align-items: center; gap: .7rem;
  padding: .5rem .4rem;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.witem:last-child { border-bottom: 0; }
.witem:hover { background: var(--bg-soft); }
.witem .pair { flex: 0 1 auto; min-width: 0; }
.witem .cs { font-weight: 600; }
.witem .en { color: var(--muted); }
.witem .badge { flex: none; margin-left: .2rem; }
.witem .actions { margin-left: auto; display: flex; gap: .3rem; }

.badge {
  font-size: .72rem; padding: .15rem .55rem; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); background: var(--card);
  white-space: nowrap; line-height: 1.5;
}
.badge.due { color: var(--muted); border-color: #e3e7f0; background: #f3f5f9; }
.badge.hard { color: var(--bad); border-color: var(--bad-line); background: var(--bad-soft); }
.icon-btn {
  background: transparent; border: 0; color: var(--muted);
  cursor: pointer; font-size: 1rem; padding: .3rem .4rem; border-radius: 8px;
}
.icon-btn:hover { background: var(--line); color: var(--text); }

.note { margin-top: .3rem; font-size: .88rem; font-weight: 600; }
.note.ok-note { color: var(--ok); }
.note.bad-note { color: var(--bad); }

/* ---------- relace ---------- */
.session-bar { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.6rem; }
.progress { flex: 1; height: 6px; background: #e3e7f1; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--accent); transition: width .25s ease; }
.counter { color: var(--muted); font-size: .85rem; white-space: nowrap; }

.task { max-width: 640px; margin: 0 auto; }
.task-title { font-size: .82rem; font-weight: 500; color: var(--muted); margin: 0 0 .5rem .2rem; }
.prompt {
  background: var(--card); border-radius: var(--radius);
  padding: 2rem 1.2rem; text-align: center; margin-bottom: 1.5rem; box-shadow: var(--shadow);
}
.prompt .word { font-size: 2rem; font-weight: 700; }

.options { display: grid; gap: .6rem; }
.option {
  display: flex; align-items: center; gap: .7rem;
  text-align: left; width: 100%;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: .85rem 1rem;
  color: var(--text); font-size: 1.05rem; font-family: inherit; cursor: pointer;
}
.option:hover:not([disabled]) { border-color: var(--accent); background: var(--accent-soft); }
.option .key {
  width: 24px; height: 24px; flex: none; display: grid; place-items: center;
  border-radius: 6px; background: var(--bg-soft); color: var(--muted); font-size: .8rem;
}
.option.correct { border-color: var(--ok); background: var(--ok-soft); }
.option.wrong { border-color: var(--bad); background: var(--bad-soft); }
.option[disabled] { cursor: default; }

.feedback {
  margin-top: 1rem; padding: 1rem; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card);
  display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
}
.feedback.ok { border-color: var(--ok-line); background: var(--ok-soft); }
.feedback.err { border-color: var(--bad-line); background: var(--bad-soft); }
.feedback .txt { flex: 1 1 200px; }
.feedback .title { font-weight: 700; }

.flashcard {
  min-height: 240px;
  display: grid; place-items: center;
  text-align: center;
  background: var(--card);
  border-radius: 18px; padding: 2.4rem 1.2rem; margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.flashcard .word { font-size: 2.3rem; font-weight: 700; }
.flashcard .sub { color: var(--muted); margin-top: .5rem; }

.answer-row { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.answer-row .btn { padding: .9rem; font-size: 1rem; }
.speak-btn { font-size: 1.3rem; padding: .45rem .7rem; }

.summary { max-width: 560px; margin: 2rem auto; text-align: center; }
.summary h2 { font-size: 1.4rem; }
.summary .big { font-size: 3rem; }

.empty { color: var(--muted); text-align: center; padding: 1.4rem; }

.toast {
  position: fixed; left: 50%; top: 1.4rem; transform: translateX(-50%);
  background: var(--text); border: 1px solid var(--text); color: #fff;
  padding: .6rem 1rem; border-radius: 999px;
  box-shadow: 0 8px 24px rgba(28, 34, 51, .18);   /* jediný prvek, co opravdu pluje nad obsahem */
  z-index: 50; font-size: .9rem;
}

@media (max-width: 560px) {
  .prompt .word { font-size: 1.6rem; }
  .flashcard .word { font-size: 1.9rem; }
}
