/* v73: subbar mode chip (display only — mode changes live in
   the title cards and MENU) + MENU settings rows */
.mode-chip {
  display: inline-flex; align-items: center; min-height: 26px; padding: 1px 12px;
  border-radius: 999px; border: 1.5px solid var(--gold); background: var(--panel);
  color: var(--gold); font-weight: 900; font-size: 11.5px; white-space: nowrap;
}
.card .menu-set-label { font-size: 11px; font-weight: 900; letter-spacing: .12em; color: var(--ink-dim); margin: 16px 0 6px; text-align: left; }
.card .menu-seg { display: flex; gap: 6px; }
.card .menu-seg button {
  font: inherit; font-weight: 900; font-size: 13.5px; border-radius: 10px; cursor: pointer;
  min-height: 42px; padding: 4px 6px; border: 1.5px solid var(--line);
  background: var(--panel2); color: var(--ink); flex: 1; white-space: nowrap;
}
.card .menu-seg button.on { border-color: var(--gold); background: var(--panel); color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.title-btns { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 24px; }
.btn-start {
  font: inherit; font-weight: 900; font-size: 19px; letter-spacing: .08em; cursor: pointer;
  min-height: 58px; border-radius: 12px; border: none;
  background: var(--accent); color: #fff; box-shadow: 0 8px 22px rgba(211,56,44,.35);
}
.btn-sub {
  font: inherit; font-weight: 900; font-size: 15px; cursor: pointer;
  min-height: 48px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--panel2); color: var(--ink);
}
.title-credit { margin-top: 28px; font-size: 11px; color: var(--ink-dim); line-height: 1.7; }
.help-inner { max-width: 560px; margin: 0 auto; padding: 18px 14px 40px; }
.help-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px 20px 22px; box-shadow: 0 18px 50px rgba(0,0,0,.4); text-align: left;
}
.help-card h2 { font-family: "Shippori Mincho B1", serif; margin: 0 0 4px; font-size: 24px; }
.help-card h3 { margin: 18px 0 6px; font-size: 14px; letter-spacing: .06em; color: var(--gold); }
.help-card p { font-size: 13.5px; line-height: 1.75; margin: 6px 0; }
.help-card ul { margin: 6px 0; padding-left: 20px; }
.help-card li { font-size: 13.5px; line-height: 1.75; margin: 3px 0; }
.help-card .btn-sub { width: 100%; margin-top: 20px; }
.help-toprow { display: flex; justify-content: flex-end; margin-bottom: 2px; }
.help-x {
  font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
  background: none; border: 1px solid var(--line); border-radius: 6px; color: var(--ink-dim);
  min-height: 30px; padding: 2px 10px;
}
.card .btncol { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.card .btncol button {
  font: inherit; font-weight: 900; font-size: 15px; border-radius: 10px; cursor: pointer; min-height: 48px;
  padding: 6px 18px; border: 1.5px solid var(--line); background: var(--panel2); color: var(--ink); width: 100%;
}
.card .btncol button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.card .btnrow a.btnlink {
  font: inherit; font-weight: 900; font-size: 15px; border-radius: 10px; min-height: 46px;
  padding: 6px 18px; border: 1.5px solid var(--line); background: var(--panel2); color: var(--ink);
  flex: 1; display: flex; align-items: center; justify-content: center; text-decoration: none;
}

/* ---------- CPU thought bubbles (UI layer only) ---------- */
.seat-block, .seat-side { position: relative; }
.cpu-bubble {
  position: absolute; z-index: 9; pointer-events: none;
  background: #fdfcf2; color: #22301f; border: 1px solid rgba(30,40,20,.35);
  border-radius: 10px; padding: 5px 9px; max-width: 190px;
  font-size: 11.5px; font-weight: 700; line-height: 1.45;
  box-shadow: 0 3px 10px rgba(0,0,0,.35);
  animation: bubfade .18s ease-out;
}
.cpu-bubble::after {
  content: ""; position: absolute; top: -5px; width: 9px; height: 9px;
  background: #fdfcf2; border-left: 1px solid rgba(30,40,20,.35); border-top: 1px solid rgba(30,40,20,.35);
  transform: rotate(45deg);
}
.cpu-bubble.bp2 { top: 26px; left: 50%; transform: translateX(-50%); white-space: nowrap; }
.cpu-bubble.bp2::after { left: 50%; margin-left: -5px; }
.cpu-bubble.bp3 { top: calc(100% + 5px); left: 0; }
.cpu-bubble.bp3::after { left: 14px; }
.cpu-bubble.bp1 { top: calc(100% + 5px); right: 0; }
.cpu-bubble.bp1::after { right: 14px; }
@keyframes bubfade { from { opacity: 0; } to { opacity: 1; } }
#cpuBubble {
  position: absolute; z-index: 6; pointer-events: none; display: none;
  background: #fdfcf2; color: #22301f; border: 1px solid rgba(30,40,20,.35);
  border-radius: 10px; padding: 5px 9px; max-width: 210px;
  font-size: 11.5px; font-weight: 700; line-height: 1.45;
  box-shadow: 0 3px 10px rgba(0,0,0,.35);
}
#cpuBubble.show { display: block; }
#cpuBubble.bub2 { left: 50%; top: 34px; transform: translateX(-50%); white-space: nowrap; }
#cpuBubble.bub3 { left: 10px; top: 52px; }
#cpuBubble.bub1 { right: 10px; top: 52px; }
@media (prefers-reduced-motion: reduce) { .cpu-bubble { animation: none; } }
/* ---------- 3D first-person stage ---------- */
#table.stage-mode { padding: 0; overflow: hidden; background: #6f7f45; }
#stage3d { position: relative; height: 540px; border-radius: 13px; overflow: hidden; cursor: pointer; }
#stage3d canvas { display: block; width: 100%; height: 100%; }
.build-tag {
  position: fixed; right: 8px; bottom: 8px; z-index: 55; pointer-events: none;
  font-size: 10px; font-weight: 700; letter-spacing: .08em; color: rgba(238,243,236,.66);
  background: rgba(3,26,15,.55); border: 1px solid rgba(255,255,255,.14); border-radius: 4px; padding: 1px 6px;
  font-variant-numeric: tabular-nums;
}
/* compact plates only, like the classic top-down table: the
   round plate centred on the top edge, one small info cluster
   under it (dora indicators, the wall count big, the kyotaku
   counter small), and one small score plate stuck to each
   seat's own edge — every plate readable from the viewer's
   side (the far plate upright, the side plates vertical). */
#hudRound {
  position: absolute; left: 50%; top: 8px; transform: translateX(-50%); z-index: 3; pointer-events: none;
  font-size: 13px; font-weight: 900; color: #f7f3df; letter-spacing: .04em; white-space: nowrap;
  background: rgba(3,26,15,.55); border: 1px solid rgba(255,255,255,.18); border-radius: 6px; padding: 2px 10px;
}
#hudCenter {
  position: absolute; left: 50%; top: 38px; transform: translateX(-50%); z-index: 3;
  display: flex; align-items: center; gap: 8px; white-space: nowrap; pointer-events: none;
  font-size: 12px; font-weight: 700; color: #f7f3df;
  background: rgba(3,26,15,.55); border: 1px solid rgba(255,255,255,.18); border-radius: 6px; padding: 3px 10px;
}
#hudCenter .hc-dora { display: inline-flex; gap: 2px; }
#hudCenter .hc-left b { font-size: 17px; color: #ffe9a8; font-variant-numeric: tabular-nums; }
#hudCenter .hc-kyo { color: #ffd9d4; font-size: 11.5px; }
.seat-label {
  position: absolute; z-index: 3; pointer-events: none; white-space: nowrap;
  font-size: 11.5px; font-weight: 700; color: #f7f3df;
  background: rgba(3,26,15,.55); border: 1px solid rgba(255,255,255,.18); border-radius: 6px; padding: 2px 8px;
}
.seat-label b { color: #ffe9a8; font-variant-numeric: tabular-nums; }
.seat-label .wd { font-family: "Shippori Mincho B1", serif; font-weight: 800; }
.seat-label .oya { color: #ffd34d; font-size: 10.5px; font-weight: 900; }
.seat-label .ri { color: #ff8d84; font-size: 10.5px; font-weight: 900; }
.seat-label.on { color: #ffd34d; }
.seat-label.sl0 { left: 10px; bottom: 8px; }
.seat-label.sl2 { left: 10px; top: 8px; }
.seat-label.sl3 { left: 6px; top: 50%; transform: translateY(-50%) rotate(-90deg); }
.seat-label.sl1 { right: 6px; top: 50%; transform: translateY(-50%) rotate(90deg); }
#fxLayer { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; pointer-events: none; overflow: hidden; }
.fx-big {
  font-family: "Shippori Mincho B1", serif; font-weight: 800; color: #fff;
  font-size: clamp(56px, 13vw, 118px); letter-spacing: .04em; white-space: nowrap;
  text-shadow: 0 0 6px rgba(255,60,40,.9), 0 4px 0 #8f161b, 0 10px 34px rgba(0,0,0,.65), 0 0 46px rgba(255,190,40,.55);
  animation: fxpop 1.25s cubic-bezier(.16,1.4,.3,1) forwards;
}
.fx-big.gold { color: #ffe9a8; text-shadow: 0 0 6px rgba(255,190,40,.95), 0 4px 0 #8a6a10, 0 10px 34px rgba(0,0,0,.65), 0 0 52px rgba(255,211,77,.8); }
.fx-big.small { font-size: clamp(38px, 8vw, 64px); }
@keyframes fxpop {
  0% { transform: scale(.2) rotate(-7deg); opacity: 0; }
  14% { transform: scale(1.22) rotate(2deg); opacity: 1; }
  26% { transform: scale(1) rotate(0deg); }
  78% { transform: scale(1.04); opacity: 1; }
  100% { transform: scale(1.1) translateY(-12px); opacity: 0; }
}
.fx-flash { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 55%, rgba(255,220,110,.5), rgba(255,220,110,0) 65%); animation: fxfflash .55s ease-out forwards; }
@keyframes fxfflash { from { opacity: 1; } to { opacity: 0; } }
/* ---------- win reveal: the hand falls open (2D fallback) ---------- */
#winCall2d { position: fixed; inset: 0; z-index: 45; display: flex; align-items: center; justify-content: center; pointer-events: none; overflow: hidden; }
/* ---------- v48: lightning strike on the winning tile ---------- */
#boltLayer { position: fixed; inset: 0; z-index: 47; pointer-events: none; overflow: hidden; }
.bolt-flash { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 38%, rgba(215,238,255,.8), rgba(140,195,255,.32) 46%, rgba(140,195,255,0) 76%); animation: boltfade .45s ease-out forwards; }
.bolt-glow { position: absolute; width: 200px; height: 200px; margin: -100px 0 0 -100px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.95) 0%, rgba(165,218,255,.7) 32%, rgba(110,180,255,0) 70%); animation: boltfade .5s ease-out forwards; }
@keyframes boltfade { 0% { opacity: 0; } 10% { opacity: 1; } 100% { opacity: 0; } }
#boltLayer svg { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 0 6px rgba(140,205,255,.9)); animation: boltflicker .5s steps(1) forwards; }
@keyframes boltflicker { 0% { opacity: 1; } 18% { opacity: .2; } 30% { opacity: 1; } 52% { opacity: .35; } 70% { opacity: .9; } 100% { opacity: 0; } }
.tile.bolt-hit { filter: brightness(2.3) saturate(.35); box-shadow: 0 0 24px 7px rgba(170,220,255,.95); }
@media (prefers-reduced-motion: reduce) { #boltLayer { display: none; } }
/* ---------- table shake (2D fallback; the 3D stage shakes its
   camera instead, via __stageShake). --shx/--shy are the peak
   offset in px, signed toward the acting seat's side of the
   board, set by shake2D() — so the jolt leans toward whoever
   caused it: down for you, right/top/left for the CPUs. */
.table.tbl-shake { animation: tblshake .5s cubic-bezier(.2,.7,.3,1); }
@keyframes tblshake {
  0% { transform: translate(0, 0); }
  20% { transform: translate(var(--shx, 0px), var(--shy, 0px)); }
  42% { transform: translate(calc(var(--shx, 0px) * -.55), calc(var(--shy, 0px) * -.55)); }
  64% { transform: translate(calc(var(--shx, 0px) * .32), calc(var(--shy, 0px) * .32)); }
  82% { transform: translate(calc(var(--shx, 0px) * -.13), calc(var(--shy, 0px) * -.13)); }
  100% { transform: translate(0, 0); }
}
@media (prefers-reduced-motion: reduce) { .table.tbl-shake { animation: none; } }
/* ---------- hand start banner (round + dealer) ---------- */
#startBanner {
  position: fixed; inset: 0; z-index: 46; display: none;
  align-items: center; justify-content: center;
  background: rgba(8,14,8,.45); cursor: pointer; padding: 14px;
}
#startBanner.show { display: flex; }
.sb-card {
  text-align: center; background: rgba(4,32,18,.9); color: #f2efe2;
  border: 1px solid rgba(255,255,255,.22); border-radius: 14px;
  padding: 20px 40px 18px; box-shadow: 0 14px 44px rgba(0,0,0,.5);
  animation: sbpop .32s cubic-bezier(.16,1.3,.3,1) both;
}
.sb-card.mine {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold), 0 0 34px rgba(255,211,77,.35), 0 14px 44px rgba(0,0,0,.5);
}
.sb-kicker { font-size: 12px; font-weight: 900; letter-spacing: .14em; color: #d8dcc8; }
.sb-round {
  font-family: "Shippori Mincho B1", serif; font-weight: 800;
  font-size: clamp(46px, 11vw, 74px); line-height: 1.15; color: #fff;
}
.sb-card.settled .sb-round { animation: sbsettle .3s ease-out; }
.sb-dealer { font-size: 19px; font-weight: 900; color: #ffe9a8; margin-top: 2px; }
.sb-mine {
  display: inline-block; margin-top: 9px; background: var(--gold); color: #241a02;
  font-size: 13.5px; font-weight: 900; border-radius: 999px; padding: 3px 14px;
}
@keyframes sbpop { from { transform: scale(.84); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes sbsettle { 0% { transform: scale(1.14); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .sb-card, .sb-card.settled .sb-round { animation: none; } }
.tile.reveal-fall { animation: revealfall .5s cubic-bezier(.3,.7,.3,1) both; transform-origin: 50% 100%; }
.reveal-fall:nth-child(2) { animation-delay: .03s; } .reveal-fall:nth-child(3) { animation-delay: .06s; }
.reveal-fall:nth-child(4) { animation-delay: .09s; } .reveal-fall:nth-child(5) { animation-delay: .12s; }
.reveal-fall:nth-child(6) { animation-delay: .15s; } .reveal-fall:nth-child(7) { animation-delay: .18s; }
.reveal-fall:nth-child(8) { animation-delay: .21s; } .reveal-fall:nth-child(9) { animation-delay: .24s; }
.reveal-fall:nth-child(10) { animation-delay: .27s; } .reveal-fall:nth-child(11) { animation-delay: .30s; }
.reveal-fall:nth-child(12) { animation-delay: .33s; } .reveal-fall:nth-child(13) { animation-delay: .36s; }
.reveal-fall:nth-child(14) { animation-delay: .39s; }
@keyframes revealfall {
  0% { transform: perspective(320px) rotateX(-62deg) translateY(5px); opacity: .45; }
  62% { transform: perspective(320px) rotateX(7deg) translateY(0); opacity: 1; }
  100% { transform: perspective(320px) rotateX(0deg); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .tile.reveal-fall { animation-duration: .15s; } }
.stage-hint { position: absolute; left: 10px; bottom: 8px; z-index: 4; font-size: 11px; font-weight: 700; color: rgba(240,244,230,.85); text-shadow: 0 1px 3px rgba(0,0,0,.8); pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .fx-big { animation-duration: .3s; } }
@media (max-width: 560px) {
  .wrap { padding-top: 4px; }
  .topbar { margin-bottom: 6px; gap: 4px; }
  .settai-box .lbl { display: none; }
  .seg button { min-height: 30px; font-size: 12px; padding: 2px 7px; }
  .naki-toggle { min-height: 30px; font-size: 11.5px; padding: 2px 7px 2px 3px; gap: 5px; }
  .naki-toggle .track { width: 28px; height: 17px; }
  .naki-toggle .track::after { width: 13px; height: 13px; }
  .naki-toggle.on .track::after { left: 13px; }
  .naki-toggle .state { min-width: 21px; font-size: 10.5px; }
  .meta-box .round { font-size: 14px; }
  .meta-box button { min-height: 28px; padding: 2px 6px; }
  #stage3d { height: 500px; height: min(520px, 68svh); }
  #hudRound { font-size: 12px; top: 6px; }
  #hudCenter { font-size: 11px; top: 32px; padding: 2px 8px; gap: 6px; }
  .seat-label { font-size: 10.5px; }
  .seat-label.sl0 { left: 8px; bottom: 6px; }
  .seat-label.sl2 { left: 8px; top: 6px; }
  .seat-label.sl3 { left: 4px; }
  .seat-label.sl1 { right: 4px; }
  .stage-hint { display: none; }
}
@media (max-width: 560px) {
  .table { border-width: 6px; padding: 13px 9px 13px; outline-offset: -10px; }
  .tile.hand { font-size: 18px; }
  button.tile.hand { min-height: 0; }
  .handrow { padding: 8px 5px 5px; }
  .board { grid-template-columns: minmax(0,1fr) 120px minmax(0,1fr); gap: 3px 4px; }
  .pool.tb { grid-template-columns: repeat(6, 26px); min-height: 100px; }
  .tile.pool-t { font-size: 12px; }
  .pool.sd .tile.pool-t { width: 24px; max-width: 24px; }
  .pool.sd { grid-template-rows: repeat(6, 28px); grid-auto-columns: 33px; min-height: 168px; min-width: 70px; }
  .pool.sd .cell { width: 33px; height: 28px; }
  .seat-side { width: 56px; }
  .seat-side .pname { font-size: 11px; }
  .seat-side .pscore { font-size: 10.5px; }
  .dora-row { flex-wrap: wrap; white-space: normal; justify-content: center; }
  .center-info .ci-sub { white-space: normal; line-height: 1.5; }
  .center-info { min-height: 154px; padding: 26px 4px; }
  .backs.side .tileback { width: 21px; height: 14px; }
  .center-info .ci-round { font-size: 16px; }
  .tileback { width: 12px; height: 20px; border-bottom-width: 2px; }
}
