/* RZ Test — mobile-first CSS
 * Brand: gold #B89968, midnight #0E1218, ivory #FBF8F1
 * Font: system (rychlost); Quicksand jen na hero přes web-safe fallback
 */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --gold: #B89968;
  --gold-deep: #9D7F4E;
  --gold-soft: #F3EAD6;
  --gold-text: #6f5628;
  --ink: #0E1218;
  --ink-2: #1a2029;
  --grey: #4F5560;
  --grey-2: #8a8f99;
  --line: #e8e2d4;
  --ivory: #FBF8F1;
  --bg: #F7F2E9;
  --ok: #2f7d54;
  --ok-bg: #e8f5ee;
  --err: #b3261e;
  --err-bg: #fbeaea;
  --warn: #b26c00;
  --warn-bg: #fdf3e0;
  --info: #1f4e79;
  --info-bg: #e3edf8;

  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(14,18,24,.04), 0 1px 3px rgba(14,18,24,.05);
  --shadow-md: 0 6px 20px -8px rgba(14,18,24,.14), 0 2px 6px rgba(14,18,24,.06);
  --shadow-lg: 0 24px 48px -16px rgba(14,18,24,.22), 0 4px 12px rgba(14,18,24,.08);

  --tap: 48px; /* min. tap target */
}

html, body {
  margin: 0; padding: 0;
  background: var(--ivory);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}

body { min-height: 100dvh; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
button { font: inherit; }

.container { max-width: 720px; margin: 0 auto; padding: 16px; padding-top: max(16px, env(safe-area-inset-top)); }

/* ---------- Header (jednoduchý) ---------- */
.app-header {
  background: var(--ink);
  color: var(--ivory);
  padding: 14px 16px calc(14px + env(safe-area-inset-top));
  padding-top: max(14px, env(safe-area-inset-top));
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 20;
  box-shadow: var(--shadow-sm);
}
.app-header h1 {
  margin: 0; font-size: 1.1rem; letter-spacing: .02em;
  display: inline-flex; align-items: center; gap: 8px;
}
.app-header .logo {
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--gold); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem;
}
.app-header button.icon {
  background: none; border: 0; color: var(--ivory);
  width: 40px; height: 40px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}

/* ---------- Bottom navigation ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: repeat(5, 1fr);
  z-index: 15;
  box-shadow: 0 -4px 20px -12px rgba(14,18,24,.15);
}
.bottom-nav button {
  background: none; border: 0;
  padding: 6px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--grey);
  font-size: .68rem;
  cursor: pointer;
  min-height: var(--tap);
  transition: color .15s ease;
}
.bottom-nav button svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 1.7; fill: none; }
.bottom-nav button.active { color: var(--gold-text); font-weight: 600; }
.bottom-nav button:active { color: var(--gold-deep); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 14px 22px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  cursor: pointer;
  font-weight: 600; font-size: 1rem;
  min-height: var(--tap);
  transition: background .15s ease, transform .1s ease, box-shadow .15s ease;
  text-decoration: none;
}
.btn-primary { background: var(--gold); color: var(--ink); }
.btn-primary:active { background: var(--gold-deep); transform: translateY(1px); }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-secondary:active { background: var(--gold-soft); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:active { background: #000; }
.btn-danger { background: var(--err-bg); color: var(--err); border-color: var(--err); }
.btn-block { display: flex; width: 100%; }
.btn-sm { padding: 8px 14px; font-size: .9rem; min-height: 36px; }

/* ---------- Cards ---------- */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.card h2 { margin-top: 0; }
.card.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.card.dark h2, .card.dark h3 { color: #fff; }

/* ---------- Home tiles ---------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.tile {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 14px;
  cursor: pointer;
  text-align: left;
  color: var(--ink);
  font: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform .1s ease, box-shadow .15s ease;
  display: flex; flex-direction: column; gap: 6px;
  min-height: 110px;
}
.tile:active { transform: translateY(1px); box-shadow: var(--shadow-md); }
.tile .icon-box {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--gold-soft); color: var(--gold-deep);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 6px;
}
.tile .icon-box svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2; fill: none; }
.tile h3 { margin: 0; font-size: 1rem; }
.tile p { margin: 0; font-size: .82rem; color: var(--grey); }

/* Hero (Domů) */
.hero {
  background: linear-gradient(135deg, var(--ink) 0%, #1a2334 100%);
  color: var(--ivory);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  margin-bottom: 16px;
}
.hero .badge { display: inline-block; font-size: .72rem; background: var(--gold); color: var(--ink); padding: 3px 10px; border-radius: 999px; font-weight: 600; letter-spacing: .04em; }
.hero h2 { color: #fff; margin: 10px 0 4px; }
.hero .count-big { font-size: 2.2rem; color: var(--gold); font-weight: 700; }
.hero .count-desc { font-size: .85rem; color: #c8c8c8; }
.hero .row { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; }

/* ---------- Forms / options ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: 10px;
  font: inherit; color: var(--ink);
  background: #fff; min-height: var(--tap);
}
.field textarea { min-height: 100px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184,153,104,.18);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px;
  border: 1.5px solid var(--line); background: #fff;
  font-size: .85rem; font-weight: 500;
  cursor: pointer; user-select: none;
  min-height: 40px;
  transition: all .15s ease;
}
.chip:active { transform: scale(.97); }
.chip.active { background: var(--gold); color: var(--ink); border-color: var(--gold); font-weight: 600; }
.chip .count { background: rgba(0,0,0,.08); border-radius: 999px; padding: 2px 8px; font-size: .72rem; }
.chip.active .count { background: rgba(14,18,24,.15); }

/* ---------- Test / question ---------- */
.qmeta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; color: var(--grey); font-size: .85rem; }
.qmeta .timer { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.qmeta .timer.warn { color: var(--warn); }
.qmeta .timer.critical { color: var(--err); }

.question-text {
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--ink);
  margin-bottom: 18px;
  font-weight: 500;
}

.options { display: flex; flex-direction: column; gap: 10px; }
.opt {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px;
  border: 2px solid var(--line);
  background: #fff;
  border-radius: 12px;
  cursor: pointer;
  min-height: var(--tap);
  transition: all .15s ease;
  font: inherit; color: var(--ink);
  text-align: left;
}
.opt:active { transform: scale(.99); }
.opt .letter {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg); color: var(--grey);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem;
  flex: 0 0 28px;
}
.opt .text { flex: 1; }
.opt.selected { border-color: var(--gold); background: var(--gold-soft); }
.opt.selected .letter { background: var(--gold); color: var(--ink); }
.opt.correct { border-color: var(--ok); background: var(--ok-bg); }
.opt.correct .letter { background: var(--ok); color: #fff; }
.opt.incorrect { border-color: var(--err); background: var(--err-bg); }
.opt.incorrect .letter { background: var(--err); color: #fff; }

.progress {
  width: 100%; height: 6px;
  background: var(--line); border-radius: 3px;
  margin-bottom: 14px; overflow: hidden;
}
.progress .bar { height: 100%; background: var(--gold); transition: width .3s ease; }

/* ---------- Results / verdict ---------- */
.verdict {
  padding: 22px;
  border-radius: var(--radius-lg);
  text-align: center;
  margin-bottom: 18px;
}
.verdict.ok { background: var(--ok-bg); color: var(--ok); border: 2px solid var(--ok); }
.verdict.fail { background: var(--err-bg); color: var(--err); border: 2px solid var(--err); }
.verdict .big { font-size: 2.4rem; font-weight: 700; display: block; margin-bottom: 4px; }
.verdict .label { font-size: 1.2rem; font-weight: 600; }

.criteria-list { display: flex; flex-direction: column; gap: 8px; }
.criteria-list .row {
  display: grid; grid-template-columns: 24px 1fr 90px;
  align-items: center; gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.criteria-list .row.fail { border-color: var(--err); background: var(--err-bg); }
.criteria-list .row.pass { border-color: var(--ok); background: var(--ok-bg); }
.criteria-list .row .k { font-weight: 700; }
.criteria-list .row .n { color: var(--grey); font-size: .85rem; }
.criteria-list .row .pct { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Flashcards ---------- */
.fc-badge {
  display: inline-block; font-size: .68rem;
  padding: 3px 9px; border-radius: 999px;
  font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; margin-bottom: 10px;
}
.fc-badge.ustni { background: var(--info-bg); color: var(--info); }
.fc-badge.situace1, .fc-badge.situace2, .fc-badge.situace3, .fc-badge.situace4 { background: var(--gold-soft); color: var(--gold-text); }
.fc-badge.etika { background: #fff2f2; color: #a63b52; }
.fc-badge.dokumentace { background: #e8ebef; color: #3f4b5f; }
.fc-badge.foto { background: var(--ok-bg); color: var(--ok); }

.fc-answer-bar {
  border-left: 4px solid var(--gold);
  padding: 12px 14px;
  background: var(--gold-soft);
  border-radius: 0 8px 8px 0;
  margin: 12px 0;
}
.fc-answer-bar.vlastni { border-left-color: var(--warn); background: var(--warn-bg); }
.fc-answer-bar.warning { border-left-color: var(--info); background: var(--info-bg); }
.fc-source-label {
  display: inline-block; font-size: .72rem;
  padding: 2px 8px; border-radius: 4px;
  background: var(--gold); color: var(--ink);
  font-weight: 600; margin-bottom: 8px;
}
.fc-source-label.vlastni { background: var(--warn); color: #fff; }

.fc-warn-in-answer {
  background: var(--warn-bg);
  border: 1px solid var(--warn);
  color: var(--warn);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: .85rem;
  margin-bottom: 10px;
}

.fc-photo, .fc-pdf-link {
  display: block;
  width: 100%;
  border-radius: 12px;
  margin: 10px 0;
  cursor: zoom-in;
}
.fc-photo { border: 1px solid var(--line); background: #fff; }
.fc-pdf-link {
  padding: 14px;
  border: 1.5px solid var(--gold);
  background: var(--gold-soft);
  color: var(--ink);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

/* Modal (fotka na fullscreen, PDF viewer) */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.92);
  z-index: 100;
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px;
  color: #fff;
}
.modal-header .title { font-weight: 600; font-size: .95rem; }
.modal-header .close {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,.15); color: #fff;
  border: 0; font-size: 1.3rem; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.modal-body { flex: 1; overflow: auto; display: flex; align-items: center; justify-content: center; }
.modal-body img { max-width: 100%; max-height: 100%; object-fit: contain; touch-action: pinch-zoom; }
.modal-body canvas { display: block; margin: 8px auto; box-shadow: 0 2px 10px rgba(0,0,0,.4); }

/* ---------- Feedback (procvičování) ---------- */
.feedback-ok, .feedback-err {
  padding: 14px 16px;
  border-radius: 12px;
  margin-top: 12px;
  border-width: 2px; border-style: solid;
  display: flex; gap: 10px; align-items: flex-start;
}
.feedback-ok { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.feedback-err { background: var(--err-bg); border-color: var(--err); color: var(--err); }
.feedback-ok strong, .feedback-err strong { display: block; }

/* ---------- Utility ---------- */
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.text-grey { color: var(--grey); }
.text-sm { font-size: .85rem; }
.text-lg { font-size: 1.15rem; }
.center { text-align: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.hidden { display: none !important; }
.muted { color: var(--grey); }

/* Bar chart pro statistiky */
.stat-bar { display: grid; grid-template-columns: 40px 1fr 60px; gap: 8px; align-items: center; margin-bottom: 4px; font-size: .85rem; }
.stat-bar .bar-container { background: var(--bg); border-radius: 999px; height: 20px; overflow: hidden; }
.stat-bar .bar-fill { height: 100%; border-radius: 999px; background: var(--gold); transition: width .3s ease; }
.stat-bar .bar-fill.err { background: var(--err); }
.stat-bar .bar-fill.ok { background: var(--ok); }
.stat-bar .val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* Tabulka historie */
.history-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  margin-bottom: 8px;
}
.history-item .date { color: var(--grey); font-size: .85rem; }
.history-item .score { font-weight: 700; font-variant-numeric: tabular-nums; }
.history-item.pass { border-left: 4px solid var(--ok); }
.history-item.fail { border-left: 4px solid var(--err); }

/* ---------- Overview (list otázek) ---------- */
.q-list { display: flex; flex-direction: column; gap: 8px; }
.q-item {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.q-item .head { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.q-item .id { font-size: .72rem; color: var(--grey-2); font-variant-numeric: tabular-nums; }
.q-item .k-badge { font-size: .68rem; background: var(--bg); color: var(--gold-text); padding: 2px 7px; border-radius: 4px; font-weight: 600; text-transform: uppercase; }
.q-item .stat-mini { font-size: .72rem; color: var(--grey); margin-left: auto; }
.q-item .q { font-weight: 500; font-size: .95rem; margin-bottom: 8px; }
.q-item .a { padding: 6px 10px; border-radius: 6px; font-size: .88rem; margin-bottom: 4px; background: var(--bg); }
.q-item .a.correct { background: var(--ok-bg); color: var(--ok); font-weight: 600; }
