/* public/css/global.css
   Global reset + app-wide base tokens + shell + simple primitives (LIGHT MODE++)
   - Mobile-first
   - POPPY background + gentle texture + richer header
   - Footer is FIXED to bottom with a clean white/glass background
   - ✅ Reusable centered "sheet" + form system (ui-sheet, ui-form, ui-field)
   - ✅ Reusable Avatar Ring system (ui-avatarring, ui-avatarimg)
   - ✅ Reusable clickable Tile primitive (ui-tile)
   - ✅ Reusable tooltip / info system (ui-info, ui-tooltip)
   --font-kid: ui-rounded, "Comic Sans MS", "Comic Sans", "Chalkboard SE",
    "Marker Felt", "Trebuchet MS", system-ui, -apple-system, Segoe UI, Roboto,
    Helvetica, Arial;
*/

:root {
  /* Fonts */
  --font-kid: "Baloo 2", system-ui, sans-serif;

  /* ============================================================
     App palette (light+++ / brighter like the logo)
  ============================================================ */
  --app-fg: #0b1220;
  --app-muted: rgba(11, 18, 32, 0.66);

  /* Brighter accents (clean + candy, not neon-glow) */
  --accent: #22d3ff; /* bright cyan */
  --accent-2: #8b5cff; /* electric violet */
  --accent-3: #22e6a8; /* bright mint/green */
  --accent-4: #ff4fb3; /* bright pink (logo candy pink) */
  --accent-5: #ffb020; /* bright amber */

  /* Bonus: logo-ish primaries for brand moments (optional usage) */
  --brand-blue: #18bfff;
  --brand-yellow: #ffcc29;

  /* Shared rainbow gradient (more saturated) */
  --rainbow: linear-gradient(
    90deg,
    rgba(34, 211, 255, 0.96),
    rgba(139, 92, 255, 0.96),
    rgba(34, 230, 168, 0.96),
    rgba(255, 176, 32, 0.94),
    rgba(255, 79, 179, 0.94)
  );

  /* Surfaces (slightly brighter/cleaner) */
  --surface: rgba(255, 255, 255, 0.9);
  --surface-2: rgba(255, 255, 255, 0.78);

  /* Borders */
  --border: rgba(11, 18, 32, 0.12);
  --border-strong: rgba(11, 18, 32, 0.18);

  /* Controls */
  --btn-bg: #0b1220;
  --btn-fg: #ffffff;
  --btn-border: rgba(11, 18, 32, 0.18);

  --input-bg: rgba(255, 255, 255, 0.94);
  --input-border: rgba(11, 18, 32, 0.16);
  --focus: rgba(34, 211, 255, 0.75);

  /* Radius */
  --r-sm: 14px;
  --r-md: 18px;
  --r-lg: 20px;

  /* Layout */
  --container: 1100px;
  --sheet: 760px;

  /* Semantic (slightly brighter) */
  --good: #12b981;
  --bad: #ef4444;

  /* Shadow */
  --shadow-sm: 0 10px 22px rgba(0, 0, 0, 0.09);
  --shadow-md: 0 16px 34px rgba(0, 0, 0, 0.14);

  /* ============================================================
     POPPY Background canvas (brighter, more “candy”)
  ============================================================ */
  --bg-grad:
    radial-gradient(
      1100px 700px at 10% 12%,
      rgba(139, 92, 255, 0.34),
      rgba(255, 255, 255, 0) 62%
    ),
    radial-gradient(
      1050px 720px at 88% 18%,
      rgba(34, 211, 255, 0.34),
      rgba(255, 255, 255, 0) 62%
    ),
    radial-gradient(
      1000px 760px at 55% 92%,
      rgba(34, 230, 168, 0.24),
      rgba(255, 255, 255, 0) 60%
    ),
    radial-gradient(
      820px 540px at 40% 52%,
      rgba(255, 79, 179, 0.18),
      rgba(255, 255, 255, 0) 66%
    ),
    radial-gradient(
      900px 560px at 82% 70%,
      rgba(255, 176, 32, 0.16),
      rgba(255, 255, 255, 0) 68%
    ),
    linear-gradient(180deg, #fff4fb 0%, #f3fbff 42%, #fffaf0 100%);

  --bg-dots: radial-gradient(
    circle at 1px 1px,
    rgba(11, 18, 32, 0.06) 1px,
    rgba(0, 0, 0, 0) 1.6px
  );

  /* Header/footer tint (glass band) */
  --glass: rgba(255, 255, 255, 0.74);
  --glass-strong: rgba(255, 255, 255, 0.9);

  /* Footer sizing */
  --footer-h: 74px;

  /* ============================================================
     Global badge
  ============================================================ */
  .app-link--hasbadge {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }

  .app-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 18px;
    font-weight: 800;
    background: #ff3b30;
    color: #fff;
  }

  /* ============================================================
     Avatar ring system
  ============================================================ */
  --avatar-xs: 33px;
  --avatar-sm: 84px;
  --avatar-md: 96px;
  --avatar-lg: 112px;

  --avatar-ring: 3px;
  --avatar-shadow: 0 14px 30px rgba(0, 0, 0, 0.12);

  /* ============================================================
     Tooltip system tokens
  ============================================================ */
  --tip-bg: rgba(255, 255, 255, 0.96);
  --tip-border: rgba(11, 18, 32, 0.12);
  --tip-shadow: 0 16px 40px rgba(0, 0, 0, 0.16);
}

/* ============================================================
   Reset-ish
============================================================ */

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--app-fg);
  font-family: var(--font-kid);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  overflow-x: hidden;
  position: relative;
}

img,
svg,
video,
canvas {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}
a:hover {
  text-decoration: none;
}

::selection {
  background: rgba(56, 189, 248, 0.28);
}

input {
  font-size: 14px;
  font-family: var(--font-kid);
}

/* ============================================================
   Layout primitives
============================================================ */

.app-container {
  width: min(var(--container), calc(100%));
  margin: 0 auto;
}

.app-main {
  padding: 0px 0 24px;
  padding-bottom: calc(var(--footer-h) + 26px);
}

.ui-page {
  padding: 14px 0 24px;
}

/* ============================================================
   Tiny primitives
============================================================ */

.ui-title {
  margin: 0 0 10px 0;
  font-size: 26px;
  font-weight: 950;
  letter-spacing: 0.2px;
}

.ui-sub {
  margin: 6px 0 14px 0;
  color: var(--app-muted);
  line-height: 1.45;
}

.ui-grid {
  display: grid;
  gap: 12px;
}

.ui-label {
  font-size: 13px;
  color: var(--app-muted);
}

/* Inputs */
.ui-input {
  width: 100%;
  padding: 12px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--app-fg);
  outline: none;
  font-family: var(--font-kid);
}

.ui-input:focus {
  border-color: rgba(11, 18, 32, 0.28);
  box-shadow: 0 0 0 4px var(--focus);
}

/* Buttons */
.ui-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-kid);
  padding: 12px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 900;
  cursor: pointer;
  user-select: none;
  box-shadow: var(--shadow-md);
  appearance: none;
  -webkit-appearance: none;
  outline: none;
}

.ui-btn:hover {
  transform: translateY(-0.5px);
}

.ui-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.ui-btn--ghost {
  background: transparent;
  color: var(--app-fg);
  border-color: rgba(11, 18, 32, 0.14);
  box-shadow: none;
}

.ui-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.65);
  border-color: rgba(11, 18, 32, 0.12);
  transform: none;
}

.ui-btn--danger {
  background: #fff;
  color: var(--bad);
  border: 1px solid rgba(239, 68, 68, 0.35);
  box-shadow: none;
}

.ui-btn--danger:hover {
  background: #fff5f5;
  border: 1px solid var(--bad);
  box-shadow: none;
  transform: none;
}

/* Status pill */
.ui-status {
  font-size: 13px;
  color: var(--app-muted);
  padding: 8px 10px;
  border-radius: 999px;
  border: 2px solid rgba(11, 18, 32, 0.1);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(12px);
}

.ui-status[data-kind="good"] {
  color: var(--good);
}
.ui-status[data-kind="bad"] {
  color: var(--bad);
}

/* ============================================================
   UI Tile (clickable card)
============================================================ */

.ui-tile {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--r-lg);
  padding: 18px;

  backdrop-filter: blur(14px);
  box-shadow: none;

  color: inherit;
  text-decoration: none;

  transition:
    transform 120ms ease,
    box-shadow 120ms ease,
    border-color 120ms ease,
    background 120ms ease;
}

.ui-tile:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: none;
}

.ui-tile:active {
  transform: translateY(0px);
}

.ui-tile:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 4px var(--focus),
    0 16px 34px rgba(0, 0, 0, 0.12);
}

.ui-tile--btn {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

/* ============================================================
   Avatar Ring System (reusable)
   ✅ includes XS again
============================================================ */

.ui-avatarring {
  width: var(--avatar-md);
  height: var(--avatar-md);
  flex: 0 0 auto;

  display: grid;
  place-items: center;

  padding: var(--avatar-ring);
  border-radius: 50%;
  background: var(--rainbow);
}

.ui-avatarring--xs {
  width: var(--avatar-xs);
  height: var(--avatar-xs);
}

.ui-avatarring--sm {
  width: var(--avatar-sm);
  height: var(--avatar-sm);
}
.ui-avatarring--md {
  width: var(--avatar-md);
  height: var(--avatar-md);
}
.ui-avatarring--lg {
  width: var(--avatar-lg);
  height: var(--avatar-lg);
}

.ui-avatarimg {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;

  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform 120ms ease;
}

.ui-avatarimg--placeholder {
  width: 100%;
  height: 100%;
  border-radius: 50%;

  display: grid;
  place-items: center;

  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-sm);
}

.ui-avatarring--btn {
  appearance: none;
  -webkit-appearance: none;

  border: 0;
  cursor: pointer;
  user-select: none;

  transition:
    transform 120ms ease,
    box-shadow 120ms ease;
}

.ui-avatarring--btn:hover {
  transform: translateY(-1px);
}

.ui-avatarring--btn:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 4px var(--focus),
    var(--avatar-shadow);
}

.ui-avatarring.is-selected {
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    0 0 0 4px rgba(0, 0, 0, 0.12),
    0 0 0 8px var(--focus),
    var(--avatar-shadow);
}

.ui-avatarring.is-selected .ui-avatarimg,
.ui-avatarring.is-selected .ui-avatarimg--placeholder {
  transform: scale(1.04);
}

/* ============================================================
   Tooltip / info system (reusable)
   ✅ make the "i" dark so it is visible
============================================================ */

.ui-info {
  appearance: none;
  -webkit-appearance: none;

  width: 20px;
  height: 20px;

  display: inline-grid;
  place-items: center;

  border-radius: 999px;
  border: 2px solid transparent;

  background: rgba(11, 18, 32, 0.86); /* 👈 DARK */
  color: #fff; /* 👈 readable */

  cursor: pointer;
  user-select: none;

  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.14);
  transition:
    background 120ms ease,
    border-color 120ms ease,
    transform 120ms ease,
    box-shadow 120ms ease;
}

.ui-info::before {
  content: "i";
  font-weight: 950;
  font-size: 12px;
  line-height: 1;
}

.ui-info:hover {
  background: rgba(11, 18, 32, 0.95);
  transform: translateY(-0.5px);
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.18);
}

.ui-info:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 4px var(--focus),
    0 12px 26px rgba(0, 0, 0, 0.18);
}

.ui-tooltip {
  z-index: 9999;

  padding: 10px 12px;
  border-radius: 14px;

  background: var(--tip-bg);
  border: 1px solid var(--tip-border);

  color: rgba(11, 18, 32, 0.92);
  font-size: 13px;
  line-height: 1.35;

  backdrop-filter: blur(14px);
  box-shadow: var(--tip-shadow);

  opacity: 0;
  pointer-events: none;

  transition:
    opacity 120ms ease,
    transform 120ms ease;
  transform: translate(-9999px, -9999px);
}

.ui-tooltip.is-on {
  opacity: 1;
  pointer-events: none;
}

/* ============================================================
   Brand logo (brain)
============================================================ */

.app-brand__logo {
  width: 100px;
  object-fit: contain;
  flex: 0 0 auto;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.18));
  margin-left: 10px;
}

.app-footer__brand {
  display: flex;
  align-items: center;
  gap: 5px;
}

.app-footer__logo {
  width: 100px;
  object-fit: contain;
  opacity: 0.9;
}

/* ============================================================
   Centered "sheet" + form system
============================================================ */

.ui-sheet {
  width: min(var(--sheet), calc(100% - 28px));
  margin: 0 auto;
}

.ui-form {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.ui-field {
  display: grid;
  gap: 8px;
}

.ui-help {
  font-size: 12px;
  color: var(--app-muted);
  margin-top: -2px;
}

.ui-form__actions {
  margin-top: 6px;
}

.ui-note {
  margin-top: 12px;
  font-size: 13px;
  color: var(--app-muted);
}

/* Inline validation helpers */
.ui-statusline {
  display: none;
  width: fit-content;
}
.ui-statusline.is-on {
  display: inline-flex;
}
.ui-statusline.is-good {
  border-color: rgba(15, 118, 110, 0.18);
  background: rgba(15, 118, 110, 0.08);
  color: var(--good);
}
.ui-statusline.is-bad {
  border-color: rgba(185, 28, 28, 0.18);
  background: rgba(185, 28, 28, 0.07);
  color: var(--bad);
}

.ui-input.is-bad {
  border-color: rgba(185, 28, 28, 0.35);
  box-shadow: 0 0 0 4px rgba(185, 28, 28, 0.12);
}

.ui-input.is-good {
  border-color: rgba(15, 118, 110, 0.28);
}

/* ============================================================
   App shell (header/nav/footer)
============================================================ */

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding-bottom: 2px;
  background: var(--glass);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(11, 18, 32, 0.08);
}

.app-header::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  pointer-events: none;
  background: var(--rainbow);
  opacity: 0.9;
}

.app-header__inner {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  position: relative;
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.app-brand__text {
  font-weight: 950;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-nav {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-right: 5px;
}

.app-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  color: rgba(11, 18, 32, 0.92);
  font-weight: 900;
  font-size: 13px;
  line-height: 1;

  padding: 8px 10px;
  border-radius: 999px;
  border: 2px solid transparent;

  background: transparent;
  user-select: none;
}

.app-link:hover {
  border-color: rgba(11, 18, 32, 0.12);
  background: rgba(255, 255, 255, 0.62);
}

.app-link--muted {
  color: rgba(11, 18, 32, 0.55);
}

.app-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 9px 12px;
  border-radius: 999px;

  background: var(--btn-bg);
  color: #fff;
  font-weight: 950;
  font-size: 13px;
  line-height: 1;

  border: 2px solid var(--btn-border);
  box-shadow: var(--shadow-sm);
  user-select: none;
}

.app-btn:hover {
  transform: translateY(-0.5px);
}

.app-logout-form {
  display: inline;
  margin: 0;
}

.app-link--btn {
  appearance: none;
  -webkit-appearance: none;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  background: transparent;
  border: 2px solid transparent;
  border-radius: 999px;

  padding: 8px 10px;
  margin: 0;

  font: inherit;
  font-weight: 900;
  font-size: 13px;
  line-height: 1;

  color: inherit;
  cursor: pointer;
}

.app-link--btn:focus {
  outline: none;
}

.app-link--btn:focus-visible {
  box-shadow: 0 0 0 4px var(--focus);
}

/* ============================================================
   Footer (FIXED)
============================================================ */

.app-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  padding: 4px;
  margin: 0;

  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(11, 18, 32, 0.1);
}

.app-footer__inner {
  width: min(var(--container), calc(100% - 28px));
  margin: 0 auto;

  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.app-footer__brand {
  font-weight: 950;
}

.app-footer__sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--app-muted);
}

.app-footer__links {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ============================================================
   Mobile polish
============================================================ */

@media (max-width: 520px) {
  .app-nav {
    gap: 6px;
  }

  .app-link,
  .app-link--btn {
    padding: 7px 9px;
    font-family: var(--font-kid);
    font-size: 12px;
  }

  .app-btn {
    padding: 8px 10px;
    font-family: var(--font-kid);
    font-size: 12px;
  }

  .app-main {
    padding-bottom: calc(var(--footer-h) + 42px);
  }
}

/* ============================================================
   Avatar dropdown (kid-mode)
============================================================ */

.app-avatarwrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

/* Same hover border behavior as app links */
.app-avatarbtn {
  display: inline-flex;
  align-items: center;
  gap: 10px;

  background: transparent;
  border: 2px solid transparent;
  cursor: pointer;

  font-family: inherit;
  color: inherit;
  padding: 6px 10px;
  border-radius: 999px;

  transition:
    background 120ms ease,
    border-color 120ms ease,
    transform 120ms ease;
}

.app-avatarbtn:hover {
  border-color: rgba(11, 18, 32, 0.12);
  background: rgba(255, 255, 255, 0.62);
  transform: translateY(-0.5px);
}

.app-avatarbtn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--focus);
}

.app-avatarname {
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.app-avatarmenu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;

  min-width: 200px;
  padding: 6px;

  background: var(--glass-strong);
  border: 1px solid rgba(11, 18, 32, 0.1);
  border-radius: 12px;

  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px);
}

.app-avatarmenu__item {
  display: block;
  width: 100%;

  text-align: left;
  font-size: 14px;
  font-weight: 500;

  padding: 8px 10px;
  border-radius: 8px;

  color: #111;
  text-decoration: none;
  background: transparent;
  border: none;
  cursor: pointer;

  transition: background 120ms ease;
}

.app-avatarmenu__item:hover {
  background: rgba(0, 0, 0, 0.06);
}

.app-avatarmenu__btn {
  font-family: inherit;
}

.app-avatarmenu__muted {
  color: rgba(0, 0, 0, 0.55);
}

.app-avatarmenu__sep {
  height: 1px;
  margin: 6px 0;
  background: rgba(0, 0, 0, 0.1);
}

.app-avatarmenu__form {
  margin: 0;
}

@media (max-width: 640px) {
  .app-avatarname {
    display: none;
  }
}

.app-avatarmenu {
  transform-origin: top right;
  animation: avatarMenuIn 120ms ease-out;
}

@keyframes avatarMenuIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(-2px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ============================================================
   Reusable Drawer (ui-drawer)
   - Right-side slide-in panel + overlay
============================================================ */

.ui-drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(11, 18, 32, 0.35);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
}

.ui-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100dvh;
  width: min(420px, calc(100% - 44px));
  z-index: 1000;

  background: rgba(255, 255, 255, 0.92);
  border-left: 1px solid rgba(11, 18, 32, 0.12);

  box-shadow: -30px 0 70px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(18px);

  transform: translateX(110%);
  transition: transform 180ms ease;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.ui-drawer__head {
  padding: 14px 14px 10px;
  border-bottom: 1px solid rgba(11, 18, 32, 0.1);
  display: grid;
  gap: 6px;
}

.ui-drawer__title {
  margin: 0;
  font-size: 16px;
  font-weight: 950;
}

.ui-drawer__sub {
  margin: 0;
  font-size: 12px;
  color: var(--app-muted);
}

.ui-drawer__body {
  padding: 14px;
  overflow: auto;
}

.ui-drawer__foot {
  padding: 12px 14px 14px;
  border-top: 1px solid rgba(11, 18, 32, 0.1);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* open state */
.ui-drawer-overlay.is-on {
  opacity: 1;
  pointer-events: auto;
}

.ui-drawer.is-on {
  transform: none;
}

/* prevent background scroll when drawer open */
body.is-drawer-open {
  overflow: hidden;
}

/* ============================================================
   Brainrot Toolbar + Chips + Pager (ONLY the knobs/filters)
   Put in: public/css/brainrot.css (loaded after global.css)
   Uses global tokens: --surface/--surface-2/--border/--focus/--shadow-*
============================================================ */

.br-shell {
  width: min(var(--sheet), calc(100% - 28px));
  margin: 0 auto;
}

/* Top controls (Generate + status) */
.br-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin: 12px auto 10px;
}

.br-btn {
  /* piggyback global button feel */
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 12px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--btn-border);

  background: var(--btn-bg);
  color: var(--btn-fg);

  font-weight: 950;
  cursor: pointer;

  box-shadow: var(--shadow-md);
  user-select: none;
}

.br-btn:hover {
  transform: translateY(-0.5px);
}

.br-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.br-status {
  /* mirror ui-status but keep class local */
  font-size: 13px;
  color: var(--app-muted);
  padding: 8px 10px;
  border-radius: 999px;
  border: 2px solid rgba(11, 18, 32, 0.1);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(12px);
}

.br-status[data-kind="good"] {
  color: var(--good);
}
.br-status[data-kind="bad"] {
  color: var(--bad);
}

/* ============================================================
   Toolbar container
============================================================ */

.br-toolbar {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--r-lg);
  padding: 14px;

  backdrop-filter: blur(14px);
  box-shadow:
    0 12px 26px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);

  display: grid;
  gap: 12px;

  margin: 8px auto 16px;
}

/* Rows + groups */
.br-toolbar__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.br-toolbar__row--pager {
  justify-content: center;
}

.br-toolbar__group {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

/* Section label (View/Sort/Filter) */
.br-toolbar__label {
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.22px;
  text-transform: uppercase;
  color: rgba(11, 18, 32, 0.62);

  padding: 6px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(11, 18, 32, 0.08);
}

/* Chip containers */
.br-toolbar__chips {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* segmented group for View */
.br-toolbar__seg {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px;
  gap: 4px;

  border: 1px solid rgba(11, 18, 32, 0.12);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.06);
}

/* ============================================================
   Chips (buttons)
============================================================ */

.br-chip {
  appearance: none;
  -webkit-appearance: none;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 9px 11px;
  border-radius: 999px;

  border: 1px solid rgba(11, 18, 32, 0.14);
  background: rgba(255, 255, 255, 0.68);
  color: rgba(11, 18, 32, 0.92);

  font: inherit;
  font-size: 13px;
  font-weight: 950;
  line-height: 1;

  cursor: pointer;
  user-select: none;

  transition:
    transform 120ms ease,
    background 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease;
}

.br-chip:hover {
  background: rgba(255, 255, 255, 0.86);
  border-color: rgba(11, 18, 32, 0.18);
  transform: translateY(-0.5px);
}

.br-chip:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--focus);
}

.br-chip:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* Active state (your template uses .is-on) */
.br-chip.is-on {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(11, 18, 32, 0.22);
  box-shadow: 0 0 0 4px var(--focus);
  transform: none;
}

/* Tighten chips inside segmented control */
.br-toolbar__seg .br-chip {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.br-toolbar__seg .br-chip:hover {
  background: rgba(255, 255, 255, 0.7);
  transform: none;
}

.br-toolbar__seg .br-chip.is-on {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 3px var(--focus);
}

/* Optional: give rarity chips a tiny “hint” tint while still subtle */
.br-chip[data-br-rarity="OG"] {
  box-shadow: inset 0 0 0 2px rgba(139, 92, 255, 0.12);
}
.br-chip[data-br-rarity="Mythic"] {
  box-shadow: inset 0 0 0 2px rgba(255, 79, 179, 0.12);
}
.br-chip[data-br-rarity="Legendary"] {
  box-shadow: inset 0 0 0 2px rgba(255, 176, 32, 0.14);
}
.br-chip[data-br-rarity="Epic"] {
  box-shadow: inset 0 0 0 2px rgba(34, 211, 255, 0.12);
}
.br-chip[data-br-rarity="Rare"] {
  box-shadow: inset 0 0 0 2px rgba(139, 92, 255, 0.1);
}
.br-chip[data-br-rarity="Uncommon"] {
  box-shadow: inset 0 0 0 2px rgba(34, 230, 168, 0.12);
}
.br-chip[data-br-rarity="Common"] {
  box-shadow: inset 0 0 0 2px rgba(11, 18, 32, 0.08);
}

/* Active rarity chip can keep its hint */
.br-chip.is-on[data-br-rarity] {
  box-shadow:
    0 0 0 4px var(--focus),
    inset 0 0 0 2px rgba(11, 18, 32, 0.06);
}

/* ============================================================
   Pager
============================================================ */

.br-pager {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.br-pager__btn {
  appearance: none;
  -webkit-appearance: none;

  width: 38px;
  height: 38px;
  border-radius: 999px;

  border: 1px solid rgba(11, 18, 32, 0.14);
  background: rgba(255, 255, 255, 0.72);
  color: rgba(11, 18, 32, 0.92);

  display: grid;
  place-items: center;

  font: inherit;
  font-size: 14px;
  font-weight: 950;

  cursor: pointer;
  user-select: none;

  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.08);
  transition:
    transform 120ms ease,
    background 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease;
}

.br-pager__btn:hover {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(11, 18, 32, 0.18);
  transform: translateY(-0.5px);
}

.br-pager__btn:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 4px var(--focus),
    0 10px 22px rgba(0, 0, 0, 0.1);
}

.br-pager__btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.br-pager__meta {
  font-size: 13px;
  font-weight: 900;
  color: rgba(11, 18, 32, 0.78);

  padding: 8px 12px;
  border-radius: 999px;

  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(11, 18, 32, 0.1);
  backdrop-filter: blur(12px);
}

.br-pager__meta strong {
  font-weight: 950;
}

.br-pager__muted {
  color: rgba(11, 18, 32, 0.55);
  font-weight: 900;
}

/* Bottom pager spacing */
.br-pagerBottom {
  margin: 18px auto 24px;
}

/* ============================================================
   Mobile tweaks
============================================================ */

@media (max-width: 520px) {
  .br-toolbar {
    padding: 12px;
  }

  .br-chip {
    padding: 8px 10px;
    font-size: 12px;
  }

  .br-toolbar__label {
    font-size: 11px;
  }

  .br-pager__meta {
    font-size: 12px;
  }
}

/* ============================================================
   GoldRot pill (match app-link exactly)
============================================================ */

.app-goldrot {
  /* inherits .app-link sizing/hover; just add the inner layout */
  gap: 8px;
}

.app-goldrot__icon {
  font-size: 14px; /* match overall nav visual weight */
  line-height: 1;
}

.app-goldrot__value {
  font: inherit;
  font-weight: inherit;
  line-height: 1;
  font-size: 14px;
}

/* ============================================================
   Kid bottom tabs (footer nav)
============================================================ */

.app-footer--kid .app-footer__inner {
  align-items: center;
  justify-content: center;
}

.kid-tabs {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.kid-tab {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 4px;

  padding: 10px 10px;
  border-radius: 16px;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.55);

  user-select: none;
  -webkit-tap-highlight-color: transparent;

  transition:
    transform 120ms ease,
    background 120ms ease,
    border-color 120ms ease;
}

.kid-tab:active {
  transform: translateY(0px);
}

.kid-tab:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--focus);
}

.kid-tab__icon {
  font-size: 20px;
  line-height: 1;
}

.kid-tab__label {
  font-size: 12px;
  font-weight: 950;
  line-height: 1;
  color: rgba(11, 18, 32, 0.84);
}

/* Put badge in top-right corner of the Messages tab */
.kid-tab__badge {
  position: absolute;
  top: 6px;
  right: 10px;
}

/* Optional: "active" styling (set via JS or server class) */
.kid-tab.is-active {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(11, 18, 32, 0.12);
  box-shadow: 0 0 0 4px var(--focus);
}

/* Tighten on tiny phones */
@media (max-width: 380px) {
  .kid-tab__icon {
    font-size: 18px;
  }
  .kid-tab__label {
    font-size: 11px;
  }
  .kid-tabs {
    gap: 8px;
  }
}

/* ============================================================
   UI MODAL (global primitive)
============================================================ */

.ui-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 18px;
}

.ui-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 18, 32, 0.45);
  backdrop-filter: blur(6px);
}

.ui-modal__card {
  position: relative;
  width: min(520px, calc(100vw - 36px));
  border-radius: 20px;
  padding: 14px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.25);
  background-color: white;
}

.ui-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.ui-modal__title {
  font-weight: 950;
  font-family: var(--font-kid);
  font-size: 20px;
  line-height: 1.1;
}

.ui-modal__text {
  opacity: 0.85;
  font-size: 14px;
  margin-bottom: 12px;
}

.ui-modal__form {
  display: grid;
  gap: 10px;
  margin: 0;
}

.ui-modal__pin {
  font-size: 18px;
  letter-spacing: 0.18em;
  text-align: center;
}

.ui-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.ui-modal__error {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 0, 80, 0.1);
  border: 1px solid rgba(255, 0, 80, 0.22);
  font-weight: 800;
  font-size: 13px;
}

@keyframes uiModalShake {
  0% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-6px);
  }
  40% {
    transform: translateX(6px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(4px);
  }
  100% {
    transform: translateX(0);
  }
}

.ui-modal--shake {
  animation: uiModalShake 260ms ease-in-out;
}

/* ------------------------------------------------------------
   collectionRenderer.css — Toolbar (2-row, no scroll)
------------------------------------------------------------ */

.cr__toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 0 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 14px;
  width: 100%;
}

/* full toolbar stack */
.cr__filters {
  display: grid;
  gap: 10px;
}

/* each row is its own grid */
.cr__row {
  display: grid;
  gap: 10px;
  align-items: end;
}

/* Top row: Search + Sort (2 columns) */
.cr__row--top {
  grid-template-columns: 1fr 1fr;
}

/* Bottom row: Rarity + Ingredirots + Clear */
.cr__row--bottom {
  grid-template-columns: 1fr 1fr auto;
}

/* IMPORTANT: allow shrinking, prevent overflow */
.cr__filter {
  min-width: 0;
}

.cr__filterLabel {
  font-size: 11px;
  opacity: 0.7;
  margin-bottom: 6px;
}

/* Clear button sits aligned with inputs */
.cr__clear {
  white-space: nowrap;
  height: 44px; /* matches input height feel */
  padding: 10px 14px;
}

/* Footer / more */
.cr__footer {
  display: flex;
  justify-content: center;
  padding-top: 14px;
}

.cr__more {
  min-width: 180px;
}

/* Super small phones: stack rows */
@media (max-width: 420px) {
  .cr__row--top {
    grid-template-columns: 1fr;
  }

  .cr__row--bottom {
    grid-template-columns: 1fr 1fr;
  }

  .cr__clear {
    grid-column: 1 / -1; /* full width clear */
    width: 100%;
  }
}

/* ------------------------------------------------------------
   Grid
------------------------------------------------------------ */

.cr__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (min-width: 720px) {
  .cr__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
  }
}

/* ------------------------------------------------------------
   Rarity tokens (copied from store.css)
   NOTE: If you already define these in global.css elsewhere,
   you can remove this :root block to avoid duplicates.
------------------------------------------------------------ */

:root {
  --br-c-common: rgba(99, 115, 139, 1);
  --br-c-uncommon: rgba(34, 230, 168, 1);
  --br-c-rare: rgba(139, 92, 255, 1);
  --br-c-epic: rgba(34, 211, 255, 1);
  --br-c-legendary: rgba(255, 176, 32, 1);
  --br-c-mythic: rgba(255, 79, 179, 1);
  --br-c-og: rgba(11, 18, 32, 1);

  --br-bg-common: #f4f7ff;
  --br-bg-uncommon: #e6fff5;
  --br-bg-rare: #f0eaff;
  --br-bg-epic: #e7fbff;
  --br-bg-legendary: #fff1d6;
  --br-bg-mythic: #ffe6f2;
  --br-bg-og: #eef1ff;
}

/* Map rarity -> generic vars */
.crItem {
  --rarity-accent: var(--br-c-common);
  --rarity-tint: var(--br-bg-common);
}

.crItem[data-rarity="Common"] {
  --rarity-accent: var(--br-c-common);
  --rarity-tint: var(--br-bg-common);
}
.crItem[data-rarity="Uncommon"] {
  --rarity-accent: var(--br-c-uncommon);
  --rarity-tint: var(--br-bg-uncommon);
}
.crItem[data-rarity="Rare"] {
  --rarity-accent: var(--br-c-rare);
  --rarity-tint: var(--br-bg-rare);
}
.crItem[data-rarity="Epic"] {
  --rarity-accent: var(--br-c-epic);
  --rarity-tint: var(--br-bg-epic);
}
.crItem[data-rarity="Legendary"] {
  --rarity-accent: var(--br-c-legendary);
  --rarity-tint: var(--br-bg-legendary);
}
.crItem[data-rarity="Mythic"] {
  --rarity-accent: var(--br-c-mythic);
  --rarity-tint: var(--br-bg-mythic);
}
.crItem[data-rarity="OG"] {
  --rarity-accent: var(--br-c-og);
  --rarity-tint: var(--br-bg-og);
}

/* ------------------------------------------------------------
   Item card (copied from store.css -> .crItem namespace)
------------------------------------------------------------ */

.crItem {
  border: 3px solid var(--rarity-accent);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 230px;
  background: rgba(255, 255, 255, 0.02);
}

/* Image */
.crItem__imgWrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.crItem__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Dex overlay */
.crItem__dex {
  position: absolute;
  top: 10px;
  right: 12px;

  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.6px;

  color: rgba(11, 18, 32, 0.55);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.65);
  pointer-events: none;
  user-select: none;
}

/* Body */
.crItem__body {
  padding: 10px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.crItem__name {
  font-size: 14px;
  line-height: 1.2;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Rarity pill */
.crItem__rarityLine {
  display: inline-flex;
}

.crItem__rarityText {
  display: inline-flex;
  align-items: center;

  padding: 4px 10px;
  border-radius: 999px;

  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.2px;

  color: var(--rarity-accent);
  background: color-mix(in srgb, var(--rarity-accent) 18%, white);
  border: 2px solid var(--rarity-accent);
}

/* Power row */
.crItem__power {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}

.crItem__powerLabel {
  font-size: 12px;
  opacity: 0.7;
}

.crItem__powerValue {
  font-size: 14px;
  font-weight: 950;
  color: rgba(11, 18, 32, 0.92);
}

/* Bottom meta */
.crItem__meta {
  margin-top: auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.crItem__price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-height: 22px; /* keeps layout stable even when empty */
}

.crItem__priceValue {
  font-size: 14px;
}

.crItem__priceUnit {
  font-size: 12px;
  opacity: 0.7;
}

.crItem__actions .crAction {
  min-width: 84px;
}

/* Hover polish */
.crItem:not(.is-owned):hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

/* ------------------------------------------------------------
   Compact view toggle button
------------------------------------------------------------ */

.cr__viewToggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 2px solid rgba(11, 18, 32, 0.14);
  border-radius: var(--r-sm);
  background: var(--input-bg);
  cursor: pointer;
  color: rgba(11, 18, 32, 0.6);
  font-size: 15px;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s;
}

.cr__viewToggle:hover,
.cr__viewToggle[data-view="compact"] {
  border-color: rgba(11, 18, 32, 0.45);
  color: rgba(11, 18, 32, 0.9);
}

/* ------------------------------------------------------------
   Search wrap — input + inline clear button
------------------------------------------------------------ */

.cr__searchWrap {
  position: relative;
  min-width: 0;
}

.cr__searchWrap .ui-input {
  width: 100%;
  padding-right: 38px;
}

.cr__searchClear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  display: none;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  color: rgba(11, 18, 32, 0.38);
  font-size: 13px;
  padding: 0;
  border-radius: 50%;
  transition: color 0.12s, background 0.12s;
}

.cr__searchClear:hover {
  color: rgba(11, 18, 32, 0.75);
  background: rgba(11, 18, 32, 0.07);
}

/* Show only when input has content (placeholder hidden = has value) */
.cr__searchWrap input:not(:placeholder-shown) + .cr__searchClear {
  display: flex;
}

/* ------------------------------------------------------------
   Compact grid layout
------------------------------------------------------------ */

.cr__grid--compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

@media (min-width: 720px) {
  .cr__grid--compact {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
  }
}

.cr__grid--compact .crItem {
  min-height: 0;
}

.cr__grid--compact .crItem__name,
.cr__grid--compact .crItem__rarityLine,
.cr__grid--compact .crItem__power {
  display: none;
}

.cr__grid--compact .crItem__body {
  padding: 5px 5px 7px;
  gap: 4px;
}

.cr__grid--compact .crItem__price {
  min-height: 0;
  gap: 3px;
}

.cr__grid--compact .crItem__priceValue,
.cr__grid--compact .crItem__priceUnit {
  font-size: 11px;
}

.cr__grid--compact .crItem__actions .crAction {
  min-width: 0;
  width: 100%;
  font-size: 11px;
  padding: 4px 4px;
}

/* ============================================================
   GAME COMPLETE MODAL (reward screen)
   - targets: .ui-modal--gameComplete
   - supports theme hook: .ui-modal--theme-night
============================================================ */

.ui-modal--gameComplete .ui-modal__card {
  padding: 18px;
  border-radius: 26px;
  overflow: hidden;

  /* "reward" surface */
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(11, 18, 32, 0.1);
  box-shadow: 0 26px 90px rgba(0, 0, 0, 0.28);
}

/* subtle rainbow edge */
.ui-modal--gameComplete .ui-modal__card::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 2px;
  border-radius: 26px;
  background: var(--rainbow);
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.95;
}

.ui-modal--gameComplete .ui-modal__head {
  margin-bottom: 10px;
}

.ui-modal--gameComplete .ui-modal__title {
  font-size: 22px;
  letter-spacing: 0.1px;
}

/* make pill a bit more "badge-y" */
.ui-modal--gameComplete .ui-status {
  font-weight: 950;
  border-width: 2px;
  background: rgba(255, 255, 255, 0.85);
}

/* ============================================================
   Hero block (headline + score + chips + progress)
============================================================ */

.ui-modal--gameComplete .ui-modal__body {
  margin-top: 6px;
}

.ui-modal--gameComplete .ui-modal__hero {
  border-radius: 20px;
  padding: 14px 14px 12px;

  background:
    radial-gradient(
      800px 220px at 10% 0%,
      rgba(34, 211, 255, 0.18),
      rgba(255, 255, 255, 0) 60%
    ),
    radial-gradient(
      700px 240px at 90% 20%,
      rgba(139, 92, 255, 0.18),
      rgba(255, 255, 255, 0) 62%
    ),
    rgba(255, 255, 255, 0.65);

  border: 1px solid rgba(11, 18, 32, 0.1);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.1);
}

.ui-modal--gameComplete .ui-modal__heroLine {
  font-size: 14px;
  font-weight: 950;
  color: rgba(11, 18, 32, 0.82);
  margin-bottom: 8px;
}

/* Big score */
.ui-modal--gameComplete .ui-modal__scoreRow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.ui-modal--gameComplete .ui-modal__scoreBig {
  font-size: 34px;
  line-height: 1.05;
  font-weight: 950;
  letter-spacing: -0.3px;
  color: rgba(11, 18, 32, 0.96);
}

/* Chips row */
.ui-modal--gameComplete .ui-modal__chips {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.ui-modal--gameComplete .ui-modal__chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;

  padding: 10px 12px;
  border-radius: 999px;

  font-size: 14px;
  font-weight: 950;

  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(11, 18, 32, 0.12);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.08);
}

.ui-modal--gameComplete .ui-modal__chipIcon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ui-modal--gameComplete .ui-modal__chip--goldrot {
  border-color: rgba(191, 152, 13, 0.28);
  background: rgba(255, 246, 214, 0.7);
}

.ui-modal--gameComplete .ui-modal__chip--level {
  border-color: rgba(139, 92, 255, 0.22);
  background: rgba(240, 234, 255, 0.75);
}

/* Progress */
.ui-modal--gameComplete .ui-modal__progressWrap {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.ui-modal--gameComplete .ui-modal__progressLabel {
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.18px;
  text-transform: uppercase;
  color: rgba(11, 18, 32, 0.62);
}

.ui-modal--gameComplete .ui-modal__progressBar {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;

  background: rgba(11, 18, 32, 0.1);
  border: 1px solid rgba(11, 18, 32, 0.1);
}

.ui-modal--gameComplete .ui-modal__progressFill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--rainbow);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.14);
  transition: width 240ms ease;
}

/* Legacy lines (if still passed) — make it feel like “summary chips” */
.ui-modal--gameComplete .ui-modal__lines {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.ui-modal--gameComplete .ui-modal__line {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(11, 18, 32, 0.1);
  background: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  font-weight: 900;
  color: rgba(11, 18, 32, 0.84);
}

/* Actions: make the primary feel like the "big" button */
.ui-modal--gameComplete .ui-modal__actions {
  margin-top: 14px;
  justify-content: space-between;
  gap: 12px;
}

.ui-modal--gameComplete .ui-modal__actions .ui-btn {
  width: 48%;
  min-height: 48px;
}

.ui-modal--gameComplete .ui-modal__actions .ui-btn--primary {
  border-radius: 16px;
  font-size: 14px;
}

.ui-modal--gameComplete .ui-modal__actions .ui-btn--ghost {
  border-radius: 16px;
}

/* ============================================================
   NIGHT THEME (optional hook)
   - uses the same layout but darker + punchier
============================================================ */

.ui-modal--gameComplete.ui-modal--theme-night .ui-modal__card {
  background: rgba(13, 18, 32, 0.92);
  color: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.ui-modal--gameComplete.ui-modal--theme-night .ui-modal__title {
  color: rgba(255, 255, 255, 0.92);
}

.ui-modal--gameComplete.ui-modal--theme-night .ui-status {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.86);
}

.ui-modal--gameComplete.ui-modal--theme-night .ui-modal__hero {
  background:
    radial-gradient(
      900px 260px at 10% 0%,
      rgba(34, 211, 255, 0.16),
      rgba(0, 0, 0, 0) 60%
    ),
    radial-gradient(
      800px 280px at 90% 20%,
      rgba(139, 92, 255, 0.16),
      rgba(0, 0, 0, 0) 62%
    ),
    rgba(255, 255, 255, 0.06);

  border-color: rgba(255, 255, 255, 0.1);
}

.ui-modal--gameComplete.ui-modal--theme-night .ui-modal__heroLine {
  color: rgba(255, 255, 255, 0.8);
}

.ui-modal--gameComplete.ui-modal--theme-night .ui-modal__scoreBig {
  color: rgba(255, 255, 255, 0.96);
}

.ui-modal--gameComplete.ui-modal--theme-night .ui-modal__chip {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.9);
}

.ui-modal--gameComplete.ui-modal--theme-night .ui-modal__chip--goldrot {
  border-color: rgba(191, 152, 13, 0.32);
}

.ui-modal--gameComplete.ui-modal--theme-night .ui-modal__chip--level {
  border-color: rgba(139, 92, 255, 0.28);
}

.ui-modal--gameComplete.ui-modal--theme-night .ui-modal__progressLabel {
  color: rgba(255, 255, 255, 0.68);
}

.ui-modal--gameComplete.ui-modal--theme-night .ui-modal__progressBar {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.1);
}

.ui-modal--gameComplete.ui-modal--theme-night .ui-modal__line {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.86);
}

/* Mobile tighten */
@media (max-width: 520px) {
  .ui-modal--gameComplete .ui-modal__card {
    padding: 16px;
  }

  .ui-modal--gameComplete .ui-modal__scoreBig {
    font-size: 30px;
  }

  .ui-modal--gameComplete .ui-modal__actions {
    flex-direction: column-reverse;
  }

  .ui-modal--gameComplete .ui-modal__actions .ui-btn {
    width: 100%;
  }
}

.app-goldrot__store {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  font-size: 14px;
  line-height: 1;

  color: rgba(11, 18, 32, 0.92);
}

/* =========================
   Header Google button
========================= */
.app-btn--google {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.app-googleLogo {
  width: 16px;
  height: 16px;
  display: block;
  object-fit: contain;
  flex: 0 0 16px;

  /* keeps it crisp on dark headers */
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.25));
}

/* ============================================================
   Nav loading spinner (footer tabs)
============================================================ */

.kid-tab.is-loading {
  pointer-events: none; /* prevent double taps */
  opacity: 0.9;
}

.kid-tab.is-loading .kid-tab__label {
  opacity: 0.7;
}

/* a steady, consistent spinner size in the icon slot */
.kid-tab__spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  line-height: 1;
}

/* Font Awesome spinner inherits currentColor */
.kid-tab__spinner .fa-spinner {
  font-size: 20px;
}

/* Game Complete — Recent GoldRot register */
.ui-modal--gameComplete .ui-modal__txns {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.ui-modal--gameComplete .ui-modal__txnsHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.ui-modal--gameComplete .ui-modal__txnsTitle {
  font-weight: 700;
  font-size: 13px;
  opacity: 0.9;
}

.ui-modal--gameComplete .ui-modal__txnsLoading,
.ui-modal--gameComplete .ui-modal__txnsEmpty {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  opacity: 0.75;
  padding: 6px 2px;
}

.ui-modal--gameComplete .ui-modal__txnsTable {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ui-modal--gameComplete .ui-modal__txnRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.03);
}

.ui-modal--gameComplete .ui-modal__txnReason {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}

.ui-modal--gameComplete .ui-modal__txnMeta {
  font-size: 12px;
  opacity: 0.7;
  margin-top: 2px;
}

.ui-modal--gameComplete .ui-modal__txnRight {
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
}

.ui-modal--gameComplete .ui-modal__txnRight[data-kind="pos"] {
  opacity: 0.9;
}

.ui-modal--gameComplete .ui-modal__txnRight[data-kind="neg"] {
  opacity: 0.9;
}

/* ============================================================
   CollectionRenderer state visibility
   data-cr-state drives what's visible — no inline style.display
   needed in JS.

   booting    → nothing shown (initial render before first fetch)
   results    → toolbar + grid + footer visible; panels hidden
   empty      → only emptyState panel; toolbar/grid/footer hidden
   no-results → toolbar + noResults panel; grid/footer hidden
============================================================ */

/* Both panels are always hidden by default — only shown via explicit
   state rules below. This prevents any flash before JS runs or before
   data-cr-state is set on the element. */
.cr__emptyState,
.cr__noResults { display: none; }

/* booting: hide everything until the first fetch completes */
.cr[data-cr-state="booting"] .cr__toolbar,
.cr[data-cr-state="booting"] .cr__grid,
.cr[data-cr-state="booting"] .cr__footer { display: none; }

/* empty: only the empty-state panel; no toolbar, no grid, no footer */
.cr[data-cr-state="empty"] .cr__toolbar,
.cr[data-cr-state="empty"] .cr__grid,
.cr[data-cr-state="empty"] .cr__footer { display: none; }
.cr[data-cr-state="empty"] .cr__emptyState { display: block; }

/* no-results: toolbar stays (user can edit/clear search), hide grid + footer */
.cr[data-cr-state="no-results"] .cr__grid,
.cr[data-cr-state="no-results"] .cr__footer { display: none; }
.cr[data-cr-state="no-results"] .cr__noResults { display: flex; }

/* Sort group: label + control stacked, centered */
.cr__sortGroup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

/* Search group stretches to fill available row space */
.cr__sortGroup--search {
  flex: 1;
  align-items: stretch;
  min-width: 0;
}

.cr__sortLabel {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.45;
  white-space: nowrap;
  line-height: 1;
}

/* Search label left-aligned + inset to align with input text */
.cr__sortGroup--search .cr__sortLabel {
  align-self: flex-start;
  padding-left: 12px;
}
