/* ════════════════════════════════════════════════════════════════════════
   mafijaonline.rs — izgled
   Ideja: svetlo sobe prati igru. Lobi je sto sa čojom, noć je mesečina,
   dan je toplo popodne, glasanje je bordo. Sve ostalo je mirno.
   ════════════════════════════════════════════════════════════════════════ */

@font-face {
  font-family: 'Big Shoulders';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/fonts/big-shoulders-display-latin-ext-wght-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Big Shoulders';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/fonts/big-shoulders-display-latin-wght-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Onest';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/fonts/onest-latin-ext-wght-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Onest';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/fonts/onest-latin-wght-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Onest';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/fonts/onest-cyrillic-wght-normal.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

:root {
  /* svetla sobe */
  --felt: #0d3a2c;
  --felt-hi: #145a43;
  --night: #0b1229;
  --night-hi: #1a2550;
  --day: #2a1d10;
  --day-hi: #4a3216;
  --vote: #2b0d13;
  --vote-hi: #4d1622;

  --paper: #f4ecdd;
  --paper-dim: rgba(244, 236, 221, 0.66);
  --paper-faint: rgba(244, 236, 221, 0.38);
  --line: rgba(244, 236, 221, 0.13);
  --glass: rgba(6, 8, 14, 0.42);
  --glass-strong: rgba(6, 8, 14, 0.7);

  --brass: #dcaa4f;
  --moon: #a6bbff;
  --sun: #f7b53d;
  --blood: #ef4b4f;
  --mint: #45d6a8;

  --bg: var(--felt);
  --bg-hi: var(--felt-hi);
  --accent: var(--brass);
  --on-accent: #1c1407;

  --display: 'Big Shoulders', 'Oswald', 'Arial Narrow', sans-serif;
  --body: 'Onest', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 14px;
  --gap: 10px;
  color-scheme: dark;
}

body[data-theme='night'] {
  --bg: var(--night);
  --bg-hi: var(--night-hi);
  --accent: var(--moon);
  --on-accent: #0b1229;
}
body[data-theme='day'] {
  --bg: var(--day);
  --bg-hi: var(--day-hi);
  --accent: var(--sun);
  --on-accent: #241604;
}
body[data-theme='vote'] {
  --bg: var(--vote);
  --bg-hi: var(--vote-hi);
  --accent: #ff6b6b;
  --on-accent: #2b0609;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
}
/* boje pozadine su "animirljive" — svetlo se polako menja između faza */
@property --bg {
  syntax: '<color>';
  inherits: true;
  initial-value: #0d3a2c;
}
@property --bg-hi {
  syntax: '<color>';
  inherits: true;
  initial-value: #145a43;
}
body {
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.45;
  color: var(--paper);
  background-color: var(--bg);
  background-image: radial-gradient(120% 90% at 50% 0%, var(--bg-hi) 0%, var(--bg) 62%);
  background-attachment: fixed;
  transition: --bg 1.4s ease, --bg-hi 1.4s ease;
  -webkit-font-smoothing: antialiased;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
a {
  color: var(--accent);
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.hidden {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ─── Dugmad i polja ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass);
  color: var(--paper);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.08s;
}
.btn:hover {
  border-color: var(--paper-faint);
  background: rgba(255, 255, 255, 0.08);
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}
.btn.primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--on-accent);
}
.btn.primary:hover {
  filter: brightness(1.08);
}
.btn.danger {
  background: rgba(239, 75, 79, 0.16);
  border-color: rgba(239, 75, 79, 0.5);
}
.btn.big {
  min-height: 52px;
  padding: 0 26px;
  font-size: 17px;
}
.btn.small {
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
}
.btn.on {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.icon-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 64px;
  height: 56px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--glass);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: var(--paper-dim);
}
.icon-btn .ico {
  font-size: 20px;
  line-height: 1;
}
.icon-btn:hover {
  color: var(--paper);
  border-color: var(--paper-faint);
}
.icon-btn.off {
  background: rgba(239, 75, 79, 0.85);
  border-color: transparent;
  color: #fff;
}
.icon-btn.active {
  border-color: var(--accent);
  color: var(--paper);
}
.field {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  outline: none;
}
.field:focus {
  border-color: var(--accent);
}
.field.code {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
select.field {
  padding-right: 8px;
}
label.lbl {
  display: block;
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--paper-dim);
}

/* ─── Kartica uloge (kao prava karta) ──────────────────────────────────── */
.card {
  --c: var(--brass);
  position: relative;
  aspect-ratio: 5 / 7;
  border-radius: 16px;
  background: linear-gradient(160deg, #fbf4e6, #e9dcc3);
  color: #1d1710;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 18px 40px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.card::before {
  /* traka tima */
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 9px;
  background: var(--c);
}
.card-inner {
  position: absolute;
  inset: 9px 0 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  text-align: center;
}
.card-emoji {
  font-size: 54px;
  line-height: 1;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.18));
}
.card-name {
  font-family: var(--display);
  font-weight: 900;
  font-size: 30px;
  line-height: 0.95;
  color: #120d08;
}
.card-team {
  font-size: 12px;
  font-weight: 700;
  color: var(--c);
  filter: brightness(0.75) saturate(1.2);
}
.card-desc {
  font-size: 12.5px;
  line-height: 1.35;
  color: #4a3f31;
}
.card.back {
  background: repeating-linear-gradient(45deg, #6d1a1f 0 10px, #5a1418 10px 20px);
  box-shadow: 0 0 0 6px #f1e5cc inset, 0 18px 40px rgba(0, 0, 0, 0.45);
}
.card.back::before {
  display: none;
}
.card.back .card-inner {
  inset: 0;
  color: #f1e5cc;
}

/* ═══ POČETNA STRANA ═══════════════════════════════════════════════════ */
.landing {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}
.brand {
  font-family: var(--display);
  font-weight: 900;
  font-size: 28px;
  letter-spacing: 0.01em;
  text-decoration: none;
  color: var(--paper);
}
.brand b {
  color: var(--brass);
  font-weight: 900;
}
.landing-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 48px;
  align-items: center;
  padding: 56px 0 40px;
}
.hero h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(54px, 7.4vw, 104px);
  line-height: 0.86;
  letter-spacing: -0.01em;
}
.hero h1 .wake {
  display: block;
  color: var(--blood);
}
.hero p.lead {
  max-width: 34em;
  margin: 22px 0 0;
  font-size: 18px;
  color: var(--paper-dim);
}
.entry {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--glass);
  backdrop-filter: blur(6px);
}
.entry h2 {
  margin: 0 0 16px;
  font-family: var(--display);
  font-size: 30px;
  font-weight: 800;
}
.entry .row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}
.entry .or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 14px;
  font-size: 13px;
  color: var(--paper-faint);
}
.entry .or::before,
.entry .or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}
.entry .error {
  margin-top: 12px;
  color: #ffb1b1;
  font-size: 14px;
}
.hand {
  position: relative;
  height: 330px;
  margin: 10px 0 30px;
}
.hand .card {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 168px;
  transform-origin: 50% 120%;
  transition: transform 0.25s ease;
}
.hand .card:hover {
  z-index: 10;
}
.section-title {
  margin: 0 0 18px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 40px;
}
.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.steps li {
  counter-increment: step;
  padding-top: 14px;
  border-top: 2px solid var(--line);
  color: var(--paper-dim);
}
.steps li::before {
  content: counter(step);
  display: block;
  margin-bottom: 6px;
  font-family: var(--display);
  font-weight: 900;
  font-size: 38px;
  line-height: 1;
  color: var(--brass);
}
.steps li b {
  display: block;
  color: var(--paper);
}
.roles-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 56px;
}
.role-row {
  display: flex;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--c);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
}
.role-row .em {
  font-size: 28px;
}
.role-row b {
  display: block;
}
.role-row span {
  font-size: 14px;
  color: var(--paper-dim);
}
.foot {
  margin-top: 64px;
  font-size: 13px;
  color: var(--paper-faint);
}

/* ═══ ULAZ U SOBU ══════════════════════════════════════════════════════ */
.screen-center {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.prejoin {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 32px;
  width: min(980px, 100%);
  align-items: center;
}
.preview {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 20px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--line);
}
.preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}
.preview .placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  color: var(--paper-dim);
}
.preview .controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  display: flex;
  justify-content: center;
  gap: 10px;
}
.meter {
  height: 6px;
  margin-top: 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.meter i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--mint);
  transition: width 0.08s linear;
}
.devices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.join-box h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 900;
  font-size: 52px;
  line-height: 1;
}
.join-box .sub {
  margin: 8px 0 22px;
  color: var(--paper-dim);
}
.join-box .btn.big {
  width: 100%;
  margin-top: 14px;
}
.notice {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line);
  font-size: 14px;
  color: var(--paper-dim);
}
.notice.warn {
  border-color: rgba(247, 181, 61, 0.45);
}
.notice.err {
  border-color: rgba(239, 75, 79, 0.5);
  color: #ffd0d0;
}

/* ═══ SOBA ═════════════════════════════════════════════════════════════ */
.room {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    'top side'
    'stage side'
    'controls side';
  height: 100dvh;
  overflow: hidden;
}
.topbar {
  grid-area: top;
  display: grid;
  /* levo nikad uže od svog sadržaja — sat se pomeri, ali ga ne prekriva */
  grid-template-columns: minmax(min-content, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px 16px 6px;
}
.topbar .left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  min-width: 0;
}
.topbar .right {
  min-width: 0;
  overflow: hidden;
}
.room-code {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass);
  font-size: 13px;
  color: var(--paper-dim);
}
.room-code b {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--paper);
}
.topbar .right {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* sat faze — glavni element */
.clock {
  min-width: 260px;
  padding: 6px 22px 10px;
  border-radius: 18px;
  text-align: center;
  background: var(--glass);
  border: 1px solid var(--line);
}
.clock-phase {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 22px;
  line-height: 1.1;
}
.clock-time {
  font-family: var(--display);
  font-weight: 900;
  font-size: 46px;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.clock-time.urgent {
  color: #ff7b7b;
  animation: pulse 1s ease-in-out infinite;
}
.clock-time.paused {
  opacity: 0.55;
}
.clock-hint {
  max-width: 340px;
  margin: 4px auto 0;
  font-size: 13px;
  color: var(--paper-dim);
}
.clock-bar {
  height: 4px;
  margin-top: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.clock-bar i {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width 0.25s linear;
}
@keyframes pulse {
  50% {
    opacity: 0.55;
  }
}

/* video mreža */
.stage {
  grid-area: stage;
  position: relative;
  min-height: 0;
  padding: 6px 16px;
}
.grid {
  position: absolute;
  inset: 6px 16px;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: var(--gap);
}
.tile {
  --c: #666;
  position: relative;
  width: var(--tile-w, 280px);
  aspect-ratio: var(--tile-ratio, 4 / 3);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  transition: box-shadow 0.12s, filter 0.4s, opacity 0.4s;
  user-select: none;
}
.tile video {
  position: absolute;
  inset: 0;
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}
.tile.has-video video {
  display: block;
}
.tile.me video {
  transform: scaleX(-1);
}
.tile-avatar {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}
.tile-avatar span {
  display: grid;
  place-items: center;
  width: 38%;
  max-width: 96px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--c);
  color: rgba(0, 0, 0, 0.72);
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(18px, calc(var(--tile-w, 280px) * 0.13), 44px);
}
.tile.has-video .tile-avatar {
  display: none;
}
.tile-veil {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  align-content: center;
  gap: 2px;
  padding-bottom: 14%;
  text-align: center;
  font-size: 13px;
  color: var(--paper-dim);
  background: rgba(5, 8, 18, 0.55);
}
.tile.asleep .tile-avatar {
  display: none;
}
.tile.dead .tile-avatar,
.tile.offline .tile-avatar {
  opacity: 0.25;
}
.tile-veil .big {
  font-size: clamp(22px, calc(var(--tile-w, 280px) * 0.12), 40px);
  line-height: 1;
}
.tile.asleep .tile-veil,
.tile.dead .tile-veil,
.tile.offline .tile-veil {
  display: grid;
}
.tile.dead {
  filter: grayscale(1) brightness(0.7);
}
.tile.dead .tile-name b {
  text-decoration: line-through;
}
.tile-name {
  position: absolute;
  left: 8px;
  bottom: 8px;
  max-width: calc(100% - 16px);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 7px;
  border-radius: 8px;
  background: var(--glass-strong);
  font-size: 13px;
}
.tile-name b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.tile-name em {
  font-style: normal;
  color: var(--paper-faint);
}
.tile-name .mic {
  font-size: 12px;
}
.tile-top {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  pointer-events: none;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--glass-strong);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.chip.role {
  border: 1px solid var(--c);
}
.chip.team {
  background: rgba(239, 75, 79, 0.85);
}
.tile-votes {
  margin-left: auto;
  min-width: 34px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--display);
  font-weight: 900;
  font-size: 24px;
  line-height: 34px;
  text-align: center;
}
.tile-voters {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 40px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  pointer-events: none;
}
.tile-voters .chip {
  font-size: 11px;
  padding: 1px 7px;
}
.tile.speaking {
  box-shadow: 0 0 0 3px var(--mint), 0 0 24px rgba(69, 214, 168, 0.35);
}
.tile.pickable {
  cursor: pointer;
}
.tile.pickable::after {
  content: attr(data-pick);
  position: absolute;
  top: 64%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--glass-strong);
  font-weight: 700;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.12s;
  pointer-events: none;
}
/* natpis na prelazu mišem — samo gde postoji miš (na telefonu bi „zalepio“ posle dodira) */
@media (hover: hover) {
  .tile.pickable:hover {
    box-shadow: 0 0 0 3px var(--paper-faint);
  }
  .tile.pickable:hover::after {
    opacity: 1;
  }
}
.tile.picked {
  box-shadow: 0 0 0 4px var(--accent), 0 0 30px color-mix(in srgb, var(--accent) 45%, transparent);
}
.tile.picked::after {
  content: '✓ ' attr(data-picked);
  opacity: 1;
  background: var(--accent);
  color: var(--on-accent);
}
/* natpis „Spava“ se ne vidi ispod oznake izbora */
.tile.picked .tile-veil > :not(.big) {
  visibility: hidden;
}
.tile.spotlight {
  box-shadow: 0 0 0 4px var(--accent), 0 0 40px color-mix(in srgb, var(--accent) 50%, transparent);
}

/* kontrole dole */
.controls {
  grid-area: controls;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px 14px;
}
.controls .group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.controls .center {
  flex: 1;
  justify-content: center;
}
.menu {
  position: relative;
}
.menu-pop {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 40;
  min-width: 220px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #151821;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}
.menu-pop button {
  display: flex;
  width: 100%;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.menu-pop button:hover {
  background: rgba(255, 255, 255, 0.07);
}
.menu-pop hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 6px 4px;
}

/* bočni panel */
.side {
  grid-area: side;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-left: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
}
.side-scroll {
  flex: 0 1 auto;
  max-height: 58%;
  overflow-y: auto;
  padding: 16px;
}
.side h3 {
  margin: 0 0 10px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 22px;
}
.side .muted {
  color: var(--paper-dim);
  font-size: 14px;
}
.my-role {
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 14px;
  align-items: start;
  margin-bottom: 16px;
}
.my-role .card {
  width: 116px;
  cursor: pointer;
}
.my-role .card-emoji {
  font-size: 38px;
}
.my-role .card-name {
  font-size: 22px;
}
.my-role .card-desc {
  display: none;
}
.my-role .about {
  font-size: 14px;
  color: var(--paper-dim);
}
.my-role .about b {
  color: var(--paper);
}
.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
}
.action-box {
  padding: 14px;
  margin-bottom: 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
}
.action-box.hot {
  border-color: var(--accent);
}
.action-box p {
  margin: 0 0 10px;
}
.action-box p:last-child {
  margin-bottom: 0;
}
.notes {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
}
.notes li {
  padding: 6px 0;
  border-top: 1px solid var(--line);
}
.notes li.good {
  color: #9ff0cf;
}
.notes li.bad {
  color: #ffb4b4;
}
.setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.setting .name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.setting .name small {
  display: block;
  color: var(--paper-faint);
  font-size: 12px;
}
.stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  flex: none;
}
.stepper button {
  width: 32px;
  height: 30px;
  border: 0;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  font-size: 17px;
}
.stepper button:disabled {
  opacity: 0.3;
  cursor: default;
}
.stepper output {
  min-width: 46px;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.switch {
  position: relative;
  flex: none;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--paper-dim);
  transition: transform 0.15s;
}
.switch[aria-checked='true'] {
  background: var(--accent);
}
.switch[aria-checked='true']::after {
  transform: translateX(18px);
  background: var(--on-accent);
}
.switch:disabled {
  opacity: 0.5;
  cursor: default;
}
.setup-summary {
  margin: 10px 0 0;
  font-size: 14px;
}
.setup-summary.bad {
  color: #ffb4b4;
}
.in-play {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.in-play .chip {
  border: 1px solid var(--c);
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 0 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.tabs button {
  flex: 1;
  padding: 11px 6px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--paper-dim);
  font-weight: 600;
  cursor: pointer;
}
.tabs button[aria-selected='true'] {
  color: var(--paper);
  border-bottom-color: var(--accent);
}
.tabs .badge {
  display: inline-block;
  min-width: 18px;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--blood);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
}
.tab-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.feed {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 16px;
  font-size: 14px;
}
.feed .entry-line {
  padding: 5px 0;
}
.feed .entry-line.night {
  color: var(--moon);
}
.feed .entry-line.day {
  color: var(--sun);
}
.feed .entry-line.death {
  color: #ffb4b4;
}
.feed .entry-line.end,
.feed .entry-line.start {
  font-weight: 700;
}
.msg {
  padding: 4px 0;
  overflow-wrap: anywhere;
}
.msg b {
  font-weight: 700;
}
.msg.system {
  color: var(--paper-faint);
  font-size: 13px;
}
.msg .ch {
  margin-right: 4px;
  padding: 0 6px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}
.msg .ch.mafija {
  background: rgba(239, 75, 79, 0.3);
}
.msg .ch.mrtvi {
  background: rgba(166, 187, 255, 0.25);
}
.chat-form {
  display: flex;
  gap: 8px;
  padding: 10px 12px 14px;
  border-top: 1px solid var(--line);
}
.chat-form .field {
  min-height: 40px;
}
.chat-form .hint {
  font-size: 12px;
  color: var(--paper-faint);
}

/* ─── Najave preko celog ekrana ────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  overflow-y: auto;
  padding: 24px;
  background: rgba(3, 5, 12, 0.72);
  backdrop-filter: blur(5px);
  animation: fade-in 0.25s ease;
}
.overlay.leaving {
  animation: fade-out 0.3s ease forwards;
}
.announce {
  max-width: 640px;
  text-align: center;
}
.announce .icon {
  font-size: 64px;
  line-height: 1;
}
.announce h2 {
  margin: 10px 0 6px;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(44px, 8vw, 84px);
  line-height: 0.92;
}
.announce p {
  margin: 8px 0 0;
  font-size: 18px;
  color: var(--paper-dim);
}
.announce .names {
  margin-top: 14px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 34px;
  color: var(--paper);
}
.announce .tap {
  margin-top: 22px;
  font-size: 13px;
  color: var(--paper-faint);
}
.announce.mafija h2 {
  color: var(--blood);
}
.announce.grad h2 {
  color: var(--sun);
}
.reveal-card {
  width: min(260px, 70vw);
  margin: 0 auto 18px;
  perspective: 900px;
}
.reveal-card .flip {
  position: relative;
  aspect-ratio: 5 / 7;
  transform-style: preserve-3d;
  animation: flip 1s 0.35s cubic-bezier(0.3, 0.7, 0.3, 1) both;
}
.reveal-card .card {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
}
.reveal-card .card.front {
  transform: rotateY(180deg);
}
@keyframes flip {
  from {
    transform: rotateY(0);
  }
  to {
    transform: rotateY(180deg);
  }
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}
@keyframes fade-out {
  to {
    opacity: 0;
  }
}
.results {
  width: 100%;
  margin-top: 18px;
  border-collapse: collapse;
  text-align: left;
  font-size: 15px;
}
.results td {
  padding: 7px 10px;
  border-top: 1px solid var(--line);
}
.results tr.dead td:first-child {
  color: var(--paper-faint);
  text-decoration: line-through;
}

/* obaveštenja */
.toasts {
  position: fixed;
  top: 14px;
  left: 50%;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  max-width: min(92vw, 520px);
  padding: 10px 16px;
  border-radius: 12px;
  background: #171a22;
  border: 1px solid var(--line);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  font-size: 14px;
  animation: fade-in 0.2s ease;
  pointer-events: auto;
}
.toast.err {
  border-color: rgba(239, 75, 79, 0.6);
}
.toast.good {
  border-color: rgba(69, 214, 168, 0.6);
}
.banner {
  position: fixed;
  left: 50%;
  bottom: 96px;
  z-index: 70;
  transform: translateX(-50%);
}
.modal {
  width: min(460px, 100%);
  padding: 22px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: #141720;
  text-align: left;
}
.modal h2 {
  margin: 0 0 14px;
  font-family: var(--display);
  font-size: 30px;
}
.modal .field {
  margin-bottom: 12px;
}

/* ─── Telefon / uzan ekran ─────────────────────────────────────────────── */
.side-toggle {
  display: none;
}
@media (max-width: 1000px) {
  .room {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      'top'
      'stage'
      'controls';
  }
  .side {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 50;
    height: min(78dvh, 640px);
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 20px 20px 0 0;
    background: #10131b;
    transform: translateY(102%);
    transition: transform 0.25s ease;
  }
  .side.open {
    transform: none;
    box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.6);
  }
  .side-toggle {
    display: inline-flex;
  }
  .side-close {
    display: block !important;
  }
  .hero {
    grid-template-columns: 1fr;
    gap: 28px;
    padding-top: 32px;
  }
  .steps {
    grid-template-columns: 1fr 1fr;
  }
  .prejoin {
    grid-template-columns: 1fr;
  }
}
.side-close {
  display: none;
  position: absolute;
  top: 8px;
  right: 10px;
}

/* ─── Dodaci: ućutkan, meni „Više“, mreža sa mnogo igrača ───────────── */
.chip.silenced-chip {
  background: rgba(239, 75, 79, 0.85);
}
.tile.silenced .tile-name {
  box-shadow: inset 0 0 0 1px rgba(239, 75, 79, 0.8);
}
.more-wrap {
  display: none;
}
.menu-pop {
  max-height: 62vh;
  overflow-y: auto;
}
.grid.scroll {
  overflow-y: auto;
  align-content: flex-start;
  padding-bottom: 8px;
}
.grid.compact .tile {
  border-radius: 10px;
}
.grid.compact .tile-name {
  left: 4px;
  bottom: 4px;
  max-width: calc(100% - 8px);
  gap: 3px;
  padding: 1px 6px 1px 4px;
  border-radius: 6px;
  font-size: 11px;
}
.grid.compact .tile-name em,
.grid.compact .chip .txt {
  display: none;
}
.grid.compact .tile-top {
  top: 4px;
  left: 4px;
  right: 4px;
  gap: 3px;
}
.grid.compact .chip {
  padding: 1px 5px;
  font-size: 10.5px;
}
.grid.compact .tile-votes {
  min-width: 22px;
  padding: 0 6px;
  font-size: 16px;
  line-height: 22px;
}
.grid.compact .tile-voters {
  left: 4px;
  right: 4px;
  bottom: 24px;
  gap: 2px;
}
.grid.compact .tile-voters .chip {
  padding: 0 5px;
  font-size: 9.5px;
}
.grid.compact .tile-veil {
  font-size: 10.5px;
}
.grid.compact .tile.pickable::after {
  top: 62%;
  max-width: calc(100% - 8px);
  overflow: hidden;
  padding: 3px 8px;
  font-size: 11px;
  white-space: nowrap;
  text-overflow: ellipsis;
}
/* kad dole stoje imena glasača, natpis ide iznad njih */
.grid.compact .tile.pickable:has(.tile-voters > *)::after {
  top: 40%;
}
.grid.compact .tile.speaking {
  box-shadow: 0 0 0 2px var(--mint), 0 0 14px rgba(69, 214, 168, 0.35);
}
.grid.tiny .tile-voters {
  display: none;
}
.grid.tiny .tile-name .mic {
  display: none;
}

/* ─── Telefon ───────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      'left phase time'
      'hint hint hint'
      'bar bar bar';
    gap: 0 10px;
    padding: 8px 10px 4px;
  }
  .topbar .left {
    grid-area: left;
  }
  .topbar .left .brand,
  .topbar .right {
    display: none;
  }
  .room-code {
    gap: 6px;
    padding: 3px 4px 3px 10px;
    font-size: 12px;
  }
  .room-code b {
    font-size: 16px;
  }
  .clock {
    display: contents;
  }
  .clock-phase {
    grid-area: phase;
    justify-content: flex-end;
    min-width: 0;
    font-size: 17px;
    white-space: nowrap;
  }
  .clock-time {
    grid-area: time;
    font-size: 30px;
    text-align: right;
  }
  .clock-hint {
    grid-area: hint;
    display: block;
    max-width: none;
    margin: 2px 0 0;
    overflow: hidden;
    font-size: 12px;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .clock-bar {
    grid-area: bar;
    margin-top: 6px;
  }
  .stage {
    padding: 4px 8px;
  }
  .grid {
    inset: 4px 8px;
    --gap: 6px;
  }
  .controls {
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px;
    padding: 6px 10px calc(8px + env(safe-area-inset-bottom));
  }
  .controls .center {
    order: -1;
    flex: 1 0 100%;
    flex-wrap: wrap;
    gap: 6px;
  }
  .controls .center:empty {
    display: none;
  }
  .controls .center .btn {
    flex: 1 1 auto;
    min-height: 40px;
    padding: 0 12px;
    font-size: 14px;
  }
  .controls .center .btn.big {
    min-height: 46px;
  }
  .controls .center .muted {
    font-size: 13px;
    text-align: center;
  }
  .icon-btn {
    min-width: 0;
    width: 52px;
    height: 46px;
  }
  .icon-btn .lbl-txt {
    display: none;
  }
  #btn-devices,
  #btn-sound,
  #btn-leave,
  #host-wrap {
    display: none !important;
  }
  .more-wrap {
    display: inline-flex;
  }
  .menu-pop {
    min-width: 250px;
  }
  .announce h2 {
    font-size: clamp(36px, 11vw, 60px);
  }
  .announce .names {
    font-size: 26px;
  }
  .hand {
    height: 250px;
  }
  .hand .card {
    width: 126px;
  }
  .steps,
  .devices {
    grid-template-columns: 1fr;
  }
}

/* nizak ekran (telefon položeno): sat u jednom redu, dugmad bez natpisa */
@media (max-height: 500px) and (min-width: 641px) {
  .topbar {
    padding: 6px 12px 2px;
  }
  .topbar .brand {
    font-size: 22px;
  }
  .clock {
    display: grid;
    grid-template-columns: auto auto;
    justify-content: center;
    align-items: center;
    column-gap: 14px;
    min-width: 240px;
    padding: 4px 16px 6px;
  }
  .clock-phase {
    font-size: 18px;
  }
  .clock-time {
    font-size: 28px;
  }
  .clock-bar {
    grid-column: 1 / -1;
    margin-top: 4px;
  }
  .clock-hint {
    grid-column: 1 / -1;
    max-width: 300px;
    margin-top: 2px;
    overflow: hidden;
    font-size: 12px;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .controls {
    padding: 4px 12px 6px;
  }
  .icon-btn {
    min-width: 48px;
    height: 42px;
  }
  .icon-btn .lbl-txt {
    display: none;
  }
}

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