/* Tváře třídy — mobile first. Desktop je jen širší varianta téhož. */

:root {
  color-scheme: light dark;

  --barva: #4f46e5;
  --barva-tmava: #4338ca;
  --barva-svetla: #eef2ff;
  --pozadi: #f6f7f9;
  --plocha: #ffffff;
  --plocha-2: #f1f2f6;
  --text: #111827;
  --text-slaby: #6b7280;
  --linka: #e2e4ea;
  --zelena: #16a34a;
  --oranzova: #d97706;
  --cervena: #dc2626;

  --lista-spodni: calc(58px + env(safe-area-inset-bottom));
  --r: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --barva: #818cf8;
    --barva-tmava: #a5b4fc;
    --barva-svetla: #1e1b4b;
    --pozadi: #0b0d12;
    --plocha: #151922;
    --plocha-2: #1e232e;
    --text: #f3f4f6;
    --text-slaby: #9ca3af;
    --linka: #2a3040;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--pozadi);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior-y: none;
}

body { padding-bottom: var(--lista-spodni); }

h1, h2, h3 { margin: 0; font-weight: 700; line-height: 1.25; }
h1 { font-size: 1.3rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: 0.95rem; }
p { margin: 0 0 12px; }

.slaby { color: var(--text-slaby); font-size: 0.88rem; }
.stred { text-align: center; }
.rozpetí { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ---------- hlavička ---------- */

.hlavicka {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--plocha);
  border-bottom: 1px solid var(--linka);
}
.hlavicka img { width: 30px; height: 30px; border-radius: 8px; display: block; }
.hlavicka .zpet {
  border: 0; background: transparent; color: var(--barva);
  font-size: 1rem; font-weight: 600; padding: 8px 4px 8px 0; cursor: pointer;
}

/* ---------- obsah ---------- */

.obal { padding: 16px; max-width: 720px; margin: 0 auto; }

.karta {
  background: var(--plocha);
  border: 1px solid var(--linka);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 14px;
}
.karta.tesna { padding: 0; overflow: hidden; }

/* ---------- ovládací prvky ---------- */

button, .tlacitko {
  display: block; width: 100%;
  min-height: 50px; padding: 14px 18px;
  font: inherit; font-weight: 600;
  border: 0; border-radius: 12px;
  background: var(--barva); color: #fff;
  text-align: center; text-decoration: none;
  cursor: pointer;
}
button.druhy, .tlacitko.druhy { background: var(--plocha-2); color: var(--text); }
button.nebezpecny { background: transparent; color: var(--cervena); box-shadow: inset 0 0 0 1px var(--cervena); }
button.maly { min-height: 40px; padding: 8px 14px; width: auto; font-size: 0.9rem; border-radius: 10px; }
button:disabled { opacity: .5; cursor: default; }
button + button, .tlacitko + .tlacitko { margin-top: 10px; }

.velke-tlacitko {
  min-height: 96px;
  font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center; gap: 12px;
}
.velke-tlacitko svg { width: 30px; height: 30px; flex: none; }

label { display: block; margin: 14px 0 6px; font-weight: 600; font-size: 0.92rem; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 14px;
  font: inherit;
  background: var(--plocha); color: var(--text);
  border: 1px solid var(--linka); border-radius: 12px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--barva); outline-offset: -1px; }
textarea { min-height: 84px; resize: vertical; }

/* ---------- seznamy ---------- */

.radek {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 14px 16px;
  background: var(--plocha); border: 0; border-bottom: 1px solid var(--linka);
  text-align: left; color: inherit; font: inherit; font-weight: 400;
  min-height: 62px; border-radius: 0; cursor: pointer;
}
.radek:last-child { border-bottom: 0; }
.radek .hlavni { flex: 1; min-width: 0; }
.radek .nazev { font-weight: 600; }
.radek .popis { color: var(--text-slaby); font-size: 0.85rem; }
.radek .sipka { color: var(--text-slaby); flex: none; }

.odznak {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 700;
  background: var(--plocha-2); color: var(--text-slaby);
}
.odznak.ok { background: #dcfce7; color: #14532d; }
.odznak.chybi { background: #fef3c7; color: #78350f; }
@media (prefers-color-scheme: dark) {
  .odznak.ok { background: #052e16; color: #bbf7d0; }
  .odznak.chybi { background: #451a03; color: #fde68a; }
}

/* ---------- výběr třídy ---------- */

.chipy {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 4px 16px 12px; margin: 0 -16px;
  scrollbar-width: none;
}
.chipy::-webkit-scrollbar { display: none; }
.chip {
  flex: none; width: auto; min-height: 40px; padding: 9px 16px;
  border-radius: 999px; font-size: 0.95rem;
  background: var(--plocha); color: var(--text);
  box-shadow: inset 0 0 0 1px var(--linka);
}
.chip[aria-pressed="true"] { background: var(--barva); color: #fff; box-shadow: none; }

/* ---------- mřížka žáků ---------- */

.mrizka {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
}
.zak { text-align: center; background: transparent; padding: 0; min-height: 0; }
.zak .portret {
  width: 100%; aspect-ratio: 1; border-radius: 12px;
  background: var(--plocha-2); object-fit: cover; display: block;
  display: grid; place-items: center; color: var(--text-slaby); font-size: 1.6rem; font-weight: 700;
}
.zak .jmeno { font-size: 0.82rem; margin-top: 6px; font-weight: 600; line-height: 1.2; }

/* ---------- spodní lišta ---------- */

.lista {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex;
  background: var(--plocha);
  border-top: 1px solid var(--linka);
  padding-bottom: env(safe-area-inset-bottom);
}
.lista button {
  flex: 1; min-height: 58px; padding: 8px 4px;
  background: transparent; color: var(--text-slaby);
  border-radius: 0; font-size: 0.7rem; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
}
.lista button[aria-current="page"] { color: var(--barva); }
.lista svg { width: 22px; height: 22px; }

/* ---------- vysouvací panel ---------- */

.pozadi-panelu {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0,0,0,.45);
  display: flex; align-items: flex-end;
}
.panel {
  width: 100%; max-height: 88vh; overflow-y: auto;
  background: var(--plocha);
  border-radius: 20px 20px 0 0;
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
}
.panel .uchyt {
  width: 40px; height: 4px; border-radius: 99px;
  background: var(--linka); margin: 6px auto 14px;
}

/* ---------- hlášky ---------- */

.hlaska { border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-size: 0.92rem; }
.hlaska.chyba { background: #fef2f2; color: #7f1d1d; border: 1px solid #fecaca; }
.hlaska.info { background: var(--barva-svetla); color: var(--barva-tmava); }
@media (prefers-color-scheme: dark) {
  .hlaska.chyba { background: #450a0a; color: #fecaca; border-color: #7f1d1d; }
}

.prazdno { text-align: center; padding: 40px 20px; color: var(--text-slaby); }
.prazdno svg { width: 52px; height: 52px; opacity: .35; margin-bottom: 12px; }

.skryto { display: none !important; }

/* ---------- focení třídy (přes celou obrazovku) ---------- */

.foto-obal {
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column;
  background: #000; color: #fff;
}
.foto-vrch {
  display: flex; align-items: center; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) 14px 8px;
  font-weight: 600;
}
.foto-zavrit {
  width: 40px; min-height: 40px; padding: 0;
  border-radius: 999px; background: rgba(255,255,255,.14); color: #fff;
  font-size: 1.5rem; line-height: 1; flex: none;
}
.foto-scena {
  flex: 1; min-height: 0; position: relative;
  display: grid; place-items: center; overflow: hidden;
}
.foto-scena video, .foto-scena canvas {
  max-width: 100%; max-height: 100%; width: auto; height: auto;
  border-radius: 0; background: #000;
}
.foto-spodek { padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); }
.foto-akce { display: grid; place-items: center; }
.spoust {
  width: 72px; height: 72px; min-height: 72px; padding: 0;
  border-radius: 999px; background: #fff;
  box-shadow: 0 0 0 4px rgba(255,255,255,.3);
}
.spoust:disabled { background: #9ca3af; }
#f-zoom-obal { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
#f-zoom-obal input { flex: 1; }
#f-zoom-hodnota { font-variant-numeric: tabular-nums; font-size: 0.9rem; min-width: 44px; }
.foto-stav {
  text-align: center; font-size: 0.88rem; color: #d1d5db;
  margin-top: 10px; min-height: 20px;
}
