/* だるま落とし一閃: 夕方の神社の境内。墨・生成り・朱・藍・金。 */
:root {
  --sumi: #2b2220;
  --sumi-soft: #5a4a42;
  --kinari: #f4ead6;
  --kinari-dark: #e6d8bb;
  --shu: #c8382a;
  --shu-dark: #9c2a1f;
  --ai: #2a4f86;
  --kin: #d8a93a;
  --bg: #2a211c;
  --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(--kinari);
  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: #3a3a48;
  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(--kinari); 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,.45), 0 0 6px rgba(0,0,0,.35); }
.hud-stage { font-size: 15px; font-weight: 600; letter-spacing: .06em; }
.hud-stage b { font-size: 20px; }
.hud-score { font-size: 15px; }
.hud-score b { font-size: 30px; font-weight: 800; line-height: 1.1; }
.snd {
  pointer-events: auto; border: 2px solid var(--kinari); background: rgba(43,34,32,.72); color: var(--kinari);
  font: 600 13px/1 var(--serif); padding: 9px 11px; border-radius: 6px; cursor: pointer; min-width: 58px;
}
.snd[aria-pressed="false"] { opacity: .6; }
.gauge { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; text-shadow: 0 1px 0 rgba(0,0,0,.45); }
.gauge-track {
  flex: 1; max-width: 200px; height: 10px; border: 2px solid var(--kinari); border-radius: 3px;
  background: rgba(43,34,32,.6); overflow: hidden; position: relative;
}
.gauge-track i { display: block; height: 100%; width: 0; background: #7fae6a; transition: background-color .2s; }
.gauge-track i.warn { background: var(--kin); }
.gauge-track i.danger { background: var(--shu); }
.gauge-end { opacity: .8; }

/* ---- メーター ---- */
.meter-wrap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 0 16px calc(env(safe-area-inset-bottom) + 22px);
  pointer-events: none;
}
.meter-wrap[hidden] { display: none; }
.hint {
  text-align: center; font-size: 13px; line-height: 1.6; margin-bottom: 10px; color: var(--kinari);
  background: rgba(43,34,32,.78); border: 1px solid var(--kinari-dark); border-radius: 6px; padding: 7px 10px;
}
.hint.gone { display: none; }
.meter { display: flex; align-items: center; gap: 8px; font-family: var(--serif); font-weight: 800; font-size: 16px; text-shadow: 0 1px 0 rgba(0,0,0,.5); }
.m-bar {
  position: relative; flex: 1; height: 26px; background: var(--kinari-dark); border: 3px solid var(--sumi);
  border-radius: 5px; box-shadow: 0 0 0 2px var(--kinari);
}
.m-band { position: absolute; top: 0; bottom: 0; background: var(--kin); }
.m-center { position: absolute; top: 0; bottom: 0; background: var(--shu); }
.m-ptr {
  position: absolute; top: -9px; bottom: -9px; width: 6px; margin-left: -3px; background: var(--sumi);
  border: 2px solid var(--kinari); border-radius: 3px; left: 0;
}

/* ---- トースト・一閃の斬撃 ---- */
.toast {
  position: absolute; left: 0; right: 0; top: 26%; text-align: center; pointer-events: none;
  font-family: var(--serif); font-weight: 800; font-size: 44px; color: var(--kinari); opacity: 0;
  text-shadow: 0 3px 0 var(--sumi), 2px 0 0 var(--sumi), -2px 0 0 var(--sumi), 0 -2px 0 var(--sumi);
  letter-spacing: .08em;
}
.toast.issen { color: #fff; font-size: 64px; text-shadow: 0 4px 0 var(--shu), 3px 0 0 var(--shu), -3px 0 0 var(--shu), 0 -3px 0 var(--shu); }
.toast.bad { font-size: 30px; color: #f0d6b0; }
.toast.clear { font-size: 36px; color: #ffe29a; }
.toast.show { animation: pop 1.1s ease-out forwards; }
@keyframes pop {
  0% { opacity: 0; transform: scale(.6) translateY(10px); }
  14% { opacity: 1; transform: scale(1.12); }
  26% { transform: scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-14px); }
}
.slash { position: absolute; left: -10%; top: 38%; width: 120%; height: 4px; pointer-events: none; opacity: 0;
  background: linear-gradient(90deg, transparent, #fff 20%, #fff 80%, transparent); transform: rotate(-16deg) scaleX(0); }
.slash.show { animation: slash .5s ease-out forwards; }
@keyframes slash {
  0% { opacity: 1; transform: rotate(-16deg) scaleX(0); }
  30% { opacity: 1; transform: rotate(-16deg) scaleX(1); }
  100% { opacity: 0; transform: rotate(-16deg) scaleX(1) scaleY(.2); }
}

/* ---- オーバーレイ（タイトル・結果） ---- */
.overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 18px;
  background: rgba(30,22,18,.28); 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); }
.paper {
  width: 100%; max-width: 380px; text-align: center; color: var(--sumi); background: var(--kinari);
  border: 3px solid var(--sumi); border-radius: 8px; box-shadow: 0 0 0 3px var(--kinari), 0 8px 24px rgba(0,0,0,.4);
  padding: 20px 20px 16px; 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: 36px; 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(--kinari); 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-score { margin: 2px 0 0; line-height: 1.1; }
.r-score b { font-size: 64px; font-weight: 800; color: var(--shu); }
.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: 8px 0 14px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; text-align: left; }
.r-list div { display: flex; justify-content: space-between; border-bottom: 1px solid var(--kinari-dark); padding: 2px 2px; font-size: 14px; }
.r-list dt { color: var(--sumi-soft); } .r-list dd { margin: 0; font-weight: 800; }
.r-best { margin: -4px 0 14px; font-size: 14px; color: var(--sumi-soft); }
.r-best b { color: var(--sumi); font-weight: 800; }
.r-sub { display: flex; gap: 10px; margin-top: 12px; }
.btn-sub {
  flex: 1; padding: 11px 6px; border: 2px solid var(--sumi); border-radius: 6px; background: var(--kinari);
  color: var(--sumi); font: 800 15px/1.2 var(--serif); cursor: pointer;
}
.btn-sub:active { background: var(--kinari-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: #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(--shu); 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 #5a4a42; padding: 7px 9px; text-align: left; }
.page th { background: #3b2f29; }
.page dt { font-weight: 800; margin-top: 14px; color: #f0c987; }
.page dd { margin: 4px 0 0; }
.policy nav { background: #33281f; border: 1px solid #5a4a42; 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 #4a3c34; font-size: 13px; }
.foot-copy { flex-basis: 100%; margin: 4px 0 0; color: #b9a891; font-size: 12px; }
body.doc { background: var(--bg); }

@media (min-width: 700px) {
  #stage { box-shadow: 0 0 0 1px #4a3c34, 0 0 40px rgba(0,0,0,.5); }
}
@media (prefers-reduced-motion: reduce) {
  .toast.show, .slash.show { animation-duration: .01s; }
}
