/* ---------- overlays ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(10,12,8,.62); z-index: 40;
  display: none; align-items: center; justify-content: center; padding: 14px;
}
.overlay.show { display: flex; }
.card {
  background: var(--panel); color: var(--ink); border-radius: 14px; max-width: 520px; width: 100%;
  max-height: 92vh; overflow-y: auto; padding: 20px 20px 16px; box-shadow: 0 18px 50px rgba(0,0,0,.4);
}
.card h2 { font-family: "Shippori Mincho B1", serif; margin: 0 0 4px; font-size: 24px; }
.card h3 { margin: 16px 0 6px; font-size: 14px; letter-spacing: .06em; color: var(--ink-dim); }
.card p { font-size: 13.5px; line-height: 1.65; margin: 6px 0; }
.win-meta { font-size: 13px; font-weight: 700; color: var(--ink-dim); margin-bottom: 2px; }
.yaku-rows { margin-top: 6px; }
.yaku-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding: 7px 2px; border-bottom: 1px solid var(--line);
  font-size: 17px; font-weight: 700;
}
.yaku-row .yh { font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; }
.win-total { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px; margin-top: 16px; }
.win-total .wt-rank { font-family: "Shippori Mincho B1", serif; font-weight: 800; font-size: 32px; color: var(--gold); }
.win-total .wt-pts { font-size: 36px; font-weight: 900; font-variant-numeric: tabular-nums; }
.win-total .win-sub { font-size: 12.5px; font-weight: 700; color: var(--ink-dim); }
/* v97: multiplier marks on the win card + the live badge */
.win-total .wt-mult {
  font-weight: 900; font-size: 19px; color: #fff; background: var(--accent);
  border-radius: 6px; padding: 2px 10px; white-space: nowrap; align-self: center;
}
.yaku-row.mult-row { color: #ffb3ab; font-weight: 900; }
#multBadge {
  margin: 0 auto 6px; width: fit-content; max-width: 100%;
  background: var(--accent); color: #fff; font-weight: 900; font-size: 14.5px;
  letter-spacing: .04em; border-radius: 999px; padding: 4px 16px;
  box-shadow: 0 3px 10px rgba(0,0,0,.45); text-align: center; white-space: nowrap;
}
#multBadge[hidden] { display: none; }
.final-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 6px; border-bottom: 1px solid var(--line);
}
.final-row .fr-rank { font-family: "Shippori Mincho B1", serif; font-weight: 800; font-size: 28px; color: var(--gold); min-width: 54px; }
.final-row .fr-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.final-row .fr-name { font-size: 13px; font-weight: 700; color: var(--ink-dim); }
.final-row .fr-score { font-size: 23px; font-weight: 900; font-variant-numeric: tabular-nums; }
.final-row .fr-side { display: flex; flex-direction: column; text-align: right; font-size: 12.5px; font-weight: 700; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.final-row .fr-side .tot { font-size: 16px; font-weight: 900; color: var(--ink); }
.final-row.me .fr-name { color: var(--accent); }
.final-row.me { background: rgba(211,56,44,.08); }
.winhand { display: flex; gap: 2px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.winhand .tile { flex: 0 0 auto; }
/* one meld = one unbreakable group on the result card, so a
   pon/chi/kan never splits across rows or sprawls */
.winmeld { display: inline-flex; gap: 2px; align-items: center; margin-left: 6px; }
.winmeld .tile { flex: 0 0 auto; }
.report-line {
  display: inline-block; margin-top: 12px; background: var(--panel2); border: 1px solid var(--gold);
  border-radius: 999px; padding: 4px 14px; font-size: 13px; font-weight: 900; color: var(--gold);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.standings { width: 100%; border-collapse: collapse; font-size: 14.5px; margin-top: 6px; }
.standings td, .standings th { padding: 7px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.standings td.num, .standings th.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.standings tr.me td { font-weight: 900; color: var(--accent); }
.card .btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.card .btnrow button {
  font: inherit; font-weight: 900; font-size: 15px; border-radius: 10px; cursor: pointer; min-height: 46px;
  padding: 6px 18px; border: 1.5px solid var(--line); background: var(--panel2); color: var(--ink); flex: 1;
}
.card .btnrow button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px);
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  background: #22241e; color: #f5f2e4; padding: 10px 18px; border-radius: 999px; font-size: 13.5px; font-weight: 700;
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 60; max-width: 92vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- title screen / help / menu (v36 shell) ---------- */
.shell-screen {
  position: fixed; inset: 0; z-index: 90; display: none; overflow-y: auto;
  background: radial-gradient(ellipse 120% 60% at 50% 0%, #173626 0%, var(--bg) 55%), var(--bg);
  color: var(--ink);
}
.shell-screen.show { display: block; }
#helpScreen { z-index: 95; }
.title-inner {
  max-width: 520px; margin: 0 auto; padding: 30px 20px 44px; min-height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
}
.logo-tiles { display: flex; gap: 5px; margin-bottom: 16px; }
.logo-tile {
  width: 44px; height: 58px; border-radius: 6px;
  background: linear-gradient(180deg, #fffdf4 0%, #f1ecd9 100%);
  border: 1px solid var(--tile-edge); border-bottom: 4px solid var(--tile-shadow);
  display: flex; align-items: center; justify-content: center;
  font-family: "Shippori Mincho B1", serif; font-weight: 800; font-size: 26px;
  box-shadow: 0 3px 8px rgba(0,0,0,.4);
}
.logo-title {
  font-family: "Shippori Mincho B1", serif; font-weight: 800;
  font-size: clamp(42px, 12.5vw, 62px); letter-spacing: .05em; line-height: 1.12; margin: 0;
}
.logo-title .accent { color: var(--gold); }
.tagline { margin: 16px 0 0; font-size: 15px; font-weight: 700; line-height: 1.85; }
.tagline-sub { margin: 6px 0 0; font-size: 12.5px; font-weight: 700; color: var(--ink-dim); line-height: 1.7; }
.shell-label { align-self: flex-start; font-size: 11px; font-weight: 900; letter-spacing: .14em; color: var(--ink-dim); margin-top: 24px; display: flex; align-items: center; gap: 7px; }
/* v89: the small ？ beside the AI忖度対象 / ドパガキモード
   labels — explanation only, it never touches a setting.
   Kept tiny so the slim title (v88) stays slim. */
.help-q {
  width: 19px; height: 19px; min-height: 19px; border-radius: 50%; padding: 0;
  border: 1.5px solid var(--line); background: var(--panel2); color: var(--ink-dim);
  font: inherit; font-size: 11px; font-weight: 900; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
/* v89: explanation dialog — its own layer above the title
   (90) and help (95) screens; backdrop tap or 閉じる closes */
.info-dialog {
  position: fixed; inset: 0; z-index: 120; display: none;
  align-items: center; justify-content: center; padding: 18px;
  background: rgba(10,12,8,.62);
}
.info-dialog.show { display: flex; }
.info-card {
  background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 14px;
  max-width: 480px; width: 100%; max-height: 86vh; overflow-y: auto;
  padding: 20px 20px 16px; box-shadow: 0 18px 50px rgba(0,0,0,.45); text-align: left;
}
.info-card h3 { font-family: "Shippori Mincho B1", serif; margin: 0 0 6px; font-size: 20px; }
.info-card p { font-size: 13.5px; line-height: 1.75; margin: 6px 0; }
.info-card ul { margin: 6px 0; padding-left: 20px; }
.info-card li { font-size: 13.5px; line-height: 1.75; margin: 3px 0; }
.info-card .btn-sub { width: 100%; margin-top: 16px; }
.settai-opts { display: flex; flex-direction: column; gap: 8px; width: 100%; margin-top: 8px; }
.settai-opt {
  font: inherit; cursor: pointer; text-align: left; color: var(--ink);
  background: var(--panel); border: 1.5px solid var(--line); border-radius: 10px;
  padding: 10px 14px; min-height: 54px;
  display: flex; gap: 12px; align-items: baseline;
}
.settai-opt .so-name { font-weight: 900; font-size: 16px; white-space: nowrap; }
.settai-opt .so-desc { font-size: 12.5px; font-weight: 700; color: var(--ink-dim); line-height: 1.55; }
.settai-opt.on { border-color: var(--gold); background: var(--panel2); box-shadow: inset 0 0 0 1px var(--gold); }
.settai-opt.on .so-name { color: var(--gold); }
/* v50: 次ツモまでの時間 selector — same cards as 接待度, 3 across */
.drawwait-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.drawwait-opts .settai-opt { flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; min-height: 54px; }
.drawwait-opts .settai-opt .so-name { font-size: 15px; }
/* v58: 音 selector — same cards as テンポ, 2 across on the title screen */
.sound-opts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.sound-opts .settai-opt { flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; min-height: 54px; }
.sound-opts .settai-opt .so-name { font-size: 15px; }
/* v58: in-game sound chip in the subbar (left), 接待 stays right */
.sound-chip {
  display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; margin-right: auto;
  min-height: 26px; padding: 1px 10px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--panel2); color: var(--ink-dim);
  font: inherit; font-weight: 900; font-size: 11.5px; cursor: pointer; white-space: nowrap;
}
.sound-chip .state { font-size: 10.5px; letter-spacing: .04em; }
.sound-chip.on { border-color: var(--gold); color: var(--gold); background: var(--panel); }
/* v77: the BGM chip sits beside the sound chip; the auto
   margin that pushes the mode group right moves to it */
/* v105: both chips live in the top bar now (the subbar is
   gone), so neither keeps the old push-the-rest-right margin */
#btnSoundTop { margin-right: 0; }
#btnBgmTop { margin-right: 0; }
/* v77: MENU overlay BGM row follows the same on/off reading */
.card .btncol button.bgm-on { border-color: var(--gold); color: var(--gold); }
/* v58: MENU overlay sound row follows the same on/off reading */
.card .btncol button.sound-on { border-color: var(--gold); color: var(--gold); }
/* v89: 音 / BGM are icon-only toggles in all three places
   (title, subbar, MENU). The state reads off the icon
   itself: ON = gold and sounding (speaker waves shown /
   note plain), OFF = dim with a slash through the icon
   and the waves gone. Every icon button carries .tgl-btn
   and its .on class is the one source the CSS reads. */
.tgl-svg { width: 22px; height: 22px; display: block; flex: 0 0 auto; }
.tgl-btn .tgl-svg .ico-slash { display: none; }
.tgl-btn:not(.on) .tgl-svg .ico-slash { display: block; }
.tgl-btn:not(.on) .tgl-svg .ico-waves { display: none; }
.tgl-btn:not(.on) { opacity: .72; }
.title-toggles { display: flex; gap: 10px; width: 100%; margin-top: 24px; }
.icon-toggle {
  width: 58px; height: 58px; border-radius: 12px; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--panel); color: var(--ink-dim);
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.icon-toggle .tgl-svg { width: 27px; height: 27px; }
.icon-toggle.on { border-color: var(--gold); background: var(--panel2); color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); opacity: 1; }
.sound-chip.icon-chip { width: 36px; min-height: 30px; padding: 0; justify-content: center; }
.sound-chip.icon-chip .tgl-svg { width: 19px; height: 19px; }
.card .btncol button.tgl-btn { display: flex; align-items: center; justify-content: center; gap: 10px; }
.card .btncol button.tgl-btn .state { font-size: 13px; letter-spacing: .1em; }
/* v79: MENU overlay ドパガキモード row follows the same reading */
.card .btncol button.dopa-on { border-color: #ff5fc8; color: #ff5fc8; }
