/* 百式闘技場「裁定記録簿」。紙・墨・罫・朱。 */
:root {
  --paper: #f3f4f1; --sheet: #ffffff; --sheet-2: #f7f7f4; --ink: #17181a; --ink-2: #2b2e33;
  --muted: #4a4d52; --faint: #62666c; --rule: #c9ccc6;
  --shu: #b8321f; --shu-dark: #8e2414; --shu-soft: #f6e4e0;
  --gold: #c9a100; --gray: #62666c; --ok: #2f6b45;
  /* 白文字のボタン。どちらのテーマでも白との差が十分な朱にする */
  --btn: #b8321f; --btn-hover: #8e2414; --btn-dark: #17181a;
  --font-display: "BIZ UDPMincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --font-body: "BIZ UDPGothic", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16171a; --sheet: #1f2125; --sheet-2: #23262a; --ink: #ecedeb; --ink-2: #d5d7da;
    --muted: #b3b6bb; --faint: #9a9ea5; --rule: #3a3d42;
    --shu: #e0715d; --shu-dark: #f08b78; --shu-soft: #3a221d;
    --gold: #d9b62e; --gray: #8a8e95; --ok: #7cc497;
    --btn: #b8321f; --btn-hover: #9c2a1a; --btn-dark: #3a3d42;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.75; }
a { color: var(--shu); }
a:hover { color: var(--shu-dark); }
:focus-visible { outline: 2px solid var(--shu); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.3; margin: 0; }
.wrap { max-width: 1120px; margin: 0 auto; padding-inline: 16px; }
@media (min-width: 720px) { .wrap { padding-inline: 24px; } }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 500; }
.spaced { letter-spacing: .1em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ヘッダー */
.site-header { border-bottom: 2px solid var(--ink); }
.header-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; padding-block: 14px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.seal { width: 40px; height: 40px; border: 2px solid var(--shu); border-radius: 4px; color: var(--shu); font-family: var(--font-display); font-weight: 700; font-size: 22px; display: flex; align-items: center; justify-content: center; }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 20px; }
.brand-sub { font-size: 12px; color: var(--muted); letter-spacing: .08em; }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; }
.site-nav a, .site-nav .link-button { color: var(--ink); text-decoration: none; font-size: 15px; padding: 10px 8px; }
.site-nav a.nav-cta { color: #fff; background: var(--btn); font-weight: 700; border-radius: 4px; padding: 10px 14px; margin-left: 4px; }
.site-nav a.nav-cta:hover { background: var(--btn-hover); color: #fff; }
.inline-form { display: inline; margin: 0; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--shu); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.site-nav .link-button { text-decoration: none; }

.main { display: flex; flex-direction: column; gap: 56px; padding-block: 40px 72px; }

/* 現王座 */
.throne { display: flex; flex-wrap: wrap; gap: 32px 48px; align-items: flex-start; }
.throne-main { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.eyebrow { font-family: var(--font-mono); font-size: 13px; letter-spacing: .12em; color: var(--muted); }
.throne-name-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.throne-name { font-size: clamp(40px, 9vw, 64px); line-height: 1.1; overflow-wrap: anywhere; }
.title-stamp { border: 2px solid var(--shu); color: var(--shu); border-radius: 4px; font-family: var(--font-display); font-weight: 700; font-size: 20px; padding: 2px 12px; transform: rotate(-3deg); }
.streak { display: flex; align-items: baseline; gap: 10px; font-size: 18px; }
.streak-num { font-family: var(--font-mono); font-weight: 500; font-size: 52px; line-height: 1; }
.lede { margin: 0; color: var(--ink-2); }
.next-leak { font-weight: 700; }

.panel { background: var(--sheet); border: 1px solid var(--ink); border-radius: 4px; }
.pad { padding: 18px 20px; }
.pad > p:first-child { margin-top: 0; }
.pad > :last-child { margin-bottom: 0; }
.tiers { flex: 1 1 440px; min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; padding: 14px 20px; border-bottom: 1px solid var(--ink); }
.panel-head h2 { font-size: 19px; }
.tier-row { display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: baseline; padding: 14px 20px; border-bottom: 1px solid var(--rule); }
.tier-row:last-child { border-bottom: 0; }
.tier-at { flex: 0 0 64px; font-weight: 500; }
.tier-label { flex: 0 0 170px; font-size: 14px; color: var(--muted); }
.tier-value { flex: 1 1 200px; min-width: 0; font-weight: 700; font-size: 17px; overflow-wrap: anywhere; }
.tier-locked { flex: 1 1 200px; min-width: 0; display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--faint); }
.hatch { display: inline-block; width: 80px; height: 12px; background: repeating-linear-gradient(135deg, var(--rule) 0 4px, transparent 4px 8px); border: 1px solid var(--rule); }

/* 見出し付きの区画 */
.section { display: flex; flex-direction: column; gap: 14px; }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 8px 16px; border-bottom: 2px solid var(--ink); padding-bottom: 10px; }
.section-head h1, .section-head h2 { font-size: clamp(24px, 5vw, 30px); }

/* 挑戦 */
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 20px; background: var(--btn); color: #fff; border: 0; border-radius: 4px; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.button:hover { background: var(--btn-hover); color: #fff; }
.button[disabled] { opacity: .55; cursor: progress; }
.button.danger { background: var(--btn-dark); }
.challenge-form { display: flex; flex-direction: column; gap: 10px; }
.field-label { font-weight: 700; }
textarea, input:not([type]) , input[type="text"] { width: 100%; font: inherit; font-size: 17px; line-height: 1.7; color: var(--ink); background: var(--paper); border: 1px solid var(--ink); border-radius: 4px; padding: 10px 12px; }
textarea { resize: vertical; min-height: 96px; }
.form-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 16px; }
.invite-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.invite-form input { flex: 1 1 200px; width: auto; }
.error { color: var(--shu); font-weight: 700; margin: 0; }
.error-text { color: var(--shu); font-weight: 700; }
.notice { color: var(--ok); font-weight: 700; margin: 0; }

/* 段階表示 */
.reveal-card { display: flex; flex-direction: column; }
.reveal-card > * { padding: 18px 20px; border-bottom: 1px solid var(--rule); }
.reveal-card > :last-child { border-bottom: 0; }
.reveal-head { font-size: 17px; }
.reveal-head .vs { color: var(--muted); font-size: 14px; display: block; }
.judging { color: var(--muted); }
.judging::after { content: ""; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.2s steps(4, end) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "・"; } 50% { content: "・・"; } 75% { content: "・・・"; } }
.step-label { font-family: var(--font-body); font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .3em; margin: 0 0 8px; }
.narration { margin: 0; font-size: 17px; line-height: 1.9; white-space: pre-wrap; }
.loser-ability { margin: 0; font-size: 19px; line-height: 1.8; border-left: 3px solid var(--ink); padding-left: 16px; overflow-wrap: anywhere; white-space: pre-wrap; }
.loser-name { margin: 0 0 6px; }
.result-card { display: flex; flex-direction: column; gap: 6px; border-left: 8px solid var(--gold) !important; }
.result-card.usurp { border-left-color: var(--shu) !important; }
.result-title { font-family: var(--font-display); font-weight: 700; font-size: 24px; }
.result-meta { display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: 15px; }
.leak-card { background: var(--shu-soft); }
.leak-card h3 { font-size: 20px; color: var(--shu); margin-bottom: 6px; }
.leak-card ul { margin: 6px 0; padding-left: 20px; }
.reveal-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; }
.step-in { animation: step-in .35s ease-out; }
@keyframes step-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .step-in, .judging::after { animation: none; } }

/* 裁定記録 */
.records { list-style: none; margin: 0; padding: 0; }
.record-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px 20px; padding: 16px 0; border-bottom: 1px solid var(--rule); color: var(--ink); text-decoration: none; }
.record-row:hover { color: var(--ink); background: var(--sheet-2); }
.rec-no { flex: 0 0 132px; display: flex; flex-direction: column; }
.rec-result { flex: 0 0 auto; min-width: 150px; display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.rec-body { flex: 999 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rec-ability { font-size: 17px; overflow-wrap: anywhere; }
.bar { display: inline-block; width: 10px; height: 20px; flex: none; }
.bar-defense { background: var(--gold); }
.bar-usurp { background: var(--shu); }
.bar-draw { background: var(--gray); }
.stamp { flex: none; width: 40px; height: 40px; border: 2px solid var(--shu); border-radius: 4px; color: var(--shu); font-family: var(--font-display); font-weight: 700; font-size: 20px; display: inline-flex; align-items: center; justify-content: center; }
@media (max-width: 719px) {
  .record-row { position: relative; padding-right: 52px; }
  .record-row .stamp { position: absolute; right: 0; top: 16px; }
  .rec-no { flex-basis: auto; flex-direction: row; gap: 10px; align-items: baseline; }
}
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--ink-2); }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 8px; }
.crumbs { color: var(--muted); }

.record { display: flex; flex-direction: column; }
.record > * { padding: 22px 24px; border-bottom: 1px solid var(--rule); }
.record > :last-child { border-bottom: 0; }
@media (min-width: 720px) { .record > * { padding: 28px 36px; } }
.record-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; border-bottom-color: var(--ink) !important; }
.record-no { font-family: var(--font-mono); font-weight: 500; font-size: clamp(32px, 8vw, 44px); line-height: 1.1; }
.record-verdict { display: flex; align-items: center; gap: 16px; }
.judged { width: 76px; height: 76px; border: 3px solid var(--shu); border-radius: 6px; color: var(--shu); font-family: var(--font-display); font-weight: 700; font-size: 20px; line-height: 1.2; display: flex; align-items: center; justify-content: center; text-align: center; transform: rotate(-5deg); }
.parties { margin: 0; display: flex; flex-wrap: wrap; gap: 12px 40px; }
.parties dt { font-size: 13px; color: var(--muted); }
.parties dd { margin: 0; }
.party-name { font-family: var(--font-display); font-weight: 700; font-size: 24px; overflow-wrap: anywhere; }
.verdict-text { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: clamp(20px, 4.5vw, 26px); line-height: 1.6; }
.loser-block { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: flex-start; }
.loser-main { flex: 999 1 360px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.stamp-with-name { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; }

/* 文章ページ */
.prose { max-width: 760px; }
.prose h1 { font-size: clamp(28px, 6vw, 36px); margin-bottom: 20px; }
.prose h2 { font-size: 22px; margin: 32px 0 8px; border-bottom: 1px solid var(--rule); padding-bottom: 6px; }
.prose h3 { font-size: 18px; margin: 24px 0 6px; }
.prose ul { padding-left: 22px; }
.prose code { font-family: var(--font-mono); font-size: 14px; background: var(--sheet); border: 1px solid var(--rule); border-radius: 3px; padding: 0 4px; }
.message { max-width: 640px; }
.message h1 { font-size: 26px; margin-bottom: 10px; }

/* 管理 */
.stat-row { display: flex; flex-wrap: wrap; gap: 6px 28px; margin: 0 0 6px; font-size: 16px; }
.table-box { overflow-x: auto; border: 1px solid var(--rule); border-radius: 4px; background: var(--sheet); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { background: var(--sheet-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }

/* フッター */
.site-footer { border-top: 2px solid var(--ink); }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 32px; padding-block: 24px 40px; font-size: 13px; line-height: 1.8; color: var(--muted); }
.footer-row > span:first-child { flex: 1 1 380px; min-width: 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 16px; }

/* 裁定中の挑戦（観戦用） */
.live-banner { flex: 1 1 100%; border: 1px solid var(--shu); background: var(--shu-soft); border-radius: 4px; padding: 10px 16px; }
.live-banner p { margin: 0; }

/* 書き方のヒント */
.hints { border-top: 1px solid var(--rule); padding-top: 10px; }
.hints summary { cursor: pointer; font-weight: 700; color: var(--shu); min-height: 32px; }
.hints ul { margin: 8px 0 0; padding-left: 20px; font-size: 14px; }

/* マイページ */
.stat-grid { margin: 0; display: flex; flex-wrap: wrap; gap: 12px 40px; }
.stat-grid dt { font-size: 13px; color: var(--muted); }
.stat-grid dd { margin: 0; font-size: 20px; }

/* 番付・歴代王者 */
table.ranking tr.me td { background: var(--shu-soft); }
.reigns { list-style: none; margin: 0; padding: 0; }
.reign { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 18px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.gen { flex: 0 0 72px; color: var(--muted); }
.reign-name { font-family: var(--font-display); font-weight: 700; font-size: 20px; overflow-wrap: anywhere; }
.reign-meta { font-size: 14px; }
.reign-end { flex: 1 1 100%; color: var(--muted); padding-left: 90px; }
@media (max-width: 719px) { .reign-end { padding-left: 0; } }
.title-chip { display: inline-block; border: 1px solid var(--shu); color: var(--shu); border-radius: 3px; font-family: var(--font-body); font-size: 12px; padding: 0 6px; vertical-align: 3px; }
table.ranking td, table.ranking th { white-space: nowrap; }
@media (max-width: 719px) { table.ranking td, table.ranking th { padding: 10px 8px; } }

/* 記録の行：引用は敗者の能力文であることを明示する */
.loser-label { color: var(--muted); display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.cat-chip { display: inline-block; border: 1px solid var(--shu); color: var(--shu); border-radius: 3px; font-size: 12px; padding: 0 6px; line-height: 1.6; }
.you { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 3px; padding: 0 6px; margin-left: 4px; line-height: 1.7; }
.you-win { background: var(--btn); color: #fff; }
.you-lose { border: 1px solid var(--faint); color: var(--muted); }
.rec-result { flex-wrap: wrap; }

/* 自分の能力（本人にだけ表示） */
.my-ability { border: 1px dashed var(--shu); border-radius: 4px; padding: 12px 16px; background: var(--sheet); }
.my-ability .loser-ability { margin-top: 6px; }
