:root {
  --navy: #1d2350; --navy2: #2c356f; --cream: #fff6e3; --mag: #ff3ea5; --cyan: #22cfee; --yel: #ffd23a;
  --font: "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  --panelTop: 46%;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--navy); }
body { font-family: var(--font); color: var(--navy); user-select: none; -webkit-user-select: none; touch-action: none; }
#app { position: fixed; inset: 0; overflow: hidden; }
#stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

.outline { text-shadow: -2px -2px 0 var(--navy), 2px -2px 0 var(--navy), -2px 2px 0 var(--navy), 2px 2px 0 var(--navy), 0 2px 0 var(--navy), 0 -2px 0 var(--navy), 2px 0 0 var(--navy), -2px 0 0 var(--navy), 0 4px 0 var(--navy); }

/* ---------------- HUD ---------------- */
#hud { position: absolute; left: 0; right: 0; top: 0; padding: calc(8px + env(safe-area-inset-top)) 66px 0 calc(10px + env(safe-area-inset-left)); pointer-events: none; z-index: 5; }
.hud-main { display: flex; align-items: center; gap: 8px; }
.hud-cap { width: 40px; height: 40px; object-fit: contain; animation: bob 2.4s ease-in-out infinite; }
.hud-num { font-size: 30px; font-weight: 900; color: var(--cream); line-height: 1; letter-spacing: 0.5px;
  text-shadow: -2px -2px 0 var(--navy), 2px -2px 0 var(--navy), -2px 2px 0 var(--navy), 2px 2px 0 var(--navy), 0 3px 0 var(--navy), 0 5px 0 var(--mag); }
.hud-num.bump { animation: bump 0.18s ease-out; }
.hud-sub { font-size: 12px; font-weight: 800; color: var(--yel); margin-top: 3px;
  text-shadow: -1px -1px 0 var(--navy), 1px -1px 0 var(--navy), -1px 1px 0 var(--navy), 1px 1px 0 var(--navy); }
.chips { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.chip { display: flex; align-items: center; gap: 4px; padding: 3px 9px 3px 5px; border-radius: 14px; background: rgba(29, 35, 80, 0.82);
  border: 2.5px solid var(--cream); color: var(--cream); font-size: 15px; font-weight: 900; box-shadow: 0 3px 0 var(--navy); }
.chip img { width: 20px; height: 20px; object-fit: contain; }
.chip-ico { width: 20px; height: 20px; border-radius: 50%; background: var(--yel); color: var(--navy); font-size: 13px; display: flex; align-items: center; justify-content: center; font-weight: 900; }
#chipRate .chip-ico { background: var(--cyan); }
.boost { margin-top: 5px; display: inline-block; padding: 2px 10px; border-radius: 12px; background: var(--mag); color: #fff; font-size: 13px; font-weight: 900;
  border: 2px solid var(--cream); animation: pulse 1s ease-in-out infinite; }
.log { margin-top: 6px; font-size: 13px; font-weight: 700; color: var(--cream); background: rgba(14, 18, 48, 0.72); border-radius: 10px; padding: 4px 9px;
  border-left: 4px solid var(--cyan); min-height: 24px; line-height: 1.35; max-width: 100%; }
.log .old { opacity: 0.55; font-size: 12px; }
.log .new { animation: typein 0.35s ease-out; }

.chip.warn { background: #e8204f; animation: pulse 0.8s ease-in-out infinite; }
.goal { margin-top: 6px; display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 3px 10px 3px 6px; border-radius: 12px;
  background: var(--yel); color: var(--navy); border: 2.5px solid var(--navy); font-size: 13px; font-weight: 900; line-height: 1.25; box-shadow: 0 3px 0 var(--navy); }
.goal::before { content: ""; flex: none; width: 12px; height: 12px; border-radius: 50%; background: radial-gradient(var(--mag) 0 2px, #fff 2.5px 4px, var(--mag) 4.5px); border: 1.5px solid var(--navy); }

/* new-player guide: a speech bubble from GACHA-01 and a ring on the thing to press */
.guide { pointer-events: auto; margin-top: 6px; display: flex; align-items: flex-start; gap: 6px; }
.guide.pop { animation: pop 0.28s cubic-bezier(.2, 1.5, .4, 1) both; }
.guide-face { flex: none; width: 50px; height: 50px; object-fit: contain; margin-top: 2px; filter: drop-shadow(0 2px 0 var(--navy)); animation: bob 2.4s ease-in-out infinite; }
.guide-body { flex: 1; min-width: 0; position: relative; background: var(--cream); border: 3px solid var(--navy); border-radius: 14px; padding: 7px 10px; box-shadow: 0 4px 0 var(--navy);
  background-image: radial-gradient(rgba(255, 62, 165, 0.16) 1.2px, transparent 1.6px); background-size: 8px 8px; }
.guide-body::before { content: ""; position: absolute; left: -10px; top: 14px; border: 7px solid transparent; border-right: 9px solid var(--navy); border-left: 0; }
.guide-text { font-size: 14px; font-weight: 800; line-height: 1.4; color: var(--navy); }
.guide-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.btn.small { font-size: 12px; min-height: 44px; opacity: 0.85; }
.guide-ring { position: absolute; z-index: 6; pointer-events: none; border: 4px solid var(--yel); border-radius: 18px;
  box-shadow: 0 0 0 3px var(--navy), 0 0 18px 4px rgba(255, 210, 58, 0.8); animation: ringPulse 1s ease-in-out infinite; transition: left 0.2s, top 0.2s, width 0.2s, height 0.2s; }
.guide-ring i { position: absolute; left: 50%; top: -26px; width: 0; height: 0; margin-left: -11px; border: 11px solid transparent; border-top: 16px solid var(--yel);
  filter: drop-shadow(0 2px 0 var(--navy)); animation: arrowBob 0.7s ease-in-out infinite; }
@keyframes ringPulse { 50% { transform: scale(1.04); box-shadow: 0 0 0 3px var(--navy), 0 0 28px 8px rgba(255, 210, 58, 0.95); } }
@keyframes arrowBob { 50% { transform: translateY(-6px); } }
/* hand-holding tutorial: the rest of the screen dims around the ring; the HUD (with the bubble) stays above it */
.guide-ring.dim { box-shadow: 0 0 0 3px var(--navy), 0 0 18px 4px rgba(255, 210, 58, 0.8), 0 0 0 200vmax rgba(12, 14, 40, 0.42); animation: ringPulseDim 1s ease-in-out infinite; }
@keyframes ringPulseDim { 50% { transform: scale(1.04); box-shadow: 0 0 0 3px var(--navy), 0 0 28px 8px rgba(255, 210, 58, 0.95), 0 0 0 200vmax rgba(12, 14, 40, 0.42); } }
#app.guiding #hud { z-index: 7; }
.guide-ring.nope { animation: ringNope 0.32s ease-in-out; }
@keyframes ringNope { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.guide-hand { position: absolute; left: 50%; top: 100%; width: 52px; height: 52px; margin: 0 0 0 -16px; object-fit: contain; filter: drop-shadow(0 2px 0 var(--navy)); animation: handUp 0.8s ease-in-out infinite; }
.guide-ring.above .guide-hand { top: auto; bottom: 100%; animation: handDown 0.8s ease-in-out infinite; }
.guide-ring.has-hand i { display: none; }
@keyframes handUp { 0%, 100% { transform: translateY(6px); } 50% { transform: translateY(-4px); } }
@keyframes handDown { 0%, 100% { transform: translateY(-6px) rotate(180deg); } 50% { transform: translateY(4px) rotate(180deg); } }


.flash-new { animation: pop 0.3s cubic-bezier(.2, 1.5, .4, 1) both, glow 1.2s ease-out; }

/* ---------------- Title ---------------- */
#title { position: absolute; inset: 0; z-index: 20; background: var(--navy) url(assets/cover-bg.webp) center / cover no-repeat; cursor: pointer; overflow: hidden; }
.title-shade { position: absolute; inset: 0; background: linear-gradient(transparent 60%, rgba(14, 18, 48, 0.55)); }
#titleLogo { position: absolute; left: 50%; top: 9%; width: 82%; max-height: 30%; object-fit: contain; transform: translateX(-50%); animation: logoIn 0.7s cubic-bezier(.2, 1.6, .4, 1) both, float 3.2s 0.7s ease-in-out infinite; filter: drop-shadow(0 6px 0 rgba(29, 35, 80, 0.5)); }
#titlePrompt { position: absolute; left: 0; right: 0; bottom: 13%; text-align: center; font-size: 24px; font-weight: 900; color: #fff; animation: pulse 1.4s ease-in-out infinite;
  text-shadow: -3px -3px 0 var(--navy), 3px -3px 0 var(--navy), -3px 3px 0 var(--navy), 3px 3px 0 var(--navy), 0 5px 0 var(--mag); }
#titleKey { position: absolute; left: 0; right: 0; bottom: calc(13% - 26px); text-align: center; font-size: 14px; font-weight: 800; color: var(--yel);
  text-shadow: -1px -1px 0 var(--navy), 1px -1px 0 var(--navy), -1px 1px 0 var(--navy), 1px 1px 0 var(--navy); }
.corner-btn { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: calc(12px + env(safe-area-inset-right)); width: 48px; height: 48px; border-radius: 50%;
  background: rgba(29, 35, 80, 0.55); border: 3px solid rgba(255, 246, 227, 0.85); display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.corner-btn:active { transform: scale(0.9); }

/* ---------------- Intro ---------------- */
#intro { position: absolute; inset: 0; z-index: 30; background: var(--navy) url(assets/cover-bg.webp) center / cover; }
#intro video { width: 100%; height: 100%; object-fit: cover; display: block; }
.skip-btn { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; }

/* ---------------- Banner / modal / ending ---------------- */
#banner { position: absolute; inset: 0; z-index: 15; display: flex; align-items: center; justify-content: center; pointer-events: none; opacity: 0; }
#banner.show { animation: bannerIn 2.6s ease-out both; }
.banner-plate { padding: 16px 30px; text-align: center; border-style: solid; border-width: 24px; border-image: url(assets/ui-panel.webp) 64 fill / 24px stretch; transform: rotate(-4deg); max-width: 92%; }
#bannerSmall { font-size: 16px; font-weight: 900; color: var(--mag); }
#bannerBig { font-size: 30px; font-weight: 900; color: var(--navy); margin-top: 2px; }
#modal { position: absolute; inset: 0; z-index: 40; background: rgba(14, 18, 48, 0.6); display: flex; align-items: center; justify-content: center; }
.modal-box { width: 86%; max-width: 360px; border: 4px solid var(--navy); border-radius: 20px; background: var(--cream); padding: 16px 16px 14px; animation: pop 0.25s cubic-bezier(.2, 1.5, .4, 1) both; }
#modalText { font-size: 15px; font-weight: 700; line-height: 1.5; white-space: pre-line; margin-bottom: 12px; }
#modalBtns { display: flex; gap: 10px; justify-content: center; }
#ending { position: absolute; inset: 0; z-index: 25; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; background: radial-gradient(rgba(14, 18, 48, 0.25), rgba(14, 18, 48, 0.85)); }
#ending div { font-size: 21px; font-weight: 900; color: #fff; opacity: 0; animation: fadeUp 1s ease-out forwards;
  text-shadow: -2px -2px 0 var(--navy), 2px -2px 0 var(--navy), -2px 2px 0 var(--navy), 2px 2px 0 var(--navy), 0 4px 0 var(--mag); }
#ending .time { font-size: 28px; color: var(--yel); }

@keyframes bob { 50% { transform: translateY(-3px) rotate(-6deg); } }
@keyframes bump { 50% { transform: scale(1.12); } }
@keyframes pulse { 50% { opacity: 0.65; transform: scale(0.97); } }
@keyframes typein { from { opacity: 0; transform: translateX(-6px); } }
@keyframes slideUp { from { transform: translateY(40%); opacity: 0; } }
@keyframes pop { from { transform: scale(0.85); opacity: 0; } }
@keyframes glow { 0% { filter: drop-shadow(0 0 10px var(--yel)); } 100% { filter: none; } }
@keyframes wiggle { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-3deg) scale(1.04); } 90% { transform: rotate(3deg) scale(1.04); } 95% { transform: rotate(-2deg); } }
@keyframes logoIn { from { transform: translate(-50%, -40px) scale(0.6); opacity: 0; } }
@keyframes float { 50% { transform: translate(-50%, -6px); } }
@keyframes bannerIn { 0% { opacity: 0; transform: scale(2.2); } 12% { opacity: 1; transform: scale(0.95); } 18% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(1.05); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
