:root {
  --bg: #1c1f1d;
  --panel: #262a27;
  --line: #44494a;
  --text: #e2e2dc;
  --dim: #9a9f98;
  --accent: #4da3ff;
  --gold: #e6b422;
  --good: #9ef0a8;
  --bad: #ff9a8f;
  --board: min(640px, calc(100vw - 16px));
  --rgap: 84px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
html { scrollbar-gutter: stable; }
body {
  background: var(--bg);
  color: var(--text);
  font: 13px/1.4 system-ui, "Segoe UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
}
button, select {
  font: inherit;
  white-space: nowrap;
  color: var(--text);
  background: #333836;
  border: 1px solid #5a605d;
  border-radius: 2px;
  padding: 2px 8px;
  cursor: pointer;
}
button:hover:not(:disabled) { background: #3e4441; }
button:disabled { opacity: .45; cursor: default; }
button.primary { border-color: var(--accent); }
h1 { font-size: 16px; margin: 0; letter-spacing: .05em; }
h2 { font-size: 13px; margin: 0; padding: 3px 8px; background: #303532; border-bottom: 1px solid var(--line); }
img, canvas { image-rendering: pixelated; }
.plusv { color: var(--good); } .minusv { color: var(--bad); } .dim { color: var(--dim); }

/* ヘッダー */
#top {
  display: flex; align-items: center; gap: 8px;
  padding: 2px 8px; height: 64px;
  border-bottom: 1px solid var(--line);
  background: #222624;
}
#top label { display: flex; gap: 4px; align-items: center; color: var(--dim); }
#top .spacer { flex: 1; }
#top .ver { color: var(--dim); font-size: 11px; }
#netmsg { color: var(--dim); }
#mascot { position: relative; width: 39px; height: 60px; margin-left: 14px; }
#mascot img { position: absolute; left: 0; top: 0; width: 39px; height: 60px; }
#mascot canvas { position: absolute; left: -14px; top: 0; width: 40px; height: 64px; pointer-events: none; }

/* 状況バー */
#status {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px;
  padding: 4px 8px; border-bottom: 1px solid var(--line); background: #202422;
}
#status b { font-size: 14px; }
#status .k { color: var(--dim); margin-right: 4px; }
#status .dora { display: inline-flex; align-items: center; gap: 4px; }

main { display: flex; gap: 8px; padding: 8px; align-items: flex-start; }
#tableCol { flex: none; width: var(--board); }
#side { flex: 1; min-width: 260px; max-width: 460px; display: flex; flex-direction: column; gap: 8px; }
#side > section, #side > details { border: 1px solid var(--line); background: var(--panel); }
#side .body { padding: 4px 8px; }
#side summary { padding: 3px 8px; cursor: pointer; background: #303532; }
@media (max-width: 1000px) {
  main { flex-direction: column; align-items: stretch; }
  #tableCol { margin: 0 auto; }
  #side { max-width: none; min-width: 0; }
}

/* 牌 */
.t {
  display: inline-block; flex: none;
  width: 64px; height: 92px;
  background: center / 100% 100% no-repeat;
  image-rendering: pixelated;
  position: relative;
}
.t.s { width: 28px; height: 40px; }
.t.xs { width: 19px; height: 27px; }
.t.dora::after {
  content: ""; position: absolute; inset: -2px; border: 2px solid var(--gold); border-radius: 2px; pointer-events: none;
}

/* 卓 */
#board {
  position: relative;
  width: var(--board); height: var(--board);
  image-rendering: pixelated;
  user-select: none;
}
#felt { position: absolute; inset: 0; pointer-events: none; }
.seat {
  position: absolute;
  width: 140px;
  padding: 3px 4px;
  background: rgba(10, 22, 14, .8);
  border: 1px solid #3b5a44;
  border-radius: 2px;
  font-size: 12px;
}
.seat.turn { border-color: var(--accent); }
.seat.pos0 { left: 50%; bottom: 16.5%; transform: translateX(-50%); }
/* 自分の席は横長の 1 行(名前・点 | 鳴き | 手札の枚数・状態 | CPU/人) */
.seat.pos0 { width: auto; min-width: 300px; max-width: 440px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.seat.pos0 .r1 .nm { flex: none; }
.seat.pos0 .melds { margin-top: 0; }
.seat.pos0 .status { margin-top: 0; flex: 1; }
.seat.pos1 { right: 5%; top: 50%; transform: translateY(-50%); }
.seat.pos2 { left: 50%; top: 6%; transform: translateX(-50%); }
.seat.pos3 { left: 5%; top: 50%; transform: translateY(-50%); }
.seat .r1 { display: flex; align-items: center; gap: 4px; }
.seat .r1 .nm { font-weight: bold; flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.seat .r1 .sc { font-size: 15px; font-weight: bold; }
.seat .r1 .dl { font-size: 11px; min-width: 22px; text-align: right; }
.seat .tiles { display: flex; gap: 1px; margin-top: 3px; min-height: 21px; align-items: flex-end; }
.seat .t.xs { width: 15px; height: 21px; }
.seat .melds { display: flex; gap: 4px; margin-top: 3px; }
.seat .meld { display: flex; gap: 0; padding: 1px; background: rgba(255, 255, 255, .08); }
.seat .status { font-size: 11px; color: var(--accent); min-height: 15px; margin-top: 1px; display: flex; gap: 4px; align-items: center; }
.seat .status .cnt { color: var(--dim); }
.seat .status .yk { color: var(--good); }
.seat .status .sp { flex: 1; }
.badge { font-size: 11px; padding: 0 4px; border: 1px solid #666; border-radius: 2px; line-height: 15px; }
.badge.oya { color: #fff; background: #a3322a; border-color: #a3322a; }
.seal { color: var(--gold); font-size: 11px; }
.aikov { color: #ffd27a; }
.mode { display: inline-flex; border: 1px solid #4a524e; border-radius: 2px; }
.mode button { border: 0; border-radius: 0; padding: 0 4px; font-size: 10px; line-height: 14px; background: transparent; color: var(--dim); }
.mode button.on { background: #4a524e; color: #fff; }

/* 河。卓と同じ大きさの枠を席の向きに回し、真ん中の操作盤の手前から 8 枚ずつ並べる */
#plays { position: absolute; inset: 0; }
.rwrap { position: absolute; inset: 0; }
.rwrap.pos1 { transform: rotate(-90deg); }
.rwrap.pos2 { transform: rotate(180deg); }
.rwrap.pos3 { transform: rotate(90deg); }
.river {
  position: absolute; left: 50%; top: calc(50% + var(--rgap));
  transform: translateX(-50%);
  display: grid; grid-template-columns: repeat(8, 19px); grid-auto-rows: 27px; gap: 1px;
}
.river .rt { position: relative; width: 19px; height: 27px; }
.river .rt .t { display: block; }
.river .rt.aiko::before { content: ""; position: absolute; left: 1px; right: 1px; bottom: -1px; height: 2px; background: #6be07f; }
.river .rt.now .t::after { content: ""; position: absolute; inset: -1px; border: 2px solid var(--gold); pointer-events: none; }
.river .rt.flip { animation: flip .25s ease-out; }
.river .rt.cut .t { opacity: .4; }
@keyframes flip { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* 卓の真ん中:前の巡の結果・山・見えていない札 */
/* 卓の絵の操作盤(真ん中の黒い四角)をまるごと覆い、同じ金属の枠と四辺のランプで操作盤に見せる */
#center {
  position: absolute; left: 50%; top: 49.2%; transform: translate(-50%, -50%);
  width: 160px; min-height: 140px; padding: 9px 9px 7px;
  background: #1b1e1f;
  border: 3px solid #3d4244; outline: 2px solid #0b0c0d; border-radius: 4px;
  font-size: 11px; text-align: center;
  display: flex; flex-direction: column; justify-content: center;
}
#center .lamp { position: absolute; background: #333; border: 1px solid #0b0c0d; opacity: .35; }
#center .lamp.p0, #center .lamp.p2 { left: 50%; width: 16px; height: 5px; margin-left: -8px; }
#center .lamp.p1, #center .lamp.p3 { top: 50%; width: 5px; height: 16px; margin-top: -8px; }
#center .lamp.p0 { bottom: -4px; background: #3d7bff; }
#center .lamp.p1 { right: -4px; background: #f2c230; }
#center .lamp.p2 { top: -4px; background: #e8433a; }
#center .lamp.p3 { left: -4px; background: #3fcf5a; }
#center .lamp.on { opacity: 1; outline: 1px solid #fff; }
#center .lamp.p0.on, #center .lamp.p2.on { width: 26px; margin-left: -13px; }
#center .lamp.p1.on, #center .lamp.p3.on { height: 26px; margin-top: -13px; }
#center .prevRow { display: flex; align-items: center; gap: 4px; text-align: left; padding-bottom: 2px; border-bottom: 1px solid #444; min-height: 30px; }
#center .prevRow .who { flex: 1; line-height: 1.2; white-space: nowrap; overflow: hidden; }
#center .prevRow small { font-size: 10px; }
#center .prevRow small.win { color: var(--good); } #center .prevRow small.lose { color: var(--bad); } #center .prevRow small.aiko { color: #ffd27a; }
#center .pot { display: flex; flex-direction: column; align-items: center; line-height: 1; color: var(--dim); font-size: 10px; }
#center .pot b { font-size: 18px; color: #ffd27a; }
#center .pot.hot b { color: var(--gold); }
#center .wallHd { display: flex; justify-content: space-between; align-items: center; margin: 2px 0 1px; }
#center .rsvRow { display: inline-flex; align-items: center; gap: 3px; }
#center .wallHd b { font-size: 13px; }
#center .wall { display: grid; grid-template-columns: repeat(14, 9px); gap: 1px; justify-content: center; min-height: 0; }
#center .wall .t { width: 9px; height: 13px; }
#center .wall.rsv { display: inline-flex; gap: 1px; }
#center .wall.rsv .t { outline: 1px solid var(--gold); }
#center .uns { display: flex; justify-content: center; gap: 4px; margin-top: 4px; padding-top: 3px; border-top: 1px solid #444; }
#center .uns .u { display: inline-flex; align-items: center; gap: 1px; }
#center .uns .t.xs { width: 13px; height: 18px; }
#center .uns b { font-size: 13px; }
#center .cap { color: var(--dim); font-size: 10px; white-space: nowrap; }
#banner {
  position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%);
  padding: 4px 12px; background: #111; border: 1px solid var(--gold); color: var(--gold);
  font-size: 14px; font-weight: bold; white-space: nowrap; z-index: 5;
}

/* 手札 */
#handPanel { margin-top: 8px; }
#handPanel .hinfo { border: 1px solid var(--line); background: var(--panel); }
/* 手札は卓の下の縁に重ねる(札の下の数字は卓の外にはみ出す) */
#handPanel.overlay { position: relative; z-index: 4; margin-top: -106px; }
#handPanel.overlay .cards { justify-content: center; padding: 0 4px 4px; }
#handPanel.overlay .hinfo { margin-top: 2px; }
#handPanel .hd { display: flex; align-items: center; gap: 8px; padding: 4px 8px; background: #303532; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
#handPanel .hd .goal { font-weight: bold; }
#handPanel .hd .goal.oya { color: var(--good); }
#handPanel .hd .goal.ko { color: #ffd27a; }
#handPanel .hd .sp { flex: 1; }
#handPanel .now { display: inline-flex; align-items: center; gap: 4px; }
#handPanel .now .p { display: inline-flex; align-items: center; gap: 2px; font-size: 11px; color: var(--dim); }
#handPanel .cards { display: flex; gap: 5px; padding: 8px; align-items: flex-end; flex-wrap: wrap; }
#handPanel .card { display: flex; flex-direction: column; align-items: center; gap: 1px; cursor: pointer; background: none; border: 0; padding: 0; }
#handPanel .card:disabled { cursor: default; opacity: 1; }
#handPanel .card:not(:disabled):hover .t { transform: translateY(-5px); }
#handPanel .card .t { transition: transform .08s; }
#handPanel .card .tag { font-size: 10px; height: 14px; color: var(--dim); }
#handPanel .card .tag.new { color: #fff; background: #a3322a; padding: 0 4px; border-radius: 2px; }
#handPanel .card .jk { font-size: 13px; font-weight: bold; line-height: 16px; }
#handPanel .card .yk { font-size: 11px; color: var(--dim); line-height: 14px; }
#handPanel .card .yk.best { color: var(--good); }
#handPanel .meldsRow { display: flex; gap: 6px; align-items: center; padding: 0 8px 6px; color: var(--dim); font-size: 11px; }
#handPanel .meldsRow .meld { display: flex; padding: 1px; background: rgba(255, 255, 255, .08); }
#handPanel .bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 8px; border-top: 1px solid var(--line); }
#handPanel .bar .lbl { color: var(--dim); }
#handPanel .bar .fx { display: inline-flex; flex-direction: column; align-items: flex-start; line-height: 1.2; padding: 2px 8px; }
#handPanel .bar .fx small { font-size: 10px; color: var(--dim); }
#handPanel .bar .fx b { color: var(--gold); font-weight: normal; }
#handPanel .bar .fx { border: 1px solid #4a524e; border-radius: 2px; opacity: .45; }
#handPanel .bar .fx.ok { border-color: var(--gold); opacity: 1; }
.gold { color: var(--gold); }
/* フレミングの合わせ出しを選んでいるとき:組める札だけ光る */
#handPanel .cards.picking .card.off .t { opacity: .35; }
#handPanel .cards.picking .card.pair .t { outline: 3px solid var(--gold); outline-offset: 1px; }
#handPanel .cards.picking .card.sel .t { transform: translateY(-8px); outline: 2px dashed var(--gold); outline-offset: 1px; }
#handPanel .card.off .yk { color: var(--bad); font-size: 10px; max-width: 64px; white-space: normal; text-align: center; line-height: 1.1; }
#handPanel .prompt small { font-size: 10px; color: var(--dim); }
#handPanel .prompt { padding: 6px 8px; background: #3a3420; border-bottom: 1px solid #7a6320; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
#handPanel .msg { padding: 10px 8px; color: var(--dim); }
#handPanel .wait { padding: 4px 8px 6px; font-size: 12px; }
#handPanel .wait b { color: var(--good); }
#handPanel .pick { display: flex; gap: 3px; flex-wrap: wrap; }
#handPanel .pick button { padding: 0; border: 1px solid transparent; background: none; }
#handPanel .pick button:hover { border-color: var(--gold); }

/* 横の欄 */
table { border-collapse: collapse; width: 100%; }
td, th { border: 1px solid var(--line); padding: 2px 6px; text-align: left; vertical-align: top; font-weight: normal; }
th { color: var(--dim); white-space: nowrap; background: #2c312e; }
td.num { text-align: right; white-space: nowrap; }
td.tl { display: flex; gap: 1px; flex-wrap: wrap; }
/* 終局の手:面子・雀頭ごとにすき間をあけ、鳴いた面子は薄い枠 */
.fgrp { display: inline-flex; margin-right: 5px; padding: 1px; }
.fgrp.called { background: rgba(255, 255, 255, .1); }
.fgrp.pair { margin-left: 2px; }
.callok { color: var(--accent); }
#judge .body, #rules td { font-size: 12px; }
#logBox .body { max-height: 200px; overflow-y: auto; font-size: 12px; }
#logBox .body div { border-bottom: 1px solid #333; padding: 1px 0; white-space: pre-wrap; }
/* ルール */
#rulesBody { font-size: 12px; }
#rulesBody .rsec { margin: 6px 0 2px; font-weight: bold; color: var(--text); border-bottom: 1px solid var(--line); }
#rulesBody .rsec:first-child { margin-top: 0; }
#rulesBody .rr { display: flex; gap: 8px; align-items: center; padding: 2px 0; }
#rulesBody .rk { flex: none; width: 104px; color: var(--dim); display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
#rulesBody .rk small, #rulesBody .rb small { font-size: 10px; color: var(--dim); margin-left: 4px; }
#rulesBody .rb { flex: 1; line-height: 1.6; }
#rulesBody .grp { display: inline-flex; gap: 0; margin-right: 4px; vertical-align: middle; }
#rulesBody .rnote { color: var(--dim); font-size: 11px; margin: 2px 0 2px 112px; }

/* 終局 */
#overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .6);
  display: flex; align-items: center; justify-content: center; z-index: 20;
}
#overlay[hidden] { display: none; }
#overlay .box { background: var(--panel); border: 1px solid var(--line); min-width: 300px; }
#overlay .box .body { padding: 8px; }
#overlay .box .ft { padding: 6px 8px; text-align: right; border-top: 1px solid var(--line); }

/* v0.8: 牌と卓のドット絵に合わせた、余白のある操作盤 */
:root {
  --bg: #151d1b; --panel: #202c27; --line: #3a4a40;
  --text: #f4ead2; --dim: #b1bdb1; --accent: #9de6c1; --gold: #efc96b;
  --board: min(620px, calc(100vw - 24px)); --rgap: 104px;
}
body { font-size: 14px; background: radial-gradient(ellipse at top, #26352b, #151d1b 75%); min-height: 100svh; }
button, select { min-height: 40px; padding: 7px 12px; border-color: #61705d; border-radius: 2px; }
button, summary, select { touch-action: manipulation; }
button.primary { background: #bf9b48; border: 2px solid #f1d58c; color: #18221c; font-weight: 750; box-shadow: 0 3px 0 #705923; }
button.primary:hover { background: #ebc66b; }
button:focus-visible, summary:focus-visible, select:focus-visible { outline: 3px solid #efc96b; outline-offset: 4px; }
button:hover:not(:disabled) { background-color: #425044; }
button.primary:hover:not(:disabled) { background-color: #ebc66b; }
[hidden] { display: none !important; }
.eyebrow { display: block; font: 10px/1.4 ui-monospace, monospace; letter-spacing: .15em; color: var(--gold); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#top { max-width: 1010px; margin: auto; height: 76px; padding: 6px 22px; gap: 14px; background: transparent; border: 0; }
#top h1 { font-size: 20px; }
#top .brand { display: flex; flex-direction: column; gap: 3px; }
#top #mascot { flex: none; }
#help { background: transparent; }
#settings { position: relative; z-index: 12; }
#settings > summary { list-style: none; padding: 9px 12px; cursor: pointer; min-height: 40px; border: 1px solid #61705d; }
#settings summary::-webkit-details-marker { display: none; }
.settingsBody { position: absolute; right: 0; top: calc(100% + 8px); display: flex; flex-direction: column; gap: 12px; width: 250px; background: #202c27; border: 2px solid #7c805d; padding: 16px; box-shadow: 5px 5px 0 #0d1513; }
#top .settingsBody label { flex-direction: column; align-items: stretch; gap: 8px; }
.playerSetting { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 0; }
.playerSetting > span:first-child { white-space: nowrap; }
.playerSetting .mode { width: auto; flex: none; }
.playerSetting .mode button { min-height: 40px; min-width: 44px; font-size: 13px; }
.playerMode { color: var(--dim); font-size: 11px; }
#status { max-width: 934px; margin: 0 auto 8px; padding: 8px 12px; gap: 14px; border: 1px solid var(--line); background: #1b2621; min-height: 46px; }
.roundBadge { font-size: 18px; color: var(--gold); font-weight: 750; }
.roundTrack { display: flex; gap: 5px; }
.roundTrack i { width: 8px; height: 8px; background: #405044; }
.roundTrack i.done { background: #9de6c1; }
.roundTrack i.current { background: #efc96b; box-shadow: 0 0 0 2px #efc96b33; }
#status .dora { margin-left: auto; }
#status .dora b { font-size: 13px; }
.progressLabel { color: var(--dim); }
.progressLabel b { color: var(--text); font-size: 18px; }
main { max-width: 958px; margin: auto; gap: 18px; padding: 0 12px 24px; }
#side { min-width: 0; width: 296px; flex: 1; gap: 12px; }
#side > section, #side > details { border: 2px solid var(--line); box-shadow: 3px 3px 0 #101713; }
#side summary { padding: 12px; background: #26352b; font-weight: 600; }
#side .body { padding: 12px; }
.seat { padding: 8px; width: 144px; border: 2px solid #44644e; background: #13271eeF; box-shadow: 2px 3px 0 #0c1b15aa; }
.seat.turn { border-color: var(--gold); box-shadow: 0 0 0 2px #efc96b33, 2px 3px 0 #0c1b15aa; }
.seat.turn::before { content: ''; position: absolute; width: 8px; height: 8px; background: var(--gold); top: -5px; left: calc(50% - 4px); }
.seat.pos0 { bottom: 18%; width: auto; min-width: 290px; gap: 10px; }
.seat.pos1 { right: 3%; top: 45%; }
.seat.pos3 { left: 3%; top: 45%; }
.seat.pos2 { top: 5%; }
.seat .r1 { gap: 5px; }
.seat .nm { font-size: 13px; }
.seat .score { display: inline-flex; align-items: baseline; gap: 3px; margin-left: auto; font-variant-numeric: tabular-nums; }
.seat .r1 .sc { font: 700 26px/1.1 ui-monospace, monospace; }
.seat .score small { font-size: 11px; color: var(--dim); }
.rank { display: inline-grid; place-items: center; width: 18px; height: 20px; font: 700 12px ui-monospace, monospace; color: #b9c3b7; background: #34463a; flex: none; }
.rank1 { color: #19251d; background: var(--gold); }
.seat .status { font-size: 12px; margin-top: 7px; gap: 6px; flex-wrap: wrap; }
.seat .status .turnLabel { color: var(--gold); font-size: 11px; }
.handCount { display: inline-flex; gap: 2px; align-items: center; min-height: 12px; }
.handCount i { width: 4px; height: 9px; background: #93a77a; border-bottom: 2px solid #4e6644; }
.mode { border: 0; gap: 2px; }
.mode button { min-height: 26px; line-height: 22px; padding: 2px 5px; font-size: 11px; }
.mode button.on { background: #4a5f4e; }
.thinking { display: inline-flex; gap: 3px; }
.thinking i { width: 4px; height: 4px; background: var(--gold); animation: thinking 1s steps(3) infinite; }
.thinking i:nth-child(2) { animation-delay: .15s; }
.thinking i:nth-child(3) { animation-delay: .3s; }
#center { width: 174px; padding: 10px; min-height: 180px; border-radius: 1px; border-color: #717466; background: #1d2825; box-shadow: inset 0 0 0 2px #101917, 3px 4px 0 #05140c88; gap: 6px; }
.centerTarget { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 13px; }
.centerTarget .t.s { width: 28px; height: 40px; }
.targetEmpty { display: inline-grid; place-items: center; width: 28px; height: 40px; font-size: 24px; color: var(--dim); }
#center .pot { flex-direction: row; justify-content: space-between; align-items: center; padding: 8px 2px; gap: 8px; border-block: 1px solid #4e5c4b; font-size: 13px; }
#center .pot > span { display: flex; gap: 5px; align-items: center; }
#center .pot b { font: 700 30px/1 ui-monospace, monospace; color: var(--gold); }
#center .pot b small { font: 12px system-ui; margin-left: 3px; }
.coinIcon { display: inline-block; width: 10px; height: 12px; background: #efc96b; border: 2px solid #fff0a2; box-shadow: 2px 0 0 #8f6228, inset -2px 0 0 #bf8c37; flex: none; }
.wallCaption { display: flex; gap: 6px; align-items: baseline; justify-content: center; color: #bcc7b8; font-size: 13px; }
.wallCaption b { font: 700 23px/1 ui-monospace, monospace; color: var(--text); }
.mountain { display: grid; grid-template-columns: repeat(14, 1fr); gap: 2px 1px; }
.mountain .t.xs { display: block; width: 10px; height: 15px; }
.mountainTile { transition: opacity .2s; }
.mountainTile.used { opacity: .12; }
#banner { top: 23%; padding: 8px 16px; border: 2px solid var(--gold); box-shadow: 3px 3px 0 #111a12; font-size: 18px; max-width: calc(100% - 30px); white-space: normal; text-align: center; pointer-events: none; }
#banner.enter { animation: bannerIn .24s steps(5) both; }
#fxLayer { position: absolute; inset: 0; z-index: 8; pointer-events: none; overflow: visible; }
#plays { overflow: clip; }
.river { --discard-w: 19px; --discard-h: 27px; }
.rwrap.pos1 .river, .rwrap.pos3 .river { top: calc(50% + 94px); }
#plays .rt.now { grid-column: span 2; grid-row: span 2; width: calc(var(--discard-w) * 2 + 1px); height: calc(var(--discard-h) * 2 + 1px); z-index: 2; filter: drop-shadow(0 0 3px #efc96b88); }
#plays .rt.now .t { width: 100%; height: 100%; }
.targetPin { position: absolute; right: 0; top: 0; width: 12px; height: 14px; background: #112217dd; color: var(--gold); font-size: 10px; line-height: 14px; text-align: center; }
.centerTarget small { display: block; color: var(--gold); font-size: 12px; margin-bottom: 3px; }
.seat.revealed.pos0 { display: block; width: 290px; min-width: 0; white-space: normal; }
.seatFinal { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 5px 3px; margin-top: 10px; padding-top: 9px; border-top: 1px solid #527055; animation: handReveal .3s steps(5) both; }
.seatFinal .fgrp { margin: 0; padding: 1px; }
.seatFinal .fgrp.loose { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 1px; }
.seat .seatFinal .t.xs { width: 18px; height: 26px; }
.seat.pos0 .seatFinal .t.xs { width: 24px; height: 34px; }
.seatYaku { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 8px; text-align: center; }
.seatYaku strong { font: 700 22px/1.1 ui-monospace, monospace; }
.seatYaku > span { font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; color: var(--text); }
.roundEnd #plays { visibility: hidden; }
.roundEnd #center { min-height: 114px; }
.roundEnd .mountain, .roundEnd .wallCaption { display: none; }
.roundFinish { font-size: 18px; font-weight: 700; color: var(--gold); padding: 5px 0; }
@keyframes handReveal { from { opacity: 0; translate: 0 7px; } to { opacity: 1; translate: 0 0; } }
.scoreFloat { position: absolute; font: 800 28px/1 ui-monospace, monospace; text-shadow: 2px 2px #102017, -1px -1px #102017; animation: scoreFloat 1.3s steps(12) both; }
.scoreFloat.gain { color: #bbffc1; }
.scoreFloat.loss { color: #ffada2; }
.flyingCoin { position: absolute; }
#handPanel.overlay { margin-top: -112px; }
#handPanel .cards { gap: 6px; flex-wrap: nowrap; }
#handPanel .card { position: relative; min-height: 44px; min-width: 0; border-radius: 0; }
#handPanel .card:not(:disabled):hover { background: transparent; }
#handPanel .card:focus-visible { outline-offset: 2px; }
#handPanel .card .t { transition: transform .13s steps(3), filter .13s; }
#handPanel .card:not(:disabled):hover .t, #handPanel .card:focus-visible .t { transform: translateY(-8px); filter: brightness(1.13); }
#handPanel .card.winning .t::before { content: ''; position: absolute; inset: 3px; border-bottom: 3px solid #a5f3ac; pointer-events: none; }
#handPanel .card .tag { font-size: 12px; height: 18px; line-height: 18px; }
#handPanel .card .jk { min-width: 36px; font: 700 22px/28px ui-monospace, monospace; text-shadow: 1px 2px #122015; }
#handPanel .card .jk.gold { font: 700 13px/28px system-ui; }
#handPanel .card .yk { font-size: 12px; }
.yakuStar { position: absolute; top: 20px; right: -1px; font-size: 11px; color: var(--gold); text-shadow: 1px 1px #111; }
#handPanel .hinfo { border: 2px solid var(--line); }
#handPanel .hd { padding: 11px 12px; background: #26362c; border-bottom: 0; font-size: 14px; }
.stateDot { width: 7px; height: 7px; display: inline-block; background: #667767; flex: none; }
.stateDot.active { background: var(--gold); box-shadow: 0 0 0 3px #efc96b22; }
.handLegend { display: flex; gap: 10px; font-size: 12px; }
#handPanel .prompt { padding: 10px 12px; font-size: 14px; }
#handPanel .prompt button { min-height: 40px; }
#handPanel .prompt:has([data-call]) { background: #1c3028; border-color: #486a56; }
#handPanel .prompt button[data-call] { display: inline-flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 12px; background: #204236; color: #f0f3e7; border: 2px solid #80ad96; box-shadow: 0 3px 0 #10271f; font-size: 15px; text-shadow: none; }
#handPanel .prompt button[data-call] small { color: #d4e4d8; font-size: 13px; line-height: 1.4; font-weight: 500; }
#handPanel .prompt button[data-call]:hover { background: #2b5142; }
#handPanel .bar { padding: 8px 12px; gap: 8px; }
#handPanel .bar .fx { padding: 6px 10px; min-height: 48px; font-size: 14px; gap: 4px; }
#handPanel .bar .fx b { font-weight: bold; }
#handPanel .bar .fx small { display: flex; align-items: center; gap: 5px; font-size: 13px; }
#handPanel .bar .fx .t.xs { width: 14px; height: 20px; }
#handPanel .wait { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 13px; padding: 10px 12px; }
.handHints { border-top: 1px solid var(--line); }
.handHints summary { min-height: 44px; padding: 11px 12px; cursor: pointer; font-size: 13px; }
.hintBody { padding: 0 12px 12px; }
.hintBody p { margin: 0 0 10px; font-size: 13px; color: var(--dim); }
.hintRow, .hintWait { display: flex; align-items: center; gap: 6px; }
.hintRow { padding: 6px 0; gap: 10px; flex-wrap: wrap; }
.hintWait b { color: var(--good); font-size: 15px; }
#guide { padding: 18px; }
.guideTop { display: flex; justify-content: space-between; align-items: center; }
#guide h2 { background: none; border: 0; padding: 8px 0 14px; font-size: 22px; letter-spacing: .03em; }
.duelPreview { display: flex; align-items: center; justify-content: center; gap: 24px; padding: 8px 0 16px; }
.duelPreview > div { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.duelPreview .t.s, .emptyTile { width: 38px; height: 55px; }
.emptyTile { display: grid; place-items: center; border: 2px dashed #63725d; color: #a3b19a; font: 24px ui-monospace, monospace; }
.duelPreview small { font-size: 12px; color: var(--dim); }
.duelVs { color: var(--gold); font-size: 22px; }
.previewOutcome { min-height: 44px; display: grid; place-items: center; border: 1px solid #455a47; background: #18271e; font-size: 15px; font-weight: 650; }
.previewOutcome.win { color: var(--good); border-color: #658665; }
.previewOutcome.lose { color: var(--bad); border-color: #945e4e; }
.previewOutcome.aiko, .previewOutcome.special { color: var(--gold); }
.previewYaku { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; padding-top: 12px; font-size: 13px; }
.previewYaku > span:first-child { width: 100%; color: var(--dim); padding-bottom: 3px; }
#lastResult { padding: 14px 16px; min-height: 94px; }
.lastDuel { display: flex; align-items: center; gap: 8px; margin: 8px 0 4px; }
.lastDuel strong { margin-left: auto; font: 700 24px ui-monospace, monospace; }
.resultEmpty { display: flex; gap: 12px; align-items: center; min-height: 64px; color: var(--dim); font-size: 13px; }
#rulesBody { font-size: 14px; }
#rulesBody .rr { gap: 8px; padding: 7px 0; border-bottom: 1px solid #354638; }
#rulesBody .rk { width: 85px; font-size: 13px; }
#rulesBody .rb { line-height: 1.7; }
#rulesBody .rnote { margin: 8px 0; font-size: 13px; }
#rulesBody .rsec { margin-top: 18px; padding-bottom: 8px; color: var(--gold); }
#rulesBody .rk small, #rulesBody .rb small { display: block; font-size: 12px; }
#logBox .body { max-height: 250px; font-size: 13px; line-height: 1.7; }
#logBox .body div { padding-block: 8px; }
.roundResults { display: grid; grid-template-columns: 1fr 1fr; padding: 12px; gap: 10px; }
.roundResult { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px; border: 1px solid #445742; }
.roundResult strong { font: 700 26px ui-monospace, monospace; }
.finalTiles, .roundResult > small { grid-column: 1 / -1; }
.roundResult > small { font-size: 12px; color: var(--dim); }
.finalTiles { display: flex; flex-wrap: wrap; gap: 2px; }
.finalTiles .fgrp { margin-right: 3px; }
#overlay { padding: 20px; backdrop-filter: blur(3px); }
#overlay .box { width: 400px; min-width: 0; max-height: 90svh; overflow: auto; border: 2px solid #7b805f; padding: 20px; box-shadow: 6px 6px 0 #0d1712; }
#overlay h2 { background: none; border: 0; font-size: 28px; padding: 8px 0 16px; }
#overlay .body { padding: 0; }
.rankingRow { display: flex; align-items: center; gap: 12px; padding: 14px 8px; border-top: 1px solid var(--line); }
.rankingRow.first { background: #efc96b12; }
.rankingRow strong { margin-left: auto; font: 700 28px ui-monospace, monospace; }
.rankingRow small { font: 12px system-ui; margin-left: 5px; }
#overlay .ft { padding: 20px 0 0; display: flex; gap: 8px; }
#overlay .ft button { flex: 1; min-height: 44px; }
@keyframes thinking { 50% { opacity: .2; transform: translateY(-3px); } }
@keyframes bannerIn { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: 0 0; } }
@keyframes scoreFloat { 0% { opacity: 0; transform: translate(-50%, 0) scale(.8); } 15% { opacity: 1; transform: translate(-50%, -18px) scale(1.15); } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -42px) scale(1); } }

@media (min-width: 861px) {
  main { flex-direction: row; align-items: flex-start; }
  #tableCol { margin: 0; }
}
@media (min-width: 701px) {
  .seat:not(.pos0) .r1 { flex-wrap: wrap; }
  .seat:not(.pos0) .r1 .score { flex-basis: 100%; justify-content: center; }
}
@media (max-width: 860px) {
  main { flex-direction: column; align-items: stretch; gap: 14px; }
  #tableCol { margin-inline: auto; }
  #side { width: var(--board); max-width: none; margin-inline: auto; display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  #guide, #lastResult { grid-column: 1 / -1; }
  #guide { display: none; }
  #lastResult { min-height: 0; padding: 10px 14px; }
  #lastResult .eyebrow { font-size: 10px; }
  .lastDuel { margin: 4px 0; }
  #lastResult > small { display: block; font-size: 13px; margin-top: 6px; }
  #side > details { grid-column: 1 / -1; }
}

/* 縦画面でも対面・上家・下家は卓の三辺。中央盤と得点は縮小しない。 */
@media (max-width: 700px) {
  :root { --board: min(620px, calc(100vw - 32px)); --rgap: 116px; }
  #top { height: 68px; padding: 4px 12px; gap: 8px; }
  #top h1 { font-size: clamp(14px, 4vw, 19px); letter-spacing: 0; }
  #top .brand .eyebrow { font-size: 8px; letter-spacing: .06em; }
  #mascot { margin-left: 3px; width: 30px; height: 48px; }
  #mascot img { width: 31px; height: 48px; }
  #mascot canvas { width: 32px; height: 51px; left: -11px; }
  #help { font-size: 13px; padding-inline: 8px; min-height: 44px; }
  #settings > summary { font-size: 13px; min-height: 44px; padding: 12px 8px; }
  #status { margin: 0 8px 6px; padding: 8px 10px; gap: 10px; flex-wrap: nowrap; font-size: 13px; }
  .roundBadge { font-size: 18px; white-space: nowrap; }
  .roundTrack { gap: 3px; }
  .roundTrack i { width: 5px; height: 7px; }
  #status .k { margin: 0; }
  #status .dora { gap: 5px; }
  #status .progressLabel { white-space: nowrap; font-size: 12px; }
  #status .progressLabel b { font-size: 18px; }
  main { padding: 0 8px 20px; }
  #board { height: clamp(470px, 62svh, 540px); background-size: 100% 100%; }
  #board.roundEnd { height: clamp(580px, 72svh, 640px); }
  #felt { position: absolute; inset: 0; }
  #center { top: 51%; width: 164px; min-height: 188px; padding: 8px; gap: 7px; }
  .centerTarget { font-size: 14px; }
  .centerTarget .t.s { width: 30px; height: 43px; }
  #center .pot { font-size: 13px; padding: 9px 0; }
  #center .pot b { font-size: 30px; }
  .mountain { gap: 3px 1px; }
  .mountain .t.xs { width: 9px; height: 14px; }
  .wallCaption { font-size: 14px; }
  .wallCaption b { font-size: 26px; }
  .seat { position: absolute; padding: 7px 5px; width: 78px; font-size: 12px; z-index: 2; }
  .seat.pos1 { right: 3%; top: 40%; transform: translateY(-50%); }
  .seat.pos3 { left: 3%; top: 40%; transform: translateY(-50%); }
  .seat.pos2 { left: 50%; top: 5%; width: 156px; transform: translateX(-50%); }
  .seat.pos0 { left: 50%; bottom: 5%; transform: translateX(-50%); min-width: 250px; max-width: calc(100% - 36px); width: auto; display: flex; gap: 8px; }
  .seat.pos1 .r1, .seat.pos3 .r1 { display: grid; grid-template-columns: 1fr; gap: 5px; }
  .seat.pos1 .rank, .seat.pos3 .rank { position: absolute; top: -10px; left: 5px; width: 16px; height: 18px; font-size: 11px; }
  .seat.pos1 .nm, .seat.pos3 .nm { font-size: 13px; letter-spacing: -.04em; text-align: center; overflow: visible; }
  .seat.pos1 .score, .seat.pos3 .score { grid-column: 1 / -1; justify-self: center; margin: 0; }
  .seat.pos1 .badge, .seat.pos3 .badge { position: absolute; top: -13px; right: 5px; }
  .seat .r1 .sc { font-size: 26px; }
  .seat .status { gap: 4px; margin-top: 6px; }
  .seat .status .turnLabel { display: none; }
  .seat.pos0 .status { margin-top: 0; }
  .seat.pos0 .handCount { display: none; }
  .handCount { gap: 1px; }
  .handCount i { width: 4px; height: 8px; }
  .mode { width: 100%; }
  .mode button { min-height: 28px; flex: 1; padding: 2px 3px; font-size: 11px; }
  .seat.pos0 .mode, .seat.pos2 .mode { width: auto; }
  .seat .melds { flex-wrap: wrap; gap: 2px; }
  .seat .t.xs { width: 13px; height: 18px; }
  .seat .seal { font-size: 12px; }
  .river { --discard-w: 13px; --discard-h: 19px; grid-template-columns: repeat(8, 13px); grid-auto-rows: 19px; gap: 1px; }
  .rwrap.pos2 .river { top: calc(50% + 104px); }
  .rwrap.pos1, .rwrap.pos3 { translate: 0 18%; }
  .river .rt, .river .t.xs { width: 13px; height: 19px; }
  .rwrap.pos1 .river, .rwrap.pos3 .river { --discard-w: 12px; --discard-h: 17px; top: calc(50% + 90px); grid-template-columns: repeat(8, 12px); grid-auto-rows: 17px; }
  .rwrap.pos1 .river .rt, .rwrap.pos3 .river .rt, .rwrap.pos1 .river .t.xs, .rwrap.pos3 .river .t.xs { width: 12px; height: 17px; }
  #banner { top: 51%; font-size: 16px; padding: 6px 12px; }
  #handPanel.overlay { margin-top: 4px; }
  #handPanel .cards, #handPanel.overlay .cards { gap: 3px; justify-content: center; padding: 0 2px 6px; }
  #handPanel .card { flex: 0 1 44px; }
  #handPanel .card .t { width: 100%; height: auto; aspect-ratio: 64 / 92; }
  #handPanel .card .jk { font-size: 22px; line-height: 29px; }
  #handPanel .card .jk.gold { font-size: 12px; }
  #handPanel .card .tag { font-size: 12px; }
  #handPanel .card .yk { font-size: 11px; }
  #handPanel .cards.picking .card .jk.gold { font-size: 11px; }
  #handPanel .hd { padding: 12px 10px; gap: 8px; }
  .handLegend { font-size: 12px; gap: 8px; }
  .handLegend span { white-space: nowrap; }
  #handPanel .hd > b { font-size: 14px; }
  #handPanel .bar { padding: 8px; gap: 6px; }
  #handPanel .bar .fx { padding: 6px 8px; font-size: 13px; flex: 1; }
  #side { gap: 10px; }
  .roundResults { grid-template-columns: 1fr; padding: 10px; }
  .finalTiles .t.xs { width: 22px; height: 32px; }
  #rulesBody .rk { width: 95px; }
  .scoreFloat { font-size: 30px; }
}
@media (max-width: 370px) {
  #top { gap: 5px; }
  #top .brand .eyebrow { display: none; }
  #top h1 { font-size: 14px; }
  #status { gap: 7px; }
  #status .dora b { display: none; }
  #center { width: 152px; }
  .mountain .t.xs { width: 8px; height: 12px; }
  .seat.pos1, .seat.pos3 { width: 72px; }
  .seat.pos1 { right: 1.5%; }
  .seat.pos3 { left: 1.5%; }
  .handLegend { gap: 5px; font-size: 11px; }
  #handPanel .cards { gap: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .scoreFloat { animation: none !important; transform: translate(-50%, -28px); }
}

/* 自動対戦の解説。卓を覆わず、スクロール中も操作を残す。 */
.helpActions { display: flex; align-items: center; gap: 8px; flex: none; }
#tutorial { border-color: #8aa77e; color: #dce8b9; background: #26392d; }
#tutorial[aria-pressed="true"] { background: #365741; border-color: #b6d8ac; }
#tutorialPanel { position: sticky; top: 8px; z-index: 10; margin-bottom: 12px; padding: 12px; background: #1b2c23; border: 2px solid #86a780; box-shadow: 3px 4px 0 #0e1913; scroll-margin-top: 8px; }
.tutorialHeading { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
#tutorialPanel h2 { margin: 0; padding: 0; border: 0; background: none; font-size: 18px; line-height: 1.4; }
.tutorialHeading > span { flex: none; font: 13px ui-monospace, monospace; color: #c5d2bb; }
.tutorialProgress { height: 4px; margin: 8px 0 10px; background: #364c3a; }
.tutorialProgress i { display: block; height: 100%; background: #a9c88c; transition: width .2s steps(4); }
#tutorialCaption { font-size: 14px; line-height: 1.65; margin: 0; min-height: 70px; color: #edf0df; }
.tutorialExample { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; min-height: 28px; }
.tutorialExample strong { font-size: 13px; color: #d4e5be; margin-left: 4px; }
.tutorialExampleGroup { display: inline-flex; gap: 0; padding-right: 3px; }
.tutorialArrow { color: #b7ccaa; font-size: 18px; }
.tutorialControls { display: grid; grid-template-columns: .8fr 1.2fr 1.4fr .7fr; gap: 6px; margin-top: 10px; }
.tutorialControls button { min-height: 44px; min-width: 0; font-size: 13px; padding: 6px; }
.tutorialControls [data-tutorial-action="next"], .tutorialControls [data-tutorial-action="pause"] { background: #2b4737; border-color: #82ab90; }
.tutorialControls [data-tutorial-action="pause"][aria-pressed="true"] { background: #365741; color: #e7f3c8; }
.tutorialControls:has([data-tutorial-action="replay"]) { grid-template-columns: 1fr 1.1fr 1.3fr; }
.tutorialMode #guide { display: none; }
.tutorialMode #settings { opacity: .45; }
.tutorialMode #handPanel .card { cursor: default; }
.tutorialFocus { outline: 2px solid #c4d7a5; outline-offset: 3px; box-shadow: 0 0 0 4px #183324; }
.tutorialSelected .t { transform: translateY(-7px); outline: 3px solid #9dd5ad; outline-offset: 1px; }
.tutorialAction { display: inline-block; padding: 5px 8px; color: #e0ecdc; background: #204236; border: 1px solid #80ad96; font-size: 13px; }
@media (max-width: 700px) {
  .helpActions { gap: 6px; }
  #tutorial { min-height: 44px; padding-inline: 8px; font-size: 13px; }
  #tutorialPanel { padding: 10px; }
  #tutorialPanel h2 { font-size: 17px; }
  .tutorialExample { gap: 4px; }
}
@media (max-width: 480px) {
  #top { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; grid-template-areas: "mascot brand settings" "actions actions actions"; height: auto; gap: 4px 8px; padding: 5px 12px 8px; }
  #mascot { grid-area: mascot; }
  #top .brand { grid-area: brand; min-width: 0; }
  #top h1 { font-size: 18px; }
  #top .spacer { display: none; }
  #settings { grid-area: settings; }
  .helpActions { grid-area: actions; justify-content: flex-end; }
}

/* 金色(primary)のボタンの中の文字は、説明文まで濃い色にする(うすいグレーは金色に埋もれる)。
   緑の地のポン・チーのボタンは #handPanel .prompt button[data-call] の明るい文字のまま */
button.primary small, button.primary .dim, button.primary span,
#handPanel button.primary small, #handPanel .prompt button.primary small, #handPanel button.primary .dim { color: #3a2e10; }
button.primary b, #handPanel button.primary b { color: #18221c; }
/* ポン・チー(緑の地)は明るい文字に戻す */
#handPanel .prompt button.primary[data-call] small { color: #d4e4d8; }


/* 勝負札 */
.betTag { color: #ff9a8f; font-weight: bold; font-size: 11px; }
#handPanel .card .betv { display: block; font-size: 11px; line-height: 14px; color: #ffcf9a; }
#handPanel .betBar { display: flex; align-items: center; gap: 8px; }
#handPanel .betBtn { border: 2px solid #c0564c; color: #ffd8d2; background: #3a2422; }
#handPanel .betBtn b { color: #ffb4a8; }
#handPanel .betBtn.on { background: #c0564c; color: #fff; }
#handPanel .betBtn.on b { color: #fff; }
.river .rt.betTile .t::before { content: ""; position: absolute; inset: -2px; border: 2px solid #e5483c; pointer-events: none; z-index: 1; }

/* デバッグ */
#debugBar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 8px; margin-bottom: 6px; border: 1px solid #7a6320; background: #2a2614; font-size: 13px; }
#debugBar .sp { flex: 1; }
#debugBar label { display: inline-flex; align-items: center; gap: 4px; }
#debugPanel .body { padding: 6px 8px; font-size: 12px; }
#debugPanel .dbgRow { margin-bottom: 6px; }
#debugPanel ol { margin: 2px 0 0 18px; padding: 0; }
#debugPanel li.chosen { color: var(--gold); }
#debugPanel .dbgSeats td, #debugPanel .dbgSeats th { padding: 2px 4px; font-size: 11px; }
.seat .dbgHand { display: inline-flex; gap: 0; }
.seat .dbgHand .t.xs { width: 12px; height: 17px; }
#handPanel .card .betv.plusv { color: var(--good); }
#handPanel .card .betv.minusv { color: var(--bad); }


/* CPU の一言(吹き出し) */
.seat .bubble {
  position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%);
  max-width: 230px; width: max-content; padding: 4px 8px; z-index: 6;
  background: #f4ead2; color: #1d1a12; border: 2px solid #1d1a12; border-radius: 4px;
  font-size: 12px; line-height: 1.35; font-weight: 600; white-space: normal; text-align: left;
  pointer-events: none;
}
.seat.pos2 .bubble { bottom: auto; top: calc(100% + 8px); }
.seat.pos0 .bubble { bottom: calc(100% + 8px); }

/* 対局ログの札の絵 */
#logBox .body .lt { display: inline-flex; vertical-align: -5px; margin: 0 1px; }
#logBox .body .lt .t.xs { width: 14px; height: 20px; }

/* 役の一覧(右の列に出しっぱなし) */
#yakuPanel h2 { font-size: 13px; padding: 6px 10px; }
#yakuPanel .body { padding: 6px 10px; font-size: 12px; }
#yakuPanel .yr { display: grid; grid-template-columns: 6.5em 2.6em 1fr; align-items: center; gap: 2px 6px; padding: 2px 0; border-bottom: 1px solid #2c3a31; }
#yakuPanel .yn { white-space: nowrap; }
#yakuPanel .yp { text-align: right; font-weight: 700; }
#yakuPanel .ye { display: flex; flex-wrap: nowrap; }
#yakuPanel .yd { grid-column: 3; color: var(--dim); font-size: 11px; }
#yakuPanel .grp { display: inline-flex; margin-right: 3px; }
#yakuPanel .t.xs { width: 11px; height: 16px; }
#yakuPanel .ynote { margin-top: 4px; color: var(--dim); font-size: 11px; }

/* 左の列(デバッグのときだけ) */
#leftSide { display: none; }
body.debug #leftSide { display: block; }
#leftSide > section { border: 2px solid var(--line); background: var(--panel); }

/* PC:スクロールせずに 1 画面。左 デバッグ / 中 卓と手札 / 右 案内・役の一覧・ログ */
@media (min-width: 1100px) {
  body { min-height: 100vh; }
  main {
    max-width: none; display: grid; justify-content: center; align-items: start;
    grid-template-columns: auto minmax(270px, 330px); grid-template-areas: "center right"; gap: 14px; padding: 0 12px 6px;
  }
  body.debug main { grid-template-columns: minmax(250px, 300px) auto minmax(270px, 330px); grid-template-areas: "left center right"; }
  #leftSide { grid-area: left; overflow: auto; }
  #tableCol { grid-area: center; }
  #side { grid-area: right; width: auto; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
  #side > section, #side > details { flex: none; }
  #logBox .body { max-height: 220px; overflow: auto; }
  #debugBar { width: var(--board); }
}

/* 役の一覧は、いちばん右の列(卓 / 次の手・直前の勝負・対局ログ / 役の一覧) */
#yakuSide { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
#yakuSide > section { border: 2px solid var(--line); box-shadow: 3px 3px 0 #101713; background: var(--panel); }
@media (max-width: 1099px) {
  main { flex-wrap: wrap; }
  #yakuSide { flex: 1 1 100%; }
}
@media (max-width: 860px) {
  #yakuSide { width: var(--board); margin-inline: auto; }
}
@media (min-width: 1100px) {
  main { grid-template-columns: auto minmax(250px, 320px) minmax(250px, 300px); grid-template-areas: "center right yaku"; }
  body.debug main { grid-template-columns: minmax(220px, 280px) auto minmax(240px, 300px) minmax(240px, 280px); grid-template-areas: "left center right yaku"; }
  #yakuSide { grid-area: yaku; overflow: auto; }
}


/* 合計とこの局の増減 */
.seat .score .tl { font-size: 10px; color: var(--dim); margin-right: 3px; }
.seat .kyokuDelta { font-size: 11px; text-align: right; line-height: 1.2; }
.seat .kyokuDelta b { font-size: 12px; }
#handPanel .endTable { padding: 6px 10px 10px; }
#handPanel .endTable table, #scoreTable table { border-collapse: collapse; width: 100%; font-size: 12px; }
#handPanel .endTable th, #handPanel .endTable td, #scoreTable th, #scoreTable td { padding: 3px 6px; border-bottom: 1px solid #2c3a31; }
#handPanel .endTable td, #scoreTable td { text-align: right; }
#scoreTable h2 { font-size: 13px; padding: 6px 10px; }
#scoreTable .body { padding: 4px 10px 8px; }
#scoreTable th small { display: block; font-size: 9px; color: var(--dim); font-weight: normal; }


/* スマホ表示の確認(PC で開く枠) */
#viewToggle { flex: none; }
#phonePreview { position: fixed; inset: 0; z-index: 50; background: rgba(8, 12, 10, .92); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 8px; }
#phonePreview[hidden] { display: none; }
#phonePreview .ppBar { display: flex; align-items: center; gap: 8px; font-size: 13px; }
#phonePreview .ppStage { position: relative; overflow: hidden; border: 2px solid #5a605d; border-radius: 4px; background: #000; }
#phonePreview iframe { border: 0; transform-origin: 0 0; background: var(--bg); display: block; }

/* スマホの縦画面:見出しを 1 段に詰め、手札と操作は画面の下に貼り付けていつでも押せるようにする */
@media (max-width: 700px) {
  #viewToggle { display: none; }
  #top { display: flex; height: auto; min-height: 0; padding: 4px 8px; gap: 6px; flex-wrap: nowrap; align-items: center; }
  #top .brand { flex: 1; min-width: 0; }
  #top h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #top .brand .eyebrow { display: none; }
  #top h1 { font-size: 15px; }
  #mascot { width: 22px; height: 34px; margin-left: 8px; }
  #mascot img { width: 22px; height: 34px; }
  #mascot canvas { width: 24px; height: 38px; left: -9px; }
  #top .helpActions { display: flex; gap: 4px; }
  #top .helpActions button, #settings > summary { min-height: 32px; padding: 4px 8px; font-size: 12px; }
  #status { padding: 4px 8px; min-height: 0; font-size: 12px; }
  .seat .score .tl { display: none; }
  .seat .kyokuDelta { font-size: 10px; }
  #handPanel, #handPanel.overlay { position: sticky; bottom: 0; z-index: 30; background: var(--bg); border-top: 2px solid var(--line); padding-top: 4px; margin-top: 6px; }
  #handPanel .hinfo { max-height: 34vh; overflow: auto; }
  #handPanel .handHints, #handPanel .handLegend { display: none; }
  #handPanel .hd { padding: 6px 10px; font-size: 13px; }
  #handPanel .bar, #handPanel .prompt { padding: 6px 10px; gap: 6px; }
  #handPanel .betBar .dim { display: none; }
  #debugBar { font-size: 12px; gap: 6px; }
}
/* スマホ表示の枠の中では、ページの横はみ出しを出さない */
body.inPhoneFrame { overflow-x: hidden; }

/* 自分の合計点:スマホでは自分の席の欄が手札の下に隠れることがあるので、手札の見出しにも出す */
#handPanel .myScore { display: none; font-size: 12px; white-space: nowrap; }
@media (max-width: 700px) { #handPanel .myScore { display: inline; order: 9; margin-left: auto; } }

/* 溜めと王冠 */
.chargeTag { color: #ffcf9a; font-size: 11px; letter-spacing: -1px; }
.badge.crown { color: #1a1a1a; background: var(--gold); border-color: var(--gold); }
#handPanel .card .chargev { color: #ffcf9a; }

/* すり抜けの予約 */
#center .pot.reserved { outline: 2px solid #c0564c; outline-offset: 2px; }

/* 読み(確 = 河から戻した札 / 薄 = 勝てる手を出さなかった) */
.readTag { display: inline-flex; align-items: center; gap: 1px; font-size: 10px; color: #9ef0a8; }
.readTag.thin { color: #ffcf9a; }
.readTag .t.xs { width: 11px; height: 16px; }

/* すり抜けの宣言棒(リーチ棒)。河の最初の 1 段に、捨て牌の手前(真ん中側)へ横に置く */
.rwrap .slipSticks { grid-column: 1 / -1; display: flex; justify-content: center; align-items: center; gap: 6px; height: 11px; margin-bottom: 3px; }
.rwrap .slipStick { display: block; width: 74px; height: 7px; background: #f2ecdc; border: 1px solid #1d1a12; border-radius: 2px; position: relative; }
.rwrap .slipStick::after { content: ""; position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px; background: #c0302a; border-radius: 50%; }

/* すり抜け棒の本数 */
.stickCount { display: inline-flex; gap: 2px; align-items: center; }
.miniStick { display: inline-block; width: 14px; height: 4px; background: #f2ecdc; border: 1px solid #1d1a12; border-radius: 1px; position: relative; }
.miniStick::after { content: ""; position: absolute; left: 50%; top: 50%; width: 2px; height: 2px; margin: -1px 0 0 -1px; background: #c0302a; }

/* 溜め満タン:次に負けると消える */
.chargeTag.full { color: #ff8a7a; }

/* 役の出現確率 */
#yakuPanel .yodds { display: block; color: var(--dim, #9aa89a); font-size: 10px; font-weight: 400; line-height: 1.2; }

/* 長い役名(ジョン・アンブローズ・フレミング)は折り返す */
#yakuPanel .yn { white-space: normal; word-break: keep-all; line-height: 1.25; }

/* 勝負の棒(横に置く) */
.slipSticks.betSticks { align-items: center; gap: 4px; }
.slipSticks.betSticks b { font-size: 10px; color: #ffcf9a; }

/* 効果音の ON/OFF */
.soundOpt { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; cursor: pointer; }
