:root {
  --bg: #0b0e14;
  --bg2: #141925;
  --card: #1b2230;
  --line: #2a3344;
  --gold: #e6b450;
  --green: #4caf72;
  --red: #e2554a;
  --text: #e7ecf3;
  --muted: #8d99ad;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #1a2233, var(--bg));
  color: var(--text);
  min-height: 100vh;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, monospace; font-size: 12px; word-break: break-all; }

/* topbar */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid var(--line); background: rgba(0,0,0,.2);
}
.brand { font-size: 20px; font-weight: 800; letter-spacing: .5px; }

#lang-select option { background: var(--card); color: var(--text); }

.wallet { display: flex; gap: 10px; align-items: center; }
.chip { background: var(--bg2); padding: 6px 12px; border-radius: 20px; border: 1px solid var(--line); font-size: 14px; }
.chip.locked { color: var(--muted); }
.user { color: var(--gold); font-weight: 700; }

/* views */
.view { max-width: 1000px; margin: 0 auto; padding: 24px 20px 60px; }
h1, h2, h3 { margin: 0 0 12px; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 20px; box-shadow: 0 10px 30px rgba(0,0,0,.25);
}

/* auth */
.auth-card { max-width: 380px; margin: 8vh auto; text-align: center; }
.tabs { display: flex; gap: 8px; margin: 16px 0; }
.tab { flex: 1; padding: 10px; background: var(--bg2); border: 1px solid var(--line); color: var(--muted); border-radius: 10px; cursor: pointer; }
.tab.active { color: var(--gold); border-color: var(--gold); }
input {
  width: 100%; padding: 12px 14px; margin: 6px 0; background: var(--bg2);
  border: 1px solid var(--line); border-radius: 10px; color: var(--text); font-size: 15px;
}
.btn-primary { width: 100%; padding: 12px; margin-top: 10px; background: var(--gold); color: #2a1e00; border: none; border-radius: 10px; font-weight: 800; font-size: 15px; cursor: pointer; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; cursor: pointer; }
.error { color: var(--red); margin-top: 10px; min-height: 18px; font-size: 14px; }
.dev-hint { background: rgba(230,180,80,.12); border: 1px dashed var(--gold); color: var(--gold); border-radius: 8px; padding: 8px 10px; margin: 6px 0; font-size: 13px; }

/* lobby */
.matchmaking { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.btn-find { width: auto; margin: 0; padding: 12px 22px; font-size: 15px; }
.stakes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 14px; margin-bottom: 24px; }
.stake-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; text-align: center; cursor: pointer; transition: .15s;
}
.stake-card:hover { border-color: var(--gold); transform: translateY(-2px); }
.stake-card .amount { font-size: 30px; font-weight: 900; color: var(--gold); }
.stake-card .label { color: var(--muted); font-size: 13px; margin-top: 4px; }
.stake-card .occ { margin-top: 10px; font-size: 13px; }
.lobby-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.row { display: flex; gap: 8px; }
.row input { margin: 0; }
.row .btn-primary { width: auto; margin: 0; white-space: nowrap; }
.history { list-style: none; padding: 0; margin: 0; max-height: 220px; overflow: auto; }
.history li { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.history .pos { color: var(--green); }
.history .neg { color: var(--red); }

/* game */
.game-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.game-info b { color: var(--gold); }
.table-wrap { position: relative; background: radial-gradient(circle at 50% 50%, #14361f, #0c2014); border: 8px solid #5a3b1a; border-radius: 50% / 40%; padding: 40px 20px; min-height: 420px; display: flex; align-items: center; justify-content: center; }
.seats { position: absolute; inset: 0; }
.seat {
  position: absolute; width: 110px; transform: translate(-50%,-50%); text-align: center;
  background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 10px 6px;
}
.seat.current { border-color: var(--gold); box-shadow: 0 0 18px rgba(230,180,80,.6); }
.seat.eliminated { opacity: .4; filter: grayscale(1); }
.seat.winner { border-color: var(--green); box-shadow: 0 0 20px rgba(76,175,114,.7); }
.seat.me .seat-name { color: var(--gold); }
.seat .seat-name { font-weight: 700; font-size: 14px; }
.seat .seat-status { font-size: 12px; color: var(--muted); }
.seat .disc { font-size: 11px; color: var(--red); }
.seat.empty { border-style: dashed; color: var(--muted); }

.center { text-align: center; z-index: 2; }
.revolver { position: relative; display: inline-block; width: 150px; height: 100px; }
.revolver-img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 6px 10px rgba(0,0,0,.5)); transition: transform .1s; }
.revolver.spin .revolver-img { animation: spin .6s linear; }
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(1080deg); } }
.revolver.bang .revolver-img { animation: bang .4s ease; }
@keyframes bang { 0%{transform:scale(1)} 50%{transform:scale(1.18)} 100%{transform:scale(1)} }
.bang-overlay { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%) scale(0); font-size: 70px; pointer-events: none; }
.bang-overlay.show { animation: boom .9s ease forwards; }
@keyframes boom { 0%{transform:translate(-50%,-50%) scale(0); opacity:0} 25%{transform:translate(-50%,-50%) scale(1.3); opacity:1} 100%{transform:translate(-50%,-50%) scale(1.6); opacity:0} }
.turn-indicator { margin-top: 8px; font-weight: 700; min-height: 22px; }
.countdown { color: var(--muted); font-size: 14px; min-height: 18px; }
.btn-shoot { margin-top: 12px; padding: 14px 26px; background: var(--red); color: #fff; border: none; border-radius: 12px; font-size: 17px; font-weight: 800; cursor: pointer; box-shadow: 0 6px 20px rgba(226,85,74,.5); }
.btn-shoot:hover { filter: brightness(1.08); }
.btn-shoot:disabled { opacity: .5; cursor: default; }
.btn-bots { margin-top: 12px; padding: 10px 18px; background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; font-size: 14px; cursor: pointer; }
.btn-bots:hover { border-color: var(--gold); }

.game-log { margin-top: 18px; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; max-height: 160px; overflow: auto; font-size: 14px; }
.game-log div { padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,.04); }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; z-index: 10; }
.result-card { max-width: 420px; text-align: center; }
.fair { text-align: left; margin: 14px 0; background: var(--bg2); border-radius: 10px; padding: 10px; }
.fair summary { cursor: pointer; color: var(--muted); }

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; justify-content: center; gap: 12px; padding: 12px 10px; }
  .brand { width: 100%; text-align: center; }
  .lobby-bottom { grid-template-columns: 1fr; }
  .seat { width: 70px; padding: 4px 2px; font-size: 10px; }
  .seat .seat-name { font-size: 10px; }
  .revolver { width: 80px; height: 53px; }
  .game-head { flex-direction: column-reverse; gap: 10px; text-align: center; justify-content: center; }
  .table-wrap { min-height: 280px; padding: 20px 10px; border-radius: 50% / 35%; border-width: 5px; }
  .turn-indicator { font-size: 13px; margin-top: 4px; }
  .countdown { font-size: 12px; }
  .btn-shoot, .btn-primary { font-size: 13px; padding: 10px 16px; margin-top: 5px; }
  .fair { font-size: 12px; }
}
