/* Komponenty hry: struktura, formuláře a stavy. Sportovní typografie a rozložení v sport.css. */

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

body {
  font-family: var(--font-body);
  color: var(--ink);
  min-height: 100vh; min-height: 100dvh;
  background: var(--canvas);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  -webkit-font-smoothing: antialiased;
}

.app { width: 100%; max-width: 540px; }

.card {
  background: var(--paper);
  border: 1px solid var(--surface);
  border-radius: 4px;
  box-shadow: none;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ilustrační pásy */
.home-illus, .run-illus, .done-illus {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--surface-raised);
  overflow: hidden;
}
.home-illus svg, .run-illus svg, .done-illus svg {
  display: block;
  width: 100%;
  height: 100%;
}

.home-body, .run-body, .done-body { padding: 20px 24px 18px; }

/* --- tlačítka --- */
.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  border-radius: 4px;
  padding: 12px 18px;
  font-size: 17px;
  color: var(--ink);
  transition: transform .08s ease, box-shadow .08s ease, background .15s;
}
.btn:active { transform: translateY(3px); }
.btn:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; }
.btn-primary { background: var(--gold); box-shadow: none; }
.btn-primary:hover { background: var(--gold); }
.btn-primary:active { box-shadow: none; }
.btn-ghost { background: var(--surface); color: var(--ink); box-shadow: none; }
.btn-ghost:active { box-shadow: none; }
.btn-big { width: 100%; font-size: 20px; padding: 14px; }

/* --- úvod --- */
.home-title { font-weight: 700; font-size: 30px; margin: 0 0 4px; color: var(--gold-deep); }
.home-sub { font-size: 17px; font-weight: 700; color: var(--ink-soft); margin: 0 0 16px; }
.trening-card {
  border: 1px solid var(--paper-edge);
  border-radius: 4px;
  padding: 16px;
  background: var(--surface);
}
.trening-top {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 13px;
  color: var(--ink-soft);
}
.trening-loc { color: var(--grass); }
.trening-name { font-size: 24px; font-weight: 700; margin: 8px 0 2px; color: var(--ink); }
.trening-tag { margin: 0 0 14px; font-weight: 600; color: var(--ink-soft); }
.home-note { margin: 10px 0 0; font-size: 13px; color: var(--ink-soft); opacity: .8; }

/* filtr tréninků */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.chip {
  appearance: none; border: 1px solid var(--paper-edge); background: var(--surface); cursor: pointer;
  font-family: inherit; font-weight: 700; font-size: 14px; color: var(--ink-soft);
  padding: 7px 14px; border-radius: 4px; transition: background .12s, color .12s, border-color .12s;
}
.chip:hover { border-color: var(--gold); }
.chip-on { background: var(--gold); border-color: var(--gold-deep); color: var(--ink); }
.chip:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }

.trening-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.trening-card {
  display: block; width: 100%; text-align: left; cursor: pointer; font-family: inherit;
  transition: transform .08s ease, border-color .12s, box-shadow .12s;
}
.trening-card:hover { border-color: var(--gold); box-shadow: none; }
.trening-card:active { transform: translateY(2px); }
.trening-card:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }
.trening-card .trening-tag { margin-bottom: 0; }
.training-counter { margin: -6px 0 14px; color: var(--work-deep); font-size: 14px; font-weight: 700; }
.training-section-head { margin: 4px 0 9px; color: var(--gold-deep); font-size: 17px; font-weight: 700; }
.recommended-section { margin-bottom: 16px; }
.trening-card.trening-recommended { border: 1px solid var(--gold-deep); background: var(--accent-soft); }
.trening-labels { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0 0; }
.trening-labels span {
  border: 1px solid var(--paper-edge); border-radius: 3px; padding: 3px 7px;
  background: var(--paper); color: var(--ink-soft); font-size: 12px; font-weight: 700;
}

/* dnešní deterministické doporučení na Domů */
.recommend-context { display: grid; grid-template-columns: minmax(0, 1fr); align-items: end; gap: 8px; margin: 12px 0 9px; }
.recommend-context .chip { padding: 6px 4px; }
.recommend-box { padding: 14px; border: 1px solid var(--gold-deep); border-radius: 4px; background: var(--accent-soft); }
.recommend-kicker { margin: 0 0 3px; color: var(--work-deep); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.recommend-title { margin: 0 0 5px; color: var(--ink); font-size: 21px; font-weight: 700; }
.recommend-copy { margin: 0; color: var(--ink-soft); font-size: 14px; font-weight: 700; }
.recommend-note { margin: 7px 0 0; color: var(--work-deep); font-size: 13px; font-weight: 700; }
.recommend-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.recommend-box .recommend-buttons > .btn {
  display: flex; align-items: center; justify-content: center; margin: 0; min-width: 0;
  min-height: 44px; padding: 10px 12px; font-size: 15px; line-height: 1.4;
  text-align: center; text-decoration: none;
}
@media (min-width: 900px) {
  .recommend-context { grid-template-columns: minmax(0, 1fr) auto; gap: 16px; }
  .recommend-context .chip { padding: 6px 10px; }
  .recommend-buttons { grid-template-columns: repeat(2, max-content); }
}
.recommend-rest { border-color: var(--paper-edge); background: var(--surface); }
.recommend-rest p { margin: 0 0 10px; font-weight: 700; }
.recommend-match .recommend-title { font-size: 19px; }
.mission-training-recommended { border-color: var(--gold-deep); background: var(--accent-soft); }
.mission-training-recommended small { color: var(--work-deep); font-weight: 700; text-transform: uppercase; }

/* denní rutina (nepočítá se do tréninků) */
.daily-section { margin: 4px 0 14px; }
.daily-head { font-size: 16px; font-weight: 700; margin: 0 0 2px; color: var(--gold-deep); }
.daily-note { font-size: 12px; font-weight: 700; color: var(--ink-soft); margin: 0 0 10px; }
.daily-card { margin-bottom: 10px; border-style: dashed; }
.daily-card:last-child { margin-bottom: 0; }
.daily-done { border-style: solid; border-color: var(--grass); background: var(--success-soft); }
.daily-done .trening-loc { color: var(--work-deep); }
.daily-other .trening-loc { color: var(--ink-soft); }

/* trénink s týmem a zápas (zápis bez časovače) */
.team-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0 0 16px; }
.team-card {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px;
  border: 1px solid var(--paper-edge); border-radius: 4px; background: var(--surface);
  color: var(--ink); text-decoration: none; text-align: center; line-height: 1.25;
}
.team-card:hover { border-color: var(--gold); }
.team-card:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }
.team-ic { font-size: 28px; line-height: 1; }
/* vlastní SVG ikonky (shared/game/icons.js): velikost jako písmo kolem */
.ic { display: inline-block; width: 1em; height: 1em; vertical-align: -0.14em; }
.ic-person { width: 1.25em; height: 1.25em; vertical-align: -0.3em; }
.team-name { font-weight: 700; font-size: 16px; }
.team-sub { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
/* Další sport: pod tréninkem s týmem a zápasem přes celou šířku, ikonky vlevo a text vedle nich (nízká karta:
   průvodce hrou zvýrazní celý řádek karet a na malém telefonu se musí vejít nad bublinu) */
.team-card.team-card-wide {
  grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr; column-gap: 12px; row-gap: 2px;
  align-items: center; justify-items: start; text-align: left;
}
.team-card-wide .team-ic { grid-row: 1 / span 2; }
.sport-again .field-lbl { margin: 0 0 8px; } /* Jako minule v úterý: nad výběrem sportu */
.team-card-wide .sport-ics { display: grid; grid-template-columns: repeat(3, auto); gap: 2px 4px; font-size: 18px; line-height: 1.15; }
.ext-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 4px 0 12px; }
.ext-tab {
  padding: 10px 4px; border: 1px solid var(--paper-edge); border-radius: 4px; background: var(--surface);
  color: var(--ink-soft); font-size: 14px; font-weight: 700; text-align: center; text-decoration: none;
}
.ext-tab-on { border-color: var(--gold-deep); background: var(--accent-soft); color: var(--gold-deep); }
.ext-tab:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }
.external .home-sub { font-size: 15px; margin-bottom: 10px; }
.ext-total { margin: 0 0 4px; font-weight: 700; }
.ext-next { margin: 0 0 14px; font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.done .ext-next { margin: 4px 0 12px; }
.ext-form { display: flex; flex-direction: column; gap: 14px; padding: 12px 0 4px; }
.ext-chips { margin: 0; }
.ext-count { min-width: 44px; }
.ext-date { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14px; color: var(--ink-soft); }
.ext-date .praz-inp { flex: 1; min-width: 0; }
.ext-state { margin: 0; min-height: 22px; font-weight: 700; color: var(--gold-deep); }
.ext-log { margin-top: 12px; border-top: 1px solid var(--paper-edge); }
.ext-flash { margin: 0 0 8px; font-weight: 700; color: var(--work-deep); }
.ext-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ext-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--paper-edge); }
.ext-day { font-weight: 700; min-width: 76px; }
.ext-what { flex: 1; font-weight: 700; color: var(--ink-soft); }
.week-team { margin: 6px 0 10px; font-size: 14px; font-weight: 700; }
.week-cal { display: block; width: max-content; margin: -4px auto 12px; font-weight: 700; color: var(--gold-deep); text-decoration: none; border-bottom: 2px solid var(--paper-edge); }
.week-cal:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; border-radius: 4px; }
.stats-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* kalendář měsíce */
.cal-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 10px; }
.cal-month { margin: 0; font-size: 22px; font-weight: 700; color: var(--gold-deep); }
.cal-heading { flex: 1; min-width: 0; text-align: center; }
.cal-now { margin-top: 6px; max-width: 100%; white-space: normal; }
.cal-arrow { flex-shrink: 0; min-width: 48px; padding: 6px 14px; font-size: 22px; }
.cal-summary { margin: 0 0 12px; }
/* Co se povedlo za měsíc (XP, úroveň, dny v pohybu, nové rekordy) */
.cal-wins { margin: 0 0 12px; padding: 12px 14px; border: 1px solid var(--gold); border-radius: 6px; background: var(--accent-soft); text-align: center; }
.cal-wins-h { margin: 0 0 6px; font-size: 14px; font-weight: 700; color: var(--gold-deep); }
.cal-wins-list { margin: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; font-weight: 700; }
.cal-grid { display: flex; flex-direction: column; gap: 4px; }
.cal-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)) 18px; gap: 4px; }
.cal-head span { text-align: center; font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.cal-day {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-height: 52px; padding: 4px 1px; border: 1px solid var(--paper-edge); border-radius: 4px;
  background: var(--surface); color: var(--ink); font: inherit; cursor: pointer;
}
.cal-out { border: none; background: transparent; cursor: default; }
.cal-num { font-size: 12px; font-weight: 700; line-height: 1; color: var(--ink-soft); }
.cal-ics { display: flex; flex-wrap: wrap; justify-content: center; font-size: 13px; line-height: 1.15; }
.cal-ics sup { font-size: 9px; font-weight: 700; }
.cal-dot { position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--work-deep); }
.cal-dot-inline { position: static; display: inline-block; vertical-align: middle; }
.cal-train { border-color: var(--grass); background: var(--success-soft); }
.cal-team { border-color: var(--gold); background: var(--accent-soft); }
.cal-hol { background-image: repeating-linear-gradient(135deg, transparent 0 6px, rgba(90, 169, 230, .16) 6px 12px); }
.cal-camp { background-image: repeating-linear-gradient(135deg, transparent 0 6px, rgba(246, 166, 35, .22) 6px 12px); }
.cal-today { border-width: 3px; border-color: var(--coral); }
.cal-future .cal-num { opacity: .55; }
.cal-selected { outline: 3px solid var(--gold-deep); outline-offset: 1px; }
.cal-day:focus-visible { outline: 3px solid var(--coral); outline-offset: 1px; }
.cal-lvi { display: flex; align-items: center; justify-content: center; font-size: 13px; }
.cal-detail { min-height: 44px; margin: 12px 0 6px; font-weight: 700; line-height: 1.45; }
.cal-legend { margin: 6px 0 10px; }

/* --- průběh --- */
.run-head {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  color: var(--ink-soft);
  font-size: 14px;
}
.run-block { color: var(--gold-deep); }
.run-progress {
  height: 8px;
  background: var(--paper-edge);
  border-radius: 4px;
  margin: 10px 0 6px;
  overflow: hidden;
}
.run-progress-fill { height: 100%; width: 0; border-radius: 4px; transition: width .2s linear; }
.run-clock {
  font-size: 74px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  margin: 8px 0 2px;
  font-variant-numeric: tabular-nums;
}
.run-phase {
  text-align: center;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  font-size: 15px;
}
.run-name { text-align: center; font-size: 23px; font-weight: 700; margin: 6px 0 4px; }
.run-kid { text-align: center; font-size: 18px; font-weight: 700; margin: 0 0 6px; }
.run-cue { text-align: center; font-size: 15px; font-weight: 700; color: var(--ink-soft); margin: 0; min-height: 20px; }
.run-controls, .done-controls {
  display: flex;
  gap: 10px;
  padding: 4px 24px 22px;
  align-items: center;
  justify-content: center;
}
.run-controls .btn-primary { flex: 1; }

/* barvy fází — příprava (zlatá) / práce (zelená) / pauza (modrá) */
.run.phase-prep .run-clock { color: var(--gold-deep); }
.run.phase-prep .run-progress-fill { background: var(--gold); }
.run.phase-prep .run-illus { background: var(--accent-soft); }
.run.phase-prep .run-phase { color: var(--gold-deep); }
.run.phase-work .run-clock { color: var(--work-deep); }
.run.phase-work .run-progress-fill { background: var(--work); }
.run.phase-work .run-illus { background: var(--success-soft); }
.run.phase-work .run-phase { color: var(--work-deep); }
.run.phase-rest .run-clock { color: var(--rest-deep); }
.run.phase-rest .run-progress-fill { background: var(--rest); }
.run.phase-rest .run-illus { background: var(--accent-soft); }
.run.phase-rest .run-phase { color: var(--rest-deep); }
.run.phase-attempts .run-illus { background: var(--danger-soft); }
.run.phase-attempts .run-phase, .run.phase-record .run-phase { color: var(--gold-deep); }
.run.phase-record .run-illus { background: var(--accent-soft); }
.run.phase-attempts .run-progress-fill, .run.phase-record .run-progress-fill { background: var(--gold); }

/* pokusy: povedlo / nepovedlo */
.att-tally { text-align: center; font-size: 18px; font-weight: 700; margin: 10px 0 14px; }
.att-btns { display: flex; gap: 12px; }
.att-btns .btn { flex: 1; font-size: 19px; padding: 16px; color: var(--ink); }
.att-good { background: var(--grass); box-shadow: none; }
.att-good:active { box-shadow: none; }
.att-bad { background: var(--coral); box-shadow: none; }
.att-bad:active { box-shadow: none; }

/* Reserved space keeps fast taps steady; decoration never intercepts input. */
.attempt-feedback { position: relative; pointer-events: none; }
.kid-row-attempts { overflow: hidden; }
.attempt-cheer { min-height: 2.8em; margin: 8px 0 0; text-align: center; font-weight: 700; color: var(--work-deep); }
/* Extend the clipping box upward over the buttons, keeping its width contained. */
.attempt-burst { position: absolute; inset: -144px 0 -24px; overflow: hidden; pointer-events: none; }
.attempt-burst i {
  position: absolute; left: 50%; top: calc(50% + 60px); width: 7px; height: 7px;
  margin: -3.5px 0 0 -3.5px; background: var(--color); border-radius: 50%;
  animation: attempt-confetti 1.2s ease-out both;
}
.attempt-burst .attempt-streak { width: 4px; height: 13px; margin: -6.5px 0 0 -2px; border-radius: 2px; }
@keyframes attempt-confetti {
  from { transform: translate(0, 0) rotate(0) scale(.4); opacity: 0; }
  12% { opacity: 1; }
  45% { transform: translate(var(--x), var(--y)) rotate(var(--turn)) scale(1); opacity: 1; }
  to { transform: translate(var(--drift-x), var(--drift-y)) rotate(calc(var(--turn) + 80deg)) scale(.7); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .attempt-burst { display: none; }
  .attempt-burst i { animation: none; }
}

/* rekord: zadání čísla */
.rec-entry { display: flex; gap: 10px; margin: 10px 0 8px; }
.rec-input {
  flex: 1; font-family: inherit; font-size: 26px; font-weight: 700; text-align: center;
  border: 1px solid var(--paper-edge); border-radius: 4px; padding: 8px; color: var(--ink);
  -moz-appearance: textfield;
}
.rec-input:focus { outline: 3px solid var(--gold); outline-offset: 1px; border-color: var(--gold); }
.rec-input::-webkit-outer-spin-button, .rec-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.rec-info { text-align: center; font-weight: 700; color: var(--ink-soft); }

/* --- hotovo --- */
.done-body { text-align: center; }
.done-title { color: var(--coral); font-size: 30px; margin: 0 0 8px; }
.done-line { font-size: 18px; font-weight: 700; margin: 0 0 6px; }
.done-count { font-size: 16px; font-weight: 700; color: var(--ink-soft); margin: 0 0 14px; }

.error { padding: 24px; }
.error code { background: var(--paper-edge); padding: 1px 6px; border-radius: 6px; }

/* --- done: nové odznaky + Lví týden --- */
.done-lvi { font-size: 16px; font-weight: 700; color: var(--gold-deep); margin: 0 0 10px; }
.done-badges { margin: 4px 0 14px; }
.done-badges-title { font-weight: 700; color: var(--coral); margin: 0 0 8px; }
.badge-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* --- statistiky --- */
.stats-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px 10px; border-bottom: 2px solid var(--paper-edge);
}
.stats-title { font-size: 24px; font-weight: 700; color: var(--gold-deep); margin: 0; }
.btn-back { padding: 8px 14px; font-size: 15px; }
.stats-body { padding: 8px 20px 22px; }
.stat-block { padding: 14px 0; border-bottom: 1px solid var(--paper-edge); }
.stat-block:last-child { border-bottom: none; }
.stat-h { font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-soft); margin: 0 0 10px; }
.muted { color: var(--ink-soft); opacity: .8; font-weight: 700; }

.big-count { text-align: center; margin-bottom: 12px; }
.big-num { display: block; font-size: 56px; font-weight: 700; line-height: 1; color: var(--gold-deep); }
.big-lbl { font-weight: 700; color: var(--ink-soft); }
.mini-counts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.mini-counts span {
  background: var(--surface); border: 1px solid var(--paper-edge); border-radius: 4px;
  padding: 6px 12px; font-weight: 700; font-size: 14px;
}

.week-dots { display: flex; justify-content: space-between; gap: 4px; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 5px; flex: 1; }
.wd-lbl { font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.wd-dot {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--paper-edge); border: 1px solid var(--paper-edge);
  display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.wd-on .wd-dot { background: var(--grass); border-color: var(--work-deep); }
.wd-team .wd-dot { background: var(--accent-soft); border-color: var(--rest-deep); }
.wd-multi .wd-dot { font-size: 12px; letter-spacing: -2px; }
.wd-today .wd-dot { border-color: var(--coral); border-width: 3px; }
.week-legend { text-align: center; margin: 8px 0 0; font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.wd-today .wd-lbl { color: var(--coral); }
.week-cap { text-align: center; font-weight: 700; margin: 12px 0 0; }

.recs { display: flex; flex-direction: column; gap: 6px; }
.rec { display: flex; justify-content: space-between; font-weight: 700; }
.rec-val { color: var(--gold-deep); font-weight: 700; }

.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.badge {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  padding: 10px 6px; border-radius: 4px; border: 1px solid var(--paper-edge); background: var(--surface);
}
.badge-ic { font-size: 26px; line-height: 1; }
.badge-name { font-size: 11px; font-weight: 700; line-height: 1.15; }
.badge-earned { border-color: var(--gold); background: var(--reward-soft); }
/* šeď jen na obsah, ne na celý rámeček: filter/opacity na otáčené ploše
   ve 3D (preserve-3d) rozbíjí backface-visibility v některých prohlížečích */
.badge-locked { background: var(--surface); }
.badge-locked .badge-ic, .badge-locked .badge-name { filter: grayscale(1); opacity: .5; }
.badge-new { border-color: var(--coral); background: var(--danger-soft); animation: pop .4s ease; }
@keyframes pop { 0% { transform: scale(.6); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .badge-new { animation: none; } .badge-inner { transition: none; } }

/* --- odznaky: otáčení (klik = za co je) --- */
.badge-hint { font-size: 13px; margin: -2px 0 8px; }
/* výška se musí propsat celým řetězem buňka → flip → inner → plocha,
   jinak by rub a líc (a sousedé v řádku) měly různou výšku */
.badge-cell { display: flex; }
.badge-flip { width: 100%; height: 100%; perspective: 700px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.badge-flip:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; border-radius: 4px; }
.badge-inner {
  position: relative; display: grid; width: 100%; height: 100%;
  transform-style: preserve-3d; transition: transform .45s cubic-bezier(.2,.7,.3,1);
}
.badge-inner > .badge-face {
  grid-area: 1 / 1; height: 100%; box-sizing: border-box;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.badge-flip.flipped .badge-inner { transform: rotateY(180deg); }
.badge-rear { transform: rotateY(180deg); justify-content: center; gap: 5px; background: var(--surface); }
.badge-rear-earned { border-color: var(--gold); background: var(--reward-soft); }
.br-status { font-size: 10px; font-weight: 700; line-height: 1.1; }
.br-desc { font-size: 10px; font-weight: 700; line-height: 1.25; color: var(--ink-soft); }

/* odznak/výzva, za kterou se v Lvím srdci odemyká bonusová pohádka: knížka v rohu
   (na nezískaném odznaku zůstává barevná — ať je vidět, že za ním čeká pohádka) */
.badge { position: relative; }
.badge-book {
  position: absolute; top: 3px; right: 4px;
  font-size: 14px; line-height: 1; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .18));
}
.vyzva { position: relative; }
.vyzva-book {
  position: absolute; top: -9px; right: -7px;
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; line-height: 1; background: var(--reward-soft); border: 1px solid var(--gold);
}
.done-pohadka { font-size: 15px; font-weight: 700; color: var(--gold-deep); margin: 10px 0 0; }

/* --- editor prázdnin --- */
.week-cap + .btn-back { margin-top: 12px; }
.praz-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.praz-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--surface); border: 1px solid var(--paper-edge); border-radius: 4px; padding: 10px 12px;
}
.praz-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.praz-name { font-weight: 700; }
.praz-dates { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.praz-ops { display: flex; gap: 6px; flex: 0 0 auto; }
.praz-mini { padding: 6px 10px; font-size: 13px; }
.praz-del { color: var(--coral); }
.praz-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.praz-inp {
  font-family: inherit; font-size: 16px; font-weight: 700; color: var(--ink);
  border: 1px solid var(--paper-edge); border-radius: 4px; padding: 10px 12px; background: var(--surface);
}
.praz-inp:focus { outline: 3px solid var(--gold); outline-offset: 1px; border-color: var(--gold); }
.praz-dates-in { display: flex; flex-wrap: wrap; gap: 10px; } /* na úzkém displeji pod sebou, jinak by karta datum ořízla */
.praz-dates-in label { flex: 1 1 150px; min-width: 0; display: flex; flex-direction: column; gap: 4px; font-weight: 700; font-size: 13px; color: var(--ink-soft); }
.praz-dates-in .praz-inp { width: 100%; min-width: 0; }
.praz-err { color: var(--coral); font-weight: 700; min-height: 18px; margin: 0; }
.praz-ok { color: var(--work-deep); font-weight: 700; margin: 0 0 12px; }
.cast-saved:empty { display: none; } /* Postavy: „Uloženo“ až po uložení */
.praz-form-btns { display: flex; gap: 10px; }
.praz-form-btns .btn { flex: 1; }

/* --- intro (citát v obrázkovém poli, tělo = info o 1. cviku + tlačítka) --- */
.intro-illus {
  width: 100%; aspect-ratio: 4 / 3;
  background: radial-gradient(120% 90% at 50% 0%, var(--accent-soft) 0%, var(--paper-edge) 60%, var(--paper-edge) 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 20px 26px; gap: 8px;
}
.intro-tren { font-weight: 700; font-size: 14px; text-transform: uppercase; letter-spacing: .5px; color: var(--gold-deep); margin: 0; }
.intro-quote { font-family: var(--font-display); font-size: 31px; font-weight: 700; line-height: 1.2; color: var(--coral); margin: 0; }
.intro-author { font-weight: 700; color: var(--ink-soft); margin: 0; }
.intro-body { padding: 18px 24px 22px; text-align: center; display: flex; flex-direction: column; gap: 10px; }
.intro-first-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--work-deep); }
.intro-first-name { font-size: 23px; font-weight: 700; margin: 4px 0; }
.intro-first-kid { font-size: 18px; font-weight: 700; margin: 0 0 4px; }
.intro-first-cue { font-size: 15px; font-weight: 700; color: var(--ink-soft); margin: 0; }
.intro-body .btn-big { margin-top: 6px; }

/* --- run: Ukončit (✕) v hlavičce --- */
.run-x { appearance: none; border: none; background: none; cursor: pointer; font-family: inherit; font-weight: 700; font-size: 13px; color: var(--coral); padding: 0; }
.run-x:hover { text-decoration: underline; }
.run-x:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; border-radius: 4px; }

/* --- finish (Dokončit trénink) --- */
.run.phase-done .run-illus { background: var(--accent-soft); }
.run.phase-done .run-phase { color: var(--gold-deep); }
.run.phase-done .run-progress-fill { background: var(--gold); }

/* --- modal (potvrzení, rekordy; public/app/dialog.js): vůči oknu nad spodní navigací i bublinou
   ukládání, vysoký obsah roluje uvnitř dialogu --- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 40; background: rgba(5, 12, 22, .5);
  display: flex; align-items: center; justify-content: center;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
}
.modal {
  background: var(--paper); border-radius: 4px; padding: 22px; max-width: 320px; width: 100%; text-align: center;
  box-shadow: none;
  max-height: 100%; overflow-y: auto; overscroll-behavior: contain;
}
.modal:focus { outline: none; }
.modal-title { font-weight: 700; font-size: 20px; margin: 0 0 6px; color: var(--ink); }
.modal-text { font-weight: 700; color: var(--ink-soft); margin: 0 0 16px; }
.modal-btns { display: flex; gap: 10px; }
.modal-btns .btn { flex: 1; }
.btn-danger { background: var(--coral); color: var(--ink); box-shadow: none; }
.btn-danger:hover { background: var(--coral); }
.btn-danger:active { box-shadow: none; }

/* --- Cviky a rady (knihovna) --- */
.cviky-list { display: flex; flex-direction: column; gap: 10px; }
.cvik-card { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--paper-edge); border-radius: 4px; overflow: hidden; }
.cvik-illus { flex: 0 0 100px; background: var(--success-soft); align-self: stretch; display: flex; align-items: center; }
.cvik-illus svg { display: block; width: 100px; height: 78px; }
.cvik-body { padding: 10px 12px 10px 0; flex: 1; min-width: 0; }
.cvik-name { font-size: 16px; font-weight: 700; margin: 0 0 2px; }
.cvik-kid { font-size: 13px; font-weight: 700; margin: 0 0 4px; }
.cvik-tip { font-size: 13px; font-weight: 700; color: var(--work-deep); margin: 0 0 6px; }
/* obrázky po krocích (public/app/svg/steps.js): knihovna Cviky a běh tréninku */
.ex-steps { display: flex; gap: 8px; }
.ex-step { flex: 1 1 0; min-width: 0; margin: 0; }
.ex-step svg { display: block; width: 100%; height: auto; }
.ex-step figcaption { font-size: 13px; font-weight: 700; line-height: 1.3; margin-top: 4px; }
.ex-step figcaption b { display: inline-block; min-width: 18px; height: 18px; border-radius: 9px; background: var(--ink); color: var(--surface); font-size: 11px; line-height: 18px; text-align: center; margin-right: 3px; }
.cvik-card-steps { flex-direction: column; }
.cvik-card-steps .cvik-body { padding: 10px 12px 2px; }
.cvik-card-steps .ex-steps { padding: 0 12px 12px; }
.run-illus .ex-steps { height: 100%; padding: 10px 12px 6px; box-sizing: border-box; align-items: flex-start; }
/* pás s kroky roste podle obrázků a popisků (run.js paintIllus), nejmíň jako dřív: 2 : 1, nejvýš 240 px (sport.css) */
.run-illus.run-illus-steps { aspect-ratio: auto; max-height: none; min-height: min(50vw, 240px); }
.run-illus.run-illus-steps .ex-steps { height: auto; }
.run-illus .ex-step svg { width: auto; max-width: 100%; max-height: 150px; margin: 0 auto; }

/* --- modal: vstup + výsledek (žonglování) --- */
.modal-input { font-family: inherit; font-size: 26px; font-weight: 700; text-align: center; width: 100%; box-sizing: border-box; border: 1px solid var(--paper-edge); border-radius: 4px; padding: 10px; margin-bottom: 8px; color: var(--ink); }
.modal-input:focus { outline: 3px solid var(--gold); outline-offset: 1px; border-color: var(--gold); }
.modal-result { font-weight: 700; color: var(--gold-deep); min-height: 20px; margin: 0 0 12px; }

/* řádek na nohu (pravá / levá) */
.jug-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; align-items: center; margin-bottom: 12px; }
.jug-lbl { font-weight: 700; font-size: 17px; }
.jug-best { font-weight: 700; font-size: 14px; color: var(--ink-soft); text-align: right; }
.jug-row .modal-input { grid-column: 1; margin: 0; font-size: 22px; padding: 8px; }
.jug-row .jug-save { grid-column: 2; padding: 10px 16px; font-size: 16px; }

/* --- výzvy --- */
.vyzvy { display: flex; flex-direction: column; gap: 10px; }
.vyzva { background: var(--surface); border: 1px solid var(--paper-edge); border-radius: 4px; padding: 10px 12px; }
.vyzva-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.vyzva-name { font-weight: 700; font-size: 14px; }
.vyzva-per { font-size: 11px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; }
.vyzva-bar { height: 8px; background: var(--paper-edge); border-radius: 4px; overflow: hidden; margin: 7px 0 4px; }
.vyzva-fill { height: 100%; background: var(--gold); border-radius: 4px; transition: width .3s ease; }
.vyzva-prog { font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.vyzva-done { border-color: var(--grass); background: var(--success-soft); }
.vyzva-done .vyzva-fill { background: var(--grass); }
.done-vyzva { font-size: 15px; font-weight: 700; color: var(--work-deep); margin: 0 0 8px; }

/* --- sbírka kartiček (Panini) --- */
.sbirka-progress { text-align: center; font-weight: 700; margin: 0 0 12px; }
.pack-zone { margin: 4px 0 10px; text-align: center; }
.done-card { font-size: 16px; font-weight: 700; color: var(--gold-deep); margin: 0 0 8px; }

/* 140 px, ne 150: na 375px telefonu zbývá na mřížku 309 px, takže dva sloupce
   po 150 px + mezera minou o jediný pixel a celá sbírka spadne do jednoho sloupce.
   grid-auto-rows: 1fr srovná VŠECHNY řádky na stejnou výšku, aby zamčené karty
   nebyly nižší než otevřené. */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 12px; grid-auto-rows: 1fr; }
.card-mini {
  position: relative; border: 1px solid var(--paper-edge); border-radius: 4px; padding: 8px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  background: linear-gradient(160deg, var(--surface), var(--surface)); box-shadow: none; overflow: hidden;
}
.card-top { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.card-ovr { font-size: 22px; font-weight: 700; line-height: 1; }
.card-flag { font-size: 20px; }
.card-avatar { width: 76px; height: 80px; }
.card-avatar svg { width: 100%; height: 100%; display: block; }
.card-name { font-weight: 700; font-size: 14px; line-height: 1.05; }
.card-pos { font-size: 10px; font-weight: 700; color: var(--ink-soft); margin-bottom: 5px; }
.card-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; width: 100%; }
.stat { display: flex; flex-direction: column; align-items: center; }
.stat-l { font-size: 8px; font-weight: 700; color: var(--ink-soft); }
.stat-v { font-size: 12px; font-weight: 700; }
.card-drill { font-size: 10px; font-weight: 700; color: var(--work-deep); margin-top: 5px; }

.rarity-common { border-color: var(--reward); }
.rarity-common .card-ovr { color: var(--reward); }
.rarity-rare { border-color: var(--ink-soft); background: linear-gradient(160deg, var(--surface), var(--accent-soft)); }
.rarity-rare .card-ovr { color: var(--ink-soft); }
.rarity-epic { border-color: var(--gold); background: linear-gradient(160deg, var(--surface), var(--reward-soft)); }
.rarity-epic .card-ovr { color: var(--gold-deep); }
.rarity-legendary { border-color: var(--paper-edge); background: linear-gradient(160deg, var(--surface), var(--reward-soft)); box-shadow: none; }
.rarity-legendary .card-ovr { color: var(--reward); }

/* ultra (karta hrdiny) — duhový, svítící */
.card-ultra { border: 0; padding: 10px; color: var(--ink);
  background: linear-gradient(125deg, var(--coral), var(--reward), var(--grass), var(--gold), var(--sky), var(--coral));
  background-size: 300% 300%; animation: ultraShift 6s ease infinite; box-shadow: none; }
.card-ultra .card-ovr, .card-ultra .card-name, .card-ultra .card-pos,
.card-ultra .stat-l, .card-ultra .stat-v, .card-ultra .card-drill { color: var(--ink); }
.card-ultra .stat-v { text-shadow: none; }
@keyframes ultraShift { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }

/* --- otáčení karty (klik = líc/rub) --- */
/* výška se musí propsat celým řetězem buňka → flip → inner → karta,
   jinak je zamčená karta nižší než otevřená (má míň obsahu) */
.card-cell { display: flex; }
.card-flip { width: 100%; height: 100%; perspective: 900px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.card-flip:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; border-radius: 4px; }
.card-inner {
  position: relative; display: grid; width: 100%; height: 100%; min-height: 200px;
  transform-style: preserve-3d; transition: transform .5s cubic-bezier(.2,.7,.3,1);
}
/* obě strany leží ve stejné buňce → výška = ta vyšší z nich */
.card-inner > .card-mini {
  grid-area: 1 / 1; height: 100%; box-sizing: border-box;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.card-flip.flipped .card-inner { transform: rotateY(180deg); }
.card-rear { transform: rotateY(180deg); justify-content: flex-start; }

.card-locked { justify-content: center; border-color: var(--paper-edge); background: var(--surface); box-shadow: none; }
.card-back { display: flex; flex-direction: column; align-items: center; font-size: 34px; opacity: .5; }
.card-back span { font-size: 22px; font-weight: 700; color: var(--ink-soft); }

/* --- rub karty --- */
.card-rear-locked { border-color: var(--paper-edge); background: var(--surface); box-shadow: none; justify-content: center; }
.cb-lock { font-size: 22px; line-height: 1; margin-bottom: 4px; }
.cb-h { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-soft); margin: 8px 0 4px; }
.cb-name { font-weight: 700; font-size: 14px; line-height: 1.1; margin-bottom: 8px; }
.cb-rows { width: 100%; display: flex; flex-direction: column; gap: 5px; }
.cb-row { display: flex; flex-direction: column; align-items: center; line-height: 1.15; }
.cb-row span { font-size: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-soft); }
.cb-row b { font-size: 12px; font-weight: 700; }
.cb-earn { font-size: 10px; font-weight: 700; line-height: 1.3; color: var(--ink-soft); margin: 8px 0 0; }
.card-ultra .cb-name, .card-ultra .cb-row span, .card-ultra .cb-row b, .card-ultra .cb-earn { color: var(--ink); }

.reveal-wrap { text-align: center; margin: 4px 0 14px; }
.reveal-title { font-weight: 700; color: var(--coral); font-size: 18px; margin: 0 0 8px; }
.card-reveal { max-width: 210px; margin: 0 auto; animation: pop .45s ease; }
.card-reveal .card-avatar { width: 104px; height: 108px; }
.card-reveal .card-name { font-size: 17px; }
@media (prefers-reduced-motion: reduce) { .card-reveal { animation: none; } .card-ultra { animation: none; } .card-inner { transition: none; } }

/* --- animace (třídy používá SVG knihovna) --- */
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes twinkle { 0%, 100% { opacity: .25; transform: scale(.7); } 50% { opacity: 1; transform: scale(1.1); } }
@keyframes spin { to { transform: rotate(360deg); } }
.sunrays { transform-box: fill-box; transform-origin: center; animation: spin 32s linear infinite; }
.floaty { transform-box: fill-box; transform-origin: center; animation: bob 3s ease-in-out infinite; }
.spark { animation: twinkle 2.2s ease-in-out infinite; }
.spark:nth-child(2n) { animation-delay: .6s; }
.spark:nth-child(3n) { animation-delay: 1.1s; }

@media (prefers-reduced-motion: reduce) {
  .floaty, .spark, .sunrays { animation: none !important; }
  .run-progress-fill { transition: none; }
}
@media (max-width: 430px) {
  body { padding: 10px; }
  .run-clock { font-size: 64px; }
  .home-title, .done-title { font-size: 26px; }
  /* jinak se „‹ Zpět" a „Přeskočit ⏭" zalomí na dva řádky a řada je rozhozená */
  .run-controls { gap: 6px; padding-left: 14px; padding-right: 14px; }
  .run-controls .btn { font-size: 15px; padding: 12px 10px; white-space: nowrap; }
  .done-controls { gap: 6px; }
  .done-controls .btn { font-size: 15px; padding: 12px 10px; white-space: nowrap; }
}

.recommend-places { min-width: 0; border: 0; padding: 0; margin: 0; }
.recommend-places legend { margin-bottom: .4rem; font-weight: 700; }
.recommend-place-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.recommend-places label { position: relative; min-width: 0; cursor: pointer; }
.recommend-places .chip { display: flex; align-items: center; justify-content: center; height: 100%; white-space: nowrap; }
.recommend-places input {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.recommend-places input:checked + span { background: var(--gold); border-color: var(--gold); color: var(--on-accent); }
/* :focus fallback keeps the ring in Safari 15.0–15.3, before :focus-visible support. */
.recommend-places input:focus + span { outline: 3px solid var(--coral); outline-offset: 2px; }
.recommend-places input:focus-visible + span { outline: 3px solid var(--coral); outline-offset: 2px; }
.recommend-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
