/* 明朝はしっぽり明朝（OFL、docs/licenses）を HP の字だけに絞って同梱（D565、tools/fonts/subset_mincho.py） */
@font-face { font-family: "Haten Mincho"; src: url('/home-assets/mincho-home-400.woff2') format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Haten Mincho"; src: url('/home-assets/mincho-home-600.woff2') format("woff2"); font-weight: 600; font-display: swap; }
/* HP: 原作の絵（8 キャラの立ち絵・ゲームの景色。tools/convert/home_art.py）を主役にした暗い画面。
   原作のキャラ選択の画面と同じく、黒地の立ち絵を暗い地に置く。角はすべて直角 */
:root {
  color-scheme: dark;
  --ink: #ece4d2;
  --ink-soft: #c7bda8;
  --muted: #968d7a;
  --paper: #14110d;
  --paper-deep: #2a251e;
  --panel: #1c1813;
  --line: #3b342a;
  --bronze: #8a7148;
  --vermilion: #c2493a;
  --vermilion-deep: #8e2c20;
  --serif: "Haten Mincho", "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "Noto Serif JP", "MS PMincho", serif;
  --sans: "Yu Gothic", "YuGothic", "Hiragino Sans", "Meiryo", sans-serif;
  --gutter: clamp(16px, 3vw, 48px);
  --ease: cubic-bezier(.2, .7, .1, 1);
}
* { box-sizing: border-box; border-radius: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body { margin: 0; color: var(--ink); background: var(--paper) url('/home-assets/paper.webp') repeat; background-blend-mode: multiply; font-family: var(--sans); font-size: 14px; line-height: 1.8; }
a { color: inherit; text-underline-offset: 5px; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
:focus-visible { outline: 2px solid var(--vermilion); outline-offset: 3px; }
h1, h2, p, dl, dd, ol, ul { margin: 0; }
.hidden { display: none !important; }
.small { color: var(--muted); font-size: 11px; line-height: 1.7; }
.skip-link { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip-link:focus { position: fixed; top: 8px; left: 12px; z-index: 50; width: auto; height: auto; clip-path: none; padding: 8px 16px; background: var(--paper); }
/* 墨書きのロゴは黒い字なので、暗い地では白抜きにする */
.brand img, .hero-logo { filter: invert(1) sepia(.25) brightness(.95); }

/* 見出し帯: 左にロゴ、右にログインの状態と朱印の GAME START。画面の上に固定 */
.site-head { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 28px; height: 64px; padding: 0 var(--gutter); background: rgb(14 12 9 / 94%); border-bottom: 1px solid var(--bronze); backdrop-filter: blur(6px); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { width: 112px; height: auto; }
.brand span { font-family: var(--serif); font-size: 12px; font-weight: 600; letter-spacing: .3em; writing-mode: vertical-rl; line-height: 1; padding-left: 10px; border-left: 1px solid var(--bronze); color: var(--ink-soft); }
.menu { display: flex; gap: 32px; margin-left: auto; }
.menu a { position: relative; font-family: var(--serif); font-size: 14px; font-weight: 600; letter-spacing: .06em; text-decoration: none; padding: 6px 0; color: var(--ink-soft); transition: color .3s; }
.menu a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--vermilion); transform: scaleX(0); transform-origin: right; transition: transform .5s var(--ease); }
.menu a:hover { color: var(--ink); }
.menu a:hover::after { transform: scaleX(1); transform-origin: left; }
.head-account { font-size: 12px; text-decoration: none; padding: 6px 14px; border: 1px solid var(--bronze); white-space: nowrap; transition: background .3s, color .3s; }
.head-account:hover { background: var(--bronze); color: var(--paper); }
.menu-btn { display: none; }

/* 朱印の GAME START（WO-065）。押した時の印を重ねておき、触れると浮かび上がらせる */
.seal { position: relative; display: grid; place-items: center; flex-shrink: 0; width: 132px; aspect-ratio: 1; padding: 0; border: 0; color: #fbf3e4; background: url('/home-assets/seal-start.webp') center / contain no-repeat; transition: transform .45s var(--ease); }
.seal::before { content: ""; position: absolute; inset: 0; background: url('/home-assets/seal-start-press.webp') center / contain no-repeat; opacity: 0; transition: opacity .35s var(--ease); }
.seal span { position: relative; font-family: Georgia, var(--serif); font-size: 21px; line-height: 1.15; letter-spacing: .12em; text-align: center; text-shadow: 0 0 1px rgb(90 20 12 / 60%); }
.seal:hover, .seal:focus-visible { transform: scale(.965); }
.seal:hover::before, .seal:focus-visible::before { opacity: 1; }
.seal:active { transform: scale(.93); transition-duration: .12s; }
.seal-small { width: 52px; }
.seal-small span { font-size: 9px; letter-spacing: .06em; }

/* 舞台: 上に題字と 8 キャラ、右にログインの札。下にお知らせ・サーバーの様子・ランキング */
.stage { position: relative; }
.hero { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 340px); align-items: stretch; gap: var(--gutter); padding: 28px var(--gutter) 0; overflow: hidden; isolation: isolate; border-bottom: 1px solid var(--bronze); }
/* 背景は原作のゲーム画面（sc_0062 の世界の部分をぼかしたもの）を暗く沈めて敷く */
.hero-art { position: absolute; inset: -24px; z-index: -1; background: linear-gradient(180deg, rgb(14 12 9 / 78%), rgb(14 12 9 / 88%) 60%, rgb(14 12 9 / 97%)), url('/home-assets/scene.webp') center / cover no-repeat; transform: translate3d(var(--px, 0), var(--py, 0), 0) scale(1.04); transition: transform 1.2s var(--ease); animation: drift 9s var(--ease) backwards; }
.hero-main { display: flex; flex-direction: column; min-width: 0; }
.hero-title { display: flex; align-items: flex-end; gap: 18px; }
.hero-logo { width: clamp(260px, 26vw, 400px); height: auto; animation: brush 1.6s var(--ease) .2s both; }
.hero-sub { padding-bottom: 14px; font-family: var(--serif); font-size: clamp(16px, 1.4vw, 21px); font-weight: 600; letter-spacing: .4em; color: var(--ink-soft); animation: rise 1.2s var(--ease) .9s both; }
.hero-lead { margin-top: 6px; font-family: var(--serif); font-size: 15px; color: var(--ink-soft); animation: rise 1.2s var(--ease) 1.1s both; }
/* 8 キャラの立ち絵（原作 login/tbit.031〜046。外側の黒地は透明にしてある）。
   普段は明るい絵で並べ、触れた時はそのキャラ以外が原作の「選んでいない」暗い絵に替わる（原作のキャラ選択の切り替え） */
.roster { list-style: none; display: flex; justify-content: center; margin-top: auto; padding: 0 0 0 60px; }
.roster li { position: relative; flex: 0 0 auto; width: 124px; height: 300px; outline-offset: -4px; }
.roster li:hover, .roster li:focus-visible { z-index: 1; }
.roster img { position: absolute; left: 50%; bottom: 22px; width: 252px; height: 280px; margin-left: -126px; transition: opacity .4s var(--ease), transform .5s var(--ease); pointer-events: none; }
.roster .dim { opacity: 0; }
.roster:hover li:not(:hover) .light, .roster:focus-within li:not(:focus-visible) .light { opacity: 0; }
.roster:hover li:not(:hover) .dim, .roster:focus-within li:not(:focus-visible) .dim { opacity: 1; }
.roster li:hover img, .roster li:focus-visible img { transform: translateY(-6px); }
.roster span { position: absolute; left: 0; right: 0; bottom: 0; text-align: center; font-family: var(--serif); font-size: 13px; font-weight: 600; color: var(--muted); transition: color .3s; }
.roster small { margin-left: 4px; font-size: 11px; color: var(--bronze); }
.roster li:hover span, .roster li:focus-visible span { color: var(--ink); }
.roster li:hover small, .roster li:focus-visible small { color: var(--vermilion); }
.roster li { animation: rise .9s var(--ease) both; }
.roster li:nth-child(1) { animation-delay: .5s; } .roster li:nth-child(2) { animation-delay: .56s; }
.roster li:nth-child(3) { animation-delay: .62s; } .roster li:nth-child(4) { animation-delay: .68s; }
.roster li:nth-child(5) { animation-delay: .74s; } .roster li:nth-child(6) { animation-delay: .8s; }
.roster li:nth-child(7) { animation-delay: .86s; } .roster li:nth-child(8) { animation-delay: .92s; }

/* ログインの札: 原作の窓のような青銅の縁の暗い札 */
.slip { position: relative; align-self: center; margin-bottom: 28px; padding: 20px 24px 18px; background: rgb(28 24 19 / 94%); border: 1px solid var(--bronze); box-shadow: inset 0 0 0 3px var(--panel), inset 0 0 0 4px rgb(138 113 72 / 45%); animation: rise 1s var(--ease) .6s both; }
.slip h2 { font-family: var(--serif); font-size: 21px; font-weight: 600; letter-spacing: .06em; line-height: 1.5; margin-bottom: 6px; overflow-wrap: anywhere; }
label { display: block; margin: 8px 0; font-size: 12px; font-weight: 600; color: var(--ink-soft); }
input { display: block; width: 100%; height: 38px; margin-top: 4px; padding: 0 10px; border: 1px solid var(--line); background: #0f0d0a; font-size: 16px; transition: border-color .3s; }
input:focus { outline: none; border-color: var(--vermilion); }
.btn { width: 100%; height: 40px; margin-top: 12px; border: 1px solid var(--bronze); background: var(--bronze); color: #15110c; font-family: var(--serif); font-weight: 600; letter-spacing: .2em; transition: background .3s, color .3s; }
.btn:hover { background: transparent; color: var(--ink); }
.btn.outline { background: transparent; color: var(--ink); }
.btn.outline:hover { background: var(--bronze); color: #15110c; }
.text-button { padding: 4px 0; border: 0; background: none; font-size: 12px; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 4px; }
.slip-links { display: flex; justify-content: space-between; margin: 6px 0 8px; }
.error { margin: 6px 0; font-size: 12px; color: #e0776a; overflow-wrap: anywhere; }
.error:empty { display: none; }
.points { display: flex; align-items: baseline; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.points dt { font-size: 12px; color: var(--muted); }
.points dd { font-family: Georgia, var(--serif); font-size: 28px; line-height: 1.2; color: #e2c27a; font-variant-numeric: tabular-nums; }
.points small { margin-left: 4px; font-size: 12px; color: var(--muted); }
.slip-head { margin-top: 10px; font-size: 12px; font-weight: 600; }
.characters { list-style: none; padding: 0; margin: 4px 0 8px; counter-reset: slot; }
.characters li { display: flex; align-items: baseline; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--line); counter-increment: slot; }
.characters li::before { content: counter(slot); width: 1em; font-family: Georgia, var(--serif); color: var(--muted); }
.characters li.selected::before { color: var(--vermilion); }
.characters .char-name { font-family: var(--serif); font-weight: 600; overflow-wrap: anywhere; }
.characters .small { margin-left: auto; white-space: nowrap; }
.characters li.empty-slot { color: var(--muted); }
.account-actions { display: flex; justify-content: space-between; margin-top: 4px; }
.slip-start { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.start-msg { text-align: center; font-size: 12px; font-weight: 600; color: #e0776a; }
.start-msg:empty { display: none; }

/* 下の段: お知らせ・サーバーの様子・ランキング */
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 0 var(--gutter); background: rgb(14 12 9 / 60%); }
.column { min-width: 0; padding: 16px clamp(16px, 2vw, 32px) 14px; border-left: 1px solid var(--line); animation: rise 1s var(--ease) .8s both; }
.column:first-child { border-left: 0; padding-left: 0; }
.column:last-child { padding-right: 0; }
.column h2 { display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px; padding-left: 10px; border-left: 3px solid var(--vermilion); font-family: var(--serif); font-size: 17px; font-weight: 600; line-height: 1.3; }
.column h2 small { margin-left: auto; font-family: var(--sans); font-size: 11px; font-weight: 400; color: var(--muted); }
.news-list { list-style: none; padding: 0; }
.news-list li { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); }
.news-list p { font-size: 12px; line-height: 1.65; color: var(--muted); }
.news-list span { display: block; }
.news-list b { display: block; font-family: var(--serif); font-size: 14px; color: var(--ink); }
.tag { align-self: start; margin-top: 2px; font-size: 10px; text-align: center; border: 1px solid var(--bronze); color: var(--ink-soft); line-height: 1.6; }
.tag.notice { color: #e0776a; border-color: var(--vermilion); }
.counts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.counts dt { font-size: 12px; color: var(--muted); }
.counts dd { font-family: Georgia, var(--serif); font-size: 34px; line-height: 1.15; font-variant-numeric: tabular-nums; }
/* サーバーの稼働状況: 稼働中は緑、つながらない時は朱 */
.server-state { display: flex; align-items: center; gap: 6px; }
.server-state b { font-weight: 600; color: var(--ink-soft); }
.server-state i { display: inline-block; width: 7px; height: 7px; background: var(--muted); }
.server-state.online i { background: #7fa25f; animation: pulse 2.4s ease-in-out infinite; }
.server-state.offline i { background: var(--vermilion); }
.server-state.offline b { color: #e0776a; }
.live-dot { display: inline-block; width: 6px; height: 6px; margin-right: 6px; background: #7fa25f; vertical-align: middle; animation: pulse 2.4s ease-in-out infinite; }
.ratio { display: flex; height: 8px; margin: 12px 0 8px; background: var(--paper-deep); }
.ratio i { display: block; height: 100%; transform-origin: left; animation: grow 1.2s var(--ease) both; }
.legend { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 10px; font-size: 11px; line-height: 1.9; color: var(--ink-soft); }
.legend li { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.legend i { display: inline-block; width: 6px; height: 6px; flex-shrink: 0; }
.legend span { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--muted); }
.banzuke { list-style: none; padding: 0; }
.banzuke li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto 44px; align-items: baseline; gap: 8px; padding: 5px 0; border-top: 1px solid var(--line); font-size: 13px; }
.banzuke .rank { font-family: Georgia, var(--serif); font-size: 15px; text-align: center; color: var(--muted); }
.banzuke li:nth-child(-n+3) .rank { color: #e2c27a; }
.banzuke .who { font-family: var(--serif); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.banzuke .what { color: var(--muted); font-size: 11px; }
.banzuke .lv { text-align: right; font-family: Georgia, var(--serif); font-variant-numeric: tabular-nums; }
.banzuke .empty { display: block; padding: 14px 0; color: var(--muted); }
footer { padding: 8px var(--gutter); border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); text-align: right; }

dialog { width: min(440px, calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--bronze); color: var(--ink); background: var(--panel); overflow-y: auto; }
dialog::backdrop { background: rgb(6 5 4 / 78%); }
.modal { position: relative; padding: 28px; }
.modal .eyebrow { display: none; }
.modal h2 { margin: 2px 40px 14px 0; padding-left: 10px; border-left: 3px solid var(--vermilion); font-family: var(--serif); font-size: 21px; font-weight: 600; }
.modal-close { position: absolute; right: 10px; top: 8px; width: 44px; height: 44px; padding: 0; border: 0; background: none; font-size: 26px; color: var(--ink-soft); }
.recovery-warning { margin-top: 10px; font-size: 12px; color: #e0776a; }
.recovery { margin: 12px 0; padding: 14px 8px; border: 1px solid var(--bronze); font-family: monospace; font-size: 21px; text-align: center; overflow-wrap: anywhere; user-select: all; }

@keyframes drift { from { transform: translate3d(0, 0, 0) scale(1.12); } }
@keyframes brush { from { clip-path: inset(0 100% 0 0); filter: invert(1) sepia(.25) brightness(.95) blur(6px); opacity: .2; } 60% { opacity: 1; } to { clip-path: inset(0 0 0 0); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes pulse { 50% { opacity: .3; } }
/* GAME START を押した瞬間の朱のにじみ（WO-065 の seal-splash） */
.seal-splash { position: fixed; z-index: 60; width: 360px; height: 360px; margin: -180px 0 0 -180px; pointer-events: none; background: url('/home-assets/seal-splash.webp') center / contain no-repeat; animation: splash .9s var(--ease) forwards; }
@keyframes splash { from { opacity: .95; transform: scale(.25) rotate(-8deg); } 55% { opacity: .85; } to { opacity: 0; transform: scale(1.25) rotate(4deg); } }

/* 広くて高さもある画面: 1 画面に収める */
@media (min-width: 1024px) and (min-height: 660px) {
  body { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100dvh; overflow: hidden; }
  .stage { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-height: 0; }
  .hero { min-height: 0; }
  .slip > section > .small { display: none; }
  footer { padding-block: 4px; }
  .banzuke li:nth-child(n+6) { display: none; }
}
/* 高さの低い画面（720px 前後） */
@media (min-width: 1024px) and (min-height: 660px) and (max-height: 819.98px) {
  .hero { padding-top: 16px; }
  .hero-logo { width: clamp(220px, 20vw, 300px); }
  .hero-lead, .legend, .news-list p span { display: none; }
  .roster li { width: 104px; height: 236px; }
  .roster img { width: 194px; height: 216px; margin-left: -97px; }
  .slip { margin-bottom: 16px; padding-block: 14px 12px; }
  .slip-start { margin-top: 8px; padding-top: 10px; }
  .news-list li:nth-child(3), .banzuke li:nth-child(n+5) { display: none; }
  label { margin: 4px 0; }
  input { height: 32px; }
  .btn { height: 36px; margin-top: 8px; }
  .slip-links { margin: 4px 0 2px; }
  .seal:not(.seal-small) { width: 88px; }
  .seal:not(.seal-small) span { font-size: 14px; }
  .column { padding-block: 10px 8px; }
  .slip h2 { font-size: 18px; margin-bottom: 2px; }
  .points { padding-block: 2px; }
  .points dd { font-size: 22px; }
  .slip-head { margin-top: 4px; }
  .characters { margin-block: 2px 4px; }
  .characters li { padding-block: 2px; }
}
/* 狭い画面: 上から 題字と 8 キャラ → ログインの札 → お知らせ・サーバーの様子・ランキング */
@media (max-width: 1023.98px), (max-height: 659.98px) {
  .hero { grid-template-columns: minmax(0, 1fr); justify-items: center; padding: 28px var(--gutter) 32px; }
  .hero-main { align-items: center; width: 100%; }
  .roster { flex-wrap: wrap; width: 100%; max-width: 760px; padding: 0; margin-top: 16px; }
  .slip { width: min(100%, 440px); margin-bottom: 0; }
  .board { grid-template-columns: minmax(0, 1fr); }
  .column, .column:first-child, .column:last-child { padding: 20px 0; border-left: 0; border-top: 1px solid var(--line); }
  .column:first-child { border-top: 0; }
}
@media (max-width: 760px) {
  .site-head { gap: 12px; height: 60px; }
  .brand img { width: 92px; }
  .head-account { display: none; }
  .menu-btn { display: grid; gap: 6px; order: 3; width: 44px; height: 44px; place-content: center; margin-left: auto; padding: 0; border: 0; background: none; }
  .menu-btn span { display: block; width: 22px; height: 1px; background: var(--ink); transition: transform .3s var(--ease); }
  .site-head.open .menu-btn span:first-child { transform: translateY(3.5px) rotate(20deg); }
  .site-head.open .menu-btn span:last-child { transform: translateY(-3.5px) rotate(-20deg); }
  .seal-small { order: 4; }
  .menu { position: absolute; top: 100%; left: 0; right: 0; display: none; flex-direction: column; gap: 0; padding: 4px var(--gutter) 12px; background: var(--paper); border-bottom: 1px solid var(--bronze); }
  .site-head.open .menu { display: flex; }
  .menu a { padding: 14px 0; border-bottom: 1px solid var(--line); }
  .hero-title { flex-direction: column; align-items: center; gap: 0; }
  .hero-sub { padding-bottom: 0; }
  .hero-lead { text-align: center; font-size: 13px; }
  /* スマホでは 4 人ずつ 2 段に並べる */
  .roster li { width: 25%; height: 150px; }
  .roster img { width: 126px; height: 140px; margin-left: -63px; bottom: 18px; }
  .roster span { font-size: 11px; }
  .roster small { display: none; }
  .seal:not(.seal-small) { width: 112px; }
  input { height: 44px; }
  .btn { height: 46px; }
  .text-button { min-height: 44px; }
  .legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
