/* Direction "Tržnice": pale sage ground, white soft cards, one colour per exam area. No purple. */
:root {
  --bg: #e6efe7; --ink: #16302a; --muted: #56706a; --card: #ffffff; --line: #d3dfd6; --track: #cfdcd1;
  --ok: #1f8a55; --ok-soft: #e3f4ea; --bad: #d2452f; --bad-soft: #fbe7e3; --warn-soft: #fbe3b8;
  --ac: #16302a; --ac-soft: #f3f7f4; --ac-ink: #16302a;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Figtree", "Segoe UI", system-ui, sans-serif;
}
.a-zakladni-ziviny   { --ac: #e08a12; --ac-soft: #fdf0d9; --ac-ink: #7a4700; }
.a-telo-metabolismus { --ac: #e2603f; --ac-soft: #fde9e3; --ac-ink: #8f2c12; }
.a-potraviny         { --ac: #3f9a4d; --ac-soft: #e4f3e6; --ac-ink: #1f5c2a; }
.a-specificke-skupiny{ --ac: #1f97a0; --ac-soft: #dff2f3; --ac-ink: #0f5a60; }
.a-nemoci            { --ac: #3b78c9; --ac-soft: #e4edfa; --ac-ink: #1f477f; }
.a-prace-s-klientem  { --ac: #5c6f7b; --ac-soft: #e8edf0; --ac-ink: #33434d; }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 400 17px/1.5 var(--body); -webkit-text-size-adjust: 100%; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
[hidden] { display: none !important; }

#app {
  max-width: 540px; min-height: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 16px;
  padding: calc(16px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px))
           calc(16px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
h1, h2 { font-family: var(--display); font-weight: 800; line-height: 1.15; margin: 0; text-wrap: balance; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.35rem; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.spacer { flex: 1; }

.btn { min-height: 54px; padding: 10px 18px; border-radius: 16px; font-weight: 700; display: flex; flex-direction: column;
  align-items: center; justify-content: center; line-height: 1.2; text-align: center; }
.btn small { font-weight: 400; font-size: .78rem; opacity: .8; }
.btn.primary { background: var(--ink); color: #fff; }
.btn.ghost { background: var(--card); border: 2px solid var(--line); }
.btn.big { min-height: 76px; font-size: 1.25rem; font-family: var(--display); border-radius: 22px; }
.btn:disabled { opacity: .45; cursor: default; }
.link { text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }

.panel { background: var(--card); border-radius: 22px; padding: 18px; box-shadow: 0 6px 18px rgba(22, 48, 42, .08); }
.field { width: 100%; min-height: 54px; padding: 10px 14px; border-radius: 14px; border: 2px solid var(--line); background: #fff; }
.error { color: var(--bad); font-weight: 600; }

/* home */
.switch { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.switch input { width: 22px; height: 22px; accent-color: var(--ink); margin: 0; }
.areas { display: flex; flex-direction: column; gap: 8px; }
.area { width: 100%; text-align: left; background: var(--card); border-radius: 16px; padding: 12px 14px; display: grid;
  grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: center; }
.area .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--ac); }
.area .name { font-weight: 700; min-width: 0; }
.area .num { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .9rem; }
.meter { grid-column: 1 / -1; position: relative; height: 8px; border-radius: 4px; background: var(--track); }
.meter i { display: block; height: 100%; border-radius: 4px; background: var(--ac); }
.meter::after { content: ""; position: absolute; left: 80%; top: -3px; bottom: -3px; width: 2px; background: var(--ink); }

/* study */
.top { display: flex; align-items: center; gap: 10px; }
.close { width: 44px; height: 44px; border-radius: 50%; background: var(--card); font-size: 1.2rem; flex: none; }
.chip { background: var(--ac-soft); color: var(--ac-ink); font-weight: 700; padding: 5px 12px; border-radius: 999px; font-size: .88rem;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.left { margin-left: auto; font-variant-numeric: tabular-nums; font-size: .88rem; color: var(--muted); white-space: nowrap; }
.card { flex: 1; background: var(--card); border-radius: 22px; padding: 20px; box-shadow: 0 6px 18px rgba(22, 48, 42, .10);
  display: flex; flex-direction: column; gap: 16px; border-top: 6px solid var(--ac); }
.kind { color: var(--ac-ink); font-weight: 700; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; }
.q { font-family: var(--display); font-weight: 800; font-size: 1.4rem; line-height: 1.22; margin: 0; text-wrap: balance; }
.answer { background: var(--ac-soft); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.answer .main { font-weight: 700; font-size: 1.15rem; line-height: 1.35; }
.src { font-size: .8rem; color: var(--muted); margin-top: auto; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt { display: flex; gap: 12px; align-items: center; text-align: left; width: 100%; padding: 12px 14px; border-radius: 14px;
  border: 2px solid var(--line); font-weight: 600; background: #fff; }
.opt b { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; font-size: .85rem; }
.opt.ok { border-color: var(--ok); background: var(--ok-soft); }
.opt.bad { border-color: var(--bad); background: var(--bad-soft); }
.opt.sel { border-color: var(--ink); }
.why { background: var(--ok-soft); border-radius: 14px; padding: 12px 14px; }
.note { background: var(--warn-soft); border-radius: 14px; padding: 12px 14px; font-size: .92rem; }
.pts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pts label { display: flex; gap: 10px; align-items: flex-start; background: var(--ac-soft); border-radius: 12px; padding: 10px 12px; cursor: pointer; }
.pts input { width: 22px; height: 22px; flex: none; margin: 1px 0 0; accent-color: var(--ok); }
.actions { display: flex; gap: 8px; position: sticky; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
.actions .btn { flex: 1; min-width: 0; padding-inline: 6px; }
.r0 { background: #f6d5cf; } .r1 { background: var(--warn-soft); } .r2 { background: #c9ead7; }

/* diagrams */
.dg-root { font-weight: 700; text-align: center; }
.dg-tree { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.dg-tree > div { background: #fff; border-radius: 12px; padding: 10px; border-top: 4px solid var(--ac); min-width: 0; }
.dg-tree b { display: block; overflow-wrap: anywhere; }
.dg-tree small { display: block; color: var(--ac-ink); font-weight: 600; }
.dg-tree ul { margin: 6px 0 0; padding-left: 18px; font-size: .9rem; }
.dg-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 22px; counter-reset: s; }
.dg-steps li { background: #fff; border-radius: 12px; padding: 10px 12px 10px 44px; position: relative; counter-increment: s; }
.dg-steps li::before { content: counter(s); position: absolute; left: 10px; top: 10px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--ac); color: #fff; font-weight: 700; font-size: .85rem; display: grid; place-items: center; }
.dg-steps li + li::after { content: "↓"; position: absolute; left: 50%; top: -23px; color: var(--ac-ink); font-weight: 700; }
.dg-steps b, .dg-steps span { display: block; }
.dg-steps span { font-size: .9rem; }
.dg-scroll { overflow-x: auto; }
.dg-table { border-collapse: collapse; width: 100%; background: #fff; border-radius: 12px; overflow: hidden; font-size: .92rem; }
.dg-table th, .dg-table td { padding: 8px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.dg-table th { color: var(--ac-ink); }
.dg-table tr:last-child td { border-bottom: 0; }
.dg-ranges { display: flex; gap: 4px; }
.dg-ranges > div { flex: 1; min-width: 0; background: #fff; border-radius: 10px; padding: 8px 6px; text-align: center; border-bottom: 5px solid var(--ac); }
.dg-ranges b { display: block; font-size: .95rem; font-variant-numeric: tabular-nums; }
.dg-ranges span { display: block; font-size: .8rem; overflow-wrap: anywhere; }
.dg-unit { text-align: right; font-size: .8rem; color: var(--muted); }

/* test result */
.score { font-family: var(--display); font-weight: 800; font-size: 2.6rem; line-height: 1; font-variant-numeric: tabular-nums; }
.miss { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.miss:first-of-type { border-top: 0; padding-top: 0; }

@media (prefers-reduced-motion: no-preference) {
  .card { animation: in .18s ease-out; }
  @keyframes in { from { transform: translateY(6px); opacity: .6; } to { transform: none; opacity: 1; } }
}
