/* Brick Blast — game-only styles on top of /assets/3d/kit.css.
   Layout rule: the 3D camera frames the board + tray inside whatever space the
   HUD leaves free (game.js measures these elements), so HUD bits can move per
   orientation here without touching the 3D code. */

/* ---------- HUD ---------- */
#hud .hud-pill { min-width: 92px; }
#hud #pill-score { min-width: 128px; }
#pill-moves b { color: #7ff3ea; }
#pill-moves.low b { color: #ff8a8a; animation: bump 0.6s ease-in-out infinite; }

#combo {
  position: absolute; left: 50%; top: 84px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; padding: 4px 12px 5px; border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 90, 40, 0.92), rgba(255, 40, 120, 0.92));
  box-shadow: 0 0 22px rgba(255, 80, 60, 0.6); font-family: var(--display); font-size: 22px;
}
#combo b { font-weight: 400; }
#combo-pips { display: flex; gap: 4px; }
#combo-pips i { width: 10px; height: 10px; border-radius: 50%; background: #fff; box-shadow: 0 0 8px #fff; }
#combo-pips i.off { background: rgba(255, 255, 255, 0.25); box-shadow: none; }
#combo.pop { animation: bump 0.35s ease-out; }

#goals {
  position: absolute; right: 12px; top: 70px; padding: 8px 10px; border-radius: 16px;
  background: var(--glass); border: 2px solid rgba(255, 255, 255, 0.12);
  display: flex; flex-direction: column; gap: 4px; font-weight: 900; font-size: 15px; min-width: 112px;
}
#goals .g { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
#goals .g .ic { font-size: 18px; width: 22px; text-align: center; }
#goals .g.done { color: #7dff9a; }
#goals .g.done::after { content: "✔"; margin-left: 2px; }
#goals .g.bump { animation: bump 0.35s ease-out; }

/* The Mega Blast meter: a ring that fills, then glows and begs to be tapped. */
#mega {
  position: fixed; z-index: 25; left: 12px; top: 70px; width: 78px; height: 78px; border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, rgba(60, 40, 110, 0.95), rgba(14, 10, 34, 0.95));
  border: 2px solid rgba(255, 255, 255, 0.16); display: grid; place-items: center; padding: 0;
  pointer-events: auto;
}
body:not([data-screen="play"]) #mega { display: none; }
#mega svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
#mega circle { fill: none; stroke-width: 8; }
#mega .track { stroke: rgba(255, 255, 255, 0.12); }
#mega .fill { stroke: url(#none); stroke: #ff9a3c; stroke-linecap: round; stroke-dasharray: 276.5; stroke-dashoffset: 276.5; transition: stroke-dashoffset 0.4s ease-out; }
#mega .mega-icon { font-size: 30px; line-height: 1; margin-top: -8px; filter: grayscale(0.7) brightness(0.8); transition: filter 0.3s; }
#mega .mega-lbl { position: absolute; bottom: 9px; font-family: var(--display); font-size: 13px; letter-spacing: 0.06em; color: rgba(255, 255, 255, 0.7); }
#mega.ready { border-color: #ffd23f; animation: mega-ready 0.9s ease-in-out infinite; cursor: pointer; }
#mega.ready .fill { stroke: #ffd23f; }
#mega.ready .mega-icon { filter: none; }
#mega.ready .mega-lbl { color: #ffd23f; }
@keyframes mega-ready {
  0%, 100% { transform: scale(1); box-shadow: 0 0 18px rgba(255, 210, 63, 0.6), 0 0 0 0 rgba(255, 210, 63, 0.5); }
  50% { transform: scale(1.1); box-shadow: 0 0 34px rgba(255, 160, 40, 0.95), 0 0 0 12px rgba(255, 210, 63, 0); }
}

/* Floating "+120" score pops (placed at the clear, in screen pixels) */
#pops { position: fixed; inset: 0; z-index: 26; pointer-events: none; overflow: hidden; }
.pop {
  position: absolute; transform: translate(-50%, -50%); font-family: var(--display); font-size: 30px; color: #fff;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.45), 0 0 16px rgba(255, 255, 255, 0.4); white-space: nowrap;
  animation: pop-up 1.1s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
  will-change: transform, opacity;
}
.pop.small { font-size: 20px; opacity: 0.9; }
.pop.gold { color: #ffd23f; font-size: 38px; }
.pop.rainbow { background: linear-gradient(90deg, #ff4d6d, #ff9f1c, #ffd23f, #6bdc4a, #22d3c5, #8f6bff); -webkit-background-clip: text; background-clip: text; color: transparent; font-size: 40px; text-shadow: none; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.5)); }
@keyframes pop-up {
  0% { transform: translate(-50%, -30%) scale(0.4); opacity: 0; }
  18% { transform: translate(-50%, -60%) scale(1.15); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate(-50%, -160%) scale(1); opacity: 0; }
}

/* Big centre callouts: "×3 COMBO!", "TRIPLE!", "CHAIN ×4!", "MEGA BLAST!" */
#bigtext { position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 27; pointer-events: none; display: flex; flex-direction: column; align-items: center; }
.callout {
  font-family: var(--display); font-size: clamp(44px, 10vw, 92px); line-height: 0.95; white-space: nowrap;
  color: #fff; -webkit-text-stroke: 3px rgba(0, 0, 0, 0.35);
  text-shadow: 0 6px 0 var(--accent-deep), 0 0 40px rgba(255, 120, 60, 0.7);
  animation: big-in 1.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  will-change: transform, opacity;
}
.callout.combo { color: #ffd23f; }
.callout.chain { color: #7ff3ea; text-shadow: 0 6px 0 #0a6a7a, 0 0 40px rgba(60, 230, 255, 0.8); }
.callout.mega { font-size: clamp(56px, 13vw, 120px); color: #ffd23f; text-shadow: 0 7px 0 #b3123f, 0 0 60px rgba(255, 160, 40, 0.95); }
.callout.perfect { color: #fff; text-shadow: 0 6px 0 #6a3ad0, 0 0 60px rgba(200, 160, 255, 0.95); }
.callout.sub { font-size: clamp(24px, 5vw, 42px); -webkit-text-stroke: 2px rgba(0, 0, 0, 0.3); animation-delay: 0.06s; }
@keyframes big-in {
  0% { transform: scale(0.2) rotate(-8deg); opacity: 0; }
  14% { transform: scale(1.25) rotate(3deg); opacity: 1; }
  26% { transform: scale(0.95) rotate(-1deg); }
  36% { transform: scale(1) rotate(0); }
  80% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.1) translateY(-30px); opacity: 0; }
}

/* Tutorial hand */
#hint { position: fixed; inset: 0; z-index: 28; pointer-events: none; }
#hint .hand { position: absolute; font-size: 54px; transform: translate(-30%, -10%); filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.5)); transition: none; }
#hint .bubble {
  position: absolute; left: 50%; transform: translateX(-50%); padding: 10px 18px; border-radius: 18px;
  background: #fff; color: #2a1a4a; font-family: var(--display); font-size: 22px; white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); animation: bump 1.4s ease-in-out infinite;
}

/* ---------- Title ---------- */
.title-screen .badge { display: inline-block; min-width: 0; margin-left: 4px; padding: 0 7px; border-radius: 999px; background: #ff5a6e; font-size: 13px; line-height: 20px; }
.title-screen .badge:empty { display: none; }
.coin-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px 1px 6px; margin-left: 4px; border-radius: 999px; background: rgba(255, 207, 51, 0.18); color: #ffd23f; font-weight: 900; font-size: 14px; }
.coin-chip::before { content: "🪙"; font-size: 14px; }
.coin-chip.big { font-size: 20px; padding: 4px 14px 4px 10px; }
.coin-chip.big::before { font-size: 20px; }
#logo { cursor: pointer; }
#logo.tap { animation: bump 0.25s ease-out; }

/* ---------- Cards: map, shop, badges ---------- */
.card.wide { width: min(620px, 96vw); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.card-head h2 { text-align: left; }
.star-total { font-family: var(--display); font-size: 24px; color: #ffd23f; }
.sticky-foot { position: sticky; bottom: -22px; padding: 12px 0 4px; background: linear-gradient(180deg, rgba(12, 16, 34, 0), rgba(12, 16, 34, 0.98) 30%); }
.lead.small { font-size: 14px; }
.big-emoji { font-size: 64px; margin: 6px 0 12px; animation: bump 0.9s ease-in-out infinite; }

/* Adventure map */
#worlds { display: flex; flex-direction: column; gap: 10px; margin: 10px 0 4px; }
.world {
  position: relative; display: grid; grid-template-columns: 64px 1fr; gap: 4px 12px; align-items: center; text-align: left;
  padding: 10px 12px; border-radius: 18px; border: 2px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(120deg, var(--w1), var(--w2));
}
.world .w-emoji { grid-row: span 2; font-size: 42px; text-align: center; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.4)); }
.world .w-name { font-family: var(--display); font-size: 22px; line-height: 1.05; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); }
.world .w-name small { font-family: var(--font); font-size: 13px; font-weight: 800; opacity: 0.85; margin-left: 6px; }
.world .w-levels { display: flex; gap: 6px; flex-wrap: wrap; }
.lv {
  width: 52px; height: 52px; border-radius: 14px; background: rgba(0, 0, 0, 0.32); border: 2px solid rgba(255, 255, 255, 0.25);
  font-family: var(--display); font-size: 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
}
.lv small { font-family: var(--font); font-size: 12px; letter-spacing: -1px; margin-top: 3px; color: rgba(255, 255, 255, 0.25); }
.lv small i { font-style: normal; }
.lv small i.on { color: #ffd23f; text-shadow: 0 0 6px rgba(255, 210, 63, 0.8); }
.lv.next { border-color: #ffd23f; box-shadow: 0 0 14px rgba(255, 210, 63, 0.7); animation: bump 1.2s ease-in-out infinite; }
.lv.boss { border-style: double; border-width: 4px; }
.lv:disabled { opacity: 0.35; cursor: default; }
.world.locked { filter: grayscale(0.8) brightness(0.7); }
.world.locked .w-levels::after { content: attr(data-lock); font-weight: 900; font-size: 14px; align-self: center; margin-left: 4px; }
.world-badge { display: inline-flex; gap: 8px; align-items: center; padding: 4px 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); font-weight: 900; margin-bottom: 8px; }
.goal-list { display: flex; flex-direction: column; gap: 8px; margin: 14px auto 6px; width: fit-content; text-align: left; }
.goal-list .g { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 900; padding: 6px 14px; border-radius: 14px; background: rgba(255, 255, 255, 0.07); }
.goal-list .g .ic { font-size: 26px; }

/* Shop */
.tabs { display: flex; gap: 8px; justify-content: center; margin: 6px 0 2px; }
.card .tabs .chip-btn { width: auto; flex: 1; padding-left: 8px; padding-right: 8px; }
.shop-grid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); max-height: 52vh; }
.shop-grid .pick { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px 8px; }
.shop-grid .pick img, .shop-grid .pick .sw { width: 72px; height: 72px; border-radius: 16px; object-fit: cover; font-size: 40px; line-height: 72px; text-align: center; }
.shop-grid .pick .price { display: inline-flex; gap: 3px; align-items: center; margin-top: 3px; padding: 2px 10px; border-radius: 999px; background: rgba(255, 207, 51, 0.2); color: #ffd23f; font-size: 14px; }
.shop-grid .pick .price::before { content: "🪙"; }
.shop-grid .pick .price.cant { background: rgba(255, 255, 255, 0.08); color: rgba(255, 255, 255, 0.55); }
.shop-grid .pick .owned { margin-top: 3px; font-size: 13px; color: #7dff9a; }
.shop-grid .pick.on .owned { color: var(--accent); }
.shop-grid .pick.secret { background: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.04) 0 8px, rgba(255, 255, 255, 0.09) 8px 16px); }
.shop-grid .pick.flash { animation: bump 0.4s ease-out; }

/* Badges */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; margin: 10px 0; max-height: 56vh; overflow-y: auto; padding: 2px; }
.bdg { padding: 10px 8px; border-radius: 16px; background: rgba(255, 255, 255, 0.06); text-align: center; }
.bdg .e { font-size: 34px; display: block; }
.bdg b { display: block; font-size: 14px; line-height: 1.15; margin-top: 2px; }
.bdg small { display: block; font-size: 12px; color: rgba(255, 255, 255, 0.65); line-height: 1.2; margin-top: 3px; }
.bdg.got { background: linear-gradient(160deg, rgba(255, 207, 51, 0.22), rgba(255, 90, 110, 0.14)); border: 2px solid rgba(255, 207, 51, 0.45); }
.bdg:not(.got) .e { filter: grayscale(1) brightness(0.55); }

/* Help */
.help-list { text-align: left; margin: 12px 0 16px; display: flex; flex-direction: column; gap: 6px; font-size: 17px; }
.help-list b { color: var(--accent); }

/* Results */
.res-coins { font-family: var(--display); font-size: 26px; color: #ffd23f; margin: 2px 0 6px; }
.res-coins:empty { display: none; }
.res-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 4px 0; }
.res-badges .bdg { min-width: 120px; animation: card-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
#res-best .new-best { margin-top: 6px; }
#res-best .gap { margin-top: 6px; color: var(--ink-2); font-weight: 900; }

/* Toasts sit high (under the HUD) so they never cover the big callouts. */
#toasts { top: 19%; }
.toast b { font-size: clamp(26px, 4.6vw, 44px); }
/* Badge banner: slides in at the top-centre, under the HUD, then away */
#badge-pop { position: fixed; left: 50%; top: 92px; transform: translateX(-50%); z-index: 29; pointer-events: none; display: flex; flex-direction: column; gap: 6px; align-items: center; }
#badge-pop .bp {
  display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 8px; border-radius: 999px; white-space: nowrap;
  background: linear-gradient(135deg, rgba(255, 207, 51, 0.95), rgba(255, 120, 60, 0.95)); color: #2a1400;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35); font-weight: 900; font-size: 15px;
  animation: bp-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both, bp-out 0.4s ease-in 2.6s forwards;
}
#badge-pop .bp .e { font-size: 22px; }
#badge-pop .bp small { font-size: 13px; opacity: 0.85; }
@keyframes bp-in { from { transform: translateY(-30px) scale(0.6); opacity: 0; } }
@keyframes bp-out { to { transform: translateY(-20px); opacity: 0; } }
@media (max-width: 520px) and (orientation: portrait) { #badge-pop { top: 136px; } }
@media (orientation: landscape) and (max-height: 500px) {
  #badge-pop { top: 62px; left: auto; right: 12px; transform: none; align-items: flex-end; }
  #badge-pop .bp { font-size: 13px; padding: 4px 12px 4px 6px; }
  .goal-list { flex-direction: row; flex-wrap: wrap; justify-content: center; width: auto; margin: 8px auto 4px; gap: 6px; }
  .goal-list .g { font-size: 16px; padding: 4px 10px; }
  .card .lead { font-size: 14px; margin-top: 2px; }
  .card h2 { font-size: 32px; }
  .world-badge { margin-bottom: 2px; }
  #daily-stats { display: none; }
  .help-list { font-size: 15px; gap: 2px; margin: 6px 0 8px; }
}
/* On narrow portrait phones the corner buttons sit over the top of tall cards. */
@media (max-width: 520px) and (orientation: portrait) { .screen.dim { padding-top: 64px; } }
/* Badge-earned toast in play */
.toast.badge b { font-size: clamp(22px, 4vw, 34px); color: #ffd23f; }

/* ---------- Narrow portrait phones: score pills under the corner buttons,
   mega meter + goals tucked left/right of them ---------- */
@media (max-width: 520px) and (orientation: portrait) {
  #hud .hud-pill { min-width: 78px; padding: 5px 10px; }
  #hud #pill-score { min-width: 104px; }
  #combo { top: 134px; font-size: 18px; }
  #mega { top: 64px; left: 8px; width: 64px; height: 64px; }
  #mega .mega-icon { font-size: 24px; margin-top: -6px; }
  #mega .mega-lbl { font-size: 12px; bottom: 6px; }
  #goals { top: 64px; right: 8px; min-width: 0; padding: 6px 8px; font-size: 13px; }
  #goals .g .ic { font-size: 15px; width: 18px; }
  body.has-goals .hud-top #pill-best { display: none; }
}
/* Landscape and wide screens: meter bottom-left, goals down the left side. */
@media (orientation: landscape) {
  #mega { top: auto; bottom: 18px; left: 16px; width: 88px; height: 88px; }
  #mega .mega-icon { font-size: 34px; }
  #goals { right: auto; left: 14px; top: 74px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  #mega { bottom: 10px; left: 10px; width: 66px; height: 66px; }
  #mega .mega-icon { font-size: 24px; margin-top: -6px; }
  #mega .mega-lbl { font-size: 12px; bottom: 6px; }
  #hud .hud-pill { padding: 4px 10px; }
  #hud .hud-pill b { font-size: 24px; }
  #hud .hud-pill.big b { font-size: 28px; }
  #combo { top: 64px; font-size: 18px; }
  #goals { top: 64px; font-size: 13px; padding: 5px 8px; }
  .callout { font-size: clamp(36px, 8vh, 64px); }
  .card { padding: 14px 18px 12px; }
  .card .big-num { font-size: 52px; margin: 6px 0 2px; }
  .stars { font-size: 34px; margin: 4px 0 0; }
  .stats { margin: 8px 0 10px; }
}
@media (prefers-reduced-motion: reduce) {
  #mega.ready { animation: none; }
  .callout { animation-duration: 1.6s; }
}
