/* 雷さま太鼓: 夜の雲の上。群青・雲の白・朱・金。 */
:root {
  --yoru: #1b2230;
  --sumi: #141a26;
  --sumi-soft: #46526a;
  --kumo: #e8edf4;
  --kumo-dark: #c3ccdb;
  --shu: #b8392b;
  --shu-dark: #8c2a1f;
  --ai: #34568a;
  --kin: #e0b84a;
  --bg: #1b2230;
  --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(--kumo);
  font-family: 'Hiragino Sans', 'Yu Gothic', 'Meiryo', sans-serif; line-height: 1.8;
  -webkit-tap-highlight-color: transparent;
}
a { color: #f1d68a; }
button { font-family: inherit; }

/* ---- ステージ ---- */
#stage {
  position: relative; height: 100vh; height: 100svh; min-height: 520px;
  max-width: 480px; margin: 0 auto; overflow: hidden; background: #1b2230;
  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; z-index: 4; color: var(--kumo); font-family: var(--serif);
  text-shadow: 0 1px 0 rgba(0,0,0,.55), 0 0 8px rgba(0,0,0,.5);
}
.hud[hidden] { display: none; }
.hud-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.hud-time { font-size: 15px; font-weight: 600; letter-spacing: .06em; }
.hud-time b { font-size: 40px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.hud-time.low b { color: #ffd8a0; }
.hud-nums { margin-top: 2px; display: flex; flex-wrap: wrap; gap: 0 14px; font-size: 14px; }
.hud-nums b { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.hud-nums .sub { font-size: 13px; opacity: .9; }
.hud-nums .sub b { font-size: 15px; }
.snd {
  pointer-events: auto; border: 2px solid var(--kumo); background: rgba(20,26,38,.72); color: var(--kumo);
  font: 600 13px/1 var(--serif); padding: 9px 11px; border-radius: 6px; cursor: pointer; min-width: 58px;
}
.snd[aria-pressed="false"] { opacity: .6; }
.stage-line { margin-top: 6px; display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 800; letter-spacing: .08em; }
.pips { display: flex; gap: 4px; }
.pips i { width: 16px; height: 8px; border-radius: 2px; background: rgba(232,237,244,.22); border: 1px solid rgba(232,237,244,.5); }
.pips i.on { background: var(--kin); border-color: #fff3c4; }

/* ---- テロップ・光 ---- */
.telop {
  position: absolute; left: 0; right: 0; top: 40%; text-align: center; pointer-events: none; opacity: 0;
  font-family: var(--serif); font-weight: 800; color: var(--kumo);
  text-shadow: 0 3px 0 var(--sumi), 2px 0 0 var(--sumi), -2px 0 0 var(--sumi), 0 -2px 0 var(--sumi), 0 0 18px rgba(0,0,0,.6);
}
.telop b { display: block; font-size: 60px; line-height: 1.15; letter-spacing: .12em; text-indent: .12em; }
.telop span { display: block; font-size: 16px; letter-spacing: .08em; margin-top: 2px; }
.telop.s5 b { color: #fff6cf; }
.telop.show { animation: telop 1.7s ease-out forwards; }
@keyframes telop {
  0% { opacity: 0; transform: scale(.7); }
  12% { opacity: 1; transform: scale(1.1); }
  22% { transform: scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-12px); }
}
.flash { position: absolute; inset: 0; background: #f4f7ff; opacity: 0; pointer-events: none; z-index: 3; }
.start-hint {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 0 22px calc(env(safe-area-inset-bottom) + 34px);
  text-align: center; pointer-events: none; font-family: var(--serif);
}
.start-hint[hidden] { display: none; }
.start-hint b { display: inline-block; font-size: 24px; font-weight: 800; letter-spacing: .08em; background: rgba(20,26,38,.8); border: 2px solid var(--kumo); border-radius: 8px; padding: 10px 18px; animation: nudge 1.1s ease-in-out infinite; }
.start-hint p { margin: 10px auto 0; max-width: 300px; font-size: 13px; line-height: 1.6; background: rgba(20,26,38,.78); border-radius: 6px; padding: 6px 10px; }
.start-hint p.gone { display: none; }
@keyframes nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* ---- オーバーレイ（タイトル・結果） ---- */
.overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 18px;
  background: rgba(14,18,28,.22); 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: 12px 12px calc(env(safe-area-inset-bottom) + 12px); background: none; pointer-events: none; }
.result .paper { pointer-events: auto; }
.paper {
  width: 100%; max-width: 380px; text-align: center; color: var(--sumi); background: var(--kumo);
  border: 3px solid var(--sumi); border-radius: 8px; box-shadow: 0 0 0 3px var(--kumo), 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(--shu-dark); font-weight: 600; }
.paper h1 { margin: 2px 0 8px; font-size: 38px; line-height: 1.25; font-weight: 800; letter-spacing: .04em; }
.paper h1 span { color: var(--shu); 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: 14px; color: var(--sumi-soft); min-height: 1.4em; }
.btn-main {
  display: block; width: 100%; padding: 16px 12px; border: 3px solid var(--sumi); border-radius: 8px; cursor: pointer;
  background: var(--shu); color: var(--kumo); font: 800 24px/1 var(--serif); letter-spacing: .3em; text-indent: .3em;
  box-shadow: 0 4px 0 var(--shu-dark), 0 4px 0 3px var(--sumi);
}
.btn-main:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--shu-dark), 0 1px 0 3px var(--sumi); }
.scroll-link { display: inline-block; margin-top: 12px; font-size: 13px; color: var(--ai); font-family: sans-serif; }
.r-stage { margin: 0; font-size: 15px; font-weight: 800; color: var(--sumi); }
.r-stage b { color: var(--shu); font-size: 18px; }
.r-score { margin: 0; line-height: 1.1; }
.r-score b { font-size: 60px; font-weight: 800; color: var(--shu); font-variant-numeric: tabular-nums; }
.r-score small { font-size: 20px; margin-left: 4px; }
.r-new { margin: 2px auto 4px; display: inline-block; background: var(--kin); border: 2px solid var(--sumi); border-radius: 4px; padding: 2px 12px; font-weight: 800; font-size: 14px; }
.r-new[hidden] { display: none; }
.r-list { margin: 6px 0 8px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; text-align: left; }
.r-list div { display: flex; justify-content: space-between; border-bottom: 1px solid var(--kumo-dark); padding: 2px 2px; font-size: 14px; }
.r-list dt { color: var(--sumi-soft); } .r-list dd { margin: 0; font-weight: 800; }
.r-power { margin: 0 0 4px; font-size: 16px; font-weight: 800; }
.r-power b { color: var(--ai); font-size: 20px; }
.r-best { margin: 0 0 12px; font-size: 14px; color: var(--sumi-soft); }
.r-best b { color: var(--sumi); font-weight: 800; }
.r-sub { display: flex; gap: 10px; margin-top: 10px; }
.btn-sub {
  flex: 1; padding: 11px 6px; border: 2px solid var(--sumi); border-radius: 6px; background: var(--kumo);
  color: var(--sumi); font: 800 15px/1.2 var(--serif); cursor: pointer;
}
.btn-sub:active { background: var(--kumo-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: var(--ai); 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: #e6ecf5; }
.below h3, .page h2, .policy h2 { font-family: var(--serif); font-size: 19px; line-height: 1.5; margin: 30px 0 10px; color: #e6ecf5; border-left: 5px solid var(--kin); padding-left: 10px; }
.page h3 { font-size: 16px; margin: 20px 0 6px; color: #f1d68a; }
.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 #46526a; padding: 7px 9px; text-align: left; }
.page th { background: #2a3347; }
.page dt { font-weight: 800; margin-top: 14px; color: #f1d68a; }
.page dd { margin: 4px 0 0; }
.policy nav { background: #232c3f; border: 1px solid #46526a; 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 #394660; font-size: 13px; }
.foot-copy { flex-basis: 100%; margin: 4px 0 0; color: #9aa6bd; font-size: 12px; }
body.doc { background: var(--bg); }

@media (prefers-reduced-motion: reduce) {
  .telop.show { animation-duration: .01s; }
  .start-hint b { animation: none; }
}

@media (min-width: 700px) {
  #stage { box-shadow: 0 0 0 1px #394660, 0 0 40px rgba(0,0,0,.5); }
}

