* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; background: #14223d; }
body { font-family: "Hiragino Maru Gothic ProN", "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif; color: #1d2b45; }
[hidden] { display: none !important; }

#stage {
  position: absolute; left: 50%; top: 50%; width: 360px; height: 640px; overflow: hidden;
  transform: translate(-50%, -50%); transform-origin: center;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  background: #aee0ff;
}
#canvas { display: block; width: 360px; height: 640px; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

#top { position: absolute; left: 8px; top: 8px; display: flex; gap: 6px; pointer-events: none; }
.pill { background: rgba(255,255,255,.92); border-radius: 999px; padding: 6px 11px; font-size: 13px; font-weight: 700; white-space: nowrap; box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.pill.gold { background: #ffe27a; }

#zoomframe { position: absolute; left: 70px; top: 76px; width: 220px; height: 124px; border: 4px solid #ffd23f; border-radius: 10px; box-shadow: 0 4px 14px rgba(0,0,0,.35); pointer-events: none; }
#zoomframe span { position: absolute; left: 0; top: 0; background: #ffd23f; font-size: 11px; font-weight: 700; padding: 1px 7px 2px; border-radius: 4px 0 8px 0; }

#banner { position: absolute; left: 0; right: 0; top: 150px; text-align: center; white-space: pre-line; font-size: 32px; font-weight: 900; line-height: 1.25; color: #fff; pointer-events: none;
  text-shadow: -2px -2px 0 #b8321f, 2px -2px 0 #b8321f, -2px 2px 0 #b8321f, 2px 2px 0 #b8321f, 0 5px 10px rgba(0,0,0,.35); animation: pop .35s cubic-bezier(.2,1.7,.4,1); }
#banner.big { font-size: 44px; color: #fff3a6; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }

#landing { position: absolute; transform: translate(-50%, -100%); background: #14223d; color: #fff; border: 3px solid #fff; border-radius: 12px; padding: 5px 14px; font-size: 22px; font-weight: 900; white-space: nowrap; pointer-events: none; animation: drop .25s ease-out; }
#landing::after { content: ""; position: absolute; left: 50%; top: 100%; margin-left: -8px; border: 8px solid transparent; border-top-color: #fff; }
@keyframes drop { from { margin-top: -14px; opacity: 0; } to { margin-top: 0; opacity: 1; } }

#flash { position: absolute; inset: 0; background: radial-gradient(circle at 50% 72%, #fffef0 0, #ffe27a 35%, rgba(255,210,63,.35) 100%); opacity: 0; pointer-events: none; }
#flash.go { animation: flash .5s ease-out; }
@keyframes flash { 0% { opacity: .85; } 50% { opacity: .55; } 100% { opacity: 0; } }

#hint { position: absolute; left: 50%; top: 508px; transform: translateX(-50%); white-space: nowrap; font-size: 13px; font-weight: 700; color: #fff; background: rgba(20,34,61,.68); border-radius: 999px; padding: 4px 12px; pointer-events: none; }

#bottom { position: absolute; left: 0; right: 0; bottom: 0; height: 66px; background: rgba(20,34,61,.9); color: #fff; pointer-events: none; }


.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
#result { background: rgba(10,18,36,.5); }
.card { width: 316px; background: #fffaf0; border: 4px solid #14223d; border-radius: 20px; padding: 18px 16px 14px; text-align: center; }
.card h1 { font-size: 22px; }
#result-wish { font-size: 12px; font-weight: 700; color: #6a7389; }
.level { font-size: 26px; font-weight: 900; margin-top: 2px; }
.level.lv0 { color: #6a7389; }
.level.lv1 { color: #2f7a43; }
.level.lv2 { color: #b8321f; text-shadow: 0 0 10px #ffd23f; }
.best { font-size: 13px; margin: -4px 0 8px; color: #6a7389; }
.best.new b { color: #fff; background: #b8321f; border-radius: 999px; padding: 2px 10px; }
.back { display: inline-block; margin-top: 10px; font-size: 13px; font-weight: 700; color: #19448e; text-decoration: underline; }
.blog { display: block; box-sizing: border-box; margin-top: 10px; width: 100%; padding: 9px; font-size: 13px; font-weight: 700; text-align: center; text-decoration: none; background: #19448e; color: #fff; border-radius: 12px; cursor: pointer; }
.total { margin: 6px 0 10px; font-size: 14px; font-weight: 700; }
.total b { font-size: 46px; color: #b8321f; margin-left: 6px; vertical-align: -6px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 3px 4px; border-bottom: 1px solid #e4dccb; }
tbody th { text-align: left; }
thead th { font-size: 11px; color: #6a7389; }
tr.none { opacity: .4; }
.chip { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; font-size: 10px; margin-right: 8px; }
.chip.y1 { background: #dfe3e6; color: #555d62; width: 22px; height: 22px; margin: 0 11px 0 3px; }
.chip.y5 { background: radial-gradient(circle, #fffaf0 0 22%, #e8c24a 25%); color: #4d3800; align-items: flex-end; padding-bottom: 1px; }
.chip.y10 { background: #b5623a; color: #fff; }
.chip.y100 { background: #b9d3ee; color: #17324f; }
.chip.y500 { background: #e7e9ec; border: 4px solid #ffc928; color: #4a3600; width: 32px; height: 32px; margin: 0 6px 0 -2px; }
#again { margin-top: 12px; width: 100%; padding: 14px; font-size: 19px; font-weight: 900; background: #ffd23f; border-radius: 14px; box-shadow: 0 5px 0 #c99a00; }
#again.wait { opacity: .45; }
#result-time { font-size: 11px; margin-top: 8px; color: #6a7389; min-height: 4px; }
#pause { background: rgba(10,18,36,.72); color: #fff; font-size: 24px; font-weight: 900; width: 100%; height: 100%; z-index: 5; }
#fatal { background: #14223d; color: #fff; font-size: 17px; font-weight: 700; padding: 24px; text-align: center; z-index: 9; }

#debug { position: fixed; left: 4px; bottom: 92px; z-index: 20; background: rgba(0,0,0,.78); color: #fff; font-size: 11px; border-radius: 8px; padding: 5px 7px; max-width: 220px; }
#debug button { background: #ffd23f; color: #000; border-radius: 5px; padding: 3px 8px; font-weight: 700; }
#debug label { display: flex; align-items: center; gap: 5px; margin-top: 6px; }
#debug input[type=range] { width: 90px; }
#debug p { margin-top: 6px; color: #bbb; }

/* ---- 第2段階 ---- */

/* 飛ぶ力のゲージ(左端) */
#gauge { position: absolute; left: 8px; top: 196px; width: 92px; pointer-events: none; }
.g-bar { position: relative; margin-top: 4px; width: 22px; height: 210px; border: 3px solid #fff; border-radius: 8px; background: rgba(20,34,61,.55); box-shadow: 0 2px 6px rgba(0,0,0,.25); }
#g-fill { position: absolute; left: 0; right: 0; bottom: 0; height: 0; border-radius: 4px; background: linear-gradient(to top, #5fd16a, #ffd23f 60%, #ff7a3a); }
.g-bar .tick { position: absolute; left: -3px; width: 8px; height: 2px; background: #fff; }
#g-max { position: absolute; left: -3px; width: 26px; border-top: 3px dashed #fff; font-size: 9px; line-height: 1.1; color: #fff; text-shadow: 0 1px 2px #000; padding-top: 2px; white-space: nowrap; }
#g-marks { position: absolute; inset: 0; }
.gm { position: absolute; left: 22px; transform: translateY(50%); background: #fff; color: #14223d; font-size: 11px; font-weight: 900; border-radius: 6px; padding: 1px 6px 1px 4px; white-space: nowrap; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.gm::before { content: ""; position: absolute; left: -7px; top: 50%; margin-top: -5px; border: 5px solid transparent; border-right: 6px solid #fff; border-left: 0; }
.gm.in { background: #ffd23f; }
.gm.in::before { border-right-color: #ffd23f; }
.gm.old { opacity: .7; font-size: 10px; }

/* タイトル */
.screen { background: rgba(10,18,36,.38); }
.title-box { width: 300px; text-align: center; background: rgba(255,250,240,.95); border: 4px solid #14223d; border-radius: 22px; padding: 18px 16px 14px; }
.title-box .sub { font-size: 12px; font-weight: 700; color: #6a7389; }
.title-box h1 { font-size: 40px; line-height: 1.15; color: #b8321f; margin: 4px 0 10px; text-shadow: 0 3px 0 #ffd23f; }
.howto { display: flex; align-items: center; gap: 10px; justify-content: center; background: #eef3fb; border-radius: 14px; padding: 8px; }
.howto p { font-size: 14px; font-weight: 900; text-align: left; }
.finger { position: relative; width: 34px; height: 62px; border-left: 2px dashed #9aa6bd; margin-left: 12px; }
.finger i { position: absolute; left: -11px; top: 0; width: 20px; height: 20px; border-radius: 50%; background: #ffd23f; border: 3px solid #14223d; animation: pullfinger 1.6s ease-in-out infinite; }
@keyframes pullfinger { 0% { top: 0; opacity: 1; } 55% { top: 40px; opacity: 1; } 62% { top: 40px; opacity: 0; } 100% { top: 0; opacity: 0; } }
.bigbtn { margin-top: 14px; width: 100%; padding: 14px; font-size: 21px; font-weight: 900; background: #ffd23f; border-radius: 14px; box-shadow: 0 5px 0 #c99a00; }
.title-box .note { margin-top: 12px; font-size: 10px; color: #6a7389; }

/* 願い事 */
.wish-box { width: 320px; background: rgba(255,250,240,.96); border: 4px solid #14223d; border-radius: 20px; padding: 14px 12px; text-align: center; }
.wish-box h2 { font-size: 21px; }
.wish-help { font-size: 11px; color: #6a7389; margin: 2px 0 8px; }
.wish { display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto; gap: 1px 8px; width: 100%; margin-top: 8px; padding: 10px 10px; text-align: left; background: #fff; border: 3px solid #14223d; border-radius: 14px; box-shadow: 0 4px 0 #9aa6bd; }
.wish:active { transform: translateY(2px); box-shadow: 0 2px 0 #9aa6bd; }
.w-size { grid-row: 1 / 4; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: #ffd23f; font-size: 20px; font-weight: 900; }


.w-meta { font-size: 11px; color: #5d6b87; }
#wish-note { font-size: 11px; color: #b8321f; margin-top: 6px; }

/* 結果の寸劇 */
#skit { background: rgba(10,18,36,.55); flex-direction: column; }
#skit .skip { position: absolute; bottom: 18px; font-size: 11px; color: rgba(255,255,255,.7); }
#skit-body { text-align: center; color: #fff; font-weight: 900; animation: pop .35s cubic-bezier(.2,1.7,.4,1); }
#skit-body p { white-space: pre-line; text-shadow: 0 2px 6px rgba(0,0,0,.5); }
.s-wish { font-size: 17px; margin-top: 12px; }
.bell { margin: 0 auto; width: 56px; height: 56px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff6c8, #e9c34a 45%, #a8801a); transform-origin: 50% -40px; animation: swing .3s ease-in-out infinite alternate; }
.bell::before { content: ""; display: block; margin: -46px auto 0; width: 6px; height: 46px; background: #d9452f; }
@keyframes swing { from { transform: rotate(-16deg); } to { transform: rotate(16deg); } }
.rings { display: flex; justify-content: center; margin-bottom: 10px; }
.rings i { width: 62px; height: 62px; border-radius: 50%; border: 14px solid #e8c24a; margin: 0 -8px; animation: join .8s ease-out; }
@keyframes join { from { margin: 0 30px; } to { margin: 0 -8px; } }
#skit-body.goen p { font-size: 22px; color: #ffe27a; }
.s-level { font-size: 34px; }
.s-words { font-size: 20px; margin-top: 8px; }
#skit-body.lv0 .s-level { color: #c6ccd8; font-size: 28px; }
#skit-body.lv1 .s-level { color: #9ff0a8; }
#skit-body.lv2 .s-level { font-size: 46px; color: #ffe27a; text-shadow: 0 0 18px #ffb300, 0 3px 0 #b8321f; animation: big 0.5s ease-in-out infinite alternate; }
@keyframes big { from { transform: scale(1); } to { transform: scale(1.08); } }
.gm.shift { transform: translateY(calc(50% + 17px)); }
.gm.shift::before { display: none; }

/* ---- みんゴルの考え方を入れた版: 届く帯と、離すタイミング ---- */
#g-band { position: absolute; left: -6px; right: -6px; background: rgba(255,60,40,.55); border: 2px solid #ff3b2a; border-radius: 3px; z-index: 1; }
#g-band.hit { background: rgba(255,210,63,.75); border-color: #fff; box-shadow: 0 0 8px #ffd23f; }
#g-marks { z-index: 2; }
#timing { position: absolute; left: 70px; right: 70px; top: 474px; height: 22px; border-radius: 11px; background: rgba(20,34,61,.82); border: 2px solid #fff; overflow: visible; pointer-events: none; }
#timing .z { position: absolute; top: 2px; bottom: 2px; border-radius: 7px; }
#timing .z.close { left: 20%; right: 20%; background: #e9d46a; }
#timing .z.nice { left: 35%; right: 35%; background: #7fd67f; }
#timing .z.perfect { left: 44%; right: 44%; background: #fff3a6; box-shadow: 0 0 6px #ffd23f; }
#t-needle { position: absolute; top: -6px; width: 4px; margin-left: -2px; height: 30px; background: #ff3b2a; border: 1px solid #fff; border-radius: 2px; }
#judge { position: absolute; left: 0; right: 0; top: 428px; text-align: center; font-size: 26px; font-weight: 900; color: #fff; pointer-events: none; text-shadow: 0 2px 0 #14223d, 0 0 8px rgba(0,0,0,.4); animation: pop .3s cubic-bezier(.2,1.7,.4,1); }
#judge.perfect { color: #ffe27a; font-size: 32px; }
#judge.nice { color: #9ff0a8; }
#judge.close { color: #ffd0a0; font-size: 22px; }
#judge.miss { color: #ff8a7a; }

/* ---- 硬貨を選ぶ・曲げる・風 ---- */
#coins { display: flex; gap: 5px; padding: 0 8px; pointer-events: auto; }
#coins button { flex: 1; height: 46px; border-radius: 10px; background: rgba(255,255,255,.12); color: #fff; display: flex; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 900; border: 2px solid transparent; padding: 0; }
#coins button .chip { margin: 0 2px 0 0; }
#coins button .chip.y1 { margin: 0 4px 0 0; }
#coins button .chip.y500 { margin: 0 1px 0 0; }
#coins button.sel { background: rgba(255,210,63,.25); border-color: #ffd23f; }
#coins button:disabled { opacity: .3; cursor: default; }
#coins button[aria-disabled="true"] { opacity: .55; }
.total .of { font-size: 16px; margin-left: 4px; color: #6a7389; }
#w-arrow { position: absolute; left: 50%; top: 50%; width: 0; height: 0; transition: transform .5s; }
#w-arrow::before { content: ""; position: absolute; left: -3px; top: -11px; width: 6px; height: 20px; background: #2b74d6; border-radius: 2px; }
#w-arrow::after { content: ""; position: absolute; left: -8px; top: -19px; border: 8px solid transparent; border-bottom: 10px solid #2b74d6; border-top: 0; }
#wind.calm #w-arrow { display: none; }
#wind.l4 #wind.l5 { background: rgba(120,20,20,.85); }
.howto2 { margin-top: 8px; font-size: 12px; font-weight: 700; color: #2b74d6; }
.yen { font-size: 13px; font-weight: 700; margin: -6px 0 2px; }
.words { white-space: pre-line; font-size: 14px; font-weight: 900; margin: 2px 0 8px; color: #14223d; }

/* ---- 11/30 夜: 文字を減らした表示・評価の演出・リプレイ ---- */
.pill { display: flex; align-items: center; padding: 6px 9px; }
#remain, #inmeter { display: inline-flex; gap: 4px; }
#remain i { width: 9px; height: 9px; border-radius: 50%; background: #c6ccd8; }
#remain i.on { background: #e8a800; box-shadow: 0 0 0 2px #fff3c4; }
#inmeter i { position: relative; width: 16px; height: 16px; border-radius: 50%; background: rgba(120,80,0,.18); border: 2px solid rgba(120,80,0,.25); }
#inmeter i.on { background: radial-gradient(circle at 35% 35%, #fff6c8, #e8a800 60%, #a8740a); border-color: #fff; }
#inmeter i.little, #inmeter i.big { border-color: #2f7a43; }
#inmeter i.big { border-color: #b8321f; }
#inmeter i.little::after, #inmeter i.big::after { content: "小"; position: absolute; left: 50%; top: -15px; transform: translateX(-50%); font-size: 9px; font-weight: 900; color: #fff; background: #2f7a43; border-radius: 4px; padding: 0 2px; line-height: 12px; }
#inmeter i.big::after { content: "大"; background: #b8321f; }
#top { top: 14px; }

#sound { position: absolute; z-index: 6; right: 8px; top: 8px; width: 34px; height: 34px; border-radius: 50%; background: #ffd23f; color: #14223d; font-size: 17px; font-weight: 900; }
#sound::before { content: "♪"; }
#sound.off { background: rgba(20,34,61,.82); color: #fff; }
#sound.off::after { content: ""; position: absolute; left: 7px; right: 7px; top: 16px; height: 2px; background: #ff8a7a; transform: rotate(-40deg); }

#wind { position: absolute; right: 8px; top: 50px; pointer-events: none; }
.w-dial { position: relative; width: 52px; height: 52px; border-radius: 50%; background: rgba(255,255,255,.95); border: 3px solid #2b74d6; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
#w-level { position: absolute; right: -6px; bottom: -6px; width: 22px; height: 22px; border-radius: 50%; background: #2b74d6; color: #fff; font-style: normal; font-size: 13px; font-weight: 900; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; }
#wind.calm .w-dial::after { content: "・"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 22px; color: #8a93a8; }
#wind.l4 .w-dial, #wind.l5 .w-dial { border-color: #d9452f; }
#wind.l4 #w-level, #wind.l5 #w-level { background: #d9452f; }

#spin { position: absolute; right: 8px; top: 268px; width: 84px; display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
#spin [data-d="-1"], #spin [data-d="1"] { height: 44px; border-radius: 12px; background: rgba(255,255,255,.94); font-size: 24px; font-weight: 900; line-height: 1; box-shadow: 0 3px 0 #9aa6bd; color: #14223d; }
#spin [data-d="-1"]:active, #spin [data-d="1"]:active { transform: translateY(2px); box-shadow: 0 1px 0 #9aa6bd; }
#spin-meter { grid-column: 1 / 3; grid-row: 2; display: flex; gap: 2px; justify-content: center; align-items: center; background: rgba(20,34,61,.75); border-radius: 8px; padding: 6px 3px; }
#spin-meter i { width: 9px; height: 12px; border-radius: 2px; background: rgba(255,255,255,.25); }
#spin-meter i.mid { background: rgba(255,255,255,.55); width: 5px; }
#spin-meter i.on { background: #ffd23f; box-shadow: 0 0 5px #ffd23f; }
#spin.on #spin-meter { outline: 2px solid #ffd23f; }

#coins { margin-top: 8px; }
#coins button { position: relative; flex-direction: column; height: 50px; gap: 3px; }
#coins button .chip, #coins button .chip.y1, #coins button .chip.y500 { margin: 0; }
#coins .cnt { position: absolute; right: 3px; top: 2px; font-size: 11px; line-height: 1; color: #c9d4e6; }
#coins .pips { display: flex; gap: 2px; }
#coins .pips i { width: 5px; height: 4px; border-radius: 1px; background: #9fe0ff; }

.g-bar { margin-top: 0; }
.gm { width: 14px; height: 12px; padding: 0; border-radius: 3px; }

/* 入った時の評価 */
#rate { position: absolute; left: 0; right: 0; top: 190px; height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; z-index: 4; }
#rate .r-word { position: relative; font-size: 50px; font-weight: 900; font-style: italic; letter-spacing: 1px; line-height: 1; font-family: "Arial Black", "Hiragino Sans", system-ui, sans-serif;
  background: linear-gradient(100deg, var(--c1) 0 38%, #fff 47%, var(--c1) 56% 100%); background-size: 260% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: 2px var(--c2); filter: drop-shadow(0 4px 0 var(--c2)) drop-shadow(0 8px 10px rgba(0,0,0,.35));
  animation: rateIn .45s cubic-bezier(.2,1.6,.4,1) both, shine 1.1s .35s ease-in-out both; }
#rate .r-yen { margin-top: 8px; font-size: 20px; font-weight: 900; color: #fff; text-shadow: 0 2px 0 var(--c2), 0 0 8px rgba(0,0,0,.4); animation: yenUp .5s .25s ease-out both; }
#rate .r-ring { position: absolute; left: 50%; top: 50%; width: 80px; height: 80px; margin: -40px; border-radius: 50%; border: 6px solid var(--c1); opacity: 0; animation: ring .7s .05s ease-out; }
#rate .r-rays { position: absolute; left: 50%; top: 42%; width: 0; height: 0; animation: spinRays 3s linear infinite; }
#rate .r-rays i { position: absolute; left: -3px; top: -100px; width: 6px; height: 46px; border-radius: 3px; background: var(--c1); opacity: 0; transform-origin: 3px 100px; animation: ray .8s ease-out both; }
#rate .r-rays i:nth-child(1) { transform: rotate(0deg); animation-delay: 0.00s; }
#rate .r-rays i:nth-child(2) { transform: rotate(30deg); animation-delay: 0.03s; }
#rate .r-rays i:nth-child(3) { transform: rotate(60deg); animation-delay: 0.06s; }
#rate .r-rays i:nth-child(4) { transform: rotate(90deg); animation-delay: 0.09s; }
#rate .r-rays i:nth-child(5) { transform: rotate(120deg); animation-delay: 0.00s; }
#rate .r-rays i:nth-child(6) { transform: rotate(150deg); animation-delay: 0.03s; }
#rate .r-rays i:nth-child(7) { transform: rotate(180deg); animation-delay: 0.06s; }
#rate .r-rays i:nth-child(8) { transform: rotate(210deg); animation-delay: 0.09s; }
#rate .r-rays i:nth-child(9) { transform: rotate(240deg); animation-delay: 0.00s; }
#rate .r-rays i:nth-child(10) { transform: rotate(270deg); animation-delay: 0.03s; }
#rate .r-rays i:nth-child(11) { transform: rotate(300deg); animation-delay: 0.06s; }
#rate .r-rays i:nth-child(12) { transform: rotate(330deg); animation-delay: 0.09s; }

#rate.excellent { --c1: #ffd23f; --c2: #b8321f; }
#rate.excellent .r-word { font-size: 52px; background-image: linear-gradient(100deg, #ffd23f 0 20%, #ff8ad1 30%, #fff 47%, #7fe0ff 62%, #ffd23f 75% 100%); }
#rate.good { --c1: #ffb347; --c2: #8a3a12; }
#rate.nice { --c1: #8ff0a4; --c2: #1d6b3a; }
#rate.oops { --c1: #c9b2ff; --c2: #4a2f86; }
#rate.oops .r-word { font-size: 44px; animation: rateIn .45s cubic-bezier(.2,1.6,.4,1) both, wobble .5s .4s ease-in-out 2; }
#rate.oops .r-rays, #rate.oops .r-ring { display: none; }
#rate.good .r-rays i:nth-child(even), #rate.nice .r-rays i:nth-child(even) { display: none; }
#rate.big .r-yen { font-size: 30px; color: #fff3a6; }
@keyframes rateIn { 0% { transform: scale(2.8) rotate(-10deg); opacity: 0; filter: blur(6px); } 60% { opacity: 1; } 100% { transform: scale(1) rotate(-4deg); opacity: 1; } }
@keyframes shine { from { background-position: 100% 0; } to { background-position: 0 0; } }
@keyframes yenUp { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ring { 0% { transform: scale(.3); opacity: .95; } 100% { transform: scale(3.2); opacity: 0; border-width: 1px; } }
@keyframes ray { 0% { opacity: 0; height: 10px; } 30% { opacity: .95; } 100% { opacity: 0; height: 60px; } }
@keyframes spinRays { to { transform: rotate(360deg); } }
@keyframes wobble { 0%, 100% { transform: rotate(-4deg); } 30% { transform: rotate(-11deg) translateX(-4px); } 70% { transform: rotate(3deg) translateX(4px); } }
#stage.shake #canvas { animation: shake .4s ease-out; }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translate(-5px, 3px); } 40% { transform: translate(5px, -3px); } 60% { transform: translate(-3px, 2px); } 80% { transform: translate(2px, -1px); } }

/* リプレイ */
#replay { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
#replay .bar { position: absolute; left: 0; right: 0; height: 52px; background: #000; animation: barIn .25s ease-out both; }
#replay .bar.top { top: 0; } #replay .bar.bottom { bottom: 0; }
#replay p { position: absolute; left: 12px; top: 62px; color: #fff; font-weight: 900; text-shadow: 0 1px 4px #000; display: flex; align-items: center; gap: 8px; font-size: 12px; }
#replay p b { font-size: 15px; letter-spacing: 2px; }
#replay p b::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 6px; border-radius: 50%; background: #ff3b2a; animation: blink 1s steps(2) infinite; }
@keyframes barIn { from { transform: scaleY(0); } to { transform: none; } }
@keyframes blink { 50% { opacity: 0; } }
#stage.replaying #top, #stage.replaying #bottom, #stage.replaying #wind, #stage.replaying #spin, #stage.replaying #gauge, #stage.replaying #sound, #stage.replaying #judge, #stage.replaying #flash { visibility: hidden; }

/* ---- 12/1 前: 得点・下ののこり・まっすぐ・弧の矢印 ---- */
#score { gap: 8px; padding: 5px 12px 5px 12px; background: rgba(255,250,240,.95); }
#score-num { font-size: 20px; font-weight: 900; color: #b8321f; min-width: 46px; text-align: right; font-variant-numeric: tabular-nums; }
.s-bar { position: relative; width: 150px; height: 12px; border-radius: 6px; background: rgba(20,34,61,.15); }
#score-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 6px; background: linear-gradient(90deg, #ffd23f, #ff9a3a); transition: width .5s cubic-bezier(.2,1.4,.4,1); }
.s-bar em { position: absolute; top: -4px; transform: translateX(-50%); width: 18px; height: 18px; border-radius: 50%; font-style: normal; font-size: 10px; font-weight: 900; color: #fff; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; background: #8a93a8; }
#mk-little.done { background: #2f7a43; } #mk-big.done { background: #b8321f; box-shadow: 0 0 8px #ffd23f; }
#score.lv2 #score-num { text-shadow: 0 0 8px #ffd23f; }
#dist { margin-top: 6px; text-align: center; font-size: 12px; font-weight: 900; color: #fff; background: rgba(20,34,61,.82); border-radius: 999px; padding: 1px 6px; }

#bottom { height: 82px; }
#remain { display: flex; justify-content: center; gap: 6px; padding-top: 6px; height: 16px; }
#remain i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,.2); }
#remain i.on { background: #ffd23f; box-shadow: 0 0 0 2px rgba(255,210,63,.3); }
#coins { margin-top: 4px; }
#coins .mult { position: absolute; left: 3px; top: 2px; font-size: 9px; letter-spacing: -.5px; line-height: 1; color: #ffd23f; }

#spin { top: 262px; }
#spin [data-d="-1"], #spin [data-d="1"] { display: flex; align-items: center; justify-content: center; padding: 0; }
#spin svg { width: 30px; height: 30px; }
#spin-meter { grid-row: 2; }
.spin-reset { grid-column: 1 / 3; height: 30px; border-radius: 9px; background: rgba(255,255,255,.85); font-size: 12px; font-weight: 900; color: #14223d; }
#spin.on .spin-reset { background: #ffd23f; }
#rate .r-yen small { display: block; font-size: 13px; margin-top: 2px; text-align: center; }
#top { top: 8px; }

/* ---- 松竹梅の願い事・★5段階 ---- */
.wish { grid-template-columns: 56px 1fr; grid-template-rows: auto; align-items: center; min-height: 76px; }
.w-icon { grid-row: 1 / 3; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.w-icon svg { width: 44px; height: 44px; }
.w-icon b { font-size: 13px; font-weight: 900; color: #14223d; line-height: 1; }
.wish .w-text { font-size: 15px; line-height: 1.35; }
.w-best { grid-column: 2; font-size: 11px; color: #e8a800; letter-spacing: 1px; }
.wish[data-wish="s"] { background: #fff4f7; }
.wish[data-wish="m"] { background: #f1fbef; }
.wish[data-wish="l"] { background: #eef6f0; border-color: #1d5530; }

#score-marks em { position: absolute; top: -4px; transform: translateX(-50%); width: 17px; height: 17px; border-radius: 50%; font-style: normal; font-size: 9px; font-weight: 900; color: #fff; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; background: #8a93a8; }
#score-marks em::before { content: "★"; font-size: 7px; margin-right: -1px; }
#score-marks em.done { background: #e8a800; box-shadow: 0 0 6px #ffd23f; }
#score.st5 #score-num { text-shadow: 0 0 8px #ffd23f; }

.stars { display: flex; justify-content: center; gap: 4px; font-size: 34px; line-height: 1; margin: 4px 0; }
.stars i { font-style: normal; color: rgba(150,150,160,.45); }
.stars i.on { color: #ffc928; text-shadow: 0 0 10px rgba(255,201,40,.8), 0 2px 0 #b8741a; animation: starIn .4s cubic-bezier(.2,1.8,.4,1) both; }
@keyframes starIn { from { transform: scale(0) rotate(-90deg); opacity: 0; } to { transform: none; opacity: 1; } }
#skit-body .stars { font-size: 40px; }
#skit-body.st1 .s-level, .level.st1 { color: #8a93a8; }
#skit-body.st2 .s-level, .level.st2 { color: #6a7389; }
#skit-body.st3 .s-level { color: #c9e4ff; } .level.st3 { color: #2b74d6; }
#skit-body.st4 .s-level { color: #9ff0a8; } .level.st4 { color: #2f7a43; }
#skit-body.st5 .s-level { font-size: 46px; color: #ffe27a; text-shadow: 0 0 18px #ffb300, 0 3px 0 #b8321f; animation: big 0.5s ease-in-out infinite alternate; }
.level.st5 { color: #b8321f; text-shadow: 0 0 10px #ffd23f; }
.s-words { font-size: 17px; line-height: 1.5; max-width: 300px; margin-left: auto; margin-right: auto; }
#result-wish { display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 13px; color: #14223d; }
.r-icon svg { width: 28px; height: 28px; display: block; }
#result .words { font-size: 15px; line-height: 1.6; margin: 6px 4px 10px; }

/* ---- 願い事のカード: 難しさで色・形が変わる(梅=やさしい暖色 / 竹=緑 / 松=濃い赤紫で太い枠) ---- */
.wish-box { padding: 14px 10px; }
.wish { position: relative; display: grid; grid-template-columns: 62px 1fr; grid-template-rows: auto auto; gap: 4px 10px; align-items: center; padding: 10px 12px 10px 8px; border-width: 3px; border-radius: 16px; color: #fff; overflow: hidden; text-align: left; }
.wish::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(-45deg, rgba(255,255,255,.08) 0 8px, transparent 8px 16px); pointer-events: none; }
.wish.d1 { background: linear-gradient(135deg, #ff9fb8, #ff7a59); border-color: #c2452f; box-shadow: 0 4px 0 #c2452f; }
.wish.d2 { background: linear-gradient(135deg, #7fd06b, #2f9e58); border-color: #1d6b3a; box-shadow: 0 4px 0 #1d6b3a; }
.wish.d3 { background: linear-gradient(135deg, #a8326e, #4a1d6e); border-color: #2a0f40; box-shadow: 0 4px 0 #2a0f40, 0 0 14px rgba(255,201,40,.55); outline: 2px solid #ffc928; outline-offset: -6px; }
.wish:active { transform: translateY(2px); }
.wish.d1:active { box-shadow: 0 2px 0 #c2452f; } .wish.d2:active { box-shadow: 0 2px 0 #1d6b3a; }
.w-icon { grid-row: 1 / 3; width: 58px; height: 58px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; border: 3px solid rgba(0,0,0,.18); z-index: 1; }
.w-icon svg { width: 44px; height: 44px; }
.wish.d3 .w-icon { border-color: #ffc928; box-shadow: 0 0 10px rgba(255,201,40,.7); }
.w-head { display: flex; align-items: center; gap: 6px; z-index: 1; }
.w-head .w-size { width: auto; height: auto; background: none; border-radius: 0; font-size: 20px; font-weight: 900; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.25); display: inline; }
.w-level { font-size: 12px; font-weight: 900; background: #fff; border-radius: 999px; padding: 1px 9px; }
.wish.d1 .w-level { color: #c2452f; } .wish.d2 .w-level { color: #1d6b3a; } .wish.d3 .w-level { color: #4a1d6e; }
.w-pips { display: flex; gap: 3px; margin-left: auto; }
.w-pips i { width: 12px; height: 12px; border-radius: 50%; background: rgba(255,255,255,.3); border: 2px solid rgba(255,255,255,.6); }
.w-pips i.on { background: #ffe27a; border-color: #fff; }
.wish .w-text { grid-column: 2; font-size: 14px; line-height: 1.4; font-weight: 900; color: #14223d; background: rgba(255,255,255,.93); border-radius: 10px; padding: 6px 9px; z-index: 1; }

/* ---- 改行: 文節の切れ目で折り返し、行の長さをそろえる(対応していないブラウザは普通の折り返し) ---- */
#stage { word-break: auto-phrase; line-break: strict; text-wrap: pretty; }
h1, h2, .w-text, .s-wish, .s-words, .words, #result-wish, .howto p, .howto2, .note { text-wrap: balance; }
#coins .mult { display: none; }
