/* v2: a shared game table. Existing wheel/effect mechanics remain in base.css. */
body.v2 {
  --paper: #b94418;
  --deep: #66241b;
  --panel: #87321c;
  --shell: #fff3d6;
  --ink: #59271d;
  --fog: #ffefdb;
  --muted-ink: #815137;
  --coral: #ffd36a;
  --brass: #ffc557;
  --table-line: #d7874c;
  --ticket-line: #e6c7a1;
  --danger: #ffe0db;
  --scrim: rgba(52, 19, 10, .82);
  --shadow: rgba(52, 19, 10, .28);
  --sunset-light: #b94c19;
  --sunset-dark: #902d1b;
  --table-background: radial-gradient(ellipse at 80% 0%, var(--sunset-light), transparent 55%), linear-gradient(155deg, var(--paper), var(--sunset-dark));
  --font-body: "Noto Sans JP", -apple-system, "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  --v2-display: "Bebas Neue", Impact, sans-serif;
  --v2-data: ui-monospace, "SF Mono", Consolas, monospace;
  --text: var(--shell);
  --text-dim: var(--fog);
  --accent-1: var(--coral);
  --accent-2: var(--brass);
  --modal-bg: var(--deep);
  --modal-border: var(--table-line);
  --modal-card: var(--panel);
  --wheel-rim-inner: var(--brass);
  --wheel-rim-outer: var(--deep);
  --wheel-rim-glow: var(--shadow);
  background: var(--table-background);
  background-color: var(--paper);
  background-attachment: fixed;
  color: var(--shell);
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  font-size: 14px;
  letter-spacing: 0;
}
body.v2[data-theme="izakaya"] {
  --table-background: var(--paper);
  --paper: #293341; --deep: #202936; --panel: #343f4d; --shell: #f4ecd8;
  --ink: #323344; --fog: #bcc6cc; --coral: #e48169; --brass: #debd7c;
  --table-line: #505c68; --ticket-line: #d8cfba; --muted-ink: #666678;
}
body.v2[data-theme="neon"] {
  --table-background: var(--paper);
  --paper: #252645; --deep: #1c1d37; --panel: #323457; --shell: #eeedf8;
  --ink: #323456; --fog: #bfbde0; --coral: #dd99d9; --brass: #9bdbda;
  --table-line: #525477; --ticket-line: #d3d0e6; --muted-ink: #6d6b8d;
}
body.v2::before { display: none; }
.v2 .app { max-width: 1120px; gap: 0; }
.v2 button, .v2 input, .v2 textarea, .v2 select { font-family: var(--font-body); }
.v2 button:disabled { cursor: default; opacity: .45; }
.v2 [hidden] { display: none !important; }
.v2 .app-header { padding: 0 0 24px; margin-bottom: 18px; border-bottom: 1px solid var(--table-line); }
.wordmark { display: flex; align-items: center; gap: 10px; color: var(--shell); text-decoration: none; font: 26px/1 var(--v2-display); letter-spacing: .06em; }
.wordmark strong { font-weight: 400; }
.wordmark small { font: 10px var(--v2-data); letter-spacing: 0; border: 1px solid var(--table-line); border-radius: 4px; padding: 4px; align-self: flex-start; }
.brand-mark { display: grid; place-items: center; width: 39px; height: 39px; border: 1px solid var(--brass); border-radius: 50%; font: 35px/1 serif; color: var(--brass); }
.v2 .header-actions { gap: 8px; }
.v2 .icon-btn { width: 42px; height: 42px; border-radius: 50%; border-color: var(--table-line); }
.settings-button { display: flex; align-items: center; gap: 8px; border: 1px solid var(--table-line); border-radius: 24px; padding: 9px 16px; color: var(--shell); background: transparent; font-size: 12px; }
.settings-button:hover { background: var(--panel); }
.game-grid { display: grid; grid-template-columns: minmax(0, 1fr) 326px; grid-template-areas: "play modes" "play roster" "play history"; gap: 20px 48px; align-items: start; }
.play-panel { grid-area: play; min-width: 0; padding: 0 20px; }
.table-intro { text-align: center; margin-bottom: 28px; }
.eyebrow { font-size: 11px; letter-spacing: .12em; line-height: 1.7; font-weight: 500; color: var(--fog); }
.table-intro h1 { margin-top: 8px; font-size: clamp(26px, 3vw, 36px); font-weight: 700; line-height: 1.45; letter-spacing: .05em; }
.mode-panel { grid-area: modes; min-width: 0; padding-top: 2px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-heading h2 { font-size: 13px; font-weight: 500; letter-spacing: .04em; }
.section-heading > span { color: var(--brass); }
.v2 .mode-bar { padding: 4px; border-radius: 12px; gap: 3px; border: 1px solid var(--table-line); background: var(--deep); backdrop-filter: none; }
.v2 .mode-btn { min-height: 66px; font-size: 12px; letter-spacing: 0; border-radius: 8px; padding: 10px 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; color: var(--fog); }
.v2 .mode-btn .ico { font-size: 20px; }
.v2 .mode-btn[aria-selected="true"] { color: var(--ink); background: var(--shell); box-shadow: none; }
.mode-description { color: var(--fog); font-size: 12px; line-height: 1.85; min-height: 45px; padding: 12px 2px 0; }
.wheel-wrap { padding: 12px 0; }
.v2 .wheel-stage { border-radius: 50%; width: min(100%, 420px); margin: 0 auto; box-shadow: 0 0 0 1px var(--table-line), 0 0 32px var(--shadow); }
.v2 .wheel { border-width: 7px; box-shadow: inset 0 0 0 2px var(--deep); }
.v2 .wheel-label { font-family: var(--font-body); font-size: 13px; }
.v2 .center-dot { width: 60px; height: 60px; box-shadow: 0 3px 12px var(--shadow); }
.v2 .tap-hint { display: none; }
.v2 .pointer { filter: none; }
.spin-controls { max-width: 380px; margin: 26px auto 0; }
.spin-button { width: 100%; min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border: 0; border-radius: 9px; padding: 15px 22px; background: var(--coral); color: var(--deep); font-size: 16px; font-weight: 700; box-shadow: 0 4px 0 var(--deep); }
.spin-button:hover:not(:disabled) { filter: brightness(1.07); }
.spin-button:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 var(--deep); }
.spin-arrow { font: 28px/1 var(--font-body); }
.spin-hint { margin-top: 12px; text-align: center; color: var(--fog); font-size: 11px; line-height: 1.6; }
.v2 .result { margin: 20px 0 0; min-height: 0; font-family: var(--font-body); font-weight: 700; font-size: 20px; line-height: 1.6; }
.v2 .result:not(.show) { height: 0; overflow: hidden; margin: 0; }
.v2 .reveal-card { border: 1px solid var(--table-line); background: var(--deep); border-radius: 12px; box-shadow: none; padding: 24px; }
.v2 .reveal-card .winner-name { letter-spacing: .02em; font-family: var(--font-body); }
.v2 .reveal-card .text { font-size: 18px; line-height: 1.75; }
.v2 .scoreboard-wrap { grid-area: roster; display: block; background: var(--shell); color: var(--ink); padding: 22px; border-radius: 3px 3px 15px 15px; border-top: 5px solid var(--brass); margin: 0; min-width: 0; }
.v2 .scoreboard-wrap.empty { display: block; }
.v2 .scoreboard-head { margin-bottom: 16px; align-items: center; }
.v2 .scoreboard-head .eyebrow { color: var(--muted-ink); font-size: 10px; margin-bottom: 5px; }
.v2 .scoreboard-head h2 { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 700; }
.count-badge { font: 12px/1 var(--v2-data); border: 1px solid var(--ticket-line); border-radius: 50%; min-width: 24px; height: 24px; display: inline-grid; place-items: center; }
.v2 .scoreboard { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-height: 304px; overflow-y: auto; padding: 0; }
.v2 .score-pill { display: grid; grid-template-columns: 26px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 6px; align-items: center; min-width: 0; border: 0 !important; border-radius: 7px; background: transparent; padding: 9px 4px; box-shadow: none; }
.v2 .score-pill .emoji { grid-row: 1/3; font-size: 21px; }
.v2 .score-pill .name { text-align: left; font-family: var(--font-body); font-size: 11px; line-height: 1.6; letter-spacing: 0; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: none; }
.v2 .score-pill .num { text-align: left; font: 20px/1.4 var(--v2-data); color: var(--ink); }
.v2 .score-pill .num::after { font-family: var(--font-body); font-size: 9px; margin-left: 4px; color: var(--muted-ink); }
.score-footer { border-top: 1px dashed var(--ticket-line); margin-top: 16px; padding-top: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.v2 .scoreboard-label { color: var(--muted-ink); font: 10px var(--font-body); letter-spacing: 0; }
.v2 .scoreboard-reset { color: var(--muted-ink); border: 0; padding: 6px 0; font: 10px var(--font-body); background: transparent; text-transform: none; letter-spacing: 0; }
.text-button { border: none; background: transparent; color: inherit; padding: 8px 0; font-size: 11px; text-decoration: underline; text-underline-offset: 4px; }
.roster-empty { font-size: 12px; line-height: 1.8; color: var(--muted-ink); padding: 10px 0; }
.round-history { grid-area: history; padding: 2px 0 0; min-width: 0; }
.round-count { font: 11px var(--v2-data); }
#roundHistory { list-style: none; max-height: 214px; overflow-y: auto; }
.history-row { border-top: 1px solid var(--table-line); padding: 11px 0; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; }
.history-number { font: 12px/1.8 var(--v2-data); color: var(--brass); }
.history-result { font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.history-meta, .history-detail { font-size: 10px; line-height: 1.6; color: var(--fog); margin-top: 3px; overflow-wrap: anywhere; }
.history-detail { max-height: 3.2em; overflow: auto; }
.history-empty { color: var(--fog); font-size: 12px; line-height: 1.8; padding: 8px 0; }
.history-note { color: var(--fog); font-size: 10px; line-height: 1.7; margin-top: 14px; }
.table-footer { display: flex; justify-content: space-between; gap: 16px; align-items: center; border-top: 1px solid var(--table-line); padding-top: 16px; margin-top: 38px; color: var(--fog); font: 10px var(--v2-data); letter-spacing: .06em; }
.v2 .onboard { display: none; border: 0; padding: 0; background: transparent; text-align: center; box-shadow: none; }
.v2 .onboard.show { display: block; }
.v2 .onboard h2 { font: 600 18px/1.6 var(--font-body); letter-spacing: 0; margin: 12px 0 6px; }
.v2 .onboard p { font-size: 12px; line-height: 1.8; }
.empty-dial { width: 128px; height: 128px; margin: 12px auto 24px; border: 6px solid var(--brass); outline: 1px solid var(--table-line); outline-offset: 10px; border-radius: 50%; display: grid; place-items: center; background: repeating-conic-gradient(var(--panel) 0deg 45deg, var(--deep) 45deg 90deg); }
.empty-dial span { background: var(--paper); border: 1px solid var(--brass); border-radius: 50%; width: 42px; height: 42px; font-size: 32px; color: var(--brass); line-height: 40px; }
.quick-players-form { display: flex; flex-direction: column; gap: 9px; max-width: 360px; margin: 22px auto 8px; text-align: left; }
.quick-players-form label, .player-add-form label { font-size: 12px; font-weight: 500; }
.quick-players-form small { font-size: 10px; line-height: 1.6; color: var(--fog); }
.v2 textarea, .v2 input:not([type="checkbox"]), .v2 select { background: var(--deep); color: var(--shell); border: 1px solid var(--table-line); border-radius: 7px; padding: 11px 12px; font-size: 16px; width: 100%; min-width: 0; }
.v2 textarea::placeholder, .v2 input::placeholder { color: var(--fog); opacity: .8; }
.v2 textarea { resize: vertical; }
.v2 .errmsg { color: var(--danger); font-size: 12px; }
.v2 .errmsg:empty { display: none; }
.v2 .btn-primary { background: var(--coral); color: var(--deep); font: 600 13px/1.5 var(--font-body); letter-spacing: 0; border-radius: 8px; box-shadow: none; padding: 14px 18px; }
.v2 .btn-secondary, .v2 .btn-danger { font: 12px/1.6 var(--font-body); letter-spacing: 0; border-radius: 7px; }
.v2 .modal-backdrop { background: var(--scrim); backdrop-filter: blur(8px); z-index: 250; }
.v2 .modal { background: var(--deep); border: 1px solid var(--table-line); border-radius: 18px; padding: 24px; width: min(640px, 100%); max-width: 640px; max-height: min(88dvh, 880px); box-shadow: 0 20px 80px var(--shadow); }
.v2 .modal-title { font: 600 20px var(--font-body); letter-spacing: .02em; }
.v2 .tab-bar { background: var(--panel); border-radius: 10px; padding: 4px; }
.v2 .tab-btn { font: 11px var(--font-body); letter-spacing: 0; min-width: 0; padding: 10px 3px; border-radius: 6px; }
.v2 .tab-btn[aria-selected="true"] { background: var(--shell); color: var(--ink); }
.v2 .settings-group h4, .v2 .stats-section h4 { font: 600 13px var(--font-body); letter-spacing: 0; }
.v2 .opt-btn, .v2 .theme-card { letter-spacing: 0; font-family: var(--font-body); }
.v2 .player-row { background: var(--panel); border-radius: 8px; }
.v2 .player-row .name-input { font-size: 16px; background: transparent; }
.player-add-form { display: flex; flex-direction: column; gap: 8px; }
.player-add-form > div { display: flex; gap: 8px; }
.v2 .add-player-btn { flex: 0 0 auto; font: 12px var(--font-body); padding: 10px 14px; margin: 0; border-radius: 7px; border-style: solid; }
.v2.settings-open { overflow: hidden; }
.v2 #revealNext { min-height: 44px; }
.v2 .grecaptcha-badge { bottom: 6px !important; }
@media (max-width: 800px) {
  body.v2 { padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom)); }
  .v2 .app { max-width: 560px; }
  .v2 .app-header { margin-bottom: 22px; padding-bottom: 18px; }
  .wordmark { font-size: 20px; gap: 8px; }
  .brand-mark { width: 31px; height: 31px; font-size: 28px; }
  .wordmark small { display: none; }
  .wordmark { font-size: 18px; white-space: nowrap; }
  .settings-button { padding: 10px; border-radius: 50%; width: 40px; height: 40px; justify-content: center; }
  .settings-button > span:last-child { display: none; }
  .game-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "modes" "play" "roster" "history"; gap: 22px; }
  .play-panel { padding: 0 12px; }
  .table-intro { margin-bottom: 18px; }
  .table-intro h1 { font-size: 25px; margin-top: 5px; }
  .table-intro .eyebrow { font-size: 10px; }
  .mode-panel .section-heading { display: none; }
  .v2 .mode-btn { flex-direction: row; min-height: 46px; gap: 6px; padding: 9px 3px; }
  .v2 .mode-btn .ico { font-size: 17px; }
  .mode-description { min-height: 0; text-align: center; padding-top: 9px; font-size: 10px; line-height: 1.6; }
  .v2 .wheel-stage { width: min(100%, 360px); }
  .spin-controls { margin-top: 22px; }
  .spin-button { min-height: 54px; font-size: 15px; }
  .v2 .scoreboard-wrap { padding: 18px; }
  .v2 .scoreboard-head { margin-bottom: 10px; }
  .v2 .scoreboard { display: flex; overflow-x: auto; overflow-y: hidden; max-height: none; }
  .v2 .score-pill { flex: 0 0 115px; }
  .score-footer { margin-top: 10px; padding-top: 8px; }
  .v2 .scoreboard-head h2 { font-size: 15px; }
  .round-history { margin: 0 3px; }
  .table-footer { margin-top: 26px; font-size: 9px; }
  .v2 .modal-backdrop { padding: 12px; }
  .v2 .modal { padding: 18px; max-height: 92dvh; }
  .v2 .tab-btn { font-size: 10px; }
  .v2 .tab-btn .ico { font-size: 17px; }
  .v2 .onboard h2 { font-size: 16px; }
}
@media (max-width: 380px) {
  body.v2 { padding-left: 12px; padding-right: 12px; }
  .wordmark { font-size: 18px; }
  .wordmark small { display: none; }
  .v2 .header-actions { gap: 4px; }
  .player-add-form > div { flex-wrap: wrap; }
  .v2 .add-player-btn { width: 100%; }
}
/* Keep outcome probabilities and timers; reduce only visual motion. */
@media (prefers-reduced-motion: reduce) {
  .v2 *, .v2 *::before, .v2 *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Shared controls stay within the table and use the existing settings keys. */
.table-controls { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 12px; width: min(100%, 540px); margin: 0 0 26px auto; }
.table-controls label { min-width: 0; display: grid; gap: 6px; }
.table-controls label > span { font-size: 11px; color: var(--fog); }
.v2 .table-controls select { min-height: 46px; font-size: 16px; padding: 10px 8px; cursor: pointer; }
@media (max-width: 800px) {
  .table-controls { width: 100%; gap: 8px; margin-bottom: 22px; }
  .v2 .app-header { margin-bottom: 14px; }
}

/* Marukanido return chip — shared across the o-kani.com games. Spec: SPEC.md next to this file. */
.okani-home {
  position: fixed;
  z-index: 2147483000;
  top: calc(10px + env(safe-area-inset-top, 0px));
  left: calc(10px + env(safe-area-inset-left, 0px));
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-sizing: border-box;
  height: 32px;
  padding: 0 12px 0 9px;
  border: 1px solid rgba(37, 39, 33, .18);
  border-radius: 999px;
  background: rgba(244, 241, 232, .94);
  color: #252721;
  font: 700 12px/1 "Noto Sans CJK JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  letter-spacing: .06em;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
  -webkit-tap-highlight-color: transparent;
}
.okani-home:hover { background: #fff; color: #252721; }
.okani-home:focus-visible { outline: 3px solid #c93824; outline-offset: 3px; }
.okani-home__mark { display: block; flex: none; width: 18px; height: 18px; }
@media print { .okani-home { display: none; } }
/* Roulette (owner 2026-10-31): the chip sits in flow in the header row, between the wordmark and share/settings, so
   nothing else moves. minmax(0, 1fr) lets the wordmark cell give way instead of pushing the buttons off the row. At
   380px and below only the crab shows (the aria-label keeps the name). Hidden with visibility (no reflow) for the whole
   round (FEVER pick -> spin -> 8 s rest = setSpinPending's aria-busy) and while settings are open. */
.v2 .app-header { grid-template-columns: minmax(0, 1fr) auto auto; }
.okani-home { position: static; }
@media (max-width: 380px) {
  .okani-home { width: 32px; padding: 0; justify-content: center; }
  .okani-home__label { display: none; }
}
body:has(#wheelStage[aria-busy="true"]) .okani-home, body.settings-open .okani-home { visibility: hidden; }
