/* ============================================================
   Бункер — игра на GameWhale, один файл без сборки
   ============================================================ */

:root {
  --bg: #080b12;
  --bg-soft: #0b1019;
  --panel: #0f1520;
  --panel-2: #131b28;
  --panel-3: #182231;
  --line: #202b3b;
  --line-strong: #2e3c52;
  --text: #e9eef7;
  --muted: #8e9bb3;
  --muted-2: #66738c;
  --accent: #5ee0d0;
  --accent-2: #3fc9b8;
  --accent-ink: #05201c;
  --danger: #ff6b5a;
  --warn: #ffc266;
  --violet: #c3b0ff;
  --win: #8ef0a1;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.45);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(900px 600px at 15% -10%, rgba(94, 224, 208, 0.06), transparent 60%),
    radial-gradient(800px 600px at 100% 0%, rgba(255, 194, 102, 0.05), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: rgba(94, 224, 208, 0.25);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

a {
  color: var(--accent);
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.02em;
}

p {
  margin: 0;
}

ul,
ol,
dl {
  margin: 0;
  padding: 0;
}

li {
  list-style: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #2b362c;
  border-radius: 99px;
  border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
  background: #3c4a3c;
}

.app {
  min-height: 100dvh;
}

.boot {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-family: var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
}

/* ------------------------------------------------------------ кнопки/поля */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  color: var(--text);
  font-weight: 600;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.btn:hover:not(:disabled) {
  background: var(--panel-3);
  border-color: #4b5a49;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover:not(:disabled) {
  background: #e6ff6d;
  border-color: #e6ff6d;
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.btn-small {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 8px;
}

.btn-micro {
  min-height: 26px;
  padding: 3px 9px;
  font-size: 11px;
  border-radius: 7px;
  border-color: var(--line-strong);
  background: rgba(94, 224, 208, 0.08);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.btn-micro:hover:not(:disabled) {
  background: rgba(94, 224, 208, 0.16);
}

.btn-block {
  width: 100%;
}

.btn-active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(94, 224, 208, 0.1);
}

.btn-special {
  border-color: rgba(255, 194, 102, 0.55);
  color: var(--warn);
  background: rgba(255, 194, 102, 0.08);
}

.btn-special:hover:not(:disabled) {
  background: rgba(255, 194, 102, 0.16);
}

.input,
.select {
  width: 100%;
  min-height: 42px;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #0b1019;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input::placeholder {
  color: var(--muted-2);
}

.input:focus,
.select:focus {
  outline: none;
  border-color: rgba(94, 224, 208, 0.6);
  box-shadow: 0 0 0 3px rgba(94, 224, 208, 0.12);
}

.select {
  min-height: 36px;
  padding: 6px 10px;
  width: auto;
  max-width: 170px;
  background: #0b1019;
}

.input-code {
  font-family: var(--mono);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  text-align: center;
  font-size: 17px;
}

.label,
.cap {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.hint {
  color: var(--muted);
  font-size: 13px;
}

.muted {
  color: var(--muted);
}

.link {
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: inherit;
}

.divider,
.or {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted-2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.or::before,
.or::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

/* ------------------------------------------------------------ панели */

.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.022), transparent 30%), var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-head h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  font-weight: 700;
}

.count {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
}

/* ------------------------------------------------------------ лендинг */

.landing {
  position: relative;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 48px 16px;
  overflow: hidden;
}

.landing::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(94, 224, 208, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(94, 224, 208, 0.04) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at 50% 40%, black, transparent 70%);
  pointer-events: none;
}

.landing-glow {
  position: absolute;
  width: 620px;
  height: 620px;
  top: 8%;
  left: 50%;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(94, 224, 208, 0.16), transparent 62%);
  filter: blur(20px);
  pointer-events: none;
}

.landing-card {
  position: relative;
  z-index: 1;
  width: min(540px, 100%);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.brand-symbol {
  font-size: 54px;
  line-height: 1;
  color: var(--accent);
  text-shadow: 0 0 40px rgba(94, 224, 208, 0.5);
  animation: brand-pulse 5s ease-in-out infinite;
}

@keyframes brand-pulse {
  0%,
  100% {
    opacity: 0.85;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
}

.brand-title {
  font-size: clamp(46px, 10vw, 72px);
  line-height: 0.95;
  letter-spacing: 0.16em;
  font-weight: 800;
  margin-left: 0.16em;
  text-shadow: 0 10px 40px rgba(94, 224, 208, 0.15);
}

.brand-sub {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.05em;
}

.entry {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.join-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px;
}

.stats {
  font-size: 12px;
  color: var(--muted-2);
  text-align: center;
  font-family: var(--mono);
}

.rules {
  font-size: 13px;
  color: var(--muted);
}

.rules summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.03em;
}

.rules ol {
  margin-top: 12px;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rules li {
  list-style: decimal;
  padding-left: 4px;
}

.landing-foot {
  text-align: center;
  color: var(--muted-2);
  font-size: 11px;
}

/* ------------------------------------------------------------ топбар */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 11, 9, 0.86);
  backdrop-filter: blur(14px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo {
  color: var(--accent);
  font-size: 22px;
  line-height: 1;
}

.logo-text {
  font-weight: 800;
  letter-spacing: 0.18em;
  font-size: 14px;
}

.room-code {
  min-height: 28px;
  padding: 3px 10px;
  border-radius: 7px;
  border: 1px dashed var(--line-strong);
  background: transparent;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.22em;
}

.room-code:hover {
  border-color: var(--accent);
  background: rgba(94, 224, 208, 0.06);
}

.topbar-center {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.phase-chip {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.timer {
  display: flex;
  align-items: center;
  gap: 9px;
}

.timer-value {
  font-family: var(--mono);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  min-width: 46px;
  text-align: right;
}

.timer.urgent .timer-value {
  color: var(--danger);
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% {
    opacity: 0.45;
  }
}

.timer-bar {
  display: block;
  width: 84px;
  height: 5px;
  border-radius: 99px;
  background: #202a22;
  overflow: hidden;
}

.timer-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.9s linear;
}

.timer.urgent .timer-bar i {
  background: var(--danger);
}

/* ------------------------------------------------------------ лобби */

.lobby-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 16px;
  align-items: start;
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 20px;
}

.players-panel {
  display: flex;
  flex-direction: column;
  min-height: 420px;
}

.player-list {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.player {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 4px;
  border-bottom: 1px solid rgba(38, 48, 42, 0.6);
}

.player:last-child {
  border-bottom: 0;
}

.player.offline {
  opacity: 0.55;
}

.avatar {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #1d2a1f;
  border: 1px solid var(--line-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.player-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.player-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-host {
  color: var(--warn);
  background: rgba(255, 194, 102, 0.1);
  border-color: rgba(255, 194, 102, 0.25);
}

.badge-you {
  color: var(--accent);
  background: rgba(94, 224, 208, 0.1);
  border-color: rgba(94, 224, 208, 0.25);
}

.badge-ready {
  color: var(--win);
  background: rgba(142, 240, 161, 0.1);
  border-color: rgba(142, 240, 161, 0.22);
}

.badge-idle {
  color: var(--muted);
  border-color: var(--line);
}

.badge-off {
  color: var(--danger);
  background: rgba(255, 107, 90, 0.08);
  border-color: rgba(255, 107, 90, 0.2);
}

.badge-dead {
  color: #b9b9b9;
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
}

.badge-warn {
  color: var(--warn);
  background: rgba(255, 194, 102, 0.08);
  border-color: rgba(255, 194, 102, 0.2);
}

.badge-shield {
  color: #9ed8ff;
  background: rgba(158, 216, 255, 0.08);
  border-color: rgba(158, 216, 255, 0.22);
}

.badge-win {
  color: var(--win);
  background: rgba(142, 240, 161, 0.12);
  border-color: rgba(142, 240, 161, 0.3);
}

.icon-btn {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted-2);
  font-size: 13px;
}

.icon-btn:hover {
  color: var(--danger);
  border-color: rgba(255, 107, 90, 0.3);
  background: rgba(255, 107, 90, 0.08);
}

.lobby-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.lobby-actions .btn {
  flex: 1;
}

.invite {
  margin-top: 8px;
}

.lobby-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-panel .cap {
  text-transform: none;
  letter-spacing: 0.04em;
  font-weight: 500;
  color: var(--muted-2);
}

.setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed rgba(38, 48, 42, 0.8);
  font-size: 13px;
  color: var(--muted);
}

.setting:last-of-type {
  border-bottom: 0;
}

.setting b {
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}

.settings-panel .hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted-2);
}

/* ------------------------------------------------------------ игровое поле */

.world {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent);
}

.world-cat b {
  display: block;
  font-size: 15px;
  color: var(--warn);
  margin: 3px 0 2px;
}

.world-cat p {
  color: var(--muted);
  font-size: 12px;
  max-width: 62ch;
}

.world-threats .chips {
  margin-top: 5px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.chip {
  padding: 2px 8px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.world-bunker {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 2px;
  white-space: nowrap;
}

.world-bunker b {
  font-family: var(--mono);
  font-size: 18px;
  color: var(--accent);
}

.world-bunker .muted {
  font-size: 11px;
}

.game-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 16px 20px 28px;
}

.own-panel {
  position: sticky;
  top: 72px;
  max-height: calc(100dvh - 90px);
  overflow: auto;
}

.own-traits {
  display: flex;
  flex-direction: column;
}

.trait {
  padding: 9px 0;
  border-bottom: 1px dashed rgba(38, 48, 42, 0.8);
}

.trait:last-child {
  border-bottom: 0;
}

.trait-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.trait-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--muted);
  font-weight: 700;
}

.trait-open .trait-label {
  color: var(--accent);
}

.trait-value {
  font-size: 14px;
  color: var(--text);
}

.trait-closed .trait-value {
  color: #b9c4b5;
}

.trait-lore {
  margin-top: 5px;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--muted);
  font-style: italic;
}

.trait-flag {
  font-size: 10px;
  color: var(--accent);
  opacity: 0.75;
  letter-spacing: 0.04em;
}

.special {
  margin-top: 14px;
  padding: 12px;
  border: 1px dashed rgba(255, 194, 102, 0.45);
  border-radius: var(--radius-sm);
  background: rgba(255, 194, 102, 0.05);
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}

.special p {
  font-size: 13px;
  color: #e7d9c0;
}

.special-top b {
  color: var(--warn);
  font-size: 15px;
}

.special-used {
  opacity: 0.55;
  border-style: solid;
}

.special-state {
  font-size: 11px;
  color: var(--muted);
}

.intel {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(195, 176, 255, 0.25);
  background: rgba(195, 176, 255, 0.06);
}

.intel .cap {
  color: var(--violet);
  margin-bottom: 4px;
}

.intel p {
  font-size: 12.5px;
  color: #ddd3ff;
}

.status-line {
  margin-top: 10px;
  font-size: 12px;
  color: var(--warn);
}

.spectator-note {
  margin-bottom: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 12px;
}

/* таблица игроков */

.table-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.phase-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  background: linear-gradient(90deg, rgba(94, 224, 208, 0.07), transparent 55%), var(--panel);
}

.phase-banner h2 {
  font-size: 17px;
  margin-bottom: 3px;
}

.phase-banner p {
  color: var(--muted);
  font-size: 13px;
  max-width: 78ch;
}

.phase-banner .btn {
  flex: none;
}

.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
  gap: 12px;
}

.pcard {
  position: relative;
  padding: 12px 13px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 118px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.pcard.is-you {
  border-color: rgba(94, 224, 208, 0.35);
  background: linear-gradient(180deg, rgba(94, 224, 208, 0.05), transparent 60%), var(--panel);
}

.pcard.my-vote {
  border-color: rgba(94, 224, 208, 0.75);
  box-shadow: 0 0 0 1px rgba(94, 224, 208, 0.25);
}

.pcard.dead {
  opacity: 0.55;
  filter: saturate(0.5);
}

.pcard-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.pcard-name {
  font-weight: 700;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.traits-mini {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}

.traits-mini li {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: baseline;
}

.traits-mini li span {
  color: var(--muted-2);
  white-space: nowrap;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.traits-mini li b {
  font-weight: 500;
  color: #cfd8c9;
  text-align: right;
  overflow-wrap: anywhere;
}

.traits-mini .hidden-traits {
  border-top: 1px dashed rgba(38, 48, 42, 0.9);
  margin-top: 4px;
  padding-top: 5px;
}

.traits-mini .hidden-traits span {
  color: var(--muted-3, #5b675b);
}

.traits-mini .hidden-traits b {
  color: var(--muted);
  font-family: var(--mono);
}

.voted-mark {
  font-size: 10px;
  color: var(--win);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.vote-btn {
  margin-top: auto;
  width: 100%;
}

/* результаты раунда */

.result-box {
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 107, 90, 0.3);
  background: rgba(255, 107, 90, 0.06);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-box.tie {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
}

.result-box h3 {
  font-size: 16px;
  color: var(--warn);
}

.vote-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.vote-count {
  padding: 3px 9px;
  border-radius: 99px;
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

.vote-count.top {
  color: var(--danger);
  border-color: rgba(255, 107, 90, 0.4);
  background: rgba(255, 107, 90, 0.08);
}

/* ------------------------------------------------------------ чат и журнал */

.side-panel {
  display: flex;
  flex-direction: column;
  min-height: 340px;
  height: calc(100dvh - 120px);
  position: sticky;
  top: 72px;
  padding: 14px;
  gap: 10px;
}

.lobby-side .side-panel {
  position: static;
  height: 430px;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  border-radius: 9px;
  background: #0b1019;
  border: 1px solid var(--line);
}

.tab {
  flex: 1;
  padding: 6px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.tab.active {
  background: var(--panel-3);
  color: var(--text);
}

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}

.empty {
  color: var(--muted-2);
  font-size: 12px;
  text-align: center;
  margin-top: 18px;
}

.msg {
  padding: 7px 10px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid transparent;
}

.msg.mine {
  background: rgba(94, 224, 208, 0.06);
  border-color: rgba(94, 224, 208, 0.16);
}

.msg.spectator {
  opacity: 0.7;
}

.msg-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 1px;
}

.msg-author {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-time {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--muted-2);
  flex: none;
}

.msg-text {
  font-size: 13px;
  color: #dbe3d5;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.chat-form {
  display: flex;
  gap: 7px;
}

.chat-form .input {
  min-height: 36px;
  padding: 7px 11px;
  font-size: 13px;
}

.log {
  display: flex;
  gap: 8px;
  font-size: 12px;
  line-height: 1.4;
  padding-bottom: 6px;
  border-bottom: 1px dashed rgba(38, 48, 42, 0.5);
}

.log-time {
  flex: none;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--muted-2);
  padding-top: 2px;
}

.log-text {
  color: var(--muted);
}

.log-reveal .log-text {
  color: #cfe97a;
}

.log-vote .log-text {
  color: var(--warn);
}

.log-special .log-text {
  color: var(--violet);
}

.log-phase .log-text {
  color: var(--text);
  font-weight: 600;
}

/* ------------------------------------------------------------ модалка */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 5, 3, 0.72);
  backdrop-filter: blur(6px);
}

.modal {
  width: min(440px, 100%);
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal h3 {
  font-size: 20px;
  color: var(--warn);
}

.modal p {
  color: var(--muted);
  font-size: 13.5px;
}

.targets {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 300px;
  overflow: auto;
  margin: 4px 0;
}

.target {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #0e140f;
  text-align: left;
}

.target:hover {
  border-color: var(--accent);
  background: rgba(94, 224, 208, 0.06);
}

.target-name {
  font-weight: 600;
}

.target-sub {
  font-size: 11px;
  color: var(--muted);
}

/* ------------------------------------------------------------ финал */

.final {
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 32px 20px 56px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.final-hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 26px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: radial-gradient(600px 200px at 50% 0%, rgba(94, 224, 208, 0.1), transparent 70%),
    var(--panel);
}

.final-kicker {
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
}

.final-hero h1 {
  font-size: clamp(26px, 5vw, 40px);
  letter-spacing: 0.04em;
}

.final-winners {
  color: var(--accent);
  font-size: 16px;
  font-weight: 600;
}

.final-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.final-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.final-card {
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.final-card.won {
  border-color: rgba(142, 240, 161, 0.4);
  background: linear-gradient(180deg, rgba(142, 240, 161, 0.06), transparent 45%), var(--panel);
}

.final-card.lost {
  opacity: 0.72;
}

.final-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.final-card-head h3 {
  font-size: 16px;
}

.full-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.full-card > div {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 10px;
  font-size: 12.5px;
  padding-bottom: 5px;
  border-bottom: 1px dashed rgba(38, 48, 42, 0.7);
}

.full-card dt {
  color: var(--muted);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-top: 2px;
}

.full-card dd {
  margin: 0;
  color: #dfe7da;
}

.special-mini {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 194, 102, 0.22);
  background: rgba(255, 194, 102, 0.05);
  font-size: 11.5px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.special-mini b {
  color: var(--warn);
}

.special-mini span {
  color: var(--muted);
}

/* ------------------------------------------------------------ анализ ИИ */

.analysis-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-color: rgba(154, 122, 255, 0.28);
  background: linear-gradient(180deg, rgba(154, 122, 255, 0.06), transparent 40%), var(--panel);
}

.analysis-status {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--violet);
  padding: 2px 8px;
  border: 1px solid rgba(154, 122, 255, 0.35);
  border-radius: 99px;
  white-space: nowrap;
}

.analysis-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13.5px;
  padding: 8px 0;
}

.spinner {
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(154, 122, 255, 0.25);
  border-top-color: var(--violet);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.analysis-text {
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-width: 92ch;
}

.analysis-text p {
  color: #d7e0d2;
  font-size: 14px;
}

.analysis-h {
  margin-top: 8px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--violet);
}

.analysis-text ul {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 2px;
}

.analysis-text li {
  position: relative;
  padding-left: 18px;
  color: #d7e0d2;
  font-size: 14px;
}

.analysis-text li::before {
  content: '▸';
  position: absolute;
  left: 3px;
  color: var(--violet);
  opacity: 0.8;
}

.analysis-text strong {
  color: var(--text);
}

.analysis-text code {
  font-family: var(--mono);
  font-size: 12px;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
}

.analysis-error {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 107, 90, 0.3);
  background: rgba(255, 107, 90, 0.06);
  color: #ffb9b0;
  font-size: 13px;
}

.analysis-wait {
  color: var(--muted);
  font-size: 13px;
}

.analysis-foot {
  color: var(--muted-2);
  font-size: 11px;
}

/* ------------------------------------------------------------ тост */

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translate(-50%, 16px);
  z-index: 100;
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #1a231b;
  color: var(--text);
  font-size: 13px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  border-color: rgba(255, 107, 90, 0.5);
  background: #2a1614;
}

/* ------------------------------------------------------------ адаптив */

@media (max-width: 1320px) {
  .game-grid {
    grid-template-columns: 310px minmax(0, 1fr);
  }

  .game-grid .side-panel {
    grid-column: 1 / -1;
    position: static;
    height: 380px;
  }
}

@media (max-width: 980px) {
  .lobby-grid,
  .game-grid {
    grid-template-columns: 1fr;
  }

  .own-panel {
    position: static;
    max-height: none;
  }

  .game-grid .side-panel {
    height: 440px;
  }

  .world {
    grid-template-columns: 1fr 1fr;
  }

  .world-bunker {
    grid-column: 1 / -1;
    text-align: left;
    flex-direction: row;
    align-items: baseline;
    gap: 8px;
  }
}

@media (max-width: 680px) {
  body {
    font-size: 14px;
  }

  .topbar {
    padding: 9px 14px;
    gap: 10px;
  }

  .topbar-center {
    order: 3;
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
  }

  .topbar-right {
    margin-left: auto;
  }

  .lobby-grid,
  .game-grid {
    padding: 14px;
  }

  .world {
    grid-template-columns: 1fr;
    padding: 12px 14px;
  }

  .players-grid {
    grid-template-columns: 1fr;
  }

  .phase-banner {
    flex-direction: column;
    align-items: stretch;
  }

  .phase-banner .btn {
    align-self: flex-start;
  }

  .brand-title {
    font-size: 48px;
  }

  .join-row {
    grid-template-columns: 1fr;
  }

  .setting {
    flex-direction: row;
    align-items: center;
  }

  .select {
    max-width: 150px;
  }

  .final {
    padding: 20px 14px 44px;
  }

  .full-card > div {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

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

/* ------------------------------------------------------------ портал */

.portal-link {
  color: var(--muted);
  font-size: 12px;
  font-family: var(--mono);
  text-decoration: none;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  white-space: nowrap;
}
.portal-link:hover { color: var(--accent); border-color: var(--line-strong); text-decoration: none; }
.landing-user { color: var(--muted); font-size: 12.5px; margin-top: 10px; }
.landing-user a { color: var(--accent); }
.landing-user b { color: var(--text); }
