*{margin:0;padding:0;box-sizing:border-box;-webkit-tap-highlight-color:transparent;
  -webkit-touch-callout:none;-webkit-user-select:none;user-select:none;touch-action:none}
html,body{width:100%;height:100%;overflow:hidden;overscroll-behavior:none;background:#0d1420;
  font-family:"Hiragino Kaku Gothic ProN","Yu Gothic",system-ui,sans-serif;
  color:#f2ead8;touch-action:none;user-select:none;position:fixed}
#safe-area-probe{position:fixed;left:0;top:0;width:1px;height:1px;
  --safe-top:env(safe-area-inset-top);--safe-bottom:env(safe-area-inset-bottom);
  visibility:hidden;pointer-events:none}

/* ハーネス契約: 上75% #game-stage / 下25% #control-deck。重ならない */
#game-shell{position:fixed;inset:0;width:100%;height:100%;height:100dvh;
  display:flex;flex-direction:column;touch-action:none}
#game-stage{position:relative;flex:0 0 75%;height:75%;min-height:0}
#screen-wrap{position:absolute;inset:0;overflow:hidden;background:#0d1420}
#c{display:block;position:absolute;inset:0;z-index:0;width:100%;height:100%;touch-action:none}
#control-deck{position:relative;flex:0 0 25%;height:25%;
  display:flex;align-items:center;gap:10px;
  padding:8px 12px max(8px,env(safe-area-inset-bottom,8px)) 12px;
  padding-left:max(12px,calc(12px + env(safe-area-inset-left,0px)));
  padding-right:max(12px,calc(12px + env(safe-area-inset-right,0px)));
  background:linear-gradient(180deg,#142033 0%,#0a1018 100%);
  border-top:1px solid rgba(242,234,216,.16);overflow:hidden;touch-action:none}
.deck-tools{display:flex;flex-direction:column;justify-content:center;gap:8px;flex-shrink:0}
.deck-note{flex:1 1 auto;font-size:11px;line-height:1.55;color:#8fa2b8;min-width:0}
.deck-note b{color:#f2ead8}

.veil{position:absolute;inset:0;z-index:2;display:flex;flex-direction:column;
  align-items:center;justify-content:center;gap:14px;padding:20px;text-align:center;
  background:radial-gradient(120% 90% at 50% 30%,rgba(20,38,58,.86),rgba(6,10,16,.96))}
.veil.hide{display:none}
h1{font-size:clamp(22px,7vw,36px);letter-spacing:.16em;font-weight:900;line-height:1.25}
h1 small{display:block;font-size:.38em;letter-spacing:.3em;font-weight:600;color:#d9b25e;margin-top:8px}
.lead{font-size:13px;line-height:1.8;color:#c3cedd;max-width:22em}
button{font:inherit;font-weight:800;letter-spacing:.14em;font-size:16px;color:#1a1206;
  background:linear-gradient(#f0c96a,#d19b34);border:0;border-radius:999px;
  padding:15px 42px;box-shadow:0 8px 0 #8a5f18,0 14px 26px rgba(0,0,0,.5);cursor:pointer;
  min-height:56px;touch-action:manipulation;transition:transform .08s ease,opacity .08s ease,box-shadow .08s ease}
button:active,button.is-pressed{transform:translateY(5px) scale(.98);box-shadow:0 3px 0 #8a5f18;opacity:.9}
.icon-btn{width:48px;height:48px;min-width:48px;min-height:48px;padding:0;letter-spacing:0;
  font-size:20px;border-radius:50%;color:#f2ead8;
  background:rgba(13,20,32,.92);border:1px solid rgba(242,234,216,.22);box-shadow:0 4px 0 rgba(0,0,0,.4)}
.icon-btn:active,.icon-btn.is-pressed{transform:scale(.92);box-shadow:0 2px 0 rgba(0,0,0,.4)}
#btnDive{flex:0 0 auto;min-width:120px;min-height:72px;height:min(86px,78%);
  padding:8px 22px;letter-spacing:.12em;font-size:15px;line-height:1.15}
#btnDive small{display:block;font-size:10px;letter-spacing:.08em;font-weight:600;opacity:.72;margin-top:4px}
#btnDive.is-held,#btnDive:active{transform:scale(.92) translateY(4px);box-shadow:0 2px 0 #8a5f18}
audio{position:absolute;width:0;height:0;opacity:0;pointer-events:none}
.big{font-size:clamp(34px,11.5vw,60px);font-weight:900;color:#f0c96a;line-height:1}
.row{display:flex;gap:0;font-size:13px;color:#9fb0c4}
.row b{display:block;font-size:20px;color:#f2ead8;font-weight:800;margin-top:4px}

/* ================= 共通の額縁と小見出し ================= */
.frame{position:absolute;inset:9px;z-index:1;pointer-events:none;
  border:1px solid rgba(240,201,106,.16)}
.frame::before,.frame::after{content:"";position:absolute;width:26px;height:26px;
  border:2px solid rgba(240,201,106,.66)}
.frame::before{top:-2px;left:-2px;border-right:0;border-bottom:0}
.frame::after{right:-2px;bottom:-2px;border-left:0;border-top:0}

.kicker{display:flex;align-items:center;gap:10px;width:min(300px,80vw);
  font-family:"Hiragino Mincho ProN","Yu Mincho",YuMincho,serif;
  font-size:10.5px;letter-spacing:.32em;text-indent:.32em;color:#cdbe9a;
  text-shadow:0 2px 6px rgba(0,0,0,.85)}
.kicker i{flex:1 1 auto;height:1px;background:rgba(240,201,106,.34)}
.kicker span{flex:0 0 auto;white-space:nowrap}

/* ================= タイトル幕：上空カントリー ================= */
#title{
  justify-content:flex-start;gap:0;overflow:hidden;
  padding:clamp(14px,5.2vh,40px) 20px 16px;
  background:
    radial-gradient(122% 72% at 50% 3%,rgba(186,220,240,.26) 0%,rgba(34,62,88,.10) 42%,rgba(0,0,0,0) 70%),
    linear-gradient(180deg,rgba(9,19,31,.66) 0%,rgba(12,26,40,.28) 26%,rgba(255,226,178,.05) 48%,rgba(255,196,126,.09) 66%,rgba(58,34,14,.34) 88%,rgba(26,15,7,.62) 100%);
}
/* 朝の光がゆっくり呼吸する */
@keyframes sun-breathe{0%,100%{opacity:.5}50%{opacity:.95}}
#title::before{content:"";position:absolute;inset:0;z-index:0;pointer-events:none;
  background:radial-gradient(62% 32% at 50% 3%,rgba(255,240,204,.28),rgba(255,240,204,0) 72%);
  animation:sun-breathe 11s ease-in-out infinite}
/* 地表側にたまる靄 */
#title::after{content:"";position:absolute;left:0;right:0;bottom:0;height:30%;z-index:0;pointer-events:none;
  background:linear-gradient(180deg,rgba(34,22,10,0),rgba(44,28,12,.30) 58%,rgba(20,12,6,.62) 100%)}

/* 上空を横切る鳥のシルエット */
.drift{position:absolute;inset:-10% -14%;z-index:0;pointer-events:none}
.drift-bird{position:absolute;left:0;width:46px;height:auto;opacity:0;
  fill:rgba(16,24,34,.78);will-change:transform,opacity;
  filter:drop-shadow(0 3px 6px rgba(0,0,0,.28))}
@keyframes drift-across{
  0%{transform:translate3d(-16vw,0,0) rotate(-5deg);opacity:0}
  9%{opacity:var(--o)}
  46%{transform:translate3d(48vw,-5vh,0) rotate(3deg)}
  91%{opacity:var(--o)}
  100%{transform:translate3d(126vw,2vh,0) rotate(-4deg);opacity:0}
}
.d1{--o:.36;width:60px;top:15%;animation:drift-across 33s linear infinite}
.d2{--o:.24;width:38px;top:30%;animation:drift-across 51s linear -13s infinite}
.d3{--o:.15;width:24px;top:8%;animation:drift-across 69s linear -35s infinite}
.d4{--o:.28;width:48px;top:72%;animation:drift-across 43s linear -24s infinite}
@media (prefers-reduced-motion:reduce){
  .drift-bird{animation:none;opacity:var(--o)}
  #title::before{animation:none;opacity:.7}
}

.title-card{position:relative;z-index:1;display:flex;flex-direction:column;align-items:center}
.crest{display:flex;align-items:center;gap:13px;width:min(304px,80vw);margin:13px 0 14px}
.crest .rule{flex:1 1 auto;height:1px;background:linear-gradient(90deg,rgba(240,201,106,0),rgba(240,201,106,.8))}
.crest .rule:last-child{background:linear-gradient(90deg,rgba(240,201,106,.8),rgba(240,201,106,0))}
.crest-mark{flex:0 0 auto;width:42px;height:auto;fill:#f0c96a;
  filter:drop-shadow(0 1px 4px rgba(0,0,0,.75))}

#title h1{font-size:clamp(30px,10.5vw,52px);letter-spacing:.2em;text-indent:.2em;
  line-height:1.06;color:#fbf4e4}
#title h1 .en{display:block;color:#fbf4e4;
  filter:drop-shadow(0 2px 10px rgba(6,14,24,.9)) drop-shadow(0 0 30px rgba(150,196,228,.28))}
@supports ((-webkit-background-clip:text) or (background-clip:text)){
  #title h1 .en{background:linear-gradient(180deg,#fffaf0 0%,#f7e8c6 44%,#e3b65f 100%);
    -webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}
}
#title h1 small{font-family:"Hiragino Mincho ProN","Yu Mincho",YuMincho,serif;
  font-size:.30em;letter-spacing:.42em;text-indent:.42em;font-weight:600;color:#f0c96a;
  margin-top:13px;text-shadow:0 2px 10px rgba(0,0,0,.85)}
#title .lead{font-family:"Hiragino Mincho ProN","Yu Mincho",YuMincho,serif;
  margin-top:16px;font-size:13.5px;line-height:2;letter-spacing:.1em;color:#e8e1ce;max-width:22em;
  text-shadow:0 2px 8px rgba(0,0,0,.9)}
#title #startBtn{margin-top:24px;
  box-shadow:0 8px 0 #8a5f18,0 16px 34px rgba(0,0,0,.6),inset 0 0 0 1px rgba(255,242,208,.4)}
.best-line{display:flex;align-items:center;gap:11px;margin-top:16px;
  font-size:11px;letter-spacing:.22em;color:#c9bea7;text-shadow:0 2px 6px rgba(0,0,0,.85)}
.best-line b{font-size:16px;font-weight:800;letter-spacing:.05em;color:#f0c96a}

/* ================= エンディング幕：日暮れの田園 ================= */
#over{
  justify-content:flex-start;gap:0;overflow:hidden;
  padding:clamp(12px,4.4vh,34px) 20px 16px;
  background:
    radial-gradient(98% 42% at 50% 100%,rgba(255,172,84,.24) 0%,rgba(255,150,64,.05) 54%,rgba(0,0,0,0) 80%),
    linear-gradient(180deg,rgba(7,14,26,.88) 0%,rgba(16,28,44,.52) 32%,rgba(36,24,16,.20) 54%,rgba(52,30,12,.34) 80%,rgba(22,12,6,.66) 100%);
}
#over::after{content:"";position:absolute;left:0;right:0;bottom:0;height:40%;z-index:0;pointer-events:none;
  background:linear-gradient(180deg,rgba(60,32,10,0),rgba(58,30,10,.22) 60%,rgba(18,10,5,.56) 100%)}
.result-card{position:relative;z-index:1;display:flex;flex-direction:column;align-items:center}
#over h1{margin-top:14px;font-family:"Hiragino Mincho ProN","Yu Mincho",YuMincho,serif;
  font-size:clamp(24px,8vw,40px);letter-spacing:.24em;text-indent:.24em;font-weight:700;color:#fbf4e4;
  text-shadow:0 2px 12px rgba(0,0,0,.9),0 0 34px rgba(255,178,96,.24)}
#over h1.rank-high{color:#ffe6ab;text-shadow:0 2px 12px rgba(0,0,0,.9),0 0 40px rgba(255,196,104,.45)}
.verse{font-family:"Hiragino Mincho ProN","Yu Mincho",YuMincho,serif;
  margin-top:12px;font-size:12.5px;line-height:2;letter-spacing:.1em;color:#e4dac4;max-width:22em;
  text-shadow:0 2px 8px rgba(0,0,0,.9)}
.score-block{display:flex;flex-direction:column;align-items:center;gap:5px;margin-top:16px}
.score-label{font-size:10px;letter-spacing:.34em;text-indent:.34em;color:#c2b393}
#over .big{color:#f8d488;text-shadow:0 3px 16px rgba(0,0,0,.7),0 0 34px rgba(240,180,92,.3)}
#over .row{margin-top:16px;padding-top:13px;border-top:1px solid rgba(240,201,106,.22)}
#over .row div{padding:0 14px;font-size:10.5px;letter-spacing:.16em;color:#bdae92}
#over .row div+div{border-left:1px solid rgba(240,201,106,.18)}
#over .row b{font-size:19px;color:#f6ead2;letter-spacing:.02em}
#over #againBtn{margin-top:22px;
  box-shadow:0 8px 0 #8a5f18,0 16px 34px rgba(0,0,0,.6),inset 0 0 0 1px rgba(255,242,208,.4)}

/* ================= 一時停止幕 ================= */
#paused h1{font-family:"Hiragino Mincho ProN","Yu Mincho",YuMincho,serif;letter-spacing:.3em;text-indent:.3em}

/* 画面が低い端末（SE・横向き）では余白と字を詰める */
@media (max-height:620px){
  #title{padding-top:10px}
  .crest{margin:9px 0 10px}
  #title .lead{margin-top:11px;font-size:12.5px;line-height:1.85}
  #title #startBtn{margin-top:17px}
  .best-line{margin-top:11px}
  #over{padding-top:10px}
  #over h1{margin-top:9px}
  .verse{margin-top:8px;line-height:1.85}
  .score-block{margin-top:10px}
  #over .row{margin-top:11px;padding-top:9px}
  #over #againBtn{margin-top:15px}
}
