:root {
  --bg: #fff8f0;
  --card: #ffffff;
  --ink: #1b2430;
  --muted: #667380;
  --line: #eee5d8;
  --primary: #0f766e;
  --primary-2: #14b8a6;
  --accent: #f26a1b;
  --good: #1f8a3d;
  --bad: #d13a3a;
  --tint: #f3ece1;
  --radius: 22px;
  --shadow: 0 1px 2px rgba(27, 36, 48, .05), 0 10px 30px -12px rgba(27, 36, 48, .18);
  --hero-a: #0f766e;
  --hero-b: #19b3a3;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12171c; --card: #1b2229; --ink: #f0f3f5; --muted: #98a4ae; --line: #2a333c; --tint: #232c35;
    --primary: #2fb5a8; --primary-2: #5eead4; --accent: #ff8a4c; --good: #5ec26f; --bad: #ff7b7b;
    --shadow: 0 10px 30px -14px rgba(0, 0, 0, .6);
    --hero-a: #0c5c56; --hero-b: #138f84;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; color: var(--ink);
  font: 16px/1.55 ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
  background:
    radial-gradient(800px 420px at 95% -8%, color-mix(in srgb, var(--primary-2) 20%, transparent), transparent 62%),
    radial-gradient(700px 400px at -8% 8%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .6rem; letter-spacing: -.02em; }
h1 { font-size: 2rem; font-weight: 800; }
h2 { font-size: 1.3rem; font-weight: 750; }
h3 { font-size: 1.08rem; font-weight: 700; }
.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: .85rem; }

/* ---------- hlavička ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: .65rem 1.2rem; position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--card) 80%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 850; font-size: 1.3rem; text-decoration: none; color: var(--ink); letter-spacing: -.03em; }
.brand img { width: 36px; height: 36px; display: block; transition: transform .3s; }
.brand:hover img { transform: rotate(-12deg) scale(1.08); }
.brand .dot { color: var(--accent); }
#nav { display: flex; gap: .25rem; flex-wrap: wrap; align-items: center; }
#nav a, #nav button {
  padding: .45rem .95rem; border-radius: 999px; text-decoration: none; color: var(--ink); font-weight: 600;
  background: none; border: 0; font-family: inherit; font-size: .95rem; cursor: pointer; transition: background .15s;
}
#nav a:hover, #nav button:hover { background: var(--tint); }
#nav a.active { background: linear-gradient(135deg, var(--primary-2), var(--primary)); color: #fff; box-shadow: 0 6px 14px -6px var(--primary); }

main { flex: 1; width: 100%; max-width: 1000px; margin: 0 auto; padding: 1.4rem 1.2rem; }
.foot { text-align: center; color: var(--muted); font-size: .85rem; padding: 1.5rem 1rem 2.2rem; }

/* ---------- karty ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.25rem 1.4rem; margin-bottom: 1.1rem;
}
.grid { display: grid; gap: 1.1rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.cols-2 > .card { margin-bottom: 0; }

/* hero s maskotem */
.hero-card {
  position: relative; overflow: hidden; color: #fff; border: 0;
  background: linear-gradient(135deg, var(--hero-a), var(--hero-b));
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.6rem 1.8rem; min-height: 190px;
}
.hero-card::before, .hero-card::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .1); pointer-events: none; }
.hero-card::before { width: 280px; height: 280px; right: -60px; top: -120px; }
.hero-card::after { width: 160px; height: 160px; left: 38%; bottom: -90px; }
.hero-card .txt { position: relative; z-index: 1; max-width: 560px; }
.hero-card h1 { color: #fff; margin-bottom: .45rem; font-size: 2.1rem; }
.hero-card .quip { font-size: 1.12rem; line-height: 1.4; opacity: .96; margin: 0; }
.hero-card .mascot { position: relative; z-index: 1; width: 170px; height: 170px; flex: 0 0 auto; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .22)); animation: bob 3.4s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-1.5deg); } 50% { transform: translateY(-7px) rotate(1.5deg); } }
@media (prefers-reduced-motion: reduce) { .hero-card .mascot { animation: none; } .brand img { transition: none; } }

.hero-auth { text-align: center; padding: 1rem 0 .5rem; }
.hero-auth .mascot { width: 190px; height: 190px; animation: bob 3.4s ease-in-out infinite; }
.hero-auth h1 { font-size: 2.3rem; margin: .2rem 0 .3rem; }

/* ---------- statistiky ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .9rem; margin-bottom: 1.1rem; }
.stat { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: .9rem 1rem; box-shadow: var(--shadow); }
.stat .ico { position: absolute; right: .75rem; top: .75rem; width: 2.2rem; height: 2.2rem; border-radius: 12px; background: var(--tint); display: grid; place-items: center; font-size: 1.1rem; }
.stat .label { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 650; }
.stat .value { font-size: 1.85rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin-top: .15rem; }
.stat .sub { color: var(--muted); font-size: .84rem; }
.good { color: var(--good); }
.badc { color: var(--bad); }

/* ---------- formuláře ---------- */
label { display: block; font-weight: 650; font-size: .88rem; margin-bottom: .3rem; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=search] {
  width: 100%; padding: .72rem .85rem; font: inherit; color: var(--ink); background: var(--tint);
  border: 2px solid transparent; border-radius: 14px; transition: border-color .15s, background .15s; min-height: 3rem; line-height: 1.3;
}
input:focus { outline: none; border-color: var(--primary-2); background: var(--card); }
button:focus-visible, a:focus-visible, select:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary-2) 55%, transparent); outline-offset: 2px; }
.row { display: flex; gap: .8rem; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 140px; }
.row > .shrink { flex: 0 0 auto; }
.field { margin-bottom: .8rem; }

.btn {
  display: inline-block; padding: .72rem 1.3rem; border-radius: 999px; border: 0;
  background: linear-gradient(135deg, var(--primary-2), var(--primary)); color: #fff;
  font: inherit; font-weight: 750; cursor: pointer; text-decoration: none; text-align: center;
  box-shadow: 0 8px 18px -8px var(--primary); transition: transform .12s, box-shadow .12s, filter .12s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 12px 22px -10px var(--primary); filter: brightness(1.05); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--primary); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--primary) 40%, transparent); }
.btn.ghost:hover { background: color-mix(in srgb, var(--primary) 10%, transparent); box-shadow: inset 0 0 0 2px var(--primary); }
.btn.danger { background: transparent; color: var(--bad); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--bad) 40%, transparent); }
.btn.danger:hover { background: color-mix(in srgb, var(--bad) 10%, transparent); box-shadow: inset 0 0 0 2px var(--bad); }
.btn.small { padding: .32rem .8rem; font-size: .84rem; }
.btn.small:not(.ghost):not(.danger), .btn.small:not(.ghost):not(.danger):hover { box-shadow: none; }
.btn:disabled { opacity: .6; cursor: default; transform: none; }

.tabs { display: inline-flex; background: var(--tint); border-radius: 999px; padding: 4px; gap: 2px; }
.tabs button { border: 0; background: none; font: inherit; font-weight: 600; padding: .32rem .9rem; border-radius: 999px; cursor: pointer; color: var(--muted); }
.tabs button.on { background: var(--card); color: var(--primary); box-shadow: 0 2px 8px -2px rgba(0, 0, 0, .2); }

/* ---------- tabulky ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .65rem .5rem; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: 0; }
th { color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td:first-child { white-space: nowrap; }
tbody tr:hover td { background: color-mix(in srgb, var(--tint) 55%, transparent); }
tr.me td { background: color-mix(in srgb, var(--primary-2) 14%, transparent); font-weight: 650; }
.rank { width: 2.6rem; font-size: 1.35rem; }
.swatch { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .45rem; vertical-align: baseline; }
.tablewrap { overflow-x: auto; }
.who small { display: block; color: var(--muted); font-weight: 500; font-size: .78rem; margin-left: 1.15rem; }

/* ---------- graf ---------- */
.chart { position: relative; width: 100%; min-height: 240px; }
.chart svg { display: block; width: 100%; height: auto; }
.chart text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .ref { stroke: var(--accent); stroke-dasharray: 5 4; stroke-width: 1.6; }
.chart .ref-text { fill: var(--accent); font-weight: 700; }
.chart .hover-line { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.tip {
  position: absolute; pointer-events: none; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: .45rem .7rem; font-size: .82rem; box-shadow: 0 10px 24px -8px rgba(0, 0, 0, .3);
  white-space: nowrap; display: none; z-index: 5;
}
.legend { display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-size: .85rem; margin-top: .6rem; }

.bar { height: 14px; border-radius: 999px; background: var(--tint); overflow: hidden; margin-top: .5rem; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary-2), var(--accent)); border-radius: 999px; transition: width .8s cubic-bezier(.2, .8, .2, 1); }

.pill { display: inline-block; font-size: .74rem; font-weight: 650; padding: .15rem .65rem; border-radius: 999px; background: var(--tint); color: var(--muted); }
.pill.running { color: var(--good); background: color-mix(in srgb, var(--good) 14%, transparent); }
.pill.upcoming { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }

.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.2rem; font-weight: 700; letter-spacing: .14em; background: var(--tint); border: 2px dashed var(--line); padding: .2rem .7rem; border-radius: 12px; }
.err { color: var(--bad); font-weight: 650; margin: .4rem 0; }
.err:empty { display: none; }
.auth { max-width: 430px; margin: 0 auto 1rem; }

/* BMI */
.bmi-val { font-size: 2.2rem; letter-spacing: -.03em; margin: .2rem 0 .8rem; }
.bmi-val b { font-weight: 850; font-variant-numeric: tabular-nums; }
.bmi-scale { position: relative; display: flex; height: 14px; border-radius: 999px; overflow: visible; margin: .4rem 0 0; }
.bmi-seg { display: block; height: 100%; }
.bmi-seg.s1 { background: #60a5fa; border-radius: 999px 0 0 999px; }
.bmi-seg.s2 { background: #34d399; }
.bmi-seg.s3 { background: #fbbf24; }
.bmi-seg.s4 { background: #fb923c; }
.bmi-seg.s5 { background: #ef4444; border-radius: 0 999px 999px 0; }
.bmi-dot { position: absolute; top: 50%; width: 24px; height: 24px; margin: -12px 0 0 -12px; border-radius: 50%; background: var(--card); border: 5px solid var(--ink); box-shadow: 0 4px 10px rgba(0, 0, 0, .3); }
.bmi-labels { position: relative; height: 1.4rem; margin-top: .55rem; font-size: .76rem; color: var(--muted); }
.bmi-labels span { position: absolute; transform: translateX(-50%); }
.bmi-joke { font-weight: 650; margin: .6rem 0 .3rem; }

/* vítěz soutěže */
.winner { display: flex; align-items: center; gap: 1rem; background: linear-gradient(135deg, color-mix(in srgb, #fbbf24 28%, var(--card)), var(--card)); }
.winner img { width: 110px; height: 110px; flex: 0 0 auto; }
.winner .big { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; }

.empty { text-align: center; padding: 1.5rem 1rem; }
.empty img { width: 160px; height: 160px; }
.empty p { margin: .2rem 0; }

.listlink { display: block; text-decoration: none; color: inherit; }
.listlink .card { transition: transform .15s, border-color .15s; }
.listlink:hover .card { transform: translateY(-2px); border-color: var(--primary-2); }
.between { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.check { display: flex; gap: .55rem; align-items: center; font-weight: 500; }
.check input { width: 1.15rem; height: 1.15rem; accent-color: var(--primary); }

.toast {
  position: fixed; left: 50%; bottom: 1.4rem; transform: translateX(-50%) translateY(160%);
  background: var(--ink); color: var(--bg); padding: .7rem 1.2rem; border-radius: 999px; transition: transform .3s cubic-bezier(.2, .9, .3, 1.3), opacity .2s;
  z-index: 50; max-width: 92vw; opacity: 0; pointer-events: none; font-weight: 600; box-shadow: 0 14px 30px -10px rgba(0, 0, 0, .5);
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

@media (max-width: 600px) {
  main { padding: .9rem .8rem; }
  h1 { font-size: 1.7rem; }
  .hero-card { flex-direction: column-reverse; text-align: center; padding: 1.2rem 1.1rem; }
  .hero-card h1 { font-size: 1.7rem; }
  .hero-card .mascot { width: 130px; height: 130px; }
  .stat .value { font-size: 1.5rem; }
  th.hide-s, td.hide-s { display: none; }
  th, td { padding: .55rem .3rem; font-size: .92rem; }
  td:first-child { white-space: normal; }
  td.num .btn.small { padding: .25rem .55rem; }
  .winner { flex-direction: column; text-align: center; }
}
