/* Expo Tycoon slice: mobile-game HUD. Every element carries its own dark
   outline and hard shadow so it reads over any part of the 3D scene. */
:root {
  --ink: #1b1f3b;
  --green: #3ddc4a; --green-edge: #1e9a2b;
  --gold: #ffb400; --gold-edge: #d47a00;
  --blue: #2fa8ff; --blue-edge: #1766c2;
  --red: #ff4d5e; --red-edge: #b81d33;
  --coin: #ffd23f;
  --cream: #fff6e3;
  --display: 'Lilita One', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --body: 'Fredoka', 'Arial Rounded MT Bold', system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* The hidden attribute must win over any display rule below (the popup layer
   is display:grid and would otherwise cover the screen and eat every touch). */
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #7ec8e3; font-family: var(--body); color: var(--ink); touch-action: none; user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
#stage { position: fixed; inset: 0; }
#stage canvas { display: block; }
#world, #fx { position: fixed; inset: 0; pointer-events: none; }

.g-text { font-family: var(--display); color: #fff; -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; text-shadow: 0 3px 0 var(--ink); letter-spacing: 0.02em; }

/* ---- HUD frame ---- */
.hud { position: fixed; pointer-events: none; z-index: 5;
  inset: calc(env(safe-area-inset-top) + 10px) calc(env(safe-area-inset-right) + 12px) calc(env(safe-area-inset-bottom) + 14px) calc(env(safe-area-inset-left) + 12px); }
.hud > * { position: absolute; }
.hud button, .hud .pill { pointer-events: auto; }
.tl { top: 0; left: 0; display: flex; gap: 8px; align-items: center; }
.tr { top: 0; right: 0; }
.tc { top: 118px; left: 50%; transform: translateX(-50%); display: grid; justify-items: center; gap: 6px; }
.br { right: 0; bottom: 0; }
.bc { left: 50%; bottom: 0; transform: translateX(-50%); }

.pill { position: relative; height: 42px; min-width: 96px; border-radius: 999px; border: 3px solid var(--ink); background: rgba(27, 31, 59, 0.78);
  box-shadow: 0 3px 0 var(--ink); padding: 0 16px 0 46px; display: flex; align-items: center; gap: 8px; }
.pill b { font-family: var(--display); font-size: 22px; color: #fff; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; font-weight: 400; font-variant-numeric: tabular-nums; }
.pill-icon { position: absolute; left: -6px; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; display: grid; place-items: center; font-size: 30px; filter: drop-shadow(0 3px 0 var(--ink)); }
.pill-icon.coin::before { content: '฿'; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-size: 24px; color: #fff;
  background: radial-gradient(circle at 35% 30%, #fff3a8 0 18%, var(--coin) 19% 70%, #e5a800 71%); border: 3px solid var(--ink); -webkit-text-stroke: 3px #b37800; paint-order: stroke fill; }
.pill.cash { min-width: 130px; }
.pill.bump { animation: bump 0.14s ease-out; }
@keyframes bump { 50% { transform: scale(1.15); } }
.xp { display: block; width: 44px; height: 10px; border-radius: 6px; background: var(--ink); overflow: hidden; }
.xp i { display: block; height: 100%; width: 0; background: var(--coin); border-radius: 6px; transition: width 0.4s; }
.icon-btn { width: 44px; height: 44px; border-radius: 14px; border: 3px solid var(--ink); background: var(--blue); box-shadow: 0 4px 0 var(--blue-edge), 0 7px 0 var(--ink); font-size: 20px; }
.icon-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--blue-edge), 0 4px 0 var(--ink); }

.edition { font-size: 20px; opacity: 0.95; }
.timer { position: relative; width: min(62vw, 300px); height: 30px; border-radius: 999px; border: 3px solid var(--ink); background: var(--ink); box-shadow: 0 3px 0 var(--ink); overflow: hidden; }
.timer i { position: absolute; inset: 0; width: 100%; background: linear-gradient(#ffd66b 0 45%, var(--gold) 45%); transition: width 0.25s linear; }
.timer.low i { background: linear-gradient(#ff8a96 0 45%, var(--red) 45%); animation: flash 0.5s steps(2) infinite; }
@keyframes flash { 50% { filter: brightness(1.4); } }
.timer b { position: relative; display: block; text-align: center; font-size: 20px; line-height: 24px; -webkit-text-stroke: 4px var(--ink); }

.hint { left: 50%; top: 184px; transform: translateX(-50%); font-size: 20px; white-space: nowrap; animation: hintIn 0.3s cubic-bezier(.3,1.6,.5,1); }
@keyframes hintIn { from { transform: translateX(-50%) scale(0.6); opacity: 0; } }

/* ---- buttons ---- */
.btn { font: 24px/1 var(--display); color: #fff; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; min-height: 60px; padding: 14px 24px;
  border: 4px solid var(--ink); border-radius: 18px; background: linear-gradient(#5cf06a 0 45%, var(--green) 45%);
  box-shadow: 0 6px 0 var(--green-edge), 0 10px 0 var(--ink); transition: transform 0.06s, box-shadow 0.06s; }
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--green-edge), 0 6px 0 var(--ink); }
.btn.gold { background: linear-gradient(#ffd24d 0 45%, var(--gold) 45%); box-shadow: 0 6px 0 var(--gold-edge), 0 10px 0 var(--ink); }
.btn.cta { animation: ctaPulse 1.2s ease-in-out infinite; }
@keyframes ctaPulse { 50% { transform: scale(1.06); } }

/* ---- joystick ---- */
.joy { position: fixed; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; background: rgba(255, 255, 255, 0.25); border: 4px solid rgba(27, 31, 59, 0.5); z-index: 6; pointer-events: none; }
.joy i { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: #fff; border: 4px solid var(--ink); box-shadow: 0 4px 0 var(--ink); }

/* ---- world-space labels (projected each frame) ---- */
.w { position: absolute; left: 0; top: 0; will-change: transform; }
.tile { display: grid; justify-items: center; gap: 2px; transform-origin: 50% 100%; }
.tile .ring { width: 58px; height: 58px; border-radius: 50%; border: 4px solid var(--ink); display: grid; place-items: center; font-size: 26px;
  background: conic-gradient(var(--green) calc(var(--p, 0) * 1%), #fff calc(var(--p, 0) * 1%)); box-shadow: 0 4px 0 var(--ink); }
.tile .ring span { width: 42px; height: 42px; border-radius: 50%; background: #fff; display: grid; place-items: center; border: 3px solid var(--ink); }
.tile .price { font: 20px/1 var(--display); color: #fff; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; text-shadow: 0 2px 0 var(--ink); white-space: nowrap; }
.tile.cant .price { color: #ffb3ba; }
.tile.can .ring { animation: can 1.2s ease-in-out infinite; }
@keyframes can { 50% { transform: scale(1.08); } }
.tile.locked .ring { background: #adb5bd; filter: grayscale(0.4); }
.tile.locked .price { font-size: 16px; }
.tile.doors .ring { width: 72px; height: 72px; background: conic-gradient(var(--green) calc(var(--p, 0) * 1%), var(--gold) calc(var(--p, 0) * 1%)); font-size: 32px; animation: can 0.9s ease-in-out infinite; }
.tile.doors .price { font-size: 22px; }
.bubble { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50% 50% 50% 8px; background: #fff; border: 4px solid var(--ink); box-shadow: 0 4px 0 var(--ink);
  font-size: 28px; transform-origin: 20% 100%; animation: pop 0.3s cubic-bezier(.3,1.8,.5,1); }
.bubble.timed { background: conic-gradient(var(--red) calc(var(--p, 0) * 1%), #fff calc(var(--p, 0) * 1%)); }
.bubble.timed span { width: 42px; height: 42px; border-radius: 50%; background: #fff; display: grid; place-items: center; }
.bubble.gold { background: var(--coin); }
.bubble.angry { animation: shake 0.4s; background: #ffb3ba; }
@keyframes pop { from { transform: scale(0); } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
/* The guide arrow: tip at the element's origin, pointing right before rotation. */
.guide { position: fixed; left: 0; top: 0; width: 0; height: 0; z-index: 8; pointer-events: none; will-change: transform; }
.guide i { position: absolute; left: -34px; top: -20px; width: 0; height: 0; border-top: 20px solid transparent; border-bottom: 20px solid transparent;
  border-left: 34px solid var(--red); filter: drop-shadow(0 0 0 var(--ink)) drop-shadow(0 3px 0 var(--ink)); }
.arrow { font-size: 44px; filter: drop-shadow(0 4px 0 var(--ink)); animation: bob 0.7s ease-in-out infinite alternate; }
.arrow::before { content: ''; display: block; width: 0; height: 0; border-left: 20px solid transparent; border-right: 20px solid transparent; border-top: 30px solid #ff4d5e; filter: drop-shadow(0 0 0 var(--ink)); }
@keyframes bob { to { transform: translateY(-14px); } }
.edge-arrow { position: absolute; width: 0; height: 0; border-top: 16px solid transparent; border-bottom: 16px solid transparent; border-left: 26px solid var(--red); filter: drop-shadow(0 3px 0 var(--ink)); }
.float { font: 26px/1 var(--display); color: var(--coin); -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; text-shadow: 0 3px 0 var(--ink); white-space: nowrap; animation: rise 0.8s ease-out forwards; }
.float.bad { color: #ff8a96; }
@keyframes rise { to { transform: translateY(-50px); opacity: 0; } }
.stack { font-size: 22px; letter-spacing: -8px; }

/* ---- coin fly to the counter ---- */
.flycoin { position: fixed; left: 0; top: 0; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; z-index: 30;
  background: radial-gradient(circle at 35% 30%, #fff3a8 0 18%, var(--coin) 19% 70%, #e5a800 71%); border: 3px solid var(--ink); }

/* ---- banner (DOORS OPEN, etc.) ---- */
.banner { position: fixed; left: 50%; top: 38%; transform: translate(-50%, -50%); z-index: 20; font-size: clamp(30px, 8.5vw, 64px); white-space: nowrap; max-width: 96vw; text-align: center; animation: bannerIn 1.6s cubic-bezier(.3,1.6,.5,1) forwards; pointer-events: none; }
@keyframes bannerIn { 0% { transform: translate(-50%, -50%) scale(0.3) rotate(-8deg); opacity: 0; } 20% { transform: translate(-50%, -50%) scale(1.1) rotate(2deg); opacity: 1; } 80% { transform: translate(-50%, -50%) scale(1) rotate(0); opacity: 1; } 100% { transform: translate(-50%, -80%) scale(1); opacity: 0; } }

/* ---- popups (results) ---- */
.scrim { position: fixed; inset: 0; background: rgba(10, 12, 30, 0.6); z-index: 40; animation: fade 0.2s; }
@keyframes fade { from { opacity: 0; } }
.popup-wrap { position: fixed; inset: 0; z-index: 41; display: grid; place-items: center; padding: 20px; }
.popup { position: relative; width: min(380px, 100%); background: var(--cream); border: 5px solid var(--ink); border-radius: 28px; box-shadow: 0 10px 0 var(--ink);
  padding: 52px 18px 22px; text-align: center; animation: popIn 0.28s cubic-bezier(.3,1.6,.5,1); }
@keyframes popIn { from { transform: scale(0.6); } }
.ribbon { position: absolute; top: -28px; left: 50%; transform: translateX(-50%); background: var(--blue); border: 4px solid var(--ink); border-radius: 14px;
  padding: 8px 26px; box-shadow: 0 5px 0 var(--blue-edge), 0 8px 0 var(--ink); font-size: 26px; white-space: nowrap; animation: dropIn 0.3s 0.1s cubic-bezier(.3,1.6,.5,1) backwards; }
@keyframes dropIn { from { transform: translate(-50%, -40px); opacity: 0; } }
.stars { display: flex; justify-content: center; gap: 6px; margin: 0 0 12px; }
.stars i { font-style: normal; font-size: 52px; filter: grayscale(1) brightness(0.8); opacity: 0.45; }
.stars i.on { filter: drop-shadow(0 4px 0 var(--ink)); opacity: 1; animation: starIn 0.35s cubic-bezier(.3,1.8,.5,1); }
.stars i:nth-child(2) { transform: translateY(-10px); font-size: 62px; }
@keyframes starIn { from { transform: scale(0) rotate(-30deg); } }
.rows { display: grid; gap: 8px; margin: 8px 0 16px; }
.row { display: grid; grid-template-columns: 40px 1fr auto auto; align-items: center; gap: 8px; background: #fff; border: 3px solid var(--ink); border-radius: 14px; padding: 6px 12px; box-shadow: 0 3px 0 var(--ink);
  font: 700 17px/1.1 var(--body); text-align: left; animation: rowIn 0.3s cubic-bezier(.3,1.6,.5,1) backwards; }
@keyframes rowIn { from { transform: scale(0.7); opacity: 0; } }
.row .ic { font-size: 26px; }
.row b { font: 22px/1 var(--display); color: var(--ink); }
.row .mini { font-size: 14px; letter-spacing: -2px; }
.total { font-size: 34px; margin: 4px 0 14px; }
.popup .note { font: 700 16px/1.3 var(--body); margin: 0 0 14px; }
.popup .btn { width: 100%; }

#errors { position: fixed; inset: 20px; background: #2a1414; color: #ffd0cb; padding: 20px; border-radius: 10px; white-space: pre-wrap; z-index: 99; }

/* Desktop: keep the HUD in phone-like proportions near the corners. */
@media (min-width: 900px) {
  .pill b { font-size: 24px; }
  .tc { top: 12px; }
  .hint { top: 110px; }
}

/* ---- splash ---- */
.splash { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; overflow: hidden; background: linear-gradient(#5fd0ff, #1b7fe0); transition: opacity 0.35s, transform 0.35s; }
.splash.gone { opacity: 0; transform: scale(1.08); pointer-events: none; }
.rays { position: absolute; left: 50%; top: 40%; width: 220vmax; height: 220vmax; margin: -110vmax 0 0 -110vmax;
  background: repeating-conic-gradient(rgba(255, 255, 255, 0.15) 0 10deg, transparent 10deg 20deg); animation: spin 40s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.splash-in { position: relative; display: grid; justify-items: center; gap: 10px; padding: 24px; text-align: center; }
.splash-icon { width: min(46vw, 190px); height: auto; filter: drop-shadow(0 10px 0 var(--ink)); animation: float 2.4s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-12px) rotate(-2deg); } }
.wordmark { margin: 6px 0 0; font-weight: 400; line-height: 0.92; font-size: clamp(56px, 17vw, 96px); -webkit-text-stroke: 10px var(--ink); text-shadow: 0 7px 0 var(--ink); display: grid; }
.wordmark .gold { color: var(--coin); }
.tagline { margin: 4px 0 18px; font-size: clamp(18px, 5vw, 24px); -webkit-text-stroke: 5px var(--ink); }
.btn.play { font-size: 32px; min-width: 240px; min-height: 72px; animation: ctaPulse 1.2s ease-in-out infinite; }
.btn.play:disabled { animation: none; filter: grayscale(0.6); opacity: 0.8; }
.fine { margin: 14px 0 0; font: 700 13px/1.3 var(--body); color: #e7f5ff; opacity: 0.85; }

/* ---- popups: close X, ribbons, level-up, upgrades ---- */
.popup .close { position: absolute; top: -16px; right: -16px; width: 52px; height: 52px; border-radius: 50%; background: var(--red); border: 4px solid var(--ink);
  box-shadow: 0 4px 0 var(--red-edge), 0 7px 0 var(--ink); font: 24px/1 var(--display); color: #fff; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; }
.popup .close:active { transform: translateY(3px); }
.ribbon.gold { background: var(--gold); box-shadow: 0 5px 0 var(--gold-edge), 0 8px 0 var(--ink); }
.row.bonus { background: #f3f0ff; }
.popup.celebrate { overflow: visible; }
.popup.celebrate::before { content: ''; position: absolute; inset: -60px; z-index: -1; border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 210, 63, 0.55) 0 12deg, transparent 12deg 24deg); animation: spin 8s linear infinite; }
.lvl { font-size: 96px; line-height: 1; margin: 0 0 8px; color: var(--coin); -webkit-text-stroke: 10px var(--ink); text-shadow: 0 7px 0 var(--ink); animation: starIn 0.5s cubic-bezier(.3,1.8,.5,1); }
.perk { display: flex; gap: 12px; align-items: center; text-align: left; background: #fff; border: 3px solid var(--ink); border-radius: 16px; padding: 10px 14px; margin: 0 0 16px; box-shadow: 0 3px 0 var(--ink); }
.perk .ic { font-size: 40px; }
.perk b { display: block; font: 22px/1.1 var(--display); }
.perk small { font: 700 15px/1.3 var(--body); color: #495057; }
.ups { display: grid; gap: 10px; }
.up { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 10px; background: #fff; border: 3px solid var(--ink); border-radius: 16px; padding: 8px 10px; box-shadow: 0 3px 0 var(--ink); text-align: left; }
.up.locked { opacity: 0.6; }
.up .ic { font-size: 30px; text-align: center; }
.up b { display: block; font: 700 16px/1.15 var(--body); }
.pips { display: flex; gap: 4px; margin-top: 4px; }
.pips i { width: 16px; height: 10px; border-radius: 4px; background: #dee2e6; border: 2px solid var(--ink); }
.pips i.on { background: var(--green); }
.btn.small { font-size: 17px; min-height: 42px; padding: 8px 12px; border-radius: 14px; box-shadow: 0 4px 0 var(--green-edge), 0 7px 0 var(--ink); -webkit-text-stroke: 3px var(--ink); }
.btn.small.off { background: linear-gradient(#ced4da 0 45%, #adb5bd 45%); box-shadow: 0 4px 0 #868e96, 0 7px 0 var(--ink); }
.maxed { font-size: 20px; color: var(--coin); -webkit-text-stroke: 4px var(--ink); padding: 0 8px; }
.tile.big .ring { width: 70px; height: 70px; font-size: 32px; }
.tile.big .ring span { width: 52px; height: 52px; }
.tile.big .price { font-size: 19px; }
.bubble.speaker { background: #e5dbff; }
.banner.big { font-size: clamp(34px, 10vw, 80px); color: var(--coin); }

/* ---- jump button ---- */
.jump { width: 72px; height: 72px; border-radius: 50%; border: 4px solid var(--ink); background: radial-gradient(circle at 35% 30%, #74c0fc, var(--blue) 70%);
  box-shadow: 0 6px 0 var(--blue-edge), 0 10px 0 var(--ink); font: 34px/1 var(--display); color: #fff; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; opacity: 0.92; }
.jump:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--blue-edge), 0 6px 0 var(--ink); }
@media (pointer: fine) { .jump { width: 56px; height: 56px; font-size: 26px; opacity: 0.7; } }

/* ---- quest chip + board ---- */
.quest { position: absolute; top: 54px; left: 50%; transform: translateX(-50%); pointer-events: auto; display: grid; grid-template-columns: 30px 1fr; grid-template-rows: auto 8px; column-gap: 8px; row-gap: 3px;
  align-items: center; width: min(78vw, 330px); padding: 6px 12px 7px 8px; border-radius: 16px; border: 3px solid var(--ink); background: var(--cream); box-shadow: 0 4px 0 var(--ink); text-align: left; }
.quest .qi { grid-row: span 2; font-size: 24px; text-align: center; }
.quest .qt { font: 700 14px/1.15 var(--body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quest .qbar { display: block; height: 8px; border-radius: 4px; background: #dee2e6; border: 2px solid var(--ink); overflow: hidden; }
.quest .qbar i { display: block; height: 100%; width: 0; background: var(--green); transition: width 0.3s; }
.quest.done { background: linear-gradient(#ffe066, var(--gold)); animation: chipPulse 0.9s ease-in-out infinite; }
@keyframes chipPulse { 50% { scale: 1.06; } }
.quest.done .qt { font-family: var(--display); font-weight: 400; font-size: 17px; color: #fff; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; }
.quest.done .qbar i { background: #fff; }
.quest:active { transform: translateX(-50%) translateY(3px); }
@media (min-width: 900px) { .quest:active { transform: translateY(3px); } }
.qcard { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; background: #fff; border: 3px solid var(--ink); border-radius: 16px; padding: 10px 12px; box-shadow: 0 3px 0 var(--ink); text-align: left; margin: 0 0 10px; }
.qcard .ic { font-size: 30px; text-align: center; }
.qcard b { display: block; font: 700 16px/1.2 var(--body); }
.qcard .qbar { display: block; height: 10px; border-radius: 5px; background: #dee2e6; border: 2px solid var(--ink); overflow: hidden; margin-top: 5px; }
.qcard .qbar i { display: block; height: 100%; background: var(--green); }
.qcard .rw { font: 18px/1 var(--display); color: var(--coin); -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; white-space: nowrap; }
.qcard.next { opacity: 0.55; box-shadow: none; }
.qdone { font: 700 14px/1.3 var(--body); color: #495057; margin: 4px 0 14px; }

/* ---- autopilot, campaigns, incidents ---- */
.tr { display: grid; justify-items: end; gap: 6px; }
.auto { pointer-events: auto; font: 15px/1 var(--display); color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; padding: 6px 10px; border-radius: 12px;
  border: 3px solid var(--ink); background: #adb5bd; box-shadow: 0 3px 0 var(--ink); white-space: nowrap; }
.auto.on { background: linear-gradient(#ffd24d, var(--gold)); }
.autocard { position: fixed; left: 50%; top: 150px; transform: translateX(-50%); z-index: 25; font-size: 22px; padding: 8px 16px; border-radius: 16px; background: rgba(27, 31, 59, 0.85);
  border: 3px solid var(--ink); white-space: nowrap; animation: hintIn 0.3s cubic-bezier(.3,1.6,.5,1), fadeOut 0.4s 2.2s forwards; }
@keyframes fadeOut { to { opacity: 0; transform: translateX(-50%) translateY(-20px); } }
.ribbon.pink { background: #f06595; box-shadow: 0 5px 0 #c2255c, 0 8px 0 var(--ink); }
.up small { display: block; font: 600 13px/1.25 var(--body); color: #495057; }
.up.picked { outline: 4px solid var(--green); }
.bubble.alert { background: conic-gradient(var(--red) calc(var(--p, 0) * 1%), #ffe3e3 calc(var(--p, 0) * 1%)); animation: pop 0.3s cubic-bezier(.3,1.8,.5,1), shake 0.5s 0.3s 2; }
.bubble.alert span, .bubble.gold span { width: 42px; height: 42px; border-radius: 50%; background: #fff; display: grid; place-items: center; }

@media (min-width: 900px) { .quest { top: 56px; left: 0; transform: none; } }
/* The big call to action sits in the lower middle, where the eye is. */
.bc { left: 50%; bottom: 16vh; transform: translateX(-50%); }
.bc .btn.cta { font-size: 30px; min-height: 72px; padding: 16px 34px; white-space: nowrap; animation: chipPulse 1.2s ease-in-out infinite; }

/* ---- side menu with red dots ---- */
.side-menu { position: absolute; left: 0; top: 118px; display: grid; gap: 10px; }
.mbtn { position: relative; pointer-events: auto; width: 48px; height: 48px; border-radius: 16px; border: 3px solid var(--ink); background: var(--cream); box-shadow: 0 4px 0 var(--ink); font-size: 24px; }
.mbtn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.dot { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; background: #ff2d3f; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--ink); animation: dotPulse 1s ease-in-out infinite; }
@keyframes dotPulse { 50% { scale: 1.25; } }
.w .dot { position: absolute; top: -4px; right: -4px; }
@media (min-width: 900px) { .side-menu { top: 120px; } }
/* ---- splash: profile + ticker ---- */
.profile { display: grid; justify-items: center; gap: 10px; margin: 0 0 8px; }
.profile input { width: min(70vw, 260px); font: 22px/1 var(--display); text-align: center; padding: 10px 14px; border-radius: 14px; border: 4px solid var(--ink); background: #fff; color: var(--ink); box-shadow: 0 4px 0 var(--ink); }
.hats { display: flex; gap: 8px; }
.hats button { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--ink); box-shadow: 0 3px 0 var(--ink); }
.hats button[aria-pressed="true"] { outline: 4px solid #fff; outline-offset: 2px; }
.ticker { margin: 12px 0 0; min-height: 1.3em; font: 700 14px/1.3 var(--body); color: #fff; text-shadow: 0 2px 0 rgba(27, 31, 59, 0.6); max-width: 86vw; }
/* ---- leaderboard / daily / invite ---- */
.tabs { display: flex; gap: 6px; justify-content: center; margin: 0 0 10px; }
.tabs button { font: 15px/1 var(--display); padding: 8px 12px; border-radius: 12px; border: 3px solid var(--ink); background: #fff; box-shadow: 0 3px 0 var(--ink); }
.tabs button[aria-pressed="true"] { background: var(--gold); color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.lb { display: grid; gap: 6px; max-height: 46vh; overflow: auto; margin: 0 0 12px; padding: 2px; }
.lbr { display: grid; grid-template-columns: 34px 22px 1fr auto; gap: 8px; align-items: center; background: #fff; border: 3px solid var(--ink); border-radius: 12px; padding: 6px 10px; text-align: left; }
.lbr.me { background: #fff3bf; }
.lbr .r { font: 18px/1 var(--display); text-align: center; }
.lbr .hat { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--ink); }
.lbr b { display: block; font: 700 15px/1.1 var(--body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lbr small { font: 600 12px/1.1 var(--body); color: #495057; }
.lbr .n { font: 16px/1 var(--display); }
.myrank { font: 700 15px/1.3 var(--body); margin: 0 0 10px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin: 0 0 12px; }
.cal div { min-width: 0; border: 2px solid var(--ink); border-radius: 9px; background: #fff; padding: 4px 0; font: 700 9px/1.2 var(--body); overflow: hidden; }
.cal div b { display: block; font: 11px/1.1 var(--display); white-space: nowrap; }
.cal .got { background: #d3f9d8; }
.cal .today { background: var(--gold); animation: chipPulse 1s ease-in-out infinite; }
.linkbox { font: 700 14px/1.2 var(--body); background: #fff; border: 3px dashed var(--ink); border-radius: 12px; padding: 10px; margin: 0 0 12px; word-break: break-all; }
.btn.blue { background: linear-gradient(#74c0fc 0 45%, var(--blue) 45%); box-shadow: 0 6px 0 var(--blue-edge), 0 10px 0 var(--ink); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sharebtn { margin-top: 10px; }

.popup { max-width: calc(100vw - 32px); }
.popup .qcard { min-width: 0; }
.popup .qcard > div { min-width: 0; }

.popup .ups { max-height: 60vh; overflow: auto; padding: 2px; }

/* ---- one-time explainers ---- */
.tipcard { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 18px); transform: translateX(-50%); z-index: 30; pointer-events: auto;
  width: min(92vw, 420px); display: grid; grid-template-columns: 40px 1fr 18px; gap: 10px; align-items: center; padding: 10px 12px;
  background: var(--cream); border: 4px solid var(--ink); border-radius: 18px; box-shadow: 0 6px 0 var(--ink); animation: tipIn 0.35s cubic-bezier(.3,1.6,.5,1); }
.tipcard .ic { font-size: 30px; text-align: center; }
.tipcard b { display: block; font: 18px/1.1 var(--display); }
.tipcard small { display: block; font: 600 14px/1.3 var(--body); color: #343a40; margin-top: 2px; }
.tipcard .x { font: 700 14px var(--body); color: #868e96; align-self: start; }
.tipcard.out { animation: tipOut 0.25s forwards; }
@keyframes tipIn { from { transform: translateX(-50%) translateY(40px); opacity: 0; } }
@keyframes tipOut { to { transform: translateX(-50%) translateY(40px); opacity: 0; } }
.saveinfo { margin: 12px 0 0; font-size: 18px; -webkit-text-stroke: 4px var(--ink); }
