/* roulette — 輪盤 */

.app {
  max-width: 920px;
  padding-bottom: 32px;
}

/* ── HUD ───────────────────────────────────────────────── */
.hud {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 12px 0;
}
.hud-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.hud-label {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
.hud-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hud-value.win  { color: #34a853; }
.hud-value.lose { color: #ef5350; }
.hud-value.small { font-size: 14px; line-height: 26px; }
.hud-value.hud-pulse { animation: hud-pulse 0.5s ease; }
@keyframes hud-pulse {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.18); color: gold; }
  100% { transform: scale(1); }
}

/* ── Layout ────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
  gap: 18px;
  align-items: start;
}
.wheel-panel, .bet-panel { min-width: 0; }

/* ── Wheel ─────────────────────────────────────────────── */
.wheel-wrap {
  position: relative;
  width: 100%;
  max-width: 400px;
  aspect-ratio: 1;
  margin: 0 auto;
  border-radius: 50%;
  box-shadow: 0 10px 28px rgba(0,0,0,0.35);
}
.wheel-rot, .ball-rot { position: absolute; inset: 0; will-change: transform; }
.wheel-rot svg { width: 100%; height: 100%; display: block; }
.ball-rot { pointer-events: none; }
.ball {
  position: absolute;
  left: 47.5%;
  top: 1.5%;
  width: 5%;
  height: 5%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #d9d9d9 60%, #9e9e9e);
  box-shadow: 0 1px 3px rgba(0,0,0,0.6);
}
.ball.in-pocket { top: 10.5%; }
.ball[hidden] { display: none; }
.wheel-center {
  position: absolute;
  left: 50%; top: 50%;
  width: 22%; height: 22%;
  transform: translate(-50%, -50%) scale(0);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(20px, 6vw, 34px);
  font-weight: 900;
  color: #fff;
  border: 3px solid #f5d78a;
  transition: transform 0.25s cubic-bezier(.2,1.4,.5,1);
  pointer-events: none;
}
.wheel-center.show { transform: translate(-50%, -50%) scale(1); }
.wheel-center.red { background: #c62828; }
.wheel-center.black { background: #1c1c1c; }
.wheel-center.green { background: #1b8f3a; }

.status {
  text-align: center;
  font-weight: 800;
  font-size: 16px;
  color: var(--text-strong);
  min-height: 24px;
  margin: 12px 0 8px;
}
.status.good { color: #2e7d32; }
.status.bad  { color: #c62828; }
body.dark .status.good { color: #81c784; }
body.dark .status.bad  { color: #ff8a80; }

.history-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
  color: var(--text-strong);
  font-size: 13px;
}
.history-title { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }
.history { display: flex; flex-wrap: wrap; gap: 4px; min-height: 26px; }
.hist {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 26px; padding: 0 3px;
  border-radius: 50%;
  color: #fff; font-weight: 800; font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.hist.red { background: #c62828; }
.hist.black { background: #212121; }
.hist.green { background: #1b8f3a; }
body.dark .hist.black { background: #000; box-shadow: 0 0 0 1px #777; }
.hist.latest { box-shadow: 0 0 0 2px var(--accent); }
.hist-empty { color: var(--text-muted); }
.hotcold { margin-top: 8px; display: grid; gap: 4px; }
.hotcold .hc { display: inline-flex; align-items: center; gap: 2px; margin-right: 8px; font-variant-numeric: tabular-nums; }
.hotcold .hc .hist { min-width: 22px; height: 22px; font-size: 11px; }
.hc-sum { color: var(--text-muted); font-size: 12px; }

/* ── Board (vertical layout) ───────────────────────────── */
.board {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: linear-gradient(180deg, #1e6b45, #14512f);
  border: 3px solid #8b5a2b;
  border-radius: var(--radius-md);
  box-shadow: inset 0 0 18px rgba(0,0,0,0.35);
  margin-top: 4px;
  user-select: none;
}
.rail { position: absolute; background: rgba(0,0,0,0.18); border-left: 1px dashed rgba(255,255,255,0.35); }
.spot {
  position: absolute;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  color: #fff;
  font-family: inherit;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.spot:disabled { cursor: default; }
.spot:focus-visible { outline: 2px solid #ffeb3b; outline-offset: -2px; z-index: 6; }
.spot.straight, .spot.dozen, .spot.column, .spot.even {
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.55);
  font-weight: 800;
  font-size: clamp(12px, 3.6vw, 17px);
}
.spot.dozen, .spot.even { font-size: clamp(11px, 3vw, 14px); }
.spot.dozen .spot-text, .spot.even .spot-text { writing-mode: vertical-rl; letter-spacing: 1px; }
.spot.straight .spot-text {
  display: inline-flex; align-items: center; justify-content: center;
  width: 70%; max-width: 34px; aspect-ratio: 1; border-radius: 50%;
}
.spot.straight.red .spot-text   { background: #c62828; }
.spot.straight.black .spot-text { background: #1c1c1c; }
.spot.straight.green { background: #1b8f3a; }
.spot.even.red .spot-text   { color: #ff5252; font-size: 1.6em; writing-mode: horizontal-tb; }
.spot.even.black .spot-text { color: #111; font-size: 1.6em; writing-mode: horizontal-tb; text-shadow: 0 0 2px #fff; }
.spot.straight, .spot.dozen, .spot.column, .spot.even { z-index: 1; }
.spot.street, .spot.line { z-index: 2; }
.spot.split { z-index: 3; }
.spot.corner { z-index: 4; }
.spot.straight.hl, .spot.dozen:hover, .spot.column:hover, .spot.even:hover { background-color: rgba(255,235,59,0.28); }
.spot.straight.green.hl { background-color: #43a047; }
.spot.split:hover, .spot.corner:hover, .spot.street:hover, .spot.line:hover { background: rgba(255,235,59,0.55); border-radius: 4px; }
.spot.straight.win .spot-text { box-shadow: 0 0 0 3px #ffd54f, 0 0 14px #ffd54f; animation: win-pulse 0.8s ease-in-out 3; }
@keyframes win-pulse { 50% { transform: scale(1.15); } }
.chip-mark {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  min-width: 24px; height: 24px; padding: 0 3px;
  border-radius: 12px;
  background: radial-gradient(circle at 35% 30%, #ffe082, #f39c12 70%);
  border: 2px dashed #fff;
  color: #3a2500;
  font-size: 10px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.45);
  pointer-events: none;
  z-index: 5;
  font-variant-numeric: tabular-nums;
  writing-mode: horizontal-tb;
}
.chip-mark[hidden] { display: none; }

.chip-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 6px 0 10px;
}
.chip-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px dashed #fff;
  background: radial-gradient(circle at 30% 30%, #f39c12, #b9770e);
  color: #fff;
  font-weight: 900;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 3px 6px rgba(0,0,0,0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  font-variant-numeric: tabular-nums;
  font-family: inherit;
}
.chip-btn[data-chip="50"]  { background: radial-gradient(circle at 30% 30%, #16a085, #0e6655); }
.chip-btn[data-chip="100"] { background: radial-gradient(circle at 30% 30%, #2980b9, #1b4f72); }
.chip-btn[data-chip="500"] { background: radial-gradient(circle at 30% 30%, #8e44ad, #5b2c6f); }
.chip-btn.allin {
  background: linear-gradient(135deg, #ffd700, #b8860b);
  color: #1a1a1a;
  font-size: 14px;
  border-style: solid;
  border-color: #fff5b8;
}
.chip-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 10px rgba(0,0,0,0.35); }
.chip-btn.active {
  transform: translateY(-3px) scale(1.08);
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ── Action buttons ────────────────────────────────────── */
.action-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 10px 0 14px;
}
.action-row .btn { min-width: 110px; }
.action-row .btn.primary {
  background: linear-gradient(180deg, #e74c3c, #c0392b);
  color: #fff;
  border: none;
  font-weight: 700;
  animation: rl-glow 1.6s ease-in-out infinite alternate;
}
@keyframes rl-glow {
  0%   { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0); }
  100% { box-shadow: 0 0 18px 4px rgba(255, 215, 0, 0.6); }
}
.action-row .btn.primary:disabled {
  background: var(--btn-bg);
  color: var(--text-muted);
  cursor: not-allowed;
  animation: none;
}

.chip-btn { width: 50px; height: 50px; }
.chip-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.action-row { flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; }
.action-row .btn { min-width: 0; padding-left: 14px; padding-right: 14px; }

.legend {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
  margin-top: 8px;
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 760px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .wheel-wrap { max-width: 300px; }
  .bet-panel { max-width: 440px; width: 100%; margin: 0 auto; }
}
@media (max-width: 520px) {
  .hud { gap: 6px; }
  .hud-box { padding: 6px 4px; }
  .hud-value { font-size: 16px; }
  .wheel-wrap { max-width: 240px; }
  .chip-btn { width: 44px; height: 44px; font-size: 13px; }
  .chip-mark { min-width: 20px; height: 20px; font-size: 9px; }
}

:where(body:not(.dark)) .hud-value { color: color-mix(in srgb, var(--accent) 55%, #000); }

/* Narrow screens: split / corner / street / six-line spots are only ~12–20px. Extend their hit area
   with an invisible halo (they sit above the straight-up cells, so edges/corners still go to them). */
@media (max-width: 560px) {
  .spot.split::after, .spot.corner::after, .spot.line::after, .spot.street::after {
    content: ""; position: absolute; inset: -6px;
  }
  .spot.corner::after { inset: -8px; }
}
