/* Vzhled appky. Vychází z „card" layoutu a animací pohádkových knížek. */

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

body {
  font-family: 'Nunito', system-ui, sans-serif;
  color: var(--ink);
  min-height: 100dvh;
  background: radial-gradient(120% 80% at 50% -10%, #FFF3D6 0%, #FCE8C4 38%, #F6D9AE 100%);
  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: 3px solid #fff;
  border-radius: 30px;
  box-shadow: 0 22px 50px -18px var(--shadow), 0 4px 0 var(--paper-edge);
  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: #EAF6FA;
  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: 900;
  border-radius: 16px;
  padding: 12px 18px;
  font-size: 17px;
  color: #fff;
  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: 0 5px 0 var(--gold-deep); }
.btn-primary:hover { background: #FFB43C; }
.btn-primary:active { box-shadow: 0 2px 0 var(--gold-deep); }
.btn-ghost { background: #EFE4D2; color: var(--ink); box-shadow: 0 5px 0 var(--paper-edge); }
.btn-ghost:active { box-shadow: 0 2px 0 var(--paper-edge); }
.btn-big { width: 100%; font-size: 20px; padding: 14px; }

/* --- úvod --- */
.home-title { font-weight: 900; 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: 2px solid var(--paper-edge);
  border-radius: 20px;
  padding: 16px;
  background: #fff;
}
.trening-top {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  font-size: 13px;
  color: var(--ink-soft);
}
.trening-loc { color: var(--grass); }
.trening-name { font-size: 24px; font-weight: 900; margin: 8px 0 2px; color: var(--ink); }
.trening-tag { margin: 0 0 14px; font-weight: 600; color: var(--ink-soft); }
.home-stat { margin: 16px 0 0; font-weight: 700; }
.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: 2px solid var(--paper-edge); background: #fff; cursor: pointer;
  font-family: inherit; font-weight: 800; font-size: 14px; color: var(--ink-soft);
  padding: 7px 14px; border-radius: 999px; 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: #fff; }
.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: 0 4px 0 var(--paper-edge); }
.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; }

/* --- průběh --- */
.run-head {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  color: var(--ink-soft);
  font-size: 14px;
}
.run-block { color: var(--gold-deep); }
.run-progress {
  height: 8px;
  background: var(--paper-edge);
  border-radius: 99px;
  margin: 10px 0 6px;
  overflow: hidden;
}
.run-progress-fill { height: 100%; width: 0; border-radius: 99px; transition: width .2s linear; }
.run-clock {
  font-size: 74px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  margin: 8px 0 2px;
  font-variant-numeric: tabular-nums;
}
.run-phase {
  text-align: center;
  font-weight: 900;
  letter-spacing: .5px;
  text-transform: uppercase;
  font-size: 15px;
}
.run-name { text-align: center; font-size: 23px; font-weight: 900; 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í — práce (zelená) vs pauza (modrá) */
.run.phase-work .run-clock { color: var(--work-deep); }
.run.phase-work .run-progress-fill { background: var(--work); }
.run.phase-work .run-illus { background: #E9F7E6; }
.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: #E3F1FB; }
.run.phase-rest .run-phase { color: var(--rest-deep); }
.run.phase-attempts .run-illus { background: #FFF1E6; }
.run.phase-attempts .run-phase, .run.phase-record .run-phase { color: var(--gold-deep); }
.run.phase-record .run-illus { background: #F0EAF9; }
.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: #fff; }
.att-good { background: var(--grass); box-shadow: 0 5px 0 var(--work-deep); }
.att-good:active { box-shadow: 0 2px 0 var(--work-deep); }
.att-bad { background: var(--coral); box-shadow: 0 5px 0 #C94631; }
.att-bad:active { box-shadow: 0 2px 0 #C94631; }

/* 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: 900; text-align: center;
  border: 2px solid var(--paper-edge); border-radius: 14px; 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: #F1E2CC; padding: 1px 6px; border-radius: 6px; }

/* --- done: nové odznaky + Lví týden --- */
.done-lvi { font-size: 16px; font-weight: 800; color: var(--gold-deep); margin: 0 0 10px; }
.done-badges { margin: 4px 0 14px; }
.done-badges-title { font-weight: 900; 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: 900; 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: 900; 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: 900; line-height: 1; color: var(--gold-deep); }
.big-lbl { font-weight: 800; color: var(--ink-soft); }
.mini-counts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.mini-counts span {
  background: #fff; border: 2px solid var(--paper-edge); border-radius: 12px;
  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: 800; color: var(--ink-soft); }
.wd-dot {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--paper-edge); border: 2px 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-today .wd-dot { border-color: var(--coral); border-width: 3px; }
.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: 900; }

.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: 14px; border: 2px solid var(--paper-edge); background: #fff;
}
.badge-ic { font-size: 26px; line-height: 1; }
.badge-name { font-size: 11px; font-weight: 800; line-height: 1.15; }
.badge-earned { border-color: var(--gold); background: #FFF6E4; }
.badge-locked { filter: grayscale(1); opacity: .5; }
.badge-new { border-color: var(--coral); background: #FFF0EC; 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; } }

/* --- 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: #fff; border: 2px solid var(--paper-edge); border-radius: 14px; padding: 10px 12px;
}
.praz-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.praz-name { font-weight: 900; }
.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: 2px solid var(--paper-edge); border-radius: 12px; padding: 10px 12px; background: #fff;
}
.praz-inp:focus { outline: 3px solid var(--gold); outline-offset: 1px; border-color: var(--gold); }
.praz-dates-in { display: flex; gap: 10px; }
.praz-dates-in label { flex: 1; display: flex; flex-direction: column; gap: 4px; font-weight: 800; font-size: 13px; color: var(--ink-soft); }
.praz-err { color: var(--coral); font-weight: 800; min-height: 18px; margin: 0; }
.praz-form-btns { display: flex; gap: 10px; }
.praz-form-btns .btn { flex: 1; }

/* --- 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: 800; color: var(--gold-deep); margin: 0 0 8px; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.card-mini {
  position: relative; border: 2px solid var(--paper-edge); border-radius: 14px; padding: 8px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  background: linear-gradient(160deg, #fff, #F6EFE1); box-shadow: 0 3px 0 var(--paper-edge); overflow: hidden;
}
.card-top { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.card-ovr { font-size: 22px; font-weight: 900; 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: 900; font-size: 14px; line-height: 1.05; }
.card-pos { font-size: 10px; font-weight: 800; 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: 800; color: var(--ink-soft); }
.stat-v { font-size: 12px; font-weight: 900; }
.card-drill { font-size: 10px; font-weight: 800; color: var(--work-deep); margin-top: 5px; }

.rarity-common { border-color: #C08A4A; }
.rarity-common .card-ovr { color: #9A6A2E; }
.rarity-rare { border-color: #9FB0C0; background: linear-gradient(160deg, #fff, #EAF0F6); }
.rarity-rare .card-ovr { color: #5E7186; }
.rarity-epic { border-color: var(--gold); background: linear-gradient(160deg, #FFFBF0, #FDEFC8); }
.rarity-epic .card-ovr { color: var(--gold-deep); }
.rarity-legendary { border-color: #2B2540; background: linear-gradient(160deg, #FFF7E0, #F3E3B0); box-shadow: 0 3px 0 #C9A23A; }
.rarity-legendary .card-ovr { color: #A6801E; }

/* ultra (Leon) — duhový, svítící */
.card-ultra { border: 0; padding: 10px; color: #fff;
  background: linear-gradient(125deg, #ff5f6d, #ffc371, #47e5bc, #5aa9e6, #b57bd6, #ff5f6d);
  background-size: 300% 300%; animation: ultraShift 6s ease infinite; box-shadow: 0 0 18px rgba(246,166,35,.7); }
.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: #fff; }
.card-ultra .stat-v { text-shadow: 0 1px 2px rgba(0,0,0,.3); }
@keyframes ultraShift { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }

.card-locked { justify-content: center; min-height: 168px; border-color: var(--paper-edge); background: #F4EEE3; 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: 900; color: var(--ink-soft); }

.reveal-wrap { text-align: center; margin: 4px 0 14px; }
.reveal-title { font-weight: 900; 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; } }

/* --- 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; }
}
