/* style.css — Emocije. Brend Terminia (R6) + dnevni/noćni režim (R5) + bez preliva (R14).
   Deca ≤7 (R13): velike mete (≥44px, ovde znatno veće), krupni emoji, malo teksta. */
:root {
  --brand: #0F6E56; --brand-dark: #085041; --brand-light: #E1F5EE; --accent: #5DCAA5;
  --paper: #EFE9DA; --ink: #2A2622; --muted: #6B6358; --chrome: #F5F2EA; --chip: #D8CFBB;
  --card-face: #FBF8F0;
  --bg: var(--paper); --text: var(--ink); --panel: var(--chrome); --border: var(--ink);
  --border-soft: color-mix(in srgb, var(--ink) 16%, transparent);
  --shadow: rgba(42,38,34,.28);
  --good: #3FA34D; --danger: #D64545;
  --font: 'Instrument Sans', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-play: 'Fredoka', var(--font);
}
:root[data-theme="night"] {
  --paper: #1A1F26; --ink: #D8D1BD; --muted: #8A8473; --chrome: #0A0C10; --chip: #2A3037;
  --card-face: #232A31;
  --shadow: rgba(0,0,0,.5); --border-soft: color-mix(in srgb, var(--ink) 20%, transparent);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* R14: nikad horizontalni preliv — nijedna aplikacija ne sme biti šira od ekrana */
html, body { margin: 0; height: 100dvh; width: 100%; max-width: 100%; overflow-x: hidden; background: var(--bg); color: var(--text); font-family: var(--font); }
body { display: flex; flex-direction: column; user-select: none; overflow: hidden; }

.topbar {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; flex-wrap: wrap; row-gap: 8px;
  background: var(--panel); border-bottom: 1px solid var(--border-soft); flex: 0 0 auto;
}
.back { color: var(--brand); font-weight: 600; text-decoration: none; white-space: nowrap; }
:root[data-theme="night"] .back { color: var(--accent); }
.title { flex: 1; min-width: 0; text-align: center; font-size: 18px; margin: 0; color: var(--ink); font-weight: 700; font-family: var(--font-play); }
.controls { display: flex; align-items: center; gap: 8px; }
.controls select {
  font: inherit; font-size: 14px; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; cursor: pointer;
}
.btn { background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 12px; font: inherit; font-weight: 600; cursor: pointer; }
.btn-round { width: 44px; height: 44px; padding: 0; display: grid; place-items: center; font-size: 18px; }

.stage { flex: 1 1 auto; display: flex; padding: 12px; min-height: 0; }
.game { flex: 1; display: flex; flex-direction: column; gap: 10px; min-height: 0; max-width: 720px; margin: 0 auto; width: 100%; }

.hud { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; row-gap: 6px; }
.hud-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; row-gap: 6px; }
.pill {
  display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--border-soft); color: var(--text);
  font-weight: 700; font-size: 14px; white-space: nowrap;
}
.pill.mono { font-variant-numeric: tabular-nums; min-width: 52px; justify-content: center; }

/* Igralište */
.play {
  position: relative; flex: 1 1 auto; min-height: 0; border-radius: 16px;
  background: var(--card-face); box-shadow: 0 8px 30px var(--shadow); overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 16px; text-align: center;
}
.question { margin: 0; font-family: var(--font-play); font-weight: 700; color: var(--brand);
  font-size: clamp(18px, 5vw, 28px); }
:root[data-theme="night"] .question { color: var(--accent); }

/* Prompt: veliko lice (emoji) ili reč/situacija */
.prompt { display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; max-width: 100%; min-height: 0; }
.prompt-face { font-size: clamp(72px, 26vw, 160px); line-height: 1; }
.prompt-word { font-family: var(--font-play); font-weight: 700; color: var(--ink);
  font-size: clamp(28px, 9vw, 56px); line-height: 1.1; max-width: 100%; word-break: break-word; }
.prompt-situation { font-family: var(--font-play); font-weight: 700; color: var(--ink);
  font-size: clamp(20px, 6vw, 34px); line-height: 1.25; max-width: 100%; }
.prompt.hidden { display: none; }

/* Opcije (velike mete — lica ili reči) */
.options { display: flex; flex-wrap: wrap; align-items: stretch; justify-content: center;
  gap: clamp(8px, 2vw, 14px); width: 100%; }
.answer {
  flex: 0 1 auto; min-width: 84px; min-height: 84px; padding: 10px 14px;
  border-radius: 18px; cursor: pointer; font: inherit;
  background: var(--bg); border: 3px solid var(--border-soft); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.answer:hover { border-color: var(--brand); }
.answer:active { transform: scale(0.96); }
.answer.kind-face .a-content { font-size: clamp(44px, 13vw, 72px); line-height: 1; }
.answer.kind-name .a-content { font-family: var(--font-play); font-weight: 700; font-size: clamp(20px, 6vw, 32px); line-height: 1.1; }
.answer.correct { border-color: var(--good); background: color-mix(in srgb, var(--good) 20%, var(--bg)); animation: pop .3s ease; }
.answer.wrong { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 18%, var(--bg)); animation: shake .3s ease; }
.answer:disabled { cursor: default; }
@keyframes pop { 0%,100% { transform: scale(1); } 45% { transform: scale(1.1); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.feedback { min-height: 24px; font-family: var(--font-play); font-weight: 700; font-size: 18px; }
.feedback.good { color: var(--good); }
.feedback.oops { color: var(--danger); }

/* Overlay (meni / rezultat) */
.overlay {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(3px);
  border-radius: 16px; padding: 16px; text-align: center; overflow-y: auto;
}
.overlay[hidden] { display: none; }
.overlay-card {
  background: var(--panel); border: 1px solid var(--border-soft); border-radius: 18px;
  padding: 20px; max-width: 460px; width: 100%; box-shadow: 0 12px 40px var(--shadow);
  max-height: 100%; overflow-y: auto;
}
.ov-title { margin: 0 0 6px; font-family: var(--font-play); font-size: 26px; color: var(--brand); }
:root[data-theme="night"] .ov-title { color: var(--accent); }
.ov-text { margin: 0 0 16px; color: var(--muted); font-size: 15px; line-height: 1.45; }

/* Birač režima (u meniju) */
.modes { display: flex; flex-direction: column; gap: 8px; margin: 0 0 16px; }
.mode-btn {
  width: 100%; text-align: center; padding: 12px 14px; border-radius: 14px;
  background: var(--bg); border: 2px solid var(--border-soft); color: var(--text);
  font: inherit; font-weight: 700; font-size: 16px; cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.mode-btn:hover { border-color: var(--brand); }
.mode-btn.selected { border-color: var(--brand); background: var(--brand-light); color: var(--brand-dark); }
:root[data-theme="night"] .mode-btn.selected { background: color-mix(in srgb, var(--accent) 20%, var(--bg)); color: var(--accent); }

.ov-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand-dark); padding: 12px 24px; font-weight: 700; }
.btn-primary:hover { background: var(--brand-dark); }

.footer { display: flex; align-items: center; justify-content: center; min-height: 22px; flex: 0 0 auto; }
.hint { color: var(--brand); font-size: 14px; font-weight: 700; text-align: center; padding: 0 8px; }
:root[data-theme="night"] .hint { color: var(--accent); }

@media (max-width: 420px) {
  .pill { font-size: 13px; padding: 5px 10px; }
  .ov-title { font-size: 23px; }
  .stage { padding: 8px; }
  .answer { min-width: 72px; min-height: 72px; }
}
