/* style.css — Piši broj. Brend Terminia (R6) + dnevni/noćni režim (R5) + deca ≤7 (R13). */
:root {
  --brand: #0F6E56; --brand-dark: #085041; --brand-light: #E1F5EE; --accent: #5DCAA5;
  /* Neutrale (papir/mastilo) */
  --paper: #EFE9DA; --ink: #2A2622; --muted: #6B6358; --chrome: #F5F2EA; --chip: #D8CFBB;
  --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);
  --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;
  --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; min-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; -webkit-user-select: none; touch-action: none; }

.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);
}
.back { color: var(--brand); font-weight: 700; text-decoration: none; white-space: nowrap; }
.title { flex: 1; min-width: 0; text-align: center; font-family: var(--font-play); font-size: 20px; margin: 0; color: var(--ink); font-weight: 700; }
.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; max-width: 42vw;
}
.btn { background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 16px; font: inherit; font-weight: 700; cursor: pointer; min-height: 44px; }
.btn-round { width: 44px; height: 44px; padding: 0; display: grid; place-items: center; font-size: 20px; }
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand-dark); font-family: var(--font-play); font-size: 18px; padding: 14px 28px; }
.btn-primary:active { background: var(--brand-dark); }

.stage { flex: 1; display: flex; justify-content: center; padding: 12px; min-height: 0; }
.game { width: 100%; max-width: 560px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }

.hud { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; row-gap: 8px; }
.hud-group { display: flex; align-items: center; gap: 8px; }
.pill { background: var(--panel); border: 1px solid var(--border-soft); border-radius: 999px; padding: 8px 14px; font-weight: 700; color: var(--ink); }
.pill.big { font-family: var(--font-play); font-size: 18px; }
.pill.mono { font-variant-numeric: tabular-nums; color: var(--muted); }

.board-wrap { position: relative; width: 100%; }
/* Kvadratno platno koje se skalira; nikad šire od ekrana (R14). */
#board {
  display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; max-width: 100%;
  background: var(--panel); border: 2px solid var(--border-soft); border-radius: 20px;
  touch-action: none; cursor: crosshair;
}

/* Pohvala (kratka animacija po napisanoj cifri) */
.praise {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
  font-family: var(--font-play); font-size: clamp(28px, 12vw, 64px); font-weight: 700; color: var(--brand);
  opacity: 0; transform: scale(.6);
}
.praise.show { animation: pop 1s ease; }
@keyframes pop {
  0% { opacity: 0; transform: scale(.5); }
  25% { opacity: 1; transform: scale(1.1); }
  70% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1); }
}

/* Overlay (meni / gotovo) */
.overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--paper) 78%, transparent); border-radius: 20px; }
.overlay[hidden] { display: none; }
.overlay-card {
  width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--border-soft);
  border-radius: 18px; padding: 22px; text-align: center; box-shadow: 0 12px 40px var(--shadow);
}
.ov-title { font-family: var(--font-play); margin: 0 0 8px; font-size: 24px; color: var(--brand); }
.ov-text { margin: 0 0 18px; color: var(--muted); line-height: 1.45; }
.ov-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

.footer { text-align: center; }
.hint { color: var(--muted); font-size: 14px; }
