/* ==========================================================
   セキララブラックジャック Webアプリ
   ========================================================== */

:root {
  color-scheme: dark;
  --bg: #1c0720;
  --bg-2: #2e0d33;
  --pink: #e6317f;
  --pink-deep: #b81a62;
  --pink-light: #ff7ab3;
  --yellow: #ffe600;
  --ink: #1a1a1a;
  --white: #ffffff;
  --muted: rgba(255, 255, 255, .72);
  --line: rgba(255, 255, 255, .18);
  --radius: 16px;
  --app-w: 480px;
  --gutter: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --dock-h: 0px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--white);
  position: relative;
  background-color: var(--bg);
  background-image:
    radial-gradient(120% 60% at 50% 100%, rgba(230, 49, 127, .28) 0%, rgba(230, 49, 127, 0) 70%);
  background-attachment: fixed;
  font-family: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic", sans-serif;
  font-weight: 700;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

/* 上部のカジノ背景（下に向かってフェード） */
body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: -1;
  width: min(100%, 720px);
  aspect-ratio: 570 / 370;
  background: url("../assets/bg-top.jpg") center top / cover no-repeat;
  -webkit-mask-image: linear-gradient(180deg, #000 35%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 35%, transparent 100%);
  opacity: .85;
}

img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.app {
  width: 100%;
  max-width: var(--app-w);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  padding: calc(var(--safe-t) + 8px) var(--gutter) max(calc(var(--dock-h) + 16px), calc(var(--safe-b) + 16px));
}

/* ---------- ヘッダー ---------- */
.app-header {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 8px;
  min-height: 44px;
}
/* 言語切り替え：押せるボタン（ルールボタンより控えめ） */
.lang-btn {
  min-height: 40px;
  min-width: 52px;
  padding: 0 12px;
  border-radius: 999px;
  border: 2px solid var(--white);
  background: rgba(28, 7, 32, .65);
  color: var(--white);
  font-weight: 900;
  font-size: 14px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .5);
  cursor: pointer;
  touch-action: manipulation;
}
.lang-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, .5); }

/* 裏コマンドの対象（ロゴ）は長押しメニューや選択を出さない */
/* 裏コマンドのタップ範囲：ダブルタップでの画面拡大が先に反応しないようにする */
html { touch-action: manipulation; }
.secret-hit {
  padding: 14px 28px;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.brand-logo { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; pointer-events: none; }
.sekirara-badge {
  align-self: center;
  margin: 4px 0 0;
  padding: 4px 14px;
  border-radius: 999px;
  background: rgba(230, 49, 127, .25);
  border: 1px solid var(--pink-light);
  color: var(--white);
  font-size: 13px;
  font-weight: 800;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-b) + 90px);
  transform: translateX(-50%);
  z-index: 50;
  margin: 0;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .85);
  color: var(--white);
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
  pointer-events: none;
}
.toast.is-show { animation: toast-in .25s ease; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* 英語版：カード画像の日本語「今回の目標ナンバーは…」の上に英語を重ねる（英語素材ができるまでの仮） */
.target-caption {
  display: none;
  position: absolute;
  top: 7%;
  left: 7%;
  right: 7%;
  height: 17%;
  margin: 0;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(46, 13, 51, .96);
  color: var(--white);
  font-size: 6.4cqw;
  font-weight: 900;
  text-shadow: 0 2px 0 var(--ink);
  white-space: nowrap;
}
html[lang="en"] .target-caption { display: flex; }
.rules-btn {
  /* 押せるボタン：立体の影＋アイコンでボタンとわかるように */
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--white);
  color: var(--ink);
  font-weight: 900;
  font-size: 15px;
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
  touch-action: manipulation;
}
.rules-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.rules-btn-icon { font-size: 16px; line-height: 1; }

.main { flex: 1; display: flex; flex-direction: column; }
section[data-screen] { flex: 1; display: flex; flex-direction: column; animation: fade-in .25s ease; }

@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- ボタン ---------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  padding: 12px 20px;
  border-radius: 999px;
  border: 0;
  font-size: clamp(17px, 4.8vw, 20px);
  font-weight: 900;
  letter-spacing: .04em;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .08s ease, filter .15s ease;
}
.btn:active { transform: translateY(2px); }
.btn-primary {
  background: var(--pink);
  color: var(--white);
  border: 3px solid var(--white);
  box-shadow: 0 4px 0 var(--pink-deep), 0 8px 24px rgba(230, 49, 127, .35);
}
.btn-primary:active { box-shadow: 0 2px 0 var(--pink-deep); }
.btn-secondary {
  background: var(--white);
  color: var(--ink);
  border: 3px solid var(--ink);
  box-shadow: 0 4px 0 rgba(0, 0, 0, .45);
}
.btn-text {
  min-height: 44px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.actions { display: flex; flex-direction: column; gap: 12px; margin-top: auto; padding-top: 20px; }

/* 進行ボタンは画面下（得点パネルの上）に常に見えるよう固定 */
.sticky-cta {
  position: sticky;
  bottom: calc(var(--dock-h) + 10px);
  z-index: 10;
  margin-top: auto;
  padding-top: 16px;
}
.sticky-cta::before {
  content: "";
  position: absolute;
  inset: -14px calc(var(--gutter) * -1) -10px;
  background: linear-gradient(180deg, rgba(28, 7, 32, 0) 0, var(--bg) 22px, var(--bg) calc(100% - 12px), rgba(28, 7, 32, 0) 100%);
  z-index: -1;
  pointer-events: none;
}
.guide-cta { margin: 0 0 10px; }
.topic-note {
  margin: 0 0 10px;
  padding: 6px 12px;
  text-align: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, .1);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.6;
  color: var(--muted);
}
.quit-link { margin-top: 8px; }

/* ---------- スタート ---------- */
.hero { padding: 6vh 0 28px; text-align: center; }
.hero-logo { width: min(92%, 420px); margin: 0 auto; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .5)); }
.hero-catch {
  margin: 20px 0 0;
  font-size: clamp(18px, 5.4vw, 24px);
  font-weight: 900;
  line-height: 1.55;
  text-shadow: 0 2px 0 var(--pink-deep), 0 0 12px rgba(0, 0, 0, .6);
}
.hero-catch .hl { color: var(--yellow); }
[data-screen="start"] .actions { margin-top: 0; }
.brand-footer { margin-top: auto; padding-top: 40px; display: flex; justify-content: center; }
.brand-logo { height: 56px; width: auto; opacity: .9; filter: invert(1); }

/* ---------- 見出し・フォーム ---------- */
.screen-title {
  margin: 8px 0 20px;
  text-align: center;
  font-size: clamp(22px, 6vw, 26px);
  font-weight: 900;
}
.field { margin-bottom: 20px; }
.field-label { margin: 0 0 10px; font-size: 16px; font-weight: 800; }
.hint { margin: 8px 0 0; font-size: 13px; font-weight: 500; color: var(--muted); }

.player-count { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.count-btn {
  min-height: 52px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: rgba(255, 255, 255, .08);
  font-size: 20px;
  font-weight: 900;
  cursor: pointer;
}
.count-btn[aria-checked="true"] { background: var(--pink); border-color: var(--white); }

.player-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.player-row { display: flex; align-items: center; gap: 10px; }
.player-num {
  flex: 0 0 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--white);
  color: var(--pink);
  font-weight: 900;
}
.text-input {
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 50px;
  padding: 0 14px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-size: 16px; /* iOSのズーム防止 */
}
.text-input:focus { outline: none; border-color: var(--pink); }

/* ---------- ラウンド表示 ---------- */
.round-badge {
  /* ただの表示（押せない）：枠・影なしの控えめなラベル */
  position: absolute;
  top: calc(var(--safe-t) + 16px);
  left: var(--gutter);
  margin: 0;
  padding: 3px 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, .45);
  color: var(--white);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .04em;
  pointer-events: none;
}
[data-screen="topics"], [data-screen="target"] { padding-top: 4px; }
[data-screen="topics"] .topic-list { padding-top: 8px; gap: 14px; }
.guide {
  margin: 18px 0 0;
  text-align: center;
  font-size: clamp(15px, 4.4vw, 18px);
  font-weight: 900;
  line-height: 1.6;
  text-shadow: 0 2px 6px rgba(0, 0, 0, .6);
}

/* ---------- お題カード ----------
   3つのお題が1画面に収まることを最優先：引き直しボタンは横に置き、
   はみ出す時は --topic-scale で文字を少しずつ小さくする（app.js fitTopicsScreen） */
.topic-list { --topic-scale: 1; list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.topic-card {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 8px;
  border-radius: var(--radius);
  background: var(--bg-2) url("../assets/card-texture.jpg") center / cover;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
}
.topic-label {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  padding: 1px 14px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--white);
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}
.topic-body {
  flex: 1;
  min-width: 0;
  min-height: 64px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
}
.topic-text {
  margin: 0;
  font-size: calc(clamp(16px, 4.8vw, 20px) * var(--topic-scale));
  font-weight: 900;
  line-height: 1.35;
  word-break: normal;
  overflow-wrap: anywhere;
  line-break: strict;
}
.topic-alt { margin: 2px 0 0; font-size: calc(clamp(13px, 3.8vw, 16px) * var(--topic-scale)); font-weight: 800; line-height: 1.35; color: var(--pink-deep); }
.topic-unit { margin: 0; font-size: calc(clamp(13px, 3.8vw, 15px) * var(--topic-scale)); font-weight: 800; color: #444; }
.topic-redraw {
  flex: 0 0 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  padding: 4px 0;
  border-radius: 12px;
  border: 2px solid var(--white);
  background: rgba(28, 7, 32, .72);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
  touch-action: manipulation;
}
.topic-redraw-icon { font-size: 20px; line-height: 1; }
/* お題1〜3の番号：カードの左上にかぶせて、縦の空間を使わない */
.topic-num {
  position: absolute;
  top: -9px;
  left: 12px;
  z-index: 1;
  padding: 0 10px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--yellow);
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.4;
  white-space: nowrap;
}
.topic-redraw:active { transform: translateY(1px); }
.topic-card.is-new .topic-body { animation: pop .35s ease; }
@keyframes pop { 0% { transform: scale(.94); opacity: .3; } 100% { transform: none; opacity: 1; } }

/* ---------- 目標ナンバー ---------- */
.target-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  container-type: inline-size;
  filter: drop-shadow(0 8px 22px rgba(0, 0, 0, .55));
}
.target-card-img { width: 100%; height: auto; }
/* 白枠の位置：元画像 1076x651 の白い角丸枠に合わせる */
.target-number-box {
  position: absolute;
  left: 9.3%;
  right: 9.4%;
  top: 28.7%;
  bottom: 12.9%;
  display: grid;
  place-items: center;
}
.target-number {
  color: var(--ink);
  font-weight: 900;
  font-size: 32vw;           /* container query 非対応端末向け */
  font-size: 34cqw;
  line-height: 1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
@media (min-width: 480px) { .target-number { font-size: 150px; font-size: 34cqw; } }
.target-card.is-reveal .target-number { animation: reveal .6s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes reveal { 0% { transform: scale(.3); opacity: 0; } 100% { transform: none; opacity: 1; } }

/* 目標ナンバーの下に今回のお題3つ（スクロールなしで収まるようコンパクトに） */
.target-topics {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.target-topic {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
}
.target-topic-label {
  flex: 0 0 auto;
  padding: 1px 8px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.4;
}
.target-topic-text {
  min-width: 0;
  font-size: clamp(14px, 3.9vw, 16px);
  font-weight: 900;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.target-topic-alt { display: block; font-size: .88em; color: var(--pink-deep); }
.target-topic-unit { font-weight: 800; color: #555; white-space: nowrap; }
[data-screen="target"] .sticky-cta { padding-top: 12px; }
[data-screen="target"] .quit-link { margin-top: 4px; min-height: 40px; }

/* ---------- ルール選択 ---------- */
.mode-list { display: flex; flex-direction: column; gap: 14px; }
.mode-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 18px 18px 16px;
  border-radius: var(--radius);
  border: 3px solid var(--white);
  background: var(--bg-2) url("../assets/card-texture.jpg") center / cover;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  position: relative;
  overflow: hidden;
}
.mode-card::before { content: ""; position: absolute; inset: 0; background: rgba(28, 7, 32, .62); }
.mode-card > * { position: relative; }
.mode-card:active { transform: translateY(2px); }
.mode-title { font-size: clamp(19px, 5.4vw, 22px); font-weight: 900; }
.mode-meta {
  align-self: flex-start;
  padding: 1px 12px;
  border-radius: 999px;
  background: var(--pink);
  font-size: 13px;
  font-weight: 800;
}
.mode-desc { font-size: 14px; font-weight: 700; color: var(--muted); line-height: 1.55; }

.quick-result-number {
  margin: 0;
  font-size: clamp(64px, 22vw, 96px);
  font-weight: 900;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.quick-result-rule { margin: 8px 0 0; font-size: 16px; font-weight: 900; line-height: 1.6; }

/* ---------- 結果 ---------- */
.result-card {
  padding: 20px;
  border-radius: var(--radius);
  background: var(--white);
  color: var(--ink);
  text-align: center;
  border: 4px solid var(--pink);
}
.result-label { margin: 0; font-size: 15px; color: var(--pink); font-weight: 900; }
.winner-name { margin: 4px 0 0; font-size: clamp(24px, 7vw, 30px); font-weight: 900; overflow-wrap: anywhere; }
.rank-list { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rank-row {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .1);
}
.rank-row.is-winner { background: rgba(230, 49, 127, .55); }
.rank-pos { font-weight: 900; }
.rank-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-score { font-weight: 900; font-size: 18px; }

/* ---------- 得点パネル ---------- */
.score-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  width: 100%;
  max-width: var(--app-w);
  margin: 0 auto;
  background: #120414;
  border-top: 3px solid var(--pink);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, .5);
  padding-bottom: var(--safe-b);
}
.score-toggle {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  background: transparent;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
}
.score-toggle-arrow { font-size: 12px; color: var(--pink-light); }
.score-panel {
  max-height: min(56vh, 56dvh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 var(--gutter) 14px;
}
.score-legend {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}
.score-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.score-cell { padding: 8px; border-radius: 12px; background: rgba(255, 255, 255, .08); }
.score-name {
  width: 100%;
  min-height: 32px;
  border: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.score-row { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.score-btn {
  flex: 0 0 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--white);
  background: var(--pink);
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}
.score-btn[data-score-action="dec"] { background: transparent; }
.score-btn:disabled { opacity: .3; cursor: default; }
.score-value { flex: 1; text-align: center; font-size: 26px; font-weight: 900; font-variant-numeric: tabular-nums; }
.score-panel .hint { text-align: center; }

/* ---------- ダイアログ ---------- */
.dialog {
  width: min(calc(100% - 32px), 400px);
  padding: 22px 18px 16px;
  border: 0;
  border-radius: 18px;
  background: var(--white);
  color: var(--ink);
}
.dialog::backdrop { background: rgba(10, 2, 12, .7); }
.dialog-message { margin: 0 0 16px; font-size: 16px; font-weight: 800; text-align: center; white-space: pre-line; line-height: 1.6; }
.dialog .text-input { border-color: #ddd; margin-bottom: 14px; }
.dialog-actions { display: flex; flex-direction: column; gap: 10px; }
.dialog-actions .btn { min-height: 50px; font-size: 16px; }
.dialog-actions .btn-text { color: #666; border: 2px solid #ddd; text-decoration: none; border-radius: 999px; }
.dialog-actions .btn-primary { border-color: var(--pink); box-shadow: 0 3px 0 var(--pink-deep); }

/* ---------- ルールダイアログ ---------- */
.rules-dialog {
  width: min(calc(100% - 24px), 560px);
  max-height: calc(100dvh - 32px);
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: #fff;
  color: var(--ink);
  overflow: hidden;
}
@supports (height: 100dvh) { .rules-dialog { max-height: calc(100dvh - 32px); } }
.rules-dialog[open] { display: flex; flex-direction: column; }
.rules-dialog::backdrop { background: rgba(10, 2, 12, .7); }
.rules-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 8px 8px 18px;
  background: var(--pink);
  color: #fff;
}
.rules-title { margin: 0; font-size: 18px; font-weight: 900; }
.rules-close {
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
.rules-tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 2px solid #f0d3e0; }
.rules-tab {
  min-height: 46px;
  border: 0;
  background: #fff;
  color: #888;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
}
.rules-tab.is-active { color: var(--pink); border-bottom-color: var(--pink); }
.rules-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px 16px 24px; font-weight: 500; font-size: 15px; line-height: 1.75; }
.rules-section { margin-bottom: 14px; padding: 14px; border-radius: 12px; background: #fff3f8; border: 1px solid #f6d2e2; }
.rules-section h3 { margin: 0 0 8px; color: var(--pink); font-size: 16px; font-weight: 900; }
.rules-section p { margin: 0 0 8px; }
.rules-section p:last-child { margin-bottom: 0; }
.rules-section ol, .rules-section ul { margin: 0; padding-left: 1.4em; }
.rules-section li { margin-bottom: 4px; }
.rules-section strong { font-weight: 900; }
.rules-section .accent { color: var(--pink); font-weight: 900; }
.rules-box { margin: 8px 0; padding: 10px 12px; border-radius: 10px; background: #fff; border: 2px solid var(--pink); }
.rules-box-title { display: block; margin-bottom: 2px; font-weight: 900; }
.rules-subbox { margin: 8px 0; padding: 8px 10px; border-radius: 8px; background: #fff3f8; border: 1px dashed var(--pink); }
.rules-table { width: 100%; border-collapse: collapse; }
.rules-table td { padding: 6px 4px; border-bottom: 1px dashed #f0c4d6; }
.rules-table td:last-child { text-align: right; font-weight: 900; white-space: nowrap; }
.rules-note { font-size: 13px; color: #666; }
.rules-components { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.rules-component { padding: 8px; border-radius: 10px; background: #fff; border: 1px solid #f0d3e0; text-align: center; }
.rules-component-img { height: 110px; display: grid; place-items: center; margin-bottom: 6px; }
.rules-component-img img { max-height: 110px; width: auto; }
.rules-component-name { font-weight: 900; font-size: 14px; line-height: 1.4; }
.rules-component-count { color: var(--pink); font-weight: 900; font-size: 13px; }
.rules-component-desc { font-size: 12px; line-height: 1.5; color: #555; margin-top: 2px; }
.rules-specials { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0; }
.rules-specials .wide { grid-column: 1 / -1; }
.rules-figure { margin: 10px auto; text-align: center; max-width: 280px; }
.rules-figure.is-small { max-width: 170px; }
.rules-figure.is-app { max-width: 220px; }
.rules-figure.is-app img { border-radius: 14px; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); }
.rules-figure img { width: 100%; height: auto; margin: 0 auto; }
.rules-figure figcaption { margin-top: 4px; font-size: 12px; font-weight: 700; color: #666; line-height: 1.5; }
.rules-specials span { padding: 6px 0; border-radius: 8px; background: #fff; border: 2px solid var(--pink); color: var(--pink); font-weight: 900; text-align: center; font-size: 17px; }

/* ---------- 小さい画面 ---------- */
@media (max-width: 359px) {
  :root { --gutter: 12px; }
  .player-count { gap: 6px; }
  .score-btn { flex-basis: 40px; height: 40px; }
  .score-value { font-size: 22px; }
}
@media (max-height: 640px) {
  .hero { padding-top: 2vh; }
  [data-screen="topics"] .topic-list { gap: 12px; }
  .guide-cta { font-size: 14px; margin-bottom: 8px; }
  .topic-note { font-size: 11px; padding: 4px 8px; margin-bottom: 6px; line-height: 1.45; letter-spacing: -.01em; }
  [data-screen="topics"] .guide-cta { font-size: 13px; line-height: 1.45; margin-bottom: 6px; }
  [data-screen="topics"] .sticky-cta { padding-top: 10px; }
  .topic-body { min-height: 48px; padding: 6px 8px; }
  .topic-card { padding: 6px; }
  .sticky-cta .btn { min-height: 50px; }
  .score-toggle { min-height: 46px; }
  .target-topics { margin-top: 10px; gap: 5px; }
  .target-topic { padding: 5px 10px; }
  .target-topic-label { font-size: 10px; padding: 0 6px; }
  .target-topic-text { font-size: 13px; }
  [data-screen="target"] .sticky-cta { padding-top: 8px; }
  [data-screen="target"] .quit-link { min-height: 36px; margin-top: 2px; }
}

/* ==========================================================
   セキララお題モード：画面全体を濃いネオンピンクに切り替える
   ========================================================== */
html.is-sekirara {
  --bg: #21031a;
  --bg-2: #4a0a3a;
  --pink: #ff2d9b;
  --pink-deep: #a8005c;
  --pink-light: #ff9ad5;
  --yellow: #ffe3f3;
}
html.is-sekirara body {
  background-image:
    radial-gradient(120% 60% at 50% 100%, rgba(255, 45, 155, .5) 0%, rgba(255, 45, 155, 0) 70%),
    radial-gradient(90% 40% at 50% 0%, rgba(255, 90, 200, .3) 0%, rgba(255, 90, 200, 0) 70%);
}
html.is-sekirara body::before { filter: saturate(1.6) brightness(1.05) contrast(1.05); }
html.is-sekirara .hero-logo { animation: pink-glow 1.4s ease-in-out infinite alternate; }
@keyframes pink-glow { from { filter: drop-shadow(0 0 8px rgba(255, 60, 170, .6)) drop-shadow(0 6px 14px rgba(0, 0, 0, .5)); } to { filter: drop-shadow(0 0 24px rgba(255, 120, 210, 1)) drop-shadow(0 6px 14px rgba(0, 0, 0, .5)); } }
html.is-sekirara .topic-card,
html.is-sekirara .mode-card { box-shadow: 0 0 0 2px var(--pink), 0 0 20px rgba(255, 45, 155, .65); }
html.is-sekirara .topic-card,
html.is-sekirara .target-card-img { filter: saturate(1.5) brightness(1.08); }
html.is-sekirara .topic-card .topic-body,
html.is-sekirara .topic-card .topic-num,
html.is-sekirara .topic-card .topic-redraw { filter: saturate(.67) brightness(.93); } /* カード上の白い部分・文字は元の色に戻す */
html.is-sekirara .round-badge { background: var(--pink); }
html.is-sekirara .sekirara-badge {
  padding: 8px 18px;
  font-size: 15px;
  background: linear-gradient(90deg, #ff2d9b, #ff8fd1);
  border: 2px solid var(--white);
  box-shadow: 0 0 18px rgba(255, 45, 155, .85);
  animation: badge-pulse 1.2s ease-in-out infinite;
}
@keyframes badge-pulse { 50% { transform: scale(1.05); } }

/* 切り替えの瞬間の演出 */
.mode-flash {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, rgba(28, 7, 32, .7), rgba(28, 7, 32, .95));
}
.mode-flash.is-on { background: radial-gradient(circle at 50% 55%, rgba(255, 140, 215, .92) 0%, rgba(230, 20, 140, .93) 45%, rgba(33, 3, 26, .97) 100%); }
.mode-flash-text {
  margin: 0;
  color: var(--white);
  font-size: clamp(34px, 11vw, 52px);
  font-weight: 900;
  line-height: 1.25;
  text-align: center;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .6), 0 0 24px rgba(255, 170, 230, .95);
}
.mode-flash.is-play { animation: flash-fade 1.6s ease forwards; }
.mode-flash.is-play .mode-flash-text { animation: flash-pop .6s cubic-bezier(.2, 1.6, .4, 1); }
.mode-flash.is-on.is-play { animation: flash-fade 1.6s ease forwards, flash-shake .4s linear 2; }
@keyframes flash-fade { 0% { opacity: 0; } 12% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }
@keyframes flash-pop { 0% { transform: scale(.3); } 100% { transform: scale(1); } }
@keyframes flash-shake { 0%, 100% { transform: none; } 25% { transform: translate(-6px, 3px); } 50% { transform: translate(5px, -4px); } 75% { transform: translate(-3px, -2px); } }
@media (prefers-reduced-motion: reduce) {
  .mode-flash.is-on.is-play, .mode-flash.is-play .mode-flash-text,
  html.is-sekirara .hero-logo, html.is-sekirara .sekirara-badge { animation-name: flash-fade; }
  html.is-sekirara .hero-logo, html.is-sekirara .sekirara-badge { animation: none; }
}
