/* Stojnica – skupni slog. Barve in mere so na :root. */
:root {
  --bg: #111317;
  --panel: #1b1f25;
  --panel-2: #242a32;
  --line: #333a44;
  --text: #f5f5f0;
  --muted: #a3aab5;
  --yellow: #ffc400;
  --ink: #161200;
  --green: #22c55e;
  --red: #ef4444;
  --orange: #f59e0b;
  --blue: #3b82f6;
  --r: 18px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.45;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
input, textarea { font: inherit; -webkit-user-select: text; user-select: text; }
a { color: var(--yellow); }
h1, h2, h3 { line-height: 1.1; margin: 0 0 .4em; }
[hidden] { display: none !important; }

/* ---------- Glava ---------- */
.stripes { height: 12px; background: repeating-linear-gradient(-45deg, var(--yellow) 0 20px, #0b0b0b 20px 40px); }
.topbar-in { display: flex; align-items: center; gap: 16px; padding: 12px clamp(16px, 3vw, 32px); }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark {
  flex: none; width: 46px; height: 46px; border-radius: 12px; overflow: hidden;
  display: grid; place-items: center;
  background: var(--yellow); color: var(--ink); font-weight: 900; font-size: 19px;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.brand-name { display: block; font-weight: 800; font-size: 19px; line-height: 1.1; }
.brand-sub { display: block; color: var(--muted); font-size: 14px; }
.page-title { flex: 1; text-align: center; font-weight: 800; font-size: clamp(18px, 2.2vw, 26px); }

/* ---------- Gumbi in osnovni elementi ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px; border-radius: 999px;
  border: 2px solid var(--line); background: var(--panel-2); color: var(--text);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  transition: transform .08s, background .15s, border-color .15s;
}
.btn:hover { background: #2d343e; }
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.btn-primary { background: var(--yellow); border-color: var(--yellow); color: var(--ink); }
.btn-primary:hover { background: #ffd23f; }
.btn-xl { min-height: 68px; padding: 0 40px; font-size: 24px; }
.btn-small { min-height: 40px; padding: 0 16px; font-size: 15px; }
.btn-ghost { background: transparent; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: clamp(16px, 2vw, 24px); }
.muted { color: var(--muted); }
.lead { font-size: clamp(18px, 1.6vw, 22px); color: var(--muted); margin: 0 0 .6em; }
.kicker { margin: 0 0 8px; font-size: 14px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--yellow); }
.hl { color: var(--yellow); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* ---------- QR ---------- */
.qr-box { width: 100%; max-width: 240px; aspect-ratio: 1; padding: 6px; border-radius: 12px; background: #fff; }
.qr-box svg { display: block; width: 100%; height: 100%; }
.qr-zoomable { cursor: zoom-in; }
.qr-error { margin: 0; padding: 8px; color: #b91c1c; font-size: 14px; }
.qr-zoom {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  background: rgba(8, 9, 11, .94); cursor: zoom-out;
}
.qr-zoom-code { width: min(80vh, 90vw); aspect-ratio: 1; padding: 12px; border-radius: 16px; background: #fff; }
.qr-zoom-code svg { display: block; width: 100%; height: 100%; }
.qr-zoom p { margin: 0; color: var(--muted); }

/* ---------- Začetni zaslon ---------- */
.home-main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr minmax(240px, 290px);
  grid-template-rows: auto 1fr;
  grid-template-areas: "hero side" "tiles side";
  align-content: start;
  gap: clamp(16px, 2vw, 28px);
  padding: clamp(12px, 2.4vw, 28px) clamp(16px, 3vw, 32px);
}
.hero { grid-area: hero; }
.hero h1 { font-size: clamp(34px, 4.2vw, 62px); font-weight: 900; letter-spacing: -.02em; margin-bottom: .25em; }
.tiles { grid-area: tiles; align-self: start; display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(12px, 1.6vw, 20px); }
.tile {
  display: flex; flex-direction: column; gap: 6px;
  padding: clamp(16px, 2vw, 26px); border-radius: var(--r);
  background: var(--panel); border: 2px solid var(--line);
  color: var(--text); text-decoration: none;
  transition: transform .12s, border-color .12s;
}
.tile:hover, .tile:focus-visible { border-color: var(--yellow); transform: translateY(-2px); outline: none; }
.tile:active { transform: scale(.98); }
.tile-icon { font-size: clamp(38px, 3.6vw, 52px); line-height: 1; }
.tile-name { font-size: clamp(22px, 2.1vw, 30px); font-weight: 800; line-height: 1.15; }
.tile-desc { color: var(--muted); }
.tile-meta { margin-top: auto; padding-top: 6px; font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--yellow); }
.side { grid-area: side; display: flex; flex-direction: column; gap: 16px; }
.board-card h2 { font-size: 20px; }
.board-card .kicker { margin-bottom: 4px; }
.board-card .board li { padding-block: 4px; }
.board-card .board li:nth-child(n+6) { display: none; }
.qr-card { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.qr-card .qr-box { max-width: 190px; }
.qr-card p { margin: 0; color: var(--muted); font-size: 16px; }
.qr-card strong { color: var(--text); font-size: 20px; }
.foot { position: fixed; left: 0; bottom: 0; padding: 6px 14px; font-size: 13px; }
.foot a { color: #5d6470; text-decoration: none; }

@media (min-width: 1200px) {
  .tiles { grid-template-columns: repeat(4, 1fr); }
}
/* Velik zaslon ali TV na stojnici: vse večje, da se vidi od daleč. */
@media (min-width: 1600px) and (min-height: 950px) {
  body { font-size: 20px; }
  .home-main { grid-template-columns: 1fr 340px; gap: 36px; }
  .hero h1 { font-size: 76px; }
  .tile { padding: 32px; }
  .tile-icon { font-size: 68px; }
  .tile-name { font-size: 36px; }
  .qr-card .qr-box { max-width: 260px; }
}
@media (max-width: 860px) {
  .home-main { grid-template-columns: 1fr; grid-template-areas: "hero" "tiles" "side"; }
}
@media (max-width: 540px) {
  .tiles { grid-template-columns: 1fr; }
  .brand-sub { display: none; }
}

/* ---------- Lestvica ---------- */
.board { list-style: none; margin: 0; padding: 0; counter-reset: rank; }
.board li { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-bottom: 1px solid var(--line); counter-increment: rank; }
.board li::before { content: counter(rank) "."; flex: none; width: 1.7em; color: var(--muted); font-weight: 700; }
.board li:nth-child(1)::before { content: "🥇"; }
.board li:nth-child(2)::before { content: "🥈"; }
.board li:nth-child(3)::before { content: "🥉"; }
.board .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.board .s { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--yellow); }
.board li.me { background: rgba(255, 196, 0, .16); border-radius: 8px; }
.board .del { width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--panel-2); color: var(--red); font-size: 20px; cursor: pointer; }
.board-empty { margin: 0; color: var(--muted); }

/* ---------- Igre: skupno ---------- */
.game-main {
  position: relative; flex: 1; min-height: 0;
  display: flex; flex-direction: column; gap: 12px;
  padding: 0 clamp(12px, 2vw, 28px) clamp(12px, 2vw, 20px);
}
.hud { display: flex; flex-wrap: wrap; align-items: center; gap: 12px clamp(16px, 3vw, 40px); }
.hud-item { display: flex; flex-direction: column; }
.hud-label { font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.hud-value { font-size: clamp(24px, 3vw, 36px); font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
.timebar { flex: 1; min-width: 160px; height: 14px; overflow: hidden; border-radius: 99px; background: var(--panel-2); }
.timebar span { display: block; width: 100%; height: 100%; border-radius: 99px; background: var(--yellow); transform-origin: left; }
.timebar.low span { background: var(--red); }

.intro {
  position: absolute; inset: 0; z-index: 5;
  display: grid; place-items: center; padding: 24px; text-align: center;
  background: rgba(17, 19, 23, .86); backdrop-filter: blur(3px);
}
.intro-in { max-width: 680px; }
.intro-icon { font-size: 72px; line-height: 1; margin-bottom: 12px; }
.intro h2 { font-size: clamp(34px, 4vw, 54px); font-weight: 900; }
.intro p { margin: 0 0 1.2em; font-size: clamp(18px, 1.9vw, 23px); color: #dfe3ea; }

/* ---------- Obvestilo ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 50;
  max-width: min(720px, calc(100vw - 32px));
  padding: 14px 20px; border: 2px solid var(--green); border-radius: 16px;
  background: #0b0d10; box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
  opacity: 0; transform: translate(-50%, 20px); pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-color: var(--red); }
.toast b { display: block; font-size: 20px; }

/* ---------- Končni zaslon ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center; padding: 16px;
  background: rgba(8, 9, 11, .88); backdrop-filter: blur(4px);
}
.end {
  width: min(1040px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
  display: grid; grid-template-columns: 1fr 260px; gap: 28px;
}
.end h2 { font-size: clamp(26px, 3vw, 38px); }
.big-score { margin: 4px 0 8px; font-size: clamp(54px, 7vw, 88px); font-weight: 900; line-height: 1; color: var(--yellow); font-variant-numeric: tabular-nums; }
.end-qr {
  position: sticky; top: 0; align-self: start;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 18px; border-radius: 16px; background: var(--panel-2); text-align: center;
}
.end-qr p { margin: 0; font-size: 16px; color: var(--muted); }
.end-qr strong { color: var(--text); }
.name-form { margin: 16px 0 12px; }
.name-form label { display: block; margin-bottom: 6px; font-weight: 700; }
.name-form input { flex: 1; min-width: 0; }
.name-form .saved { margin: 0; font-size: 20px; }
.field-input,
.name-form input {
  min-height: 52px; padding: 10px 14px;
  border: 2px solid var(--line); border-radius: 14px;
  background: var(--bg); color: var(--text); font-size: 20px;
}
input:focus, textarea:focus { outline: none; border-color: var(--yellow); }
.end-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 4px; }
.details { margin-top: 20px; }
.details h3 { font-size: 20px; }
.details ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.details li { padding: 10px 14px; border-radius: 12px; border-left: 5px solid var(--line); background: var(--panel-2); }
.details li.ok { border-left-color: var(--green); }
.details li.no { border-left-color: var(--red); }
.details li b { display: block; }
.details li span { font-size: 16px; color: var(--muted); }

@media (max-width: 760px) {
  .end { grid-template-columns: 1fr; }
  .end-qr { position: static; }
}
