:root {
  --bg: #eaf7f5;
  --card: #ffffff;
  --text: #12343b;
  --muted: #557377;
  --border: #cde8e3;
  --primary: #0e9384;
  --primary-dark: #0a6e63;
  --primary-soft: #d8f3ee;
  --blue: #1597c9;
  --yellow: #ffc83d;
  --yellow-dark: #e0a800;
  --coral: #ff7a59;
  --ok: #138a4a;
  --ok-soft: #ddf5e5;
  --danger: #d93a50;
  --danger-soft: #fde5e9;
  --shadow: 0 4px 0 #c7e6e0, 0 10px 30px rgba(14, 147, 132, 0.08);
}

* { box-sizing: border-box; }
html, body { overflow-x: clip; }
body {
  margin: 0;
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  line-height: 1.5;
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cg fill='%230e9384' fill-opacity='0.08' font-family='Georgia,serif' font-size='26'%3E%3Ctext x='18' y='40'%3Ei%3C/text%3E%3Ctext x='120' y='60'%3E%CF%80%3C/text%3E%3Ctext x='60' y='120'%3E%E2%88%9A%3C/text%3E%3Ctext x='165' y='150'%3E%E2%84%82%3C/text%3E%3Ctext x='20' y='190'%3E%E2%88%9E%3C/text%3E%3Ctext x='110' y='205'%3E%3D%3C/text%3E%3C/g%3E%3C/svg%3E");
}
h1, h2, .brand, .btn, .chip, .sat, .velik, .ponuda .slovo, .podij .mjesto { font-family: "Baloo 2", "Nunito", system-ui, sans-serif; }
h1 { font-size: 2rem; line-height: 1.15; margin: 0 0 8px; font-weight: 800; }
h2 { font-size: 1.3rem; margin: 0 0 14px; font-weight: 700; }
.sakriveno { display: none !important; }
.muted { color: var(--muted); }

/* Zaglavlje */
.zaglavlje { max-width: 1040px; margin: 0 auto; padding: 18px 16px 6px; }
.brand { font-weight: 800; font-size: 1.25rem; color: var(--text); text-decoration: none; display: inline-flex; align-items: center; }
.brand-znak {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; margin-right: 10px;
  border-radius: 12px; background: var(--yellow); font-size: 1.4rem; font-style: italic;
  transform: rotate(-8deg); box-shadow: 0 3px 0 var(--yellow-dark);
}
main { max-width: 640px; margin: 0 auto; padding: 8px 16px 48px; }
main.siroko { max-width: 1040px; }

/* Kartice */
.kartica {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 24px;
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--primary) 0%, var(--blue) 65%, var(--yellow) 140%);
  color: #fff; border-radius: 28px; padding: 26px 24px;
  box-shadow: 0 6px 0 var(--primary-dark);
  margin-bottom: 20px;
}
.hero > * { position: relative; z-index: 1; }
.hero p { margin: 0; color: rgba(255, 255, 255, 0.9); font-size: 1.05rem; }
.hero-oznaka {
  display: inline-block; background: var(--yellow); color: var(--text);
  font-weight: 700; font-size: 0.8rem; padding: 3px 12px; border-radius: 99px; margin-bottom: 10px;
  transform: rotate(-2deg);
}
.hero .simboli { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.simboli span {
  position: absolute; font-family: "Baloo 2", Georgia, serif; font-weight: 800; line-height: 1;
  color: rgba(255, 255, 255, 0.18); animation: lebdi 6s ease-in-out infinite;
}
.simboli .s1 { font-size: 6.5rem; right: 4%; top: -10%; font-style: italic; }
.simboli .s2 { font-size: 3rem; right: 26%; bottom: 4%; animation-delay: -2s; color: rgba(255, 200, 61, 0.6); }
.simboli .s3 { font-size: 3.6rem; right: 2%; bottom: -12%; animation-delay: -4s; }
.simboli .s4 { font-size: 2.4rem; right: 38%; top: 8%; animation-delay: -1s; color: rgba(255, 122, 89, 0.55); }
@keyframes lebdi { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-8px) rotate(6deg); } }
@media (prefers-reduced-motion: reduce) { .simboli span { animation: none; } }
@media (max-width: 600px) {
  h1 { font-size: 1.7rem; }
  .simboli .s2, .simboli .s4 { display: none; }
}

/* Obrasci */
label { display: block; font-weight: 700; margin: 14px 0 6px; }
input, select {
  width: 100%;
  font: inherit; font-size: 1.1rem;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 1.15rem; font-weight: 700;
  padding: 12px 22px;
  border-radius: 16px;
  border: 2px solid var(--primary-dark);
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--primary-dark);
  transition: transform 0.1s, box-shadow 0.1s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--primary-dark); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.zuti { background: var(--yellow); border-color: var(--yellow-dark); color: var(--text); box-shadow: 0 4px 0 var(--yellow-dark); }
.btn.sporedni { background: #fff; color: var(--primary-dark); border-color: var(--border); box-shadow: 0 4px 0 var(--border); }
.btn.puno { width: 100%; margin-top: 20px; }
.greska { color: var(--danger); font-weight: 700; margin: 10px 0 0; }
.savjet { font-size: 0.9rem; color: var(--muted); margin: 12px 0 0; }
.uputa { font-weight: 700; background: #fff6d6; border: 2px solid var(--yellow); border-radius: 12px; padding: 10px 14px; margin: 14px 0 0; }

/* Odabir kviza */
.kvizovi { display: grid; gap: 10px; }
.kviz-izbor {
  text-align: left; width: 100%; cursor: pointer;
  border: 2px solid var(--border); border-radius: 18px; background: #fff; color: var(--text);
  padding: 14px 16px; font: inherit; box-shadow: 0 4px 0 var(--border);
}
.kviz-izbor strong { display: block; font-family: "Baloo 2", system-ui, sans-serif; font-size: 1.15rem; }
.kviz-izbor.odabrano { border-color: var(--primary); box-shadow: 0 4px 0 var(--primary); background: var(--primary-soft); }
.chipovi { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 99px; background: var(--primary-soft); color: var(--primary-dark); font-weight: 700; font-size: 0.85rem; }
.prazno { text-align: center; padding: 20px 8px; color: var(--muted); }

/* Pitanje */
.traka-gore { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; }
.chip.velik { font-size: 1.05rem; padding: 4px 14px; }
.sat {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 800; font-size: 1.2rem; font-variant-numeric: tabular-nums;
  background: #fff; border: 2px solid var(--border); border-radius: 99px; padding: 2px 14px;
}
.sat.malo { background: var(--yellow); border-color: var(--yellow-dark); animation: puls 1s ease-in-out infinite; }
@keyframes puls { 50% { transform: scale(1.06); } }
.tockice { display: flex; gap: 4px; margin-bottom: 14px; }
.tockice i { flex: 1; height: 8px; border-radius: 99px; background: var(--border); }
.tockice i.gotovo { background: var(--primary); }
.tockice i.sada { background: var(--yellow); }
.vrijeme-traka { height: 6px; background: var(--primary-soft); border-radius: 99px; overflow: hidden; margin: -4px 0 18px; }
.vrijeme-traka > div { height: 100%; background: var(--primary); transition: width 1s linear; }
.tekst-pitanja { white-space: pre-line; font-size: 1.3rem; font-weight: 700; margin-bottom: 16px; overflow-x: auto; overflow-y: hidden; }
.ravnina { display: flex; justify-content: center; margin: 0 0 16px; }
.ravnina svg { width: 100%; max-width: 300px; height: auto; background: #fff; border: 2px solid var(--border); border-radius: 18px; }

.kompleksni { display: flex; align-items: center; gap: 8px; }
.kompleksni .znak { font-size: 1.5rem; font-weight: 800; font-family: "Baloo 2", system-ui, sans-serif; }
.polje { flex: 1; display: flex; gap: 6px; min-width: 0; }
.polje input { min-width: 0; text-align: center; font-size: 1.3rem; font-weight: 700; }
.plusminus {
  flex: 0 0 auto; width: 46px; border-radius: 14px; cursor: pointer;
  border: 2px solid var(--border); background: var(--primary-soft); color: var(--primary-dark);
  font-size: 1.2rem; font-weight: 800;
}
.opisi-polja { display: flex; gap: 8px; margin-top: 6px; font-size: 0.8rem; color: var(--muted); text-align: center; }
.opisi-polja span { flex: 1; }
.opisi-polja span.prazan { flex: 0 0 22px; }

.ponude { display: grid; gap: 10px; }
.ponuda {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer;
  border: 2px solid var(--border); border-radius: 18px; background: #fff; color: var(--text);
  padding: 12px 14px; font: inherit; font-size: 1.1rem; box-shadow: 0 4px 0 var(--border);
  overflow-x: auto; transition: transform 0.1s;
}
.ponuda .slovo {
  flex: 0 0 34px; height: 34px; display: grid; place-items: center;
  border-radius: 10px; background: var(--primary-soft); color: var(--primary-dark); font-weight: 800;
}
.ponuda.odabrano { border-color: var(--primary); box-shadow: 0 4px 0 var(--primary); background: var(--primary-soft); transform: rotate(-1deg); }
.ponuda.odabrano .slovo { background: var(--primary); color: #fff; }

/* Rezultat */
.velik-rezultat { font-size: 3rem; font-weight: 800; line-height: 1; margin: 6px 0 10px; font-family: "Baloo 2", system-ui, sans-serif; }
.stavka { border-radius: 18px; padding: 14px; margin-bottom: 12px; border: 2px solid var(--border); background: #fff; }
.stavka.tocno { background: var(--ok-soft); border-color: #b7e6c8; }
.stavka.netocno { background: var(--danger-soft); border-color: #f6c3cc; }
.stavka .naslov { font-weight: 800; margin-bottom: 4px; font-family: "Baloo 2", system-ui, sans-serif; font-size: 1.05rem; }
.stavka.tocno .naslov { color: var(--ok); }
.stavka.netocno .naslov { color: var(--danger); }
.stavka .tekst { white-space: pre-line; }
.stavka .tekst, .stavka .rjesenje { overflow-x: auto; overflow-y: hidden; }
.stavka .rjesenje { margin-top: 6px; padding-top: 6px; border-top: 1px dashed rgba(18, 52, 59, 0.2); }

/* Nastavnik */
.mreza { display: grid; gap: 20px; }
@media (min-width: 860px) { .mreza { grid-template-columns: 340px 1fr; align-items: start; } }
.qr-kartica { text-align: center; }
#qr { background: #fff; padding: 12px; border-radius: 18px; border: 2px solid var(--border); width: 100%; max-width: 280px; margin: 0 auto 12px; aspect-ratio: 1; }
#qr svg { width: 100%; height: 100%; display: block; }
.poveznica { font-family: "Baloo 2", system-ui, sans-serif; font-size: 1.35rem; font-weight: 800; word-break: break-all; color: var(--primary-dark); }
.alati { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.alati > div { flex: 1 1 150px; }
.alati label { margin-top: 0; }
.prekidac { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--muted); margin-top: 12px; }
.prekidac input { width: 20px; height: 20px; accent-color: var(--primary); }

.podij { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; align-items: end; margin-bottom: 18px; }
.podij > div { text-align: center; min-width: 0; }
.podij .ime { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podij .bodovi { color: var(--muted); font-size: 0.9rem; }
.podij .stup { margin-top: 6px; border-radius: 16px 16px 6px 6px; display: grid; place-items: center; color: #fff; }
.podij .mjesto { font-size: 2rem; font-weight: 800; }
.podij .m1 .stup { height: 110px; background: var(--yellow); color: var(--text); box-shadow: 0 4px 0 var(--yellow-dark); }
.podij .m2 .stup { height: 80px; background: var(--primary); box-shadow: 0 4px 0 var(--primary-dark); }
.podij .m3 .stup { height: 60px; background: var(--coral); box-shadow: 0 4px 0 #d9583a; }

.tablica-omot { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 8px; border-bottom: 2px solid var(--primary-soft); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
td.rang { font-family: "Baloo 2", system-ui, sans-serif; font-weight: 800; font-size: 1.1rem; }
tr.ponovljeno td { color: var(--muted); text-decoration: line-through; }
.postotak { display: inline-block; min-width: 52px; padding: 1px 8px; border-radius: 99px; font-weight: 700; text-align: center; }
.postotak.visok { background: var(--ok-soft); color: var(--ok); }
.postotak.srednji { background: #fff1cf; color: #8a5a00; }
.postotak.nizak { background: var(--danger-soft); color: var(--danger); }

/* Nastavnik na mobitelu */
.mreza > * { min-width: 0; }
.razred-ispod { display: none; font-size: 0.8rem; color: var(--muted); }
@media (max-width: 700px) {
  .mreza { display: flex; flex-direction: column; }
  .qr-kartica { order: 2; }
  #qr { max-width: 200px; }
  .alati > div { flex-basis: 100%; }
  .alati .btn { flex: 1 1 0; }
  .kartica { padding: 18px 16px; }
  th.siroko, td.siroko { display: none; }
  .razred-ispod { display: block; }
  td.ime { white-space: normal; }
  .postotak { min-width: 0; }
  th, td { padding: 10px 5px; }
  th { letter-spacing: 0; }
  .podij .mjesto { font-size: 1.5rem; }
  .podij .m1 .stup { height: 80px; }
  .podij .m2 .stup { height: 60px; }
  .podij .m3 .stup { height: 44px; }
}

/* Navigacija i čekanje */
.navigacija { display: flex; gap: 10px; margin-top: 20px; }
.navigacija .btn { flex: 1; }
.navigacija .btn.sporedni { flex: 0 0 auto; }
.tockice button { flex: 1; height: 12px; padding: 0; border: 0; border-radius: 99px; background: var(--border); cursor: pointer; }
.tockice button.gotovo { background: var(--primary); }
.tockice button.sada { background: var(--yellow); }
.cekanje { text-align: center; padding: 36px 22px; }
.pjescani-sat { font-size: 3.5rem; display: inline-block; animation: okreni 2.4s ease-in-out infinite; }
@keyframes okreni { 0%, 40% { transform: rotate(0); } 50%, 90% { transform: rotate(180deg); } 100% { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pjescani-sat { animation: none; } }

/* Sat nastavnika */
.sat-nastavnik { text-align: center; margin-top: 18px; padding: 18px 12px; border-radius: 20px; background: var(--primary-soft); }
.veliki-sat { font-family: "Baloo 2", system-ui, sans-serif; font-weight: 800; font-size: 4.5rem; line-height: 1; font-variant-numeric: tabular-nums; color: var(--muted); }
.veliki-sat.tece { color: var(--primary-dark); }
.veliki-sat.malo { color: var(--danger); animation: puls 1s ease-in-out infinite; }
.sat-nastavnik .muted { margin: 8px 0 14px; }
.gumbi-sata { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.ocjena { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; font-family: "Baloo 2", system-ui, sans-serif; font-weight: 800; font-size: 1.1rem; }
.ocjena.o5 { background: var(--ok-soft); color: var(--ok); }
.ocjena.o4 { background: var(--primary-soft); color: var(--primary-dark); }
.ocjena.o3 { background: #fff1cf; color: #8a5a00; }
.ocjena.o2 { background: #ffe6dc; color: #b8451f; }
.ocjena.o1 { background: var(--danger-soft); color: var(--danger); }

/* Detalji učenika */
.ime-gumb { background: none; border: 0; padding: 0; font: inherit; color: var(--primary-dark); font-weight: 700; text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; cursor: pointer; text-align: left; }
.detalji { width: min(720px, calc(100vw - 24px)); max-height: calc(100vh - 40px); border: 2px solid var(--border); border-radius: 24px; padding: 20px; background: var(--card); color: var(--text); }
.detalji::backdrop { background: rgba(18, 52, 59, 0.45); }
.detalji-zaglavlje { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 12px; }
.detalji-zaglavlje h2 { margin: 0; }
.detalji-zaglavlje p { margin: 4px 0 0; }
.detalji-zaglavlje .btn { padding: 6px 14px; }
.stavka .odgovori { margin-top: 6px; display: grid; gap: 2px; }

/* Slike postupka */
label.btn { box-sizing: border-box; }
.slike-popis { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-top: 14px; }
.slika-stavka { border: 2px solid var(--border); border-radius: 14px; overflow: hidden; background: #fff; font-size: 0.8rem; font-weight: 700; text-align: center; }
.slika-stavka img { display: block; width: 100%; height: 96px; object-fit: cover; background: var(--border); }
.slika-stavka span { display: block; padding: 4px; }
.slika-stavka.ok { border-color: #b7e6c8; color: var(--ok); }
.slika-stavka.ne { border-color: #f6c3cc; color: var(--danger); }
.ima-slike { display: inline-block; margin-left: 6px; font-size: 0.8rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.detalji-slike { margin-bottom: 16px; }
.detalji-slike h3 { margin: 0 0 10px; font-size: 1.05rem; }
.detalji-slike figure { margin: 0 0 14px; border: 2px solid var(--border); border-radius: 16px; overflow: hidden; background: #fff; }
.detalji-slike img { display: block; width: 100%; min-height: 80px; background: var(--border); }
.detalji-slike figcaption { display: flex; justify-content: space-between; padding: 8px 12px; font-size: 0.9rem; font-weight: 700; }
.detalji-slike a { color: var(--primary-dark); }
#rezultat-bodovi a { color: #fff; font-weight: 700; }
.btn.opasno { background: #fff; color: var(--danger); border-color: #f6c3cc; box-shadow: 0 4px 0 #f6c3cc; }
