/* public/embed-assets/overlay.css
   QR card injected over an embedded game (/embed/:totemId/:instanceId/).
   The game page does not load /css/tokens.css, so the few DreamBricks tokens
   used here are scoped to .dbx — nothing leaks into the game's own styles. */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@500;600;700&family=IBM+Plex+Mono:wght@500;600&display=swap');

.dbx {
  --dbx-ink:     oklch(0.16 0.028 230);
  --dbx-muted:   oklch(0.42 0.024 230);
  --dbx-brand:   #42b0d5;
  --dbx-brand-7: oklch(from #42b0d5 calc(l - 0.18) c h);
  --dbx-strong:  #034a5d;
  --dbx-line:    oklch(0.89 0.014 230);
  --dbx-ok:      oklch(0.48 0.13 155);
  --dbx-wait:    oklch(0.52 0.12 70);
  --dbx-ease:    cubic-bezier(0.16, 1, 0.3, 1);

  position: fixed; z-index: 2147483000;
  inset: auto clamp(10px, 2.2vmin, 24px) clamp(10px, 2.2vmin, 24px) auto;
  font-family: 'Poppins', ui-sans-serif, system-ui, sans-serif;
  color: var(--dbx-ink);
  -webkit-font-smoothing: antialiased;
}
.dbx *, .dbx *::before, .dbx *::after { box-sizing: border-box; margin: 0; padding: 0; }
.dbx[data-pos="bl"] { inset: auto auto clamp(10px, 2.2vmin, 24px) clamp(10px, 2.2vmin, 24px); }
.dbx[data-pos="tr"] { inset: clamp(10px, 2.2vmin, 24px) clamp(10px, 2.2vmin, 24px) auto auto; }
.dbx[data-pos="tl"] { inset: clamp(10px, 2.2vmin, 24px) auto auto clamp(10px, 2.2vmin, 24px); }

/* ── Card ───────────────────────────────────────────────────────────────────── */
.dbx-card {
  width: clamp(168px, 24vmin, 240px);
  padding: clamp(10px, 1.6vmin, 16px);
  background: #fff;
  /* Brand plate motif: three soft corners, one fully rounded */
  border-radius: 16px 16px 16px clamp(40px, 6vmin, 64px);
  box-shadow: 0 12px 32px oklch(0.16 0.028 230 / 0.22), 0 2px 6px oklch(0.16 0.028 230 / 0.12);
  transform-origin: bottom right;
  animation: dbx-in 0.5s var(--dbx-ease);
}
.dbx[data-pos="bl"] .dbx-card, .dbx[data-pos="tl"] .dbx-card { border-radius: 16px 16px clamp(40px, 6vmin, 64px) 16px; transform-origin: bottom left; }
@keyframes dbx-in { from { opacity: 0; transform: translateY(12px) scale(0.92); } }

.dbx-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.dbx-head img { width: 26px; height: auto; flex: none; }
.dbx-title {
  flex: 1; min-width: 0;
  font-size: clamp(12px, 1.7vmin, 15px); font-weight: 700; line-height: 1.2;
  color: var(--dbx-strong);
}
.dbx-min {
  display: grid; place-items: center; width: 28px; height: 28px; flex: none;
  color: var(--dbx-muted); background: transparent; border: 0; border-radius: 6px; cursor: pointer;
}
.dbx-min:hover { background: oklch(0.94 0.010 230); color: var(--dbx-ink); }
.dbx-min:focus-visible, .dbx-qr:focus-visible, .dbx-pill:focus-visible, .dbx-phone:focus-visible {
  outline: 3px solid var(--dbx-brand); outline-offset: 2px;
}
.dbx-min svg { width: 16px; height: 16px; }

.dbx-qr {
  display: block; aspect-ratio: 1; padding: 4px;
  border: 1px solid var(--dbx-line); border-radius: 10px;
  background: #fff;
  transition: border-color 0.18s, transform 0.18s var(--dbx-ease);
}
.dbx-qr:hover { border-color: var(--dbx-brand); transform: scale(1.02); }
.dbx-qr img { display: block; width: 100%; height: 100%; image-rendering: pixelated; }

.dbx-status {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 8px; min-height: 1.4em;
  font: 600 clamp(10px, 1.4vmin, 12px)/1.3 'IBM Plex Mono', ui-monospace, monospace;
  color: var(--dbx-muted);
  font-variant-numeric: tabular-nums;
}
.dbx-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.dbx-status[data-state="free"] { color: var(--dbx-ok); }
.dbx-status[data-state="busy"] { color: var(--dbx-wait); }
.dbx-status[data-state="free"] .dbx-dot { animation: dbx-pulse 2s ease-in-out infinite; }
@keyframes dbx-pulse { 50% { opacity: 0.35; } }

/* "Play on this phone" — touch screens can't scan their own QR */
.dbx-phone {
  display: none; margin-top: 8px; width: 100%; min-height: 40px;
  align-items: center; justify-content: center;
  font: 600 13px/1 'Poppins', sans-serif; color: #fff; text-decoration: none;
  background: var(--dbx-brand-7); border-radius: 10px;
}
/* On a phone the QR is useless (nobody scans their own screen) and it would
   cover half the game: keep the status + a direct button only. */
.dbx--touch .dbx-phone { display: flex; }
.dbx--touch .dbx-qr { display: none; }
.dbx--touch .dbx-card { width: auto; min-width: 180px; }

/* ── Collapsed pill ─────────────────────────────────────────────────────────── */
.dbx-pill {
  display: none; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 14px 0 10px;
  font: 600 13px/1 'Poppins', sans-serif; color: #fff;
  background: var(--dbx-strong); border: 0; border-radius: 999px; cursor: pointer;
  box-shadow: 0 8px 20px oklch(0.16 0.028 230 / 0.3);
  animation: dbx-in 0.4s var(--dbx-ease);
}
.dbx-pill svg { width: 18px; height: 18px; }
.dbx.is-min .dbx-card { display: none; }
.dbx.is-min .dbx-pill { display: inline-flex; }

/* Short frames (wide banners): pull the card in so the game stays visible */
@media (max-height: 380px) {
  .dbx-card { width: clamp(132px, 34vh, 168px); }
  .dbx-status { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .dbx-card, .dbx-pill { animation: none; }
  .dbx-status[data-state="free"] .dbx-dot { animation: none; }
}
