/* v=1 */
/* MONEY WHEEL — staging. Five-tone palette shared with other hakoniwa tools. */
: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: #3a5a7a; --felt-2: #2d4a66;
  --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.1rem, 5vw, 1.7rem); letter-spacing: 0.1em; color: var(--c-dark); }
.tagline { color: var(--muted); font-size: 0.82rem; margin: 4px 0 8px; }

/* ---- tabs ---- */
.tabs { display: flex; justify-content: center; gap: 4px; margin-bottom: 4px; }
.tab {
  padding: 6px 18px; border: 1px solid var(--line); border-radius: 100px;
  background: var(--surface); color: var(--muted);
  font-family: inherit; font-size: 0.82rem; cursor: pointer;
}
.tab.is-active { background: var(--c-dark); color: #fff; border-color: transparent; }

/* ---- panel ---- */
.panel { max-width: 560px; margin: 0 auto; padding: 0 12px; display: none; }
.panel.is-active { display: block; }

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

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

/* ---- table felt ---- */
.table-felt {
  background: radial-gradient(130% 90% at 50% 0%, var(--felt) 0%, var(--felt-2) 95%);
  border-radius: 16px; padding: 14px 16px;
  box-shadow: inset 0 0 24px rgba(0,0,0,0.25);
  margin-bottom: 12px;
}

/* ---- card rows ---- */
.row-section { margin-bottom: 10px; }
.row-section:last-child { margin-bottom: 0; }
.row-label {
  font-size: 0.66rem; color: rgba(255,255,255,0.85);
  letter-spacing: 0.1em; margin-bottom: 5px;
  display: flex; align-items: center; gap: 6px;
}
.row-label .dot-noir { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #1a1a1a; border: 1px solid rgba(255,255,255,0.4); }
.row-label .dot-rouge { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #d32f2f; border: 1px solid rgba(255,255,255,0.3); }
.row-total {
  font-family: 'Cinzel', serif; font-size: 1.1rem; font-weight: 700;
  color: #fff; margin-left: 8px; min-width: 28px; display: inline-block; text-align: right;
}
.card-row { display: flex; gap: 4px; flex-wrap: wrap; min-height: 54px; align-items: flex-start; }
.card {
  width: 36px; height: 50px; border-radius: 6px;
  background: #fff; border: 1px solid #ccc;
  font-size: 0.75rem; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', monospace; font-weight: 600;
  user-select: none; flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.card.red { color: #d32f2f; }
.card.black { color: #1a1a1a; }

/* ---- result message ---- */
.result-msg {
  text-align: center; min-height: 2.5em; font-size: 0.95rem;
  padding: 10px 12px; border-radius: 10px; margin: 8px 0;
  color: var(--muted); display: flex; align-items: center; justify-content: center;
}
.result-msg.win  { background: rgba(58,168,147,0.12); color: var(--win);  border: 1px solid rgba(58,168,147,0.35); font-weight: 600; }
.result-msg.lose { background: rgba(232,72,63,0.10);  color: var(--lose); border: 1px solid rgba(232,72,63,0.30); font-weight: 600; }
.result-msg.push { background: rgba(80,81,79,0.08);  color: var(--muted); border: 1px solid var(--line); }

/* ---- bet rows ---- */
.bet-row { display: flex; gap: 8px; margin-bottom: 8px; }
.bet-area {
  position: relative; flex: 1; display: flex; flex-direction: column;
  border: 2px solid var(--line); border-radius: 12px;
  padding: 12px; cursor: pointer; min-height: 80px;
  background: var(--surface); color: var(--ink);
  transition: border-color 0.15s, background 0.15s;
}
.bet-area.active {
  border-color: var(--c-teal);
  background: rgba(112,193,179,0.09);
}
.bet-area.win {
  border-color: var(--win);
  background: rgba(58,168,147,0.10);
  box-shadow: 0 0 0 2px rgba(58,168,147,0.25);
}
.bet-area.lose {
  border-color: var(--lose);
  background: rgba(232,72,63,0.07);
  box-shadow: 0 0 0 2px rgba(232,72,63,0.18);
}
.bet-area.push {
  border-color: var(--muted);
  background: rgba(80,81,79,0.06);
}
.bet-name { font-weight: 700; font-size: 1.1rem; font-family: 'Cinzel', serif; letter-spacing: 0.06em; }
.bet-odds { font-size: 0.7rem; color: var(--muted); }
.bet-chips { display: flex; gap: 4px; min-height: 30px; flex-wrap: wrap; margin-top: 4px; align-items: center; }

/* ---- bet amount badge (on felt) ---- */
.placed-badge {
  position: absolute; top: -8px; right: -6px; min-width: 28px; height: 28px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center; border-radius: 50%;
  font-family: 'JetBrains Mono', monospace; font-size: 0.62rem; font-weight: 700; color: #fff;
  border: 2px dashed rgba(255,255,255,0.75); box-shadow: 0 2px 6px -1px rgba(40,42,41,0.5);
  background: var(--c-blue);
}

/* ---- chip tray ---- */
.chip-tray { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 10px 0; }
.chip-hint { font-size: 0.66rem; color: var(--muted); text-align: center; }
.chiprow { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* ---- chip spec C1 ---- */
.chip {
  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: 700; font-size: 0.72rem;
  cursor: pointer; transition: transform 0.12s;
  display: flex; align-items: center; justify-content: center;
  user-select: none;
  box-shadow: 0 5px 12px -5px rgba(40,42,41,0.5), inset 0 0 0 4px rgba(255,255,255,0.12);
}
.chip:active { transform: scale(0.92); }
.chip.c1   { background: #b9c3c7; color: var(--c-dark); }
.chip.c5   { background: var(--c-blue); }
.chip.c25  { background: var(--c-teal); }
.chip.c100 { background: var(--c-dark); border-color: var(--c-yellow); color: var(--c-yellow); }
.chip.c500 { background: #7E57C2; }
.chip:disabled { opacity: 0.35; pointer-events: none; transform: none; }
.chip.selected {
  transform: scale(1.12);
  box-shadow: 0 0 0 3px var(--c-yellow), inset 0 0 0 4px rgba(255,255,255,0.12);
}

/* ---- mini chips in bet-chips area ---- */
.chip-mini {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px dashed rgba(255,255,255,0.7);
  font-family: 'JetBrains Mono', monospace; font-size: 0.55rem; font-weight: 700; color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}
.chip-mini.c1   { background: #b9c3c7; color: var(--c-dark); }
.chip-mini.c5   { background: var(--c-blue); }
.chip-mini.c25  { background: var(--c-teal); }
.chip-mini.c100 { background: var(--c-dark); border-color: var(--c-yellow); color: var(--c-yellow); }

/* ---- action buttons ---- */
.action-btns { display: flex; gap: 8px; justify-content: center; margin: 12px 0; }
.btn {
  font-family: 'Cinzel', serif; letter-spacing: 0.06em;
  padding: 14px 24px; border-radius: 12px; border: none; cursor: pointer;
  font-size: 0.9rem; transition: transform 0.08s, filter 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.38; filter: grayscale(0.3); cursor: default; }
.btn-primary { background: var(--c-red); color: #fff; flex: 1; }
.btn-secondary {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); flex: 1;
}
.btn-secondary:disabled { opacity: 0.35; }

/* ---- footer nav ---- */
.topbar nav { margin-top: 4px; }

/* ---- sim tab ---- */
.sim-intro { font-size: 0.84rem; color: var(--muted); margin-bottom: 14px; line-height: 1.7; }
.he-section { margin: 14px 0; }
.he-section h3 { font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; margin: 0 0 6px; color: var(--ink); }
.he-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.he-table th { background: var(--surface-2); padding: 6px 10px; text-align: center; border-bottom: 2px solid var(--line); font-family: 'JetBrains Mono', monospace; }
.he-table td { padding: 6px 10px; text-align: center; border-bottom: 1px solid var(--line-soft); }
.he-table tr:hover td { background: var(--surface-2); }

.sim-form {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; margin: 10px 0;
}
.sim-form .block { margin-bottom: 10px; }
.sim-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: var(--muted); }
.sim-form select, .sim-form input[type=number] {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  font-family: inherit; font-size: 0.84rem; background: var(--bg); color: var(--ink);
}
.sim-btn {
  width: 100%; padding: 12px; border: none; border-radius: 10px;
  background: var(--c-blue); color: #fff; font-family: 'Cinzel', serif;
  font-size: 0.9rem; font-weight: 600; cursor: pointer; margin-top: 4px;
}
.sim-btn:hover { filter: brightness(1.08); }
.sim-result {
  margin: 10px 0; padding: 14px; background: var(--surface-2);
  border-radius: 10px; font-size: 0.82rem; line-height: 1.8;
}
.sim-stat-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 8px;
}
.sim-stat-grid .stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; text-align: center;
}
.sim-stat-grid .stat.full { grid-column: 1 / -1; background: rgba(242,95,92,0.05); border-color: rgba(242,95,92,0.25); }
.sim-stat-grid .sk { display: block; font-size: 0.62rem; color: var(--muted); margin-bottom: 2px; letter-spacing: 0.04em; }
.sim-stat-grid .sv { font-weight: 700; font-size: 1.05rem; color: var(--ink); }
.sim-stat-grid .sv.pos { color: var(--win); }
.sim-stat-grid .sv.neg { color: var(--lose); }
.sim-stat-grid .sv.big { font-size: 1.35rem; }
.sim-meta { font-size: 0.7rem; color: var(--muted); margin-top: 8px; }
.play-foot { text-align: center; margin: 18px 0 6px; font-size: 0.8rem; color: var(--muted); }

/* ---- sim: graph ---- */
.sim-form .field { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: var(--muted); }
.sim-progress { display: flex; align-items: center; gap: 8px; margin: 12px 0; }
.prog-bar { flex: 1; height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.prog-fill { height: 100%; background: var(--c-blue); border-radius: 4px; width: 0; transition: width 0.1s; }
.prog-text { font-size: 0.75rem; color: var(--muted); min-width: 36px; }
.sim-results { margin: 10px 0; }
.sim-stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 12px 0; }
.sim-stat { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; }
.sim-stat .sk { display: block; font-size: 0.62rem; color: var(--muted); margin-bottom: 2px; letter-spacing: 0.04em; }
.sim-stat .sv { font-weight: 700; font-size: 1.05rem; color: var(--ink); }
.sim-stat .sv.pos { color: var(--win); }
.sim-stat .sv.neg { color: var(--lose); }
.sim-canvas-label { font-size: 0.75rem; color: var(--muted); margin: 10px 0 4px; text-align: center; }
.sim-canvas { display: block; width: 100%; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }

/* ---- money wheel visual ---- */
.wheel-wrap { position: relative; margin: 16px auto 12px; width: 200px; height: 200px; }
.wheel-svg { width: 200px; height: 200px; }
.wheel-pointer {
  position: absolute; top: -8px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 10px solid transparent; border-right: 10px solid transparent;
  border-top: 22px solid var(--c-red);
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}
.spin-result {
  text-align: center; font-family: 'Cinzel', serif; font-weight: 700;
  font-size: 1.5rem; color: var(--c-yellow);
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  min-height: 2.2rem; margin: 4px 0;
}
