:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --text: #1c1c1e;
  --muted: #6e6e73;
  --border: #d4d3cd;
  --tile-empty: #ffffff;
  --key: #e2e1db;
  --correct: #4f9d57;
  --present: #d0a52c;
  --absent: #232427; /* napačne črke: skoraj črne */
  --absent-text: #f2f2f4;
  --p0: #2f6fdb;
  --p1: #e0573a;
  --solve: #8a4fd6;
  --danger: #d23c3c;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121214;
    --surface: #1c1c1f;
    --text: #f2f2f4;
    --muted: #9a9aa1;
    --border: #3a3a3f;
    --tile-empty: #1c1c1f;
    --key: #3b3b40;
    --absent: #050506; /* v temnem načinu povsem črne */
    --absent-text: #8d8d94;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
  touch-action: manipulation;
}
body.in-game { height: 100vh; height: 100dvh; overflow: hidden; }
body.in-game .topbar { display: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

.topbar {
  width: 100%;
  max-width: 520px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.logo { margin: 0; font-size: 1.4rem; letter-spacing: 0.12em; font-weight: 800; }
.logo span { font-weight: 400; letter-spacing: 0.02em; color: var(--muted); margin-left: 6px; font-size: 1rem; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid var(--border); background: none; color: var(--text);
  font-weight: 700; cursor: pointer;
}

.screen { width: 100%; max-width: 520px; flex: 1; display: flex; flex-direction: column; align-items: center; padding: 16px; }
.card { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 24px; width: 100%; }

.home-card { display: flex; flex-direction: column; gap: 12px; margin-top: 4vh; }
.lead { margin: 0 0 8px; color: var(--muted); line-height: 1.45; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--muted); }
input {
  font: inherit; font-size: 1rem; padding: 12px 14px; border-radius: 10px;
  border: 2px solid var(--border); background: var(--bg); color: var(--text); outline: none;
}
input:focus { border-color: var(--p0); }
.join-row { display: flex; gap: 8px; }
.join-row input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: 0.3em; text-align: center; font-weight: 700; }
.msg { min-height: 1.2em; margin: 0; color: var(--p1); font-size: 0.9rem; text-align: center; }

.btn {
  font: inherit; font-weight: 700; font-size: 1rem; padding: 13px 18px; border-radius: 10px;
  border: 2px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
  transition: transform 0.1s, filter 0.15s;
}
.btn:hover { filter: brightness(0.97); }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--correct); border-color: var(--correct); color: #fff; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: none; color: var(--muted); }
.btn.small { padding: 8px 14px; font-size: 0.9rem; }
.btn:disabled { opacity: 0.5; cursor: default; }

.wait-card { text-align: center; margin-top: 6vh; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.wait-card h2 { margin: 0; }
.code { font-size: 2.6rem; font-weight: 800; letter-spacing: 0.3em; margin: 8px 0 12px; padding-left: 0.3em; }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 4px solid var(--border); border-top-color: var(--correct); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ================= IGRA ================= */
#screen-game { padding: 8px 8px 6px; gap: 6px; position: relative; min-height: 0; user-select: none; -webkit-user-select: none; }

.scoreboard { width: 100%; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.player {
  display: flex; flex-direction: column; padding: 5px 10px; border-radius: 12px;
  background: var(--surface); box-shadow: var(--shadow); border: 2px solid transparent;
  transition: border-color 0.25s, transform 0.25s; min-width: 0;
}
.player.p1 { text-align: right; }
.player .pname { font-size: 0.8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player .pname .you { font-size: 0.7rem; font-weight: 700; margin-left: 4px; }
.player .pscore { font-size: 1.45rem; font-weight: 800; font-variant-numeric: tabular-nums; display: inline-block; }
.player.p1 .pscore { align-self: flex-end; }
.player.p0 .pscore { color: var(--p0); }
.player.p1 .pscore { color: var(--p1); }
.player.p0.active { border-color: var(--p0); transform: translateY(-1px); }
.player.p1.active { border-color: var(--p1); transform: translateY(-1px); }
.player.offline { opacity: 0.45; }
.pscore.bump { animation: bump 0.55s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes bump { 35% { transform: scale(1.35); } }

.center { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.menu-btn {
  display: flex; align-items: center; gap: 4px; border: none; background: none; color: var(--muted);
  font: inherit; font-size: 0.72rem; font-weight: 700; padding: 3px 8px; border-radius: 8px; cursor: pointer;
}
.menu-btn:active { background: var(--key); }
.timer { font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.timer.low { color: var(--p1); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.15); } }

.turn-banner { font-weight: 700; font-size: 0.95rem; min-height: 1.3em; text-align: center; }
.turn-banner.mine { color: var(--correct); }
.turn-banner.t0 { color: var(--p0); }
.turn-banner.t1 { color: var(--p1); }
.turn-banner.enter { animation: slideDown 0.35s ease-out; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } }

/* ---- štiri plošče ---- */
.boards {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  /* velikost ploščice: najmanjša od širine in višine, da tipkovnica vedno ostane vidna */
  --t: clamp(16px, min(calc((min(100vw, 520px) - 82px) / 10), calc((100dvh - var(--chrome, 362px)) / 12)), 44px);
  --g: 3px;
}
.bd {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 5px 6px 6px;
  border-radius: 12px;
  background: var(--surface);
  border: 2px solid transparent;
  transition: transform 0.2s ease, border-color 0.2s, box-shadow 0.2s, opacity 0.3s;
}
.bd.selectable { cursor: pointer; }
.bd.selectable:not(.selected):hover { border-color: var(--border); }
.bd.selected {
  border-color: var(--turn);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--turn) 22%, transparent), var(--shadow);
  transform: scale(1.015);
  z-index: 1;
}
.bd.opp-focus { border-color: var(--turn); border-style: dashed; }
.bd.nudge { animation: nudge 0.35s; }
@keyframes nudge { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.bd-head { width: 100%; display: flex; justify-content: space-between; align-items: center; font-size: 0.7rem; color: var(--muted); font-weight: 700; line-height: 1; }
.bd-num {
  width: 16px; height: 16px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--key); color: var(--text); font-size: 0.65rem;
}
.bd.selected .bd-num { background: var(--turn); color: #fff; }
.bd-grid { display: grid; gap: var(--g); transition: opacity 0.6s, filter 0.6s; }

.row { display: grid; grid-template-columns: repeat(5, var(--t)); gap: var(--g); position: relative; }
.tile {
  width: var(--t); height: var(--t);
  border: 2px solid var(--border); border-radius: 3px; background: var(--tile-empty);
  display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--t) * 0.52); font-weight: 800; text-transform: uppercase; line-height: 1;
  backface-visibility: hidden;
}
.tile.filled { border-color: var(--muted); animation: pop 0.12s ease-out; }
.tile.correct, .tile.present, .tile.absent { border-color: transparent; color: #fff; }
.tile.correct { background: var(--correct); }
.tile.present { background: var(--present); }
.tile.absent { background: var(--absent); color: var(--absent-text); }
.row.next .tile { border-color: color-mix(in srgb, var(--border) 60%, var(--text) 25%); }
.row.input .tile { border-color: color-mix(in srgb, var(--border) 50%, var(--text) 35%); }
.row.input .tile.filled { border-color: var(--text); }
.row.input.opp .tile { border-style: dashed; }
.row.input.opp .tile.filled { background: var(--key); border-color: var(--muted); animation: none; }
.row.shake { animation: shake 0.4s; }
@keyframes pop { 50% { transform: scale(1.12); } }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

/* točke ob vrstici: majhna značka v barvi igralca */
.pts {
  position: absolute; right: calc(var(--g) * -1 - 4px); top: -5px;
  min-width: 16px; padding: 1px 4px; border-radius: 8px;
  font-size: 0.6rem; font-weight: 800; color: #fff; text-align: center; line-height: 1.3;
  pointer-events: none; z-index: 2;
}
.pts:empty { display: none; }
.pts.p0 { background: var(--p0); }
.pts.p1 { background: var(--p1); }
.pts.pop { animation: ptsPop 0.7s cubic-bezier(0.3, 1.6, 0.5, 1) both; }
@keyframes ptsPop {
  0% { opacity: 0; transform: translateY(6px) scale(0.3); }
  60% { opacity: 1; transform: translateY(-4px) scale(1.25); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* razkritje: ploščica se obrne in barvo pokaže šele na polovici obrata */
.tile.flip { animation-duration: 0.6s; animation-timing-function: ease-in-out; animation-fill-mode: both; }
.tile.flip.correct { animation-name: flipCorrect; }
.tile.flip.present { animation-name: flipPresent; }
.tile.flip.absent { animation-name: flipAbsent; }
@keyframes flipCorrect {
  0%, 49% { background: var(--tile-empty); border-color: var(--muted); color: var(--text); }
  0% { transform: rotateX(0); }
  50% { transform: rotateX(-90deg); }
  50.01%, 100% { background: var(--correct); border-color: transparent; color: #fff; }
  100% { transform: rotateX(0); }
}
@keyframes flipPresent {
  0%, 49% { background: var(--tile-empty); border-color: var(--muted); color: var(--text); }
  0% { transform: rotateX(0); }
  50% { transform: rotateX(-90deg); }
  50.01%, 100% { background: var(--present); border-color: transparent; color: #fff; }
  100% { transform: rotateX(0); }
}
@keyframes flipAbsent {
  0%, 49% { background: var(--tile-empty); border-color: var(--muted); color: var(--text); }
  0% { transform: rotateX(0); }
  50% { transform: rotateX(-90deg); }
  50.01%, 100% { background: var(--absent); border-color: transparent; color: var(--absent-text); }
  100% { transform: rotateX(0); }
}

/* ---- rešena beseda: val skokov, sij, konfeti, nato značka ---- */
.tile.jump { animation: jump 0.65s cubic-bezier(0.3, 0.7, 0.4, 1) both; }
@keyframes jump {
  0% { transform: translateY(0); }
  30% { transform: translateY(-55%) scale(1.08); }
  55% { transform: translateY(0) scale(0.96, 1.04); }
  72% { transform: translateY(-14%); }
  100% { transform: translateY(0); }
}
.bd.by0 { --win: var(--p0); }
.bd.by1 { --win: var(--p1); }
.bd.celebrate { animation: glow 1.7s ease-out; border-color: var(--correct); }
@keyframes glow {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--correct) 70%, transparent); transform: scale(1); }
  25% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--correct) 25%, transparent); transform: scale(1.04); }
  100% { box-shadow: 0 0 0 18px transparent; transform: scale(1); }
}
.bd.solved:not(.celebrate) .bd-grid,
.bd.failed .bd-grid { opacity: 0.22; filter: saturate(0.5); }
.bd.solved:not(.celebrate) { border-color: color-mix(in srgb, var(--correct) 55%, transparent); }

.bd-badge {
  position: absolute; inset: 22px 6px 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  opacity: 0; transform: scale(0.6); pointer-events: none;
  transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.bd.solved:not(.celebrate) .bd-badge,
.bd.failed .bd-badge { opacity: 1; transform: scale(1); }
.bdg-word {
  font-size: calc(var(--t) * 0.62); font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 4px 8px; border-radius: 8px; background: var(--correct); color: #fff;
}
.bd.failed .bdg-word { background: var(--absent); color: #fff; }
.bdg-label { font-size: 0.7rem; color: var(--muted); font-weight: 700; }
.bdg-who { font-size: 0.8rem; font-weight: 800; padding: 2px 8px; border-radius: 10px; color: #fff; }
.bdg-who.p0 { background: var(--p0); }
.bdg-who.p1 { background: var(--p1); }

.confetti { position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; z-index: 3; }
.confetti i {
  position: absolute; width: 7px; height: 11px; border-radius: 2px; left: -3px; top: -5px;
  animation: burst 1.3s cubic-bezier(0.15, 0.7, 0.3, 1) both;
}
@keyframes burst {
  0% { transform: translate(0, 0) rotate(0) scale(0.4); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate(var(--dx), calc(var(--dy) + 70px)) rotate(var(--rot)) scale(1); opacity: 0; }
}

/* ---- tipkovnica ---- */
.keyboard { width: 100%; display: flex; flex-direction: column; gap: 5px; margin-top: auto; padding-bottom: 4px; }
.krow { display: flex; gap: 4px; justify-content: center; }
.key {
  flex: 1; min-width: 0; max-width: 44px; height: clamp(38px, 6.6dvh, 54px); border: none; border-radius: 6px;
  background: var(--key); color: var(--text);
  font: inherit; font-weight: 700; font-size: 1rem; text-transform: uppercase; cursor: pointer; padding: 0;
  transition: background-color 0.3s, color 0.3s, opacity 0.2s;
}
.key.wide { max-width: 68px; flex: 1.6; font-size: 0.72rem; }
.key.correct { background: var(--correct); color: #fff; }
.key.present { background: var(--present); color: #fff; }
.key.absent { background: var(--absent); color: var(--absent-text); }
.key.tap { animation: keytap 0.15s ease-out; }
@keyframes keytap { 50% { transform: scale(0.9); } }
.keyboard.locked .key { opacity: 0.5; }

/* ---- končni zaslon ---- */
.overlay {
  position: absolute; inset: 0; z-index: 5; padding: 16px;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(4px);
  animation: fadeIn 0.4s ease;
}
@keyframes fadeIn { from { opacity: 0; } }
.overlay-card { text-align: center; max-width: 400px; }
.overlay-card.pop-in { animation: cardIn 0.55s cubic-bezier(0.3, 1.5, 0.5, 1); }
@keyframes cardIn { from { opacity: 0; transform: translateY(20px) scale(0.9); } }
.overlay-card h2 { margin: 0 0 6px; }
.big-emoji { font-size: 3rem; line-height: 1; margin-bottom: 6px; animation: trophy 1s cubic-bezier(0.3, 1.6, 0.5, 1) 0.2s both; }
@keyframes trophy { from { transform: scale(0) rotate(-30deg); } }
.final-score { font-size: 1.15rem; margin: 6px 0 4px; }
.overlay-card .sub { color: var(--muted); margin: 4px 0 14px; }
.overlay-card table { width: 100%; border-collapse: collapse; margin: 10px 0 16px; font-size: 0.95rem; }
.overlay-card td, .overlay-card th { padding: 6px 4px; border-bottom: 1px solid var(--border); }
.overlay-card th { color: var(--muted); font-weight: 600; font-size: 0.8rem; }
.overlay-card td.w { text-transform: uppercase; font-weight: 700; letter-spacing: 0.1em; text-align: left; }
.overlay-card .actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.c0 { color: var(--p0); } .c1 { color: var(--p1); }

.toast {
  position: fixed; top: calc(12px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%) translateY(-10px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-weight: 700;
  max-width: calc(100vw - 32px); text-align: center;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 20;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- okna ---- */
dialog { border: none; border-radius: 16px; background: var(--surface); color: var(--text); max-width: 440px; width: calc(100vw - 32px); box-shadow: var(--shadow); line-height: 1.5; }
dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
dialog[open] { animation: cardIn 0.3s cubic-bezier(0.3, 1.4, 0.5, 1); }
dialog ul { padding-left: 20px; }
dialog h2 { margin-top: 4px; }
dialog .sub { color: var(--muted); margin-top: 0; }
.sheet-actions { display: flex; flex-direction: column; gap: 8px; }
.chip { display: inline-block; min-width: 34px; text-align: center; padding: 1px 6px; border-radius: 6px; color: #fff; font-weight: 700; font-size: 0.85rem; }
.chip.present { background: var(--present); }
.chip.correct { background: var(--correct); }
.chip.solve { background: var(--solve); }

/* stikalo: brez časovne omejitve */
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.switch .sw { flex: none; position: relative; width: 46px; height: 28px; border-radius: 14px; background: var(--border); transition: background 0.2s; }
.switch .sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.3); transition: transform 0.25s cubic-bezier(0.3, 1.4, 0.5, 1); }
.switch input:checked + .sw { background: var(--correct); }
.switch input:checked + .sw::after { transform: translateX(18px); }
.switch input:focus-visible + .sw { outline: 2px solid var(--p0); outline-offset: 2px; }
.sw-text { display: flex; flex-direction: column; font-weight: 700; font-size: 0.95rem; line-height: 1.25; }
.sw-text small { font-weight: 500; font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.tag { margin: 0 0 8px; display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--bg); color: var(--muted); font-weight: 700; font-size: 0.85rem; }
.timer.hidden { display: none; }

/* zgodovina iger */
.history-btn { align-self: center; padding: 8px 14px; font-size: 0.95rem; }
.history-btn .count { display: inline-block; min-width: 1.6em; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--border); color: var(--text); font-size: 0.8rem; }
dialog.history { max-height: min(86dvh, 720px); display: flex; flex-direction: column; overflow: hidden; }
dialog.history:not([open]) { display: none; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.stats:empty { display: none; }
.stats div { background: var(--bg); border-radius: 10px; padding: 8px 4px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.stats b { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.stats small { font-size: 0.68rem; color: var(--muted); line-height: 1.15; }
.hist-list { list-style: none; padding: 0 2px 0 0; margin: 0 0 12px; overflow-y: auto; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain; }
.hist { border: 2px solid var(--border); border-left-width: 6px; border-radius: 12px; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.hist.win { border-left-color: var(--correct); }
.hist.loss { border-left-color: var(--p1); }
.hist.tie, .hist.local { border-left-color: var(--present); }
.hist-top { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.hist-top .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res { font-size: 0.78rem; padding: 2px 8px; border-radius: 999px; color: #fff; white-space: nowrap; }
.res.win { background: var(--correct); }
.res.loss { background: var(--p1); }
.res.tie, .res.local { background: var(--present); }
.hist-mid { display: flex; align-items: baseline; gap: 10px; font-size: 0.85rem; }
.hist-mid .sc { font-size: 1.05rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hist-words { display: flex; flex-wrap: wrap; gap: 4px; }
.hw { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 6px; border-radius: 5px; color: #fff; }
.hw.me { background: var(--correct); }
.hw.opp { background: var(--p1); }
.hw.p0 { background: var(--p0); }
.hw.p1 { background: var(--p1); }
.hw.none { background: var(--absent); color: var(--absent-text); }
.hist-list .empty { text-align: center; padding: 24px 0; }

/* ---- načini: računalnik, dva na enem telefonu ---- */
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; margin: 2px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.mode-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 8px; font-size: 0.9rem; line-height: 1.2; }
.mode-ico { font-size: 1.6rem; line-height: 1; transition: transform 0.2s; }
.mode-btn:hover .mode-ico, .mode-btn:focus-visible .mode-ico { transform: scale(1.15) rotate(-6deg); }
.btn.level { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; }
.btn.level small { font-weight: 500; font-size: 0.82rem; color: var(--muted); }
.btn.level[data-level=easy] { border-left: 6px solid var(--correct); }
.btn.level[data-level=medium] { border-left: 6px solid var(--present); }
.btn.level[data-level=hard] { border-left: 6px solid var(--p1); }
#localForm .c0 { color: var(--p0); font-weight: 700; }
#localForm .c1 { color: var(--p1); font-weight: 700; }
#local2:focus { border-color: var(--p1); }

/* računalnik razmišlja … */
.dots { display: inline-flex; gap: 3px; margin-left: 5px; vertical-align: middle; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: dot 1.1s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: 0.15s; }
.dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot { 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }

/* menjava igralca na eni napravi */
.turn-splash {
  position: fixed; inset: 0; z-index: 15; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  pointer-events: none; opacity: 0;
}
.turn-splash small { color: var(--muted); font-weight: 700; font-size: 0.95rem; }
.turn-splash b { font-size: clamp(2rem, 11vw, 3.4rem); line-height: 1.1; max-width: 90vw; overflow-wrap: anywhere; text-align: center; }
.turn-splash b.c0 { color: var(--p0); }
.turn-splash b.c1 { color: var(--p1); }
.turn-splash.go { animation: splash 1.4s ease both; animation-delay: var(--d, 0ms); }
.turn-splash.go b { animation: splashName 1.4s cubic-bezier(0.3, 1.5, 0.5, 1) both; animation-delay: var(--d, 0ms); }
@keyframes splash { 0% { opacity: 0; } 15%, 75% { opacity: 1; } 100% { opacity: 0; } }
@keyframes splashName { 0% { transform: scale(0.6); } 25% { transform: scale(1); } 100% { transform: scale(1.04); } }

/* ležeči telefon: plošče levo, tipkovnica desno */
@media (orientation: landscape) and (max-height: 500px) {
  #screen-game {
    max-width: 960px; display: grid; grid-template-columns: auto 1fr;
    grid-template-rows: auto auto 1fr; column-gap: 16px; align-items: start;
  }
  #screen-game .boards { grid-column: 1; grid-row: 1 / 4; --t: clamp(14px, calc((100dvh - 120px) / 12), 40px); width: auto; }
  #screen-game .scoreboard, #screen-game .turn-banner { grid-column: 2; }
  #screen-game .keyboard { grid-column: 2; grid-row: 3; align-self: end; }
  .key { height: clamp(34px, 11dvh, 48px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
