/* CRAPS v2-A — staging. Five-tone palette + casino felt table. */
:root {
  --c-dark: #50514F; --c-red: #F25F5C; --c-yellow: #FFE066; --c-blue: #247BA0; --c-teal: #70C1B3;
  --bg: #f4f6f5; --surface: #fff; --surface-2: #eef1f0; --ink: #50514F; --muted: #8c8e8b;
  --line: rgba(80,81,79,0.16); --line-soft: rgba(80,81,79,0.08);
  --felt:    #1e6338;
  --felt-dc: #1a5730;
  --felt-dp: #102b1a;
  --felt-cx: #0d2415;
  --felt-field: #163f25;
  --gold:    #c4a44a;
  --win: #3aa893; --lose: #e8483f;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  background: radial-gradient(120% 70% at 50% -8%, #fff 0%, #f2f4f3 60%, #e7eae9 100%) fixed;
  color: var(--ink); line-height: 1.6; padding-bottom: 24px;
}
h1, h2, h3 { font-family: 'Cinzel', serif; }
a { color: var(--c-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }

/* ---- header ---- */
.topbar { text-align: center; padding: 16px 16px 8px; }
.brand { display: flex; align-items: center; justify-content: center; gap: 10px; }
.brand h1 { margin: 0; font-size: clamp(1.2rem, 6vw, 2rem); letter-spacing: 0.14em; color: var(--c-dark); }
.pip { font-size: 1.2rem; color: var(--c-red); }
.tagline { color: var(--muted); font-size: 0.82rem; margin: 4px 0 12px; }

.panel { max-width: 600px; margin: 0 auto; padding: 0 12px; }

/* ---- tools bar ---- */
.play-tools { display: flex; gap: 8px; margin: 6px 0 10px; }
.tool-btn { flex: 1; display: flex; align-items: center; justify-content: center;
  text-align: center; text-decoration: none; line-height: 1.2;
  font-family: 'JetBrains Mono', monospace; font-size: 0.74rem; padding: 9px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); cursor: pointer; }
.tool-btn:active { background: var(--surface-2); }

/* ---- stats rail ---- */
.rail { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.chip-stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 7px 8px; text-align: center; }
.chip-stat .ck { display: block; font-size: 0.56rem; color: var(--muted); letter-spacing: 0.06em; }
.chip-stat span:last-child { font-weight: 600; font-size: 0.95rem; color: var(--c-blue); }

/* ---- dice zone ---- */
.dice-zone { display: flex; gap: 14px; align-items: center; margin-bottom: 10px;
  background: radial-gradient(130% 90% at 50% 0%, #255f3a 0%, #1a4a2b 95%);
  border-radius: 16px; padding: 14px 16px;
  box-shadow: inset 0 0 24px rgba(0,0,0,0.3); }
.dice-pair { display: flex; gap: 14px; flex: 0 0 auto; }
.die { width: 72px; height: 72px; filter: drop-shadow(0 3px 8px rgba(0,0,0,0.35)); }
.die svg { width: 100%; height: 100%; display: block; border-radius: 12px; }
.die.rolling { animation: diceShake 0.65s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
@keyframes diceShake {
  0%   { transform: rotate(0) scale(1); }
  15%  { transform: rotate(-12deg) scale(0.92); }
  30%  { transform: rotate(10deg) scale(1.08); }
  45%  { transform: rotate(-9deg) scale(0.96); }
  60%  { transform: rotate(7deg) scale(1.04); }
  75%  { transform: rotate(-4deg) scale(0.98); }
  90%  { transform: rotate(2deg) scale(1.01); }
  100% { transform: rotate(0) scale(1); }
}
.dice-info { flex: 1; min-width: 0; text-align: center; }
.dice-total { font-size: 2.4rem; font-weight: 700; color: #fff; line-height: 1; font-family: 'Cinzel', serif; }
.phase-label { font-size: 0.68rem; color: rgba(255,255,255,0.75); letter-spacing: 0.1em; margin-top: 4px; }
.point-badge { display: inline-block; margin-top: 8px; padding: 4px 12px; border-radius: 100px;
  background: var(--c-yellow); color: #2a2200; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; }

/* ---- message ---- */
.message { text-align: center; min-height: 2em; font-size: 0.9rem; padding: 8px;
  border-radius: 10px; margin: 6px 0; color: var(--muted); }
.message.win  { background: rgba(58,168,147,0.12); color: var(--win);  border: 1px solid rgba(58,168,147,0.35); font-weight: 600; }
.message.lose { background: rgba(232,72,63,0.10);  color: var(--lose); border: 1px solid rgba(232,72,63,0.30); font-weight: 600; }
.message.push { background: rgba(36,123,160,0.08); color: var(--c-blue); border: 1px solid rgba(36,123,160,0.25); }

/* =====================================================
   CRAPS TABLE
   ===================================================== */

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 10px 0;
  border-radius: 14px;
}

.craps-table {
  min-width: 480px;
  background: var(--felt);
  border-radius: 14px;
  border: 3px solid var(--gold);
  overflow: hidden;
  color: #fff;
  user-select: none;
}

/* ---- Row: PLACE BETS ---- */
.row-place {
  display: flex;
  align-items: stretch;
  border-bottom: 2px solid rgba(255,255,255,0.13);
  background: #194e2b;
}

.puck-home {
  width: 52px;
  min-width: 52px;
  background: var(--felt-cx);
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid rgba(255,255,255,0.18);
  padding: 8px 4px;
}

/* Puck disk */
.puck {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  flex-shrink: 0;
  font-family: 'JetBrains Mono', monospace;
  transition: background 0.25s, color 0.25s, border-color 0.25s;
}
.puck.is-off {
  background: #2a2a2a;
  color: #888;
  border: 2px solid #555;
}
.puck.is-on {
  background: #f5edc0;
  color: #1a1400;
  border: 2px solid var(--gold);
  box-shadow: 0 0 8px rgba(196,164,74,0.6);
}

.place-boxes {
  flex: 1;
  display: flex;
}

.place-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 4px 2px 8px;
  border-right: 1px solid rgba(255,255,255,0.18);
  min-height: 64px;
  position: relative;
}
.place-box:last-child { border-right: none; }

.place-chip-area {
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  width: 36px;
}

.place-num {
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
}

/* highlight the point-active place box */
.place-box.is-point {
  background: rgba(245,237,192,0.07);
  border-bottom: 2px solid var(--gold);
}

/* ---- Row: DON'T COME ---- */
.row-dc {
  border-bottom: 1px solid rgba(255,255,255,0.13);
  background: var(--felt-dc);
}

.dc-box {
  padding: 8px 14px;
  display: flex;
  align-items: center;
  min-height: 40px;
}

/* ---- Row: COME ---- */
.row-come {
  border-bottom: 2px solid rgba(255,255,255,0.13);
}

.come-box {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
}

/* ---- Row: FIELD ---- */
.row-field {
  border-bottom: 2px solid rgba(255,255,255,0.13);
  background: var(--felt-field);
}

.field-box {
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
}

.field-hdr {
  font-family: 'Cinzel', serif;
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  color: rgba(255,255,255,0.6);
  flex-shrink: 0;
}

.field-nums {
  flex: 1;
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.fn {
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  color: #fff;
  line-height: 1.1;
}
.fn sub {
  font-size: 0.48rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--c-yellow);
}
.fn-2x, .fn-3x { color: var(--c-yellow); }

/* ---- Row: PASS LINE ---- */
.row-pass {
  display: flex;
  border-bottom: 1px solid rgba(255,255,255,0.13);
}

.pass-box {
  flex: 1;
  padding: 10px 14px;
  position: relative;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: background 0.15s;
  -webkit-tap-highlight-color: rgba(255,255,255,0.05);
}
.pass-box.bet-selectable { cursor: pointer; }
.pass-box.bet-selectable:hover { background: rgba(255,255,255,0.04); }
.pass-box.bet-active {
  background: rgba(244,216,80,0.10);
  box-shadow: inset 0 0 0 2px rgba(244,216,80,0.45);
}

.pass-txt {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  color: #fff;
  font-weight: 700;
}

.pass-chip-area {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.odds-stripe {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.5rem;
  color: rgba(255,255,255,0.38);
  letter-spacing: 0.1em;
}

.big-col {
  display: flex;
  flex-direction: column;
  border-left: 1px solid rgba(255,255,255,0.2);
}

.big-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  cursor: default;
}
.big-box:last-child { border-bottom: none; }

.big-lbl {
  font-family: 'Cinzel', serif;
  font-size: 0.46rem;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.1em;
}
.big-num {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
}

/* ---- Row: DON'T PASS BAR ---- */
.row-dp {
  background: var(--felt-dp);
}

.dp-box {
  padding: 9px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 38px;
  transition: background 0.15s;
  -webkit-tap-highlight-color: rgba(255,255,255,0.05);
}
.dp-box.bet-selectable:hover { background: rgba(255,255,255,0.04); }
.dp-box.bet-active {
  background: rgba(244,216,80,0.10);
  box-shadow: inset 0 0 0 2px rgba(244,216,80,0.45);
}

.dp-txt {
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: rgba(255,255,255,0.72);
}

.dp-chip-area {
  display: flex;
  align-items: center;
  min-height: 28px;
}

/* Chip on table — casino chip look, coloured by value tier */
.tbl-chip {
  --chip: #c4373a; --spot: #f4f4f4;
  position: relative;
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  background:
    radial-gradient(circle at 50% 50%, var(--chip) 0 52%, transparent 53%),
    repeating-conic-gradient(var(--chip) 0 18deg, var(--spot) 18deg 36deg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.45), inset 0 0 0 1px rgba(0,0,0,0.25);
}
.tbl-chip::after {
  content: ''; position: absolute; inset: 19%; border-radius: 50%;
  border: 1px dashed rgba(255,255,255,0.85);
}
.tbl-chip .cv { position: relative; z-index: 2; color: #fff; font-size: 0.38rem; font-weight: 700;
  text-shadow: 0 1px 1px rgba(0,0,0,0.55); }
.tbl-chip.cr { --chip: #c4373a; }  /* < $25   red    */
.tbl-chip.cg { --chip: #2e8b57; }  /* $25-99  green  */
.tbl-chip.ck { --chip: #2b2b2b; }  /* $100+   black  */
.tbl-chip.cp { --chip: #6a3d9a; }  /* $500+   purple */

/* Text label styles */
.t-lbl-sm {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: rgba(255,255,255,0.82);
}
.t-lbl-lg {
  font-family: 'Cinzel', serif;
  font-size: 1.0rem;
  letter-spacing: 0.22em;
  color: #fff;
  font-weight: 700;
}

/* =====================================================
   CENTER — PROPOSITION BETS
   ===================================================== */

.prop-section {
  background: var(--felt-cx);
  border-radius: 12px;
  border: 1px solid rgba(196,164,74,0.4);
  padding: 10px;
  margin: 8px 0;
}

.prop-title {
  text-align: center;
  font-family: 'Cinzel', serif;
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  color: rgba(255,255,255,0.45);
  margin-bottom: 8px;
}

.prop-row {
  display: flex;
  gap: 3px;
  margin-bottom: 3px;
}
.prop-row:last-of-type { margin-bottom: 0; }

.prop-box {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 5px;
  padding: 5px 3px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  justify-content: center;
}

.prop-name {
  font-family: 'Cinzel', serif;
  font-size: 0.58rem;
  color: rgba(255,255,255,0.82);
  letter-spacing: 0.05em;
  line-height: 1.2;
}
.prop-odds {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.48rem;
  color: rgba(255,220,100,0.8);
  line-height: 1.2;
}

.prop-hard    { background: rgba(160,60,10,0.18); }
.prop-any7    { background: rgba(200,20,20,0.22); border-color: rgba(200,20,20,0.35); }
.prop-acraps  { flex: 1.4; background: rgba(180,30,30,0.15); }
.prop-combo   { flex: 2; }
.prop-combo-row { margin-top: 3px; }

.prop-note {
  text-align: center;
  font-size: 0.58rem;
  color: rgba(255,255,255,0.28);
  margin: 8px 0 0;
  font-family: 'JetBrains Mono', monospace;
}

/* =====================================================
   BET CONTROLS
   ===================================================== */

.bet-section { margin: 12px 0 8px; }

.bet-hint {
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 8px;
  min-height: 1.4em;
}

.bet-amount-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.amt-btn { font-family: 'JetBrains Mono', monospace; font-size: 0.9rem; width: 38px; height: 38px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; display: flex; align-items: center; justify-content: center; }
.amt-btn:disabled { opacity: 0.35; cursor: default; }
.amt-btn:active:not(:disabled) { background: var(--surface-2); }
.amt-btn.amt-fx { width: auto; padding: 0 10px; font-size: 0.72rem; color: var(--c-blue);
  border-color: rgba(36,123,160,0.4); }
.amt-display { flex: 1; text-align: center; font-size: 1.2rem; font-weight: 600; color: var(--c-blue); }

/* ---- roll button ---- */
.roll-btn { width: 100%; font-family: 'Cinzel', serif; letter-spacing: 0.1em;
  padding: 16px; border-radius: 14px; border: none; color: #fff; background: var(--c-red);
  cursor: pointer; font-size: 1.05rem; transition: transform 0.08s, filter 0.15s; margin: 8px 0; }
.roll-btn:active:not(:disabled) { transform: translateY(1px); }
.roll-btn:disabled { opacity: 0.38; filter: grayscale(0.3); cursor: default; background: var(--muted); }
.roll-btn.phase-next { background: var(--c-blue); }

/* ---- history ---- */
.history-section { margin: 14px 0 8px; }
.history-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.history-title { font-family: 'Cinzel', serif; font-size: 0.82rem; letter-spacing: 0.04em; }
.link-btn { background: none; border: none; color: var(--c-blue); font-size: 0.72rem; cursor: pointer; font-family: inherit; }
.history-strip { display: flex; gap: 5px; overflow-x: auto; padding-bottom: 4px; }
.hs-item { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: #fff; }
.hs-win  { background: var(--win); }
.hs-lose { background: var(--lose); }
.hs-push { background: var(--c-blue); }
.hs-roll { background: var(--c-dark); opacity: 0.55; }

.play-foot { text-align: center; margin: 18px 0 8px; font-size: 0.82rem; }

/* ---- footer ---- */
.foot { max-width: 600px; margin: 30px auto 0; padding: 18px 16px;
  text-align: center; color: var(--muted); font-size: 0.74rem;
  border-top: 1px solid var(--line); }

/* =====================================================
   v2-C: ANIMATIONS
   ===================================================== */

/* dice-pair: relative + overflow for rake clipping */
.dice-pair {
  position: relative;
  overflow: hidden;
}

/* ---- Dice throw (fly-in from right with tumble) ---- */
@keyframes diceThrow {
  0%   { transform: translateX(76px) rotate(210deg) scale(0.32); opacity: 0; }
  52%  { transform: translateX(-7px) rotate(-11deg) scale(1.08); opacity: 1; }
  76%  { transform: translateX(3px)  rotate(4deg)   scale(0.97); }
  100% { transform: translateX(0)    rotate(0deg)   scale(1);    opacity: 1; }
}
.die.throwing {
  animation: diceThrow 0.52s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

/* ---- Stickman rake ---- */
.rake-wrap {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.rake-stick {
  position: absolute;
  top: 50%;
  left: 100%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  height: 22px;
  opacity: 0;
  will-change: transform, opacity;
}
.rake-head {
  width: 11px;
  height: 20px;
  border: 3px solid rgba(196,164,74,0.95);
  border-right: none;
  border-radius: 5px 0 0 5px;
  flex-shrink: 0;
}
.rake-handle {
  width: 200px;
  height: 4px;
  background: linear-gradient(
    90deg,
    rgba(196,164,74,0.95) 0%,
    rgba(220,185,100,0.80) 55%,
    rgba(180,140,60,0.50) 100%
  );
  border-radius: 0 2px 2px 0;
  flex-shrink: 0;
}
@keyframes rakeSweep {
  0%   { transform: translateY(-50%) translateX(0);     opacity: 0; }
  7%   { transform: translateY(-50%) translateX(-10px);  opacity: 1; }
  45%  { transform: translateY(-50%) translateX(-120px); opacity: 1; }
  63%  { transform: translateY(-50%) translateX(-120px); opacity: 0.9; }
  100% { transform: translateY(-50%) translateX(-380px); opacity: 0; }
}
.rake-stick.sweeping {
  animation: rakeSweep 1.25s cubic-bezier(0.4, 0, 0.3, 1) forwards;
}

/* ---- Chip appear ---- */
@keyframes chipIn {
  0%   { transform: scale(0) translateY(-8px); opacity: 0; }
  65%  { transform: scale(1.15) translateY(1px); opacity: 1; }
  100% { transform: scale(1)    translateY(0);   opacity: 1; }
}
.tbl-chip.chip-new {
  animation: chipIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ---- Reduced motion: kill all anim/transition ---- */
@media (prefers-reduced-motion: reduce) {
  .die.throwing,
  .die.rolling,
  .rake-stick.sweeping,
  .tbl-chip.chip-new {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .puck {
    transition: none !important;
  }
}

/* =====================================================
   v2-B WIRING: bet states, chips on every spot, A/T/S
   ===================================================== */

/* clickable / locked states */
[data-bet] { cursor: pointer; transition: filter 0.15s, box-shadow 0.15s, background 0.15s; }
[data-bet].bet-open:hover { background: rgba(255,255,255,0.05); }
[data-bet].bet-locked { cursor: default; filter: grayscale(0.5) brightness(0.84); opacity: 0.8; }
.pass-box.bet-locked, .dp-box.bet-locked { filter: none; opacity: 1; }

/* generic chip slots inside boxes */
.place-box, .prop-box, .big-box, .ats-box, .field-box { position: relative; }
.pchip, .field-chip, .odds-chip { display: flex; align-items: center; justify-content: center; }
.pchip { position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%); pointer-events: none; }
.field-chip { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); pointer-events: none; }

/* smaller chip for tight center/prop/odds boxes */
.prop-box .tbl-chip, .pchip .tbl-chip, .ats-box .tbl-chip, .odds-chip .tbl-chip {
  width: 26px; height: 26px; font-size: 0.42rem; border-width: 1.5px;
}

/* odds sub-spot on the line */
.odds-spot { display: flex; align-items: center; gap: 6px; margin-top: 3px;
  padding: 2px 7px; border: 1px dashed rgba(255,255,255,0.22); border-radius: 6px; }
.odds-spot.bet-locked { border-style: dotted; }
.odds-lbl { font-family: 'JetBrains Mono', monospace; font-size: 0.5rem;
  color: rgba(255,255,255,0.5); letter-spacing: 0.08em; }
.dp-odds { margin-top: 0; margin-left: auto; }

/* come / don't come traveling chips */
.come-list { display: flex; flex-wrap: wrap; gap: 4px; margin-left: 10px; }
.come-chip { font-family: 'JetBrains Mono', monospace; font-size: 0.55rem; font-weight: 600;
  background: var(--c-blue); color: #fff; border-radius: 100px; padding: 2px 8px;
  border: 1px solid rgba(255,255,255,0.4); }
.come-chip.on { background: var(--c-teal); color: #06302a; }

/* ALL / TALL / SMALL bonus row */
.ats-section { margin: 8px 0; }
.ats-row { display: flex; gap: 6px; }
.ats-box { flex: 1; background: var(--felt-cx); border: 1px solid rgba(196,164,74,0.4);
  border-radius: 10px; padding: 8px 4px 24px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ats-name { font-family: 'Cinzel', serif; font-size: 0.72rem; font-weight: 700; color: #fff; letter-spacing: 0.08em; }
.ats-sub { font-family: 'JetBrains Mono', monospace; font-size: 0.46rem; color: rgba(255,255,255,0.6); }
.ats-odds { font-family: 'JetBrains Mono', monospace; font-size: 0.5rem; color: var(--c-yellow); }
.ats-progress { text-align: center; font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem; color: var(--muted); min-height: 1.2em; margin-top: 5px; }

/* chip denomination selector — 共通チップ規格 C1（丸56px・白破線枠・内側リング影／blackjack基準） */
.chip-row { display: flex; gap: 10px; margin: 6px 0 12px; justify-content: center; flex-wrap: wrap; }
.chip-btn { box-sizing: border-box; width: 56px; height: 56px; border-radius: 50%;
  border: 3px dashed rgba(255,255,255,0.7); color: #fff;
  font-family: 'JetBrains Mono', monospace; font-weight: 600; font-size: 0.9rem; cursor: pointer;
  transition: transform 0.12s;
  box-shadow: 0 5px 12px -5px rgba(40,42,41,0.5), inset 0 0 0 4px rgba(255,255,255,0.12); }
.chip-btn:active { transform: scale(0.92); }
.chip-btn.chip-active { transform: scale(1.12);
  box-shadow: 0 0 0 3px var(--c-yellow), inset 0 0 0 4px rgba(255,255,255,0.12); }
.chip-btn.c1 { background: #b9c3c7; color: var(--c-dark); }
.chip-btn.c5 { background: var(--c-blue); }
.chip-btn.c25 { background: var(--c-teal); }
.chip-btn.c100 { background: var(--c-dark); border-color: var(--c-yellow); color: var(--c-yellow); }

/* action row: clear + roll */
.action-row { display: flex; gap: 8px; align-items: stretch; }
.sec-btn { flex: 0 0 38%; font-family: 'JetBrains Mono', monospace; font-size: 0.78rem;
  border-radius: 14px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); cursor: pointer; }
.sec-btn:disabled { opacity: 0.38; cursor: default; }
.action-row .roll-btn { flex: 1; width: auto; margin: 0; }

/* hint flash */
.bet-hint.hint-flash { color: var(--lose); font-weight: 600; }

/* =====================================================
   PHASE BAR + dice thrown onto the table felt
   ===================================================== */
.phase-bar { display: flex; align-items: center; justify-content: center; gap: 12px;
  margin: 2px 0 8px; min-height: 1.7em; }
.phase-bar .phase-label { font-family: 'JetBrains Mono', monospace; font-size: 0.66rem;
  letter-spacing: 0.14em; color: var(--muted); margin: 0; }
.phase-bar .point-badge { margin-top: 0; }

/* felt — a touch more like a real layout */
.table-area { position: relative; }
.craps-table {
  background: radial-gradient(140% 120% at 50% -10%, #2a7046 0%, #1d5733 50%, #133f24 100%);
  box-shadow: inset 0 0 0 2px rgba(196,164,74,0.32), inset 0 0 40px rgba(0,0,0,0.3), 0 6px 18px rgba(0,0,0,0.2);
}

/* dice land on the felt, centered in the visible table window */
.dice-throw { position: absolute; inset: 0; z-index: 6; pointer-events: none;
  display: flex; align-items: center; justify-content: center; gap: 20px;
  opacity: 0; transition: opacity 0.14s; }
.dice-throw.show { opacity: 1; }
.tdie { width: 58px; height: 58px; filter: drop-shadow(0 6px 11px rgba(0,0,0,0.55)); will-change: transform; }
.tdie svg { width: 100%; height: 100%; display: block; border-radius: 13px; }

/* 1) thrown onto the felt (fly in from the player side, tumbling) */
@keyframes tdieThrow {
  0%   { transform: translate(38%, 230%) rotate(-55deg) scale(0.5); opacity: 0; }
  28%  { opacity: 1; }
  72%  { transform: translate(-5%, -14%) rotate(430deg) scale(1.08); }
  100% { transform: translate(0, 0) rotate(540deg) scale(1); opacity: 1; }
}
.tdie.throw { animation: tdieThrow 0.68s cubic-bezier(0.25, 0.7, 0.4, 1) both; }
/* settle bounce */
@keyframes tdieRest { 0% { transform: scale(1.12); } 60% { transform: scale(0.95); } 100% { transform: scale(1); } }
.tdie.rest { animation: tdieRest 0.28s ease-out both; }
/* raked away (right → left, with the stick) */
@keyframes tdieGone { 0% { transform: translateX(0) rotate(0); opacity: 1; } 100% { transform: translateX(-230%) rotate(-52deg); opacity: 0; } }
.tdie.gone { animation: tdieGone 0.48s cubic-bezier(0.5, 0, 0.7, 1) 0.05s both; }

/* stickman rake sweeps across the felt (right → left, head leads) */
.throw-rake { position: absolute; top: 50%; left: 108%; transform: translateY(-50%);
  display: flex; align-items: center; height: 24px; opacity: 0; }
.rk-head { width: 13px; height: 24px; border: 4px solid rgba(196,164,74,0.95); border-right: none;
  border-radius: 6px 0 0 6px; flex-shrink: 0; }
.rk-handle { width: 80%; max-width: 360px; height: 5px; flex-shrink: 0;
  background: linear-gradient(90deg, rgba(196,164,74,0.95) 0%, rgba(220,185,100,0.8) 55%, rgba(180,140,60,0.4) 100%);
  border-radius: 0 3px 3px 0; }
@keyframes crapsRakeSweep { 0% { left: 108%; opacity: 0; } 14% { opacity: 1; } 100% { left: -64%; opacity: 0.9; } }
.throw-rake.sweep { animation: crapsRakeSweep 0.6s cubic-bezier(0.4, 0, 0.3, 1) both; }

@media (prefers-reduced-motion: reduce) {
  .dice-throw { display: none !important; }
}

/* =====================================================
   ルールオプション — casino/region preset bar
   ===================================================== */
.rules-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; }
.rules-pre { font-size: 0.62rem; color: var(--muted); letter-spacing: 0.1em; flex-shrink: 0; }
.casino-select { flex: 1; min-width: 0; font-family: 'JetBrains Mono', monospace; font-size: 0.72rem;
  padding: 8px 9px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink); cursor: pointer; }
.casino-select:disabled { opacity: 0.5; cursor: default; }
.rules-note { flex-basis: 100%; font-family: 'JetBrains Mono', monospace; font-size: 0.55rem;
  color: var(--muted); line-height: 1.45; }

/* =====================================================
   タブ + シミュレーション (sic-bo と共通パターン)
   ===================================================== */
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 100px; margin: 6px 0 10px; }
.tab { font-family: 'Cinzel', serif; font-size: 0.78rem; letter-spacing: 0.06em; border: none; background: transparent; color: var(--muted); padding: 8px 20px; border-radius: 100px; cursor: pointer; transition: 0.2s; }
.tab.is-active { color: #fff; background: var(--c-blue); }

/* panel becomes tab-controlled (overrides the always-visible rule above) */
.panel { display: none; }
.panel.is-active { display: block; animation: fade 0.35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* action buttons */
.action { font-family: 'Cinzel', serif; letter-spacing: 0.05em; padding: 14px 8px; border-radius: 12px; border: none; color: #fff; background: var(--c-blue); cursor: pointer; transition: transform 0.08s, filter 0.2s; font-size: 0.9rem; }
.action:active { transform: translateY(1px); }
.action:disabled { opacity: 0.4; filter: grayscale(0.4); cursor: default; }
.action.run { width: 100%; margin-top: 4px; }

/* sim form */
.sim-form { margin-top: 6px; }
.sim-intro { font-size: 0.82rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--c-blue); border-radius: 10px; padding: 11px 13px; margin-bottom: 14px; }
.block { background: var(--surface); border: 1px solid var(--line-soft); border-radius: 14px; padding: 12px; margin: 10px 0; display: grid; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 0.72rem; color: var(--muted); }
.field select, .field input[type="number"] { font-family: 'JetBrains Mono', monospace; font-size: 0.9rem; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 10px; appearance: none; }
.field input[type="range"] { width: 100%; accent-color: var(--c-blue); }

/* sim progress */
.sim-progress { margin: 12px 0; display: flex; align-items: center; gap: 10px; }
.bar { flex: 1; height: 8px; background: var(--surface-2); border-radius: 100px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--c-blue); transition: width 0.1s; }

/* sim results */
.sim-results { margin-top: 14px; }
.stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 9px 8px; text-align: center; }
.stat .sk { display: block; font-size: 0.56rem; color: var(--muted); letter-spacing: 0.04em; margin-bottom: 3px; }
.stat .sv { font-size: 1rem; font-weight: 600; color: var(--c-blue); }
.sv.pos { color: var(--win); } .sv.neg { color: var(--lose); }
.chart-wrap { margin-top: 14px; }
.chart-wrap h3 { font-size: 0.82rem; color: var(--muted); margin: 0 0 6px; font-family: 'JetBrains Mono', monospace; letter-spacing: 0.04em; }
canvas { width: 100%; display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.sim-meta { font-size: 0.72rem; color: var(--muted); margin-top: 10px; }

/* HE table in sim */
.he-section { margin: 14px 0; }
.he-section h3 { font-family: 'Cinzel', serif; font-size: 0.84rem; letter-spacing: 0.05em; margin: 0 0 10px; }
.he-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.he-table th, .he-table td { padding: 7px 8px; border: 1px solid var(--line); text-align: left; }
.he-table th { background: var(--surface-2); font-family: 'Cinzel', serif; font-size: 0.7rem; letter-spacing: 0.04em; }
.he-table td:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.he-table tr.he-low td:first-child { color: var(--win); font-weight: 600; }
.he-table tr.he-high td:first-child { color: var(--lose); }
.he-loading { font-size: 0.78rem; color: var(--muted); text-align: center; padding: 12px; }
