/* 波紋れんさ: 夜の池。和紙・墨・夜の水・灯籠のあかり。 */
:root {
  --sumi: #1d2433;
  --sumi-soft: #4a5468;
  --washi: #f1e6cf;
  --washi-dark: #ddcfb0;
  --akari: #d98a2b;
  --akari-dark: #a8651a;
  --mizu: #7a9cc0;
  --bg: #0b1220;
  --serif: 'Shippori Mincho B1', 'Yu Mincho', 'Hiragino Mincho ProN', 'MS PMincho', serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--washi);
  font-family: 'Hiragino Sans', 'Yu Gothic', 'Meiryo', sans-serif; line-height: 1.8;
  -webkit-tap-highlight-color: transparent;
}
a { color: #f0c987; }
button { font-family: inherit; }

/* ---- ステージ ---- */
#stage {
  position: relative; height: 100vh; height: 100svh; min-height: 520px;
  max-width: 480px; margin: 0 auto; overflow: hidden; background: #0b1220;
  user-select: none; -webkit-user-select: none;
}
#c { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }

.hud {
  position: absolute; left: 0; right: 0; top: 0; padding: calc(env(safe-area-inset-top) + 10px) 14px 0;
  pointer-events: none; color: var(--washi); font-family: var(--serif);
}
.hud[hidden] { display: none; }
.hud-row { display: flex; justify-content: space-between; align-items: flex-start; }
.hud-main { display: flex; flex-direction: column; text-shadow: 0 1px 0 rgba(0,0,0,.5), 0 0 8px rgba(0,0,0,.6); }
.hud-mode { font-size: 13px; letter-spacing: .08em; opacity: .85; }
.hud-count { font-size: 15px; line-height: 1.15; }
.hud-count b { font-size: 40px; font-weight: 800; }
.hud-count small { font-size: 15px; opacity: .8; }
.hud-stage { font-size: 15px; font-weight: 600; letter-spacing: .1em; color: #ffd98a; }
.snd {
  pointer-events: auto; border: 2px solid var(--washi); background: rgba(11,18,32,.7); color: var(--washi);
  font: 600 13px/1 var(--serif); padding: 9px 11px; border-radius: 6px; cursor: pointer; min-width: 58px;
}
.snd[aria-pressed="false"] { opacity: .6; }

.hint {
  position: absolute; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 22px); text-align: center;
  font-size: 13px; line-height: 1.6; color: var(--washi); pointer-events: none;
  background: rgba(11,18,32,.78); border: 1px solid #3b4a66; border-radius: 6px; padding: 8px 10px;
}
.hint[hidden] { display: none; }

/* ---- テロップ（段階の切り替わり） ---- */
.toast {
  position: absolute; left: 0; right: 0; top: 24%; text-align: center; pointer-events: none; opacity: 0;
  font-family: var(--serif); color: #fff3d6; display: flex; flex-direction: column; align-items: center; gap: 2px;
  text-shadow: 0 0 14px rgba(255,190,90,.7), 0 2px 0 rgba(0,0,0,.6);
}
.toast b { font-size: 52px; font-weight: 800; letter-spacing: .16em; text-indent: .16em; }
.toast small { font-size: 16px; letter-spacing: .12em; background: rgba(11,18,32,.6); padding: 2px 12px; border-radius: 4px; }
.toast.show { animation: pop 2.4s ease-out forwards; }
@keyframes pop {
  0% { opacity: 0; transform: scale(.85) translateY(8px); }
  15% { opacity: 1; transform: scale(1.04); }
  25% { transform: scale(1); }
  78% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-12px); }
}

/* ---- オーバーレイ（タイトル・結果） ---- */
.overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 18px;
  background: rgba(8,12,22,.25); touch-action: pan-y; z-index: 5;
}
.overlay[hidden] { display: none; }
.title { align-items: flex-end; padding-bottom: calc(env(safe-area-inset-bottom) + 28px); }
.result { align-items: flex-end; padding-bottom: calc(env(safe-area-inset-bottom) + 14px); background: linear-gradient(transparent 30%, rgba(8,12,22,.55)); overflow-y: auto; }
.paper {
  width: 100%; max-width: 380px; text-align: center; color: var(--sumi); background: var(--washi);
  border: 3px solid var(--sumi); border-radius: 8px; box-shadow: 0 0 0 3px var(--washi), 0 8px 24px rgba(0,0,0,.5);
  padding: 18px 20px 14px; font-family: var(--serif);
}
.kicker { margin: 0; font-size: 14px; letter-spacing: .12em; color: var(--akari-dark); font-weight: 600; }
.paper h1 { margin: 2px 0 8px; font-size: 40px; line-height: 1.25; font-weight: 800; letter-spacing: .06em; }
.paper h1 span { color: var(--akari); margin-left: 4px; }
.lead { margin: 0 0 8px; font-size: 14px; line-height: 1.8; font-weight: 600; }
.best-line { margin: 0 0 12px; font-size: 13px; color: var(--sumi-soft); min-height: 1.4em; line-height: 1.6; }
.btn-main {
  display: block; width: 100%; padding: 14px 12px; border: 3px solid var(--sumi); border-radius: 8px; cursor: pointer;
  background: var(--akari); color: #fff8e8; font: 800 24px/1.1 var(--serif); letter-spacing: .24em; text-indent: .24em;
  box-shadow: 0 4px 0 var(--akari-dark), 0 4px 0 3px var(--sumi);
}
.btn-main small { display: block; font-size: 13px; letter-spacing: .1em; text-indent: .1em; font-weight: 600; margin-top: 3px; }
.btn-main:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--akari-dark), 0 1px 0 3px var(--sumi); }
.btn-sub2 {
  display: block; width: 100%; margin-top: 12px; padding: 11px 8px; border: 2px solid var(--sumi); border-radius: 6px;
  background: var(--washi); color: var(--sumi); font: 800 16px/1.2 var(--serif); cursor: pointer;
}
.btn-sub2:active { background: var(--washi-dark); }
.scroll-link { display: inline-block; margin-top: 10px; font-size: 13px; color: #2a4f86; font-family: sans-serif; }
.r-score { margin: 2px 0 0; line-height: 1.1; }
.r-score b { font-size: 60px; font-weight: 800; color: var(--akari); }
.r-score small { font-size: 20px; margin-left: 4px; }
.r-stage { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: .14em; }
.r-new { margin: 4px auto 0; display: inline-block; background: #ffd98a; border: 2px solid var(--sumi); border-radius: 4px; padding: 1px 12px; font-weight: 800; font-size: 14px; }
.r-new[hidden] { display: none; }
.r-map { display: block; margin: 8px auto; width: 120px; height: 160px; border: 2px solid var(--sumi); border-radius: 6px; background: #0e1a2e; }
.r-best { margin: 0 0 10px; font-size: 13px; color: var(--sumi-soft); line-height: 1.6; }
.r-sub { display: flex; gap: 8px; margin-top: 10px; }
.btn-sub {
  flex: 1; padding: 10px 4px; border: 2px solid var(--sumi); border-radius: 6px; background: var(--washi);
  color: var(--sumi); font: 800 14px/1.2 var(--serif); cursor: pointer;
}
.btn-sub:active { background: var(--washi-dark); }
.copy-box { width: 100%; margin-top: 10px; font: 13px/1.5 sans-serif; padding: 6px; border: 1px solid var(--sumi); border-radius: 4px; resize: none; }
.copy-msg { margin: 6px 0 0; min-height: 1.3em; font-size: 12px; color: #2a4f86; font-family: sans-serif; }
.fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; background: var(--bg); z-index: 9; }
.fallback[hidden] { display: none; }

/* ---- ゲームの下の本文 ---- */
.below, .page, .policy { max-width: 720px; margin: 0 auto; padding: 36px 20px 28px; }
.below h2, .page h1, .policy h1 { font-family: var(--serif); font-size: 24px; line-height: 1.4; margin: 0 0 14px; color: #f6e2b8; }
.below h3, .page h2, .policy h2 { font-family: var(--serif); font-size: 19px; line-height: 1.5; margin: 30px 0 10px; color: #f6e2b8; border-left: 5px solid var(--akari); padding-left: 10px; }
.page h3 { font-size: 16px; margin: 20px 0 6px; color: #f0c987; }
.below p, .page p, .policy p, .below li, .page li, .policy li { font-size: 15px; }
.below ul, .page ul, .policy ul, .page ol, .policy ol { padding-left: 1.4em; }
.links { display: flex; flex-direction: column; gap: 6px; margin-top: 22px; }
.ad-box { margin: 28px 0 0; min-height: 40px; }
.page table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 14px; }
.page th, .page td { border: 1px solid #3b4a66; padding: 7px 9px; text-align: left; }
.page th { background: #16213a; }
.page dt { font-weight: 800; margin-top: 14px; color: #f0c987; }
.page dd { margin: 4px 0 0; }
.policy nav { background: #121c30; border: 1px solid #3b4a66; border-radius: 6px; padding: 8px 14px; margin: 16px 0; }
.site-foot { max-width: 720px; margin: 0 auto; padding: 18px 20px calc(env(safe-area-inset-bottom) + 28px); display: flex; flex-wrap: wrap; gap: 6px 18px; border-top: 1px solid #26324a; font-size: 13px; }
.foot-copy { flex-basis: 100%; margin: 4px 0 0; color: #93a0b8; font-size: 12px; }
body.doc { background: var(--bg); }

@media (min-width: 700px) {
  #stage { box-shadow: 0 0 0 1px #26324a, 0 0 40px rgba(0,0,0,.5); }
}
@media (prefers-reduced-motion: reduce) {
  .toast.show { animation-duration: .01s; animation-fill-mode: forwards; }
}
@media (max-height: 640px) {
  .r-map { display: none; }
}
