/* ===== ヨット スタイル ===== */
:root {
  --sea-0: #07182a;
  --sea-1: #0b2239;
  --sea-2: #123a5e;
  --sea-3: #1d5586;
  --paper: #f7f3e8;
  --paper-2: #ece5d3;
  --ink: #1b2430;
  --ink-soft: #5b6573;
  --red: #d9483b;
  --gold: #e8b53a;
  --teal: #2a9d8f;
  --p0: #3d8bfd;
  --p1: #e8693b;
  --joker: #7b3fe4;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  --die: clamp(46px, 13vw, 68px);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background: #0b3d1f;
  color: #eaf2fb;
  -webkit-tap-highlight-color: transparent;
}

/* 背景画像（iOS Safari は background-attachment: fixed が不安定なため固定レイヤーで敷く） */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.28)),
    url("../assets/bakku.webp") center / cover no-repeat,
    #0b3d1f;
}

#app { min-height: 100vh; min-height: 100dvh; }

[hidden] { display: none !important; }

/* ===== ボタン ===== */
.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.7em 1.4em;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease, background 0.15s ease, opacity 0.15s;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.2;
}
.btn:hover:not(:disabled) { filter: brightness(1.06); }
.btn:active:not(:disabled) { transform: translateY(1px) scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.btn.primary { background: linear-gradient(180deg, #ff6b57, var(--red)); color: #fff; box-shadow: 0 6px 16px rgba(217, 72, 59, 0.35); }
.btn.secondary { background: rgba(255, 255, 255, 0.12); color: #eaf2fb; border: 1px solid rgba(255, 255, 255, 0.25); }
.btn.secondary.active { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.btn.ghost { background: transparent; color: #cfe0f2; border: 1px solid rgba(255, 255, 255, 0.2); }
.btn.small { padding: 0.45em 0.9em; font-size: 0.85rem; white-space: nowrap; }
.btn.big { padding: 0.85em 2em; font-size: 1.08rem; min-width: 12em; }

/* ===== メニュー画面 ===== */
.screen {
  max-width: 720px;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 16px 48px;
}

.logo {
  text-align: center;
  margin: 28px 0 8px;
}
.logo h1 {
  margin: 0;
  font-size: clamp(2.6rem, 11vw, 4.2rem);
  letter-spacing: 0.08em;
  font-weight: 900;
  background: linear-gradient(180deg, #ffffff, #bcd6f0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 4px 24px rgba(120, 180, 255, 0.25);
}
.logo .sub { margin: 4px 0 0; color: #9fb8d2; letter-spacing: 0.3em; font-size: 0.8rem; }
.logo-dice { display: flex; justify-content: center; gap: 10px; margin: 18px 0 6px; }
.logo-dice .die { --die: 44px; animation: bob 3s ease-in-out infinite; }
.logo-dice .die:nth-child(2) { animation-delay: 0.2s; }
.logo-dice .die:nth-child(3) { animation-delay: 0.4s; }
.logo-dice .die:nth-child(4) { animation-delay: 0.6s; }
.logo-dice .die:nth-child(5) { animation-delay: 0.8s; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-6px) rotate(3deg); } }

.screen h2 { font-size: 1.4rem; margin: 18px 0 6px; }
.screen .lead { color: #a9c0d8; margin: 0 0 18px; line-height: 1.6; }

.menu { display: grid; gap: 12px; margin-top: 18px; }
.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04));
  color: #eaf2fb;
  border-radius: var(--radius);
  padding: 16px 18px;
  font: inherit;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.15s, background 0.15s;
}
.menu-item:hover { border-color: rgba(255, 255, 255, 0.35); background: rgba(255, 255, 255, 0.12); }
.menu-item:active { transform: scale(0.99); }
.menu-item:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.menu-item .t { display: block; font-size: 1.15rem; font-weight: 800; }
.menu-item .d { display: block; color: #a9c0d8; font-size: 0.88rem; margin-top: 4px; line-height: 1.5; }

.nav-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 24px; flex-wrap: wrap; }

/* ルール選択 */
.rule-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.rule-card {
  position: relative;
  display: block;
  border: 2px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  padding: 14px 14px 14px 48px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.rule-card input { position: absolute; opacity: 0; pointer-events: none; }
.rule-card::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 16px;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, 0.4);
}
.rule-card.checked { border-color: var(--gold); background: rgba(232, 181, 58, 0.14); }
.rule-card.checked::before { background: var(--gold); border-color: var(--gold); box-shadow: inset 0 0 0 3px var(--sea-1); }
.rule-card.disabled { opacity: 0.45; cursor: not-allowed; }
.rule-card:focus-within { outline: 3px solid var(--gold); outline-offset: 2px; }
.rule-card .t { font-weight: 800; }
.rule-card .d { color: #b7cbe0; font-size: 0.85rem; margin-top: 4px; line-height: 1.55; }
.counter { color: var(--gold); font-weight: 700; }

/* モーダル（明るい背景）内のルール選択カード：黒文字・黒チェックボックス・枠線 */
.modal .rule-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.modal .rule-card { background: #fff; border: 2px solid #1b2430; color: #111; }
.modal .rule-card .t { color: #111; }
.modal .rule-card .d { color: #111; }
.modal .rule-card::before { border-color: #111; background: #fff; }
.modal .rule-card.checked { background: #fff4d1; border-color: #111; box-shadow: 0 0 0 2px var(--gold); }
.modal .rule-card.checked::before { background: #111; border-color: #111; box-shadow: inset 0 0 0 3px #fff; }
.modal .rule-card.disabled { opacity: 0.55; }
.modal .rule-card:hover:not(.disabled) { background: #fafafa; }
.modal .rule-card.checked:hover { background: #fff4d1; }

/* フォーム */
.field { display: grid; gap: 6px; margin: 14px 0; }
.field label { font-weight: 700; font-size: 0.92rem; }
.field input {
  font: inherit;
  padding: 0.75em 0.9em;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  font-size: 1.05rem;
}
.field input:focus { outline: 2px solid var(--gold); border-color: transparent; }
.field .help { color: #9fb8d2; font-size: 0.82rem; }
.error-text { color: #ff9c8f; min-height: 1.4em; font-weight: 700; }

.waiting { text-align: center; padding: 30px 0; }
.passphrase-box {
  display: inline-block;
  margin: 12px 0;
  padding: 12px 24px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px dashed rgba(255, 255, 255, 0.4);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  word-break: break-all;
}
.spinner {
  width: 42px;
  height: 42px;
  margin: 18px auto;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--gold);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== ゲーム画面 ===== */
.game {
  max-width: 1100px;
  margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom));
}
.game-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.header-right { display: flex; gap: 6px; }
.game-title { text-align: center; font-weight: 800; display: grid; }
.game-title .round { color: var(--gold); font-size: 0.85rem; font-weight: 700; }

.players { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.player {
  position: relative;
  border-radius: var(--radius);
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid transparent;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
  min-width: 0;
}
.player.p0 { --pc: var(--p0); }
.player.p1 { --pc: var(--p1); }
.player.active { border-color: var(--pc); background: color-mix(in srgb, var(--pc) 18%, transparent); }
.player .top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.player .name { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player .name::before { content: "●"; color: var(--pc); margin-right: 6px; }
.player .you { margin-left: 6px; font-size: 0.62rem; font-weight: 800; padding: 1px 6px; border-radius: 99px; background: var(--pc); color: #fff; vertical-align: 2px; }
.player .total { font-size: 1.6rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.player .tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; min-height: 0; }
.player .turn-mark {
  position: absolute; top: -9px; left: 12px;
  background: var(--pc); color: #fff; font-size: 0.7rem; font-weight: 800;
  padding: 1px 8px; border-radius: 99px;
}
.tag {
  font-size: 0.7rem; font-weight: 700; padding: 2px 7px; border-radius: 99px;
  background: rgba(255, 255, 255, 0.14); color: #dce8f5; cursor: help; white-space: nowrap;
}
.tag.rule { background: rgba(232, 181, 58, 0.22); color: #ffe1a1; }

.board { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
/* PC、およびスマホの横画面は 2 カラム */
@media (min-width: 880px), (orientation: landscape) and (min-width: 560px) {
  .board { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); align-items: start; }
  .tray { position: sticky; top: 12px; }
}

.card { background: var(--paper); color: var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); }

/* スコア表 */
.scorecard-wrap { padding: 6px; overflow: hidden; }
.scorecard { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.scorecard th, .scorecard td { padding: 0; border-bottom: 1px solid var(--paper-2); height: 36px; }
.scorecard thead th { font-size: 0.8rem; color: var(--ink-soft); height: 30px; }
.scorecard thead th.pcol { width: 27%; }
.scorecard thead th.p0 { color: var(--p0); }
.scorecard thead th.p1 { color: var(--p1); }
.scorecard .cat { text-align: left; padding-left: 10px; font-weight: 700; font-size: 0.92rem; }
.scorecard .cat small { display: block; font-weight: 400; color: var(--ink-soft); font-size: 0.68rem; line-height: 1.2; }
.scorecard td { text-align: center; }
.scorecard td.cur { background: rgba(61, 139, 253, 0.05); }
.scorecard td.cur.p1 { background: rgba(232, 105, 59, 0.06); }
.scorecard .filled { font-weight: 800; font-size: 1.05rem; }
.scorecard .filled .note { display: block; font-size: 0.58rem; color: var(--red); font-weight: 800; line-height: 1; }
.scorecard .sum td, .scorecard .sum th { background: var(--paper-2); height: 30px; font-size: 0.85rem; }
.scorecard .total td, .scorecard .total th { background: var(--ink); color: #fff; height: 40px; font-size: 1.1rem; font-weight: 900; }
.scorecard .total th { border-radius: 0 0 0 10px; }
.scorecard tr.bet-row .cat { color: var(--red); }
.scorecard tr.bet-row .cat::after { content: " BET×2"; font-size: 0.65rem; background: var(--red); color: #fff; border-radius: 4px; padding: 1px 4px; margin-left: 4px; vertical-align: 2px; }
.preview {
  width: calc(100% - 8px);
  height: 30px;
  margin: 3px 4px;
  border: 2px dashed rgba(27, 36, 48, 0.25);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-weight: 800;
  font-size: 1rem;
  color: var(--teal);
  cursor: pointer;
  transition: transform 0.08s, background 0.15s, border-color 0.15s;
}
.preview:hover:not(:disabled) { background: #e8fbf7; border-color: var(--teal); border-style: solid; }
.preview:active:not(:disabled) { transform: scale(0.96); }
.preview.zero { color: #b3b0a6; }
.preview.best { border-color: var(--teal); border-style: solid; background: #e8fbf7; }
.preview:disabled { cursor: not-allowed; opacity: 0.35; }
.preview:focus-visible { outline: 3px solid var(--gold); }
.preview .note { display: block; font-size: 0.55rem; line-height: 1; color: var(--red); }
.preview.has-note { line-height: 1; }
.ghost-preview { color: #b9b3a3; font-size: 0.85rem; }
.just-filled { animation: pop 0.6s ease; }
@keyframes pop { 0% { background: var(--gold); } 100% { background: transparent; } }

/* ダイストレイ */
.tray { padding: 14px; background: linear-gradient(180deg, #1f6b4f, #17563f); color: #fff; border: 6px solid #6b4526; box-shadow: var(--shadow), inset 0 0 40px rgba(0, 0, 0, 0.35); }
.turn-banner { text-align: center; font-weight: 800; font-size: 1.05rem; min-height: 1.5em; }
.turn-banner .who { padding: 2px 10px; border-radius: 99px; background: var(--pc, #fff); color: #fff; }
.bet-panel { margin: 10px 0 0; text-align: center; }
.bet-panel .label { font-size: 0.85rem; font-weight: 700; margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.chip {
  appearance: none; border: 1px solid rgba(255, 255, 255, 0.4); background: rgba(0, 0, 0, 0.2); color: #fff;
  border-radius: 99px; padding: 5px 11px; font: inherit; font-size: 0.82rem; font-weight: 700; cursor: pointer;
}
.chip.on { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.chip:disabled { opacity: 0.4; cursor: not-allowed; }
.chip:focus-visible { outline: 3px solid var(--gold); }

.dice-area { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 22px 14px; margin: 16px 0 8px; }
.dice-row, .hand-row { display: flex; gap: clamp(6px, 2vw, 12px); justify-content: center; }
.hand-area { padding: 6px 10px 8px; border-radius: 12px; background: rgba(0, 0, 0, 0.22); border: 1px dashed rgba(255, 255, 255, 0.35); }
.hand-label { font-size: 0.72rem; font-weight: 800; text-align: center; margin-bottom: 4px; color: #cfe8dc; }

/* サイコロ */
.die {
  --pip: calc(var(--die) * 0.18);
  position: relative;
  width: var(--die);
  height: var(--die);
  flex: 0 0 auto;
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  padding: calc(var(--die) * 0.12);
  border-radius: calc(var(--die) * 0.2);
  background: linear-gradient(145deg, #ffffff, #e9e4d6);
  box-shadow: 0 4px 0 #c9c1ab, 0 8px 14px rgba(0, 0, 0, 0.35);
  border: 0;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  font: inherit;
  color: var(--ink);
}
button.die:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
button.die:disabled { cursor: default; }
.die .pip { width: var(--pip); height: var(--pip); border-radius: 50%; background: var(--ink); place-self: center; visibility: hidden; }
.die .pip.on { visibility: visible; }
.die.v1 .pip.on { background: var(--red); width: calc(var(--pip) * 1.45); height: calc(var(--pip) * 1.45); }
.die.blank .q { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 900; color: #c4bca6; font-size: calc(var(--die) * 0.42); }
.die.held { transform: translateY(-8px); box-shadow: 0 0 0 3px var(--gold), 0 4px 0 #c9a13a, 0 12px 18px rgba(0, 0, 0, 0.4); }
.die .held-label {
  position: absolute; left: 50%; bottom: calc(var(--die) * -0.42); transform: translateX(-50%);
  font-size: 0.62rem; font-weight: 900; letter-spacing: 0.08em; color: var(--gold); white-space: nowrap;
}
.die.joker { background: linear-gradient(145deg, #efe4ff, #cdb6f7); box-shadow: 0 4px 0 #9c7bd8, 0 8px 14px rgba(0, 0, 0, 0.35); }
.die.joker .pip { background: #3b1d78; }
.die.joker.held { box-shadow: 0 0 0 3px var(--gold), 0 4px 0 #9c7bd8, 0 12px 18px rgba(0, 0, 0, 0.4); }
.die .jk-star {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: calc(var(--die) * 0.55); color: var(--joker); text-shadow: 0 1px 0 #fff;
}
.die .jk-mark { position: absolute; top: 2px; right: 4px; font-size: 0.55rem; font-weight: 900; color: var(--joker); }
.die.selected { box-shadow: 0 0 0 3px #7ee0ff, 0 8px 14px rgba(0, 0, 0, 0.35); transform: translateY(-4px); }
.die.flip-target { animation: wobble 0.9s ease-in-out infinite; }
.die.rolling { animation: tumble 0.55s cubic-bezier(0.3, 0.7, 0.4, 1); }
.die.flipped { animation: flip 0.45s ease; }
@keyframes tumble {
  0% { transform: translateY(-26px) rotate(-200deg) scale(0.9); }
  60% { transform: translateY(4px) rotate(12deg) scale(1.03); }
  100% { transform: translateY(0) rotate(0) scale(1); }
}
@keyframes wobble { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes flip { 0% { transform: rotateX(0); } 50% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }

.hint { text-align: center; min-height: 2.8em; margin: 14px 0 8px; font-size: 0.88rem; color: #d8efe4; line-height: 1.45; }
.controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.resources { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.resources .tag { background: rgba(0, 0, 0, 0.25); }

/* トースト */
.toast-layer { position: fixed; left: 0; right: 0; top: 64px; display: grid; justify-items: center; gap: 8px; pointer-events: none; z-index: 50; }
.toast {
  background: rgba(7, 24, 42, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 800;
  box-shadow: var(--shadow);
  animation: toast-in 0.25s ease, toast-out 0.3s ease forwards;
  animation-delay: 0s, var(--life, 1.8s);
  max-width: calc(100vw - 32px);
  text-align: center;
}
.toast.big { font-size: 1.4rem; padding: 14px 26px; background: linear-gradient(180deg, #f6c64f, #d99a18); color: var(--ink); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px) scale(0.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-10px); } }

/* モーダル */
.modal-layer { position: fixed; inset: 0; background: rgba(3, 10, 20, 0.66); display: grid; place-items: center; padding: 16px; z-index: 60; backdrop-filter: blur(3px); }
.modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  background: var(--paper);
  color: var(--ink);
  border-radius: 18px;
  padding: 22px 20px;
  box-shadow: var(--shadow);
  animation: modal-in 0.25s ease;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
.modal h2 { margin: 0 0 8px; }
.modal h3 { margin: 18px 0 6px; font-size: 1rem; }
.modal p, .modal li { line-height: 1.6; }
.modal .actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.modal .btn.secondary, .modal .btn.ghost { color: var(--ink); border-color: rgba(0, 0, 0, 0.2); background: transparent; }
.modal table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.modal th, .modal td { border-bottom: 1px solid var(--paper-2); padding: 5px 4px; text-align: left; vertical-align: top; }
.center { text-align: center; }
.result-title { font-size: 2rem; font-weight: 900; text-align: center; margin: 4px 0 10px; }
.result-scores { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.result-scores .box { border-radius: 12px; padding: 12px; text-align: center; background: var(--paper-2); }
.result-scores .box.win { background: #fff3cf; box-shadow: 0 0 0 3px var(--gold); }
.result-scores .n { font-weight: 800; }
.result-scores .s { font-size: 2rem; font-weight: 900; }
.order-big { font-size: 1.6rem; font-weight: 900; text-align: center; margin: 12px 0; }
.rule-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rule-summary .box { background: var(--paper-2); border-radius: 12px; padding: 10px 12px; }
.rule-summary ul { margin: 6px 0 0; padding-left: 1.1em; }

/* 狭い画面: ダイストレイを画面下部に固定し、スコア表をスクロールしながら操作できるようにする */
@media (max-width: 879px) and (min-height: 600px) and (orientation: portrait) {
  :root { --die: clamp(42px, 12vw, 58px); }
  .tray { position: sticky; bottom: max(6px, env(safe-area-inset-bottom)); z-index: 5; padding: 8px 10px 10px; border-width: 4px; }
  .dice-area { margin: 8px 0 4px; gap: 18px 10px; }
  .hint { min-height: 0; margin: 6px 0; font-size: 0.78rem; }
  .controls { flex-wrap: nowrap; }
  .controls .btn.big { min-width: 0; flex: 1 1 auto; padding: 0.75em 1em; font-size: 1rem; }
  .controls .btn.secondary { flex: 0 1 auto; font-size: 0.85rem; padding: 0.6em 0.9em; }
  .resources { display: none; }
  .bet-panel .label { font-size: 0.75rem; margin-bottom: 4px; }
  .chip { padding: 4px 9px; font-size: 0.75rem; }
  .game-title { font-size: 0.85rem; }
}

@media (max-width: 520px) {
  .scorecard .cat small { display: none; }
  .scorecard th, .scorecard td { height: 33px; }
  .player .you { margin-left: 6px; font-size: 0.62rem; font-weight: 800; padding: 1px 6px; border-radius: 99px; background: var(--pc); color: #fff; vertical-align: 2px; }
.player .total { font-size: 1.35rem; }
  .btn.big { min-width: 0; }
  .game-header .btn-text { display: none; }
  .players { gap: 6px; }
  .player { padding: 8px 9px; }
  .tag { font-size: 0.64rem; padding: 1px 6px; }
  .rule-summary { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
.modal .rule-card.checked::before { content: "✓"; color: #fff; font-weight: 900; font-size: 15px; line-height: 18px; text-align: center; box-shadow: none; }

/* 設定画面 */
.settings { display: grid; gap: 16px; margin: 8px 0; }
.setting-label { font-weight: 800; margin-bottom: 6px; }
.vol-steps { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.vol-step {
  appearance: none; font: inherit; font-weight: 800; padding: 10px 0; border-radius: 10px; cursor: pointer;
  border: 2px solid #1b2430; background: #fff; color: #1b2430; transition: background 0.12s, color 0.12s;
}
.vol-step.lit { background: #cdeed9; }
.vol-step.on { background: #1f6b4f; color: #fff; border-color: #1f6b4f; }
.vol-step:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.setting-note { font-size: 0.8rem; color: var(--ink-soft); }

/* =====================================================================
   v4: 選択画面のボタン（白地・黒の太枠）
   ===================================================================== */
.screen .menu-item {
  background: #fff;
  color: #111;
  border: 3px solid #111;
  box-shadow: 0 4px 0 #111;
  transition: transform 0.08s, box-shadow 0.08s, background 0.15s;
}
.screen .menu-item:hover { background: #fffbe8; border-color: #111; }
.screen .menu-item:active { transform: translateY(3px); box-shadow: 0 1px 0 #111; }
.screen .menu-item .t { color: #111; }
.screen .menu-item .d { color: #333; }
.screen .btn.ghost,
.screen .btn.secondary {
  background: #fff;
  color: #111;
  border: 3px solid #111;
  box-shadow: 0 3px 0 #111;
}
.screen .btn.ghost:active,
.screen .btn.secondary:active { transform: translateY(2px); box-shadow: 0 1px 0 #111; }
.screen .btn.primary { border: 3px solid #111; box-shadow: 0 3px 0 #111; }
.screen .rule-card { background: #fff; color: #111; border: 3px solid #111; }
.screen .rule-card .t, .screen .rule-card .d { color: #111; }
.screen .rule-card::before { border-color: #111; background: #fff; }
.screen .rule-card.checked { background: #fff4d1; border-color: #111; box-shadow: 0 0 0 3px var(--gold); }
.screen .rule-card.checked::before { background: #111; border-color: #111; content: "✓"; color: #fff; font-weight: 900; font-size: 15px; line-height: 18px; text-align: center; box-shadow: none; }
.screen .field input { background: #fff; color: #111; border: 3px solid #111; }
.screen h2, .screen .lead, .screen .field label { text-shadow: 0 2px 6px rgba(0, 0, 0, 0.55); }

.confirm-table th { width: 32%; color: var(--ink-soft); font-weight: 700; }
.confirm-table td { font-weight: 800; }

/* =====================================================================
   v4: スコア表を長方形の紙に
   ===================================================================== */
.scorecard-wrap.card {
  border-radius: 3px;
  padding: 14px 12px 16px;
  background-color: #fffdf4;
  background-image:
    radial-gradient(circle at 20% 10%, rgba(255, 255, 255, 0.9), transparent 45%),
    radial-gradient(circle at 80% 90%, rgba(214, 196, 150, 0.18), transparent 50%),
    repeating-linear-gradient(0deg, rgba(120, 100, 60, 0.025) 0 2px, transparent 2px 4px);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15), 0 12px 28px rgba(0, 0, 0, 0.45), inset 0 0 40px rgba(190, 170, 120, 0.18);
  position: relative;
}
/* 上端のミシン目 */
.scorecard-wrap.card::before {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  top: 5px;
  border-top: 2px dashed rgba(120, 100, 60, 0.25);
}
.scorecard caption {
  caption-side: top;
  text-align: center;
  font-family: Georgia, "Times New Roman", "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-weight: 700;
  letter-spacing: 0.35em;
  font-size: 1rem;
  color: #3a3226;
  padding: 4px 0 8px;
  border-bottom: 3px double #3a3226;
  margin-bottom: 2px;
}
.scorecard caption span { display: block; font-size: 0.62rem; letter-spacing: 0.3em; color: #8a7d66; font-weight: 400; }
.scorecard th, .scorecard td { border-bottom: 1px solid rgba(80, 110, 160, 0.22); }
.scorecard td.p0, .scorecard td.p1, .scorecard th.pcol { border-left: 1px solid rgba(58, 50, 38, 0.25); }
.scorecard .sum td, .scorecard .sum th { background: rgba(214, 196, 150, 0.22); }
.scorecard .total td, .scorecard .total th {
  background: transparent;
  color: #1b1b1b;
  border-top: 3px double #3a3226;
  border-bottom: 0;
  font-size: 1.2rem;
}
.scorecard .total th { border-radius: 0; }
.scorecard .filled { font-family: Georgia, "Yu Mincho", "Hiragino Mincho ProN", serif; font-size: 1.15rem; color: #1f2a44; }
.scorecard td.cur { background: rgba(61, 139, 253, 0.06); }

/* ヨットが入力できるときは金色 */
.preview.gold {
  color: #5a3b00;
  background: linear-gradient(180deg, #ffe79a, #f2b929);
  border: 2px solid #b8860b;
  box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.35), 0 0 14px rgba(255, 200, 0, 0.75);
  animation: gold-pulse 1.1s ease-in-out infinite;
}
.preview.gold:hover:not(:disabled) { background: linear-gradient(180deg, #fff0b8, #f5c542); border-color: #8b6508; }
@keyframes gold-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.35), 0 0 8px rgba(255, 200, 0, 0.5); }
  50% { box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.55), 0 0 20px rgba(255, 200, 0, 0.95); }
}

/* =====================================================================
   v4: 画面中央の演出（先攻・後攻 / 役成立）
   ===================================================================== */
.fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 55; display: grid; place-items: center; }
.fx-layer > * { grid-area: 1 / 1; }

.order-intro { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, 0.35); pointer-events: auto; animation: fade-in 0.2s ease; }
.oi-band {
  width: 100%;
  padding: 26px 16px 22px;
  text-align: center;
  background: linear-gradient(90deg, transparent, rgba(8, 20, 34, 0.94) 12%, rgba(8, 20, 34, 0.94) 88%, transparent);
  border-top: 3px solid var(--gold);
  border-bottom: 3px solid var(--gold);
  animation: band-in 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.oi-label { font-weight: 800; color: #cfe0f2; letter-spacing: 0.2em; }
.oi-word {
  font-size: clamp(3rem, 16vw, 6.5rem);
  font-weight: 900;
  line-height: 1.15;
  color: #fff;
  letter-spacing: 0.1em;
  min-height: 1.15em;
  text-shadow: 0 0 18px rgba(120, 180, 255, 0.8);
}
.oi-word.alt { color: #ffd0c4; text-shadow: 0 0 18px rgba(255, 120, 90, 0.8); }
.oi-sub { min-height: 1.4em; font-weight: 800; color: var(--gold); font-size: 1.05rem; }
.oi-band.decided .oi-word { animation: decide-pop 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.4); color: #ffe27a; text-shadow: 0 0 24px rgba(255, 200, 40, 0.95); }
.oi-band.decided.is-second .oi-word { color: #ffd0c4; text-shadow: 0 0 24px rgba(255, 120, 90, 0.95); }
.oi-band.leave { animation: band-out 0.35s ease forwards; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes band-in { from { transform: scaleY(0); opacity: 0; } }
@keyframes band-out { to { transform: scaleY(0); opacity: 0; } }
@keyframes decide-pop { 0% { transform: scale(1.8); opacity: 0.3; } 100% { transform: scale(1); opacity: 1; } }

.combo-fx { width: 100%; }
.cf-band {
  text-align: center;
  padding: 16px 16px 14px;
  background: linear-gradient(90deg, transparent, rgba(10, 60, 40, 0.92) 15%, rgba(10, 60, 40, 0.92) 85%, transparent);
  border-top: 2px solid rgba(255, 255, 255, 0.6);
  border-bottom: 2px solid rgba(255, 255, 255, 0.6);
  animation: combo 1.7s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}
.cf-who { font-weight: 800; color: #cfe8dc; font-size: 0.95rem; }
.cf-name { font-size: clamp(2.2rem, 11vw, 4.4rem); font-weight: 900; color: #fff; line-height: 1.15; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35), 0 0 22px rgba(120, 255, 190, 0.7); }
.cf-score { font-size: clamp(1.6rem, 7vw, 2.6rem); font-weight: 900; color: #ffe27a; text-shadow: 0 0 14px rgba(255, 200, 40, 0.8); }
.cf-note { font-size: 0.85rem; font-weight: 800; color: #ffb3a6; }
.combo-fx.yacht .cf-band {
  background: linear-gradient(90deg, transparent, rgba(90, 60, 0, 0.94) 12%, rgba(120, 80, 0, 0.94) 50%, rgba(90, 60, 0, 0.94) 88%, transparent);
  border-color: #ffd54a;
  animation-duration: 2.3s;
}
.combo-fx.yacht .cf-name { color: #ffe27a; font-size: clamp(3rem, 15vw, 6rem); text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35), 0 0 30px rgba(255, 210, 60, 1); letter-spacing: 0.12em; }
@keyframes combo {
  0% { transform: scale(1.6) ; opacity: 0; }
  12% { transform: scale(0.96); opacity: 1; }
  18% { transform: scale(1); }
  82% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.04); opacity: 0; }
}

/* =====================================================================
   v5: 対戦中のボタン（白地・黒の太枠）
   ===================================================================== */
#game .btn,
#game .btn.ghost,
#game .btn.secondary,
#game .btn.primary {
  background: #fff;
  color: #111;
  border: 3px solid #111;
  box-shadow: 0 3px 0 #111;
  text-shadow: none;
}
#game .btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #111; }
#game .btn:disabled { opacity: 0.5; box-shadow: 0 3px 0 #111; }
#game .btn.secondary.active { background: var(--gold); }
#game .chip { background: #fff; color: #111; border: 2px solid #111; }
#game .chip.on { background: var(--gold); color: #111; }
.board { margin-top: 10px; }

/* =====================================================================
   v5: 得点表の名前欄（適用ルール・手番の光る枠）
   ===================================================================== */
.scorecard thead th.pcol { vertical-align: top; padding: 4px 2px 6px; height: auto; border-radius: 6px; }
.scorecard .pname { font-size: 0.85rem; font-weight: 800; line-height: 1.25; }
.scorecard .pname .you { margin-left: 4px; font-size: 0.6rem; padding: 1px 5px; border-radius: 99px; background: #1b2430; color: #fff; vertical-align: 1px; }
.scorecard .ptags { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; margin-top: 3px; }
.scorecard .ptags .tag { background: #f3e7c2; color: #4a3a12; border: 1px solid #c9b27a; font-size: 0.6rem; padding: 0 5px; }
.scorecard thead th.my-turn {
  box-shadow: inset 0 0 0 3px currentColor;
  background: rgba(255, 255, 255, 0.7);
  animation: turn-glow 1.3s ease-in-out infinite;
}
.scorecard thead th.p0.my-turn { --glow: 61, 139, 253; }
.scorecard thead th.p1.my-turn { --glow: 232, 105, 59; }
@keyframes turn-glow {
  0%, 100% { box-shadow: inset 0 0 0 3px currentColor, 0 0 6px rgba(var(--glow), 0.45); }
  50% { box-shadow: inset 0 0 0 3px currentColor, 0 0 18px rgba(var(--glow), 0.95); }
}

/* 下段（チョイス除く）の役を入力できる枠を光らせる */
.preview.combo {
  color: #0b5a45;
  background: #e3fff6;
  border: 2px solid #1fae86;
  animation: combo-pulse 1.2s ease-in-out infinite;
}
@keyframes combo-pulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(31, 174, 134, 0.3), 0 0 5px rgba(31, 214, 160, 0.4); }
  50% { box-shadow: 0 0 0 2px rgba(31, 174, 134, 0.5), 0 0 16px rgba(31, 214, 160, 0.95); }
}

/* 光る演出 OFF: 枠と色は残し、発光と点滅だけ止める */
body.no-glow .preview.gold,
body.no-glow .preview.combo,
body.no-glow .scorecard thead th.my-turn { animation: none; }
body.no-glow .preview.gold,
body.no-glow .preview.combo { box-shadow: none; }
body.no-glow .scorecard thead th.my-turn { box-shadow: inset 0 0 0 3px currentColor; }

/* ボーナス獲得演出 */
.combo-fx.bonus .cf-band {
  background: linear-gradient(90deg, transparent, rgba(30, 40, 110, 0.94) 12%, rgba(60, 50, 140, 0.94) 50%, rgba(30, 40, 110, 0.94) 88%, transparent);
  border-color: #9fb4ff;
}
.combo-fx.bonus .cf-name { color: #dfe6ff; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35), 0 0 24px rgba(140, 160, 255, 0.95); }

/* 設定: ON/OFF */
.toggle-steps { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.toggle-step {
  appearance: none; font: inherit; font-weight: 800; padding: 10px 0; border-radius: 10px; cursor: pointer;
  border: 2px solid #1b2430; background: #fff; color: #1b2430;
}
.toggle-step.on { background: #1f6b4f; color: #fff; border-color: #1f6b4f; }
.toggle-step:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* =====================================================================
   v7: スマホ — ダイストレイはプレイヤー欄の下に通常配置。得点表はシートボタンで開閉
   ===================================================================== */
.sheet-toggle { display: none; }
.board { margin-top: 0; }

@media (max-width: 879px) and (orientation: portrait) {
  /* 以前の「画面下に追従」指定を打ち消して通常の流れに置く */
  #game .tray { position: static; margin: 0; }
  #game { padding-bottom: 96px; }

  /* 得点表は通常は隠し、シートを開いたときだけダイストレイの下にオーバーレイ表示 */
  #game .scorecard-wrap { display: none; }
  #game.sheet-open .scorecard-wrap {
    display: block;
    position: fixed;
    top: var(--sheet-top, 64px);
    left: 8px;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 30;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: 96px; /* 左下／右下のシートボタンに最終行が隠れないように */
    animation: sheet-in 0.24s cubic-bezier(0.2, 0.9, 0.3, 1);
  }
  @keyframes sheet-in { from { transform: translateY(28px); opacity: 0; } }

  /* 常時表示: ダイス部分の下に得点表を通常配置し、シートボタンは出さない */
  body.sheet-always #game .tray { order: -1; }
  body.sheet-always #game .scorecard-wrap { display: block; position: static; animation: none; padding-bottom: 16px; }
  body.sheet-always .sheet-toggle { display: none; }
  body.sheet-always #game { padding-bottom: 16px; }

  .sheet-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    left: 0;
    bottom: calc(max(8px, env(safe-area-inset-bottom)) + 12px);
    z-index: 40;
    padding: 14px 8px;
    border: 3px solid #111;
    border-left: 0;
    border-radius: 0 14px 14px 0;
    background: #fff;
    color: #111;
    font: inherit;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 3px 3px 0 #111;
  }
  body.sheet-right .sheet-toggle {
    left: auto;
    right: 0;
    border-left: 3px solid #111;
    border-right: 0;
    border-radius: 14px 0 0 14px;
    box-shadow: -3px 3px 0 #111;
  }
  .sheet-toggle .st-label { writing-mode: vertical-rl; letter-spacing: 0.15em; font-size: 0.9rem; }
  .sheet-toggle:active { transform: translateY(1px); }
  .sheet-toggle:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
  #game.sheet-open .sheet-toggle { background: var(--gold); }
  .sheet-toggle.attn { animation: sheet-attn 1.1s ease-in-out infinite; }
  body.no-glow .sheet-toggle.attn { animation: none; background: #fff4c2; }
}
@keyframes sheet-attn {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(255, 200, 40, 0)); }
  50% { filter: drop-shadow(0 0 10px rgba(255, 200, 40, 0.95)); }
}
@media (max-width: 879px) and (orientation: portrait) {
  /* ダイストレイが上部にあるため、通知は空いている画面中ほどに出す */
  .toast-layer { top: 48vh; }
}

/* 設定: 操作不可の行（グレー表示） */
.setting-row.disabled { opacity: 0.4; }
.setting-row.disabled .toggle-step { cursor: not-allowed; background: #e6e6e6; color: #777; border-color: #999; }
.setting-row.disabled .toggle-step.on { background: #9a9a9a; color: #fff; border-color: #9a9a9a; }

/* =====================================================================
   v9: モーダル（設定・確認など）の黒太枠とボタン配色の統一
   ===================================================================== */
.modal { border: 4px solid #111; }
.modal .btn,
.modal .btn.primary,
.modal .btn.ghost,
.modal .btn.secondary,
.screen .btn.primary {
  background: #fff;
  color: #111;
  border: 3px solid #111;
  box-shadow: 0 3px 0 #111;
  text-shadow: none;
}
.modal .btn:active:not(:disabled),
.screen .btn.primary:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #111; }
.modal .btn:disabled { opacity: 0.45; }
/* 主要な操作ボタン（ダイスを振る・振り直す・やめる・対戦開始・ゲーム開始・閉じる）は薄い赤 */
.btn.soft-red,
.modal .btn.soft-red,
.screen .btn.soft-red,
#game .btn.soft-red { background: #ffd9d3; color: #111; border: 3px solid #111; }
.btn.soft-red:hover:not(:disabled),
#game .btn.soft-red:hover:not(:disabled) { background: #ffc9c0; filter: none; }

/* 設定: デフォルトネーム */
.name-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: stretch; }
.name-input {
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.55em 0.75em;
  border: 3px solid #111;
  border-radius: 10px;
  background: #fff;
  color: #111;
  min-width: 0;
}
.name-input:focus { outline: 3px solid var(--gold); outline-offset: 1px; }
.name-dice {
  aspect-ratio: 1 / 1;
  width: 48px;
  font: inherit;
  font-size: 1.4rem;
  font-weight: 900;
  border: 3px solid #111;
  border-radius: 10px;
  background: #fff;
  color: #111;
  cursor: pointer;
  box-shadow: 0 3px 0 #111;
}
.name-dice:active { transform: translateY(2px); box-shadow: 0 1px 0 #111; }
.name-dice:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* =====================================================================
   v9: スマホ縦画面 — ダイス部分の各要素に余白を持たせる
   ===================================================================== */
@media (max-width: 879px) and (orientation: portrait) {
  #game .tray { padding: 14px 12px 16px; }
  .turn-banner { margin-bottom: 4px; }
  .bet-panel { margin: 10px 0 4px; }
  .bet-panel .label { margin-bottom: 8px; line-height: 1.5; }
  .chips { gap: 8px; }
  .dice-area { margin: 16px 0 10px; gap: 24px 10px; }
  .hint { margin: 14px 6px 14px; font-size: 0.86rem; line-height: 1.6; min-height: 0; }
  .controls { gap: 10px; }
  .players { margin: 10px 0 12px; }
}

/* =====================================================================
   v9: スマホ横画面 — 幅を抑え、ボタン類を画面内に収める
   ===================================================================== */
@media (orientation: landscape) and (max-height: 520px) {
  :root { --die: 46px; }
  .game { max-width: 760px; padding-top: 6px; }
  .game-header .btn.small { padding: 0.35em 0.8em; font-size: 0.8rem; }
  .players { margin: 6px 0; }
  .player { padding: 6px 10px; }
  .player .total { font-size: 1.25rem; }
  .board { gap: 10px; }
  .tray { padding: 10px; top: 6px; }
  .dice-area { margin: 8px 0 6px; gap: 16px 8px; }
  .hint { min-height: 0; margin: 8px 0; font-size: 0.8rem; }
  .btn.big { padding: 0.65em 1.4em; font-size: 1rem; min-width: 0; }
  .resources { margin-top: 6px; }
  .scorecard th, .scorecard td { height: 30px; }
  .scorecard .cat small { display: none; }
  .scorecard caption { padding: 2px 0 4px; }

  /* タイトル・選択画面 */
  .screen { max-width: 760px; padding-top: 10px; padding-bottom: 16px; }
  .logo { margin: 4px 0 4px; }
  .logo-dice { margin: 4px 0 0; }
  .logo-dice .die { --die: 30px; }
  .logo h1 { font-size: 2.2rem; }
  .logo .sub { font-size: 0.7rem; }
  .screen h2 { margin: 4px 0 2px; font-size: 1.2rem; }
  .screen .lead { margin-bottom: 8px; }
  .menu { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 8px; }
  .menu-item { padding: 10px 14px; }
  .menu-item .t { font-size: 1.02rem; }
  .menu-item .d { font-size: 0.78rem; margin-top: 2px; }
  .nav-row { margin-top: 12px; }
  .rule-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
  .rule-card { padding: 10px 10px 10px 44px; }
  .rule-card::before { top: 12px; }
  .rule-card .d { font-size: 0.78rem; }
  .field { margin: 8px 0; }
  .waiting { padding: 8px 0; }

  /* モーダル */
  .modal { max-height: calc(100dvh - 16px); padding: 14px 16px; }
  .modal-layer { padding: 8px; }
  .order-intro .oi-band { padding: 12px 16px; }
  .oi-word { font-size: 4rem; }
}

/* =====================================================================
   v10: ルーム（ルーム名・公開設定・ロビー）と「知らない人と遊ぶ」の持ち時間
   ===================================================================== */
.field-label { font-weight: 700; font-size: 0.92rem; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.55); }
.visibility { max-width: 360px; }
.room-name-label { font-size: 0.85rem; color: #cfe0f2; margin-top: 6px; }
.room-name { font-size: 1.5rem; font-weight: 900; margin: 2px 0 10px; word-break: break-all; }
.help-dark { font-size: 0.85rem; color: var(--ink-soft); }
.stranger-rules { font-size: 0.82rem; background: rgba(0, 0, 0, 0.35); border-radius: 10px; padding: 8px 12px; }
.lobby-list .lobby-room .t { font-size: 1.1rem; }
.lobby-list .lobby-room .d { margin-top: 2px; }
.lobby-empty { background: rgba(0, 0, 0, 0.3); border-radius: 12px; padding: 14px; }
.forfeit-note { font-weight: 800; color: var(--red); }

.turn-timer { display: flex; align-items: center; gap: 10px; margin: 6px auto 0; max-width: 420px; }
.turn-timer .tt-bar { flex: 1; height: 8px; border-radius: 99px; background: rgba(0, 0, 0, 0.35); overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.3); }
.turn-timer .tt-bar span { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #7ee0a0, #ffe27a); transition: width 0.2s linear; }
.turn-timer .tt-text { font-size: 0.8rem; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.turn-timer.danger .tt-bar span { background: linear-gradient(90deg, #ff8a7a, #ff4d3a); }
.turn-timer.danger .tt-text { color: #ffb3a6; }

/* =====================================================================
   v11: 役を構成するダイスの発光（光る演出 OFF で非表示）
   ===================================================================== */
.die.combo-glow::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: calc(var(--die) * 0.26);
  border: 3px solid #37e3a6;
  box-shadow: 0 0 10px rgba(55, 227, 166, 0.9), inset 0 0 6px rgba(55, 227, 166, 0.6);
  pointer-events: none;
  animation: die-glow 1.1s ease-in-out infinite;
}
.die.combo-glow.gold::after {
  border-color: #ffd23f;
  box-shadow: 0 0 14px rgba(255, 210, 63, 1), inset 0 0 8px rgba(255, 210, 63, 0.7);
}
@keyframes die-glow {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.04); }
}
body.no-glow .die.combo-glow::after { display: none; }

/* 1 人プレイ */
.players.solo { grid-template-columns: 1fr; }
.result-scores.solo { grid-template-columns: 1fr; max-width: 280px; margin-left: auto; margin-right: auto; }

/* ルーム待機中の共有ボタン */
.share-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 6px 0 4px; }
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.6em 1.3em;
  border: 3px solid #111;
  border-radius: 999px;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 3px 0 #111;
}
.share-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #111; }
.share-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.share-x { background: #000; color: #fff; }
.share-line { background: #06c755; color: #fff; }

/* =====================================================================
   v12: スクロールバー非表示（スクロール自体は可能）と拡大防止
   ===================================================================== */
html,
body,
* {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* 旧 Edge */
}
*::-webkit-scrollbar { display: none; width: 0; height: 0; }

html,
body {
  touch-action: manipulation; /* ダブルタップ拡大を無効化（タップの遅延もなくなる） */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
button,
a,
.die,
.menu-item,
.rule-card,
.preview,
.chip { touch-action: manipulation; -webkit-user-select: none; user-select: none; }
