/* BEAMSTORM — 画面は英語。Beam Clash の橙 #ff6a3d / 水色 #5fd4ff を UI にも使う */
:root {
  --orange: #ff6a3d;
  --cyan: #5fd4ff;
  --ink: #1a1240;
  --pad: max(14px, env(safe-area-inset-left));
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #2c2470; color: #fff; font-family: 'Lilita One', 'Trebuchet MS', system-ui, sans-serif; touch-action: none; user-select: none; -webkit-user-select: none; }
canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
[hidden] { display: none !important; }

/* ---------- HUD ---------- */
.hud { position: fixed; inset: 0; pointer-events: none; padding: env(safe-area-inset-top) var(--pad) env(safe-area-inset-bottom); }
.xp { position: absolute; left: 0; right: 0; top: 0; height: 8px; background: rgba(20, 10, 60, .55); }
#xp-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), #fff); box-shadow: 0 0 10px var(--cyan); transition: width .12s; }
.row { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; }
.lv, .kos { min-width: 72px; line-height: 1; text-shadow: 0 2px 0 #1a1240, 0 0 10px rgba(0,0,0,.4); }
.lv span, .kos span { font-size: 12px; opacity: .85; margin: 0 4px; letter-spacing: .08em; }
.lv b, .kos b { font-size: 26px; }
.kos { text-align: right; }
.time { font-size: 38px; letter-spacing: .04em; text-shadow: 0 3px 0 #1a1240, 0 0 14px rgba(255,255,255,.35); }
.time.final { color: #ff5a5a; animation: pulse .5s infinite alternate; }
.hp { position: relative; height: 16px; margin: 6px auto 0; width: min(260px, 70vw); background: rgba(20,10,60,.7); border: 3px solid #1a1240; border-radius: 10px; overflow: hidden; }
#hp-fill { height: 100%; width: 100%; background: linear-gradient(180deg, #ff9a8a, #ff4a5a); transition: width .1s; }
.hp span { position: absolute; inset: 0; text-align: center; font-size: 12px; line-height: 12px; text-shadow: 0 1px 0 #1a1240; }
.chips { position: absolute; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom) + 12px); display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.chip { width: 40px; height: 40px; border-radius: 12px; border: 3px solid #1a1240; display: grid; place-items: center; font-size: 20px; color: #1a1240; position: relative; box-shadow: 0 2px 0 #1a1240; }
.chip i { position: absolute; right: -6px; bottom: -8px; background: #1a1240; color: #fff; font-style: normal; font-size: 11px; padding: 1px 5px; border-radius: 8px; }

.mute { position: fixed; right: 10px; bottom: 10px; z-index: 5; background: rgba(20,10,60,.55); border: 2px solid rgba(255,255,255,.4); color: #fff; border-radius: 12px; width: 40px; height: 40px; font-size: 18px; }
.hud:not([hidden]) ~ .mute { bottom: auto; top: calc(env(safe-area-inset-top) + 64px); right: 10px; opacity: .6; }

.hurt, .danger { position: fixed; inset: 0; pointer-events: none; opacity: 0; }
.hurt { background: radial-gradient(ellipse at center, rgba(255,40,60,0) 40%, rgba(255,40,60,.6) 100%); transition: opacity .35s; }
.hurt.on { opacity: 1; transition: none; }
.danger { background: radial-gradient(ellipse at center, rgba(255,60,60,0) 55%, rgba(255,60,60,.26) 100%); }
.danger.on { opacity: 1; animation: pulse 1s infinite alternate; }
@keyframes pulse { from { opacity: .35 } to { opacity: 1 } }

.banner { position: fixed; left: 0; right: 0; top: 28%; text-align: center; font-size: 46px; letter-spacing: .06em; text-shadow: 0 4px 0 #1a1240, 0 0 24px var(--orange); color: #fff; animation: pop .5s ease-out; pointer-events: none; }
@keyframes pop { from { transform: scale(1.8); opacity: 0 } to { transform: scale(1); opacity: 1 } }

.stick { position: fixed; width: 112px; height: 112px; margin: -56px 0 0 -56px; border-radius: 50%; border: 3px solid rgba(255,255,255,.55); background: rgba(255,255,255,.12); pointer-events: none; z-index: 4; }
#knob { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; border-radius: 50%; background: rgba(255,255,255,.85); transform: translate(-50%, -50%); box-shadow: 0 0 14px var(--cyan); }

.toast { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); background: rgba(20,10,60,.9); padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 20; }

/* ---------- パネル ---------- */
.panel { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; background: radial-gradient(ellipse at 50% 30%, rgba(60,30,120,.55), rgba(20,10,50,.88)); z-index: 10; }
.panel.lvl { background: rgba(20,10,50,.78); }
.kicker { margin: 0; font-size: 16px; letter-spacing: .3em; color: var(--cyan); text-shadow: 0 0 12px var(--cyan); }
.title { margin: 6px 0 8px; font-size: clamp(64px, 20vw, 108px); line-height: .88; letter-spacing: .03em; color: #fff; text-shadow: 0 5px 0 #1a1240, 0 0 28px var(--orange), 4px 0 0 var(--orange), -3px 0 0 var(--cyan); }
.sub { margin: 4px 0 22px; font-size: 17px; line-height: 1.35; opacity: .92; font-family: 'Trebuchet MS', system-ui, sans-serif; font-weight: 700; }
.cta { font: inherit; font-size: 28px; letter-spacing: .08em; padding: 12px 52px; border-radius: 18px; border: 4px solid #1a1240; background: linear-gradient(180deg, #ff9a5a, var(--orange)); color: #fff; text-shadow: 0 2px 0 #1a1240; box-shadow: 0 6px 0 #1a1240, 0 0 24px rgba(255,106,61,.6); cursor: pointer; margin: 6px; pointer-events: auto; }
.cta:active { transform: translateY(3px); box-shadow: 0 3px 0 #1a1240; }
.cta.ghost { background: rgba(255,255,255,.12); font-size: 20px; padding: 10px 34px; box-shadow: 0 4px 0 #1a1240; }
.cta.share { background: linear-gradient(180deg, #7fe0ff, var(--cyan)); box-shadow: 0 6px 0 #1a1240, 0 0 24px rgba(95,212,255,.6); font-size: 24px; }
.how { margin: 14px 0 0; font-size: 14px; opacity: .8; font-family: 'Trebuchet MS', system-ui, sans-serif; }
.best { margin: 8px 0 0; font-size: 16px; color: #ffe27a; }
.credit { position: absolute; bottom: calc(env(safe-area-inset-bottom) + 14px); margin: 0; font-size: 13px; opacity: .65; letter-spacing: .04em; }

.pick { margin: 2px 0 14px; font-size: 38px; text-shadow: 0 3px 0 #1a1240; }
.cards { display: flex; flex-direction: column; gap: 12px; width: min(420px, 100%); }
.card { display: flex; align-items: center; gap: 14px; text-align: left; padding: 12px 14px; border-radius: 18px; border: 4px solid #1a1240; background: linear-gradient(180deg, #fff, #e6e0ff); color: #1a1240; font: inherit; cursor: pointer; box-shadow: 0 5px 0 #1a1240; animation: cardin .3s ease-out backwards; }
.card:nth-child(2) { animation-delay: .06s } .card:nth-child(3) { animation-delay: .12s }
@keyframes cardin { from { transform: translateY(30px) scale(.9); opacity: 0 } }
.card:active { transform: translateY(3px); box-shadow: 0 2px 0 #1a1240; }
.card .ic { flex: none; width: 54px; height: 54px; border-radius: 14px; border: 3px solid #1a1240; display: grid; place-items: center; font-size: 28px; color: #1a1240; }
.card .tx b { display: block; font-size: 22px; letter-spacing: .02em; }
.card .tx small { display: block; font-size: 14px; line-height: 1.25; font-family: 'Trebuchet MS', system-ui, sans-serif; font-weight: 700; opacity: .8; }
.card .tx em { font-style: normal; font-size: 12px; color: #d63a6a; }
.card kbd { margin-left: auto; font-size: 12px; opacity: .45; font-family: monospace; }

.res-title { margin: 4px 0 10px; font-size: 76px; text-shadow: 0 5px 0 #1a1240, 0 0 24px var(--orange); }
.stats { display: flex; gap: 28px; margin-bottom: 8px; }
.stats div { display: flex; flex-direction: column; }
.stats b { font-size: 44px; text-shadow: 0 3px 0 #1a1240; }
.stats span { font-size: 13px; letter-spacing: .08em; opacity: .85; }

@media (max-height: 640px) { .title { font-size: 64px; } .res-title { font-size: 56px; } }
