:root {
  /* Brand palette — MŠ Prúdy dizajnmanuál */
  --prudy-blue: #2043d9;
  --prudy-yellow: #ffbb33;
  --prudy-brown: #4c280f;
  --prudy-orange: #ff7733;
  --ink: #000000;
  --paper: #ffffff;

  /* Derived warm neutrals */
  --bg: #fbf7f0;
  --bg-tint: #f4eee3;
  --card: #ffffff;
  --line: #e7ddcb;
  --line-strong: #d8ccb4;
  --muted: #7c715f;
  --muted-soft: #a99e8c;

  --font: "Loyola Next", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 28px;

  --accent: var(--prudy-blue);
  --accent-soft: color-mix(in oklab, var(--prudy-blue) 12%, white);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  overflow-x: clip;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ---------- App shell ---------- */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 40px);
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in oklab, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__logo { height: 38px; width: auto; display: block; }
.topbar__right {
  display: flex; align-items: center; gap: 14px;
  font-size: 13px; color: var(--muted);
}
.topbar__save {
  display: inline-flex; align-items: center; gap: 6px;
}
.dot-save {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--prudy-orange);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--prudy-orange) 22%, transparent);
}

/* ---------- Progress rail ---------- */
.progress {
  display: flex;
  gap: 6px;
  padding: 0 clamp(16px, 4vw, 40px);
  max-width: 860px;
  width: 100%;
  margin: 22px auto 0;
}
.progress__seg {
  flex: 1;
  height: 7px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
  position: relative;
}
.progress__seg > span {
  position: absolute; inset: 0;
  background: var(--accent);
  transform-origin: left;
  transition: transform .45s cubic-bezier(.4,0,.1,1);
}

/* ---------- Step canvas ---------- */
.stage {
  flex: 1;
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: clamp(20px, 3vw, 38px) clamp(16px, 4vw, 40px) 140px;
  position: relative;
}
.stage-frame { position: relative; }
.step-card {
  position: relative;
  z-index: 1;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(24px, 4vw, 44px) clamp(20px, 3.5vw, 46px) clamp(30px, 4vw, 46px);
  box-shadow: 0 26px 64px -36px rgba(60,40,12,.30);
}
.step-head { margin: 14px 0 26px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 13px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}
.eyebrow .pip {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: white;
  font-size: 13px; letter-spacing: 0;
}
.step-head h1 {
  font-weight: 700;
  font-size: clamp(30px, 5.4vw, 46px);
  line-height: 1.08;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.step-head p {
  margin: 0;
  font-size: 17px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 54ch;
}

/* ---------- Fields ---------- */
.fieldset { display: grid; gap: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }
@media (max-width: 620px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
.col-span { grid-column: 1 / -1; }

.field { display: grid; gap: 8px; }
.field > label {
  font-size: 14px; font-weight: 700;
  color: var(--ink);
  display: flex; align-items: baseline; gap: 8px;
}
.field .req { color: var(--prudy-orange); font-weight: 700; }
.field .hint { font-size: 12.5px; color: var(--muted-soft); font-weight: 400; }

.control {
  appearance: none;
  width: 100%;
  border: 1.5px solid var(--line-strong);
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 14px 15px;
  font-size: 16px;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.control::placeholder { color: var(--muted-soft); }
.control:hover { border-color: color-mix(in oklab, var(--accent) 40%, var(--line-strong)); }
.control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 18%, transparent);
}
textarea.control { min-height: 120px; resize: vertical; line-height: 1.5; }
.control.invalid { border-color: var(--prudy-orange); }
.err {
  font-size: 12.5px; color: color-mix(in oklab, var(--prudy-orange) 86%, black);
  font-weight: 700;
}

/* PSČ boxed input */
.psc { display: flex; gap: 7px; }
.psc input {
  width: 44px; text-align: center; padding: 12px 0;
  font-size: 18px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---------- Choice cards (radio / checkbox) ---------- */
.choices { display: grid; gap: 12px; }
.choices.row { grid-auto-flow: column; grid-auto-columns: 1fr; }
@media (max-width: 560px) { .choices.row { grid-auto-flow: row; } }
.choice {
  display: flex; align-items: center; gap: 13px;
  border: 1.5px solid var(--line-strong);
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 15px 16px;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
  user-select: none;
}
.choice:hover { border-color: color-mix(in oklab, var(--accent) 45%, var(--line-strong)); }
.choice:active { transform: translateY(1px); }
.choice.sel {
  border-color: var(--accent);
  background: color-mix(in oklab, var(--accent) 8%, white);
}
.choice__mark {
  flex: none;
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  display: grid; place-items: center;
  transition: border-color .15s, background .15s;
}
.choice.box .choice__mark { border-radius: 7px; }
.choice.sel .choice__mark {
  border-color: var(--accent);
  background: var(--accent);
}
.choice.sel .choice__mark svg { opacity: 1; transform: scale(1); }
.choice__mark svg { opacity: 0; transform: scale(.5); transition: .15s; color: white; }
.choice__body { display: grid; gap: 2px; }
.choice__body b { font-size: 15.5px; font-weight: 700; }
.choice__body small { font-size: 13px; color: var(--muted); }

/* ---------- Toggle row ---------- */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  background: color-mix(in oklab, var(--bg-tint) 50%, white);
}
.toggle-row .tr__txt b { display: block; font-size: 15.5px; }
.toggle-row .tr__txt small { font-size: 13px; color: var(--muted); }
.switch {
  flex: none; width: 52px; height: 30px; border-radius: 99px;
  border: none; background: var(--line-strong); position: relative;
  transition: background .18s;
}
.switch.on { background: var(--accent); }
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; border-radius: 50%; background: white;
  transition: transform .18s; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch.on::after { transform: translateX(22px); }

/* ---------- Footer nav ---------- */
.navbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px;
  padding: 16px clamp(16px, 4vw, 40px);
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.navbar__inner {
  width: 100%; max-width: 760px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.btn {
  border: none; border-radius: 99px;
  padding: 15px 26px; font-size: 16px; font-weight: 700;
  transition: transform .1s, background .15s, box-shadow .15s, opacity .15s;
  display: inline-flex; align-items: center; gap: 9px;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--accent); color: white;
  box-shadow: 0 8px 22px -10px color-mix(in oklab, var(--accent) 80%, black);
}
.btn--primary:hover { background: color-mix(in oklab, var(--accent) 88%, black); }
.btn--ghost { background: transparent; color: var(--muted); padding-left: 12px; padding-right: 18px; }
.btn--ghost:hover { color: var(--ink); }
.btn--soft {
  background: var(--card); color: var(--ink);
  border: 1.5px solid var(--line-strong);
}
.btn--soft:hover { border-color: var(--accent); }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btn--big { padding: 17px 34px; font-size: 17px; }
.btn--reset {
  display: inline-flex; margin: 14px auto 0; font-size: 14px; font-weight: 600;
  background: transparent; color: var(--muted); padding: 8px 16px;
}
.btn--reset:hover { color: var(--prudy-orange); }
.btn--reset svg { opacity: .8; }

.submit-msg {
  margin: 14px auto 0; max-width: 520px; font-size: 14.5px; font-weight: 600;
  padding: 11px 16px; border-radius: 12px; line-height: 1.4;
}
.submit-msg.ok   { background: color-mix(in oklab, #34c759 16%, white); color: #1c7a36; }
.submit-msg.warn { background: color-mix(in oklab, var(--prudy-orange) 18%, white); color: #9a4a12; }
.submit-msg.err  { background: color-mix(in oklab, #ff3b30 14%, white); color: #b3261e; }

.muted-note { margin: 10px auto 0; max-width: 460px; font-size: 12.5px; color: var(--muted); line-height: 1.45; }

.done__back { position: absolute; top: 0; left: 0; margin: 0; font-size: 14px; }

.step-count { font-size: 13px; color: var(--muted); font-weight: 700; }

/* ---------- Intro screen ---------- */
.intro { text-align: left; position: relative; }
.intro__hero {
  position: relative;
  z-index: 1;
  border-radius: var(--radius-lg);
  background: var(--card);
  border: 1.5px solid var(--line);
  padding: clamp(26px, 4vw, 44px);
  overflow: hidden;
}
.intro__logo { height: 104px; width: auto; display: block; margin: 4px auto 30px; }
.intro h1 {
  font-size: clamp(34px, 6vw, 56px); font-weight: 700;
  line-height: 1.04; margin: 0 0 16px; letter-spacing: -0.02em;
  text-wrap: balance;
}
.intro h1 em { font-style: normal; color: var(--accent); }
.intro__lead { font-size: 18px; line-height: 1.55; color: var(--muted); max-width: 50ch; margin: 0 0 28px; }
.checklist { display: grid; gap: 14px; margin: 0 0 30px; padding: 0; list-style: none; }
.checklist li { display: flex; gap: 13px; align-items: flex-start; font-size: 15.5px; line-height: 1.45; }
.checklist .ic {
  flex: none; width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center; color: white; font-weight: 700;
}
.meta-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; width: 100%; margin-top: 20px; color: var(--muted); font-size: 14px; }
.meta-row b { color: var(--ink); }
.intro__sep { height: 1.5px; background: var(--line); width: 100%; margin-top: 26px; border-radius: 2px; }

/* ---------- Review ---------- */
.review-group {
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  margin-bottom: 16px;
  overflow: hidden;
}
.review-group__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; gap: 12px;
  background: color-mix(in oklab, var(--bg-tint) 55%, white);
  border-bottom: 1.5px solid var(--line);
}
.review-group__head h3 { margin: 0; font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.review-group__head .tag { width: 12px; height: 12px; border-radius: 4px; }
.edit-link {
  background: none; border: none; color: var(--accent);
  font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; gap: 6px;
}
.edit-link:hover { text-decoration: underline; }
.review-rows { padding: 8px 20px 14px; }
.review-rows .rr {
  display: grid; grid-template-columns: minmax(150px, 38%) 1fr; gap: 14px;
  padding: 9px 0; border-bottom: 1px dashed var(--line); align-items: baseline;
}
.review-rows .rr:last-child { border-bottom: none; }
.review-rows .rr dt { font-size: 13.5px; color: var(--muted); }
.review-rows .rr dd { margin: 0; font-size: 15px; font-weight: 700; word-break: break-word; }
.review-rows .rr dd.empty { color: var(--muted-soft); font-weight: 400; font-style: italic; }

/* ---------- Done screen ---------- */
.done { text-align: center; padding-top: 10px; }
.done__badge {
  width: 96px; height: 96px; margin: 0 auto 26px;
  border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in oklab, var(--prudy-blue) 12%, white);
  color: var(--prudy-blue);
}
.done h1 { font-size: clamp(32px, 5.5vw, 48px); font-weight: 700; margin: 0 0 14px; }
.done p { font-size: 17px; color: var(--muted); line-height: 1.55; max-width: 46ch; margin: 0 auto 30px; }
.done__actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.note-card {
  margin: 34px auto 0; max-width: 560px; text-align: left;
  border: 1.5px solid var(--line); border-radius: var(--radius);
  background: var(--card); padding: 22px 24px;
}
.note-card h4 { margin: 0 0 12px; font-size: 15px; display: flex; align-items: center; gap: 9px; }
.note-card ol { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 14.5px; line-height: 1.45; color: var(--muted); }
.note-card ol b { color: var(--ink); }

/* ---------- Dekoratívne motívy v pozadí ---------- */
/* Fixed celoobrazovková vrstva — motívy vykúkajú spoza okrajov a spoza footera */
.art-layer {
  position: fixed; inset: 0; z-index: 0;
  overflow: hidden; pointer-events: none;
}
.art-piece {
  position: absolute;
  height: 200px;
  opacity: 0;
  animation: artIn 1.6s cubic-bezier(.2,.7,.2,1) forwards;
  will-change: transform, opacity;
}
.art-piece img { display: block; height: 100%; width: auto; }
@keyframes artIn {
  from { opacity: 0; transform: var(--art-from); }
  to   { opacity: var(--art-op, 1); transform: var(--art-to); }
}
/* na menších obrazovkách motívy stlmíme, na úzkych ich skryjeme úplne */
@media (max-width: 820px) { .art-layer { opacity: .55; } }
@media (max-width: 560px) { .art-layer { display: none; } }
/* obsah krokov nad dekoráciou */
.stage-frame { position: relative; z-index: 1; }
.stage-frame .intro,
.stage-frame .step-card,
.stage-frame .done { position: relative; z-index: 1; }

/* ---------- Datepicker ---------- */
.dp { position: relative; }
.dp__trigger {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; text-align: left; cursor: pointer;
}
.dp__trigger.open { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 18%, transparent); }
.dp__val { font-weight: 700; font-variant-numeric: tabular-nums; }
.dp__ph { color: var(--muted-soft); }
.dp__ic { color: var(--accent); flex: none; }

.dp__pop {
  position: fixed; z-index: 80;
  max-width: calc(100vw - 32px);
  background: var(--card);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: 0 22px 50px -18px rgba(40,28,12,.4);
  padding: 14px;
  animation: dpIn .16s cubic-bezier(.2,.7,.2,1);
}
@keyframes dpIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.dp__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.dp__nav {
  width: 38px; height: 38px; border-radius: 10px; border: none;
  background: var(--bg-tint); color: var(--ink); display: grid; place-items: center;
  transition: background .15s;
}
.dp__nav:hover { background: color-mix(in oklab, var(--accent) 16%, var(--bg-tint)); }
.dp__title {
  flex: 1; border: none; background: none; font-family: inherit;
  font-size: 16px; font-weight: 700; color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px; border-radius: 10px; transition: background .15s;
}
.dp__title:hover { background: var(--bg-tint); }
.dp__dow {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
  margin-bottom: 4px;
}
.dp__dow span {
  text-align: center; font-size: 12px; font-weight: 700;
  color: var(--muted-soft); padding: 4px 0;
}
.dp__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp__empty { aspect-ratio: 1; }
.dp__day {
  aspect-ratio: 1; border: none; background: none; border-radius: 10px;
  font-family: inherit; font-size: 14.5px; font-weight: 600; color: var(--ink);
  cursor: pointer; transition: background .12s, color .12s;
  font-variant-numeric: tabular-nums;
}
.dp__day:hover { background: var(--accent-soft); }
.dp__day.today { box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.dp__day.sel { background: var(--accent); color: #fff; }
.dp__foot {
  display: flex; justify-content: space-between; gap: 8px;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line);
}
.dp__todaybtn, .dp__clear {
  border: none; background: none; font-family: inherit; font-size: 13.5px;
  font-weight: 700; color: var(--accent); padding: 6px 10px; border-radius: 8px;
  transition: background .15s;
}
.dp__todaybtn:hover, .dp__clear:hover { background: var(--accent-soft); }
.dp__clear { color: var(--muted); }
.dp__years {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  max-height: 230px; overflow: auto; padding: 2px;
}
.dp__year {
  border: none; background: var(--bg-tint); font-family: inherit;
  font-size: 14px; font-weight: 700; color: var(--ink);
  padding: 11px 0; border-radius: 10px; cursor: pointer;
  font-variant-numeric: tabular-nums; transition: background .12s, color .12s;
}
.dp__year:hover { background: var(--accent-soft); }
.dp__year.sel { background: var(--accent); color: #fff; }

.fade-step { animation: fadeStep .4s cubic-bezier(.4,0,.1,1); }
@keyframes fadeStep { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
