:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --line: #2a2f3a;
  --text: #e8eaf0;
  --dim: #98a0b0;
  --accent: #4ade80;
  --accent-dim: #16311f;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 14px;
}

* { box-sizing: border-box; }

html { accent-color: var(--accent); color-scheme: dark; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
}

/* ─────────────── HLAVIČKA ─────────────── */

#hlavicka {
  position: sticky; top: 0; z-index: 20;
  background: rgba(15, 17, 21, .88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
#hlavicka .wrap {
  max-width: 720px; margin: 0 auto;
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
#hlavicka .vpravo { display: flex; align-items: center; gap: 8px; min-width: 0; }
#prepinac {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 7px 10px; font-size: 14px; max-width: 46vw;
}
#odhlasit {
  padding: 7px 10px; font-size: 13px; white-space: nowrap;
  color: var(--dim); background: var(--panel-2);
}
#odhlasit:hover { color: var(--text); border-color: var(--bad); }
#kto { font-weight: 600; }

/* ─────────────── PRIHLASOVACIA STRÁNKA ─────────────── */

body.prihlasenie {
  padding: 0; min-height: 100dvh;
  display: grid; place-items: center;
}
body.prihlasenie main { width: 100%; max-width: 380px; padding: 20px; }
body.prihlasenie .karta { margin: 0; }
body.prihlasenie h1 { font-size: 24px; }
body.prihlasenie button { margin-top: 6px; }
body.prihlasenie .chyba { margin: 0 0 12px; }

/* ─────────────── LAYOUT ─────────────── */

#obsah { max-width: 720px; margin: 0 auto; padding: 16px; }

.karta {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

h1 { font-size: 21px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 22px 0 10px; }
h3 { font-size: 15px; margin: 16px 0 6px; }
.pod { color: var(--dim); font-size: 14px; margin: 0 0 18px; }
.dim { color: var(--dim); }
small { color: var(--dim); font-size: 12.5px; display: block; }

/* ─────────────── FORMULÁRE ─────────────── */

fieldset {
  border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; margin: 0 0 16px;
}
fieldset.dolezite { border-color: #6b3a3a; background: #1d1517; }
legend { padding: 0 8px; font-weight: 600; font-size: 14px; }

label { display: block; margin-bottom: 12px; font-size: 14px; font-weight: 500; }
label:last-child { margin-bottom: 0; }

/* Pozor: `input` bez atribútu type je text, ale [type=text] ho nechytí. */
input:not([type=checkbox]):not([type=range]), select, textarea {
  width: 100%; margin-top: 5px;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; font: inherit; font-size: 16px; /* 16px = iOS nezoomuje */
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent;
}
.riadok { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.chipy { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chipy label { margin: 0; }
.chipy input { position: absolute; opacity: 0; pointer-events: none; }
.chipy span {
  display: inline-block; cursor: pointer;
  padding: 8px 13px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line);
  font-size: 13.5px; user-select: none;
}
.chipy input:checked + span {
  background: var(--accent-dim); border-color: var(--accent); color: var(--accent);
}

/* ─────────────── TLAČIDLÁ ─────────────── */

button {
  font: inherit; cursor: pointer; border-radius: 11px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  padding: 11px 16px; font-size: 15px;
}
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
button.hlavne {
  width: 100%; background: var(--accent); color: #06240f;
  border-color: var(--accent); font-weight: 700; padding: 14px;
}
button.hlavne:hover:not(:disabled) { filter: brightness(1.08); }
.tlacidla { display: flex; gap: 10px; flex-wrap: wrap; }

/* ─────────────── SPODNÉ MENU ─────────────── */

/* Musí prebiť `display: grid` nižšie, inak atribút hidden nič nespraví. */
#menu[hidden] { display: none; }

#menu {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(23, 26, 33, .96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
#menu button {
  border: none; border-radius: 0; background: none;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 9px 2px; font-size: 11px; color: var(--dim);
}
#menu button span { font-size: 19px; line-height: 1.2; }
#menu button.aktivny { color: var(--accent); }

/* ─────────────── OBSAH PLÁNOV ─────────────── */

.den {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px; margin-bottom: 12px;
}
.den > h3 { margin-top: 0; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 8px; }
th, td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--dim); font-weight: 600; font-size: 12px; text-transform: uppercase; }
td:first-child { font-weight: 600; }

.makra { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.makro {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 11px; padding: 11px 8px; text-align: center;
}
.makro b { display: block; font-size: 19px; color: var(--accent); }
.makro small { font-size: 11px; }

.stitok {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  background: var(--accent-dim); color: var(--accent); margin-left: 6px;
}

.zoznam { padding-left: 20px; margin: 8px 0; }
.zoznam li { margin-bottom: 4px; font-size: 14px; }

.trenerova-rec {
  background: var(--accent-dim); border-left: 3px solid var(--accent);
  border-radius: 0 11px 11px 0; padding: 13px 15px; margin: 14px 0;
  font-size: 14.5px; white-space: pre-wrap;
}
.varovanie {
  background: #2a1d16; border-left: 3px solid var(--warn);
  border-radius: 0 11px 11px 0; padding: 13px 15px; margin: 0 0 16px; font-size: 14px;
}
.chyba {
  background: #2a1618; border-left: 3px solid var(--bad);
  border-radius: 0 11px 11px 0; padding: 13px 15px; margin: 12px 0; font-size: 14px;
}

/* ─────────────── PROGRES ─────────────── */

.graf { width: 100%; height: 180px; margin: 10px 0; }
.graf polyline { fill: none; stroke: var(--accent); stroke-width: 2;
  stroke-linejoin: round; stroke-linecap: round; }
.graf .os { stroke: var(--line); stroke-width: 1; }
.graf text { fill: var(--dim); font-size: 10px; }

/* ─────────────── CHAT ─────────────── */

#chat-tok { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.bublina {
  max-width: 85%; padding: 11px 14px; border-radius: 15px;
  font-size: 14.5px; white-space: pre-wrap; word-wrap: break-word;
}
.bublina.ja { align-self: flex-end; background: var(--accent-dim); color: var(--text); }
.bublina.trener { align-self: flex-start; background: var(--panel-2); }
#chat-vstup { display: flex; gap: 9px; }
#chat-vstup textarea { flex: 1; margin: 0; }

/* ─────────────── STAVY ─────────────── */

.nacitava { text-align: center; color: var(--dim); padding: 30px 16px; font-size: 14px; }
.nacitava::after {
  content: ""; display: block; width: 26px; height: 26px; margin: 14px auto 0;
  border: 3px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: tocenie .8s linear infinite;
}
@keyframes tocenie { to { transform: rotate(360deg); } }

.prazdne { text-align: center; padding: 30px 16px; color: var(--dim); }
.prazdne p { margin-bottom: 16px; font-size: 14.5px; }

@media (min-width: 640px) {
  .makra { grid-template-columns: repeat(4, 1fr); }
}
