/* Rocket Pinball: a WebGL canvas fills the stage; HUD, callouts and menus are HTML on top */
.rp { display: flex; flex-direction: column; color: #fff; --p0: #ff7a1a; --p1: #ffd23f; --p2: #ff3d6e;
  font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.rp-stage { position: relative; width: 100%; height: clamp(520px, calc(100vh - 150px), 1000px); height: clamp(520px, calc(100dvh - 150px), 1000px); overflow: hidden; border-radius: 10px; background: #04050b;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; outline: none; contain: layout paint; }
@media (max-width: 640px) { .rp-stage { height: auto; aspect-ratio: 9 / 16.6; max-height: 88vh; min-height: 0; border-radius: 8px; } }
#rp-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: default; }
.rp-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.rp [hidden] { display: none !important; }
.rp kbd { display: inline-block; min-width: 1.5em; padding: 1px 6px; border-radius: 6px; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.18); font: inherit; font-size: 0.92em; text-align: center; }
.rp .hint-touch { display: none; }
@media (hover: none) and (pointer: coarse) { .rp .hint-kb { display: none; } .rp .hint-touch { display: inline; } }

/* ---------- HUD ---------- */
.rp-hud { position: absolute; inset: 0; pointer-events: none; padding: max(6px, env(safe-area-inset-top, 0px)) 8px 8px; }
.rp-glass { background: linear-gradient(135deg, rgba(10,12,26,0.74), rgba(10,12,26,0.46)); border: 1px solid rgba(255,255,255,0.1); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.rp-bar { display: flex; align-items: stretch; gap: 6px; height: 54px; }
.rp-scorebox { flex: none; display: flex; flex-direction: column; justify-content: center; line-height: 1; min-width: 92px; padding: 5px 10px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(10,12,26,0.74), rgba(10,12,26,0.46)); border: 1px solid rgba(255,255,255,0.1); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.08); }
.rp-score { font-size: clamp(19px, 5.6vmin, 30px); font-weight: 900; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: #fff;
  text-shadow: 0 0 12px color-mix(in srgb, var(--p0) 70%, transparent); transition: transform .12s; transform-origin: left center; }
.rp-score.is-bump { animation: rp-bump .22s ease-out; }
@keyframes rp-bump { 40% { transform: scale(1.07); } }
.rp-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255,255,255,0.78); white-space: nowrap; }
.rp-x { color: var(--p1); }
.rp-savechip { margin-left: auto; padding: 1px 6px; border-radius: 99px; background: rgba(61,255,154,0.2); color: #6dffb5; font-size: 9px; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; box-shadow: 0 0 10px rgba(61,255,154,0.35); }
.rp-savechip.is-ending { animation: rp-blink .35s steps(2) infinite; }
@keyframes rp-blink { 50% { opacity: 0.25; } }
.rp-mission { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; justify-content: center; padding: 4px 10px 6px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(10,12,26,0.72), rgba(10,12,26,0.42)); border: 1px solid color-mix(in srgb, var(--p0) 38%, rgba(255,255,255,0.08)); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 0 22px color-mix(in srgb, var(--p0) 18%, transparent); }
.rp-mission.is-ready { border-color: var(--p2); animation: rp-pulse 1s ease-in-out infinite; }
.rp-mission.is-done { animation: rp-flashcard .6s ease-out; }
@keyframes rp-flashcard { 30% { transform: scale(1.04); box-shadow: 0 0 40px var(--p1); } }
@keyframes rp-pulse { 50% { box-shadow: 0 0 34px color-mix(in srgb, var(--p2) 85%, transparent); } }
.rp-mtop { display: flex; align-items: center; gap: 5px; min-width: 0; }
.rp-pdot { flex: none; width: 11px; height: 11px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff 0 8%, var(--p1) 25%, var(--p0) 65%, #000 130%); box-shadow: 0 0 8px var(--p0); }
.rp-mstep { font-size: 9.5px; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; color: var(--p1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-mtime { font-size: 11px; font-weight: 900; color: #ffd23f; font-variant-numeric: tabular-nums; }
.rp-mname { display: block; margin-top: 1px; font-size: 13.5px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.15; }
.rp-mtext { display: none; font-size: 12px; font-weight: 700; color: rgba(255,255,255,0.78); }
.rp-mbar { height: 4px; margin-top: 4px; border-radius: 99px; background: rgba(255,255,255,0.14); overflow: hidden; }
.rp-mbar i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--p0), var(--p1)); box-shadow: 0 0 10px var(--p0); transition: width .25s ease-out; }
.rp-btns { flex: none; display: flex; flex-direction: column; gap: 4px; pointer-events: auto; }
.rp-ib { width: 34px; height: 25px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,0.12); border-radius: 9px; background: rgba(10,12,26,0.62); color: #fff; cursor: pointer;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); touch-action: manipulation; transition: background .15s, transform .1s; }
.rp-ib:hover { background: rgba(40,44,70,0.75); } .rp-ib:active { transform: scale(0.93); }
.rp-ib svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
.rp-ib .off { display: none; } .rp-ib[aria-pressed="true"] .on { display: none; } .rp-ib[aria-pressed="true"] .off { display: inline; }
.rp-ib:focus-visible, .rp-btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
@media (min-width: 480px) { .rp-bar { height: 60px; } .rp-ib { width: 40px; height: 28px; } .rp-mname { font-size: 15px; } .rp-mstep { font-size: 10.5px; } }
.rp-combo { position: absolute; left: 50%; top: 30%; transform: translateX(-50%); padding: 4px 14px; border-radius: 99px; font-size: 14px; font-weight: 900; letter-spacing: 0.1em;
  background: linear-gradient(90deg, var(--p0), var(--p2)); box-shadow: 0 0 24px var(--p2); animation: rp-pop .3s cubic-bezier(.2,1.6,.4,1); }

/* wide layouts: score on the left, the mission on the right, the table in the middle */
.rp.is-wide .rp-hud { padding: 14px; }
.rp.is-wide .rp-bar { display: block; height: auto; }
.rp.is-wide .rp-scorebox { position: absolute; left: 14px; top: 14px; width: var(--side, 260px); padding: 14px 16px; border-radius: 18px; }
.rp.is-wide .rp-score { font-size: clamp(30px, 4.4vmin, 50px); }
.rp.is-wide .rp-meta { font-size: 12px; margin-top: 8px; }
.rp.is-wide .rp-mission { position: absolute; right: 14px; top: 14px; width: var(--side, 260px); padding: 12px 14px 14px; border-radius: 18px; }
.rp.is-wide .rp-mstep { font-size: 11px; } .rp.is-wide .rp-pdot { width: 14px; height: 14px; }
.rp.is-wide .rp-mname { font-size: 20px; margin-top: 4px; white-space: normal; }
.rp.is-wide .rp-mtext { display: block; margin-top: 2px; font-size: 13.5px; }
.rp.is-wide .rp-mbar { height: 6px; margin-top: 8px; }
.rp.is-wide .rp-btns { position: absolute; left: 14px; bottom: 14px; flex-direction: row; gap: 8px; }
.rp.is-wide .rp-ib { width: 44px; height: 40px; border-radius: 13px; } .rp.is-wide .rp-ib svg { width: 20px; height: 20px; }
.rp.is-wide .rp-combo { top: 22%; }

/* ---------- warp jump: light streaks rushing out from the centre ---------- */
.rp-warp { position: absolute; inset: -20%; pointer-events: none; opacity: 0; mix-blend-mode: screen;
  background: repeating-conic-gradient(from 0deg at 50% 45%, rgba(255,255,255,0) 0deg 2.2deg, color-mix(in srgb, var(--p1) 70%, #fff) 2.6deg, rgba(255,255,255,0) 3deg 7deg),
    radial-gradient(circle at 50% 45%, #fff 0, color-mix(in srgb, var(--p0) 60%, transparent) 14%, transparent 46%);
  -webkit-mask-image: radial-gradient(circle at 50% 45%, transparent 8%, #000 30%); mask-image: radial-gradient(circle at 50% 45%, transparent 8%, #000 30%); }
.rp-warp.is-on { animation: rp-warp 1.5s cubic-bezier(.3,0,.2,1) forwards; }
@keyframes rp-warp { 0% { opacity: 0; transform: scale(0.6) rotate(0deg); } 18% { opacity: 1; } 70% { opacity: 0.85; } 100% { opacity: 0; transform: scale(2.2) rotate(8deg); } }

/* ---------- callouts and score popups ---------- */
.rp-call { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; text-align: center; width: max-content; max-width: 92%; opacity: 0; }
.rp-call b { font-size: clamp(30px, 9vmin, 64px); font-weight: 900; line-height: 0.95; letter-spacing: -0.01em; text-transform: uppercase; color: #fff;
  text-shadow: 0 0 18px var(--p0), 0 0 42px var(--p0), 0 4px 0 rgba(0,0,0,0.35); }
.rp-call span { font-size: clamp(13px, 3.4vmin, 18px); font-weight: 800; color: rgba(255,255,255,0.92); text-shadow: 0 2px 8px rgba(0,0,0,0.8); max-width: 26em; }
.rp-call.is-on { animation: rp-call 2.3s cubic-bezier(.2,1.2,.3,1) forwards; }
.rp-call.is-small b { font-size: clamp(22px, 6vmin, 40px); }
.rp-call.is-bad b { text-shadow: 0 0 18px #ff2a4a, 0 0 42px #ff2a4a, 0 4px 0 rgba(0,0,0,0.35); }
@keyframes rp-call { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0.55); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); } 20% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -58%) scale(1); } }
@keyframes rp-pop { from { transform: translateX(-50%) scale(0.6); opacity: 0; } }
.rp-pops { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.rp-pop { position: absolute; transform: translate(-50%, -50%); font-size: 15px; font-weight: 900; white-space: nowrap; color: #fff; font-variant-numeric: tabular-nums;
  text-shadow: 0 0 10px var(--c, var(--p0)), 0 2px 3px rgba(0,0,0,0.7); animation: rp-float 1.1s ease-out forwards; }
.rp-pop.is-big { font-size: 22px; letter-spacing: 0.02em; }
.rp-pop small { display: block; font-size: 10px; letter-spacing: 0.14em; text-align: center; color: var(--p1); }
@keyframes rp-float { 0% { opacity: 0; transform: translate(-50%, -30%) scale(0.7); } 15% { opacity: 1; transform: translate(-50%, -60%) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -180%) scale(1); } }

.rp-tilt { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); width: 140px; height: 18px; border-radius: 99px; background: rgba(0,0,0,0.55); overflow: hidden; display: grid; place-items: center; }
.rp-tilt i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, #ffd23f, #ff2a4a); }
.rp-tilt span { position: relative; font-size: 10px; font-weight: 900; letter-spacing: 0.2em; text-transform: uppercase; }

.rp-plunge { position: absolute; right: 12px; bottom: 14px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; pointer-events: none; font-size: 12px; font-weight: 800; color: rgba(255,255,255,0.86); text-shadow: 0 2px 6px #000; }
.rp-pmeter { width: 14px; height: 92px; border-radius: 99px; background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.2); overflow: hidden; display: flex; align-items: flex-end; margin-right: 4px; }
.rp-pmeter i { display: block; width: 100%; height: 0; background: linear-gradient(0deg, var(--p0), var(--p1), #fff); box-shadow: 0 0 12px var(--p1); }

/* ---------- title ---------- */
.rp-title { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px 18px; text-align: center;
  background: radial-gradient(ellipse at 50% 42%, rgba(4,5,11,0.15), rgba(4,5,11,0.78) 75%); }
.rp-logo { display: flex; flex-direction: column; align-items: center; line-height: 0.82; font-size: clamp(48px, 14vmin, 104px); font-weight: 900; letter-spacing: -0.03em; text-transform: uppercase; transform: rotate(-5deg);
  animation: rp-logo .8s cubic-bezier(.2,1.4,.3,1) both; }
.rp-logo span:first-child { color: #fff; text-shadow: 0 0 22px var(--p0), 0 0 60px var(--p0), 0 6px 0 color-mix(in srgb, var(--p0) 60%, #000); }
.rp-logo span:last-child { margin-left: 0.4em; background: linear-gradient(90deg, var(--p1), #fff, var(--p2)); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 18px var(--p2)) drop-shadow(0 5px 0 rgba(0,0,0,0.4)); }
@keyframes rp-logo { from { opacity: 0; transform: rotate(-5deg) scale(0.6) translateY(-40px); } }
.rp-tag { margin: 18px 0 0; max-width: 24em; font-size: 15px; font-weight: 700; color: rgba(255,255,255,0.85); text-shadow: 0 2px 8px #000; }
.rp-best { margin: 0; min-height: 1.2em; font-size: 13px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; color: var(--p1); text-shadow: 0 2px 8px #000; }
.rp-menu { display: flex; flex-direction: column; gap: 9px; width: min(100%, 280px); margin-top: 8px; }
.rp-btn { min-height: 48px; padding: 11px 18px; border: 1px solid rgba(255,255,255,0.16); border-radius: 15px; background: rgba(16,18,36,0.72); color: #fff; font: inherit; font-size: 16px; font-weight: 900;
  letter-spacing: 0.02em; cursor: pointer; touch-action: manipulation; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: transform .1s, background .15s, box-shadow .2s; }
.rp-btn:hover { background: rgba(36,40,70,0.85); } .rp-btn:active { transform: scale(0.97); }
.rp-btn-go { min-height: 58px; font-size: 21px; border: 0; background: linear-gradient(135deg, var(--p0), var(--p2)); box-shadow: 0 0 30px color-mix(in srgb, var(--p0) 60%, transparent), inset 0 1px 0 rgba(255,255,255,0.4); text-shadow: 0 2px 4px rgba(0,0,0,0.35); }
.rp-btn-go:hover { background: linear-gradient(135deg, var(--p0), var(--p2)); box-shadow: 0 0 44px var(--p0); }
.rp-keys { margin: 10px 0 0; font-size: 12.5px; font-weight: 700; color: rgba(255,255,255,0.75); text-shadow: 0 2px 6px #000; }

/* ---------- panels ---------- */
.rp-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 14px; background: rgba(4,5,12,0.55); z-index: 3; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.rp-panel { position: relative; width: min(100%, 420px); max-height: 100%; overflow: auto; overscroll-behavior: contain; padding: 22px 18px 18px; border-radius: 22px; text-align: center;
  background: linear-gradient(160deg, rgba(24,26,48,0.96), rgba(10,11,24,0.97)); border: 1px solid rgba(255,255,255,0.12); box-shadow: 0 30px 80px rgba(0,0,0,0.6), 0 0 40px color-mix(in srgb, var(--p0) 25%, transparent);
  animation: rp-in .3s cubic-bezier(.2,1.3,.4,1); }
@keyframes rp-in { from { opacity: 0; transform: scale(0.92) translateY(10px); } }
.rp-panel h3 { margin: 0 0 4px; font-size: 22px; font-weight: 900; }
.rp-kicker { margin: 0 0 4px; font-size: 11px; font-weight: 900; letter-spacing: 0.14em; text-transform: uppercase; color: var(--p1); }
.rp-big { margin: 4px 0; font-size: clamp(38px, 10vmin, 56px); line-height: 1; font-weight: 900; letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #fff, var(--p1)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.rp-sub { margin: 6px 0 12px; font-size: 14px; font-weight: 700; color: rgba(255,255,255,0.72); }
.rp-new { display: inline-block; padding: 3px 10px; border-radius: 99px; background: var(--p1); color: #241400; font-size: 12px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; }
.rp-row { display: flex; gap: 8px; margin-top: 12px; } .rp-row .rp-btn { flex: 1 1 0; }
.rp-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 12px 0 4px; }
.rp-stats div { padding: 8px 4px; border-radius: 12px; background: rgba(255,255,255,0.06); font-size: 11px; font-weight: 800; color: rgba(255,255,255,0.65); text-transform: uppercase; letter-spacing: 0.06em; }
.rp-stats b { display: block; font-size: 18px; color: #fff; letter-spacing: 0; }
.rp-tour { display: flex; justify-content: center; gap: 5px; margin: 10px 0 2px; }
.rp-tour i { width: 16px; height: 16px; border-radius: 50%; opacity: 0.25; box-shadow: inset -3px -3px 5px rgba(0,0,0,0.5); }
.rp-tour i.on { opacity: 1; box-shadow: inset -3px -3px 5px rgba(0,0,0,0.4), 0 0 10px currentColor; }
.rp-help { text-align: left; font-size: 14px; line-height: 1.45; color: rgba(255,255,255,0.86); }
.rp-help h4 { margin: 14px 0 4px; font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--p1); }
.rp-help p { margin: 0 0 6px; } .rp-help ul { margin: 0; padding-left: 18px; }
.rp-set { display: grid; grid-template-columns: 1fr 1.4fr; align-items: center; gap: 12px 12px; margin: 14px 0 6px; text-align: left; font-size: 14px; font-weight: 800; }
.rp-set input[type=range] { width: 100%; accent-color: var(--p0); }
.rp-seg { display: flex; gap: 4px; } .rp-seg button { flex: 1; min-height: 36px; border: 1px solid rgba(255,255,255,0.15); border-radius: 10px; background: rgba(255,255,255,0.06); color: #fff; font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; }
.rp-seg button[aria-pressed="true"] { background: var(--p0); border-color: var(--p0); color: #120a00; }
.rp-close { position: absolute; right: 10px; top: 10px; width: 38px; height: 38px; border: 0; border-radius: 12px; background: rgba(255,255,255,0.08); color: #fff; font-size: 20px; font-weight: 900; cursor: pointer; }

.rp-loading { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; background: #04050b; font-size: 14px; font-weight: 800; color: rgba(255,255,255,0.8); transition: opacity .4s; z-index: 5; }
.rp-loading.is-done { opacity: 0; pointer-events: none; }
.rp-spin { width: 38px; height: 38px; border-radius: 50%; border: 4px solid rgba(255,255,255,0.15); border-top-color: var(--p0); animation: rp-rot 0.8s linear infinite; }
@keyframes rp-rot { to { transform: rotate(360deg); } }
.rp-nogl { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; background: #0b1328; color: #dfe9ff; text-align: center; z-index: 6; }

/* ---------- full screen ---------- */
.stage.is-immersive .stage-body > .rp { min-height: 0; flex: 1 1 auto; }
.stage.is-immersive .rp-stage { flex: 1 1 auto; height: auto; aspect-ratio: auto; max-height: none; min-height: 0; border-radius: 0; }
@media (orientation: landscape) and (max-height: 520px) {
  .rp-logo { font-size: 44px; } .rp-tag { margin-top: 8px; font-size: 13px; } .rp-menu { flex-direction: row; width: auto; } .rp-btn { min-height: 42px; padding: 8px 14px; font-size: 14px; } .rp-btn-go { min-height: 42px; font-size: 16px; }
  .rp-title { gap: 6px; padding: 12px; }
}
@media (prefers-reduced-motion: reduce) { .rp-call.is-on { animation-duration: 2.4s; } .rp-logo, .rp-panel { animation: none; } }
