/* 競馬G1予想リーグ: スマホ優先・1カラム (最大幅 480px) */

/* 配色はここだけで変更する。白文字を金 (--gold) の背景に載せないこと (読みにくいため。金の上は --on-gold) */
:root {
  --bg: #0d0d0f;            /* 地色 */
  --header-bg: #000000;     /* ヘッダー */
  --surface: #17171a;       /* カードや囲みの背景 */
  --text: #ffffff;          /* 文字 */
  --muted: #a8a8b0;         /* 補足の文字 */
  --border: #2e2e34;        /* 罫線 */
  --gold: #c2a468;          /* 主要ボタン・選択状態の背景、リンク、見出しの下線、副ボタンの枠線と文字 */
  --on-gold: #0d0d0f;       /* 金の背景に載せる文字 */
  --red-fill: #c8102e;      /* 強調の赤 (面で塗る場合。文字は --on-red-fill) */
  --on-red-fill: #ffffff;
  --red-text: #ff5a66;      /* 強調の赤 (黒地の上の文字) */
  --input-bg: #ffffff;      /* 入力欄 */
  --input-text: #0d0d0f;

  --font-heading: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", serif;
  --font-body: "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;

  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.8;
}

.container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px;
}

a {
  color: var(--gold);
}

h1,
h2 {
  font-family: var(--font-heading);
  font-weight: 800;
  line-height: 1.4;
}

h3 {
  font-size: 1rem;
  margin: 20px 0 4px;
}

p {
  margin: 0 0 12px;
}

code {
  font-size: 0.85em;
  word-break: break-all;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="search"],
select,
textarea {
  background: var(--input-bg);
  color: var(--input-text);
  color-scheme: light;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--gold);
  /* 未チェックの枠が暗い地色に埋もれないよう、白地で描画させる */
  color-scheme: light;
}

/* ヘッダー */
.site-header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--gold);
  color: var(--text);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
}

.site-name {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  flex: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  min-width: 0;
}

.site-nav a {
  white-space: nowrap;
  padding: 12px 0;
}

/* ログアウト中だけ出す右上の「Xでログイン」 */
.site-nav a.site-login {
  padding: 8px 14px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  color: var(--gold);
  font-weight: 700;
  text-decoration: none;
}

.site-nav a.site-login:hover,
.site-nav a.site-login:focus-visible {
  background: var(--gold);
  color: var(--header-bg);
}

.site-user {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

main.container {
  padding-top: 24px;
  /* 本文の下端の余白。スマホのブラウザの下部バーに内容が隠れないようにする */
  padding-bottom: 96px;
}

/* フッター */
.site-footer {
  border-top: 1px solid var(--border);
  /* ページの下端に余白を取り、スマホのブラウザの下部バーに内容 (フッターのリンクなど) が隠れないようにする */
  padding: 24px 0 calc(96px + env(safe-area-inset-bottom, 0px));
  font-size: 0.85rem;
  color: var(--muted);
}

.site-footer p {
  margin: 0 0 6px;
}

.footer-links {
  display: flex;
  gap: 20px;
  margin-top: 12px;
}

.footer-links a {
  display: inline-block;
  padding: 10px 0;
}

/* トップの見出し */
.hero {
  text-align: center;
  padding: 16px 0 24px;
}

/* ロゴ: 160px 四方で中央寄せ。画像の四隅の黒地が地色と段差にならないよう円形に切り抜く */
.hero-logo {
  display: block;
  width: 160px;
  height: 160px;
  margin: 0 auto 12px;
  border-radius: 50%;
}

.hero h1 {
  font-size: 2rem;
  margin: 0 0 4px;
}

.hero-season {
  font-family: var(--font-heading);
  font-weight: 800;
  color: var(--red-text);
  margin: 0 0 12px;
}

.hero-lead {
  margin: 0 0 20px;
}

.page-title {
  font-size: 1.5rem;
  margin: 0 0 16px;
}

/* カード */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 16px;
  margin: 0 0 16px;
}

.card h2 {
  font-size: 1.2rem;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gold);
}

.card > :last-child {
  margin-bottom: 0;
}

/* トップの同時開催キャンペーンの告知。面の赤に白文字。赤の上ではリンク色 (金) を使わない */
.campaign-banner {
  position: relative;
  display: block;
  background: var(--red-fill);
  color: var(--on-red-fill);
  border-radius: 8px;
  padding: 20px 16px;
  margin: 0 0 16px;
  text-decoration: none;
}

.campaign-banner p {
  margin: 0 0 8px;
}

/* バナーの右上の企画ロゴ (トップとキャンペーンのページ。images/campaign-logo.png は OGP 画像と同じ光彩付きのロゴで、縁は透過)。「同時開催」・ハッシュタグ・見出しの 1 行目の右の余白に置く。
   ハッシュタグ (0.8rem で幅 約213px、左端は画面の左から 32px) との間を 8px あけるよう、画面幅に合わせて大きさを変える
   (100vw - 294px。390px 以上で 96px)。342px 未満では 48px にして、ハッシュタグの行より上に収める */
.campaign-banner-icon {
  position: absolute;
  top: 12px;
  right: 10px;
  width: clamp(48px, calc(100vw - 294px), 96px);
  height: clamp(48px, calc(100vw - 294px), 96px);
}

/* 「同時開催」の下のハッシュタグ */
.campaign-banner p.campaign-hashtag {
  margin: 6px 0 0;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.campaign-banner > :last-child {
  margin-bottom: 0;
}

.campaign-label {
  display: inline-block;
  border: 1px solid var(--on-red-fill);
  border-radius: 4px;
  padding: 0 8px;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.8;
}

/* 改行は「優勝者を当てて」と「10万円山分けキャンペーン🎉」の間だけ (各 span 内は折り返さないので、絵文字だけが次の行に落ちない)。
   幅 320px でも 2 行目が収まるよう、文字の大きさを画面幅に合わせる。
   明朝体の後ろにカラー絵文字のフォントを並べて、🎉 を白黒の記号ではなく端末の標準の絵文字で表示する */
.campaign-title {
  font-family: var(--font-heading), "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";
  font-size: clamp(1.1rem, 5.8vw, 1.4rem);
  line-height: 1.5;
  margin: 4px 0 12px;
  padding: 0;
  border: 0;
}

.campaign-title span {
  white-space: nowrap;
}

.campaign-period {
  font-weight: 700;
  font-size: 1.05rem;
}

.campaign-note {
  font-size: 0.85rem;
}

/* 締切後の「応募は締め切りました」。赤の面に白の帯で、応募期間の下で目立たせる */
.campaign-banner p.campaign-closed {
  display: inline-block;
  background: var(--on-red-fill);
  color: var(--red-fill);
  border-radius: 4px;
  padding: 2px 10px;
  font-weight: 700;
}

.campaign-more {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.campaign-link:hover,
.campaign-link:focus-visible {
  color: var(--on-red-fill);
  filter: brightness(1.08);
}

.campaign-link:focus-visible {
  outline: 3px solid var(--on-red-fill);
  outline-offset: 2px;
}

/* ---------- 優勝予想キャンペーン (/campaign) ---------- */
.campaign-hero .campaign-lead {
  margin-bottom: 12px;
}

.campaign-steps li + li {
  margin-top: 4px;
}

.campaign-picks {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

/* 参加者は 2 列。幅 360px でも横スクロールが出ないよう、名前とユーザー名は 1 行で省略する */
.campaign-pick-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  list-style: none;
  margin: 0 !important;
  padding: 0 !important;
}

.campaign-pick-list li {
  margin: 0;
  min-width: 0;
}

.campaign-pick {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
}

.campaign-pick.is-selected {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px var(--gold);
}

.campaign-pick-head {
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.4;
}

.campaign-pick-head input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
}

.campaign-pick-body {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.campaign-pick-body img,
.campaign-pick-body .avatar-placeholder {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
}

.campaign-pick-name {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.4;
}

/* 名前は 2 行まで (それ以上は省略)、ユーザー名は 1 行で省略。選んだ人の名前はプレビューで全文を確認できる */
.campaign-pick-name .account-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: normal;
  font-size: 0.85rem;
}

.campaign-pick-name .account-username {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.75rem;
}

/* .button の display: flex より優先して隠す (選ぶまで出さないフォローのリンク) */
.button[hidden] {
  display: none;
}

.campaign-choice {
  margin: 16px 0 8px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

#campaign-follow {
  margin-bottom: 8px;
}

.campaign-preview-title {
  font-size: 1rem;
  margin: 16px 0 8px;
}

/* 投稿のプレビュー。改行をそのまま表示する */
.campaign-preview {
  margin: 0 0 12px;
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.9rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.campaign-preview.is-filled {
  border-style: solid;
  color: var(--text);
}

.campaign-notes li {
  font-size: 0.9rem;
}

.campaign-terms-link {
  text-align: center;
}

.campaign-banner .campaign-more {
  margin-top: 12px;
}

/* URL など、区切りの無い長い文字列を幅に収める */
.wrap-anywhere {
  overflow-wrap: anywhere;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.card ul,
.card ol {
  margin: 0 0 12px;
  padding-left: 1.3em;
}

.card li {
  margin-bottom: 6px;
}

/* 概要 (項目と値) */
.facts {
  margin: 0;
}

.facts div {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.facts div:last-child {
  border-bottom: 0;
}

.facts dt {
  flex: 0 0 5.5em;
  color: var(--muted);
  font-size: 0.9rem;
}

.facts dd {
  margin: 0;
  flex: 1;
  font-weight: 700;
}

.gold {
  color: var(--gold);
}

/* 応募条件の要点 */
.condition-lead {
  color: var(--gold);
  font-weight: 700;
  font-size: 1.05rem;
}

.accent {
  color: var(--red-text);
}

/* ボタン */
.button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: var(--gold);
  color: var(--on-gold);
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 700;
  /* 文言が 2 行になったときも中央にそろえる */
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.button:disabled,
.button[aria-disabled="true"] {
  background: var(--border);
  border-color: var(--border);
  color: var(--muted);
  cursor: not-allowed;
}

/* 副ボタン (トップへ戻る など) */
.button-secondary {
  background: var(--surface);
  color: var(--gold);
}

/* 今回追加したボタンの並び用 (既存の配置には影響しない) */
.button + .button,
.inapp-notice .button + .note,
.login-note {
  margin-top: 12px;
}

.button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

/* 表 */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.table th,
.table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.table thead th {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 400;
}

.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.table tbody td.num {
  font-weight: 700;
}

/* エントリー */
.account {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
}

.account-name {
  font-weight: 700;
  line-height: 1.4;
  word-break: break-all;
}

.account-username {
  color: var(--muted);
  font-size: 0.9rem;
}

/* 提出状況の「未提出の方へのリマインド」: 宛先のチェックと、グループ DM に貼る文面 */
.reminder-targets {
  list-style: none;
  margin: 0 0 12px;
  padding: 0 !important;
}

.reminder-targets li {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.reminder-text {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 12px;
  padding: 8px;
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.6;
}

.checks {
  list-style: none;
  margin: 0;
  padding: 0 !important;
}

.checks li {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  margin: 0;
}

.checks li:last-child {
  border-bottom: 0;
}

.check-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.check-value {
  font-weight: 700;
  font-size: 1.1rem;
}

.check-rule {
  color: var(--muted);
  font-size: 0.85rem;
}

/* 判定の OK 表示 */
.badge {
  flex: none;
  padding: 2px 10px;
  border-radius: 4px;
  border: 1px solid var(--gold);
  background: var(--gold);
  color: var(--on-gold);
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

/* 判定の NG 表示 */
.badge-ng {
  border-color: var(--red-text);
  background: transparent;
  color: var(--red-text);
}

/* 受付前などの中立の表示 (赤は締切・エラー系に使う) */
.badge-muted {
  border-color: var(--muted);
  background: transparent;
  color: var(--muted);
}

/* レース一覧の状態: バッジの右 (狭い画面では下) に補足を小さく出す */
.race-status {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 8px;
  row-gap: 2px;
  vertical-align: middle;
}

.card .race-status .badge {
  margin-left: 0;
}

.race-status-note {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 400;
}

.notice {
  border-left: 4px solid var(--red-fill);
  background: var(--surface);
  padding: 12px;
  margin: 0 0 16px;
  color: var(--red-text);
  font-weight: 700;
}

.notice ul {
  margin: 4px 0 0;
  padding-left: 1.2em;
  font-weight: 400;
}

.note {
  color: var(--muted);
  font-size: 0.85rem;
}

/* アプリ内ブラウザ向けの案内 (ログインボタンの上) */
.inapp-notice {
  border: 1px solid var(--border);
  border-left: 4px solid var(--red-fill);
  border-radius: 4px;
  background: var(--bg);
  padding: 12px;
  margin: 0 0 16px;
}

.inapp-notice > :last-child {
  margin-bottom: 0;
}

.inapp-notice-lead {
  color: var(--red-text);
  font-weight: 700;
}

.inapp-notice ol.note {
  margin: 12px 0 0;
  padding-left: 1.5em;
}

.copy-input {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 8px 12px;
  margin: 0 0 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 1rem;
}

/* 同意チェック: 行全体をタップ可能にし、高さ 48px 以上を確保 */
.consent {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 12px;
  margin: 0 0 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
}

.consent input[type="checkbox"] {
  flex: none;
  width: 28px;
  height: 28px;
  margin: 0;
}

.consent-links {
  font-size: 0.9rem;
  margin: 4px 0 16px;
}

.consent-links a {
  display: inline-block;
  padding: 8px 0;
  margin-right: 16px;
}

/* ---------- 第2段階: ナビゲーション、レース、参加者、管理画面、買い目入力 ---------- */

/* ヘッダーのナビゲーション */
/* 項目が増えて 1 行に収まらない幅 (管理者の表示など) では折り返す (横スクロールを出さない) */
.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 4px;
  border-top: 1px solid var(--border);
}

.main-nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}

.main-nav a:first-child {
  padding-left: 0;
}

.main-nav a:hover {
  color: var(--gold);
}

.breadcrumb {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 8px;
}

.flash {
  border-left: 4px solid var(--gold);
  background: var(--surface);
  padding: 12px;
  margin: 0 0 16px;
  font-weight: 700;
}

.button-row {
  display: flex;
  gap: 8px;
  margin: 0 0 16px;
}

.card .button-row {
  margin: 12px 0 0;
}

.button-row .button {
  min-height: 48px;
  padding: 8px;
  font-size: 0.95rem;
}

.button-row .button + .button {
  margin-top: 0;
}

.card .badge {
  vertical-align: middle;
  margin-left: 4px;
}

.entry-number {
  color: var(--gold);
  font-family: var(--font-heading);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  margin-right: 4px;
}

/* 参加者一覧 */
.participants {
  list-style: none;
  margin: 0 !important;
  padding: 0 !important;
}

.participants li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  margin: 0;
  border-bottom: 1px solid var(--border);
}

.participants li:last-child {
  border-bottom: 0;
}

.participants img,
.avatar-placeholder {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
}

.participants .entry-number {
  flex: none;
  width: 3.2em;
}

.participant-name {
  min-width: 0;
}

.participant-name a {
  display: inline-block;
  padding: 4px 0;
  color: var(--gold);
}

/* 管理画面のフォーム */
.admin-form label,
.admin-entry label {
  display: block;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.85rem;
}

.admin-form input:not([type="checkbox"]),
.admin-form select,
.runners-table input:not([type="checkbox"]) {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 8px 12px;
  margin-top: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 1rem;
}

.runners-table input[readonly] {
  background: var(--surface);
  color: var(--muted);
  color-scheme: dark;
}

.admin-entry .facts {
  margin-top: 12px;
}

.admin-entry details {
  margin-top: 12px;
}

.admin-entry summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--gold);
  cursor: pointer;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.choice {
  display: flex !important;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 4px 8px;
  margin: 0 !important;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text) !important;
  font-size: 0.95rem !important;
  cursor: pointer;
}

.choice input {
  flex: none;
  width: 24px;
  height: 24px;
  margin: 0;
}

.runners-table th,
.runners-table td {
  padding: 4px;
}

.runners-table td:nth-child(2) {
  width: 4.5em;
}

.runners-table input[type="checkbox"] {
  width: 28px;
  height: 28px;
}

.runners-table .center,
.runners-table th:last-child {
  text-align: center;
  font-size: 0.75rem;
}

.runners-table + .button {
  margin-top: 16px;
}

/* 買い目入力 */
.countdown {
  color: var(--red-text);
  font-weight: 400;
  font-size: 0.9rem;
  white-space: nowrap;
}

.option-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.option-buttons:empty {
  display: none;
}

.option-buttons + .option-buttons {
  margin-top: 8px;
}

.option-button,
.number-button {
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  cursor: pointer;
}

.option-button {
  padding: 8px 14px;
  font-size: 0.95rem;
  font-weight: 700;
}

/* 選択状態: 金地に黒文字 */
.option-button[aria-pressed="true"],
.number-button[aria-pressed="true"] {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--on-gold);
}

.picker {
  margin: 0 0 16px;
}

.picker-label {
  color: var(--gold);
  font-size: 0.9rem;
  font-weight: 700;
  margin: 0 0 6px;
}

/* 馬番 (枠番) のボタン: 44px 以上 */
.number-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 6px;
}

.number-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 58px;
  min-width: 44px;
  padding: 4px 3px;
  line-height: 1.2;
  overflow: hidden;
}

.number-button-number {
  font-size: 1.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* 馬名は 9 文字まであるので 2 行まで表示する */
.number-button-caption {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  max-width: 100%;
  overflow: hidden;
  word-break: break-all;
  font-size: 0.62rem;
  line-height: 1.25;
  color: var(--muted);
}

.number-button[aria-pressed="true"] .number-button-caption {
  color: var(--on-gold);
}

.number-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  text-decoration: line-through;
}

.amount-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.amount-row input {
  width: 6em;
  text-align: right;
  min-height: 48px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 1.1rem;
  text-align: right;
}

.bet-preview {
  margin: 16px 0 12px;
  min-height: 1.8em;
  font-weight: 700;
}

.bet-preview.over,
.bet-total.over {
  color: var(--red-text);
}

.bet-groups {
  list-style: none;
  margin: 0 0 12px !important;
  padding: 0 !important;
}

.bet-groups li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  margin: 0;
  border-bottom: 1px solid var(--border);
}

.bet-groups li.has-scratched {
  border-left: 4px solid var(--red-fill);
  padding-left: 8px;
}

.bet-group-title {
  font-weight: 700;
}

.bet-group-selection {
  word-break: break-all;
}

.bet-group-amount {
  color: var(--muted);
  font-size: 0.85rem;
}

.bet-group-warning {
  color: var(--red-text);
  font-size: 0.85rem;
  font-weight: 700;
}

.remove-button {
  flex: none;
  min-width: 56px;
  min-height: 44px;
  border: 1px solid var(--red-text);
  border-radius: 8px;
  background: transparent;
  color: var(--red-text);
  font-family: var(--font-body);
  font-weight: 700;
  cursor: pointer;
}

.bet-total {
  font-size: 1.1rem;
  font-weight: 700;
  text-align: right;
}

.bet-total + .note {
  text-align: right;
}

/* ---------- トップページ: 対象レースの日程 ---------- */
/* 表ではなく「日付 | レース名 + 主催・競馬場」の 2 列にして、スマホで横スクロールが出ないようにする */
.schedule {
  list-style: none;
  margin: 12px 0 0 !important;
  padding: 0 !important;
  border-top: 1px solid var(--border);
}

.schedule li {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  margin: 0;
  border-bottom: 1px solid var(--border);
}

.schedule li:last-child {
  border-bottom: 0;
}

.schedule-date {
  flex: 0 0 6.6em;
  font-size: 0.9rem;
  line-height: 1.7;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  white-space: nowrap;
}

.schedule-body {
  flex: 1;
  min-width: 0;
}

.schedule-name {
  display: block;
  font-weight: 700;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.schedule-meta {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

/* 終了したレースは薄く表示する */
.schedule li.finished {
  opacity: 0.45;
}

/* ---------- 大会規約・プライバシーポリシー (長文) ---------- */
.legal-toc ol,
.legal-toc ul {
  list-style: none;
  margin: 0 !important;
  padding: 0 !important;
}

.legal-toc li {
  margin: 0;
  border-bottom: 1px solid var(--border);
}

.legal-toc li:last-child {
  border-bottom: 0;
}

.legal-toc a {
  display: block;
  padding: 10px 0;
  text-decoration: none;
}

/* 本文は行間と余白を広めに取る */
.legal {
  line-height: 2;
}

.legal p {
  margin: 0 0 16px;
}

.legal h2 {
  margin: 40px 0 16px;
  /* ページ内リンクで飛んだときに、見出しが画面の端に貼り付かないようにする */
  scroll-margin-top: 16px;
}

.legal h3 {
  margin: 24px 0 8px;
  font-size: 1rem;
  line-height: 1.7;
}

.legal ol,
.legal ul {
  margin: 0 0 16px;
  padding-left: 1.5em;
}

.legal li {
  margin-bottom: 12px;
}

.legal li > ul {
  margin: 8px 0 0;
}

.legal li > ul > li {
  margin-bottom: 6px;
}

.legal .table {
  margin: 12px 0 4px;
  line-height: 1.6;
}

.legal-date {
  margin: 40px 0 0 !important;
  color: var(--muted);
  text-align: right;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* ---------- 買い目・印の入力: 出馬表形式 ---------- */

/* 枠の色 (JRA と同じ)。白・黄・橙・桃は黒文字、それ以外は白文字 */
:root {
  --frame-1: #ffffff;
  --frame-2: #000000;
  --frame-3: #e60012;
  --frame-4: #0068b7;
  --frame-5: #ffe100;
  --frame-6: #009944;
  --frame-7: #f39800;
  --frame-8: #f19ec2;
  --frame-dark-text: #0d0d0f;
  --frame-light-text: #ffffff;
  --mark-col-bg: #1f1f24;  /* 出馬表の印の列の背景 (カードの背景より一段明るい) */
  --mark-empty: #4a4a52;   /* 印が無い馬の「−」 */
}

.frame-1 { background: var(--frame-1); color: var(--frame-dark-text); }
.frame-2 { background: var(--frame-2); color: var(--frame-light-text); }
.frame-3 { background: var(--frame-3); color: var(--frame-light-text); }
.frame-4 { background: var(--frame-4); color: var(--frame-light-text); }
.frame-5 { background: var(--frame-5); color: var(--frame-dark-text); }
.frame-6 { background: var(--frame-6); color: var(--frame-light-text); }
.frame-7 { background: var(--frame-7); color: var(--frame-dark-text); }
.frame-8 { background: var(--frame-8); color: var(--frame-dark-text); }

/* 印 / 買い目 の切り替え */
.tabs {
  display: flex;
  margin: 0 0 16px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  overflow: hidden;
}

.tabs a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  color: var(--gold);
  font-weight: 700;
  text-decoration: none;
}

.tabs a[aria-current="page"] {
  background: var(--gold);
  color: var(--on-gold);
}

/* 券種: 4 列のボタン */
.type-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 0 0 12px;
}

.type-buttons .option-button {
  padding: 8px 2px;
  font-size: 0.9rem;
}

/* 買い方: 横 1 列の切り替え */
.segmented {
  display: flex;
  margin: 0 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.segment {
  flex: 1 1 0;
  min-height: 48px;
  padding: 4px 2px;
  border: 0;
  border-right: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.3;
  cursor: pointer;
}

.segment:first-child {
  flex-grow: 1.7;
}

.segment:last-child {
  border-right: 0;
}

.segment[aria-pressed="true"] {
  background: var(--gold);
  color: var(--on-gold);
}

.odds-note {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: right;
}

.odds-note a {
  margin-left: 8px;
}

/* 出馬表。狭い画面でも馬名の幅を確保するため、本文の左右の余白を使って画面いっぱいに近い幅で表示する */
.entry-table {
  --frame-col: 24px;
  --num-col: 26px;
  --mark-col: 30px;
  --check-col: 46px;
  width: calc(100% + 24px);
  margin: 0 -12px 8px;
  border-collapse: collapse;
  table-layout: fixed;
}

.entry-table th,
.entry-table td {
  padding: 0;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

/* 見出し行はスクロールしても上部に固定する */
.entry-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 32px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--gold);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 400;
  text-align: center;
}

.entry-table th.frame,
.entry-table td.frame {
  width: var(--frame-col);
  text-align: center;
}

.entry-table th.num,
.entry-table td.num {
  width: var(--num-col);
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.entry-table th.name {
  text-align: left;
  padding-left: 4px;
}

.entry-table th.op,
.entry-table td.op {
  width: var(--check-col);
}

/* 印の列: 固定幅。背景を一段明るくして、行の上下いっぱいに塗る */
.entry-table th.mark,
.entry-table td.mark {
  width: var(--mark-col);
  padding: 0;
  text-align: center;
}

.entry-table td.mark {
  background: var(--mark-col-bg);
  color: var(--gold);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

/* 注1〜注3 は 2 文字幅になるので小さくする */
.entry-table td.mark.long {
  font-size: 0.72rem;
  letter-spacing: -0.02em;
}

/* 印が無い馬は薄い「−」(縦の並びを揃えるため空欄にしない) */
.entry-table td.mark.empty {
  color: var(--mark-empty);
  font-weight: 400;
}

/* 印のタブでは印の列を出さない。馬名の開始位置は買い目のタブと揃える */
.marks-table th.name,
.marks-table td.name {
  padding-left: calc(var(--mark-col) + 4px) !important;
}

.entry-table th.mark-op,
.entry-table td.mark-op {
  width: 72px;
}

.entry-table tbody td {
  height: 48px;
}

/* オッズがある場合は 2 段 (馬名 + オッズ) */
.entry-table.with-odds tbody td {
  height: 58px;
}

.frame-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 0.8rem;
  font-weight: 700;
}

.entry-table td.name {
  padding: 0 4px;
  overflow: hidden;
}

.entry-table tbody td.name {
  text-align: left;
}

.name-line {
  display: flex;
  align-items: baseline;
  gap: 3px;
  overflow: hidden;
  white-space: nowrap;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.5;
}

/* 馬名は折り返さない。収まらなければ 14px まで小さくし (entry-table.js)、それでも収まらなければ末尾を省略する */
.horse-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.horse-name.small {
  font-size: 14px;
}

.saved-mark {
  flex: none;
  color: var(--gold);
  font-weight: 700;
}

.scratched-label {
  flex: none;
  color: var(--red-text);
  font-size: 0.7rem;
  font-weight: 700;
}

.odds-line {
  min-height: 1.4em;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.odds.low {
  color: var(--red-text);
}

/* 取消・除外の馬は薄い色にする */
.entry-table tr.scratched td {
  opacity: 0.45;
}

/* 枠連・枠単: 枠単位の行に、その枠の馬番と馬名を併記する */
.frame-row td {
  height: auto !important;
  padding-top: 6px !important;
  padding-bottom: 6px !important;
}

/* 枠単位の行でも、馬番・印・馬名の位置を馬ごとの行の列と揃える (幅は px で固定する) */
.frame-horse {
  display: flex;
  align-items: baseline;
  gap: 0;
  overflow: hidden;
  white-space: nowrap;
  font-size: 0.8rem;
  line-height: 1.7;
}

.frame-horse-mark {
  flex: none;
  width: var(--mark-col);
  color: var(--gold);
  font-weight: 700;
  text-align: center;
}

.frame-horse-mark.empty {
  color: var(--mark-empty);
  font-weight: 400;
}

.frame-horse-mark.long {
  font-size: 0.68rem;
}

.frame-horse-number {
  flex: none;
  width: calc(var(--num-col) - 4px);
  color: var(--muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.frame-horse .horse-name {
  margin-left: 4px;
}

.scratched-horse .horse-name {
  text-decoration: line-through;
  opacity: 0.6;
}

/* チェック欄: 見た目は 28px 四方、タップできる範囲は列の幅 (46px) × 高さ 48px 以上 */
.check {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 48px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.check-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 2px solid var(--muted);
  border-radius: 6px;
  background: var(--bg);
}

.check[aria-pressed="true"] .check-box {
  border-color: var(--gold);
  background: var(--gold);
}

.check[aria-pressed="true"] .check-box::after {
  content: "";
  width: 7px;
  height: 13px;
  margin-top: -3px;
  border: solid var(--on-gold);
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}

.check:disabled {
  cursor: not-allowed;
}

.check:focus-visible,
.bulk-button:focus-visible,
.mark-button:focus-visible,
.segment:focus-visible,
.option-button:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: -3px;
}

/* 列ごとの一括操作 (表の最下部。チェック欄の列と同じ位置・幅) */
.bulk-row td {
  height: 48px;
  border-bottom: 1px solid var(--border);
}

.bulk-label {
  padding-right: 8px !important;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: right;
}

.bulk-button {
  display: block;
  width: 40px;
  height: 40px;
  margin: 0 auto;
  padding: 0;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: var(--surface);
  color: var(--gold);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.bulk-button:disabled {
  border-color: var(--border);
  color: var(--muted);
  cursor: not-allowed;
}

[data-role="marks-hint"] {
  margin: 0 0 12px;
  text-align: right;
}

/* 金額 */
.amount-card {
  margin-top: 12px;
}

.amount-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 0 0 10px;
}

.amount-presets .option-button {
  padding: 8px 2px;
  font-size: 0.9rem;
}

.amount-row .button {
  width: auto;
  flex: 1;
  min-height: 48px;
  padding: 8px;
  font-size: 0.9rem;
}

.amount-row input {
  width: 6.5em;
}

/* 下部に固定する帯 */
.sticky-bar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin: 0 -16px 16px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--gold);
  background: var(--header-bg);
}

.bar-line {
  margin: 0 0 2px;
  font-size: 0.9rem;
  font-weight: 700;
}

.bar-line.note {
  font-weight: 400;
}

.rest.over {
  color: var(--red-text);
}

.bar-flash {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 0.85rem;
  font-weight: 700;
}

.sticky-bar .button {
  margin-top: 6px;
  min-height: 48px;
}

/* 現在の買い目: 1点あたりの金額の入力 */
.bet-group-text {
  min-width: 0;
}

.group-amount {
  width: 5em;
  min-height: 40px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  text-align: right;
}

.group-amount.invalid {
  border: 2px solid var(--red-fill);
}

/* 印のタブ */
.mark-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 44px;
  margin: 0 auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
}

.mark-button.has-mark {
  border-color: var(--gold);
  color: var(--gold);
}

.mark-button:disabled {
  cursor: not-allowed;
}

.mark-panel {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  background: rgba(0, 0, 0, 0.6);
}

.mark-panel[hidden] {
  display: none;
}

.mark-panel-body {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--gold);
  border-radius: 12px 12px 0 0;
  background: var(--surface);
}

.mark-panel-body h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

/* 8 種類の印: 4 列 × 2 段 */
.mark-choices {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.mark-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  cursor: pointer;
}

.mark-choice[aria-pressed="true"] {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--on-gold);
}

.mark-choice-label {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.3;
}

.mark-choice-user {
  min-height: 1.3em;
  font-size: 0.7rem;
  color: var(--muted);
}

.mark-choice[aria-pressed="true"] .mark-choice-user {
  color: var(--on-gold);
}

.mark-line {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 2;
}

.mark-part {
  display: inline-block;
  margin-right: 10px;
  white-space: nowrap;
}

/* 確定後、1〜3 着に入った馬の印を強調する */
.mark-part.hit {
  color: var(--red-text);
}

.nowrap {
  display: inline-block;
  white-space: nowrap;
}

/* 管理画面: オッズの手入力 */
.odds-table th,
.odds-table td {
  padding: 4px;
}

.odds-table td:nth-child(3),
.odds-table td:nth-child(4) {
  width: 4.8em;
}

.odds-table input {
  display: block;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 1rem;
  text-align: right;
}

.odds-table input:disabled {
  background: var(--surface);
  color-scheme: dark;
}

.odds-table + .button {
  margin-top: 16px;
}

/* ながし: 軸のパターン (3連単は 6 つを横 1 列に並べてスマホ幅に収める) */
.pattern-buttons {
  display: grid;
  gap: 4px;
  width: 100%;
}

.pattern-buttons.cols-2 { grid-template-columns: repeat(2, 1fr); }
.pattern-buttons.cols-6 { grid-template-columns: repeat(6, 1fr); }

.pattern-buttons .option-button {
  min-width: 0;
  padding: 4px 0;
  font-size: 0.75rem;
  letter-spacing: -0.02em;
}

.multi-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 4px;
  font-weight: 700;
  cursor: pointer;
}

.multi-toggle input {
  width: 26px;
  height: 26px;
  margin: 0;
}

/* 軸の列 (1 頭だけ選べる) は丸いボタンにして、相手の列 (四角いチェック欄) と形で区別する */
.check.radio .check-box {
  border-radius: 50%;
}

.check.radio[aria-pressed="true"] .check-box {
  background: var(--bg);
}

.check.radio[aria-pressed="true"] .check-box::after {
  width: 14px;
  height: 14px;
  margin: 0;
  border: 0;
  border-radius: 50%;
  background: var(--gold);
  transform: none;
}

/* 管理画面: 結果の確定 */
.warning-list {
  border-left-color: var(--gold);
  color: var(--text);
}

.settle-runners th,
.settle-runners td {
  padding: 2px 4px;
  text-align: center;
}

.settle-runners td.settle-name {
  text-align: left;
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 7em;
}

.settle-runners input[type="checkbox"] {
  width: 24px;
  height: 24px;
  margin: 10px 0;
}

.payout-row {
  display: grid;
  grid-template-columns: 5.2em 1fr 5.6em auto;
  gap: 4px;
  margin: 0 0 6px;
}

.payout-row select,
.payout-row input {
  min-height: 44px;
  margin: 0 !important;
  padding: 4px 6px !important;
  font-size: 0.95rem !important;
}

.payout-row .remove-button {
  min-width: 48px;
}

.payout-rows + template + .button {
  margin-top: 8px;
}

.lines-table {
  font-size: 0.85rem;
}

.lines-table tr.hit td {
  color: var(--red-text);
  font-weight: 700;
}

.lines-table tr.invalid td {
  opacity: 0.45;
  text-decoration: line-through;
}

/* ---------- 第3段階: 結果・ランキング ---------- */
.main-nav a {
  padding: 0 10px;
}

.race-link {
  color: var(--text);
  text-decoration-color: var(--gold);
}

.section-title {
  font-size: 1.2rem;
  margin: 24px 0 12px;
}

.card .subheading {
  margin-top: 20px;
}

.result-table td,
.payout-table td {
  padding: 8px 6px;
}

.payout-table td:nth-child(2) {
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}

.share-button {
  margin-top: 16px;
}

/* 参加者ごとの結果 */
.participant-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.participant-head .participant-name {
  flex: 1;
  min-width: 0;
}

.participant-head .account-name {
  display: block;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.participant-score {
  flex: none;
  text-align: right;
  line-height: 1.3;
}

.score-points {
  color: var(--gold);
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.3rem;
}

.score-payout {
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.score-payout-label {
  color: var(--muted);
  font-size: 0.8rem;
}

/* 払戻金の金額は赤の太字で少し大きく */
.score-payout-value {
  color: var(--red-text);
  font-weight: 700;
  font-size: 1.05rem;
}

/* 的中した参加者のカード: 赤枠で囲み、上端に 🎯 と的中した買い目の帯を付ける */
.participant-card.is-hit {
  border: 2px solid var(--red-text);
  padding-top: 0;
  overflow: hidden;
}

.hit-band {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 -16px 14px;
  padding: 7px 16px;
  background: #d6333f;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.hit-band::before {
  content: "";
  flex: none;
  width: 22px;
  height: 22px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='13' r='8'/%3E%3Ccircle cx='11' cy='13' r='4'/%3E%3Ccircle cx='11' cy='13' r='1' fill='white'/%3E%3Cpath d='M11 13 20 4M17 3v4h4'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* 複数の券種で的中したとき: 折り返しは区切りの「・」の位置だけ */
.hit-keys {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  min-width: 0;
}

.hit-key {
  white-space: nowrap;
}

/* 狭い画面で @ID が払戻金に重ならないよう省略する */
.participant-head .account-username {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.participant-card .mark-line {
  margin: 8px 0 0;
  font-size: 0.95rem;
  line-height: 1.8;
}

.honmei-result {
  font-size: 0.85rem;
  white-space: nowrap;
}

/* 的中の強調 (黒地の上の赤) */
.hit,
.mark-part.hit,
.public-groups summary.hit,
.expanded-lines li.hit {
  color: var(--red-text);
}

/* レース一覧の「確定済のレース情報」(確定・中止のレースを折りたたむ) */
.finished-races > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  cursor: pointer;
  color: var(--gold);
  font-weight: 700;
}

.finished-races > summary::-webkit-details-marker {
  display: none;
}

.finished-races > summary::after {
  content: "▼ 開く";
  margin-left: auto;
  flex: none;
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 400;
  white-space: nowrap;
}

.finished-races[open] > summary::after {
  content: "▲ 閉じる";
}

.finished-races-count {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 400;
}

.finished-races .race-card {
  margin: 12px 0 0;
}

/* 管理画面のレース一覧の「レースを追加する」(下のレースの一覧と離す) */
.add-race-button {
  margin-bottom: 16px;
}

.bet-details {
  margin-top: 8px;
}

.bet-details > summary,
.public-groups summary {
  min-height: 44px;
  padding: 6px 0;
  cursor: pointer;
}

.bet-details > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  color: var(--gold);
  font-weight: 700;
}

/* display: flex / grid の summary は既定の三角が消えるため、開閉できることを文字と記号で示す */
.bet-details > summary::-webkit-details-marker,
.public-groups summary::-webkit-details-marker {
  display: none;
}

.bet-details > summary::after {
  content: "▼ 開く";
  margin-left: auto;
  flex: none;
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 400;
  white-space: nowrap;
}

.bet-details[open] > summary::after {
  content: "▲ 閉じる";
}

.public-groups summary::after {
  content: "▼";
  grid-row: 1;
  grid-column: 3;
  align-self: center;
  color: var(--muted);
  font-size: 0.75rem;
}

.public-groups details[open] > summary::after {
  content: "▲";
}

.public-groups {
  list-style: none;
  margin: 4px 0 0 !important;
  padding: 0 !important;
}

.public-groups > li {
  margin: 0;
  border-top: 1px solid var(--border);
}

.public-groups summary {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0 8px;
}

.public-groups summary .bet-group-selection {
  grid-column: 1 / -1;
  font-size: 0.9rem;
}

.public-groups summary .bet-group-amount {
  grid-row: 1;
  grid-column: 2;
}

.expanded-lines {
  list-style: none;
  margin: 0 0 8px !important;
  padding: 0 0 0 12px !important;
  border-left: 2px solid var(--border);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.expanded-lines li {
  display: flex;
  gap: 10px;
  margin: 0;
}

.expanded-lines li span:first-child {
  min-width: 5.5em;
}

.expanded-lines li.invalid {
  opacity: 0.45;
}

.public-runners td {
  padding: 6px 2px;
}

/* 騎手名の分の幅をあけるため、馬名とオッズの欄は少し小さくする (9 文字の馬名と騎手名・オッズが 390px 幅で 1 行に収まる) */
.public-runners .runner-name {
  font-size: 0.85rem;
}

.public-runners .odds-cell {
  font-size: 0.75rem;
}

.public-runners tr.scratched td {
  opacity: 0.45;
}

.odds-cell {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

/* 騎手名 (オッズの左に、オッズと同じ大きさで) */
.odds-cell .jockey,
.odds-line .jockey {
  margin-right: 6px;
}

.objection {
  margin-top: 16px;
}

/* ランキング */
.ranking-heading {
  color: var(--gold);
  font-weight: 700;
}

.ranking-card {
  padding: 8px 8px 12px;
}

.ranking-table th,
.ranking-table td {
  padding: 8px 4px;
  vertical-align: middle;
}

.ranking-table .rank {
  width: 2.6em;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.1rem;
}

/* 上位 3 名の順位は金色 */
.ranking-table .rank.top {
  color: var(--gold);
  font-size: 1.3rem;
}

.ranking-table .points {
  font-weight: 700;
  font-size: 1.05rem;
}

.ranking-name a {
  display: block;
  color: var(--text);
  text-decoration: none;
  line-height: 1.4;
}

.ranking-name .entry-number {
  display: block;
  font-size: 0.8rem;
}

/* 名前は 2 行まで折り返して表示し、それを超える分だけ「…」で省略する (長い表示名が多いため) */
.ranking-name .account-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.ranking-table td .note {
  font-size: 0.75rem;
}

/* 名前の下の横棒 (先頭の点数を 100%)。参加者の行と棒の行をひとまとまりに見せるため、区切り線は棒の行の下だけ */
.ranking-table tr.has-bar td {
  border-bottom: 0;
  padding-bottom: 4px;
}

.ranking-table tr.ranking-bar-row td {
  padding-top: 0;
  padding-bottom: 14px;
}

/* ランキングの「ポイントの推移」(上位 3 名の折れ線) */
.points-chart svg {
  display: block;
  width: 100%;
  height: auto;
}

.points-chart .grid {
  stroke: rgba(255, 255, 255, 0.12);
}

.points-chart .axis {
  fill: var(--muted);
  font-size: 10px;
}

.points-chart .zero {
  stroke: rgba(255, 255, 255, 0.35);
  stroke-width: 1.5;
  stroke-dasharray: 3 3;
}

.points-chart .other {
  fill: none;
  stroke: rgba(255, 255, 255, 0.22);
  stroke-width: 1.2;
  stroke-linejoin: round;
}

.points-chart .leader {
  fill: none;
  stroke-width: 3;
  stroke-linejoin: round;
}

.points-legend {
  list-style: none;
  margin: 10px 0 0;
  padding: 0 !important;
}

.points-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}

.points-legend .swatch {
  flex: none;
  width: 22px;
  height: 5px;
  border-radius: 3px;
}

.points-legend .swatch-other {
  background: rgba(255, 255, 255, 0.3);
}

.points-legend .name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.points-legend .pt {
  flex: none;
  color: var(--muted);
}

.participant-races td {
  padding: 8px 4px;
  font-size: 0.9rem;
}

/* 管理画面の日時入力: 日本時間で入力することを明記する */
.tz-label {
  display: inline-block;
  margin-left: 4px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 400;
}

/* ---------- 管理画面: 公式サイトからの自動取得 ---------- */
.fetch-url-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.fetch-url-row input {
  flex: 1 1 220px;
  min-width: 0;
}

.fetch-url-row .fetch-button {
  flex: 0 0 auto;
  width: auto;
  min-height: 44px;
  padding: 0 16px;
  font-size: 0.95rem;
}

.fetch-last {
  font-size: 0.85rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* 自動取得の値 (金の枠) と、取得後に手で変えた値 (赤の枠)。色だけに頼らないよう、凡例とツールチップも付ける */
input.is-fetched,
select.is-fetched {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

input.is-edited,
select.is-edited {
  outline: 2px dashed var(--red-text);
  outline-offset: 1px;
}

.fetch-legend {
  font-size: 0.85rem;
  color: var(--muted);
}

.legend-fetched,
.legend-edited {
  display: inline-block;
  margin-right: 8px;
  padding: 0 6px;
  color: var(--text);
}

.legend-fetched {
  outline: 2px solid var(--gold);
}

.legend-edited {
  outline: 2px dashed var(--red-text);
}

/* ---------- トップページ: エントリー状況 / 参加状況 (/home-stats を読み込んで表示) ---------- */
.home-stats {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 0 0 16px;
  min-height: 120px;
}

.home-stats[hidden] {
  display: none;
}

.stats-loading {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.stats-title {
  margin: 0;
  font-size: 1.25rem;
}

.stats-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.stats-card-small {
  gap: 8px;
  padding: 16px;
  min-width: 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stats-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.stats-card-title {
  font-size: 0.9rem;
  font-weight: 700;
}

.stats-badge {
  flex: none;
  padding: 2px 10px;
  border: 1px solid var(--gold);
  border-radius: 4px;
  background: var(--gold);
  color: var(--on-gold);
  font-size: 0.75rem;
  font-weight: 700;
}

.stats-badge-outline {
  background: transparent;
  color: var(--gold);
}

.stats-label {
  font-size: 0.85rem;
  color: var(--muted);
}

.stats-divider {
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.stats-sub {
  font-size: 0.8rem;
  color: var(--muted);
}

.stats-number-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 6px;
}

.stats-number {
  font-family: var(--font-heading);
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.stats-number-small {
  font-size: 2.6rem;
}

/* 抽選結果の公開前の「最終応募」 */
.stats-number-large {
  font-size: 5.5rem;
}

/* トップのエントリー状況のカード (受付前・受付中・受付終了): 応募数の右の余白に、企画ロゴを透かしで出す (SNS 用のスクリーンショットの見栄え)。
   数字の行の高さに合わせ、上下の文言やバーには掛からないようにする */
.stats-card-entry .stats-number-row {
  position: relative;
}

.stats-card-entry .stats-number-row::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  height: calc(100% + 1.25rem);
  aspect-ratio: 1;
  transform: translateY(-50%);
  background: url("/images/logo-mark.png") right center / contain no-repeat;
  opacity: 0.2;
  pointer-events: none;
}

/* 最終応募 (大きい数字) の行は、数字の右の余白が狭いので小さめにする (「/ 定員 30名」に掛からない大きさ) */
.stats-card-entry .stats-number-row-large::after {
  height: 5.4rem;
}

@media (max-width: 385px) {
  .stats-card-entry .stats-number-row-large::after {
    height: 4.25rem;
  }
}

/* トップの「9/26(土)のスケジュール」(キャンペーンの開始まで) */
.stats-schedule {
  display: flex;
  flex-direction: column;
  gap: 14px;
  list-style: none;
  margin: 14px 0 0 !important;
  padding: 0 !important;
}

.stats-schedule li {
  display: grid;
  grid-template-columns: 3.2rem 1fr auto;
  gap: 10px;
  align-items: start;
}

.stats-schedule-time {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.4;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.stats-schedule-text {
  font-weight: 700;
  line-height: 1.5;
}

.stats-schedule-note {
  display: block;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--muted);
}

.stats-schedule li.is-done .stats-schedule-time,
.stats-schedule li.is-done .stats-schedule-text {
  color: var(--muted);
}

/* 数字の右に余白が無いほど狭い画面では出さない */
@media (max-width: 369px) {
  .stats-card-entry .stats-number-row-large::after {
    display: none;
  }
}

@media (max-width: 340px) {
  .stats-card-entry .stats-number-row::after {
    display: none;
  }
}

.stats-number-text {
  font-size: 1.6rem;
}

.stats-number-muted {
  font-size: 2.5rem;
  color: var(--muted);
}

.stats-unit {
  font-size: 1rem;
  font-weight: 700;
}

.stats-capacity {
  margin-left: 4px;
  font-size: 0.9rem;
}

.stats-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--border);
  overflow: hidden;
}

.stats-bar-thin {
  height: 6px;
  border-radius: 3px;
}

.stats-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--gold);
}

.stats-text {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.7;
}

.stats-ranking {
  display: flex;
  flex-direction: column;
  gap: 12px;
  list-style: none;
  margin: 0 !important;
  padding: 0 !important;
}

.stats-ranking li {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
}

.stats-ranking-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.85rem;
}

.stats-ranking-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.stats-ranking-count {
  flex: none;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* 管理画面: キャンペーンのオッズの推移 (SVG の折れ線) */
.odds-chart-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 12px;
}

.odds-chart-tools .button {
  width: auto;
  min-height: 36px;
  padding: 6px 14px;
  font-size: 0.85rem;
}

.odds-chart-tools .button[aria-pressed="true"] {
  background: var(--gold);
  color: #111;
}

.odds-chart-tools .odds-chart-image {
  margin-left: auto;
}

.odds-chart {
  display: block;
  width: 100%;
  height: auto;
}

.odds-legend {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
  font-size: 0.85rem;
}

.odds-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.odds-legend .swatch {
  flex: none;
  width: 18px;
  height: 4px;
  border-radius: 2px;
}

.odds-legend .rank-pill {
  flex: none;
  margin: 0;
}

/* X 用の画像は凡例の文字が大きいので、順位のラベルも合わせる */
.chart-image .odds-legend .rank-pill {
  font-size: 0.8rem;
}

.odds-legend .name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.odds-legend .val {
  flex: none;
  margin-left: auto;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.odds-legend .val small {
  margin-left: 6px;
  color: var(--muted);
  font-weight: 400;
}

.odds-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: left;
}

/* X 用の画像 (1200x675): レイアウトなしで、この大きさのまま撮る */
.chart-image-body {
  margin: 0;
  background: #0d0d0f;
  color: #fff;
}

.chart-image {
  box-sizing: border-box;
  width: 1200px;
  height: 675px;
  padding: 28px 40px;
  display: grid;
  /* 右の凡例は No・順位のラベル・名前・オッズが入る幅 */
  grid-template-columns: 1fr 340px;
  grid-template-rows: auto 1fr;
  gap: 8px 28px;
}

.chart-image h1 {
  grid-column: 1 / -1;
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.6rem;
}

.chart-image h1 small {
  margin-left: 16px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 400;
}

.chart-image .odds-chart {
  align-self: center;
}

.chart-image .odds-legend {
  margin: 0;
  align-self: center;
  font-size: 1rem;
}

/* ◎の集計 (X 用の画像 1200x675、/admin/races/{id}/marks-image) */
.marks-image {
  box-sizing: border-box;
  width: 1200px;
  height: 675px;
  padding: 24px 44px 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: radial-gradient(ellipse at 30% 0%, #1d1a13 0%, #0b0b0d 70%);
  border: 3px solid #bb9e65;
}

.marks-image-kicker {
  margin: 0;
  color: var(--gold);
  font-weight: 700;
  font-size: 1.1rem;
}

.marks-image h1 {
  margin: 0 0 12px;
  font-family: var(--font-heading);
  font-size: 2.1rem;
}

.marks-image h1 span {
  margin-left: 12px;
  color: var(--gold);
}

.marks-image-wait {
  margin: auto 0;
  font-size: 1.6rem;
  text-align: center;
}

.marks-image-rows {
  flex: 1;
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-rows: repeat(8, minmax(0, 1fr));
  gap: 5px;
}

.marks-image-rows li {
  display: grid;
  grid-template-columns: 52px 330px 1fr 120px 120px;
  align-items: center;
  gap: 14px;
  padding: 0 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
}

.marks-image-number {
  display: grid;
  place-items: center;
  height: 40px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.marks-image-name {
  font-weight: 700;
  font-size: 1.55rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.marks-image-name small {
  margin-left: 10px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 400;
}

.marks-image-bar {
  height: 22px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.marks-image-bar span {
  display: block;
  height: 100%;
  border-radius: 11px;
  background: linear-gradient(90deg, #a57c32, var(--gold));
}

.marks-image-honmei {
  font-size: 1.5rem;
  text-align: right;
}

.marks-image-honmei strong {
  color: var(--gold);
  font-size: 2rem;
}

.marks-image-sub {
  color: var(--muted);
  font-size: 1.1rem;
}

.marks-image-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

/* 優勝予想キャンペーンのオッズ (応募数から計算)。10 倍未満は赤 */
.campaign-odds-cell {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
}

.campaign-odds {
  font-size: 1.05rem;
}

.campaign-odds.low {
  color: var(--red-text);
}

.campaign-odds-unit {
  font-size: 0.75rem;
}

.campaign-odds-count {
  margin-left: 8px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 400;
}

.stats-more {
  align-self: flex-end;
  font-size: 0.85rem;
}

.stats-asof {
  margin: 0;
  text-align: right;
  font-size: 0.75rem;
  color: var(--muted);
}

/* キャンペーンのページ: 全参加者の予想数 */
.stats-all-picks {
  list-style: none;
  margin: 0 !important;
  padding: 0 !important;
}

.stats-all-picks li {
  margin: 0;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.stats-all-picks li:last-child {
  border-bottom: 0;
}

/* 1 行目: 名前と件数。2 行目: ゲージ */
.stats-all-picks-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

/* 名前と @ユーザー名 (リンク)。長い名前でも件数を押し出さないよう折り返す */
.stats-all-picks-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.stats-all-picks-name .account-username {
  font-size: 0.8rem;
}

p.stats-sub {
  margin: 0;
}

/* 管理画面: 取り消せない操作 (エントリーの削除) */
.button-danger {
  border-color: var(--red-text);
  background: transparent;
  color: var(--red-text);
}

.entry-delete-form {
  margin-top: 12px;
}

/* 参加者の X のアイコン (_Avatar.cshtml)。大きさは呼び出し側で指定する */
.avatar {
  flex: none;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface);
  vertical-align: middle;
}

.avatar-none {
  display: inline-block;
  border: 1px solid var(--border);
}

.ranking-name .avatar,
.stats-ranking-name .avatar,
.stats-all-picks .avatar {
  margin: 0 4px 0 6px;
}

/* キャンペーンの一覧: No の横に、いまのリーグの順位。1〜3 位でポイントがあれば金 */
.rank-pill {
  display: inline-block;
  margin: 0 2px 0 6px;
  padding: 0 7px;
  border: 1px solid var(--muted);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.6;
  vertical-align: 2px;
  white-space: nowrap;
}

.rank-pill-top {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--on-gold);
}

/* 的中のスタンプ (印鑑風)。赤の二重丸を少し傾けて重ねる */
.hit-stamp {
  flex: none;
  display: inline-block;
  padding: 2px 8px;
  border: 2px solid var(--red-text);
  border-radius: 6px;
  color: var(--red-text);
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.4;
  transform: rotate(-8deg);
  transform-origin: center;
  vertical-align: middle;
}

/* 買い目の見出しのスタンプ: 右端に寄せて大きめに (右の「開く / 閉じる」の手前) */
.hit-stamp-large {
  margin-left: auto;
  /* 「開く / 閉じる」のすぐ左に置く (summary の gap を打ち消す) */
  margin-right: -6px;
  padding: 4px 14px;
  border-width: 3px;
  font-size: 1.15rem;
  letter-spacing: 0.12em;
}

.hit-stamp-small {
  margin-left: 8px;
  padding: 1px 6px;
  border-width: 1px;
  border-radius: 4px;
  font-size: 0.7rem;
}

@media (prefers-reduced-motion: reduce) {
  .hit-stamp {
    transform: none;
  }
}

/* エントリー状況: バーと注記はひとまとまり (バーが満タンでも「締切」と誤解されないよう、必ず一緒に見せる) */
.stats-bar-group {
  break-inside: avoid;
}

.stats-bar-group .stats-bar {
  margin-bottom: 6px;
}

.stats-lottery-note {
  margin-top: 0;
}

/* エントリー状況: 定員を増枠したお知らせ */
.stats-upsize {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: rgba(194, 164, 104, 0.12);
  font-size: 0.85rem;
  line-height: 1.6;
}

.stats-upsize-badge {
  flex: none;
  margin-top: 2px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--red-fill);
  color: var(--on-red-fill);
  font-size: 0.75rem;
  font-weight: 700;
}

/* 文言が折り返しても、バッジは左に残して文章だけを折り返す */
.stats-upsize-text {
  flex: 1;
  min-width: 0;
}

.stats-upsize strong {
  color: var(--gold);
  font-weight: 700;
}

/* 当選のエントリー画面の見出し。明朝体の後ろにカラー絵文字のフォントを並べて、🎉 を端末の標準の絵文字で表示する */
.entry-title {
  font-family: var(--font-heading), "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";
}

/* 抽選結果のページの抽選演出 (lottery-show.js)。画面全体に重ねて、正方形の canvas を中央に置く */
.lottery-show {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.94);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lottery-show[hidden] {
  display: none;
}

.lottery-show.is-visible {
  opacity: 1;
}

.lottery-show canvas {
  width: min(100%, calc(100dvh - 32px), 720px);
  height: auto;
  aspect-ratio: 1;
  border-radius: 12px;
  background: var(--bg);
}

.lottery-show-skip {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  min-height: 44px;
  padding: 8px 18px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: rgba(13, 13, 15, 0.8);
  color: var(--gold);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

/* 演出を出している間は後ろのページをスクロールさせない */
html.lottery-show-open,
html.lottery-show-open body {
  overflow: hidden;
}

.lottery-show-replay {
  margin-bottom: 16px;
}

/* ---------- 参加者アンケート (/survey/{id}) ---------- */
.survey-period {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 0 0 12px;
}

.survey-description p {
  margin: 0 0 12px;
  line-height: 1.8;
}

.survey-images {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

/* 画像は幅いっぱいに縮める (スマホで横にはみ出さない)。タップで原寸を開く */
.survey-images img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.survey-form fieldset {
  border: 0;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 10px;
}

/* 選択肢は行全体を押せるようにする */
.survey-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.survey-option input {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  accent-color: var(--gold);
}

.survey-option:has(input:checked) {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px var(--gold);
}

.survey-option-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.survey-option-list li {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-wrap: anywhere;
}

.survey-option-list li.is-own {
  border-color: var(--gold);
}

.survey-option-list .badge {
  margin-left: 8px;
}

.survey-results {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 14px;
}

.survey-result-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}

.survey-result-count {
  flex: none;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.survey-result-count small {
  color: var(--muted);
  font-weight: 400;
}

/* トップページ・エントリー画面の「アンケート実施中」。未投票は赤い枠で目立たせる */
.survey-home h2 {
  margin: 4px 0;
}

.survey-home.is-unvoted {
  border: 2px solid var(--red-text);
}

.survey-home-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--gold);
  font-weight: 700;
}

.button-row form {
  flex: 1;
  margin: 0;
}

/* カード内の ol の字下げを打ち消す (選択肢と結果は枠で区切るので不要) */
.card .survey-option-list,
.card .survey-results {
  margin-left: 0;
  margin-right: 0;
  padding: 0;
}

/* 引用リポストの全件チェック (管理画面)。スマホ幅で名前が細切れに折り返さないよう、No. と名前を 2 行に分ける */
.quote-check-name {
  display: block;
  font-size: 0.85rem;
}

.quote-check-nowrap {
  white-space: nowrap;
}

.card .quote-invalid {
  margin: 0;
  padding: 0;
  list-style: none;
}

.quote-invalid li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.quote-finish {
  margin: 8px 0 0;
}

.card .pick-count-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.pick-count-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.pick-count-form {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 6px 0 0;
}

.pick-count-form input[type="number"] {
  width: 7em;
  min-height: 40px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 1rem;
}

.pick-count-form .button {
  min-height: 40px;
  padding: 6px 16px;
}

.quote-finish .button {
  width: 100%;
}
