:root {
  --red: #E30613;
  --red-dark: #B0000C;
  --drop: #8B0008;
  --ink: #1a1a1a;
  --muted: #5c5c5c;
  --paper: #ffffff;
  --ash: #f3f3f3;
  --line: #d9d9d9;
  --oil: #141414;
  --oil-2: #1e1e1e;
  --ok: #1b7a3d;
  --danger: #E30613;
  --cream: #ffffff;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  font-family: Manrope, system-ui, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(900px 420px at 50% -8%, rgba(227, 6, 19, 0.45), transparent 60%),
    linear-gradient(180deg, #2a0a0c, var(--oil));
  color: #fff;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, .wordmark, .wordmark-sub, .brand strong, .lukoil-name, .lukoil-game {
  font-family: Oswald, Manrope, sans-serif;
  letter-spacing: 0.08em;
  margin: 0;
  text-transform: uppercase;
}

[hidden] { display: none !important; }

.drop { display: block; flex-shrink: 0; border-radius: 50%; }
.drop.sm { box-shadow: none; }

.home {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}
.home-card {
  width: min(560px, 100%);
  background: #fff;
  color: var(--ink);
  border: 0;
  box-shadow: var(--shadow);
  padding: 32px 32px 28px;
  text-align: center;
  border-top: 8px solid var(--red);
}
.brand-lockup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: left;
  margin-bottom: 18px;
}
.wordmark {
  font-size: clamp(36px, 7vw, 52px);
  color: var(--red);
  line-height: 0.9;
  letter-spacing: 0.12em;
}
.wordmark-sub {
  font-size: 18px;
  color: var(--ink);
  letter-spacing: 0.28em;
  margin-top: 2px;
}
.eyebrow { letter-spacing: 0.16em; text-transform: uppercase; font-size: 11px; color: var(--muted); margin: 0 0 4px; }
.lead { margin: 0 0 22px; line-height: 1.45; color: #333; text-align: left; }
.field, .label { display: block; text-align: left; font-size: 13px; font-weight: 700; margin: 12px 0 6px; }
.field input, .code, .panel input, .panel select, .modal-card input, .modal-card select {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--ash);
  color: var(--ink);
  border-radius: 0;
}
.field input:focus, .code:focus {
  outline: 2px solid var(--red);
  background: #fff;
}
.tokens { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 18px; }
.token-btn {
  width: 52px; height: 52px; border-radius: 50%;
  border: 3px solid transparent; background: #fff;
  font-size: 24px; line-height: 1;
  box-shadow: 0 0 0 1px var(--line);
}
.token-btn.on { border-color: var(--red); }
.home-actions { display: grid; gap: 10px; }
.join-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.code { text-transform: uppercase; letter-spacing: 0.3em; text-align: center; font-weight: 800; background: #fff; }
.btn {
  border: 0; border-radius: 0; padding: 12px 16px; font-weight: 800;
  background: var(--ash); color: var(--ink);
}
.btn.primary { background: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-dark); }
.btn.ok { background: var(--ok); color: #fff; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.ghost { background: rgba(0,0,0,0.18); color: #fff; border: 1px solid #fff; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.small { padding: 7px 10px; font-size: 13px; }
.linkish { background: none; border: 0; color: var(--red); text-decoration: underline; margin-top: 16px; }
.hint { min-height: 1.3em; color: var(--red); font-size: 14px; }

.game { min-height: 100vh; display: flex; flex-direction: column; }
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--red); border-bottom: 0;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand strong { font-size: 22px; color: #fff; letter-spacing: 0.14em; display: block; line-height: 1; }
.brand span { opacity: 0.92; font-size: 13px; }
.top-mid { font-weight: 800; text-align: center; flex: 1; }
.top-right { display: flex; gap: 8px; align-items: center; }
.lan { font-size: 12px; opacity: 0.85; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 300px;
  gap: 12px;
  padding: 12px;
  min-height: 0;
}
.col { display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow: auto; }
.board-wrap { display: grid; place-items: center; min-height: 0; }
.board-frame {
  width: min(100%, calc(100vh - 110px), 920px);
  background: linear-gradient(180deg, var(--red), var(--drop));
  padding: 10px;
  border-radius: 0;
  box-shadow: var(--shadow);
}

.board {
  display: grid;
  grid-template-columns: 1.42fr repeat(9, 1fr) 1.42fr;
  grid-template-rows: 1.42fr repeat(9, 1fr) 1.42fr;
  aspect-ratio: 1;
  background: var(--paper);
  color: var(--ink);
  outline: 2px solid #111;
}

.center {
  grid-column: 2 / 11;
  grid-row: 2 / 11;
  background:
    radial-gradient(circle at 50% 42%, rgba(227, 6, 19, 0.08), transparent 52%),
    repeating-linear-gradient(-18deg, #fff 0 16px, #f7f7f7 16px 32px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; text-align: center; padding: 16px;
  border: 2px solid #111;
}
.lukoil-mark { display: grid; justify-items: center; gap: 6px; }
.lukoil-mark img { width: clamp(56px, 10vw, 96px); height: auto; }
.lukoil-name {
  font-size: clamp(28px, 4.6vw, 56px);
  color: var(--red);
  letter-spacing: 0.16em;
  line-height: 1;
}
.lukoil-game {
  font-size: clamp(14px, 2vw, 22px);
  color: var(--ink);
  letter-spacing: 0.32em;
}
.center p { max-width: 280px; font-size: 13px; color: var(--muted); margin: 0; }

.cell {
  position: relative;
  border: 1px solid #111;
  background: var(--paper);
  display: flex;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  cursor: pointer;
}
.cell:hover { filter: brightness(1.04); }
.cell.on { outline: 3px solid var(--red); outline-offset: -3px; z-index: 2; }
.cell.here { box-shadow: inset 0 0 0 3px var(--red); }
.cell-inner {
  flex: 1; display: flex; flex-direction: column; min-width: 0; padding: 3px;
  font-size: 8px; line-height: 1.15; font-weight: 700; text-transform: uppercase;
}
.cell.corner .cell-inner { align-items: center; justify-content: center; text-align: center; font-size: 10px; }
.cell.corner { background: #fff5f5; }
.bar { height: 22%; min-height: 10px; width: 100%; flex: 0 0 auto; }
.cell.left .bar, .cell.right .bar { width: 22%; height: auto; min-height: 0; }
.cell.left { flex-direction: row-reverse; }
.cell.right { flex-direction: row; }
.cell.top { flex-direction: column-reverse; }
.name { overflow: hidden; }
.price { margin-top: auto; font-size: 8px; }
.houses { display: flex; gap: 2px; margin: 2px 0; }
.house { width: 7px; height: 7px; background: var(--red); border-radius: 1px; }
.house.hotel { width: 16px; background: var(--drop); }
.pawns {
  position: absolute; left: 2px; right: 2px; bottom: 2px;
  display: flex; flex-wrap: wrap; gap: 2px; pointer-events: none;
}
.pawn {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.4);
  font-size: 8px; display: grid; place-items: center;
}

.player {
  background: var(--oil-2);
  border: 1px solid rgba(255,255,255,0.08);
  border-left: 4px solid transparent;
  border-radius: 0;
  padding: 10px;
}
.player.me { border-left-color: #fff; }
.player.turn { border-left-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }
.player.dead { opacity: 0.45; }
.player-head { display: flex; align-items: center; gap: 8px; }
.player-head .pawn { width: 22px; height: 22px; font-size: 12px; }
.cash { font-size: 20px; font-weight: 800; color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip {
  width: 14px; height: 10px; border-radius: 0; border: 1px solid rgba(255,255,255,0.3);
}
.chip.mort { opacity: 0.4; outline: 1px dashed #fff; }

.panel {
  background: var(--oil-2);
  border-radius: 0;
  padding: 12px;
  border-top: 3px solid var(--red);
}
.panel h3, .log-wrap h3 { font-size: 13px; margin-bottom: 8px; color: #fff; }
.panel.muted { color: #ddd; font-size: 13px; line-height: 1.4; }
.actions { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row .btn { flex: 1; }
.note { font-size: 13px; opacity: 0.9; margin: 0 0 8px; }

.dice-box { display: flex; justify-content: center; gap: 12px; }
.die {
  width: 56px; height: 56px; background: #fff; color: #111;
  border-radius: 4px; box-shadow: 2px 3px 0 var(--red);
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  padding: 8px; gap: 3px;
}
.die.shake { animation: shake 0.45s ease; }
@keyframes shake {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-12deg) translateY(-4px); }
  75% { transform: rotate(10deg); }
}
.die span { width: 100%; height: 100%; border-radius: 50%; }
.die .pip { background: var(--red); }
.die[data-v="0"] { background: #ececec; }

.log-wrap { flex: 1; min-height: 120px; display: flex; flex-direction: column; }
.log-wrap h3 { font-family: Oswald, sans-serif; letter-spacing: 0.12em; }
.log {
  flex: 1; overflow: auto; background: #0d0d0d;
  border-radius: 0; padding: 8px; font-size: 12px; line-height: 1.35;
}
.log div { padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }

.modal {
  position: fixed; inset: 0; background: rgba(20, 0, 2, 0.72);
  display: grid; place-items: center; padding: 16px; z-index: 20;
}
.modal-card {
  width: min(560px, 100%);
  background: #fff;
  color: var(--ink);
  border: 0;
  border-top: 8px solid var(--red);
  border-radius: 0;
  padding: 22px;
  max-height: 90vh; overflow: auto;
}
.modal-card h2 { color: var(--red); margin-bottom: 10px; }
.modal-card p { line-height: 1.45; }
.rules { text-align: left; font-size: 14px; }
.rules ul { padding-left: 18px; }
.card-face {
  border: 2px solid var(--red); padding: 16px; background: #fff5f5;
  font-size: 18px;
}
.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: var(--red); color: #fff; padding: 10px 16px; border-radius: 0; z-index: 30;
}

.trade-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; text-align: left; }
.plist { max-height: 180px; overflow: auto; border: 1px solid var(--line); padding: 6px; background: #fff; }
.plist label { display: flex; gap: 6px; font-size: 13px; padding: 3px 0; font-weight: 600; }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .board-frame { width: min(100%, 96vw); }
  .top { flex-wrap: wrap; }
  .col.players { flex-direction: row; overflow-x: auto; }
  .player { min-width: 180px; }
}
