/* 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);
  --tile-dash: rgba(11, 18, 32, 0.22);

  /* 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;

  /* ============================================================
     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);

  /* ============================================================
     Extra semantic tokens (used across many pages)
  ============================================================ */
  --card-bg: #ffffff;
  --card-fg: #111111;
  --ink: rgba(11, 18, 32, 0.92);
  --ink-soft: rgba(11, 18, 32, 0.66);
  --ink-faint: rgba(11, 18, 32, 0.06);
  --gold: #bf980d;
}

/* ============================================================
   Global badge (notification dots on nav items)
============================================================ */
.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;
}

/* ============================================================
   DARK THEME — override all tokens via data-theme attribute
============================================================ */

[data-theme="dark"] {
  --app-fg: #e8ecf2;
  --app-muted: rgba(232, 236, 242, 0.60);

  --accent: #22d3ff;
  --accent-2: #9b75ff;
  --accent-3: #22e6a8;
  --accent-4: #ff6bc4;
  --accent-5: #ffb020;

  --brand-blue: #18bfff;
  --brand-yellow: #ffcc29;

  --surface: rgba(30, 34, 44, 0.92);
  --surface-2: rgba(36, 40, 52, 0.82);

  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --tile-dash: rgba(11, 18, 32, 0.25);

  --btn-bg: #e8ecf2;
  --btn-fg: #0b1220;
  --btn-border: rgba(255, 255, 255, 0.14);

  --input-bg: rgba(30, 34, 44, 0.90);
  --input-border: rgba(255, 255, 255, 0.14);
  --focus: rgba(34, 211, 255, 0.55);

  --good: #34d399;
  --bad: #f87171;

  --shadow-sm: 0 10px 22px rgba(0, 0, 0, 0.30);
  --shadow-md: 0 16px 34px rgba(0, 0, 0, 0.40);

  --bg-grad:
    radial-gradient(
      1100px 700px at 10% 12%,
      rgba(139, 92, 255, 0.18),
      transparent 62%
    ),
    radial-gradient(
      1050px 720px at 88% 18%,
      rgba(34, 211, 255, 0.18),
      transparent 62%
    ),
    radial-gradient(
      1000px 760px at 55% 92%,
      rgba(34, 230, 168, 0.12),
      transparent 60%
    ),
    radial-gradient(
      820px 540px at 40% 52%,
      rgba(255, 79, 179, 0.09),
      transparent 66%
    ),
    radial-gradient(
      900px 560px at 82% 70%,
      rgba(255, 176, 32, 0.08),
      transparent 68%
    ),
    linear-gradient(180deg, #0f1219 0%, #141820 42%, #0f1219 100%);

  --bg-dots: radial-gradient(
    circle at 1px 1px,
    rgba(255, 255, 255, 0.04) 1px,
    transparent 1.6px
  );

  --glass: rgba(20, 24, 34, 0.80);
  --glass-strong: rgba(20, 24, 34, 0.92);

  --tip-bg: rgba(30, 34, 44, 0.96);
  --tip-border: rgba(255, 255, 255, 0.10);
  --tip-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);

  --card-bg: #1e222c;
  --card-fg: #e8ecf2;
  --ink: rgba(232, 236, 242, 0.92);
  --ink-soft: rgba(232, 236, 242, 0.60);
  --ink-faint: rgba(255, 255, 255, 0.06);
  --gold: #d4a822;
}

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

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  color: var(--app-fg);
  font-family: var(--font-kid);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  overflow-x: hidden;
  position: relative;
}

[data-theme="dark"] body {
  background: #0f1219;
}

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 {
  flex: 1;
  padding: 0px 0 24px;
}

body:has(.app-footer--kid) .app-main {
  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: var(--border-strong);
  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;
  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--sm {
  padding: 6px 12px;
  font-size: 12px;
  box-shadow: none;
  min-height: 42px;
}

.ui-btn--ghost {
  background: transparent;
  color: var(--app-fg);
  border-color: var(--border);
  box-shadow: none;
}

.ui-btn--ghost:hover {
  background: var(--surface-2);
  border-color: var(--border);
  transform: none;
}

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

.ui-btn--danger:hover {
  background: rgba(239, 68, 68, 0.08);
  background: color-mix(in srgb, var(--bad) 8%, var(--card-bg));
  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 var(--border);
  background: var(--surface-2);
  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: var(--surface);
  box-shadow: none;
}

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

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

.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;
  overflow: hidden;

  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%;
  min-width: 0;
  min-height: 0;
  border-radius: 50%;
  object-fit: cover;

  background: var(--card-bg);
  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: var(--surface);
  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 var(--border),
    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: var(--btn-bg); /* 👈 DARK */
  color: var(--btn-fg); /* 👈 readable */

  cursor: pointer;
  user-select: none;

  box-shadow: var(--shadow-sm);
  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: var(--btn-bg);
  transform: translateY(-0.5px);
  box-shadow: var(--shadow-md);
}

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

.ui-tooltip {
  z-index: 9999;

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

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

  color: var(--ink);
  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;
}

/* Minimal brand (used on headerless pages like join-class) */

.minimal-brand {
  text-align: center;
  margin-bottom: 18px;
}

.minimal-brand__logo {
  width: 120px;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.15));
}


/* ============================================================
   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 var(--border);
}

.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: 0;
  flex-wrap: nowrap;
  justify-content: flex-end;
  padding-right: 10px;
}

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

  padding: 8px 10px;

  color: var(--ink);
  font-weight: 900;
  font-size: 13px;
  line-height: 1;

  text-decoration: none;
  transition: color 0.15s;
  user-select: none;
}

.app-link:hover {
  color: var(--ink-soft);
}

.app-link--muted {
  color: var(--ink-soft);
}

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

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

  background: var(--btn-bg);
  color: var(--btn-fg);
  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: none;

  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)
============================================================ */

/* -- Kid fixed tab bar -------------------------------------------------- */
.app-footer--kid {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  padding: 4px;
  margin: 0;
  background: var(--glass-strong);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
}

/* -- Static site footer ------------------------------------------------- */
.app-footer--site {
  margin-top: auto;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  background: var(--ink-faint);
}

.app-footer__inner {
  width: min(var(--container), calc(100% - 28px));
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.app-footer__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.app-footer__row + .app-footer__row {
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

.app-footer__brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
}

.app-footer__logo {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.app-footer__name {
  font-weight: 950;
  font-size: 15px;
  letter-spacing: 0.2px;
}

.app-footer__sub {
  font-size: 12px;
  color: var(--app-muted);
  margin: 0;
  white-space: nowrap;
}

.app-footer__nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

.app-footer__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 0.15s;
}

.app-footer__link:hover {
  color: var(--ink);
}

.app-footer__social {
  margin-left: auto;
}

.app-footer__link i {
  font-size: 12px;
}

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

@media (max-width: 520px) {
  .app-link--btn {
    padding: 7px 10px;
    font-family: var(--font-kid);
    font-size: 12px;
  }

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

  body:has(.app-footer--kid) .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 behavior as app links */
.app-avatarbtn {
  display: inline-flex;
  align-items: center;
  gap: 10px;

  background: transparent;
  border: none;
  cursor: pointer;

  font-family: inherit;
  color: inherit;
  padding: 6px 10px;

  transition: color 0.15s, transform 120ms ease;
}

.app-avatarbtn:hover {
  color: var(--ink-soft);
}

.app-avatarbtn:active {
  transform: scale(0.92);
}

.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 var(--border);
  border-radius: 12px;

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

.app-avatarmenu__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;

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

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

  color: var(--card-fg);
  text-decoration: none;
  background: transparent;
  border: none;
  cursor: pointer;

  transition: background 120ms ease;
}

.app-avatarmenu__item:hover {
  background: var(--ink-faint);
}

.app-avatarmenu__item i {
  width: 16px;
  text-align: center;
  opacity: 0.55;
}

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

.app-avatarmenu__muted {
  color: var(--ink-soft);
}

.app-avatarmenu__sep {
  height: 1px;
  margin: 6px 0;
  background: var(--border);
}

.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: var(--glass-strong);
  border-left: 1px solid var(--border);

  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 var(--border);
  display: grid;
  gap: 6px;
}

.ui-drawer__headRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

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

.ui-drawer__close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: none;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 16px;
  cursor: pointer;
  color: inherit;
  opacity: 0.5;
}

.ui-drawer__close:hover {
  opacity: 1;
}

.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 var(--border);
  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;
}

/* ============================================================
   Game Rules — button + drawer content
   Reusable across all game pages (multiplayer + minigames).
============================================================ */

.game-rules-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: none;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 16px;
  opacity: 0.5;
  cursor: pointer;
  color: inherit;
}

.game-rules-btn:hover {
  opacity: 1;
}

.game-rules__intro {
  margin: 0 0 14px;
  line-height: 1.55;
  opacity: 0.85;
}

.game-rules__h {
  margin: 16px 0 6px;
  font-size: 14px;
  font-weight: 800;
}

.game-rules__ul {
  margin: 0 0 6px;
  padding-left: 18px;
  line-height: 1.6;
  opacity: 0.85;
  font-size: 13px;
}

.game-rules__ul li {
  margin-bottom: 4px;
}

/* ============================================================
   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 var(--border);
  background: var(--surface-2);
  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:
    var(--shadow-sm),
    inset 0 1px 0 var(--glass);

  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: var(--ink-soft);

  padding: 6px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

/* 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 var(--border);
  background: var(--surface-2);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
}

/* ============================================================
   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 var(--border);
  background: var(--surface-2);
  color: var(--ink);

  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: var(--surface);
  border-color: var(--border-strong);
  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: var(--surface);
  border-color: var(--border-strong);
  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: var(--surface-2);
  transform: none;
}

.br-toolbar__seg .br-chip.is-on {
  background: var(--surface);
  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 var(--border);
  background: var(--surface-2);
  color: var(--ink);

  display: grid;
  place-items: center;

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

  cursor: pointer;
  user-select: none;

  box-shadow: var(--shadow-sm);
  transition:
    transform 120ms ease,
    background 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease;
}

.br-pager__btn:hover {
  background: var(--surface);
  border-color: var(--border-strong);
  transform: translateY(-0.5px);
}

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

.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: var(--ink);

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

  background: var(--surface-2);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

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

.br-pager__muted {
  color: var(--ink-soft);
  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(auto-fit, minmax(0, 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: transparent;

  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: var(--ink-soft);
}

/* Put badge hugging the icon (top-right of center) */
.kid-tab__badge {
  position: absolute;
  top: 2px;
  left: 50%;
  margin-left: 14px;
}

/* Optional: "active" styling (set via JS or server class) */
.kid-tab.is-active {
  background: transparent;
  border-color: var(--border);
  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;
  }
}

/* Assignment bar (locked mode) */
.kid-assignment-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  text-align: center;
}

/* ============================================================
   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.35);
}

[data-theme="dark"] .ui-modal__backdrop {
  background: rgba(0, 0, 0, 0.6);
}

/* ============================================================
   Avatar Swap Modal (ui-modal--avatarSwap)
   Global so it works from any page (store, kid-home, etc.)
============================================================ */

.ui-modal--avatarSwap .ui-modal__body {
  padding: 18px 12px 6px;
}

.ui-modal--avatarSwap .ui-modal__avatarRow {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  justify-items: center;
  gap: 22px;
  padding: 6px 4px 2px;
  margin: 6px 0 10px;
}

.ui-modal--avatarSwap .ui-modal__avatarCell {
  display: grid;
  place-items: center;
}

.ui-modal--avatarSwap .ui-modal__avatarCell .ui-avatarring {
  width: clamp(96px, 26vw, 132px);
  height: clamp(96px, 26vw, 132px);
  box-shadow: var(--avatar-shadow);
}

.ui-modal--avatarSwap .ui-modal__avatarCell .ui-avatarimg {
  box-shadow: var(--shadow-md);
  transform: scale(1.01);
}

.ui-modal--avatarSwap .ui-modal__avatarArrow {
  display: grid;
  place-items: center;
  width: clamp(56px, 10vw, 72px);
  height: clamp(56px, 10vw, 72px);
  border-radius: 999px;
  background: var(--surface-2);
  border: 2px solid var(--border);
  box-shadow: var(--shadow-sm);
  font-size: clamp(28px, 6vw, 40px);
  font-weight: 950;
  line-height: 1;
  color: var(--ink);
  user-select: none;
}

.ui-modal--avatarSwap .ui-modal__actions {
  margin-top: 8px;
}

@media (max-width: 420px) {
  .ui-modal--avatarSwap .ui-modal__avatarRow {
    gap: 14px;
  }
  .ui-modal--avatarSwap .ui-modal__avatarArrow {
    width: 52px;
    height: 52px;
    font-size: 30px;
  }
}

.ui-modal__card {
  position: relative;
  width: min(520px, calc(100vw - 36px));
  border-radius: 20px;
  padding: 14px;
  box-shadow: var(--shadow-md);
  background-color: var(--card-bg);
}

.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;
}

/* ============================================================
   Badge Detail Modal (ui-modal--badge)
============================================================ */

.ui-modal--badge .ui-modal__card {
  text-align: center;
  padding: 28px 20px 20px;
  max-width: 340px;
}

.ui-modal__badgeHero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.ui-modal__badgeIcon {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  font-size: 36px;
  color: var(--badge-color, #facc15);
  background: rgba(250, 204, 21, 0.12);
  background: color-mix(in srgb, var(--badge-color, #facc15) 12%, transparent);
  border: 3px solid rgba(250, 204, 21, 0.35);
  border: 3px solid color-mix(in srgb, var(--badge-color, #facc15) 35%, transparent);
}

.ui-modal__badgeLabel {
  font-size: 22px;
  font-weight: 950;
  letter-spacing: 0.2px;
  line-height: 1.2;
}

.ui-modal__badgeCat {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.2px;
  color: var(--badge-color, #facc15);
  background: rgba(250, 204, 21, 0.12);
  background: color-mix(in srgb, var(--badge-color, #facc15) 12%, transparent);
}

.ui-modal__badgeDesc {
  font-size: 14px;
  line-height: 1.4;
  color: var(--app-muted);
  margin-bottom: 14px;
}

.ui-modal__badgeStatus {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}

.ui-modal--badge .ui-modal__actions {
  justify-content: center;
}

/* ============================================================
   Avatar Detail Modal (ui-modal--avatarDetail)
============================================================ */

.ui-modal--avatarDetail .ui-modal__card {
  text-align: center;
  padding: 20px;
  max-width: 320px;
}

.ui-modal__avImgWrap {
  width: 180px;
  height: 180px;
  margin: 0 auto 14px;
  border-radius: 18px;
  overflow: hidden;
  border: 3px solid var(--av-color, var(--border));
  background: var(--ink-faint);
}

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

.ui-modal__avName {
  font-size: 22px;
  font-weight: 950;
  letter-spacing: 0.2px;
  line-height: 1.2;
  margin-bottom: 6px;
}

.ui-modal__avRarity {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.2px;
  color: var(--av-color, var(--ink-soft));
  background: rgba(0, 0, 0, 0.06);
  background: color-mix(in srgb, var(--av-color, var(--ink-soft)) 14%, transparent);
  border: 2px solid var(--av-color, var(--border));
  margin-bottom: 10px;
}

/* Stats row (power + price) */
.ui-modal__avStats {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 8px;
}

.ui-modal__avStat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.ui-modal__avStatLabel {
  font-size: 11px;
  color: var(--app-muted);
  font-weight: 800;
  letter-spacing: 0.2px;
}

.ui-modal__avStatValue {
  font-size: 18px;
  font-weight: 950;
  display: flex;
  align-items: center;
  gap: 4px;
}

.ui-modal__avModifier {
  font-size: 12px;
  color: var(--app-muted);
  font-weight: 700;
  margin-bottom: 6px;
}

.ui-modal--avatarDetail .ui-modal__actions {
  justify-content: center;
  gap: 10px;
}

/* Fullscreen toggle */
.ui-modal__avFullscreen {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 14px;
  z-index: 1;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border: none;
}

.ui-modal__avFullscreen:hover {
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
}

/* Fullscreen mode */
.ui-modal--avFull .ui-modal__card {
  max-width: calc(100vw - 36px);
  max-height: calc(100vh - 36px);
  width: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ui-modal--avFull .ui-modal__avImgWrap {
  width: min(85vw, 85vh);
  height: min(85vw, 85vh);
  margin-bottom: 10px;
  border-radius: 20px;
}

.ui-modal--avFull .ui-modal__avName,
.ui-modal--avFull .ui-modal__avRarity,
.ui-modal--avFull .ui-modal__avStats,
.ui-modal--avFull .ui-modal__avModifier,
.ui-modal--avFull .ui-modal__actions {
  display: none;
}

/* ============================================================
   Dashboard modal (shared by parent + teacher dashboards)
============================================================ */

.pd-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pd-modal:not([aria-hidden="false"]) {
  display: none;
}

.pd-modal__panel {
  position: relative;
  z-index: 10000;
  width: min(420px, 90vw);
  padding: 28px 24px;
  border-radius: var(--r-lg);
  background: var(--card-bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.pd-modal__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9999;
}

.pd-modal__title {
  font-weight: 950;
  margin-bottom: 10px;
  font-size: 18px;
}

.pd-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--ink);
  font-weight: 900;
}

.pd-input {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--app-fg);
  font-family: var(--font-kid);
  outline: none;
}

.pd-input:focus {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 4px var(--focus);
}

.pd-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.pd-err {
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(239, 68, 68, 0.22);
  background: rgba(239, 68, 68, 0.12);
  color: var(--ink);
  font-weight: 950;
  font-size: 13px;
}

.pd-warn {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(245, 158, 11, 0.22);
  background: rgba(245, 158, 11, 0.14);
  color: var(--ink);
  font-size: 13px;
  font-weight: 950;
}

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

.cr__toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 15px 0 14px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  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;
}

/* Infinite scroll sentinel: visually hidden but kept in layout so the
   IntersectionObserver has a box to watch. Larger bottom padding pushes
   the observer's prefetch zone into view a little earlier. */
.cr__more--invisible {
  opacity: 0;
  pointer-events: none;
  min-height: 1px;
  min-width: 0;
  padding: 0;
  border: 0;
  margin: 0;
}

/* Back-to-filters floating pill — appears once the toolbar scrolls off. */
.cr__toFilters {
  position: fixed;
  right: 16px;
  bottom: 84px; /* clear the kid/footer tab bar */
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 2px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.2px;
  font-family: inherit;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px) scale(0.95);
  pointer-events: none;
  transition: opacity 180ms ease-out, transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.cr__toFilters.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.cr__toFilters:hover {
  border-color: var(--ink);
  transform: translateY(-1px) scale(1);
}

.cr__toFilters i {
  font-size: 14px;
  color: var(--ink-soft);
}

/* 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;
}

/* OG rarity: silver/platinum for dark mode (must come after :root) */
[data-theme="dark"] {
  --br-c-og: rgba(220, 225, 240, 1);
  --br-bg-og: rgba(220, 225, 240, 0.08);
}

/* 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: 2px solid var(--rarity-accent);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 230px;
  background: var(--ink-faint);
  cursor: pointer;
}

/* 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: var(--ink-soft);
  text-shadow: 0 1px 0 var(--glass);
  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: rgba(0, 0, 0, 0.06);
  background: color-mix(in srgb, var(--rarity-accent) 18%, var(--card-bg));
  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: var(--ink);
}

/* 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: var(--shadow-sm);
}

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

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

.cr__viewToggle:hover,
.cr__viewToggle[data-view="compact"] {
  border-color: var(--border-strong);
  color: var(--ink);
}

/* ------------------------------------------------------------
   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: var(--ink-soft);
  font-size: 13px;
  padding: 0;
  border-radius: 50%;
  transition: color 0.12s, background 0.12s;
}

.cr__searchClear:hover {
  color: var(--ink);
  background: var(--ink-faint);
}

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

/* ------------------------------------------------------------
   Compact grid layout  (trade-card style)
------------------------------------------------------------ */

.cr__grid--compact {
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
}

.cr__grid--compact .crItem {
  min-height: 0;
  border-width: 2px;
  border-radius: 12px;
}

/* Hide power row — not needed in compact */
.cr__grid--compact .crItem__power {
  display: none;
}

/* Body: tight, centered, trade-card feel */
.cr__grid--compact .crItem__body {
  padding: 6px 6px 8px;
  gap: 2px;
  text-align: center;
}

/* Name: trade-card style */
.cr__grid--compact .crItem__name {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}

/* Rarity: plain text, no pill */
.cr__grid--compact .crItem__rarityLine {
  display: block;
}

.cr__grid--compact .crItem__rarityText {
  display: inline;
  padding: 0;
  border: none;
  border-radius: 0;
  background: none;
  font-size: 10px;
  font-weight: 600;
  opacity: 0.55;
  color: inherit;
  letter-spacing: 0;
}

/* Meta row: thin border-top separator, centered */
.cr__grid--compact .crItem__meta {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 6px;
}

/* When price is present (store), spread evenly */
.cr__grid--compact .crItem__meta:has(.crItem__price) {
  justify-content: space-around;
}

/* Price: small inline text */
.cr__grid--compact .crItem__price {
  min-height: 0;
  gap: 3px;
  align-items: center;
}

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

.cr__grid--compact .crItem__priceUnit {
  font-size: 10px;
  opacity: 0.55;
}

/* Actions: styled text links, not buttons */
.cr__grid--compact .crItem__actions .crAction {
  all: unset;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent, #22d3ff);
  white-space: nowrap;
  transition: opacity 0.12s;
}

.cr__grid--compact .crItem__actions .crAction:hover {
  opacity: 0.7;
}

.cr__grid--compact .crItem__actions .crAction:disabled {
  cursor: default;
  color: inherit;
  opacity: 0.4;
}

/* ============================================================
   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: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

/* 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: var(--surface);
}

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

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

/* Chips row — single row of stat chips */
.ui-modal--gameComplete .ui-modal__chips {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.ui-modal--gameComplete .ui-modal__chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1 1 0;
  min-width: 0;

  padding: 8px 8px;
  border-radius: 12px;
  text-align: center;

  background: var(--surface);
  border: 1.5px solid var(--border);
}

.ui-modal--gameComplete .ui-modal__chipLabel {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--ink-soft);
}

.ui-modal--gameComplete .ui-modal__chipRow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.ui-modal--gameComplete .ui-modal__chipIcon {
  font-size: 14px;
}

.ui-modal--gameComplete .ui-modal__chipValue {
  font-size: 15px;
  font-weight: 950;
  color: var(--ink);
}

/* Time chip — black border + icon */
.ui-modal--gameComplete .ui-modal__chip--time {
  border-color: var(--border-strong);
}

.ui-modal--gameComplete .ui-modal__chip--time .ui-modal__chipIcon {
  color: var(--ink-soft);
}

/* GoldRot chip — gold border + icon, black value */
.ui-modal--gameComplete .ui-modal__chip--goldrot {
  border-color: var(--gold);
}

.ui-modal--gameComplete .ui-modal__chip--goldrot .ui-modal__chipIcon {
  color: var(--gold);
}

/* Level chip — purple border + icon */
.ui-modal--gameComplete .ui-modal__chip--level {
  border-color: #7c3aed;
}

.ui-modal--gameComplete .ui-modal__chip--level .ui-modal__chipIcon {
  color: #7c3aed;
}

.ui-modal--gameComplete .ui-modal__chip--level .ui-modal__chipValue {
  color: #7c3aed;
}

/* 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 var(--border);
  background: var(--surface-2);
  font-size: 14px;
  font-weight: 900;
  color: var(--ink);
}

/* Actions: side-by-side buttons */
.ui-modal--gameComplete .ui-modal__actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
}

.ui-modal--gameComplete .ui-modal__actions .ui-btn {
  flex: 1 1 0;
  min-height: 46px;
  border-radius: 14px;
  font-size: 14px;
}

/* ============================================================
   DARK MODE — game-complete card
   Auto-applied via data-theme="dark" (no manual class needed)
============================================================ */

[data-theme="dark"] .ui-modal--gameComplete .ui-modal__card {
  background: #1e222c;
  color: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .ui-modal--gameComplete .ui-modal__title {
  color: rgba(255, 255, 255, 0.92);
}

[data-theme="dark"] .ui-modal--gameComplete .ui-modal__chip {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .ui-modal--gameComplete .ui-modal__chipLabel {
  color: rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] .ui-modal--gameComplete .ui-modal__chipValue {
  color: rgba(255, 255, 255, 0.92);
}

[data-theme="dark"] .ui-modal--gameComplete .ui-modal__chip--time {
  border-color: rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .ui-modal--gameComplete .ui-modal__chip--time .ui-modal__chipIcon {
  color: rgba(255, 255, 255, 0.7);
}

[data-theme="dark"] .ui-modal--gameComplete .ui-modal__chip--goldrot {
  border-color: #f5c842;
}

.ui-modal--gameComplete.ui-modal--theme-night .ui-modal__chip--goldrot .ui-modal__chipIcon {
  color: #f5c842;
}

.ui-modal--gameComplete.ui-modal--theme-night .ui-modal__chip--level {
  border-color: #a78bfa;
}

.ui-modal--gameComplete.ui-modal--theme-night .ui-modal__chip--level .ui-modal__chipIcon,
.ui-modal--gameComplete.ui-modal--theme-night .ui-modal__chip--level .ui-modal__chipValue {
  color: #a78bfa;
}

.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__actions .ui-btn {
    min-height: 42px;
  }
}

/* GoldRot dropdown */
.app-grwrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.app-grbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 8px 10px;
  font-family: inherit;
  font-weight: 900;
  font-size: 13px;
  line-height: 1;
  color: inherit;
  position: relative;
  transition: color 0.15s;
}

.app-grbtn:hover {
  color: var(--ink-soft);
}

.app-grbadge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 10px;
  line-height: 16px;
  pointer-events: none;
}

.app-grcaret {
  font-size: 10px;
  opacity: 0.5;
  transition: transform 120ms ease;
}

.app-grbtn[aria-expanded="true"] .app-grcaret {
  transform: rotate(180deg);
}

.app-grmenu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  min-width: 200px;
  padding: 6px;
  background: var(--glass-strong);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px);
  transform-origin: top right;
  animation: grMenuIn 120ms ease-out;
}

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

.app-grmenu__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--card-fg);
  text-decoration: none;
  transition: background 100ms ease;
}

.app-grmenu__item:hover {
  background: var(--ink-faint);
}

.app-grmenu__item i {
  width: 16px;
  text-align: center;
  opacity: 0.55;
}

/* =========================
   "How it works" dropdown
========================= */
/* =========================
   Audience picker dropdown ("I'm a…") — logged-out header nav.
   Renamed from the old .app-how* classes but structurally identical:
   single button that opens a small menu with Parent / Teacher links.
========================= */
.app-iamNav {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.app-iamNav__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 900;
  color: var(--ink);
  padding: 8px 10px;
  line-height: 1;
  white-space: nowrap;
  transition: color 0.15s;
}

.app-iamNav__btn:hover {
  color: var(--ink-soft);
}

.app-iamNav__caret {
  font-size: 10px;
  opacity: 0.5;
  transition: transform 120ms ease;
}

.app-iamNav__btn[aria-expanded="true"] .app-iamNav__caret {
  transform: rotate(180deg);
}

.app-iamNav__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  min-width: 180px;
  padding: 6px;
  background: var(--glass-strong);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px);
  transform-origin: top right;
  animation: grMenuIn 120ms ease-out;
}

.app-iamNav__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--card-fg);
  text-decoration: none;
  transition: background 100ms ease;
}

.app-iamNav__item:hover {
  background: var(--ink-faint);
}

.app-iamNav__item i {
  width: 16px;
  text-align: center;
  opacity: 0.55;
}

/* =========================
   Header Google button
========================= */
.app-btn--google {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.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 var(--border);
}

.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: var(--ink-faint);
}

.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;
}

/* ============================================================
   Utility: coin/gold color (used across many views)
============================================================ */
.icon-gold {
  color: var(--gold);
}

/* ============================================================
   Site-wide bottom toast — hosts cookie consent and (on landing
   pages) the audience switcher. Two sections, side by side on
   desktop, stacked on mobile. Each dismisses independently.
============================================================ */
.lp3-bottomToast {
  position: fixed;
  bottom: 14px;
  right: 14px;
  z-index: 90;
  display: flex;
  align-items: stretch;
  max-width: 580px;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, rgba(11, 18, 32, 0.12));
  border-radius: 14px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  transform: translateY(calc(100% + 40px));
  opacity: 0;
  transition:
    transform 340ms cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 240ms ease;
  font-family: var(--font-kid, system-ui, sans-serif);
  color: var(--app-fg, #0b1220);
}

.lp3-bottomToast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.lp3-bottomToast__section {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  min-width: 0;
  transition: opacity 220ms ease, transform 220ms ease;
}

.lp3-bottomToast__section.is-leaving {
  opacity: 0;
  transform: translateY(6px);
}

.lp3-bottomToast__section--cookie + .lp3-bottomToast__section--audience {
  border-left: 1px solid var(--border, rgba(11, 18, 32, 0.08));
}

.lp3-bottomToast__icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}

.lp3-bottomToast__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
  gap: 1px;
}

.lp3-bottomToast__text strong {
  font-weight: 800;
  font-size: 13px;
  letter-spacing: -0.1px;
}

.lp3-bottomToast__text span {
  font-size: 11.5px;
  opacity: 0.7;
}

.lp3-bottomToast__inlineLink {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.lp3-bottomToast__btns {
  display: flex;
  gap: 6px;
  margin-left: 4px;
  flex-shrink: 0;
}

.lp3-bottomToast__btn {
  appearance: none;
  border: 1px solid var(--border, rgba(11, 18, 32, 0.18));
  background: var(--surface-2, #f4f4f7);
  color: inherit;
  font-family: inherit;
  font-weight: 700;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 80ms ease;
}

.lp3-bottomToast__btn:hover {
  background: var(--surface, #ffffff);
  border-color: var(--app-fg, #0b1220);
}

.lp3-bottomToast__btn:active {
  transform: scale(0.96);
}

.lp3-bottomToast__btn--accept {
  background: var(--app-fg, #0b1220);
  color: var(--surface, #ffffff);
  border-color: var(--app-fg, #0b1220);
}

.lp3-bottomToast__btn--accept:hover {
  background: #000;
  border-color: #000;
  color: #fff;
}

.lp3-bottomToast__link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
  flex: 1;
}

.lp3-bottomToast__arrow {
  font-size: 11px;
  opacity: 0.55;
  margin-left: 2px;
  flex-shrink: 0;
}

.lp3-bottomToast__close {
  appearance: none;
  border: none;
  background: transparent;
  color: inherit;
  font-family: inherit;
  padding: 0 10px;
  cursor: pointer;
  opacity: 0.5;
  font-size: 13px;
  border-left: 1px solid var(--border, rgba(11, 18, 32, 0.08));
  transition: opacity 160ms ease, background 160ms ease;
}

.lp3-bottomToast__close:hover {
  opacity: 1;
  background: var(--surface-2, #f4f4f7);
}

@media (max-width: 540px) {
  .lp3-bottomToast {
    flex-direction: column;
    bottom: 14px;
    left: 14px;
    right: 14px;
    max-width: none;
    transform: translateY(calc(100% + 40px));
  }
  .lp3-bottomToast.is-visible {
    transform: translateY(0);
  }
  .lp3-bottomToast__section--cookie + .lp3-bottomToast__section--audience {
    border-left: none;
    border-top: 1px solid var(--border, rgba(11, 18, 32, 0.08));
  }
  .lp3-bottomToast__btns {
    margin-left: auto;
  }
}
