:root {
  --felt: #14683f;
  --felt-dark: #0d4a2c;
  --wood: #3d2b1c;
  --ink: #1a1a1a;
  --panel: #f7f4ec;
  --panel-line: #d8cfb8;
  --accent: #b3202a;
  --good: #1d6f5c;
  --hand-w: 54px;
  --river-w: 34px;
  --back-w: 20px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
  background: radial-gradient(circle at 50% 30%, #2a4636, #16241c 70%);
  color: #f2efe6;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  gap: 18px;
  padding: 16px;
}

.tile-svg { width: 100%; height: 100%; display: block; }

/* ── 卓 ───────────────────────────────────────────────────────── */

.stage { display: flex; flex-direction: column; align-items: center; gap: 14px; }

.table {
  position: relative;
  width: min(72vh, 700px);
  aspect-ratio: 1;
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 45%, #1a7d4c 0%, var(--felt) 45%, var(--felt-dark) 100%);
  box-shadow: 0 0 0 12px var(--wood), 0 18px 40px rgba(0, 0, 0, .55);
}

.quadrant {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  padding-bottom: 10px;
  pointer-events: none;
}
.quadrant[data-seat="0"] { transform: rotate(0deg); }
.quadrant[data-seat="1"] { transform: rotate(-90deg); }   /* 下家は右 */
.quadrant[data-seat="2"] { transform: rotate(180deg); }   /* 対面は上 */
.quadrant[data-seat="3"] { transform: rotate(90deg); }    /* 上家は左 */

.river {
  display: grid;
  grid-template-columns: repeat(6, var(--river-w));
  gap: 3px;
  width: calc(6 * var(--river-w) + 15px);
  min-height: 4px;
}
.river .tile {
  width: var(--river-w);
  height: calc(var(--river-w) * 1.37);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .4));
}
.river .tile.fresh { animation: drop .32s ease-out; }

@keyframes drop {
  from { transform: translateY(-14px) scale(1.15); opacity: .2; }
  to   { transform: none; opacity: 1; }
}
.river .tile.riichi.fresh { animation: none; }

.opp-hand { display: flex; gap: 1px; }
.opp-hand .tile { width: var(--back-w); height: calc(var(--back-w) * 1.37); }

.nameplate {
  pointer-events: none;
  font-size: 12px;
  letter-spacing: .06em;
  color: #cfe6d8;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nameplate .wind {
  background: rgba(0, 0, 0, .35);
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 4px;
  padding: 0 5px;
  font-size: 13px;
}
.quadrant[data-seat="1"] .nameplate { transform: rotate(90deg); }
.quadrant[data-seat="2"] .nameplate { transform: rotate(180deg); }
.quadrant[data-seat="3"] .nameplate { transform: rotate(-90deg); }

.riichi-stick {
  width: 40px; height: 7px; border-radius: 3px;
  background: #f4f1e6; position: relative;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .5);
}
.riichi-stick::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent); transform: translate(-50%, -50%);
}

/* ── 卓の中央 ─────────────────────────────────────────────────── */

.center {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 300px;
  display: grid;
  /* minmax(0,…) を付けないと、中の文字が長いときに枠から溢れる。 */
  grid-template-columns: minmax(0, auto) minmax(0, 1fr) minmax(0, auto);
  grid-template-rows: auto auto auto;
  align-items: center;
  justify-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, .32);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 10px;
  padding: 8px 10px;
  text-align: center;
  backdrop-filter: blur(2px);
}

.center-info { grid-area: 2 / 2; min-width: 0; }
.center [data-score="2"] { grid-area: 1 / 2; }   /* 対面・上 */
.center [data-score="3"] { grid-area: 2 / 1; }   /* 上家・左 */
.center [data-score="1"] { grid-area: 2 / 3; }   /* 下家・右 */
.center [data-score="0"] { grid-area: 3 / 2; }   /* 自分・下 */

.center .round { font-size: 15px; letter-spacing: .1em; }
.center .stats { margin-top: 6px; font-size: 12px; color: #bcd8c7; }
.center .dora { margin-top: 10px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.center .dora .tile { width: 30px; height: 41px; }
.center .dora span { font-size: 10px; color: #bcd8c7; }

/* ── 自分の手牌 ───────────────────────────────────────────────── */

.hand-row {
  display: flex; align-items: flex-end; gap: 26px;
  min-height: 92px; flex-wrap: wrap; justify-content: center;
}
.myhand { display: flex; align-items: flex-end; gap: 4px; min-height: 92px; }

/* 鳴いてできた面子。相手から取った牌は本物と同じく横向きに置く。 */
.melds { display: flex; align-items: flex-end; gap: 14px; }
.meld { display: flex; align-items: flex-end; gap: 2px; }
.meld .tile {
  width: 40px; height: 55px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .45));
}
.meld .tile.called { transform: rotate(-90deg) translateY(-7px); }
.meld .tile.facedown { }
.meld .label {
  font-size: 10px; color: #9fd4b4; align-self: flex-end;
  margin-left: 2px; margin-bottom: 3px; letter-spacing: .04em;
}
.myhand .gap { width: 18px; }

.myhand .tile {
  width: var(--hand-w);
  height: calc(var(--hand-w) * 1.37);
  cursor: pointer;
  transition: transform .12s, filter .12s;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, .5));
  position: relative;
}
.myhand .tile:hover:not(.locked) { transform: translateY(-10px); }
.myhand .tile.locked { cursor: not-allowed; opacity: .55; }
.myhand.must-discard .tile:not(.locked) { animation: nudge 1.4s ease-in-out infinite; }
@keyframes nudge {
  0%, 100% { transform: none; }
  50% { transform: translateY(-4px); }
}

.myhand .tile.drawn::after {
  content: "ツモ"; position: absolute; left: 50%; bottom: -17px;
  transform: translateX(-50%); font-size: 10px; color: #9fd4b4; letter-spacing: .08em;
}
.myhand .tile .badge {
  position: absolute; top: -8px; left: 50%; transform: translateX(-50%);
  font-size: 9px; padding: 1px 4px; border-radius: 3px; white-space: nowrap;
  border: 1px solid rgba(0, 0, 0, .3);
}
.badge.現物 { background: #2f7d52; color: #eafff2; }
.badge.スジ { background: #b8912f; color: #241c04; }
.badge.字牌 { background: #4a6d8c; color: #eaf3ff; }
.myhand .tile.musuji::before {
  content: ""; position: absolute; inset: -2px; border-radius: 8px;
  border: 2px solid rgba(179, 32, 42, .85); pointer-events: none;
}

/* ── 操作 ─────────────────────────────────────────────────────── */

.controls { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
button {
  font: inherit; font-size: 13px;
  padding: 7px 14px; border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .1);
  color: #f2efe6; cursor: pointer;
}
button:hover:not(:disabled) { background: rgba(255, 255, 255, .2); }
button:disabled { opacity: .35; cursor: not-allowed; }
button.on { background: var(--accent); border-color: var(--accent); }
button.primary { background: var(--good); border-color: #2f9a7d; }

.message {
  min-height: 40px; max-width: 700px; text-align: center;
  font-size: 13px; line-height: 1.6; white-space: pre-line;
  color: #e6f2ea;
}
.message .ng { color: #ffb3b3; }
.message .ok { color: #a7e6c4; }

/* ── 右パネル ─────────────────────────────────────────────────── */

.panel {
  width: 340px; flex: none;
  background: var(--panel); color: var(--ink);
  border-radius: 12px; padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
  max-height: calc(100vh - 32px); overflow: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
}
.panel h2 { margin: 0; font-size: 14px; letter-spacing: .08em; }
.panel .hint { font-size: 11px; color: #6b6355; line-height: 1.6; }
.panel .hint.scope {
  background: #fdf6e3; border: 1px solid #e3d5a8; border-left: 3px solid #b8912f;
  border-radius: 5px; padding: 7px 9px; color: #4a4133;
}

/* 打点と押し引き */
.verdict { border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; color: #fff; }
.verdict h3 { margin: 0 0 5px; font-size: 15px; }
.verdict p { margin: 0; font-size: 12px; line-height: 1.6; }
.verdict.free { background: #4a6d8c; }
.verdict.push { background: #1d6f5c; }
.verdict.neutral { background: #b8912f; }
.verdict.fold { background: var(--accent); }
.reasons { font-size: 11.5px; line-height: 1.75; margin: 0 0 10px; padding-left: 1.1em; }
.value-box {
  border: 1px solid var(--panel-line); border-radius: 6px;
  padding: 8px 10px; font-size: 12px; line-height: 1.7; margin-bottom: 10px;
}
.value-box .big { font-size: 17px; font-weight: 700; }
.value-box .tag {
  font-size: 10px; padding: 1px 5px; border-radius: 3px; margin-left: 5px;
  background: #1d6f5c; color: #fff;
}
.value-box .tag.guess { background: #b8912f; }
table.risks { width: 100%; border-collapse: collapse; font-size: 11.5px; }
table.risks td { border-bottom: 1px solid var(--panel-line); padding: 3px; }
table.risks td:last-child { text-align: right; }
table.risks tr.safe { background: #e7f4ec; }
.tabs { display: flex; gap: 6px; }
/* パネル内のボタンはすべて明るい背景向けの色にする。
   ここを .tabs だけに限ると、解説ボタンが白地に白文字になって見えなくなる。 */
.panel button { color: var(--ink); border-color: var(--panel-line); background: #fff; }
.panel button:hover:not(:disabled) { background: #ece7da; }
.tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* 解説タブの主役なので、押す場所だと分かる見た目にする。 */
#btnExplain {
  width: 100%; padding: 10px; font-size: 13px; font-weight: 600;
  background: var(--good); color: #fff; border-color: var(--good);
}
#btnExplain:hover:not(:disabled) { background: #17836a; border-color: #17836a; }

table.options { width: 100%; border-collapse: collapse; font-size: 12px; }
table.options th, table.options td {
  border-bottom: 1px solid var(--panel-line); padding: 4px 3px; text-align: right;
}
table.options th:first-child, table.options td:first-child { text-align: left; }
table.options tr.best { background: #e7f4ec; font-weight: 600; }
table.options .useful { font-size: 10px; color: #6b6355; text-align: left; }

.score { font-size: 12px; border-top: 1px solid var(--panel-line); padding-top: 8px; }
.score b { font-size: 20px; }





.explain-body { font-size: 12.5px; line-height: 1.75; white-space: pre-line; }
.explain-body.warn { border-left: 3px solid var(--accent); padding-left: 8px; }

/* ── モーダル ─────────────────────────────────────────────────── */

.overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .65);
  display: flex; align-items: center; justify-content: center; z-index: 20;
}
.overlay[hidden] { display: none; }
.modal {
  background: var(--panel); color: var(--ink);
  border-radius: 12px; padding: 22px 26px; min-width: 340px; max-width: 520px;
  text-align: center;
  max-height: 86vh; overflow-y: auto;      /* 長い結果でも画面からはみ出さない */
}
.modal h1 { margin: 0 0 10px; font-size: 22px; }
.modal .detail { font-size: 13px; line-height: 1.8; white-space: pre-line; text-align: left; }
.modal .buttons { margin-top: 16px; display: flex; gap: 8px; justify-content: center; }
.modal h1.bad { color: var(--accent); }
.modal .misses { margin-top: 12px; text-align: left; font-size: 12px; line-height: 1.7; }
.modal .misses li { margin-bottom: 5px; }

/* 記録 */
.stat-row { display: flex; gap: 10px; margin-bottom: 10px; }
.stat {
  flex: 1; border: 1px solid var(--panel-line); border-radius: 6px;
  padding: 8px; text-align: center;
}
.stat b { display: block; font-size: 21px; }
.stat span { font-size: 10.5px; color: #6b6355; }
.weak {
  background: #fdf6e3; border: 1px solid #e3d5a8; border-left: 3px solid #b8912f;
  border-radius: 5px; padding: 8px 10px; font-size: 12px; line-height: 1.7;
  margin-bottom: 10px;
}
.weak b { color: #8a6a12; }
table.options td.shape { font-size: 10px; color: #1d6f5c; }
.modal button { color: var(--ink); border-color: var(--panel-line); background: #fff; }
.modal button.primary { background: var(--good); color: #fff; border-color: var(--good); }


/* ── 狭い画面（スマホ・縦持ちのタブレット） ─────────────────── */
@media (max-width: 900px) {
  body { flex-direction: column; align-items: center; padding: 8px; gap: 10px; }
  .panel { width: 100%; max-width: 640px; max-height: none; }
  .table { width: min(94vw, 560px); }
  :root { --hand-w: 40px; --river-w: 26px; --back-w: 14px; }
  .myhand { gap: 2px; flex-wrap: wrap; justify-content: center; }
  .hand-row { gap: 12px; }
  .meld .tile { width: 30px; height: 41px; }
  .center { width: 190px; padding: 8px 10px; }
  .center .round { font-size: 13px; }
  .center .stats { font-size: 10.5px; }
  .message { font-size: 12px; }
  .modal { min-width: auto; width: 92vw; }
}

/* さらに狭い画面では、卓を画面幅いっぱいに使う。
   河を5列に詰めて、中央の情報箱と重ならない幅にする。 */
@media (max-width: 560px) {
  .table { width: 96vw; }
  :root { --hand-w: 32px; --river-w: 18px; --back-w: 10px; }
  .river {
    grid-template-columns: repeat(5, var(--river-w));
    width: calc(5 * var(--river-w) + 12px);
  }
  .center { width: 156px; padding: 6px 8px; }
  .center .round { font-size: 11.5px; }
  .center .stats { font-size: 9.5px; margin-top: 3px; }
  .center .dora { margin-top: 5px; gap: 5px; }
  .center .dora .tile { width: 22px; height: 30px; }
  .center .dora span { font-size: 9px; }
  .nameplate { font-size: 10px; }
  .myhand .tile.drawn::after { font-size: 8px; bottom: -14px; }
  .controls button { padding: 6px 10px; font-size: 12px; }
}

/* ── 見返し ─────────────────────────────────────────────── */

#reviewGames {
  width: 100%;
  margin-bottom: 8px;
  padding: 6px 8px;
  font: inherit;
  font-size: 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--panel-line);
  border-radius: 6px;
}

.review-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0;
}

.review-nav #reviewCount { font-size: 12px; font-variant-numeric: tabular-nums; }

#reviewMemo {
  width: 100%;
  padding: 8px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--panel-line);
  border-radius: 6px;
  resize: vertical;
}

.review-table td:first-child { white-space: nowrap; opacity: .75; }

/* 見返し中は全部の牌が押せないが、灰色にすると当時の手牌が読みにくい。 */
.myhand.review .tile.locked { opacity: 1; cursor: default; }
.myhand.review .tile:hover { transform: none; }

/* 見返し中、実際に切った牌は元の位置のまま。上に矢印だけを出す。
   牌を動かすと「どこにあった牌か」が分からなくなる。 */
/* ::after は「ツモ」表示で使うので、矢印は ::before に置く。
   ツモ切りのときは両方出したい。 */
.myhand.review .tile.cut::before {
  content: "↑";
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 18px;
  line-height: 1;
  font-weight: 700;
  color: #d9534f;
}

/* 打ちながら1手ごとに残すメモ。右の欄の下に置く。 */
.turn-memo {
  margin-top: 14px;
  padding: 10px;
  font-size: 12px;
  background: #f3efe3;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
}

.turn-memo label { display: block; margin-bottom: 6px; font-weight: 700; }

.turn-memo textarea {
  width: 100%;
  padding: 6px 8px;
  font: inherit;
  font-size: 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--panel-line);
  border-radius: 5px;
  resize: vertical;
}

.turn-memo-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin-top: 6px;
}

/* 幅が狭いと文字が縦に潰れるので、ボタンは縮ませず折り返す。 */
.turn-memo-row button { flex: 0 0 auto; white-space: nowrap; }
.turn-memo-row .hint { flex: 1 1 100%; white-space: normal; }

.turn-memo button { padding: 5px 12px; font-size: 12px; }
.turn-memo .hint { white-space: nowrap; }

/* ── 手牌の右上に出る操作ボタン ───────────────────────────── */

.hand-area { position: relative; }

.hand-top {
  position: absolute;
  right: 8px;
  bottom: 100%;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  z-index: 5;
  pointer-events: none;
}

.hand-top > * { pointer-events: auto; }

.actions { display: flex; gap: 8px; }

.actions .act {
  padding: 10px 20px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .08em;
  color: #10251a;
  background: linear-gradient(180deg, #ffe9a8, #e8bf58);
  border: 1px solid #a9832b;
  border-radius: 999px;
  box-shadow: 0 3px 0 #8d6a1f, 0 5px 12px rgba(0, 0, 0, .45);
  cursor: pointer;
  transition: transform .1s, box-shadow .1s;
  animation: pop .18s ease-out;
}

.actions .act:hover { transform: translateY(-2px); box-shadow: 0 5px 0 #8d6a1f, 0 8px 16px rgba(0, 0, 0, .5); }
.actions .act:active { transform: translateY(2px); box-shadow: 0 1px 0 #8d6a1f; }

.actions .act-ron, .actions .act-tsumo {
  color: #2a0d0b;
  background: linear-gradient(180deg, #ffb3ad, #e2564c);
  border-color: #9c332b;
  box-shadow: 0 3px 0 #7d2820, 0 5px 12px rgba(0, 0, 0, .45);
}

.actions .act-pass {
  color: #e7efe9;
  background: linear-gradient(180deg, #4b5b52, #33403a);
  border-color: #222c27;
  box-shadow: 0 3px 0 #1c2521, 0 5px 12px rgba(0, 0, 0, .4);
}

.actions .act-riichi.on {
  color: #fff;
  background: linear-gradient(180deg, #62b3ff, #2f7fd6);
  border-color: #1f5a99;
  box-shadow: 0 3px 0 #17456f, 0 5px 12px rgba(0, 0, 0, .45);
}

@keyframes pop {
  from { transform: scale(.82); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* 選択肢（ポンの組み合わせ・カンの種類）。ボタンを押してから出す。 */
.choices {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: rgba(18, 30, 24, .96);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 10px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .5);
}

.choices button {
  padding: 8px 14px;
  font-size: 13px;
  color: #10251a;
  background: linear-gradient(180deg, #ffe9a8, #e8bf58);
  border: 1px solid #a9832b;
  border-radius: 6px;
  white-space: nowrap;
  cursor: pointer;
}

.choices button.act-pass { color: #e7efe9; background: #3b4a43; border-color: #222c27; }

/* ── 聴牌の表示 ─────────────────────────────────────────── */

.tenpai { position: relative; }

.tenpai-label {
  display: inline-block;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  color: #eafff2;
  background: rgba(47, 125, 82, .92);
  border: 1px solid #57a87a;
  border-radius: 999px;
  cursor: help;
}

.tenpai.furiten .tenpai-label {
  color: #ffecea;
  background: rgba(150, 52, 45, .92);
  border-color: #d9534f;
}

.tenpai-tip {
  display: none;
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  width: 260px;
  max-height: 46vh;
  overflow-y: auto;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.55;
  color: #e7efe9;
  text-align: left;
  background: rgba(18, 30, 24, .97);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .5);
}

.tenpai:hover .tenpai-tip, .tenpai:focus-within .tenpai-tip { display: block; }
.tenpai-tip b { color: #ffe9a8; }
.tenpai-tip .ng { color: #ff9d97; }
.tenpai-tip .warn { color: #ffd77a; }
.tenpai-opt { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255, 255, 255, .1); }
.tenpai-note { margin-top: 8px; color: #b9c9bf; }

@media (max-width: 900px) {
  .actions .act { padding: 8px 14px; font-size: 14px; }
  .tenpai-tip { width: 220px; }
}

/* 立直の構え中：宣言して切れる牌だけを光らせる。 */
.myhand.arming .tile.locked { opacity: .3; }

.myhand .tile.glow {
  animation: glow 1.1s ease-in-out infinite;
}

@keyframes glow {
  0%, 100% { filter: drop-shadow(0 3px 5px rgba(0, 0, 0, .5)) drop-shadow(0 0 4px #62b3ff); }
  50% { filter: drop-shadow(0 3px 5px rgba(0, 0, 0, .5)) drop-shadow(0 0 14px #8ecbff); }
}

/* 自分の Claude に貼るためのプロンプト表示欄。 */
.prompt-box {
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--panel-line);
  border-radius: 6px;
  resize: vertical;
}

/* コピーの結果メッセージはボタンの下に置く（横に流すと本文と重なる）。 */
#copyPositionState, #copyGameState { display: block; margin-top: 6px; }

/* ── ドラ ─────────────────────────────────────────────────

   控えめに。金の細い縁を常に出し、ときどき光が横切るだけにする。
   牌の絵そのものは変えない（本物の牌にドラの印は無いため）。 */

.tile.dora { position: relative; }

.tile .sheen {
  position: absolute;
  inset: 0;
  border: 1.5px solid rgba(214, 168, 66, .8);
  border-radius: 6px;
  overflow: hidden;
  pointer-events: none;
}

.tile .sheen::after {
  content: "";
  position: absolute;
  top: -40%;
  left: -70%;
  width: 45%;
  height: 180%;
  background: linear-gradient(
    90deg, transparent, rgba(255, 244, 214, .9), transparent);
  transform: rotate(18deg);
  animation: sheen 2.6s ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  opacity: 0;
}

@keyframes sheen {
  0%, 52% { left: -70%; opacity: 0; }
  58% { opacity: .9; }
  92%, 100% { left: 125%; opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .tile .sheen::after { animation: none; }
}

/* 見返しで、鳴きの判断につけるメモ。 */
.call-memo {
  width: 100%;
  margin-bottom: 8px;
  padding: 6px 8px;
  font: inherit;
  font-size: 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--panel-line);
  border-radius: 5px;
  resize: vertical;
}

/* 「Claude に聞く」の3つのボタン。何が聞けるのかを1行ずつ添える。 */
.ask-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }

.ask-list button {
  display: block;
  width: 100%;
  padding: 9px 12px;
  text-align: left;
  line-height: 1.5;
  cursor: pointer;
}

.ask-list button b { display: block; font-size: 13px; }
.ask-list button span { display: block; font-size: 11px; opacity: .7; }

/* 相手の副露。手牌の裏面のとなりに小さく並べる。 */
.opp-melds { display: flex; gap: 6px; flex-wrap: wrap; }
.opp-melds .meld { display: flex; gap: 1px; }
.opp-melds .tile { width: 15px; height: 21px; }

.quadrant[data-seat="1"] .opp-melds,
.quadrant[data-seat="3"] .opp-melds { flex-direction: column; }

/* 鳴ける／ロンできる牌。河の中でどれのことか分かるように光らせる。 */
.river .tile.call-target,
.river .tile.ron-target {
  position: relative;
  z-index: 2;
  animation: callTarget 1s ease-in-out infinite;
}

.river .tile.call-target::before,
.river .tile.ron-target::before {
  content: "";
  position: absolute;
  inset: -3px;
  border: 2.5px solid #ffd34d;
  border-radius: 6px;
  pointer-events: none;
}

.river .tile.ron-target::before { border-color: #ff6b60; }

@keyframes callTarget {
  0%, 100% { filter: drop-shadow(0 0 3px rgba(255, 211, 77, .9)); transform: scale(1); }
  50% { filter: drop-shadow(0 0 11px rgba(255, 211, 77, 1)); transform: scale(1.12); }
}

/* カンでドラが増えたら、表示牌を横に並べる。 */
.dora .tile.many { width: auto; display: flex; gap: 2px; }
.dora .tile.many .tile-svg { width: 18px; }

/* ── 点棒（雀魂と同じく、中央を囲む4辺に置く）─────────────────

   持ち点は全員25000で固定（この練習機は東1局だけを扱うため）。
   立直した人の欄に棒とラベルを出す。ここが「誰が立直したか」の主な手がかり。 */

.seat-score {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  gap: 3px 5px;
  padding: 3px 7px;
  font-variant-numeric: tabular-nums;
  color: #eaf5ee;
  background: rgba(0, 0, 0, .4);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 7px;
  white-space: nowrap;
}

/* 左右は縦に積んで細くする（横に置くと中央の文字が入らない）。 */
.center [data-score="1"], .center [data-score="3"] {
  flex-direction: column;
  gap: 1px;
  padding: 4px 6px;
}

.seat-score .seat-wind {
  padding: 0 6px;
  font-size: 14px;
  background: rgba(255, 255, 255, .14);
  border-radius: 4px;
}

.seat-score .seat-points { font-size: 17px; font-weight: 700; }

.seat-score.riichi {
  color: #fff3d0;
  background: rgba(150, 40, 34, .78);
  border-color: #ffb4ac;
  box-shadow: 0 0 14px rgba(255, 120, 100, .55);
}

.seat-score .seat-riichi {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .12em;
}

/* 立直棒。実物と同じく、白い棒の真ん中に赤い点。 */
.seat-score .seat-riichi i {
  width: 34px;
  height: 7px;
  border-radius: 3px;
  background: #f4f1e6;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .6);
  position: relative;
}

.seat-score .seat-riichi i::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #d9534f;
  transform: translate(-50%, -50%);
}

/* 立直宣言牌。横向きに置くだけだと埋もれるので、金色の枠を付ける。 */
.river .tile.riichi {
  transform: rotate(-90deg);
  outline: 2px solid #ffd34d;
  outline-offset: -1px;
  border-radius: 5px;
  filter: drop-shadow(0 0 6px rgba(255, 211, 77, .8));
}

@media (max-width: 900px) {
  .seat-score { padding: 3px 8px; font-size: 12px; gap: 5px; }
  .seat-score .seat-points { font-size: 14px; }
  .seat-score .seat-riichi i { width: 24px; height: 5px; }
  .center { width: 258px; padding: 6px 6px; }
  .seat-score { font-size: 11px; padding: 2px 4px; gap: 2px 4px; }
  .seat-score .seat-wind { font-size: 11px; padding: 0 4px; }
  .seat-score .seat-points { font-size: 13px; }
  .seat-score .seat-riichi { font-size: 11px; gap: 3px; }
  .seat-score .seat-riichi i { width: 22px; height: 5px; }
  .center .round { font-size: 13px; }
  .center .stats { font-size: 11px; }
}

/* メモの付け先を切り替えるリンク。 */
.turn-memo button.link {
  padding: 0;
  font-size: 11px;
  color: #2f7d52;
  background: none;
  border: none;
  text-decoration: underline;
  cursor: pointer;
}
