:root{
  --bg:#f4f3ef; --surface:#fcfcfb; --surface-2:#eeede8; --border:#e0dfd8;
  --text:#0b0b0b; --text-2:#52514e; --muted:#7a7974;
  --s1:#2a78d6; --s2:#eb6834;
  --good:#0ca30c; --serious:#ec835a; --neutral:#8a8983;
  --ramp: #cde2fb,#9ec5f4,#6da7ec,#3987e5,#256abf,#184f95,#0d366b;
  color-scheme: light;
}
@media (prefers-color-scheme: dark){
  :root{
    --bg:#111110; --surface:#1a1a19; --surface-2:#252523; --border:#33332f;
    --text:#fff; --text-2:#c3c2b7; --muted:#8f8e86;
    --s1:#3987e5; --s2:#d95926;
    color-scheme: dark;
  }
}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--text);font:15px/1.45 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif}
main{max-width:1100px;margin:0 auto;padding:24px 16px 48px}
header{display:flex;justify-content:space-between;align-items:baseline;gap:12px;flex-wrap:wrap;margin-bottom:18px}
h1{font-size:22px;margin:0;letter-spacing:-.01em}
h2{font-size:15px;margin:0 0 12px;font-weight:600}
.sub{color:var(--text-2);font-size:13px}
.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:14px;margin-bottom:14px}
.card{background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:16px 18px;min-width:0}
.hero{font-size:52px;font-weight:650;line-height:1;letter-spacing:-.02em;font-variant-numeric:tabular-nums}
.hero small{font-size:15px;font-weight:500;color:var(--text-2);letter-spacing:0;margin-left:6px}
.badge{display:inline-flex;align-items:center;gap:6px;font-size:13px;font-weight:600;padding:3px 10px;border-radius:99px;background:var(--surface-2);color:var(--text)}
.badge i{width:9px;height:9px;border-radius:50%;display:inline-block}
.row{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-top:10px}
.win{display:flex;justify-content:space-between;gap:10px;padding:8px 0;border-top:1px solid var(--border);font-variant-numeric:tabular-nums}
.win:first-of-type{border-top:0}
.win b{font-weight:600}
.win .v{color:var(--text-2);white-space:nowrap}
.note{background:var(--surface-2);border-radius:8px;padding:10px 12px;font-size:13px;color:var(--text-2);margin-bottom:14px}
.muted{color:var(--muted)}
/* Aktuální počet je hlavní důvod, proč sem člověk chodí, takže má vlastní
   kartu nad vším ostatním. Na širší obrazovce se číslo a popisky srovnají
   vedle sebe, ať karta přes celou šířku nezeje prázdnotou. */
@media (min-width: 601px){
  .nowcard{display:flex;align-items:flex-end;gap:20px;flex-wrap:wrap}
  .nowcard .row{margin-top:0}
}
/* heatmap */
.heat-scroll{position:relative}
/* Stín u kraje říká, že tabulka pokračuje mimo obrazovku. Přepínají ho
   data atributy z app.js podle skutečné polohy posuvníku. */
.heat-scroll::before,.heat-scroll::after{content:"";position:absolute;top:0;bottom:0;width:20px;pointer-events:none;opacity:0;transition:opacity .15s}
.heat-scroll::before{left:0;background:linear-gradient(to right,var(--surface),transparent)}
.heat-scroll::after{right:0;background:linear-gradient(to left,var(--surface),transparent)}
.heat-scroll[data-l="1"]::before,.heat-scroll[data-r="1"]::after{opacity:1}
.heat-wrap{overflow-x:auto}
.heat{display:grid;gap:2px;min-width:640px}
.heat .lbl{font-size:12px;color:var(--text-2);align-self:center;padding-right:6px}
.heat .hr{font-size:11px;color:var(--muted);text-align:left;white-space:nowrap}
.heat .c{height:26px;border-radius:3px;background:var(--surface-2);cursor:default}
.heat .c.closed{background:repeating-linear-gradient(135deg,transparent 0 3px,var(--border) 3px 4px)}
.heat .c.now{outline:2px solid var(--s2);outline-offset:1px}
.legend{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--text-2);margin-top:10px;flex-wrap:wrap}
.legend .lg-scale{display:inline-flex;align-items:center;gap:8px}
.legend .bar{display:flex;height:10px;width:160px;border-radius:3px;overflow:hidden}
.legend .bar span{flex:1}
.key{display:inline-flex;align-items:center;gap:6px;margin-right:12px}
.key i{display:inline-block;width:14px;height:3px;border-radius:2px}
.key i.band{height:10px;opacity:.25}
/* tabs */
.tabs{display:flex;gap:4px;flex-wrap:wrap;margin-bottom:10px}
.tabs button{font:inherit;font-size:13px;border:1px solid var(--border);background:var(--surface);color:var(--text-2);padding:4px 10px;border-radius:99px;cursor:pointer}
.tabs button[aria-pressed=true]{background:var(--text);color:var(--surface);border-color:var(--text)}
.tabs .today{display:inline-flex;align-items:center;gap:4px;margin-left:5px}
.tabs .today i{width:5px;height:5px;border-radius:50%;background:var(--s2);display:inline-block}
svg text{fill:var(--muted);font-size:11px}
.tip{position:fixed;pointer-events:none;background:var(--surface);color:var(--text);border:1px solid var(--border);border-radius:8px;padding:7px 10px;font-size:12px;box-shadow:0 4px 16px rgba(0,0,0,.12);display:none;z-index:9;font-variant-numeric:tabular-nums;max-width:240px}
.tip b{font-weight:600}
table{width:100%;border-collapse:collapse;font-size:13px;font-variant-numeric:tabular-nums}
th,td{text-align:left;padding:6px 8px;border-top:1px solid var(--border);vertical-align:top}
th{color:var(--text-2);font-weight:600}
footer{margin-top:18px;font-size:12px;color:var(--muted);display:flex;gap:14px;flex-wrap:wrap}
a{color:var(--s1)}
.mb{margin-bottom:14px}

/* Telefony: těsnější rozestupy, ať se na malou obrazovku vejde víc obsahu. */
@media (max-width: 600px){
  main{padding:16px 12px 32px}
  header{margin-bottom:14px;gap:6px}
  h1{font-size:19px}
  h2{margin-bottom:10px}
  .hero{font-size:44px}
  .card{padding:14px;border-radius:10px}
  .grid{gap:10px;margin-bottom:10px;grid-template-columns:1fr}
  .mb{margin-bottom:10px}
  .win{flex-wrap:wrap;gap:0 10px}
  .win .v{white-space:normal}
  th,td{padding:5px 6px}
  .legend{font-size:11px;gap:6px}
  .legend .bar{width:110px}
  /* Popisky heatmapy zabírají na řádku se stupnicí moc místa, tak dostanou vlastní. */
  .legend .lg-note{flex-basis:100%}
  /* Mřížka místo lámání řádku: délky 4 + 3, dny všech sedm v jedné řadě. */
  #swim{display:grid;grid-template-columns:repeat(4,1fr);gap:6px}
  #tabs{display:grid;grid-template-columns:repeat(7,1fr);gap:4px}
  #tabs button{padding:9px 2px;font-size:13px}
  .tabs .today{margin-left:4px}
  .tabs .today>span{display:none}
  footer{gap:10px}
}

/* Dotykové ovládání: cíle, do kterých se dá trefit prstem. */
@media (hover: none){
  .tabs{gap:6px}
  .tabs button{padding:9px 14px;font-size:14px}
  .heat .c{height:30px}
  .heat-wrap{-webkit-overflow-scrolling:touch}
  /* Svislé posouvání stránky musí fungovat i při tažení po grafu. */
  #hit{touch-action:pan-y}
  .tip{max-width:min(280px, calc(100vw - 24px))}
}
