/* Bubble Pop — canvas bubble shooter (port of the Pocket Games title). */
.bubble-pop-play { display: grid; gap: var(--space-3); }
.bubble-pop-play > h1 { font-size: var(--step-4); text-align: center; margin: 0; }
.bubble-pop-sub { text-align: center; color: var(--text-muted); margin: 0 auto; max-inline-size: 60ch; }

/* Mode tabs (the play shell mirrors them as chips on the cover) */
.bp-modes { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); }
.bp-mode {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-block-size: var(--tap); padding-inline: var(--space-4);
  border-radius: var(--radius-pill, 999px); border: 1px solid var(--border);
  background: var(--surface-1); color: var(--text-muted);
  font-family: var(--font-body); font-weight: 600; cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.bp-mode:hover { color: var(--text); background: var(--surface-2); }
.bp-mode[aria-selected="true"] { color: var(--text); border-color: color-mix(in oklab, var(--accent) 60%, transparent); background: color-mix(in oklab, var(--accent) 16%, var(--surface-1)); }
.bp-mode:focus-visible, .bp-arrow:focus-visible, .bp-swap:focus-visible, .bp-guide:focus-visible, .bp-go:focus-visible, .bp-canvas:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* HUD */
.bp-hud { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); inline-size: min(100%, 560px); margin-inline: auto; }
.bp-cell {
  display: grid; justify-items: center; align-content: center; gap: 2px; min-block-size: 58px;
  padding: var(--space-2) var(--space-2); border-radius: var(--radius-md); text-align: center;
  background: var(--surface-1); border: 1px solid var(--border); box-shadow: var(--glass-hi);
}
.bp-cell small { font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); line-height: 1.1; }
.bp-cell > b, .bp-level b { font-family: var(--font-display); font-size: var(--step-2); line-height: 1; color: var(--text); font-variant-numeric: tabular-nums; }
.bp-cell b span { font-size: 0.6em; color: var(--text-muted); }
.bp-cell > b { direction: ltr; unicode-bidi: isolate; }
.bp-cell--warn > b { color: var(--coral); }
.bp-level { display: flex; align-items: center; gap: var(--space-1); }
.bp-arrow {
  inline-size: 32px; block-size: 32px; display: grid; place-items: center; border-radius: var(--radius-sm, 8px);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer;
}
.bp-arrow:disabled { opacity: 0.35; cursor: default; }
[dir="rtl"] .bp-arrow i { transform: scaleX(-1); }
.bp-cell--tide small b { color: var(--accent); font-size: 1.1em; }
.bp-cell--tide i { display: block; inline-size: 80%; block-size: 8px; margin-block-start: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bp-cell--tide em { display: block; block-size: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), var(--accent)); transition: width var(--dur-med, 240ms) var(--ease); }
.bp-note { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); margin: 0; min-block-size: 26px; }
.bp-note[hidden] { display: none; }
.bp-chip {
  display: inline-flex; align-items: center; gap: var(--space-1); padding: 3px var(--space-3);
  border-radius: 99px; font-size: var(--step--1); color: var(--text-muted);
  background: var(--surface-1); border: 1px solid var(--border);
}
.bp-chip em { font-style: normal; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; color: var(--accent-ink, #120a2e); background: var(--lime); padding: 1px 6px; border-radius: 99px; }
.bp-chip.is-new { color: var(--text); border-color: color-mix(in oklab, var(--lime) 50%, transparent); }
.bp-chip.is-warn { color: var(--text); border-color: color-mix(in oklab, var(--coral) 70%, transparent); background: color-mix(in oklab, var(--coral) 18%, var(--surface-1)); }

/* Stage */
.bubble-pop-card { padding: var(--space-2); inline-size: fit-content; max-inline-size: 100%; margin-inline: auto; }
.bubble-pop-stage {
  --bp-h: clamp(460px, calc(100svh - var(--header-stuck) - 240px), 820px);
  position: relative; block-size: var(--bp-h); inline-size: min(100%, calc(var(--bp-h) * 0.66)); min-inline-size: min(300px, 100%);
  margin-inline: auto; border-radius: var(--radius-lg, 16px); overflow: hidden;
  background: linear-gradient(180deg, #070d3a, #0d2a7a 55%, #1476c9);
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
.bubble-pop-card .bubble-pop-stage { inline-size: min(calc(100vw - 2 * var(--gutter) - 2 * var(--space-3) - 2px), calc(var(--bp-h) * 0.66)); }
.bp-canvas { display: block; inline-size: 100%; block-size: 100%; touch-action: none; cursor: crosshair; }

.bp-swap {
  position: absolute; z-index: 2; inline-size: 52px; block-size: 52px; padding: 0;
  display: grid; place-items: center; border-radius: 50%; cursor: pointer;
  border: 2px solid rgb(255 255 255 / 0.55); background: rgb(8 25 74 / 0.55);
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.35);
  transition: transform var(--dur-fast, 120ms) var(--ease);
}
.bp-swap i {
  inline-size: 30px; block-size: 30px; border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #fff 0 8%, var(--orb, #fff) 22% 68%, color-mix(in srgb, var(--orb, #fff) 55%, #000) 100%);
  box-shadow: 0 0 10px color-mix(in srgb, var(--orb, #fff) 60%, transparent);
}
.bp-swap small { position: absolute; inset-block-end: -16px; font-size: 0.6rem; font-weight: 700; letter-spacing: 0.08em; color: #dff3ff; text-shadow: 0 1px 3px #000; }
.bp-swap:hover:not(:disabled) { transform: scale(1.06); }
.bp-swap:active:not(:disabled) { transform: scale(0.94); }
.bp-swap:disabled { opacity: 0.6; cursor: default; }
.bp-guide {
  position: absolute; z-index: 2; inline-size: 40px; block-size: 40px; display: grid; place-items: center;
  border-radius: 50%; cursor: pointer; color: #fff; border: 1px solid rgb(255 255 255 / 0.35); background: rgb(8 25 74 / 0.5);
}
.bp-guide[aria-pressed="false"] { opacity: 0.55; }
.bp-swap[hidden], .bp-guide[hidden] { display: none; }

.bp-praise {
  position: absolute; z-index: 3; inset-inline: 0; inset-block-start: 38%; margin-inline: auto; inline-size: max-content; max-inline-size: 90%;
  display: grid; justify-items: center; gap: 2px; text-align: center; pointer-events: none; opacity: 0;
}
.bp-praise b { font-family: var(--font-display); font-size: clamp(1.7rem, 7vw, 2.4rem); line-height: 1; color: #fff; text-shadow: 0 2px 0 #c81f7a, 0 4px 18px rgb(255 47 185 / 0.55); letter-spacing: 0.02em; }
.bp-praise small { font-weight: 700; font-size: var(--step--1); color: #ffe28a; text-shadow: 0 1px 4px rgb(0 0 0 / 0.7); }
.bp-praise.is-on { animation: bp-praise 1.3s var(--ease) forwards; }
@keyframes bp-praise {
  0% { opacity: 0; transform: translateY(14px) scale(0.85); }
  14% { opacity: 1; transform: translateY(0) scale(1.06); }
  24% { transform: scale(1); }
  75% { opacity: 1; transform: translateY(-8px); }
  100% { opacity: 0; transform: translateY(-22px); }
}

.bp-overlay {
  position: absolute; z-index: 4; inset: 0; display: grid; place-content: center; justify-items: center; gap: var(--space-2);
  padding: var(--space-5); text-align: center;
  background: radial-gradient(ellipse at center, rgb(7 5 26 / 0.45), rgb(7 5 26 / 0.86));
}
.bp-overlay[hidden] { display: none; }
.bp-overlay h2 { margin: 0; font-family: var(--font-display); font-size: var(--step-4); line-height: 0.95; color: #fff; text-shadow: 0 2px 14px rgb(0 0 0 / 0.6); }
.bp-kicker { margin: 0; font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--cyan); font-weight: 700; }
.bp-sub { margin: 0; max-inline-size: 30ch; color: var(--text-muted); line-height: 1.45; }
.bp-sub b { color: var(--text); font-size: 1.15em; }
.bp-hint { display: inline-block; margin-block-start: var(--space-2); font-size: var(--step--1); color: var(--text-faint); }
.bp-go {
  margin-block-start: var(--space-3); display: inline-flex; align-items: center; gap: var(--space-2);
  min-block-size: var(--tap); padding-inline: var(--space-5); border-radius: 99px; cursor: pointer;
  font-family: var(--font-body); font-weight: 700; color: var(--accent-ink, #120a2e);
  background: var(--accent); border: 0; box-shadow: 0 6px 22px color-mix(in oklab, var(--accent) 45%, transparent);
  transition: transform var(--dur-fast, 120ms) var(--ease);
}
.bp-go:hover { transform: translateY(-1px) scale(1.03); }

/* Inside the immersive play layer: the shell owns start, pause and result screens. */
.play-layer .bp-overlay { display: none !important; }
.play-slot .bubble-pop-play { gap: var(--space-2); }
.play-slot .bubble-pop-card .bubble-pop-stage { inline-size: min(calc(100vw - 2 * var(--gutter) - 2 * var(--space-3) - 2px), calc(var(--bp-h) * 0.7)); }
.play-slot .bp-note[hidden] { display: flex; visibility: hidden; }
.play-slot .bubble-pop-play { inline-size: min(100%, 1100px); }
@media (max-width: 599px) {
  .bp-cell { min-block-size: 50px; padding: var(--space-1); }
  .bp-cell small { font-size: 0.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  .bp-praise.is-on { animation: bp-praise-calm 1.3s linear forwards; }
  .bp-swap, .bp-go, .bp-mode, .bp-cell--tide em { transition: none; }
}
@keyframes bp-praise-calm { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
