/* 卓上スコア（ux）。方向性: 卓上の道具。緑のフェルト、真鍮のチップ、象牙色の文字。暗い固定。 */
:root {
  color-scheme: dark;
  --felt: #0e1512;
  --felt-2: #17221c;
  --felt-3: #22312a;
  --line: #2f4237;
  --ink: #efe8d6;
  --ink-dim: #a8b3a5;
  --brass: #e2b64a;
  --brass-dark: #7a5f1c;
  --plus: #8fd18a;
  --minus: #ff7a59;
  --warn: #f0b14a;
  --num: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", system-ui, sans-serif;
  --body: system-ui, "Hiragino Sans", "Noto Sans JP", sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --head-h: 48px;
  --bar-h: 56px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { background: var(--felt); }
body { margin: 0; background: var(--felt); color: var(--ink); font: 16px/1.4 var(--body); min-height: 100vh; }
body.no-scroll { overflow: hidden; }
h1, h2, p { margin: 0; }
button, input, select, summary { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
a { color: inherit; }
.dim { color: var(--ink-dim); }
.small { font-size: 13px; }
.center { text-align: center; }
.err { color: var(--minus); font-size: 14px; min-height: 0; }
.err:empty { display: none; }
.icon { flex: none; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

/* ---- ボタン・入力 ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 14px; border: 1.5px solid transparent; font-weight: 700; text-decoration: none; background: var(--felt-3); color: var(--ink); transition: transform 80ms; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--brass); color: #1a1405; }
.btn.secondary { background: transparent; border-color: var(--brass); color: var(--brass); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); font-weight: 600; }
.btn.danger { background: var(--minus); color: #2a0d05; }
.btn.big { min-height: 58px; font-size: 18px; width: 100%; }
.btn.small { min-height: 44px; padding: 0 14px; font-size: 14px; }
.btn.square { width: 48px; padding: 0; }
.link-btn { background: none; border: 0; color: var(--brass); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; min-height: 44px; min-width: 44px; padding: 0 6px; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; background: none; border: 0; border-radius: 12px; color: var(--ink); }
input, select { width: 100%; min-height: 48px; padding: 0 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--felt-2); color: var(--ink); font-size: 16px; }
input:focus, select:focus { border-color: var(--brass); outline: none; }
label, .label { display: block; margin: 16px 0 6px; font-size: 14px; color: var(--ink-dim); font-weight: 600; }
label.chk { display: flex; align-items: center; gap: 8px; }
label.chk input { width: 20px; min-height: 20px; height: 20px; }
.label.inline { margin: 0; }
.code-input { text-transform: uppercase; letter-spacing: .18em; font-family: var(--num); font-weight: 700; text-align: center; font-size: 20px; }
.inline-row { display: flex; gap: 8px; align-items: center; }
.inline-row input { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-between { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; }
.row-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.row-btns > .btn { flex: 1; }
.shake { animation: shake .3s; border-color: var(--minus); }
@keyframes shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }

/* ---- 入口・作る・入る ---- */
.screen { min-height: 100vh; }
.screen:not(.table-screen) { max-width: 560px; margin: 0 auto; padding: 0 16px calc(24px + var(--safe-b)); }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 56px; }
.brand { display: inline-flex; align-items: center; min-height: 44px; gap: 8px; text-decoration: none; font-weight: 800; letter-spacing: .02em; }
.brand-mark { color: var(--brass); }
.lang-switch { display: inline-flex; background: var(--felt-2); border: 1px solid var(--line); border-radius: 999px; padding: 0; }
.lang-opt { border: 0; background: none; min-height: 44px; min-width: 44px; padding: 0 8px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--ink-dim); }
.lang-opt.on { background: var(--brass); color: #1a1405; }
.page { padding-top: 8px; }
.hero { font-size: 28px; line-height: 1.3; font-weight: 800; margin: 12px 0 20px; text-wrap: balance; }
.cta { display: grid; gap: 12px; margin-top: 24px; }
.join-inline { background: var(--felt-2); padding: 4px 16px 16px; border-radius: 14px; }
.recent { justify-content: space-between; }
.howto { margin-top: 20px; font-size: 14px; }
.page-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 8px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }
.back { display: inline-flex; align-items: center; gap: 2px; background: none; border: 0; color: var(--ink-dim); min-height: 44px; padding: 0 8px 0 0; font-weight: 600; }
.back .icon { transform: rotate(90deg); }
.code-chip { font-family: var(--num); font-weight: 800; letter-spacing: .14em; padding: 4px 10px; border-radius: 8px; background: var(--felt-3); color: var(--brass); }
.kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kind-card { display: grid; gap: 2px; text-align: left; padding: 12px 14px; min-height: 64px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--felt-2); }
.kind-card .kind-name { font-weight: 800; font-size: 17px; }
.kind-card .kind-sum { font-size: 12.5px; color: var(--ink-dim); }
.kind-card.on { border-color: var(--brass); background: var(--felt-3); box-shadow: 0 0 0 1px var(--brass) inset; }
.kind-info { margin-top: 8px; font-size: 14px; }
.custom-box { margin-top: 4px; padding: 0 14px 14px; background: var(--felt-2); border-radius: 14px; }
.stepper-n { display: flex; align-items: center; gap: 4px; }
.step-val { min-width: 48px; text-align: center; font: 800 24px var(--num); font-variant-numeric: tabular-nums; }
.fold { margin-top: 16px; background: var(--felt-2); border-radius: 14px; padding: 0 14px; }
.fold[open] { padding-bottom: 14px; }
.fold summary { min-height: 48px; display: flex; align-items: center; cursor: pointer; font-weight: 600; }
.fold label { margin-top: 4px; }
.hint { font-size: 13px; margin-top: 6px; }
.privacy { margin-top: 16px; font-size: 13.5px; color: var(--ink-dim); padding: 12px 14px; border-left: 3px solid var(--brass); background: var(--felt-2); border-radius: 0 10px 10px 0; }
#c-submit { margin-top: 20px; }
.card-info { background: var(--felt-2); padding: 14px 16px; border-radius: 14px; margin-top: 8px; }
.ci-title { font-weight: 800; font-size: 18px; }
.form .btn { margin-top: 14px; }
.form > .btn { width: 100%; }
.form .btn.big { margin-top: 20px; }
.form > .small.dim { margin-top: 10px; }
.suggest .btn { margin-top: 8px; }
.notice { text-align: center; padding: 36px 8px 20px; display: grid; gap: 10px; justify-items: center; }
.notice h1 { font-size: 22px; }
.notice-icon { color: var(--warn); }
.screen.notfound .form { margin-bottom: 8px; }

/* ---- 骨組み（読み込み中） ---- */
.skeleton-list { display: grid; gap: 8px; padding: 8px 0; }
.skeleton-row { height: 64px; border-radius: 14px; background: var(--felt-2); animation: pulse 1.2s ease-in-out infinite; }
.skeleton-line { display: block; width: 110px; height: 14px; border-radius: 7px; background: var(--felt-3); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

/* ---- 席の行 ---- */
.seats { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.seat { background: var(--felt-2); border-radius: 14px; box-shadow: 0 2px 0 rgba(0,0,0,.35); position: relative; overflow: hidden; }
.seat-head { display: grid; grid-template-columns: 24px 14px 30px minmax(0, 1fr) auto; gap: 8px; align-items: center; width: 100%; min-height: 64px; padding: 0 14px 0 12px; background: none; border: 0; text-align: left; }
.seat-head:disabled { cursor: default; }
.rank { font: 800 18px var(--num); color: var(--ink-dim); text-align: center; font-variant-numeric: tabular-nums; }
.seat.me .rank { color: var(--brass); }
.arrow { font-size: 10px; text-align: center; }
.arrow.up { color: var(--plus); }
.arrow.down { color: var(--minus); }
.dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 14px; color: #10170f; }
.who { min-width: 0; display: grid; gap: 1px; }
.nm-line { display: flex; align-items: center; gap: 4px; min-width: 0; }
.nm { font-size: 17px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tags { display: flex; gap: 6px; }
.tag { font-size: 11.5px; font-weight: 700; padding: 0 6px; border-radius: 6px; display: inline-flex; align-items: center; gap: 3px; line-height: 18px; }
.tag.me { background: var(--felt-3); color: var(--brass); }
.tag.out { background: #4a1f15; color: var(--minus); }
.crown { color: var(--brass); display: inline-flex; animation: crown 1.2s ease-out both; }
.crown.on { animation: none; }
@keyframes crown { 0% { transform: translateY(6px) scale(.5); opacity: 0; } 25% { transform: none; opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
.val, .big { font-family: var(--num); font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; line-height: 1.1; }
.val { font-size: 40px; }
.val.d4 { font-size: 32px; }
.val.d6 { font-size: 26px; }
.seat.out { filter: saturate(.6); }
.seat.out .nm { opacity: .7; }
.seat.sending .val, .seat.sending .big { opacity: .62; }
.bump { animation: bump 150ms ease-out; }
@keyframes bump { 50% { transform: scale(1.15); } }
.flash-plus { animation: flashPlus .9s ease-out; }
.flash-minus { animation: flashMinus .9s ease-out; }
@keyframes flashPlus { from { background-color: rgba(143, 209, 138, .55); } }
@keyframes flashMinus { from { background-color: rgba(255, 122, 89, .55); } }
.seat.mark-plus::before, .seat.mark-minus::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.seat.mark-plus::before { background: var(--plus); }
.seat.mark-minus::before { background: var(--minus); }

.seat-panel { display: none; padding: 0 14px 14px; }
.seat.open .seat-panel { display: block; }
.seat.open .seat-head { min-height: 52px; }
.seat.open .seat-head .val { display: none; }
.seat.open .seat-head { grid-template-columns: 24px 14px 30px minmax(0, 1fr); }
.editing { color: var(--warn); font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.pm { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin: 2px 0 12px; }
.big { flex: 1; min-width: 0; font-size: 56px; background: none; border: 0; text-align: center; padding: 0; height: 80px; }
.big.d4 { font-size: 46px; }
.big.d6 { font-size: 34px; }
.chip { --rim: var(--brass); position: relative; width: 72px; height: 72px; border-radius: 50%; border: 0; padding: 0; flex: none; background: repeating-conic-gradient(var(--rim) 0 12deg, var(--brass-dark) 12deg 24deg); display: grid; place-items: center; color: var(--ink); transition: transform 80ms; touch-action: manipulation; }
.chip::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: radial-gradient(circle at 50% 35%, #34493e, var(--felt-3)); box-shadow: inset 0 -3px 6px rgba(0,0,0,.35); }
.chip::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; }
.chip:active { transform: scale(.94); }
.chip-t { position: relative; font: 800 20px var(--num); font-variant-numeric: tabular-nums; }
.chip.minus .chip-t { color: var(--minus); }
.chip.plus .chip-t { color: var(--plus); }
.big-step .chip { --rim: var(--warn); }
.steps { display: flex; gap: 8px; }
.step { flex: 1; min-height: 44px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--felt-3); font-weight: 800; font-variant-numeric: tabular-nums; }
.step.on { background: var(--brass); color: #1a1405; border-color: var(--brass); }
.step.on.warn { background: var(--warn); border-color: var(--warn); }
.step.warn:not(.on) { border-color: #6b5320; }
.step.eq { flex: 0 0 52px; font-size: 18px; }
.own-status { display: flex; align-items: center; justify-content: space-between; min-height: 32px; margin-top: 10px; font-size: 14px; }
.own-status:empty { display: none; }
.st { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; background: none; border: 0; padding: 0; }
.st.sending { color: var(--ink-dim); }
.st.done { color: var(--plus); }
.st.done .icon { animation: tick .3s ease-out; }
.st.failed { color: var(--warn); text-decoration: underline; text-underline-offset: 3px; min-height: 44px; }
@keyframes tick { 0% { transform: scale(1.7); } 100% { transform: none; } }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--brass); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.list-tail { display: grid; gap: 10px; margin-top: 10px; }
.free-row { padding: 14px; border-radius: 14px; border: 1.5px dashed var(--line); color: var(--ink-dim); text-align: center; font-size: 14px; }
.alone { padding: 14px; border-radius: 14px; background: var(--felt-2); border: 1.5px dashed var(--brass-dark); display: grid; gap: 10px; }
.alone p { color: var(--ink-dim); font-size: 14.5px; }
.add-seat { min-height: 44px; }
.watch-note { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; padding: 10px 12px; border-radius: 12px; background: var(--felt-3); font-size: 14px; font-weight: 600; }
.watch-note .btn { margin: 0; }

/* ---- 卓の画面の枠 ---- */
.table-screen { padding-top: calc(var(--head-h) + 44px); /* 上の帯の分を空けて、帯が席を隠さない */ padding-bottom: calc(var(--bar-h) + var(--safe-b) + 16px); }
.t-head { position: fixed; top: 0; left: 0; right: 0; height: var(--head-h); z-index: 50; display: flex; align-items: center; gap: 6px; padding: 0 4px 0 16px; background: var(--felt); border-bottom: 1px solid var(--line); }
.t-title { flex: 1 1 0; min-width: 0; overflow: hidden; }
.t-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.t-line .t-name { min-width: 0; }
.t-line .badge { flex: none; font-size: 11.5px; line-height: 1.4; }
.t-name { font-weight: 800; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.2; }
.t-sub { white-space: nowrap; display: flex; gap: 6px; align-items: center; font-size: 11.5px; color: var(--ink-dim); line-height: 1.2; font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.badge { background: var(--brass); color: #1a1405; font-weight: 800; padding: 0 6px; border-radius: 6px; letter-spacing: 0; }
.conn-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; margin: 0 2px; }
.conn-dot.live { background: var(--plus); }
.conn-dot.reconnecting { background: var(--warn); animation: pulse 1s infinite; }
.menu-wrap { position: relative; }
.menu-pop { position: absolute; right: 0; top: 46px; width: 250px; background: var(--felt-3); border: 1px solid var(--line); border-radius: 14px; padding: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.5); z-index: 60; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 0 12px; background: none; border: 0; border-radius: 10px; font-weight: 600; text-align: left; }
.menu-item:hover { background: var(--felt-2); }
.menu-item.danger { color: var(--minus); }
.menu-note { font-size: 12px; padding: 8px 12px 6px; }
.banner { position: fixed; top: var(--head-h); left: 0; right: 0; height: 44px; z-index: 45; display: flex; align-items: center; padding: 0 16px; font-size: 15px; white-space: nowrap; overflow: hidden; pointer-events: none; opacity: 0; transform: translateY(-8px); transition: opacity .15s, transform .15s; background: var(--felt-3); border-bottom: 1px solid var(--line); }
.banner.show { opacity: 1; transform: none; }
.banner strong { font-weight: 800; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; min-width: 0; }
.banner .by { color: var(--ink-dim); font-weight: 500; flex: none; padding-left: 6px; }
.banner.plus { background: color-mix(in srgb, var(--plus) 22%, var(--felt-3)); }
.banner.minus { background: color-mix(in srgb, var(--minus) 22%, var(--felt-3)); }
.banner.warn { background: color-mix(in srgb, var(--warn) 30%, var(--felt-3)); }
.banner.ok { background: color-mix(in srgb, var(--plus) 30%, var(--felt-3)); }
.banner.err { background: color-mix(in srgb, var(--minus) 45%, var(--felt-3)); }
.t-body { max-width: 560px; margin: 0 auto; padding: 8px 16px 0; }
.area { min-width: 0; }

/* ---- 履歴 ---- */
.bar { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--bar-h) + var(--safe-b)); padding: 0 8px calc(var(--safe-b)) 16px; z-index: 30; display: flex; align-items: center; gap: 8px; background: var(--felt-3); border-top: 1px solid var(--line); }
.bar-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 100%; background: none; border: 0; text-align: left; }
.bar-status { flex: none; display: inline-flex; }
.bar-status .st.done span, .h-right .st.done span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.bar-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14.5px; }
.bar-open { display: inline-flex; align-items: center; gap: 2px; height: 44px; padding: 0 10px; background: none; border: 0; font-weight: 700; color: var(--brass); flex: none; }
.bar-undo { min-height: 44px; padding: 0 14px; background: var(--brass); color: #1a1405; flex: none; }
.h-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 35; }
.hist-open .h-backdrop { display: block; }
.hist-panel { position: fixed; left: 0; right: 0; bottom: 0; height: 75vh; z-index: 40; background: var(--felt-2); border-radius: 20px 20px 0 0; border-top: 1px solid var(--line); transform: translateY(105%); transition: transform .25s ease-out; display: flex; flex-direction: column; padding-bottom: var(--safe-b); }
.hist-open .hist-panel { transform: none; }
.h-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 8px auto 0; }
.h-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 4px 16px; }
.h-head h2 { font-size: 18px; }
.h-empty { padding: 20px 16px; font-size: 14.5px; }
.h-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.h-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 8px; align-items: center; min-height: 56px; padding: 6px 12px 6px 13px; border-bottom: 1px solid rgba(255,255,255,.05); border-left: 3px solid transparent; }
.h-row.own { border-left-color: var(--brass); }
.h-time { font-size: 12.5px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.h-l1 { font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-l1 .pl { color: var(--plus); font-weight: 800; }
.h-l1 .mi { color: var(--minus); font-weight: 800; }
.h-l2 { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-right { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.h-row.undone .h-main { text-decoration: line-through; opacity: .5; }
.h-row.is-undo .h-l1 { color: var(--ink-dim); }
.h-row.confirming { display: block; padding: 10px 16px; background: var(--felt-3); }
.h-confirm { display: grid; gap: 8px; font-weight: 600; }
.h-confirm .btn { margin: 0; flex: none; }

/* ---- 結果 ---- */
.result { display: grid; gap: 14px; }
.result h2 { font-size: 20px; }
.podium { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pod { display: grid; grid-template-columns: 28px 30px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; min-height: 60px; padding: 0 14px 0 12px; background: var(--felt-2); border-radius: 14px; }
.pod.r1 { min-height: 84px; background: var(--felt-3); box-shadow: 0 0 0 1.5px var(--brass) inset; }
.pod.r1 .nm { font-size: 22px; }
.pod.r1 .rank { color: var(--brass); font-size: 26px; }
.pod .val { font-size: 32px; }
.pod.r1 .val { font-size: 44px; }
.pod .val.d4, .pod.r1 .val.d4 { font-size: 28px; }
.pod .val.d6, .pod.r1 .val.d6 { font-size: 22px; }
.result-line { padding: 14px; background: var(--felt-2); border-radius: 12px; font-size: 15px; word-break: break-word; user-select: all; }

/* ---- モーダル・QR・トースト ---- */
.modal-wrap { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.modal-back { position: absolute; inset: 0; background: rgba(0,0,0,.65); }
.modal { position: relative; width: 100%; max-width: 440px; max-height: 94vh; overflow-y: auto; background: var(--felt-2); border-radius: 22px 22px 0 0; padding: 20px 20px calc(20px + var(--safe-b)); display: grid; gap: 14px; }
.modal h2 { font-size: 19px; padding-right: 40px; }
.modal-x { position: absolute; top: 8px; right: 8px; }
.qr-box { width: min(70vw, 264px); margin: 0 auto; background: #fff; border-radius: 16px; padding: 10px; line-height: 0; }
.qr-box svg { width: 100%; height: auto; display: block; }
.qr-code { text-align: center; font: 800 34px var(--num); letter-spacing: .22em; color: var(--brass); padding-left: .22em; }
.url-copy { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 44px; padding: 0 12px; background: var(--felt-3); border: 1px dashed var(--line); border-radius: 12px; color: var(--ink); }
.url-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.pass-note { background: #3a3014; color: var(--warn); padding: 10px 12px; border-radius: 10px; font-size: 14px; font-weight: 600; }
.sync-hint { text-align: center; font-size: 14px; color: var(--ink-dim); }
.set-diff { min-height: 22px; font: 700 18px var(--num); font-variant-numeric: tabular-nums; color: var(--brass); }
.toast { position: fixed; left: 50%; bottom: calc(var(--bar-h) + var(--safe-b) + 16px); transform: translate(-50%, 12px); max-width: calc(100vw - 32px); background: var(--ink); color: #1a1a14; padding: 10px 16px; border-radius: 999px; font-weight: 700; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; z-index: 200; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- PC（768px 以上）: 左に席、右に履歴 ---- */
@media (min-width: 768px) {
  .table-screen { padding-bottom: 0; min-height: 0; }
  .t-body { max-width: 1080px; display: grid; grid-template-columns: minmax(360px, 520px) minmax(340px, 1fr); gap: 24px; align-items: start; padding-top: 4px; }
  .banner { padding-left: max(16px, calc((100vw - 1080px) / 2 + 16px)); padding-right: max(16px, calc((100vw - 1080px) / 2 + 16px)); }
  .bar, .h-backdrop, .h-grip, .h-close { display: none !important; }
  .hist-panel { position: sticky; top: calc(var(--head-h) + 16px); transform: none; height: calc(100vh - var(--head-h) - 48px); margin-bottom: 16px; border-radius: 18px; border: 1px solid var(--line); transition: none; }
  .t-head { padding-left: max(16px, calc((100vw - 1080px) / 2)); padding-right: max(4px, calc((100vw - 1080px) / 2)); }
  .modal-wrap { align-items: center; }
  .modal { border-radius: 22px; }
  .toast { bottom: 24px; }
  .hero { font-size: 34px; }
}
@media (max-width: 359px) {
  .t-head .lang-opt { min-width: 44px; padding: 0 4px; }
  .val { font-size: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .flash-plus { animation: flashPlus .9s linear !important; }
  .flash-minus { animation: flashMinus .9s linear !important; }
}

/* 周回1: 他人の行の印、初回の一言、QR ボタン */
.val-wrap { display: inline-flex; align-items: center; gap: 6px; }
.edit-mark { display: inline-grid; place-items: center; color: var(--ink-dim); opacity: .55; }
.seat.open .seat-head .val-wrap { display: none; }
.edit-tip { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; padding: 10px 12px; border-radius: 12px; background: var(--felt-3); color: var(--brass); font-size: 14px; font-weight: 600; }
.qr-btn { display: inline-flex; gap: 6px; }
.qr-label { display: none; font-weight: 800; font-size: 15px; }
#qr-newtab, #alone-tab { white-space: nowrap; }
@media (min-width: 768px) {
  .qr-btn { width: auto; padding: 0 10px; }
  .qr-label { display: inline; }
}
.qr-modal .row-btns { display: flex; flex-direction: column; gap: 10px; }
.qr-modal .row-btns .btn { width: 100%; white-space: nowrap; }
.qr-modal .row-btns #qr-newtab { order: 1; }
.qr-modal .row-btns #qr-go { order: 0; }
.alone .row-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.alone .row-btns .btn { flex: 1 1 auto; white-space: nowrap; }
.qr-btn .icon { stroke-width: 1.6; }

/* 周回3: 勝ちの瞬間・最終順位 */
.target-box { margin-top: 0; }
.win-band { position: sticky; top: calc(var(--head-h) + 52px); z-index: 40; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; align-items: center; margin: 0 0 12px; padding: 14px 16px; border-radius: 16px; background: linear-gradient(135deg, #e9c46a, #c9962b); color: #1a1405; box-shadow: 0 6px 0 rgba(0,0,0,.35), 0 0 0 2px #fff3c4 inset; animation: winPop .6s cubic-bezier(.2,1.4,.4,1) both; }
.win-crown { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: rgba(26,20,5,.14); animation: winSway 2.4s ease-in-out infinite; }
.win-text { display: grid; gap: 2px; min-width: 0; }
.win-title { font-size: 24px; font-weight: 900; line-height: 1.15; overflow-wrap: anywhere; }
.win-sub { font-size: 14px; font-weight: 700; opacity: .8; }
.win-band .btn.win-close { grid-column: 1 / -1; margin-top: 8px; background: #1a1405; color: #f6dc8a; min-height: 48px; }
@keyframes winPop { 0% { transform: scale(.85) translateY(-10px); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes winSway { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg) scale(1.06); } }
.seat.winner { box-shadow: 0 0 0 2px var(--brass), 0 2px 0 rgba(0,0,0,.35); background: color-mix(in srgb, var(--brass) 14%, var(--felt-2)); }
.seat.winner .crown { animation: none; }
.result-winner { font-size: 22px; font-weight: 900; color: var(--brass); animation: podIn .5s ease-out both; }
.pod { animation: podIn .5s cubic-bezier(.2,1.2,.4,1) both; animation-delay: calc(var(--i, 0) * .45s + .15s); }
.pod.r1 { min-height: 108px; transform-origin: center top; }
.pod.r1 .crown { color: var(--brass); filter: drop-shadow(0 2px 0 rgba(0,0,0,.4)); }
.pod.r1 .crown svg { width: 32px; height: 32px; }
@keyframes podIn { 0% { opacity: 0; transform: translateY(18px) scale(.96); } 100% { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .pod, .result-winner, .win-band, .win-crown { animation: none !important; opacity: 1 !important; transform: none !important; }
}

/* 周回4: 押し込み・PC の配置・結果カード */
.chip:active, .step:active:not(.on), .btn:active:not(:disabled), .icon-btn:active { filter: brightness(1.35); }
.chip:active { transform: scale(.9); }
.step { transition: transform 80ms, filter 80ms; }
.step:active { transform: scale(.93); }
.val, .big { min-width: 0; }
.set-diff.bad { color: var(--minus); }

@media (min-width: 768px) {
  .t-body { max-width: 1160px; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 380px); gap: 28px; }
  .banner { padding-left: max(16px, calc((100vw - 1160px) / 2 + 16px)); padding-right: max(16px, calc((100vw - 1160px) / 2 + 16px)); }
  .t-head { padding-left: max(16px, calc((100vw - 1160px) / 2)); padding-right: max(4px, calc((100vw - 1160px) / 2)); }
  /* flex の折り返し: 行に1席だけ残った席は自動で全幅に伸びる（自分の席が全幅でも、他人の席が半分の幅で残らない） */
  .seats { display: flex; flex-wrap: wrap; gap: 14px; }
  .seats > .seat { flex: 1 1 300px; min-width: 0; }
  .seats > .seat.open { flex-basis: 100%; }
  .seat { border-radius: 18px; }
  .seat-head { min-height: 96px; gap: 10px; }
  .seat .val { font-size: 52px; }
  .seat .val.d4 { font-size: 42px; }
  .seat .val.d6 { font-size: 32px; }
  .seat .nm { font-size: 20px; }
  .seat.open { grid-column: 1 / -1; }
  .seat.open .seat-head { min-height: 64px; }
  .seat:only-child { grid-column: 1 / -1; }
  .hist-panel { height: auto; min-height: 280px; max-height: calc(100vh - var(--head-h) - 48px); }
  .list-tail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .list-tail > .alone, .list-tail > .add-seat, .list-tail > .free-row, .list-tail > p { grid-column: 1 / -1; }
  .rcard { padding: 24px 28px; }
  .result { max-width: 560px; margin: 0 auto; }
}

/* 結果カード（写真1枚で見せる）。390 幅でスクロールなし */
.result { gap: 12px; }
.rcard { position: relative; overflow: hidden; display: grid; gap: 6px; padding: 14px 14px 12px; border-radius: 22px; background: radial-gradient(120% 70% at 50% 0%, #2c4a38 0%, var(--felt-2) 60%); box-shadow: 0 0 0 2px var(--brass) inset, 0 10px 30px rgba(0,0,0,.45); }
.rc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13px; color: var(--ink-dim); }
.rc-game { font-weight: 800; color: var(--ink); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.rc-date { flex: none; font-variant-numeric: tabular-nums; }
.rc-title { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--brass); text-align: center; margin-top: 2px; }
.result-winner { font-size: 24px; line-height: 1.2; text-align: center; overflow-wrap: anywhere; }
.stage { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 6px; align-items: end; position: relative; margin-top: 6px; }
.stage .pc { display: grid; justify-items: center; gap: 2px; min-width: 0; animation: podIn .5s cubic-bezier(.2,1.2,.4,1) both; animation-delay: calc(var(--i, 0) * .45s + .15s); position: relative; }
.stage .pc-gap { visibility: hidden; }
.stage.n2 { grid-template-columns: 1fr 1fr; padding: 0 16%; }
.stage.n2 .pc-gap { display: none; }
.stage .pc .nm { max-width: 100%; text-align: center; font-size: 15px; }
.stage .pc .val { font-size: 24px; text-align: center; }
.stage .pc .val.d4 { font-size: 22px; }
.stage .pc .val.d6 { font-size: 18px; }
.stage .pc.r1 .nm { font-size: 18px; }
.stage .pc.r1 .val { font-size: 34px; color: var(--brass); }
.stage .pc.r1 .val.d4 { font-size: 28px; }
.stage .pc.r1 .val.d6 { font-size: 22px; }
.stage .pc.r1 .dot { width: 40px; height: 40px; font-size: 18px; box-shadow: 0 0 0 3px var(--brass); }
.stage .pc.r1:not(.pc-0) .nm { font-size: 16px; }
.stage .pc.r1:not(.pc-0) .val { font-size: 28px; }
.stage .pc.r1:not(.pc-0) .val.d4 { font-size: 24px; }
.stage .pc.r1:not(.pc-0) .val.d6 { font-size: 19px; }
.wins-badge { display: inline-flex; align-items: center; gap: 3px; padding: 0 7px; border-radius: 999px; background: color-mix(in srgb, var(--brass) 22%, transparent); color: var(--brass); font-size: 12px; font-weight: 800; line-height: 20px; white-space: nowrap; }
.rest-row .nm { display: inline-flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.tag.wins { background: color-mix(in srgb, var(--brass) 22%, transparent); color: var(--brass); }
.tag.wait { background: var(--felt-3); color: var(--ink-dim); font-weight: 600; }
.next-round { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: 14px; background: var(--brass); color: #1a1405; text-decoration: none; font-weight: 800; font-size: 16px; min-height: 52px; }
.nr-go { flex: none; }
.reserved { margin-top: 12px; display: grid; gap: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-name { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--felt-2); color: var(--ink); font: inherit; font-weight: 700; }
#result-again { width: 100%; }
.pc-crown { justify-self: center; color: var(--brass); filter: drop-shadow(0 3px 0 rgba(0,0,0,.45)); line-height: 0; margin: 2px 0 -2px; animation: crownDrop .7s cubic-bezier(.2,1.5,.4,1) both; animation-delay: .9s; }
@keyframes crownDrop { 0% { opacity: 0; transform: translateY(-26px) scale(.5) rotate(-12deg); } 100% { opacity: 1; transform: none; } }
.pc-block { display: grid; place-items: start center; width: 100%; margin-top: 4px; padding-top: 8px; border-radius: 10px 10px 0 0; background: linear-gradient(180deg, #3a5446, var(--felt-3)); height: 56px; }
.pc-block .rank { font-size: 28px; color: var(--ink); }
.pc.r1 .pc-block { height: 104px; background: linear-gradient(180deg, #e9c46a, #b98b25); }
.pc.r1 .pc-block .rank { color: #1a1405; font-size: 40px; }
.pc.r2 .pc-block { height: 76px; }
.pc .wins-badge { margin: 2px 0; }
.rest { list-style: none; margin: 4px 0 0; padding: 8px 0 0; border-top: 1px solid var(--line); display: grid; gap: 2px; }
.rest-row { display: grid; grid-template-columns: 28px 24px minmax(0, 1fr) auto; gap: 8px; align-items: center; min-height: 34px; animation: podIn .4s ease-out both; animation-delay: calc(var(--i, 3) * .3s + .3s); }
.rest-row .dot { width: 24px; height: 24px; font-size: 12px; }
.rest-row .nm { font-size: 15px; }
.rest-row .val { font-size: 20px; }
.rcard .result-line { padding: 8px 2px 0; margin-top: 4px; border-top: 1px solid var(--line); background: none; font-size: 14px; line-height: 1.7; color: var(--ink-dim); text-align: center; display: flex; flex-wrap: wrap; justify-content: center; gap: 0 14px; user-select: text; }
.rl-item { white-space: nowrap; font-variant-numeric: tabular-nums; }
.rl-item b { color: var(--ink); font-weight: 800; }
@media (prefers-reduced-motion: reduce) {
  .stage .pc, .rest-row, .pc-crown { animation: none !important; opacity: 1 !important; transform: none !important; }
}

/* 最近の卓（入口）と端末に残した結果 */
.recents { margin-top: 28px; }
.recents-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 15px; font-weight: 800; margin-bottom: 8px; }
.recents-empty { margin: 0; }
.recents-clear { margin-top: 10px; }
.recents-hint { font-size: 12px; font-weight: 500; }
.recent-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.recent-item { display: flex; align-items: stretch; background: var(--felt-2); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.recent-main { flex: 1; min-width: 0; display: grid; gap: 2px; text-align: left; background: none; border: 0; padding: 10px 6px 10px 14px; min-height: 64px; }
.recent-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.recent-name { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.recent-badge { flex: none; font-size: 11px; font-weight: 800; padding: 0 6px; border-radius: 6px; background: var(--felt-3); color: var(--ink-dim); }
.recent-badge.live { background: var(--brass); color: #1a1405; }
.recent-meta { font-size: 12.5px; }
.recent-line { font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.recent-del { flex: none; width: 48px; display: grid; place-items: center; background: none; border: 0; border-left: 1px solid var(--line); color: var(--ink-dim); }
.recent-del:hover { color: var(--minus); }
.saved-rank { list-style: none; margin: 16px 0; padding: 0; display: grid; gap: 8px; }
.saved-row { display: grid; grid-template-columns: 32px 30px 1fr auto; align-items: center; gap: 10px; background: var(--felt-2); border-radius: 12px; padding: 10px 12px; }
.saved-row.r1 .rank { color: var(--brass); }
.saved-row .val { font: 800 20px var(--num); font-variant-numeric: tabular-nums; }
.saved-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.saved-rank + .recent-line { margin-bottom: 8px; }
.saved .small { margin: 12px 0; }
/* メニューの音の切り替え */
.menu-note-ico { width: 18px; text-align: center; font-weight: 800; }
.menu-label { flex: 1; }
.menu-state { font-size: 13px; color: var(--ink-dim); }
.menu-item[aria-checked="true"] .menu-state { color: var(--brass); font-weight: 800; }

/* 周回7: サイコロ・先手決め・大きな表示 */
.banner.rand { background: color-mix(in srgb, var(--brass) 28%, var(--felt-3)); }
.banner.rand strong { font-size: 17px; }
.banner.pop strong { animation: dicePop .5s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes dicePop { 0% { transform: translateY(-6px) rotate(-3deg) scale(.9); opacity: 0; } 100% { transform: none; opacity: 1; } }
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tools .btn { min-height: 48px; padding: 0 10px; white-space: nowrap; }
.tag.first { background: var(--brass); color: #1a1405; font-weight: 800; }
.seat.pick-spin { box-shadow: 0 0 0 2px var(--brass); background: color-mix(in srgb, var(--brass) 22%, var(--felt-2)); }
.seat.pick-win { box-shadow: 0 0 0 3px var(--brass), 0 0 24px color-mix(in srgb, var(--brass) 60%, transparent); background: color-mix(in srgb, var(--brass) 26%, var(--felt-2)); animation: pickPop .5s cubic-bezier(.2,1.4,.4,1); }
@keyframes pickPop { 0% { transform: scale(.96); } 60% { transform: scale(1.03); } 100% { transform: none; } }
.h-row.is-rand { border-left-color: var(--brass); }
.h-row.is-rand .h-l1 b { color: var(--brass); }

.dice-modal { gap: 12px; }
.dchips { display: flex; flex-wrap: wrap; gap: 6px; }
.dchip { min-width: 46px; min-height: 48px; padding: 0 6px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--felt-3); font: 800 17px var(--num); font-variant-numeric: tabular-nums; }
.dchip.on { background: var(--brass); color: #1a1405; border-color: var(--brass); }
.dcount-row { display: flex; align-items: center; gap: 10px; }
.dcount-row .label { flex: 1; margin: 0; }
.dcount { min-width: 32px; text-align: center; font: 800 24px var(--num); font-variant-numeric: tabular-nums; }
.dice-out { min-height: 96px; display: grid; align-content: center; justify-items: center; gap: 6px; }
.dice-out:empty { min-height: 0; }
.dice-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.die { display: grid; place-items: center; min-width: 64px; height: 64px; padding: 0 8px; border-radius: 14px; background: var(--ink); color: #1a1a14; font: 900 34px var(--num); font-variant-numeric: tabular-nums; box-shadow: 0 3px 0 rgba(0,0,0,.45); }
.die.d3 { font-size: 26px; }
.dice-tiles.rolling .die { animation: dieShake .16s linear infinite; }
.dice-tiles.landed .die { animation: dieLand .35s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes dieShake { 0% { transform: rotate(-8deg) translateY(-2px); } 50% { transform: rotate(8deg) translateY(2px); } 100% { transform: rotate(-8deg) translateY(-2px); } }
@keyframes dieLand { 0% { transform: scale(1.35) rotate(10deg); } 100% { transform: none; } }
.dice-sum { font: 800 20px var(--num); color: var(--brass); }
.big-suggest { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; padding: 10px 12px; border-radius: 12px; background: var(--felt-2); border: 1px dashed var(--brass-dark); font-size: 14px; }
.big-suggest .btn { margin: 0; flex: none; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) {
  .dice-tiles.rolling .die, .dice-tiles.landed .die, .banner.pop strong, .seat.pick-win { animation: none !important; }
}

/* 大きな表示: 席の数字を大きく、操作を隠す。帯・順位の入れ替わり・勝ちの帯は残す */
.big-display .seat-panel, .big-display .edit-mark, .big-display .tools, .big-display .list-tail,
.big-display .edit-tip, .big-display .watch-note, .big-display .big-suggest, .big-display .win-close, .big-display .bar-undo { display: none !important; }
.big-display .seat { border-radius: 20px; }
.big-display .seat-head { pointer-events: none; min-height: 0; padding: 12px 16px 8px; gap: 2px 8px; grid-template-columns: 34px 16px 44px minmax(0, 1fr); grid-template-areas: "rank arrow dot who" "val val val val"; align-items: center; }
.big-display .seat-head .rank { grid-area: rank; font-size: 28px; }
.big-display .seat-head .arrow { grid-area: arrow; font-size: 13px; }
.big-display .seat-head .dot { grid-area: dot; width: 44px; height: 44px; font-size: 20px; }
.big-display .seat-head .who { grid-area: who; }
.big-display .seat-head .val-wrap { grid-area: val; justify-self: end; }
.big-display .seat .nm { font-size: 26px; }
.big-display .seat .tag { font-size: 13px; line-height: 22px; }
.table-screen.big-display .seat .val { font-size: 84px; line-height: 1; }
.table-screen.big-display .seat .val.d4 { font-size: 70px; }
.table-screen.big-display .seat .val.d6 { font-size: 50px; }
.big-display .bar-text { font-size: 16px; }
@media (min-width: 768px) {
  .big-display .t-body { max-width: none; grid-template-columns: minmax(0, 1fr); padding: 8px 28px 0; }
  .big-display .banner { padding-left: 28px; padding-right: 28px; }
  .big-display .t-head { padding-left: 28px; padding-right: 12px; }
  .big-display .hist-panel { display: none; }
  .big-display .seats { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
  .big-display .seat:only-child { grid-column: auto; }
  .table-screen.big-display { padding-bottom: calc(var(--bar-h) + 16px); }
  .big-display .bar { display: flex !important; justify-content: center; }
  .big-display .bar-main { pointer-events: none; justify-content: center; flex: 0 1 auto; }
  .big-display .bar .bar-open { display: none; }
  .big-display .bar-text { font-size: 20px; }
  .table-screen.big-display .seat .val { font-size: clamp(72px, 9vw, 128px); }
  .table-screen.big-display .seat .val.d4 { font-size: clamp(60px, 7.5vw, 108px); }
  .table-screen.big-display .seat .val.d6 { font-size: clamp(44px, 5.4vw, 76px); }
  .big-display .seat .nm { font-size: 30px; }
  .big-display .seat-head .rank { font-size: 34px; }
}
@media (min-width: 768px) { .list-tail > .tools { grid-column: 1 / -1; } }

/* 周回8: 今夜のまとめ */
.recent-item.series { border-color: var(--brass-dark); }
.series-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px; min-height: 48px; border-radius: 14px; border: 1.5px solid var(--brass-dark); color: var(--brass); text-decoration: none; font-weight: 800; }
.summary .page-head h1 { font-size: 18px; }
.summary .result { max-width: 560px; margin: 0 auto; display: grid; }
.scard .pc-crown { margin: 0; }
.sboard { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; }
.srow { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 8px; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 12px; background: var(--felt-3); animation: podIn .4s ease-out both; animation-delay: calc(var(--i, 0) * .12s + .15s); }
.srow .rank { font-size: 22px; }
.srow .nm { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-weight: 800; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srow .swins { font: 800 22px var(--num); font-variant-numeric: tabular-nums; white-space: nowrap; }
.srow.top { background: linear-gradient(180deg, #e9c46a, #b98b25); color: #1a1405; }
.srow.top .rank, .srow.top .nm, .srow.top .swins { color: #1a1405; }
.srow.top .nm { font-size: 22px; }
.srow.top .swins { font-size: 28px; }
.scrown { display: inline-flex; line-height: 0; flex: none; }
.srounds { margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--line); display: grid; gap: 4px; }
.srounds-title { font-size: 12px; }
.srounds-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 14px; }
.sround { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: baseline; }
.sround-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-btns > .btn { padding: 0 12px; white-space: nowrap; }
/* 周回9: 大きな表示の下の「今夜の合計」 */
.big-total { display: none; }
.big-display .big-total:not([hidden]) { display: grid; gap: 6px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.bt-title { margin: 0; font-size: 14px; }
.bt-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 22px; }
.bt-item { display: inline-flex; align-items: baseline; gap: 8px; min-width: 0; max-width: 100%; font-size: 22px; font-weight: 800; }
.bt-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.bt-wins { color: var(--brass); font-family: var(--num); white-space: nowrap; }
@media (min-width: 768px) { .bt-title { font-size: 16px; } .bt-item { font-size: 32px; } .big-display .big-total:not([hidden]) { margin-top: 24px; padding-top: 16px; } }
.sround b { color: var(--brass); }
.sround.draw { color: var(--ink-dim); }
@media (prefers-reduced-motion: reduce) { .srow { animation: none !important; opacity: 1 !important; transform: none !important; } }

/* 周回8: 大きな表示のサイコロ・先手決めを画面の中央に大きく出す。下半分に直近の操作 */
.big-rand { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; background: rgba(8, 14, 11, .72); animation: brIn .25s ease-out both; cursor: pointer; }
.br-card { display: grid; justify-items: center; gap: 14px; max-width: 100%; padding: 28px 32px; border-radius: 28px; background: radial-gradient(120% 90% at 50% 0%, #2c4a38 0%, var(--felt-2) 70%); box-shadow: 0 0 0 3px var(--brass) inset, 0 20px 60px rgba(0,0,0,.6); text-align: center; }
.br-label { font-size: 20px; font-weight: 800; color: var(--ink-dim); overflow-wrap: anywhere; }
.br-tiles { gap: 16px; }
.br-tiles .die { min-width: 120px; height: 120px; font-size: 72px; border-radius: 24px; }
.br-tiles .die.d3 { font-size: 52px; }
.br-tiles.many .die { min-width: 84px; height: 84px; font-size: 48px; border-radius: 18px; }
.br-sum { font: 900 44px var(--num); color: var(--brass); }
.br-name { font: 900 72px/1.1 var(--num); color: var(--brass); overflow-wrap: anywhere; }
.br-by { font-size: 18px; color: var(--ink-dim); }
@keyframes brIn { from { opacity: 0; } to { opacity: 1; } }
.big-feed { display: none; }
@media (max-width: 420px) {
  .br-card { padding: 22px 18px; }
  .br-tiles .die { min-width: 84px; height: 84px; font-size: 52px; }
  .br-tiles .die.d3 { font-size: 38px; }
  .br-tiles.many .die { min-width: 60px; height: 60px; font-size: 34px; }
  .br-name { font-size: 52px; }
}
@media (min-width: 768px) {
  .big-display .big-feed { display: grid; gap: 8px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
  .bf-title { font-size: 16px; margin: 0; }
  .bf-row { display: flex; align-items: baseline; gap: 14px; font-size: 26px; font-weight: 700; padding: 6px 4px; border-radius: 10px; overflow: hidden; }
  .bf-row:first-of-type { font-size: 30px; }
  .bf-row.rand .bf-main { color: var(--brass); }
  .bf-main { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .bf-by { font-size: 18px; font-weight: 500; white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) { .big-rand { animation: none; } }

/* ---- ラウンド制（周回10） ---- */
.rounds-box { margin-top: 12px; padding: 4px 14px 10px; background: var(--felt-2); border-radius: 14px; }
.rounds-box[hidden], .round-bar[hidden], .h-tabs[hidden] { display: none; }
.rounds-box label.chk { margin: 10px 0 4px; font-size: 16px; color: var(--ink); }
.rounds-box .hint { margin: 0 0 4px; font-size: 13.5px; }
.round-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; padding: 8px 10px 8px 16px; border-radius: 14px; background: var(--felt-3); border: 1.5px solid var(--brass-dark); }
.rb-n { font: 800 20px var(--num); color: var(--brass); white-space: nowrap; }
.rb-actions { display: flex; gap: 8px; flex: none; }
.rb-actions .btn { padding: 0 12px; white-space: nowrap; gap: 4px; }
.rb-actions .btn[hidden] { display: none; }
.rd-score { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.big-display #rb-next, .big-display #rb-table { display: none; }
.h-tabs { display: flex; gap: 6px; padding: 0 16px 8px; }
.h-tab { flex: 1; min-height: 44px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--felt-3); color: var(--ink-dim); font-weight: 800; }
.h-tab.on { background: var(--brass); border-color: var(--brass); color: #1a1405; }
.rounds-view { display: none; padding: 0 12px 16px; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.hist-panel.tab-table .rounds-view { display: block; }
.hist-panel.tab-table .h-list, .hist-panel.tab-table .h-empty { display: none; }
.h-row.is-round { background: color-mix(in srgb, var(--brass) 14%, transparent); }
.rt-cap { margin: 8px 4px 0; }
.rt-wrap { overflow-x: auto; max-width: 100%; border-radius: 12px; border: 1px solid var(--line); background: var(--felt-2); -webkit-overflow-scrolling: touch; }
.rt { border-collapse: separate; border-spacing: 0; width: 100%; font-variant-numeric: tabular-nums; }
.rt th, .rt td { padding: 0 10px; height: 44px; text-align: right; white-space: nowrap; font-family: var(--num); font-weight: 700; font-size: 15px; border-bottom: 1px solid var(--line); background: var(--felt-2); }
.rt tbody tr:last-child th, .rt tbody tr:last-child td { border-bottom: 0; }
.rt thead th { font-size: 13px; color: var(--ink-dim); height: 38px; }
.rt .cur { color: var(--brass); background: color-mix(in srgb, var(--brass) 12%, var(--felt-2)); }
.rt .rt-name { position: sticky; left: 0; z-index: 2; text-align: left; min-width: 112px; max-width: 150px; font-family: var(--body); }
.rt tbody .rt-name { display: table-cell; }
.rt .rt-name .dot { display: inline-grid; width: 24px; height: 24px; font-size: 12px; vertical-align: middle; margin-right: 8px; }
.rt .rt-nm { display: inline-block; vertical-align: middle; max-width: 84px; overflow: hidden; text-overflow: ellipsis; }
.rt .rt-total { position: sticky; right: 0; z-index: 2; color: var(--brass); font-size: 17px; font-weight: 800; border-left: 1px solid var(--line); }
.rt .rt-before { color: var(--ink-dim); }
.rt tr.me .rt-name { color: var(--brass); }
.rc-rounds { margin-top: 6px; min-width: 0; }
.rc-rt-title { margin: 0 0 4px; font-size: 12.5px; font-weight: 700; }
.rt-wrap.mini { border-radius: 10px; }
.rt-wrap.mini .rt th, .rt-wrap.mini .rt td { height: 34px; padding: 0 7px; font-size: 13px; }
.rt-wrap.mini .rt thead th { height: 28px; font-size: 11.5px; }
.rt-wrap.mini .rt .rt-name { min-width: 84px; max-width: 110px; }
.rt-wrap.mini .rt .rt-nm { max-width: 62px; }
.rt-wrap.mini .rt .rt-name .dot { width: 20px; height: 20px; font-size: 10.5px; margin-right: 6px; }
.rt-wrap.mini .rt .rt-total { font-size: 14px; }
.srow .nm .dot { width: 26px; height: 26px; font-size: 12px; flex: none; }
.srow.top .nm .dot { width: 30px; height: 30px; font-size: 14px; }
.rb-note { flex-basis: 100%; margin: 0; color: var(--brass); font-weight: 600; text-align: right; }
.rb-note[hidden] { display: none; }

/* チェックボックスは画面の色（金）に合わせる */
input[type="checkbox"] { accent-color: var(--brass); color-scheme: dark; }

/* ---- ラウンドのまとめて入力・表のマスの修正（周回12） ---- */
.rb-bulk { flex: 1 0 100%; min-height: 44px; font-size: 15px; }
.bulk-modal { max-width: 460px; gap: 10px; }
.bk-hint { margin: -4px 0 0; }
.bk-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bk-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; grid-template-areas: "dot who field" ". status status" ". err err"; align-items: center; column-gap: 10px; row-gap: 2px; padding: 8px 10px; border-radius: 14px; background: var(--felt-3); border: 1.5px solid transparent; }
.bk-row.filled { border-color: var(--brass-dark); }
.bk-row.bad { border-color: var(--minus); }
.bk-row .dot { grid-area: dot; }
.bk-who { grid-area: who; display: grid; min-width: 0; }
.bk-name { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-field { grid-area: field; display: flex; gap: 6px; align-items: center; }
.bk-input { width: 112px; text-align: right; font: 800 20px var(--num); font-variant-numeric: tabular-nums; }
.bk-neg { width: 44px; min-height: 48px; }
.bk-status { grid-area: status; display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; }
.bk-status:empty { display: none; }
.bk-status.sending { color: var(--ink-dim); }
.bk-status.done { color: var(--plus); }
.bk-status.done .icon { animation: tick .3s ease-out; }
.bk-status.failed { color: var(--warn); }
.bk-err { grid-area: err; color: var(--minus); }
.bk-fin { font-weight: 700; color: var(--plus); margin: 0; }
.bk-foot { position: sticky; bottom: calc(-20px - var(--safe-b)); padding: 10px 0 0; background: var(--felt-2); flex-direction: column; flex-wrap: nowrap; gap: 8px; }
.rt .rt-cell { width: 100%; min-width: 52px; height: 34px; padding: 0 8px; border-radius: 9px; border: 1.5px dashed var(--brass); background: color-mix(in srgb, var(--brass) 8%, transparent); color: var(--brass); font: inherit; text-align: right; }
.rt .rt-cell:active { background: color-mix(in srgb, var(--brass) 25%, transparent); }
.rt td.past { color: var(--ink-dim); font-weight: 600; background-image: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--ink) 5%, transparent) 6px 7px); cursor: not-allowed; }

/* ---- 席の色・ラウンドの流れの仕上げ・画像の見本（周回13） ---- */
.bk-send-row, .bk-nav-row { display: flex; gap: 8px; width: 100%; }
.bk-foot .btn { padding: 0 10px; line-height: 1.2; }
.bk-send-row #bk-send { flex: 1 1 0; white-space: normal; }
.bk-send-row #bk-sendnext { flex: 1.2 1 0; white-space: normal; }
.bk-nav-row .btn { flex: 1 1 0; white-space: nowrap; }
.dot.sm { width: 22px; height: 22px; font-size: 11px; flex: none; }
.cp-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.cp-sw { min-height: 46px; border-radius: 14px; border: 2px solid transparent; font: 800 17px var(--num); color: #10170f; display: grid; place-items: center; padding: 0; }
.cp-sw.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--felt-2), 0 0 0 4px var(--brass); }
.cp-sw:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.cp-auto { grid-column: 1 / -1; background: var(--felt-3); color: var(--ink); border-color: var(--line); font: 700 15px var(--body); order: -1; }
.cp-auto.on { border-color: var(--brass); box-shadow: none; }
.cp-note { margin: 6px 0 0; min-height: 20px; }
.seat-color-btn { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.menu-item .dot.sm { margin: 0 1px; }
.h-row.is-color .h-l1 { display: flex; align-items: center; gap: 8px; }
.h-tag { margin-left: 8px; padding: 1px 8px; border-radius: 6px; background: var(--felt-3); color: var(--brass); font-size: 12px; font-weight: 700; white-space: nowrap; }
.h-row.is-fix .h-l1 { flex-wrap: wrap; }
.color-modal { max-width: 440px; }
.img-preview { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; background: none; border: 0; padding: 4px 0 0; color: inherit; }
.img-preview-canvas { width: 116px; height: auto; aspect-ratio: 1080 / 1350; border-radius: 8px; border: 1.5px solid var(--line); box-shadow: 0 4px 14px rgba(0,0,0,.4); background: var(--felt-2); }
.img-preview:active .img-preview-canvas { transform: scale(.98); }
.img-preview:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; border-radius: 10px; }
.fix-cells { margin-left: 6px; font-size: 13.5px; white-space: nowrap; }
.bk-send-row .btn { text-wrap: balance; }
/* 卓の設定・席の名前（周回14） */
.own-status { flex-wrap: wrap; gap: 0 12px; }
.seat-rename-btn { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.settings-modal .set-form { display: grid; gap: 4px; }
.settings-modal .set-form label:first-child { margin-top: 4px; }
.settings-modal .set-form .row-btns { margin-top: 12px; }
.settings-modal .err { margin: 6px 0 0; }
.h-row.is-settings { background: color-mix(in srgb, var(--brass) 8%, transparent); }
.h-row.is-settings .h-l1 b { overflow-wrap: anywhere; }

/* ---- 周回15: 1人に複数のカウンター ---- */
.xs { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 3px; }
.x { display: inline-flex; align-items: baseline; gap: 5px; max-width: 100%; padding: 1px 9px; border-radius: 999px; background: rgba(255,255,255,.07); font-size: 13px; line-height: 20px; }
.x .xn { color: var(--ink-dim); font-size: 12px; font-weight: 600; max-width: 6.5em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.x .xv { font: 800 14px var(--num); font-variant-numeric: tabular-nums; }
.seat.open .xs { display: none; }
.ctabs { display: flex; gap: 6px; margin: 0 0 10px; }
.ctab { flex: 1 1 0; min-width: 0; min-height: 48px; display: grid; gap: 0; justify-items: center; align-content: center; padding: 3px 6px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--felt-3); }
.ctab .tn { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; color: var(--ink-dim); font-weight: 700; }
.ctab .tv { font: 800 17px var(--num); font-variant-numeric: tabular-nums; line-height: 1.2; }
.ctab.on { border-color: var(--brass); background: color-mix(in srgb, var(--brass) 22%, var(--felt-3)); }
.ctab.on .tn { color: var(--brass); }
.x-flash-plus { animation: xFlashPlus .9s ease-out; }
.x-flash-minus { animation: xFlashMinus .9s ease-out; }
@keyframes xFlashPlus { from { background-color: rgba(143, 209, 138, .7); } }
@keyframes xFlashMinus { from { background-color: rgba(255, 122, 89, .7); } }
.x-box { margin-top: 12px; display: grid; gap: 8px; }
.x-box .hint { margin: 0; }
.x-examples { display: flex; flex-wrap: wrap; gap: 8px; }
.x-list { display: grid; gap: 10px; }
.xfield { padding: 0 14px 14px; background: var(--felt-2); border-radius: 14px; display: grid; gap: 4px; }
.xf-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.xf-remove { min-height: 36px; margin: 0; }
.x-set { margin-top: 12px; display: grid; gap: 6px; }
.x-set .xfield { padding: 0 0 8px; background: none; }
.big-display .xs { gap: 6px 10px; margin-top: 6px; }
.big-display .x { font-size: 22px; line-height: 32px; padding: 2px 14px; }
.big-display .x .xn { font-size: 18px; max-width: 9em; }
.big-display .x .xv { font-size: 28px; }

/* 周回15: 閉じた帯と履歴の行は途中で切らずに2行に折る */
.banner { height: auto; min-height: 44px; white-space: normal; flex-wrap: wrap; align-content: center; padding: 5px 16px; line-height: 1.3; }
.banner strong { overflow: visible; text-overflow: clip; }
.h-l1, .h-l2 { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.bar-text { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; font-size: 13.5px; line-height: 1.25; overflow-wrap: anywhere; }
.big-display .bar-text { font-size: 16px; }
@media (min-width: 768px) { .big-display .bar-text { font-size: 20px; } .bar-text { font-size: 14.5px; } }

/* 周回15: 入口の1行と、保存できる画像の見本 */
.hero-uses { font-size: 15px; margin: -10px 0 16px; text-wrap: balance; }
.sample-card { display: flex; align-items: center; gap: 14px; margin: 18px 0 0; }
.sample-canvas { width: 78px; flex: none; height: auto; aspect-ratio: 1080 / 1350; border-radius: 8px; border: 1.5px solid var(--line); box-shadow: 0 4px 14px rgba(0,0,0,.4); background: var(--felt-2); }
.sample-cap { font-size: 14px; }

/* 周回16: 脱落の条件、脱落の理由、入口の見本の拡大 */
.rule-box { display: grid; gap: 8px; }
.rule-sel { width: 100%; min-height: 44px; }
.rule-at { display: flex; align-items: center; gap: 8px; }
.rule-num { width: 6.5em; min-height: 44px; }
.tag.out { white-space: nowrap; }
.h-tag.out { background: #4a1f15; color: var(--minus); }
.out-why { display: block; margin-top: 2px; font-size: 12px; font-weight: 700; color: var(--minus); }
.sample-card { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-align: left; width: 100%; cursor: zoom-in; }
.sample-card:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; border-radius: 10px; }
.sample-zoom { align-items: center; }
.sample-zoom-body { position: relative; display: grid; justify-items: center; gap: 12px; max-height: 96vh; padding: 12px; }
.sample-big { width: min(86vw, 420px, calc((96vh - 90px) * 0.8)); height: auto; aspect-ratio: 1080 / 1350; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,.6); }
/* 大きな表示: 「あなた」の印で自分の席だけ背が高くなり、丸と数字がずれていた。名前の高さを全席で揃え、上端に合わせる */
.big-display .seat-head { align-items: start; }
.big-display .seat-head .who { min-height: 66px; align-content: start; }
.big-display .seat-head .rank { align-self: start; }
.big-display .seat-head .val-wrap { align-self: end; }
/* 周回16: 2つ目のカウンターがあると who が 66px を超え、「あなた」の行のぶん自分の席だけ下がっていた。印の行の高さを全席で常に確保する */
.big-display .seat-head .tags { min-height: 22px; align-items: center; }

/* ---- 周回17: 下端バーの長い名前は名前を省き、末尾の「・誰が・いつ」を残す ---- */
.bar-text .bar-nm { display: inline-block; max-width: 8em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
@media (max-width: 430px) { .bar-text .bar-nm { max-width: 4em; } }
@media (max-width: 430px) {
  /* 取り消しの大きなボタンが出ている間は「履歴」の文字を畳み、バーの文を2行で読み切れるようにする（帯の文のほうは押しても履歴が開く） */
  .bar:has(.bar-undo:not([hidden])) .bar-open span { display: none; }
  .bar:has(.bar-undo:not([hidden])) .bar-open { padding: 0 6px; }
  .bar-undo { padding: 0 10px; }
}

/* 周回18: 1人で全員分を付ける */
.players-list { display: grid; gap: 8px; margin-bottom: 8px; }
.player-row { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 8px; align-items: center; }
.player-row .pn { text-align: center; font-weight: 800; color: var(--brass); }
.player-row .pme { min-height: 44px; display: flex; align-items: center; padding: 0 12px; border-radius: 12px; background: var(--felt-2); color: var(--ink); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.anyone-note { margin: 0 2px 8px; }
.solo-note { margin: 8px 0 0; padding: 8px 10px; border-radius: 10px; background: var(--felt-3); color: var(--brass); font-size: 14px; font-weight: 600; text-align: left; }
.seat .quick { position: absolute; right: 8px; top: 10px; display: flex; gap: 6px; }
.seat .quick[hidden] { display: none; }
.qbtn { width: 40px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--felt-3); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; }
.qbtn:active { transform: scale(.94); }
.seat.has-quick .seat-head { padding-right: 98px; }
.seat.has-quick .seat-head .val-wrap { max-width: 100%; }
@media (min-width: 720px) { .seat .quick { top: 24px; } .seat.has-quick .seat-head { padding-right: 112px; } }
.big-display .quick { display: none !important; }
/* 周回18b: 2列（768px〜）では ＋／− を行の下の右端へ移し、名前の幅を取り戻す */
@media (min-width: 768px) {
  .seat .quick { position: static; justify-content: flex-end; padding: 0 12px 10px; margin-top: -8px; }
  .seat.has-quick .seat-head { padding-right: 14px; }
  .seat .quick .qbtn { width: 44px; height: 38px; }
}
.hero-solo { font-size: 17px; font-weight: 700; color: var(--brass); margin: -6px 0 12px; text-wrap: balance; }
.err.field { margin-top: 4px; }
.player-row input.bad { border-color: var(--minus); }
