* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #dfeef9; touch-action: none; overscroll-behavior: none; }
body { --ac: #ffcf3a; font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", system-ui, sans-serif; font-variant-numeric: tabular-nums; color: #1d2733; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
/* 画面いっぱい（§19）。文字の大きさは main.js の fit() が決める */
#stage { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; overflow: hidden; background: linear-gradient(#bfe3ff, #eaf6ff); touch-action: none; }
#stage[data-sky="hill"] { background: linear-gradient(#b9def6, #e8f4fb); }
#stage[data-sky="shop"] { background: linear-gradient(#f2d7b0, #f8eedf); }
#stage[data-sky="hwy"] { background: linear-gradient(#a9d3f2, #e6f2fb); }
#stage[data-sky="sea"] { background: linear-gradient(#8fcdf3, #e2f3fc); }
#stage[data-sky="swim"] { background: linear-gradient(#7cc4f0, #dff1fc); }
#stage[data-sky="snow"] { background: linear-gradient(#c6d1dc, #eef2f6); }
#stage[data-sky="work"] { background: linear-gradient(#e2cfa6, #f3eada); }
#stage[data-sky="hell"] { background: linear-gradient(#1a0503, #6a1d0c 70%, #b0391a); }
#stage[data-sky="moon"] { background: radial-gradient(circle at 70% 20%, #1c2342, #05060d 70%); }
#c { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hide { display: none !important; }
/* アイコン（src/icons.js）。文字と同じ大きさで並ぶ */
.ic { width: 1em; height: 1em; display: inline-block; vertical-align: -.14em; flex: none; overflow: visible; }
.ic.pl { margin-right: .25em; color: #1f3d66; }
button .ic { pointer-events: none; }
.touch { display: none !important; }
body.isTouch .touch:not(.hide) { display: grid !important; }
/* PC でも回すボタンを出す（右クリック・Tab でも回る。下にキーの印）。走っている間に隠すのは .hide */
#btTurn:not(.hide) { display: grid !important; position: relative; }
/* PC だけに出す操作の印（タッチでは枠やボタンを押すので要らない） */
body.isTouch .pc { display: none !important; }
body:not(.isTouch) .tc { display: none !important; }
#stage.portrait #turnBox > .cap { display: none; }
kbd { display: inline-block; font: inherit; font-size: max(.9em, 10px); font-weight: 900; line-height: 1.25; padding: 0 .35em; border-radius: .3em; background: #fff; color: #1f3d66; box-shadow: 0 .1em 0 #9aa7b6; text-shadow: none; }

/* ---- 遊んでいる間。左上はメニュー。下の左右の隅には何も置かない ---- */
#hud { position: absolute; inset: 0; pointer-events: none; }
#tl { position: absolute; left: 4.4em; top: 0.9em; text-shadow: 0 0 .3em rgba(255,255,255,.9); }
#label { font-size: 1.15em; font-weight: 700; }
#lbName { display: inline-flex; align-items: center; gap: .3em; }
#sub { margin-top: .2em; font-size: 1.1em; font-weight: 700; display: flex; gap: .8em; align-items: center; }
/* 2026-11-14：ハートは 1.5 倍、白いふち（地獄の赤い空でも見える） */
#lives { color: #e8463c; display: inline-flex; gap: .12em; font-size: 1.5em; filter: drop-shadow(0 0 .05em #fff) drop-shadow(0 .03em .06em rgba(0,0,0,.45)); }
#lives .ic path[fill] { stroke: #fff; stroke-width: 2.6; paint-order: stroke; }
#stage.last #lives > .ic:first-child { animation: hbBeat .8s ease-in-out infinite; }
@keyframes hbBeat { 15% { transform: scale(1.3); } 30% { transform: scale(1); } 45% { transform: scale(1.18); } 60% { transform: scale(1); } }
/* 積んだ数（箱の絵＋数） */
#cnt { display: inline-flex; align-items: center; gap: .15em; font-size: .95em; }
#cnt:empty { display: none; }
#cnt .ic { width: 1.25em; height: 1.25em; filter: drop-shadow(0 0 .08em rgba(255,255,255,.9)); }
#cnt.up b { animation: cntUp .3s ease-out; display: inline-block; }
@keyframes cntUp { 40% { transform: scale(1.5); } }
/* 失ったハート：左右に割れて落ちる */
#lives .hb { position: relative; display: inline-block; width: 1em; height: 1em; vertical-align: -.14em; }
#lives .hb > .ic { position: absolute; inset: 0; opacity: 0; animation: hbIn .2s .35s forwards; }
#lives .hh { position: absolute; inset: 0; animation: hbShake .15s linear; }
#lives .hh .ic { display: block; }
#lives .hh.l { clip-path: polygon(0 0, 55% 0, 42% 35%, 58% 55%, 45% 100%, 0 100%); animation: hbShake .15s linear, hbL .45s .15s ease-in forwards; }
#lives .hh.r { clip-path: polygon(55% 0, 100% 0, 100% 100%, 45% 100%, 58% 55%, 42% 35%); animation: hbShake .15s linear, hbR .45s .15s ease-in forwards; }
@keyframes hbShake { 25% { transform: translateX(-.08em) rotate(-8deg); } 75% { transform: translateX(.08em) rotate(8deg); } }
@keyframes hbL { to { transform: translate(-.35em, .9em) rotate(-35deg); opacity: 0; } }
@keyframes hbR { to { transform: translate(.35em, .9em) rotate(35deg); opacity: 0; } }
@keyframes hbIn { to { opacity: 1; } }
#stage[data-sky="hell"] #tl, #stage[data-sky="moon"] #tl { color: #fff; text-shadow: 0 0 .3em rgba(0,0,0,.9); }
#score { position: absolute; left: 50%; top: 0.5em; transform: translateX(-50%); text-align: center; color: #fff; text-shadow: 0 .06em .25em rgba(0,0,0,.55); white-space: nowrap; }
#scNum { font-size: 2.7em; font-weight: 900; display: inline-block; transition: transform .12s; }
/* 点は枠なし。着いたら金色に弾む（bank）。全部失うと赤く揺れる（crash） */
#scBox { display: inline-block; }
#score.bank #scBox { color: #ffcf3a; animation: bankIn .5s cubic-bezier(.2,1.6,.4,1); }
@keyframes bankIn { from { transform: scale(1.4); } }
#score.crash #scBox { color: #ff6b5e; animation: scCrash .12s linear 8; }
@keyframes scCrash { 25% { transform: translateX(-.12em) rotate(-3deg); } 75% { transform: translateX(.12em) rotate(3deg); } }
#scNum.pop { transform: scale(1.18); }
.chip { display: inline-block; vertical-align: .9em; margin-left: .4em; font-size: .95em; font-weight: 800; padding: .05em .45em; border-radius: 1em; background: #ffcf3a; color: #2a2a2a; text-shadow: none; }
.chip:empty { display: none; }
#scInfo { font-size: 1.05em; font-weight: 800; margin-top: -.1em; display: flex; justify-content: center; align-items: center; gap: .3em; min-height: 1.6em; }
#sig:empty { display: none; }
/* タイム（2026-11-16：勝手に落ちるまでの時計の輪の代わり）。数字の幅をそろえて揺れないように */
#scTime { font-size: 1em; font-weight: 800; font-variant-numeric: tabular-nums; opacity: .9; }
#scTime:empty { display: none; }
#score .unit { font-size: 1.1em; font-weight: 900; margin-left: .1em; }
#scTxt { font-size: 1.35em; }
/* 2026-11-14：この止まる所の 5 個。積んだ分だけ箱の色で埋まる */
#pips { display: inline-flex; gap: .16em; }
#pips:empty { display: none; }
#pips i { width: .62em; height: .62em; border-radius: .14em; border: .1em solid #fff; background: rgba(20,30,45,.45); box-shadow: 0 .05em .12em rgba(0,0,0,.35); }
#pips i.on { background: #d9a066; border-color: #5a3a1a; }
#scUnit { font-size: .85em; }
#scUnit:empty { display: none; }
.ic.sig { width: 2.6em; height: 2.6em; margin: -.5em 0; filter: drop-shadow(0 .05em .15em rgba(0,0,0,.4)); }
/* 右上：キープ → つぎ → 回すボタン を縦一列 */
#side { position: absolute; right: 1.2em; top: 0.9em; display: flex; flex-direction: column; align-items: center; gap: .9em; }
/* つぎの枠は押せないが、触っても下の画面（落とす）へ通さない */
#next { display: flex; flex-direction: column; gap: .3em; align-items: center; pointer-events: auto; }
/* 名前はどちらも枠の上 */
#side .qbox { flex-direction: column-reverse; }
/* 枠の名前（キープ＝取り置き、つぎ） */
.qbox { display: flex; flex-direction: column; align-items: center; gap: .15em; }
.cap { display: inline-flex; align-items: center; gap: .3em; font-size: max(.75em, 11px); font-weight: 800; color: #fff; text-shadow: 0 0 .2em rgba(0,0,0,.85), 0 .05em .1em rgba(0,0,0,.6); pointer-events: none; white-space: nowrap; }
#turnBox { display: flex; flex-direction: column; align-items: center; gap: .35em; margin-top: .2em; }
#turnBox:has(> .hide) { display: none; }
.slot { width: 4.6em; height: 4.6em; border-radius: .5em; background: rgba(255,255,255,.65); border: 2px solid rgba(40,60,90,.25); display: grid; place-items: center; position: relative; }
.slot img { width: 92%; height: 92%; object-fit: contain; pointer-events: none; }
.slot.small { width: 3.4em; height: 3.4em; opacity: .85; background: rgba(255,255,255,.35); border-style: dashed; }
/* キープの枠は押せる：白い実線のふちと影でボタンに見せる */
#hold { pointer-events: auto; cursor: pointer; background: rgba(255,255,255,.45); border: .12em solid #fff; box-shadow: 0 .12em 0 rgba(40,60,90,.35); }
#hold:active { transform: translateY(.08em); box-shadow: none; }
/* 押せる範囲を枠の外へ少し広げる */
#hold::after { content: ''; position: absolute; inset: -.4em; }
body:not(.isTouch) #btTurn { font-size: 1.3em; }
#hold.used img { opacity: .4; }
@media (hover: hover) {
  body:not(.isTouch) #hold:hover { background: rgba(255,255,255,.85); border-color: #ffcf3a; transform: scale(1.05); }
}
#hold { transition: transform .1s, background .1s; }
.usedMark { display: none; position: absolute; right: .2em; top: .2em; font-size: 1.1em; color: #e8463c; }
#hold.used .usedMark { display: block; }
button.round { pointer-events: auto; width: 2.6em; height: 2.6em; padding: 0; border-radius: 50%; font-size: 1.6em; place-items: center; background: #fff; color: #1f3d66; box-shadow: 0 .12em 0 #9aa7b6; }
button.round .ic { width: 1.25em; height: 1.25em; }
#pops { position: absolute; inset: 0; }
/* 左の道のり（下がスタート、上がゴール）。点は信号、旗がゴール、トラックの印が今いる所 */
#route { position: absolute; left: 1.55em; top: 5.2em; width: 1.6em; height: 11em; }
#route .rLine { position: absolute; left: 50%; top: 0; bottom: 0; width: .32em; margin-left: -.16em; border-radius: 1em; background: rgba(255,255,255,.55); box-shadow: 0 0 .2em rgba(0,0,0,.35); overflow: hidden; }
#route .rLine i { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: #ffcf3a; }
#rMarks > * { position: absolute; left: 50%; transform: translate(-50%, 50%); }
.rSig { width: .95em; height: .55em; border-radius: .2em; background: #1f2a3a; border: .08em solid #fff; }
.rSig::after { content: ""; position: absolute; right: .1em; top: 50%; width: .3em; height: .3em; margin-top: -.15em; border-radius: 50%; background: #ff3b30; }
.rSig.done::after { background: #2fe06a; right: auto; left: .1em; }
.rStop { width: .55em; height: .55em; border-radius: 50%; background: #1f2a3a; border: .1em solid #fff; }
.rStop.done { background: #fff; }
.rStart { width: .55em; height: .55em; border-radius: 50%; background: #fff; border: .1em solid #1f3d66; }
.rGoal { width: 1.3em; height: 1.3em; transform: translate(-20%, 50%) !important; }
.rGoal .ic { width: 100%; height: 100%; display: block; filter: drop-shadow(0 .05em .1em rgba(0,0,0,.5)); }
#rMe { position: absolute; left: 50%; width: 1.5em; height: 1.5em; transform: translate(-50%, 50%); transition: bottom .25s linear; }
#rMe .ic { width: 100%; height: 100%; display: block; filter: drop-shadow(0 .05em .12em rgba(0,0,0,.5)); }
.pop1 { position: absolute; font-weight: 900; font-size: 1.5em; color: #fff; text-shadow: 0 .05em .2em rgba(0,0,0,.6); transform: translate(-50%, -50%); transition: left .6s cubic-bezier(.5,0,.8,.6), top .6s cubic-bezier(.3,.6,.5,1), opacity .6s; }
/* 落ちた所で砕けるハート（hud.heartBurst）。出る 0〜.15s → ひび .15〜.32s → 砕ける .32〜.8s */
.hx { position: absolute; width: 2.4em; height: 2.4em; margin: -1.2em 0 0 -1.2em; color: #e8463c; filter: drop-shadow(0 0 .12em rgba(255,255,255,.9)); }
.hx .ic { width: 100%; height: 100%; display: block; }
.hxWhole, .hxShard { position: absolute; inset: 0; }
.hxWhole { animation: hxIn .15s ease-out backwards, hxShake .17s .15s linear, hxHide 0s .32s forwards; }
.hxCrack { position: absolute; inset: 0; width: 100%; height: 100%; fill: none; stroke: #fff; stroke-width: 1.3; stroke-linejoin: round; stroke-dasharray: 14; stroke-dashoffset: 14; animation: hxDraw .14s .16s forwards; }
.hxShard { opacity: 0; animation: hxFly .48s .32s cubic-bezier(.2,.6,.5,1) forwards; }
@keyframes hxIn { from { transform: scale(.3); opacity: 0; } 70% { transform: scale(1.2); opacity: 1; } }
@keyframes hxShake { 25% { transform: translateX(-.08em) rotate(-7deg); } 75% { transform: translateX(.08em) rotate(7deg); } }
@keyframes hxDraw { to { stroke-dashoffset: 0; } }
@keyframes hxHide { to { visibility: hidden; } }
@keyframes hxFly { 0% { opacity: 1; transform: none; } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--r)) scale(.7); } }
/* 救われたハート（hud.heartSave）：ハートが弾む・受け止めた所から小さなハートが上る */
#lives.save > .ic { animation: hsPulse .8s ease-out; }
@keyframes hsPulse { 25% { transform: scale(1.7); filter: drop-shadow(0 0 .25em #fff); } 50% { transform: scale(.9); } 75% { transform: scale(1.2); } }
.hs { position: absolute; width: 2em; height: 2em; margin: -1em 0 0 -1em; color: #e8463c; filter: drop-shadow(0 0 .12em rgba(255,255,255,.9)); animation: hsUp 1s ease-out forwards; pointer-events: none; }
.hs .ic { width: 100%; height: 100%; display: block; }
@keyframes hsUp { 0% { transform: scale(.3); opacity: 0; } 20% { transform: translateY(-.6em) scale(1.25); opacity: 1; } 70% { opacity: 1; } 100% { transform: translateY(-3em) scale(1); opacity: 0; } }
/* 指で狙っている間の「やめる」 */
/* 2026-11-14：下の真ん中（指を置く所）から左下の隅へ。小さく、薄く。上で離すとやめる（当たりは枠の 1.3 倍） */
#cancel { position: absolute; left: .9em; bottom: 1em; width: 2.6em; height: 2.6em; border-radius: 50%; display: grid; place-items: center; font-size: 1.5em; color: rgba(255,255,255,.9); background: rgba(30,40,55,.3); border: .1em solid rgba(255,255,255,.55); transition: transform .1s, background .1s; animation: cnIn .2s ease-out; }
#cancel.on { background: #e8463c; border-color: #fff; color: #fff; transform: scale(1.25); }
@keyframes cnIn { from { opacity: 0; transform: scale(.6); } }

/* 角のボタン */
button.corner { position: absolute; z-index: 20; width: 2.4em; height: 2.4em; padding: 0; border-radius: .5em; font-size: 1.4em; display: grid; place-items: center; background: rgba(255,255,255,.85); color: #2c3e57; box-shadow: 0 .12em 0 #9aa7b6; }
button.corner .ic { width: 1.15em; height: 1.15em; }
button.corner.tl { left: .55em; top: .55em; }
button.corner.tr { right: .55em; top: .55em; }
button.corner.tr2 { right: 3.4em; top: .55em; }

.ov { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1em; padding: 1em; }
.ov.dim { background: rgba(255,255,255,.18); z-index: 10; }

.btns { display: flex; gap: .8em; align-items: center; }
.btns.col { flex-direction: column; }
.btns.wrap { flex-wrap: wrap; justify-content: center; }
.btns.eq button { width: 11em; }
button { font: inherit; font-size: 1.3em; font-weight: 700; padding: .45em 1.6em; border-radius: .5em; border: none; background: #3b78c4; color: #fff; cursor: pointer; box-shadow: 0 .15em 0 #24538e; touch-action: manipulation; }
button:hover { filter: brightness(1.1); }
button:active { transform: translateY(.08em); }
button.sub { background: #fff; color: #2c3e57; box-shadow: 0 .15em 0 #9aa7b6; font-size: 1.05em; }
button.big { font-size: 1.7em; padding: .4em 1.4em; }
button.icon { padding: 0; width: 2.2em; height: 2.2em; font-size: 1.15em; display: inline-grid; place-items: center; }
button.icon .ic { width: 1.2em; height: 1.2em; }
button.back { display: inline-grid; place-items: center; }
button.back .ic { width: 1.2em; height: 1.2em; }
#btCopy { min-width: 5.2em; }
#btCopy .ic { width: 1.7em; height: 1.7em; margin: -.3em 0; color: #1d7a3a; }

/* ---- 結果 ---- */
/* 結果のカードは card.js が描いた 1 枚の絵（4:5）。長押しで保存できるように callout を戻す */
#result { flex-direction: row; gap: 1.6em; }
.resCard { display: block; height: min(88%, 88vh); aspect-ratio: 1 / 1; max-width: 68%; object-fit: contain; border-radius: .4em; box-shadow: 0 .4em 1.4em rgba(0,0,0,.4); background: #fff; -webkit-touch-callout: default; user-select: auto; -webkit-user-select: auto; }
.resBtns { flex-direction: column; align-items: stretch; flex-wrap: nowrap; }
.resBtns button { min-width: 8em; }
/* 解放の演出：光の帯が回り、紙ふぶきが舞う */
#unlock { position: absolute; inset: 0; display: grid; place-items: center; z-index: 30; background: rgba(10,15,30,.55); animation: ulFade .3s ease-out; cursor: pointer; overflow: hidden; }
#unlock .burst { position: absolute; left: 50%; top: 50%; width: 160vmax; height: 160vmax; margin: -80vmax 0 0 -80vmax; background: repeating-conic-gradient(rgba(255,214,80,.55) 0 8deg, transparent 8deg 22deg); border-radius: 50%; mask: radial-gradient(circle, #000 0, #000 20%, transparent 60%); -webkit-mask: radial-gradient(circle, #000 0, #000 20%, transparent 60%); animation: spin 6s linear infinite; }
#unlock .ulCard { position: relative; display: flex; flex-direction: column; align-items: center; gap: .1em; background: #fff; padding: .8em 2.2em 1em; border-radius: 1em; box-shadow: 0 0 0 .3em #ffcf3a, 0 .6em 2em rgba(0,0,0,.5); animation: ulPop .7s cubic-bezier(.2,1.6,.4,1) both; }
#ulIcon { font-size: 5em; line-height: 1; color: #1f3d66; animation: ulReveal 1.1s ease-out both; }
#ulIcon .ic { display: block; }
#ulName { font-size: 2.2em; }
#unlock small { font-size: 1.6em; font-weight: 900; color: #e8463c; letter-spacing: .1em; }
#unlock i { position: absolute; top: -5%; width: .7em; height: 1.1em; border-radius: .1em; animation: fall linear forwards; }
@keyframes ulFade { from { opacity: 0; } }
@keyframes ulPop { 0% { transform: scale(.2) rotate(-12deg); opacity: 0; } 100% { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes ulReveal { 0%, 35% { filter: brightness(0); transform: scale(.8); } 60% { filter: brightness(2.2); transform: scale(1.25); } 100% { filter: none; transform: scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fall { to { transform: translateY(115vh) rotate(720deg); } }

/* 2026-11-14：何が落ちたか（上の真ん中、点の下に約 1 秒） */
#cause { position: absolute; left: 50%; top: 6.6em; transform: translateX(-50%); pointer-events: none; }
#cause .cs { position: relative; width: 5.4em; height: 5.4em; border-radius: .7em; background: rgba(255,255,255,.8); box-shadow: 0 0 0 .18em #e8463c, 0 .2em .6em rgba(0,0,0,.35); display: grid; place-items: center; animation: csIn 1.1s ease-out forwards; }
#cause img, #cause .cs > .ic { width: 90%; height: 90%; object-fit: contain; }
#cause .csX { position: absolute; right: -14%; bottom: -14%; width: 50%; height: 50%; padding: 9%; border-radius: 50%; background: #e8463c; box-shadow: 0 0 0 .12em #fff, 0 .1em .3em rgba(0,0,0,.4); fill: none; stroke: #fff; stroke-width: 4; stroke-linecap: round; animation: csX .25s .1s cubic-bezier(.2,1.8,.4,1) backwards; }
@keyframes csX { from { transform: scale(0) rotate(-90deg); } }
@keyframes csIn { 0% { transform: scale(.3); opacity: 0; } 15% { transform: scale(1.15); opacity: 1; } 25% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-.6em); } }
#stage.portrait #cause { top: 7.4em; }
/* 最後のハート：画面のふちが赤く脈打つ */
#vign { position: absolute; inset: 0; pointer-events: none; z-index: 5; opacity: 0; background: radial-gradient(ellipse at center, transparent 55%, rgba(232,30,20,.55) 100%); }
#stage.last #vign { animation: vgBeat .8s ease-in-out infinite; }
@keyframes vgBeat { 0%, 100% { opacity: .35; } 15% { opacity: 1; } 35% { opacity: .5; } 50% { opacity: .85; } }
/* 全部失った瞬間（hud.fail）：白く光る・揺れる・真ん中に「失敗」の判 */
#stage.shake #c { animation: shake .45s linear; }
@keyframes shake { 10% { transform: translate(-1.2%, .8%); } 30% { transform: translate(1%, -1%); } 50% { transform: translate(-.8%, -.5%); } 70% { transform: translate(.6%, .6%); } 90% { transform: translate(-.3%, .2%); } }
#fail { position: absolute; inset: 0; z-index: 25; pointer-events: none; overflow: hidden; }
#fail .flash { position: absolute; inset: 0; background: #fff; opacity: 0; animation: flash .45s ease-out; }
@keyframes flash { 0% { opacity: .9; } 100% { opacity: 0; } }
#fail .stamp { position: absolute; left: 50%; top: 28%; display: flex; align-items: center; gap: .15em; padding: .05em .35em .05em .2em; font-size: 4.4em; font-weight: 900; color: #e8463c; border: .1em solid #e8463c; border-radius: .18em; background: rgba(255,255,255,.88); box-shadow: 0 .1em .4em rgba(0,0,0,.35); white-space: nowrap; transform: translate(-50%, -50%) rotate(-8deg); animation: stampIn .35s .2s cubic-bezier(.5,0,.6,1.4) backwards; }
#fail .stamp b { letter-spacing: .05em; }
#fail .sIc .ic { width: 1.15em; height: 1.15em; display: block; }
@keyframes stampIn { 0% { transform: translate(-50%, -50%) rotate(-20deg) scale(3); opacity: 0; } 70% { transform: translate(-50%, -50%) rotate(-6deg) scale(.92); opacity: 1; } 100% { transform: translate(-50%, -50%) rotate(-8deg) scale(1); } }
#stage.portrait #fail .stamp { font-size: 3.6em; top: 42%; }
#stage.portrait #bubble.big { font-size: 2.2em; }
#bubble.big { font-size: 2.8em; padding: .1em .7em; color: #1d7a3a; box-shadow: 0 0 0 .1em #2fbf5a, 0 .15em .6em rgba(0,0,0,.35); z-index: 26; }
#bubble { position: absolute; white-space: nowrap; transform: translate(-50%, -120%); background: #fff; color: #1d7a3a; font-weight: 900; font-size: 1.6em; padding: .1em .6em; border-radius: 1em; box-shadow: 0 .15em .5em rgba(0,0,0,.3); pointer-events: none; animation: bub .9s ease-out forwards; }
@keyframes bub { from { transform: translate(-50%, -60%) scale(.6); opacity: 0; } 20% { transform: translate(-50%, -120%) scale(1.1); opacity: 1; } 80% { opacity: 1; } to { transform: translate(-50%, -150%) scale(1); opacity: 0; } }

/* ---- タイトル ---- */
#title { background: linear-gradient(rgba(255,255,255,0), rgba(255,255,255,.3)); justify-content: flex-start; padding-top: 6%; gap: 1.6em; }
#title h1 { font-size: 3.2em; margin: 0; color: #1f3d66; text-align: center; text-shadow: 0 .05em 0 #fff, 0 .1em .4em rgba(255,255,255,.8); letter-spacing: .04em; }
#stage[data-sky="hell"] #title h1, #stage[data-sky="moon"] #title h1 { color: #fff; text-shadow: 0 .1em .4em rgba(0,0,0,.8); }
#wait { font-size: 2em; color: #3b4b60; }
#btQuick { display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
#btQuick small { font-size: .5em; opacity: .95; font-weight: 700; display: inline-flex; align-items: center; }
#btQuick .ic.pl, button:not(.sub) .ic.pl { color: #fff; }
#streamOk { margin-top: auto; padding-bottom: 1.2em; font-size: .95em; font-weight: 700; color: #2c3e57; text-decoration: underline; text-underline-offset: .2em; text-shadow: 0 0 .3em rgba(255,255,255,.9); }
#stage[data-sky="hell"] #streamOk, #stage[data-sky="moon"] #streamOk { color: #fff; text-shadow: 0 0 .3em rgba(0,0,0,.8); }

/* ---- 場所・車・設定（共通の画面） ---- */
.scr { justify-content: flex-start; gap: .8em; background: rgba(240,246,252,.82); overflow-y: auto; touch-action: pan-y; padding-top: .6em; }
.scr .head { width: 100%; display: flex; align-items: center; gap: .8em; font-size: 1.4em; min-height: 2.4em; }
.scr .head b { font-size: 1.1em; }
button.back { font-size: .9em; padding: .3em .8em; }
.head b { display: inline-flex; align-items: center; }
#placeGrid { display: grid; grid-template-columns: repeat(5, minmax(0, 9.5em)); gap: .7em; justify-content: center; }
.pcard { position: relative; background: #fff; color: #1d2733; box-shadow: 0 .15em 0 #9aa7b6; font-size: 1em; padding: .5em .4em .45em; display: flex; flex-direction: column; align-items: center; gap: .1em; border: .15em solid transparent; }
.pcard .e { font-size: 2.6em; line-height: 1; color: #1f3d66; margin: .05em 0 .1em; }
.pcard .e .ic { display: block; }
.pcard .n { font-size: 1.1em; }
.pcard .m { font-size: .85em; color: #b06a00; }
.pcard .b { font-size: .8em; color: #4a5a70; min-height: 1.2em; display: inline-flex; align-items: center; gap: .2em; }
.pcard.on { border-color: #ffcf3a; }
.pcard.lock { background: #d9e0e8; color: #6a7686; box-shadow: 0 .15em 0 #aab4c0; cursor: default; }
.pcard.lock .e { filter: grayscale(1); opacity: .5; }
.pcard.lock .m, .pcard.lock .b { color: #6a7686; }
.pcard .m.need { display: inline-flex; align-items: center; gap: .2em; }
.pcard .m.need .ic { width: 1em; height: 1em; }
.pcard.fresh { animation: freshCard 1.6s ease-out both; }
.pcard.fresh .e { animation: ulReveal 1.6s ease-out both; }
@keyframes freshCard { 0%, 30% { box-shadow: 0 0 0 0 #ffcf3a; } 60% { box-shadow: 0 0 0 .5em rgba(255,207,58,.8); transform: scale(1.08); } 100% { box-shadow: 0 .15em 0 #9aa7b6; transform: none; } }
#trucks { display: flex; gap: .8em; flex-wrap: wrap; justify-content: center; }
.tcard { background: rgba(255,255,255,.85); color: #1d2733; box-shadow: 0 .12em 0 #9aa7b6; font-size: 1.05em; padding: .5em 1em; min-width: 8.5em; display: flex; flex-direction: column; align-items: center; gap: .15em; border: .15em solid transparent; }
.tcard.on { border-color: #ffcf3a; background: #fff; }
.tcard .m { font-size: .9em; color: #b06a00; }
.tcard .b { font-size: .85em; color: #4a5a70; display: inline-flex; align-items: center; gap: .2em; }
.pcard .b .ic, .tcard .b .ic { color: #8a5a00; }
#passRow { display: flex; gap: .4em; align-items: center; }
#passNote { font-size: .8em; font-weight: 700; color: #b06a00; margin-top: -.3em; }
#pass { font: inherit; font-size: 1.25em; width: 9em; padding: .3em .5em; border-radius: .4em; border: 2px solid #9aa7b6; text-align: center; touch-action: manipulation; user-select: text; -webkit-user-select: text; }
.rows { display: flex; flex-direction: column; gap: 1em; font-size: 1.2em; }
.row { display: flex; align-items: center; gap: .7em; }
.row > span { width: 2.2em; display: grid; place-items: center; color: #1f3d66; }
.row > span .ic { width: 1.3em; height: 1.3em; }
#btMute.on { background: #e9edf2; }
/* 音量のつまみ（既定の見た目をやめる） */
#vol { font: inherit; font-size: 1.15em; width: 10em; touch-action: manipulation; -webkit-appearance: none; appearance: none; height: 1.6em; background: transparent; cursor: pointer; }
#vol::-webkit-slider-runnable-track { height: .5em; border-radius: 1em; background: #fff; box-shadow: inset 0 0 0 .12em #9aa7b6; }
#vol::-moz-range-track { height: .5em; border-radius: 1em; background: #fff; box-shadow: inset 0 0 0 .12em #9aa7b6; }
#vol::-moz-range-progress { height: .45em; border-radius: 1em; background: #3b78c4; }
#vol::-webkit-slider-thumb { -webkit-appearance: none; width: 1.3em; height: 1.3em; margin-top: -.4em; border-radius: 50%; background: #3b78c4; border: .2em solid #fff; box-shadow: 0 .1em 0 #9aa7b6; }
#vol::-moz-range-thumb { width: 1em; height: 1em; border-radius: 50%; background: #fff; border: .2em solid #3b78c4; }
#bgmList { display: flex; gap: .35em; flex-wrap: wrap; }
#bgmList button { font-size: .85em; padding: .25em .7em; }
#bgmList button.on { background: #3b78c4; color: #fff; box-shadow: 0 .15em 0 #24538e; }
#foot { margin-top: auto; text-align: center; font-size: .95em; color: #2c3e57; padding: 0 1em 3.2em; }
#foot .lib { font-size: .8em; opacity: .8; margin-top: .3em; }

/* ゴールに着いた：大きな「到着!」が弾んで出て、紙ふぶき */
#arrive { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 30; }
#arrive b { position: absolute; left: 50%; top: 30%; transform: translate(-50%, -50%); font-size: 4.2em; font-weight: 900; color: #ffcf3a; -webkit-text-stroke: .1em #1f3d66; paint-order: stroke fill; text-shadow: 0 .08em 0 #1f3d66, 0 .15em .4em rgba(0,0,0,.35); white-space: nowrap; animation: arIn .6s cubic-bezier(.2,1.6,.5,1) both; }
#arrive i { position: absolute; top: -5%; width: .5em; height: .9em; border-radius: .1em; animation: arFall linear forwards; }
@keyframes arIn { from { transform: translate(-50%, -50%) scale(.2) rotate(-12deg); opacity: 0; } to { transform: translate(-50%, -50%) scale(1) rotate(-4deg); opacity: 1; } }
@keyframes arFall { to { transform: translateY(115vh) rotate(720deg); } }
#toast { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 40; background: rgba(0,0,0,.7); color: #fff; font-weight: 700; padding: .5em 1.2em; border-radius: .5em; pointer-events: none; }

/* ---- 縦長の画面 ---- */
#stage.portrait #title h1 { font-size: 2.5em; padding: 0 1em; }
#stage.portrait #title { padding-top: 22%; }
#stage.portrait #tl { top: .7em; }
/* 縦持ち：ハートが大きくなったので、積んだ数はハートの下の行へ（点にかからない） */
#stage.portrait #sub { flex-wrap: wrap; max-width: 8em; gap: 0 .6em; }
#stage.portrait #sub #lives { flex-basis: 100%; }
#stage.portrait #route { top: 7em; }
/* 縦持ち：キープ・つぎ・つぎ を右の端に縦一列 */
#stage.portrait #side { right: .5em; top: .6em; gap: .6em; }
#stage.portrait #score { top: .4em; }
/* 縦持ち：回すボタンは点数から離し、右の真ん中（親指の届く所。下の隅は空ける） */
#stage.portrait #btTurn { position: fixed; right: .35em; top: 50%; font-size: 1.9em; }
#stage.portrait .slot { width: 3.9em; height: 3.9em; }
#stage.portrait .slot.small { width: 3em; height: 3em; }
#stage.portrait #result { flex-direction: column; gap: .8em; }
#stage.portrait .resCard { height: auto; width: min(94%, calc(100vh - 9em)); max-width: none; }
/* 縦持ち：「もう一度」を上に横いっぱい、残り 4 つは下に同じ幅で 1 列（幅は写真と揃える） */
#stage.portrait .resBtns { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5em; width: min(94%, calc(100vh - 9em)); }
#stage.portrait .resBtns button { min-width: 0; padding: .5em .2em; white-space: nowrap; }
#stage.portrait .resBtns button.big { grid-column: 1 / -1; font-size: 1.45em; padding: .35em 1em; }
#stage.portrait #placeGrid { grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
#stage.portrait .tcard { min-width: 7em; padding: .5em .6em; }
#stage.portrait .rows { font-size: 1.1em; }
#stage.portrait #vol { width: 9em; }
/* 横長だが背が低い（スマホの横持ち） */
#stage.short .scr { gap: .5em; }
#stage.short .pcard .e { font-size: 2em; }
#stage.short #title { padding-top: 3%; gap: 1em; }
