/* Rocket Hop: a WebGL canvas fills the stage; the HUD, title and menus are HTML on top */
.rh { display: flex; flex-direction: column; color: #fff; }
.rh-stage { position: relative; width: 100%; height: min(78vh, 760px); min-height: 400px; overflow: hidden; border-radius: 10px; background: #5cc8f2;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
@media (max-width: 600px) { .rh-stage { height: auto; aspect-ratio: 9 / 15; max-height: 80vh; min-height: 0; border-radius: 8px; } }
#rh-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; cursor: pointer; }
.rh-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.rh [hidden] { display: none !important; }

/* ---------- HUD ---------- */
.rh-hud { position: absolute; inset: 0; pointer-events: none; padding: max(10px, env(safe-area-inset-top, 0px)) 12px 12px; }
.rh-scorebox { position: absolute; left: 14px; top: 8px; display: flex; flex-direction: column; line-height: 1; }
.rh-score { font-size: clamp(40px, 9vmin, 60px); font-weight: 900; letter-spacing: -0.02em; color: #fff;
  text-shadow: 0 3px 0 rgba(0,0,0,0.35), 0 0 1px rgba(0,0,0,0.6); font-variant-numeric: tabular-nums; }
.rh-score.is-bump { animation: rh-bump .18s ease-out; }
@keyframes rh-bump { 50% { transform: scale(1.12); } }
.rh-top { margin-top: 4px; font-size: 13px; font-weight: 800; letter-spacing: 0.06em; color: rgba(255,255,255,0.92); text-shadow: 0 2px 0 rgba(0,0,0,0.3); }
.rh-right { position: absolute; right: 10px; top: 10px; display: flex; align-items: center; gap: 8px; pointer-events: auto; }
.rh-coins { display: inline-flex; align-items: center; gap: 6px; padding: 0 4px; font-size: 24px; font-weight: 900; color: #ffd23f; text-shadow: 0 2px 0 rgba(0,0,0,0.35); font-variant-numeric: tabular-nums; }
.rh-coins.is-bump { animation: rh-bump .2s ease-out; }
.rh-coin { width: 20px; height: 20px; border-radius: 4px; background: radial-gradient(circle at 50% 50%, #ffe27a 0 32%, #ffc93c 34% 100%); box-shadow: inset 0 -2px 0 #d99a12, 0 2px 0 rgba(0,0,0,0.3); }
.rh-ibtn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 12px; background: rgba(0,0,0,0.28); color: #fff; cursor: pointer;
  touch-action: manipulation; transition: background .15s, transform .1s; }
.rh-ibtn:hover { background: rgba(0,0,0,0.42); } .rh-ibtn:active { transform: scale(0.94); }
.rh-ibtn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; }
.rh-ibtn:focus-visible, .rh-mbtn:focus-visible, .rh-btn:focus-visible, .rh-card:focus-visible, .rh-lv:focus-visible, .rh-wtab:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.rh-powers { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); display: flex; gap: 6px; }
.rh-pw { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 8px; border-radius: 999px; background: rgba(0,0,0,0.38); font-size: 13px; font-weight: 800; white-space: nowrap; }
.rh-pw i { width: 10px; height: 10px; border-radius: 50%; }
.rh-pw b { font-variant-numeric: tabular-nums; }
.rh-level { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 900; text-shadow: 0 2px 0 rgba(0,0,0,0.3); }
.rh-lvname { font-size: 13px; letter-spacing: 0.08em; }
.rh-stars { font-size: 18px; letter-spacing: 2px; color: rgba(255,255,255,0.45); } .rh-stars b { color: #ffd23f; font-weight: 900; }
.rh-prog { width: 110px; height: 7px; border-radius: 99px; background: rgba(0,0,0,0.3); overflow: hidden; } .rh-prog i { display: block; height: 100%; width: 0; background: #fff; border-radius: 99px; transition: width .2s; }
.rh-level ~ .rh-powers { top: 66px; }

/* ---------- title ---------- */
.rh-title { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 22px 14px 16px; pointer-events: none; text-align: center; }
.rh-logo { margin: 0; display: flex; flex-direction: column; align-items: center; line-height: 0.86; font-size: clamp(46px, 12vmin, 86px); font-weight: 900; letter-spacing: -0.01em; text-transform: uppercase;
  color: #fff; text-shadow: 0 5px 0 #e8423c, 0 9px 0 #8a1f1f, 0 14px 20px rgba(0,0,0,0.3); transform: rotate(-4deg); animation: rh-logo-in .6s cubic-bezier(.2,1.4,.4,1) both; }
.rh-logo span:last-child { color: #ffd23f; margin-left: 0.6em; }
@keyframes rh-logo-in { from { transform: rotate(-4deg) translateY(-30px) scale(0.8); opacity: 0; } }
.rh-best { margin: 18px 0 0; font-size: 14px; font-weight: 800; letter-spacing: 0.05em; text-shadow: 0 2px 0 rgba(0,0,0,0.3); min-height: 1em; }
.rh-tap { margin: auto 0 18px; font-size: 18px; font-weight: 900; text-shadow: 0 2px 0 rgba(0,0,0,0.35); animation: rh-pulse 1.4s ease-in-out infinite; }
.rh-tap kbd { display: inline-block; min-width: 1.4em; padding: 0 5px; border-radius: 6px; background: rgba(0,0,0,0.3); font: inherit; }
.rh .hint-touch { display: none; }
@media (hover: none) and (pointer: coarse) { .rh .hint-kb { display: none; } .rh .hint-touch { display: inline; } }
@keyframes rh-pulse { 50% { transform: scale(1.06); opacity: 0.85; } }
.rh-menu { display: flex; gap: 8px; width: 100%; max-width: 420px; justify-content: center; pointer-events: auto; }
.rh-mbtn { flex: 1 1 0; max-width: 96px; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; min-height: 64px; padding: 8px 4px; border: 0; border-radius: 16px;
  background: rgba(255,255,255,0.94); color: #1d2440; font: inherit; font-size: 12px; font-weight: 900; cursor: pointer; touch-action: manipulation;
  box-shadow: 0 4px 0 rgba(0,0,0,0.22); transition: transform .1s, box-shadow .1s; }
.rh-mbtn:hover { transform: translateY(-1px); } .rh-mbtn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,0.22); }
.rh-mbtn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.rh-mic { width: 28px; height: 28px; display: grid; place-items: center; } .rh-mic svg { width: 28px; height: 28px; }
.rh-sound .off { display: none; } .rh-sound[aria-pressed="true"] .on { display: none; } .rh-sound[aria-pressed="true"] .off { display: inline; } .rh-sound[aria-pressed="true"] { color: #8a95a7; }

/* ---------- toast ---------- */
.rh-toast { position: absolute; left: 50%; top: 26%; transform: translate(-50%, -50%); padding: 10px 18px; border-radius: 14px; background: rgba(0,0,0,0.5); font-size: 20px; font-weight: 900;
  white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .25s; text-shadow: 0 2px 0 rgba(0,0,0,0.3); }
.rh-toast.is-on { opacity: 1; animation: rh-toast-in .35s cubic-bezier(.2,1.5,.4,1); }
@keyframes rh-toast-in { from { transform: translate(-50%, -50%) scale(0.7); } }

/* ---------- panels ---------- */
.rh-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 14px; background: rgba(10,16,36,0.45); z-index: 3; }
.rh-overlay.is-sheet { align-items: flex-end; background: linear-gradient(rgba(10,16,36,0) 30%, rgba(10,16,36,0.55)); padding-bottom: 0; }
.rh-panel { width: min(100%, 400px); max-height: 100%; overflow: auto; overscroll-behavior: contain; text-align: center; padding: 22px 18px 18px; border-radius: 22px; background: #fff; color: #1d2440;
  box-shadow: 0 8px 0 rgba(0,0,0,0.18), 0 20px 50px rgba(0,0,0,0.35); animation: rh-in .3s cubic-bezier(.2,1.3,.4,1); }
.is-sheet .rh-panel { width: min(100%, 560px); max-height: 62%; border-radius: 22px 22px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,0.3); animation: rh-up .3s cubic-bezier(.2,1,.3,1); }
@keyframes rh-in { from { opacity: 0; transform: scale(0.9) translateY(10px); } }
@keyframes rh-up { from { transform: translateY(40px); opacity: 0; } }
.rh-panel h3 { margin: 0 0 4px; font-size: 22px; font-weight: 900; }
.rh-kicker { margin: 0 0 2px; font-size: 12px; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; color: #8a95a7; }
.rh-big { margin: 0; font-size: 64px; line-height: 1; font-weight: 900; letter-spacing: -0.03em; }
.rh-sub { margin: 6px 0 14px; font-size: 14px; font-weight: 700; color: #5b6680; }
.rh-new { display: inline-block; padding: 3px 10px; border-radius: 99px; background: #ffd23f; color: #5a3d00; font-size: 12px; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; animation: rh-pulse 1s ease-in-out 3; }
.rh-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.rh-btn { flex: 1 1 0; min-width: 0; min-height: 48px; padding: 10px 14px; border: 0; border-radius: 14px; background: #eef1f7; color: #1d2440; font: inherit; font-size: 15px; font-weight: 900; cursor: pointer;
  touch-action: manipulation; box-shadow: 0 4px 0 #cfd6e4; transition: transform .1s, box-shadow .1s; white-space: nowrap; }
.rh-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #cfd6e4; }
.rh-btn-primary { background: #2fbf71; color: #fff; box-shadow: 0 4px 0 #1f8a50; font-size: 17px; }
.rh-btn-primary:active { box-shadow: 0 1px 0 #1f8a50; }
.rh-btn-wide { flex-basis: 100%; }
.rh-btn:disabled { opacity: 0.5; cursor: default; }
.rh-coinline { display: inline-flex; align-items: center; gap: 6px; font-weight: 900; color: #b47a00; }
.rh-coinline .rh-coin { width: 16px; height: 16px; }
.rh-unlock { margin: 10px 0 0; font-size: 13px; font-weight: 700; color: #5b6680; }
.rh-meter { height: 8px; margin: 6px auto 0; max-width: 220px; border-radius: 99px; background: #eef1f7; overflow: hidden; } .rh-meter i { display: block; height: 100%; background: #ffc93c; border-radius: 99px; }
.rh-close { position: absolute; right: 10px; top: 10px; width: 40px; height: 40px; border: 0; border-radius: 12px; background: #eef1f7; color: #1d2440; font-size: 22px; font-weight: 900; cursor: pointer; touch-action: manipulation; }
.rh-panel { position: relative; }
.rh-bigstars { display: flex; justify-content: center; gap: 6px; margin: 6px 0 4px; }
.rh-bigstars span { font-size: 44px; line-height: 1; color: #dfe4ec; transform: scale(0.6); animation: rh-star .4s cubic-bezier(.2,1.6,.4,1) forwards; }
.rh-bigstars span.on { color: #ffc93c; text-shadow: 0 3px 0 #d99a12; }
@keyframes rh-star { to { transform: scale(1); } }

/* characters */
.rh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 12px; }
.rh-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 7px; border: 2px solid transparent; border-radius: 16px; background: #f3f5fa; color: #1d2440;
  font: inherit; font-size: 13px; font-weight: 900; cursor: pointer; touch-action: manipulation; min-height: 112px; }
.rh-card svg { width: 58px; height: 58px; }
.rh-card small { font-size: 11px; font-weight: 800; color: #5b6680; }
.rh-card.is-sel { border-color: #2fbf71; background: #e6f8ee; }
.rh-card.is-locked svg { filter: grayscale(1) brightness(0.35); opacity: 0.6; }
.rh-card.is-buyable small { color: #b47a00; }
.rh-confirm { margin-top: 12px; padding: 12px; border-radius: 16px; background: #fff7dd; }
.rh-confirm p { margin: 0 0 8px; font-weight: 800; }

/* adventure */
.rh-worlds { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 6px; margin: 10px -4px 0; scrollbar-width: none; }
.rh-wtab { flex: none; min-height: 44px; padding: 8px 12px; border: 0; border-radius: 12px; background: #eef1f7; color: #1d2440; font: inherit; font-size: 13px; font-weight: 900; cursor: pointer; touch-action: manipulation; }
.rh-wtab[aria-selected="true"] { background: #1d2440; color: #fff; }
.rh-wtab:disabled { opacity: 0.45; cursor: default; }
.rh-levels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 8px; }
.rh-lv { min-height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 0; border-radius: 14px; background: #eef1f7; color: #1d2440;
  font: inherit; font-size: 18px; font-weight: 900; cursor: pointer; touch-action: manipulation; box-shadow: 0 3px 0 #cfd6e4; }
.rh-lv small { font-size: 12px; letter-spacing: 1px; color: #cfd6e4; } .rh-lv small b { color: #ffc93c; }
.rh-lv.is-done { background: #e6f8ee; box-shadow: 0 3px 0 #b9e8cd; }
.rh-lv:disabled { opacity: 0.4; cursor: default; box-shadow: none; }
.rh-wdesc { margin: 8px 0 0; font-size: 13px; font-weight: 700; color: #5b6680; }

.rh-nogl { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; background: #0b1328; color: #dfe9ff; text-align: center; }

/* ---------- full screen ---------- */
.stage.is-immersive .stage-body > .rh { min-height: 0; flex: 1 1 auto; }
.stage.is-immersive .rh-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) {
  .rh-logo { font-size: 44px; }
  .rh-best { margin-top: 8px; }
  .rh-tap { margin-bottom: 8px; font-size: 15px; }
  .rh-mbtn { min-height: 50px; padding: 5px 4px; }
  .rh-title { padding: 12px 14px 10px; }
  .is-sheet .rh-panel { max-height: 78%; }
}
@media (prefers-reduced-motion: reduce) {
  .rh-tap, .rh-logo, .rh-new, .rh-score.is-bump, .rh-coins.is-bump { animation: none; }
  .rh-panel, .is-sheet .rh-panel { animation: none; }
}
.rh-best .rh-coinline { color: #ffd23f; }
