/* ═══ KASKADA ═══ */
:root {
  --bg0: #06070d;
  --bg1: #0c0f1d;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-border: rgba(255, 255, 255, 0.09);
  --text: #e6e9f2;
  --muted: #8b93a8;
  --cyan: #22d3ee;
  --violet: #a855f7;
  --rose: #f43f5e;
  --amber: #f59e0b;
  --green: #22c55e;
  --radius: 14px;
  --font: "Segoe UI", "Inter", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", "Consolas", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 75% -10%, rgba(168, 85, 247, 0.13), transparent 60%),
    radial-gradient(1000px 600px at 15% 110%, rgba(34, 211, 238, 0.10), transparent 60%),
    linear-gradient(180deg, var(--bg1), var(--bg0));
  overflow: hidden;
  user-select: none;
}

#bgfx { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.5; }

.screen {
  position: fixed; inset: 0; z-index: 1;
  display: none;
  align-items: center; justify-content: center;
  overflow-y: auto;
  padding: 24px;
}
.screen.active { display: flex; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.85rem; }
.err { color: var(--rose); font-size: 0.85rem; min-height: 1.2em; margin-top: 8px; }

/* ─── Meni ─── */
.menu-wrap { max-width: 880px; width: 100%; text-align: center; }

.logo {
  font-size: clamp(3rem, 8vw, 5.5rem);
  font-weight: 900;
  letter-spacing: 0.18em;
  background: linear-gradient(100deg, var(--cyan) 10%, var(--violet) 55%, var(--rose) 95%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 24px rgba(168, 85, 247, 0.35));
  margin-bottom: 4px;
}
.tagline { color: var(--muted); letter-spacing: 0.28em; text-transform: uppercase; font-size: 0.78rem; margin-bottom: 40px; }

.menu-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 22px 18px;
  color: var(--text);
  font-family: var(--font);
  cursor: pointer;
  text-align: left;
  display: flex; flex-direction: column; gap: 8px;
  backdrop-filter: blur(12px);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.card:hover {
  transform: translateY(-3px);
  border-color: rgba(34, 211, 238, 0.5);
  box-shadow: 0 12px 34px rgba(34, 211, 238, 0.12);
}
.card.featured { border-color: rgba(168, 85, 247, 0.45); box-shadow: inset 0 0 40px rgba(168, 85, 247, 0.07); }
.card.featured:hover { border-color: var(--violet); box-shadow: 0 12px 34px rgba(168, 85, 247, 0.2); }
.card.multi { border-color: rgba(244, 63, 94, 0.35); }
.card.multi:hover { border-color: var(--rose); box-shadow: 0 12px 34px rgba(244, 63, 94, 0.16); }
.card-icon { font-size: 1.6rem; }
.card-title { font-weight: 700; font-size: 1.12rem; letter-spacing: 0.04em; }
.card-desc { color: var(--muted); font-size: 0.82rem; line-height: 1.45; }
.card-best { color: var(--cyan); font-size: 0.78rem; font-family: var(--mono); min-height: 1em; }

.help {
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 14px 18px;
  backdrop-filter: blur(12px);
}
.help summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; letter-spacing: 0.05em; }
.help-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin: 14px 0; font-size: 0.85rem; color: var(--muted); }
kbd {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 7px;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text);
  margin-right: 4px;
}
.help-note { font-size: 0.8rem; color: var(--muted); line-height: 1.55; margin-bottom: 12px; }
.spec-table { width: 100%; font-size: 0.8rem; color: var(--muted); border-collapse: collapse; }
.spec-table td { padding: 4px 8px; }
.sp {
  display: inline-block; width: 20px; height: 20px; line-height: 20px;
  text-align: center; border-radius: 50%;
  background: rgba(34, 211, 238, 0.15); color: var(--cyan);
  border: 1px solid rgba(34, 211, 238, 0.4);
  font-family: var(--mono); font-size: 0.72rem; margin-right: 6px;
}

/* ─── Paneli in gumbi ─── */
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  padding: 26px;
}
.panel.slim { padding: 12px 14px; }
.panel h4 { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); margin-bottom: 8px; }
.key-hint { float: right; color: rgba(139, 147, 168, 0.6); font-family: var(--mono); font-size: 0.68rem; }

.btn {
  font-family: var(--font);
  font-size: 0.92rem; font-weight: 600;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 11px 22px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  letter-spacing: 0.03em;
}
.btn:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.25); }
.btn:active { transform: scale(0.97); }
.btn.primary { background: linear-gradient(120deg, rgba(34, 211, 238, 0.2), rgba(168, 85, 247, 0.2)); border-color: rgba(34, 211, 238, 0.5); }
.btn.primary:hover { border-color: var(--cyan); box-shadow: 0 0 20px rgba(34, 211, 238, 0.25); }
.btn.accent { background: linear-gradient(120deg, rgba(244, 63, 94, 0.25), rgba(245, 158, 11, 0.2)); border-color: rgba(244, 63, 94, 0.55); }
.btn.accent:hover { border-color: var(--rose); box-shadow: 0 0 20px rgba(244, 63, 94, 0.3); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.btn.small { padding: 7px 14px; font-size: 0.82rem; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── Lobi ─── */
.lobby-panel { width: min(440px, 92vw); display: flex; flex-direction: column; gap: 18px; }
.lobby-panel h2, .room-panel h2 { font-weight: 800; letter-spacing: 0.06em; }
.field { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.field span { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
input {
  font-family: var(--font); font-size: 1rem;
  color: var(--text);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 11px 14px;
  outline: none;
  transition: border-color 0.15s;
}
input:focus { border-color: var(--cyan); }
#inp-code { width: 110px; text-transform: uppercase; font-family: var(--mono); letter-spacing: 0.3em; text-align: center; }
.lobby-actions { display: flex; flex-direction: column; gap: 12px; }
.join-row { display: flex; gap: 10px; }
.join-row .btn { flex: 1; }
.room-list-wrap h3 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin-bottom: 8px; }
.room-list { display: flex; flex-direction: column; gap: 6px; max-height: 180px; overflow-y: auto; }
.room-item {
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 9px 14px;
  cursor: pointer;
  transition: border-color 0.15s;
  font-size: 0.9rem;
}
.room-item:hover { border-color: var(--cyan); }
.room-item .code { font-family: var(--mono); color: var(--cyan); letter-spacing: 0.2em; }

/* ─── Soba ─── */
.room-panel { width: min(560px, 94vw); display: flex; flex-direction: column; gap: 20px; }
.code {
  font-family: var(--mono);
  color: var(--cyan);
  letter-spacing: 0.3em;
  text-shadow: 0 0 16px rgba(34, 211, 238, 0.5);
}
.room-players { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.player-slot {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 12px 14px;
  min-height: 54px;
}
.player-slot.empty { opacity: 0.4; border-style: dashed; }
.player-slot .num {
  width: 26px; height: 26px; border-radius: 8px;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 0.8rem; font-weight: 700;
  background: rgba(34, 211, 238, 0.14); color: var(--cyan);
  border: 1px solid rgba(34, 211, 238, 0.35);
}
.player-slot .pname { font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-slot .tag { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em; padding: 3px 8px; border-radius: 6px; }
.tag.host { background: rgba(245, 158, 11, 0.15); color: var(--amber); border: 1px solid rgba(245, 158, 11, 0.4); }
.tag.ready { background: rgba(34, 197, 94, 0.15); color: var(--green); border: 1px solid rgba(34, 197, 94, 0.4); }
.tag.wait { background: rgba(139, 147, 168, 0.12); color: var(--muted); border: 1px solid rgba(139, 147, 168, 0.25); }
.mode-pick h3 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin-bottom: 8px; }
.mode-opts { display: flex; gap: 8px; margin-bottom: 6px; }
.mode-opt {
  flex: 1;
  font-family: var(--font); font-size: 0.9rem; font-weight: 600;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.mode-opt.active {
  color: var(--text);
  border-color: var(--violet);
  background: rgba(168, 85, 247, 0.14);
  box-shadow: 0 0 16px rgba(168, 85, 247, 0.18);
}
.mode-opt:disabled { cursor: default; }
.mode-opt:not(.active):disabled { opacity: 0.45; }

.room-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.room-actions .btn { flex: 1; min-width: 130px; }
.btn.is-ready { border-color: var(--green); background: rgba(34, 197, 94, 0.15); }

.chat { display: flex; flex-direction: column; gap: 8px; }
.chat-log {
  height: 130px; overflow-y: auto;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.84rem;
  display: flex; flex-direction: column; gap: 4px;
}
.chat-log .cname { color: var(--cyan); font-weight: 600; }
.chat-log .sys { color: var(--muted); font-style: italic; }
.chat-row { display: flex; gap: 8px; }
.chat-row input { flex: 1; }

/* ─── Igra ─── */
#game-layout {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  justify-content: center;
}
.side { display: flex; flex-direction: column; gap: 12px; width: 152px; flex-shrink: 0; }
.side canvas { display: block; width: 100%; }

#board-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--panel-border);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.4);
  line-height: 0;
}
#board-wrap.shake { animation: shake 0.28s; }
@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-5px, 3px); }
  50% { transform: translate(4px, -3px); }
  75% { transform: translate(-3px, 2px); }
}
#board-wrap.danger { box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55), 0 0 34px rgba(244, 63, 94, 0.45); }
#cv-board { display: block; width: 360px; height: 720px; }

.stats { display: flex; flex-direction: column; gap: 8px; }
.stat { display: flex; justify-content: space-between; align-items: baseline; }
.stat span { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.stat b { font-family: var(--mono); font-size: 1.02rem; }

.goal-bar { height: 8px; background: rgba(255, 255, 255, 0.07); border-radius: 4px; overflow: hidden; }
#goal-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--cyan), var(--violet)); transition: width 0.3s; }

.inventory { display: flex; gap: 6px; min-height: 34px; flex-wrap: wrap; }
.inv-slot {
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center;
  font-family: var(--mono); font-weight: 700; font-size: 0.86rem;
  background: rgba(34, 211, 238, 0.12); color: var(--cyan);
  border: 1px solid rgba(34, 211, 238, 0.4);
}
.inv-slot.first { background: rgba(168, 85, 247, 0.2); color: #d8b4fe; border-color: var(--violet); box-shadow: 0 0 12px rgba(168, 85, 247, 0.35); }
.inv-slot.hostile { background: rgba(244, 63, 94, 0.12); color: #fda4af; border-color: rgba(244, 63, 94, 0.45); }
.inv-slot.hostile.first { background: rgba(244, 63, 94, 0.25); box-shadow: 0 0 12px rgba(244, 63, 94, 0.4); }

#opponents { display: flex; flex-direction: column; gap: 10px; }
.opp {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 10px 12px;
  backdrop-filter: blur(12px);
}
.opp.dead { opacity: 0.45; }
.opp.dead .opp-name { text-decoration: line-through; }
.opp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.opp-name { font-size: 0.8rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 84px; }
.opp-key {
  font-family: var(--mono); font-size: 0.68rem;
  background: rgba(244, 63, 94, 0.14); color: var(--rose);
  border: 1px solid rgba(244, 63, 94, 0.4);
  border-radius: 5px; padding: 1px 6px;
}
.opp canvas { display: block; width: 100%; border-radius: 6px; background: rgba(0, 0, 0, 0.4); }
.opp-stats { font-family: var(--mono); font-size: 0.68rem; color: var(--muted); margin-top: 5px; display: flex; justify-content: space-between; }

/* prekrivni elementi na plošči */
.overlay {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px;
  background: rgba(6, 7, 13, 0.82);
  backdrop-filter: blur(6px);
  line-height: 1.4;
}
.overlay h2 { letter-spacing: 0.08em; font-size: 1.5rem; }
.count-num {
  font-size: 6rem; font-weight: 900; font-family: var(--mono);
  background: linear-gradient(120deg, var(--cyan), var(--violet));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: pop 0.9s ease-out infinite;
}
@keyframes pop { 0% { transform: scale(1.5); opacity: 0; } 25% { transform: scale(1); opacity: 1; } 100% { transform: scale(0.92); opacity: 0.9; } }

.over-stats { font-family: var(--mono); font-size: 0.95rem; color: var(--muted); text-align: center; display: flex; flex-direction: column; gap: 5px; }
.over-stats b { color: var(--text); }
.over-stats .win { color: var(--amber); font-size: 1.1rem; }
.over-actions { display: flex; gap: 10px; }

.banner {
  position: absolute; top: 26%; left: 50%; z-index: 6;
  transform: translateX(-50%);
  padding: 12px 26px;
  border-radius: 12px;
  background: rgba(6, 7, 13, 0.85);
  border: 1px solid rgba(168, 85, 247, 0.55);
  box-shadow: 0 0 30px rgba(168, 85, 247, 0.3);
  font-weight: 800; font-size: 1.05rem; letter-spacing: 0.1em;
  white-space: nowrap;
  animation: bannerIn 0.25s ease-out;
}
.banner.warn { border-color: var(--rose); box-shadow: 0 0 30px rgba(244, 63, 94, 0.4); color: #fda4af; }
.banner.good { border-color: var(--green); box-shadow: 0 0 30px rgba(34, 197, 94, 0.35); color: #86efac; }
@keyframes bannerIn { from { transform: translateX(-50%) scale(0.7); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }

.incoming {
  position: absolute; left: 8px; bottom: 8px; z-index: 4;
  min-width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: rgba(244, 63, 94, 0.2);
  border: 1px solid var(--rose);
  color: #fda4af;
  font-family: var(--mono); font-weight: 800;
  animation: pulse 0.8s ease-in-out infinite alternate;
}
@keyframes pulse { from { box-shadow: 0 0 6px rgba(244, 63, 94, 0.3); } to { box-shadow: 0 0 22px rgba(244, 63, 94, 0.7); } }

.toast {
  position: fixed; bottom: 28px; left: 50%; z-index: 40;
  transform: translateX(-50%);
  background: rgba(12, 15, 29, 0.95);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 12px 22px;
  font-size: 0.9rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  animation: bannerIn 0.2s ease-out;
}

.mute-btn {
  position: fixed; right: 16px; bottom: 16px; z-index: 40;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  backdrop-filter: blur(10px);
}
.mute-btn:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.3); }
.mute-btn.off { color: rgba(139, 147, 168, 0.4); text-decoration: line-through; }

/* ═══ Vizualni učinki ═══ */

#fxtop { position: fixed; inset: 0; z-index: 30; pointer-events: none; }

/* prehodi med zasloni */
.screen.active { animation: screenIn 0.35s cubic-bezier(0.2, 0.9, 0.3, 1); }
@keyframes screenIn {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

/* logo: vstop + potujoči gradient */
.logo {
  background-size: 250% 100%;
  animation: logoDrop 0.8s cubic-bezier(0.2, 1.4, 0.4, 1), logoShift 7s ease-in-out infinite alternate;
}
@keyframes logoDrop {
  from { opacity: 0; transform: translateY(-46px) scale(1.06); filter: blur(6px) drop-shadow(0 0 24px rgba(168, 85, 247, 0.35)); }
  to { opacity: 1; transform: none; }
}
@keyframes logoShift {
  from { background-position: 0% 50%; }
  to { background-position: 100% 50%; }
}
.tagline { animation: tagIn 1s 0.25s ease backwards; }
@keyframes tagIn { from { opacity: 0; letter-spacing: 0.55em; } }

/* kartice: postopni vstop + 3D nagib + sijaj pod miško */
.menu-cards .card {
  position: relative;
  overflow: hidden;
  animation: cardIn 0.55s cubic-bezier(0.2, 1.2, 0.4, 1) backwards;
  transform: perspective(720px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--ty, 0px));
  transition: transform 0.14s ease-out, border-color 0.18s ease, box-shadow 0.18s ease;
  will-change: transform;
}
.menu-cards .card:nth-child(1) { animation-delay: 0.08s; }
.menu-cards .card:nth-child(2) { animation-delay: 0.16s; }
.menu-cards .card:nth-child(3) { animation-delay: 0.24s; }
.menu-cards .card:nth-child(4) { animation-delay: 0.32s; }
@keyframes cardIn { from { opacity: 0; transform: translateY(26px) scale(0.96); } }
.menu-cards .card::after {
  content: '';
  position: absolute; inset: 0;
  pointer-events: none;
  background: radial-gradient(160px circle at var(--mx, 50%) var(--my, 50%), rgba(34, 211, 238, 0.13), transparent 70%);
  opacity: 0;
  transition: opacity 0.25s;
}
.menu-cards .card:hover::after { opacity: 1; }
.card.featured::after { background: radial-gradient(160px circle at var(--mx, 50%) var(--my, 50%), rgba(168, 85, 247, 0.16), transparent 70%); }
.card.multi::after { background: radial-gradient(160px circle at var(--mx, 50%) var(--my, 50%), rgba(244, 63, 94, 0.14), transparent 70%); }

/* CRT pridih na plošči */
#board-wrap::after {
  content: '';
  position: absolute; inset: 0; z-index: 3;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.022) 0 1px, transparent 1px 4px);
}

/* odštevanje: širiči se obroč */
#overlay-count { overflow: hidden; }
.count-ring {
  position: absolute; left: 50%; top: 50%;
  width: 30px; height: 30px;
  margin: -15px 0 0 -15px;
  border: 3px solid var(--cyan);
  border-radius: 50%;
  animation: ringOut 0.75s ease-out forwards;
  pointer-events: none;
}
@keyframes ringOut {
  from { transform: scale(0.4); opacity: 0.9; }
  to { transform: scale(11); opacity: 0; }
}

/* statistika: poskok ob spremembi */
.stat b.bump { animation: bump 0.3s ease; }
@keyframes bump {
  40% { transform: scale(1.3); color: var(--cyan); text-shadow: 0 0 12px rgba(34, 211, 238, 0.7); }
}

/* opozorilna pasica rahlo trese */
.banner.warn { animation: bannerIn 0.25s ease-out, bannerShake 0.4s 0.15s ease; }
@keyframes bannerShake {
  20% { transform: translateX(calc(-50% - 4px)); }
  40% { transform: translateX(calc(-50% + 4px)); }
  60% { transform: translateX(calc(-50% - 3px)); }
  80% { transform: translateX(calc(-50% + 2px)); }
}

/* KO žig na izpadlem nasprotniku */
.opp { position: relative; }
.opp.dead::after {
  content: 'KO';
  position: absolute; left: 50%; top: 44%;
  transform: translate(-50%, -50%) rotate(-14deg) scale(1);
  font-weight: 900; font-size: 1.7rem; letter-spacing: 0.1em;
  color: var(--rose);
  border: 3px solid var(--rose);
  border-radius: 8px;
  padding: 1px 9px;
  background: rgba(6, 7, 13, 0.72);
  animation: stampIn 0.35s cubic-bezier(0.2, 1.6, 0.4, 1);
  text-shadow: 0 0 14px rgba(244, 63, 94, 0.7);
}
@keyframes stampIn {
  from { transform: translate(-50%, -50%) rotate(-14deg) scale(2.4); opacity: 0; }
}

/* leteči posebni blok proti zalogi */
.flyer {
  position: fixed; z-index: 60;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 8px;
  font-family: var(--mono); font-weight: 800; font-size: 0.9rem;
  background: rgba(168, 85, 247, 0.35); color: #e9d5ff;
  border: 1px solid var(--violet);
  box-shadow: 0 0 16px rgba(168, 85, 247, 0.6);
  pointer-events: none;
  transition: transform 0.5s cubic-bezier(0.3, 0.1, 0.2, 1), opacity 0.5s;
}

/* zmagovalni sijaj plošče */
#board-wrap.victory { box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55), 0 0 44px rgba(245, 158, 11, 0.55); }

/* ═══ Serija BO3, statistika, gledalec ═══ */
.fmt-opts { margin-top: 8px; }
.series-score { display: flex; flex-direction: column; gap: 4px; font-size: 0.82rem; }
.series-score .srow { display: flex; justify-content: space-between; }
.series-score .swins { font-family: var(--mono); color: var(--amber); font-weight: 700; }
.series-score .srow.leader .sname { color: var(--amber); }

.pstats { font-size: 0.66rem; color: var(--muted); font-family: var(--mono); display: block; }

.spec-wrap { width: min(860px, 96vw); display: flex; flex-direction: column; gap: 16px; }
.spec-head {
  display: flex; align-items: center; gap: 14px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 14px 20px;
  backdrop-filter: blur(12px);
}
.spec-head h2 { font-size: 1.2rem; letter-spacing: 0.04em; }
.spec-head .muted { flex: 1; }
.spec-players {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
}
.spec-card { padding: 12px; }
.spec-card canvas { width: 100%; }
.spec-card.winner { border-color: var(--amber); box-shadow: 0 0 24px rgba(245, 158, 11, 0.3); }
.spec-chat .chat-log { height: 100px; }

.mute-btn.music { right: 64px; }

/* ═══ Lestvice ═══ */
.lb-open { margin-bottom: 16px; font-size: 0.95rem; }
.lb-modal {
  position: fixed; inset: 0; z-index: 45;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4, 5, 10, 0.7);
  backdrop-filter: blur(6px);
  padding: 20px;
}
.lb-panel { width: min(760px, 94vw); max-height: 86vh; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.lb-panel h2 { letter-spacing: 0.06em; }
.lb-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; }
.lb-cols h4 { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); margin-bottom: 8px; }
.lb-cols ol, .over-board { list-style: none; counter-reset: lb; display: flex; flex-direction: column; gap: 4px; }
.lb-cols li, .over-board li {
  counter-increment: lb;
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 0.85rem;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}
.lb-cols li::before, .over-board li::before {
  content: counter(lb) '.';
  color: var(--muted);
  font-family: var(--mono);
  min-width: 1.6em;
}
.lb-cols li:nth-child(1)::before, .over-board li:nth-child(1)::before { color: var(--amber); }
.lb-cols li:nth-child(2)::before, .over-board li:nth-child(2)::before { color: #cbd5e1; }
.lb-cols li:nth-child(3)::before, .over-board li:nth-child(3)::before { color: #d97706; }
.lb-cols li .lname, .over-board li .lname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-cols li .lval, .over-board li .lval { font-family: var(--mono); color: var(--cyan); }
.lb-cols li.me, .over-board li.me {
  background: rgba(168, 85, 247, 0.16);
  border: 1px solid rgba(168, 85, 247, 0.5);
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.2);
}
.lb-empty { color: var(--muted); font-size: 0.82rem; font-style: italic; }
.over-board { width: min(280px, 84%); max-height: 220px; overflow-y: auto; }
.lb-submit { display: flex; gap: 8px; }
.lb-submit input { width: 170px; }

/* ═══ Dotik / mobilne naprave ═══ */
html, body { overscroll-behavior: none; }
body { touch-action: manipulation; }
#board-wrap, #cv-board { touch-action: none; }

#touch-bar { display: none; }
body.touch #touch-bar {
  display: flex;
  gap: 10px;
  justify-content: center;
  width: 100%;
  order: 4;
}
.tbtn {
  width: 56px; height: 56px;
  border-radius: 16px;
  font-size: 1.4rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(10px);
  cursor: pointer;
  display: grid; place-items: center;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.tbtn:active { background: rgba(34, 211, 238, 0.22); border-color: var(--cyan); transform: scale(0.93); }
.tbtn.spec { color: #d8b4fe; border-color: rgba(168, 85, 247, 0.45); }
.tbtn.spec:active { background: rgba(168, 85, 247, 0.25); border-color: var(--violet); }
.tbtn.hidden { display: none; }
body.touch .key-hint { display: none; }
body.touch .opp { cursor: pointer; }
body.touch .opp:active { border-color: var(--rose); }

/* manjši zasloni */
@media (max-width: 860px) {
  #game-layout { gap: 10px; }
  .side { width: 118px; }
  #cv-board { width: 280px; height: 560px; }
  .opp-name { max-width: 60px; }
}
@media (max-height: 820px) and (min-width: 701px) {
  #cv-board { width: 300px; height: 600px; }
}

/* telefoni: navpična postavitev — vrstica HUD, plošča + ozek stolpec, gumbi */
@media (max-width: 700px) {
  .screen { padding: 10px; }
  #game-layout {
    flex-wrap: wrap;
    justify-content: center;
    align-content: flex-start;
    gap: 8px;
    width: 100%;
  }
  .side.left {
    order: 1;
    width: 100%;
    max-width: 480px;
    flex-direction: row;
    gap: 8px;
  }
  .side.left .panel { flex: 1; padding: 8px 10px; }
  .side.left .stats { flex: 2; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; }
  .stat b { font-size: 0.88rem; }
  .stat span { font-size: 0.6rem; }
  #cv-hold { max-width: 74px; margin: 0 auto; }
  #goal-panel { display: none !important; }
  #board-wrap { order: 2; }
  :root { --bw: min(56vw, 34vh); }
  #cv-board { width: var(--bw); height: calc(var(--bw) * 2); }
  .side.right {
    order: 3;
    width: 88px;
    gap: 8px;
  }
  .side.right .panel { padding: 8px; }
  #inv-panel h4 { font-size: 0.58rem; }
  .inv-slot { width: 24px; height: 24px; font-size: 0.72rem; }
  #opponents { flex-direction: column; gap: 6px; }
  .opp { padding: 6px; }
  .opp-stats { display: none; }
  .opp-name { max-width: 46px; font-size: 0.66rem; }
  .banner { font-size: 0.82rem; padding: 9px 16px; }
  .room-players { grid-template-columns: 1fr; }
  .menu-cards { grid-template-columns: 1fr 1fr; }
  .logo { font-size: clamp(2.4rem, 11vw, 3.6rem); }
}
@media (max-width: 700px) and (max-height: 700px) {
  :root { --bw: min(52vw, 30vh); }
}
