@import url("https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600&display=swap");

/* Bubble Wand: a dark room with one soft window of light. The bubbles are drawn on one WebGL canvas
   (#gl, transparent so the room shows through); the wand, droplets and pop sparks live on #ui. */
:root {
  --font: "Geist", system-ui, -apple-system, sans-serif;
  --ink: #dfe8f5;
  --panel: rgba(16, 22, 34, 0.74);
  --line: rgba(190, 215, 255, 0.18);
}

*,*::before,*::after { box-sizing: border-box; }
html, body {
  -webkit-tap-highlight-color: transparent; height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body {
  font-family: var(--font); color: var(--ink); touch-action: none; background: #06080e;
  background:
    radial-gradient(120% 90% at 50% 112%, rgba(30, 58, 92, 0.55), transparent 62%),
    radial-gradient(70% 60% at 12% 4%, rgba(255, 226, 180, 0.17), transparent 70%),
    linear-gradient(180deg, #080b14 0%, #05070c 100%);
}

/* the window the bubbles reflect: a blurred pane of light, top left, matching the highlight in the shader */
.room { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.room::after { content: ""; position: absolute; inset: 0; background: radial-gradient(130% 100% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.55)); }
.room__window {
  position: absolute; left: 3%; top: -6%; width: min(38vw, 420px); aspect-ratio: 1.3 / 1;
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 3.2%;
  transform: rotate(-7deg) skewX(-4deg); filter: blur(13px); opacity: 0.55;
}
.room__window i { display: block; border-radius: 3px; background: linear-gradient(160deg, #fff4de, #ffd9a0 70%, #ffc27a); }
@media (max-width: 900px) and (orientation: portrait) { .room__window { width: 62vw; left: -4%; top: 4%; opacity: 0.5; } }

canvas {
  display: block; position: fixed; inset: 0; touch-action: none;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
}
#gl { z-index: 1; cursor: none; }
#gl.is-over-bubble { cursor: pointer; }
#ui { z-index: 2; pointer-events: none; }

/* the row of actions */
.bar {
  position: fixed; z-index: 6; left: 50%; top: max(12px, env(safe-area-inset-top)); transform: translateX(-50%);
  display: flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
}
.pill, .bar .opt-share.opt-share {
  appearance: none; cursor: pointer; font-family: var(--font);
  display: inline-flex; align-items: center; gap: 7px; height: 36px; margin: 0; padding: 0 14px 0 12px;
  border-radius: 999px; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.01em; opacity: 1;
  color: var(--ink); background: var(--panel); border: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 6px 16px rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  touch-action: manipulation;
}
.pill svg { width: 15px; height: 15px; flex: none; }
.pill:hover, .bar .opt-share.opt-share:hover { background: rgba(28, 38, 58, 0.9); border-color: rgba(190, 215, 255, 0.34); text-decoration: none; }
.pill:active, .bar .opt-share.opt-share:active { transform: scale(0.96); }
.pill[aria-pressed="false"]#breezeBtn { opacity: 0.6; }
.pill[aria-pressed="true"]#machineBtn { color: #0a1220; background: linear-gradient(135deg, #bfe3ff, #f2cfff 55%, #ffe2b8); border-color: transparent; }
.pill:focus-visible, .bar .opt-share.opt-share:focus-visible, .sound-btn:focus-visible { outline: 2px dashed rgba(170, 210, 255, 0.9); outline-offset: 2px; }
.share-host { display: inline-flex; }
.share-host:empty { display: none; }

.sound-btn {
  appearance: none; position: fixed; z-index: 12; cursor: pointer; padding: 0;
  top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right));
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  color: var(--ink); background: var(--panel); border: 1px solid var(--line);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: transform 0.12s ease, opacity 0.15s ease;
}
.sound-btn:active { transform: scale(0.94); }
.sound-btn[aria-pressed="false"] { opacity: 0.55; }
.sound-btn[aria-pressed="false"] .sound-btn__wave { opacity: 0; }

.frame { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
.frame__corner {
  position: absolute; font-size: clamp(0.58rem, 1.2vw, 0.7rem); font-weight: 600;
  letter-spacing: 0.22em; text-transform: uppercase; color: rgba(205, 222, 245, 0.5);
  white-space: nowrap; font-family: var(--font); text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
}
.frame__corner--tl { top: calc(max(12px, env(safe-area-inset-top)) + 13px); left: max(18px, env(safe-area-inset-left)); }
.frame__corner--tr { top: calc(max(12px, env(safe-area-inset-top)) + 13px); right: calc(max(12px, env(safe-area-inset-right)) + 54px); }
.frame__corner--bl { bottom: max(18px, env(safe-area-inset-bottom)); left: max(18px, env(safe-area-inset-left)); }
.frame__corner a { color: inherit; text-decoration: none; pointer-events: auto; border-bottom: 1px solid transparent; transition: color .14s, border-color .14s; }
.frame__corner a:hover { color: rgba(200, 228, 255, 0.95); border-bottom-color: rgba(200, 228, 255, 0.5); }

.hint {
  position: fixed; top: calc(max(12px, env(safe-area-inset-top)) + 48px); left: 50%; transform: translateX(-50%);
  width: min(88vw, 560px); margin: 0; text-align: center; z-index: 9; pointer-events: none;
  font-size: 0.62rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; line-height: 1.6;
  color: rgba(205, 222, 245, 0.62); text-shadow: 0 1px 8px rgba(0, 0, 0, 0.95); transition: opacity .8s;
}
.hint.is-hidden { opacity: 0; }

/* tip-jar and fullscreen badges sit bottom-right, off the play area (doubled classes out-specify the injected styles) */
.opt-tipjar.opt-tipjar { top: auto; bottom: max(14px, env(safe-area-inset-bottom)); transform: none; }
.opt-fs.opt-fs { top: auto; bottom: max(14px, env(safe-area-inset-bottom)); right: calc(max(14px, env(safe-area-inset-right)) + 54px); transform: none; }
.opt-tipjar.opt-tipjar.tj-nudge { animation: none; }

/* phones and small tablets: the action bar drops under the corner labels so nothing crowds the name */
@media (max-width: 900px) {
  .bar { top: calc(max(12px, env(safe-area-inset-top)) + 44px); }
  .hint { top: calc(max(12px, env(safe-area-inset-top)) + 92px); }
}
@media (max-width: 520px) { .hint { width: 96vw; letter-spacing: 0.07em; font-size: 0.6rem; } #breezeBtn { padding: 0 11px; } #breezeBtn .pill__t { display: none; } }
@media (max-width: 380px) {
  .pill, .bar .opt-share.opt-share { font-size: 0.72rem; padding: 0 11px 0 10px; gap: 6px; }
  .bar { gap: 6px; }
}
@media (max-width: 345px) { .pill svg { display: none; } }
/* a phone on its side is short: the bar goes back up between the corner labels */
@media (orientation: landscape) and (max-height: 500px) and (min-width: 760px) {
  .bar { top: max(10px, env(safe-area-inset-top)); }
  .hint { top: calc(max(10px, env(safe-area-inset-top)) + 46px); }
}
@media (prefers-reduced-motion: reduce) { .pill, .sound-btn, .hint, .bar .opt-share.opt-share { transition: none; } }
