/* Hallmark · macrostructure: Workbench · tone: quiet premium table · anchor hue: indigo-blue felt */
/* Hallmark · pre-emit critique: P5 H5 E4 S5 R5 V4 */
/* Hallmark · contrast: pass (40–41) · nav/footer: n/a · slop: pass (42–49) · mobile: pass (34, 49–57) */

:root {
  --v17-touch: 48px;
  --v17-copy: 17px;
  --v17-copy-large: 18px;
  --v17-opponent-river: clamp(21px, 3vw, 32px);
}

/* ---------- public-information coaching panel ---------- */
#coach-panel {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  z-index: 20;
  width: min(760px, calc(100vw - 28px));
  max-height: min(30vh, 220px);
  margin: 0;
  padding: 12px 16px;
  overflow: auto;
  transform: translateX(-50%);
  border: 1px solid rgba(118, 192, 220, .46);
  border-radius: 14px;
  color: var(--v16-text);
  background: linear-gradient(135deg, rgba(7, 28, 39, .91), rgba(9, 48, 48, .78));
  box-shadow: 0 10px 24px rgba(0, 0, 0, .34), inset 0 1px rgba(220, 250, 255, .08);
  backdrop-filter: blur(12px);
  text-align: left;
  pointer-events: auto;
}

#coach-panel.hidden { display: none; }
#coach-panel .coach-panel-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 5px;
}
#coach-panel .coach-panel-heading span {
  color: var(--learn-cyan);
  font: 800 10px/1.2 var(--v16-font-body);
  letter-spacing: .16em;
}
#coach-panel .coach-panel-heading strong { color: var(--v16-gold); font-size: 17px; }
#coach-collapse {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 5px 11px;
  border: 1px solid rgba(220, 250, 255, .34);
  border-radius: 8px;
  color: var(--v16-text);
  background: rgba(25, 86, 100, .55);
  font: 800 13px/1.1 var(--v16-font-body);
  cursor: pointer;
}
#coach-panel p { margin: 0; }
#coach-recommendation { font-size: 18px; font-weight: 800; line-height: 1.4; }
#coach-explanation { margin-top: 3px !important; color: var(--v16-text); font-size: 16px; line-height: 1.55; }
#coach-more {
  min-height: 40px;
  margin-top: 8px;
  padding: 6px 14px;
  border: 1px solid rgba(220, 250, 255, .34);
  border-radius: 9px;
  color: var(--v16-text);
  background: rgba(25, 86, 100, .55);
  font: 800 14px/1.2 var(--v16-font-body);
  cursor: pointer;
}
#coach-panel[data-collapsed='true'] { width: min(420px, calc(100vw - 28px)); padding-block: 9px; }
#coach-panel[data-collapsed='true'] #coach-explanation,
#coach-panel[data-collapsed='true'] #coach-more { display: none; }

#coach-detail-dialog {
  width: min(760px, calc(100vw - 28px));
  max-width: 760px;
  padding: 0;
  border: 1px solid rgba(118, 192, 220, .5);
  border-radius: 18px;
  color: var(--v16-text);
  background: rgba(7, 28, 39, .97);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .54);
}
#coach-detail-dialog::backdrop { background: rgba(2, 8, 15, .72); backdrop-filter: blur(6px); }
.coach-detail-shell { display: grid; grid-template-rows: auto 1fr auto; max-height: min(760px, calc(100dvh - 30px)); }
.coach-detail-header { display: flex; align-items: end; justify-content: space-between; gap: 16px; padding: 18px 20px 14px; border-bottom: 1px solid rgba(220, 250, 255, .12); }
.coach-detail-header span { color: var(--learn-cyan); font: 800 11px/1.2 var(--v16-font-body); letter-spacing: .16em; }
.coach-detail-header h2 { margin: 5px 0 0; color: var(--v16-gold); font-size: clamp(20px, 3vw, 26px); }
.coach-detail-header strong { max-width: 46%; color: var(--v16-text); font-size: clamp(16px, 2.4vw, 20px); line-height: 1.35; text-align: right; }
.coach-detail-scroll { overflow: auto; padding: 18px 20px 20px; }
#coach-detail-body p { margin: 0 0 11px; font-size: 16px; line-height: 1.75; }
.coach-detail-footer { display: flex; justify-content: flex-end; padding: 12px 20px 16px; border-top: 1px solid rgba(220, 250, 255, .12); }
.coach-detail-footer button { min-width: 150px; min-height: 46px; border: 1px solid rgba(220, 250, 255, .28); border-radius: 10px; color: var(--v16-text); background: rgba(25, 86, 100, .72); font-size: 16px; font-weight: 800; cursor: pointer; }

/* Advice is optional context; never let it cover a live Ron/Pon/Chi decision. */
#action-bar { z-index: 50; }
#action-bar.claim-mode { z-index: 55; }
#action-bar.claim-mode { grid-template-columns: minmax(145px, 24%) minmax(0, 1fr); }
#coach-panel[data-phase='claim'] { display: none; }
.claim-coach-line {
  display: block;
  margin-top: 4px;
  color: var(--v16-text);
  font-size: 12px;
  line-height: 1.35;
}
.claim-coach-more {
  align-self: flex-start;
  min-height: 30px;
  margin-top: 4px;
  padding: 3px 8px;
  border: 1px solid rgba(220, 250, 255, .3);
  border-radius: 6px;
  color: var(--v16-text);
  background: rgba(25, 86, 100, .6);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

@media (max-width: 560px) {
  #coach-panel { width: calc(100vw - 14px); max-height: min(28vh, 180px); padding: 10px 12px; }
  #coach-panel .coach-panel-heading strong { font-size: 16px; }
  #coach-collapse { min-height: 32px; padding-inline: 9px; font-size: 12px; }
  #coach-recommendation { font-size: 17px; }
  #coach-explanation { font-size: 15px; }
  #coach-detail-dialog { width: calc(100vw - 16px); }
  .coach-detail-header { align-items: start; flex-direction: column; padding: 15px 16px 12px; }
  .coach-detail-header strong { max-width: none; text-align: left; }
  .coach-detail-scroll { padding: 15px 16px 17px; }
  #coach-detail-body p { font-size: 15px; line-height: 1.7; }
  .coach-detail-footer { padding: 10px 16px 14px; }
  .coach-detail-footer button { width: 100%; }
}

html,
body { overflow-x: clip; }

#screen-title .voice-credits {
  max-width: 62ch;
  margin: 12px auto 0;
  color: var(--learn-muted);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

/* Dedicated gamepad shortcuts are labels, not extra focus targets. */
.gamepad-key-hint {
  display: none;
  min-width: 24px;
  min-height: 20px;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border: 1px solid var(--learn-rule-strong);
  border-radius: 5px;
  color: var(--learn-cyan);
  background: var(--v16-panel-strong);
  font: 800 10px/1 var(--v16-font-body);
  letter-spacing: .04em;
  white-space: nowrap;
}

html[data-gamepad='connected'] .gamepad-key-hint { display: inline-flex; }
html[data-gamepad='connected'] .pause-button { min-width: 114px; }
html[data-gamepad='connected'] .no-claims-control { min-width: 146px; }

/* ---------- the table remains the visual anchor ---------- */
.river-cell.top { --river-tile-w: var(--v17-opponent-river); }

.dealer-ceremony {
  position: absolute;
  z-index: 73;
  inset: 0;
  overflow: hidden;
  color: var(--v16-text);
  background: transparent;
  pointer-events: none;
}

.dealer-ceremony-banner {
  position: absolute;
  top: max(8px, env(safe-area-inset-top));
  left: 50%;
  min-width: clamp(270px, 34vw, 410px);
  min-height: 62px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 16px;
  padding: 8px 16px;
  border: 1px solid var(--v16-rule);
  border-radius: 12px;
  background: var(--v16-panel);
  box-shadow: 0 12px 28px var(--v16-shadow);
  backdrop-filter: blur(10px);
  transform: translateX(-50%);
}

.dealer-ceremony-banner small {
  color: var(--learn-blue);
  font: 800 10px/1.2 var(--v16-font-body);
  letter-spacing: .14em;
}

.dealer-ceremony-banner > strong {
  color: var(--v16-gold);
  font: 600 clamp(18px, 2vw, 23px)/1.2 var(--v16-font-display);
}

.dealer-dice {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  gap: 4px;
  color: var(--v16-text);
  font-size: clamp(27px, 3.2vw, 36px);
  line-height: 1;
}

.dealer-ceremony-banner p {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  color: var(--learn-muted);
  font-size: 13px;
  line-height: 1.3;
}

.dealer-seat-count {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dealer-seat-count li {
  position: absolute;
  min-width: 88px;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--learn-muted);
  opacity: .45;
  transform: translate3d(0, 0, 0);
}

.dealer-seat-count li > span {
  min-width: 24px;
  color: var(--learn-blue);
  font: 800 16px/1 var(--v16-font-body);
  text-align: center;
}

.dealer-seat-count li > strong { font-size: 14px; white-space: nowrap; }
.dealer-seat-count li[data-dealer-seat='0'] { bottom: 22%; left: max(8px, env(safe-area-inset-left)); }
.dealer-seat-count li[data-dealer-seat='1'] { top: var(--seat-right-top); right: max(8px, env(safe-area-inset-right)); }
.dealer-seat-count li[data-dealer-seat='2'] { top: 4.5%; right: max(104px, 12%); }
.dealer-seat-count li[data-dealer-seat='3'] { top: var(--seat-left-top); left: max(8px, env(safe-area-inset-left)); }
.dealer-seat-count li[data-active='true'] {
  border-color: var(--v16-rule);
  color: var(--v16-text);
  background: var(--v16-panel);
  box-shadow: 0 8px 22px var(--v16-shadow);
  opacity: 1;
  animation: v17-dealer-count 105ms var(--learn-ease-out) both;
}

@keyframes v17-dealer-count {
  from { opacity: .55; }
  to { opacity: 1; }
}

#center {
  width: clamp(116px, 14vw, 170px);
  height: clamp(82px, 10vw, 116px);
  padding: clamp(8px, 1vw, 12px) clamp(12px, 1.2vw, 16px);
  gap: 4px;
}

#center .kyoku { font-size: clamp(19px, 2vw, 24px); }
#center .sub { gap: 8px; font-size: clamp(13px, 1.2vw, 15px); }
#center .dora-row { gap: 4px; margin-top: 4px; }
#center .dora-row .label { font-size: 14px; }
#center .dora-row .tile {
  width: clamp(20px, 2vw, 24px);
  height: clamp(28px, 2.8vw, 34px);
}

@media (orientation: landscape) {
  #strip-left {
    transform: translateY(-50%) rotate(20deg);
    transform-origin: center;
  }

  #strip-right {
    transform: translateY(-50%) rotate(-20deg);
    transform-origin: center;
  }
}

/* ---------- result and scoring legibility ---------- */
#overlay-content {
  width: min(94vw, 720px);
  max-height: calc(100dvh - 20px);
  padding: clamp(20px, 2.5vw, 32px);
  scrollbar-color: var(--learn-rule-strong) var(--v16-panel-strong);
  scrollbar-width: thin;
}

#overlay-content::-webkit-scrollbar { width: 8px; }
#overlay-content::-webkit-scrollbar-track { background: var(--v16-panel-strong); }
#overlay-content::-webkit-scrollbar-thumb {
  border: 2px solid var(--v16-panel-strong);
  border-radius: 8px;
  background: var(--learn-rule-strong);
}

#overlay-content h2 { font-size: clamp(27px, 3.3vw, 38px); }
#overlay-content .win-sub { font-size: var(--v17-copy); line-height: 1.55; }
#overlay-content .yaku-line { gap: 20px; padding: 8px 16px; font-size: var(--v17-copy-large); }
#overlay-content .score-total { margin-block: 12px 8px; font-size: clamp(38px, 5vw, 50px); }
#overlay-content .limit-name { font-size: clamp(23px, 3vw, 30px); }
#overlay-content .fu-han { font-size: var(--v17-copy); }
#overlay-content .win-hand { gap: 4px; margin-block: 16px 8px; }
#overlay-content .win-hand .tile { width: clamp(30px, 3.2vw, 38px); height: clamp(41px, 4.3vw, 51px); }
#overlay-content .win-hand .win-tile-box .lbl { font-size: 13px; }
#overlay-content .dora-line { gap: 8px; margin-block: 12px; }
#overlay-content .dora-line .lbl { font-size: 15px; }
#overlay-content .dora-line .tile { width: 28px; height: 38px; }
#overlay-content .transfer { max-width: 480px; margin-top: 16px; }
#overlay-content .transfer .row { padding: 8px 12px; font-size: var(--v17-copy); }
#overlay-content .reveal .rv-row { gap: 8px; margin-block: 8px; }
#overlay-content .reveal .rv-row .nm { width: 82px; font-size: 15px; }
#overlay-content .reveal .rv-row .tile { width: 22px; height: 30px; }
#overlay-content .rank-line { padding: 8px 20px; font-size: 20px; }
#overlay-content :where(button, .btn) { min-height: var(--v17-touch); font-size: 16px; }

/* ---------- thought actions and uninterrupted full-text reading ---------- */
.seat-thought {
  width: clamp(300px, 34vw, 460px);
  min-height: 154px;
}

.seat-thought-body { font-size: var(--v17-copy-large); line-height: 1.58; }
.seat-thought-metrics {
  min-height: 22px;
  padding-right: 0;
  font-size: 14px;
}

.seat-thought-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  pointer-events: auto;
}

.seat-thought-more,
.seat-thought-skip {
  position: static;
  min-height: 44px;
  margin: 0;
  padding: 12px 16px;
  border: 1px solid var(--v16-rule);
  border-radius: 8px;
  font: 800 15px/1 var(--v16-font-body);
  cursor: pointer;
  white-space: nowrap;
  pointer-events: auto;
}

.seat-thought-more { color: var(--v16-text); background: transparent; }
.seat-thought-skip { min-width: 76px; color: var(--learn-bg); background: var(--v16-gold); }

#thought-detail-dialog {
  z-index: calc(var(--learn-z-review) + 15);
  width: min(860px, calc(100vw - 32px));
  height: min(760px, calc(100dvh - 32px));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--learn-rule-strong);
  border-radius: var(--learn-radius-lg);
  color: var(--learn-text);
  background: var(--learn-bg);
  box-shadow: 0 28px 90px var(--learn-shadow);
}

#thought-detail-dialog::backdrop {
  background: var(--learn-scrim);
  backdrop-filter: blur(9px);
}

#thought-detail-dialog[open] { animation: v17-detail-in var(--learn-dur-in) var(--learn-ease-out) both; }

.thought-detail-shell {
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.thought-detail-header {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--learn-rule);
  background: var(--learn-bg-raised);
}

#thought-detail-speaker {
  color: var(--learn-blue);
  font: 800 12px/1.3 var(--v16-font-body);
  letter-spacing: .12em;
}

.thought-detail-header h2 {
  margin: 4px 0 0;
  color: var(--v16-gold);
  font: 600 clamp(24px, 3.2vw, 34px)/1.25 var(--v16-font-display);
}

.thought-detail-scroll {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(24px, 4vw, 40px);
  scrollbar-color: var(--learn-rule-strong) transparent;
  scrollbar-width: thin;
}

#thought-detail-summary {
  max-width: 68ch;
  margin: 0;
  color: var(--learn-text);
  font-size: clamp(18px, 2vw, 21px);
  line-height: 1.75;
  white-space: pre-line;
}

/* ---------- pause audio mixer: one contained block, no floating controls ---------- */
.pause-audio-settings {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--learn-rule);
  border-radius: 10px;
  background: color-mix(in srgb, var(--v16-panel-strong) 86%, transparent);
}

.pause-audio-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--learn-rule);
}

.pause-audio-heading strong { color: var(--v16-gold); font-size: 16px; }
.pause-audio-heading small { color: var(--learn-muted); font-size: 12px; }
.pause-audio-settings .pause-setting-row { min-height: 46px; }

.pause-volume-row {
  min-height: 38px;
  display: grid;
  grid-template-columns: 4.5em minmax(112px, 1fr) 3ch;
  align-items: center;
  gap: 12px;
  color: var(--learn-text);
  font-size: 15px;
}

.pause-volume-row input[type='range'] {
  width: 100%;
  min-height: 32px;
  accent-color: var(--v16-gold);
}

.pause-volume-row output {
  color: var(--learn-cyan);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

#thought-detail-details {
  max-width: 68ch;
  display: grid;
  grid-template-columns: minmax(112px, 9em) minmax(0, 1fr);
  margin: 24px 0 0;
  border-top: 1px solid var(--learn-rule);
}

#thought-detail-details dt,
#thought-detail-details dd {
  margin: 0;
  padding: 12px 4px;
  border-bottom: 1px solid var(--learn-rule);
  font-size: 16px;
  line-height: 1.55;
}

#thought-detail-details dt { color: var(--learn-cyan); font-weight: 800; }
#thought-detail-details dd { color: var(--learn-muted); }

.thought-detail-footer {
  min-height: 72px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 12px 20px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--learn-rule);
  background: var(--learn-bg-raised);
}

.thought-detail-footer button {
  min-width: 132px;
  min-height: var(--v17-touch);
  padding: 12px 16px;
  border: 1px solid var(--learn-rule-strong);
  border-radius: var(--learn-radius-sm);
  color: var(--learn-text);
  background: transparent;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

#thought-detail-next { color: var(--learn-bg); background: var(--v16-gold); }

@keyframes v17-detail-in {
  from { opacity: 0; transform: translate3d(0, 8px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

/* ---------- desktop review: evaluation left, decision timeline right ---------- */
.review-header h2 { font-size: 28px; }
.review-summary strong { font-size: 34px; }
.review-summary span,
.review-summary small { font-size: 13px; }
.review-timeline > p,
.review-eyebrow { font-size: 12px; }
.review-timeline button { min-height: 52px; gap: 12px; padding: 8px 12px; }
.review-timeline button strong { font-size: 16px; }
.review-timeline button small { font-size: 14px; }
.review-choice-block p { font-size: var(--v17-copy); line-height: 1.65; }
.review-comment { grid-template-columns: 92px minmax(0, 1fr) 66px; gap: 16px; padding: 16px; }
.review-comment-persona strong { font-size: 16px; }
.review-comment-persona small { font-size: 13px; line-height: 1.35; }
.review-comment-body h4 { font-size: 18px; }
.review-comment-body p { font-size: var(--v17-copy); line-height: 1.65; }
.review-comment-score { font-size: 32px; }
.review-comment-score small { font-size: 12px; }
.review-nav,
.review-close { min-height: var(--v17-touch); font-size: 16px; }

#review-dialog,
.review-workspace,
.review-analysis {
  scrollbar-color: var(--learn-rule-strong) var(--v16-panel-strong);
  scrollbar-width: thin;
}

#review-dialog::-webkit-scrollbar,
.review-workspace::-webkit-scrollbar,
.review-analysis::-webkit-scrollbar { width: 8px; height: 8px; }
#review-dialog::-webkit-scrollbar-track,
.review-workspace::-webkit-scrollbar-track,
.review-analysis::-webkit-scrollbar-track { background: var(--v16-panel-strong); }
#review-dialog::-webkit-scrollbar-thumb,
.review-workspace::-webkit-scrollbar-thumb,
.review-analysis::-webkit-scrollbar-thumb {
  border: 2px solid var(--v16-panel-strong);
  border-radius: 8px;
  background: var(--learn-rule-strong);
}

@media (min-width: 681px) {
  .review-workspace { grid-template-columns: minmax(0, 1fr) minmax(260px, 30%); }
  .review-analysis { grid-column: 1; grid-row: 1; }
  .review-timeline {
    grid-column: 2;
    grid-row: 1;
    border-right: 0;
    border-left: 1px solid var(--learn-rule);
  }
  .review-timeline button { border-right: 2px solid transparent; border-left: 0; }
  .review-timeline button[aria-current='true'] {
    border-right-color: var(--learn-gold);
    border-left-color: transparent;
  }
}

/* 320 / 390 portrait contract: no horizontal scroll, full-height reading. */
@media (orientation: portrait) {
  .dealer-seat-count li[data-dealer-seat='0'] { bottom: 20%; }
  .dealer-seat-count li[data-dealer-seat='2'] { top: 10.5%; right: 2%; }
  #strip-left { transform: translateY(-50%) rotate(5deg); transform-origin: center; }
  #strip-right { transform: translateY(-50%) rotate(-5deg); transform-origin: center; }
  #center { width: clamp(94px, 27vw, 112px); height: clamp(70px, 20vw, 84px); }
  #center .kyoku { font-size: clamp(15px, 4.2vw, 18px); }
  #center .sub { gap: 4px; font-size: clamp(10px, 2.8vw, 12px); }
  #center .dora-row .label { font-size: 10px; }
  #center .dora-row .tile { width: 15px; height: 21px; }
}

@media (max-width: 700px) {
  #thought-detail-dialog {
    width: 100vw;
    height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .thought-detail-header {
    min-height: 78px;
    padding-top: max(12px, env(safe-area-inset-top));
    padding-right: max(16px, env(safe-area-inset-right));
    padding-left: max(16px, env(safe-area-inset-left));
  }
  .thought-detail-scroll {
    padding-right: max(20px, env(safe-area-inset-right));
    padding-left: max(20px, env(safe-area-inset-left));
  }
  .thought-detail-footer {
    padding-right: max(12px, env(safe-area-inset-right));
    padding-left: max(12px, env(safe-area-inset-left));
  }
  .thought-detail-footer button { min-width: 0; flex: 1; }
  .review-timeline { max-height: 86px; }
  .review-timeline button { min-width: 128px; }
  .review-comment {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: 'persona score' 'body body';
    gap: 12px;
    padding: 16px;
  }
  .review-comment-persona {
    grid-area: persona;
    display: flex;
    align-items: baseline;
    gap: 12px;
  }
  .review-comment-body { grid-area: body; }
  .review-comment-score { grid-area: score; align-self: start; }
}

@media (max-width: 390px) {
  .dealer-ceremony-banner { min-width: calc(100vw - 96px); padding-inline: 12px; }
  .dealer-seat-count li { min-width: 72px; padding-inline: 8px; }
  .dealer-seat-count li > strong { font-size: 12px; }
  .seat-thought { width: calc(100vw - 16px); min-height: 148px; padding: 12px; }
  .seat-thought-headline { font-size: 17px; }
  .seat-thought-body { font-size: 16px; }
  .seat-thought-more,
  .seat-thought-skip { min-width: 0; flex: 1; padding-inline: 8px; }
  #thought-detail-details { grid-template-columns: 1fr; }
  #thought-detail-details dt { padding-bottom: 4px; border-bottom: 0; }
  #thought-detail-details dd { padding-top: 4px; }
  .review-comment {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 12px;
  }
  .review-comment-body p { font-size: 16px; }
  .pause-audio-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
  .pause-volume-row { grid-template-columns: 3.5em minmax(96px, 1fr) 3ch; gap: 8px; }
}

/* 667×375 / 844×390 short-landscape contract. */
@media (orientation: landscape) and (max-height: 480px) {
  :root { --v17-opponent-river: clamp(20px, 3.1vw, 27px); }
  .dealer-ceremony-banner {
    top: max(4px, env(safe-area-inset-top));
    min-height: 54px;
    padding-block: 8px;
  }
  .dealer-seat-count li[data-dealer-seat='0'] { bottom: 23%; }
  #center { width: clamp(108px, 15vw, 138px); height: clamp(76px, 10.5vw, 94px); }
  #center .kyoku { font-size: clamp(17px, 2.2vw, 20px); }
  #center .sub { font-size: clamp(11px, 1.35vw, 13px); }
  .seat-thought { width: clamp(320px, 45vw, 390px); min-height: 132px; }
  .seat-thought-body { font-size: 16px; line-height: 1.48; }
  #overlay-content { width: min(92vw, 680px); }
  .review-header { min-height: 66px; }
  .review-analysis { padding: 16px 20px; }
  .review-comment { padding: 12px; }
  .review-comment-body p { font-size: 16px; }
  .thought-detail-header { min-height: 72px; padding-block: 12px; }
  .thought-detail-scroll { padding-block: 16px; }
  .thought-detail-footer { min-height: 64px; padding-block: 8px; }
  .pause-audio-settings { padding: 12px; }
}

/* 1280 / 1920 desktop contracts retain comfortable reading width. */
@media (min-width: 1280px) {
  #review-dialog { width: min(1220px, calc(100vw - 40px)); }
  .review-analysis { padding: 36px 40px; }
}

@media (min-width: 1920px) {
  #review-dialog { width: 1280px; height: min(820px, calc(100dvh - 56px)); }
  #thought-detail-dialog { width: 940px; }
}

@media (hover: hover) {
  .seat-thought-more:hover,
  .thought-detail-footer button:hover,
  .review-timeline button:hover { filter: brightness(1.09); }
}

.seat-thought-more:active,
.thought-detail-footer button:active { filter: brightness(.92); }

.seat-thought-more:disabled,
.thought-detail-footer button:disabled { opacity: .5; cursor: not-allowed; }

.seat-thought-more:focus-visible,
#thought-detail-dialog button:focus-visible,
#thought-detail-dialog [data-gamepad-focused='true'] {
  outline: 2px solid var(--learn-focus);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .dealer-seat-count li[data-active='true'] { animation: none; }
  #thought-detail-dialog[open] { animation: none; }
  .seat-thought-more,
  .thought-detail-footer button { transition: none; }
}

/* ---------- ガイド思考モード (v14, 2026-08-19) ---------- */
.coach-style {
  appearance: none;
  border: 1px solid rgba(214, 178, 94, 0.6);
  border-radius: 999px;
  background: rgba(24, 40, 58, 0.85);
  color: #e8d9ac;
  font: 700 12px/1 var(--v16-font-body, inherit);
  padding: 5px 10px;
  margin-left: auto;
  margin-right: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.coach-style:active { transform: translateY(1px); }
.coach-style-board {
  display: grid;
  gap: 6px;
  margin: 0 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(214, 178, 94, 0.25);
}
.coach-style-heading {
  margin: 0;
  font-size: 0.78rem;
  color: #b9c6cf;
}
.coach-style-row {
  appearance: none;
  display: grid;
  grid-template-columns: 5.2em 1fr;
  grid-template-areas: 'label pick' 'label description';
  gap: 2px 10px;
  align-items: center;
  text-align: left;
  border: 1px solid rgba(214, 178, 94, 0.25);
  border-radius: 10px;
  background: rgba(12, 22, 34, 0.6);
  color: inherit;
  font: inherit;
  padding: 8px 10px;
  cursor: pointer;
}
.coach-style-row.current {
  border-color: rgba(214, 178, 94, 0.85);
  background: rgba(38, 56, 76, 0.85);
}
.coach-style-label {
  grid-area: label;
  font-weight: 700;
  color: #e8d9ac;
}
.coach-style-row.current .coach-style-label::after {
  content: ' ●';
  font-size: 0.7em;
  color: #9fd48f;
}
.coach-style-pick {
  grid-area: pick;
  font-weight: 700;
}
.coach-style-description {
  grid-area: description;
  font-size: 0.74rem;
  color: #9fb0bb;
}

/* ---------- 対戦相手ピッカー + 汎用アバター (2026-08-20) ---------- */
.opponent-picker {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(214, 178, 94, 0.3);
  border-radius: 12px;
  padding: 12px;
  margin: 0 0 10px;
}
.opponent-picker legend {
  padding: 0 6px;
  font-size: 0.85rem;
  color: #d6b25e;
}
.opponent-slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.85rem;
}
.opponent-slot select {
  flex: 1;
  max-width: 70%;
  min-height: 40px;
  border-radius: 8px;
  background: rgba(12, 22, 34, 0.85);
  color: inherit;
  border: 1px solid rgba(214, 178, 94, 0.35);
  padding: 6px 8px;
}
.opponent-descriptions {
  margin: 2px 0 0;
  font-size: 0.74rem;
  line-height: 1.5;
  color: #9fb0bb;
  white-space: pre-line;
}
.opponent-portrait.generic,
.avatar.generic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #23405a, #101d2c);
  border: 1px solid rgba(214, 178, 94, 0.45);
  color: #e8d9ac;
  font-weight: 800;
}
.opponent-portrait.generic::after,
.avatar.generic::after {
  content: attr(data-initial);
  font-size: 1.05em;
}

/* デバッグボタン(v98): 通常UIと見分けが付くよう控えめな警告色 */
.debug-button { border-color: rgba(255, 170, 90, .5); color: #f2b06a; font-size: 13px; }

/* iPad縦(700px以上のportrait): 上辺プレートが中断/あれ?/TURNの列と重ならないよう左へ退避 (v99)。
   table-physical-v2.cssのportraitルール(right:3%)より後勝ちさせるためidで特異度を上げる */
@media (min-width: 700px) and (orientation: portrait) {
  #board .chip.seat-2 { right: 170px; }
}

/* ============ 自動卓センター盤 (v101・雀魂参照のユーザー設計) ============ */
#center .center-device { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
#center .center-core { text-align: center; }
/* 四辺の風+点棒。狭い画面では出さない(席札が同情報を持つ)。広い横画面で展開 */
#center .center-seat { display: none; position: absolute; gap: 5px; align-items: center; white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 12px; color: #cfe0f0; }
#center .center-seat .cwind { font-weight: 700; font-size: 12px; color: #8fa8c0; }
#center .center-seat.dealer .cwind { color: #ffce6e; }
#center .center-seat.active { color: #ffffff; text-shadow: 0 0 8px rgba(120, 190, 255, .8); }
#center .center-seat.riichi .cpts { color: #8fd0ff; }
#center .center-seat .cpts { font-weight: 600; }

@media (orientation: landscape) and (min-width: 900px) and (min-height: 600px) {
  /* 広い横画面: センター盤を自動卓の開口サイズへ拡張し、四辺に点棒を回転配置 */
  #board.webgl-tabletop-active #center { width: 134px; height: 134px; border-radius: 14px; }
  #board.webgl-tabletop-active #center .center-core { max-width: 88px; }
  #board.webgl-tabletop-active #center .center-core .kyoku { font-size: 15px; }
  #board.webgl-tabletop-active #center .center-core .sub { flex-wrap: wrap; justify-content: center; gap: 2px 5px; font-size: 9px; line-height: 1.3; }
  #board.webgl-tabletop-active #center .center-seat { display: flex; }
  #board.webgl-tabletop-active #center .center-seat.pos-0 { bottom: 4px; left: 50%; transform: translateX(-50%); }
  #board.webgl-tabletop-active #center .center-seat.pos-2 { top: 4px; left: 50%; transform: translateX(-50%) rotate(180deg); }
  #board.webgl-tabletop-active #center .center-seat.pos-1 { top: 50%; right: -24px; transform: translateY(-50%) rotate(-90deg); }
  #board.webgl-tabletop-active #center .center-seat.pos-3 { top: 50%; left: -24px; transform: translateY(-50%) rotate(90deg); }
}

/* ドラ表示HUD: 表示牌(めくれ牌)であることを名乗る。左上定位置 */
#dora-hud {
  position: absolute; z-index: 30; left: 12px; top: 188px;
  display: none; flex-direction: column; gap: 3px; align-items: flex-start;
  padding: 6px 9px; border-radius: 9px;
  background: rgba(10, 16, 26, .72); border: 1px solid rgba(214, 178, 106, .35);
}
#screen-game:not(.hidden) #dora-hud { display: flex; }
#dora-hud .label { font-size: 10px; letter-spacing: .08em; color: #d9c48a; }
#dora-hud .tiles { display: flex; gap: 2px; }
#dora-hud .derived { font-size: 10px; color: rgba(255, 255, 255, .75); }
@media (orientation: landscape) and (max-height: 480px) {
  #dora-hud { top: 108px; left: 8px; padding: 4px 6px; }
  #dora-hud .derived { display: none; }
}
@media (orientation: portrait) {
  #dora-hud { left: 8px; top: clamp(112px, calc(46.1vh - 151px), 260px); }
}
@media (orientation: portrait) and (max-height: 719px) {
  /* 短い縦: 右上帯(あれ?の下)に横並びミニ表示。左上は局パネルが使う */
  #dora-hud { left: auto; right: 8px; top: 103px; flex-direction: row; align-items: center; gap: 5px; padding: 3px 7px; }
  #dora-hud .derived { display: none; }
}

/* カルテ55号: ガイド推奨と一致する鳴き選択肢に「おすすめ」印(候補が複数並ぶチーで
   どれを指しているか分からなかった 2026-09-01 ユーザー指摘) */
.act-btn.claim-recommended {
  position: relative;
  outline: 2px solid #d6b26a;
  outline-offset: -2px;
  box-shadow: 0 0 12px rgba(214, 178, 106, 0.45);
}
.claim-recommend-badge {
  /* カード外上端(top:-9px)はスクロール容器に切られる(2026-09-01実機)。内側下部へ */
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: #d6b26a;
  color: #14100a;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 8px;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
}

/* v123: 残り牌数を読めるサイズに(ユーザー「残り牌数が見にくい」2026-09-03)。局名の次に大きく、金色で */
#center .sub .rest {
  color: var(--v16-gold, #ffe7a2);
  font-size: 1.32em;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: .5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .8);
}

/* v123: 九種九牌は倒した手牌を見せる */
#kyuushu-reveal {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(92vw, 720px);
  padding: 14px 16px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(233, 190, 98, .55);
  border-radius: 14px;
  background: rgba(4, 10, 20, .92);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .7);
  animation: kyuushu-in .25s ease-out;
}
#kyuushu-reveal .kyuushu-title { color: #ffe7a2; font-size: clamp(16px, 2.4vw, 22px); font-weight: 800; letter-spacing: 3px; }
#kyuushu-reveal .kyuushu-note { color: #b9c9db; font-size: clamp(11px, 1.4vw, 13px); }
#kyuushu-reveal .kyuushu-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; }
#kyuushu-reveal .kyuushu-tiles .tile { width: clamp(30px, 5.2vw, 44px); height: auto; aspect-ratio: 60 / 82; }
#kyuushu-reveal .kyuushu-tiles .tile.yaochu { outline: 2px solid #ffe7a2; outline-offset: 1px; border-radius: 4px; }
@keyframes kyuushu-in { from { opacity: 0; transform: translate(-50%, -46%); } to { opacity: 1; transform: translate(-50%, -50%); } }
@media (prefers-reduced-motion: reduce) { #kyuushu-reveal { animation: none; } }
