/* RollBounce meta screens: Garage (cosmetics) and Leaderboards.
   A DOM overlay above the Unity canvas. Everything is sized in rem/vw so the
   same markup holds on a 1920 desktop and a 390 phone. */

#rb-meta {
  --ink: #06040f;
  --panel: rgba(10, 6, 28, 0.72);
  --panel-2: rgba(16, 10, 40, 0.82);
  --line: rgba(120, 200, 255, 0.28);
  --line-hot: rgba(0, 240, 255, 0.85);
  --cyan: #19e8ff;
  --cyan-soft: #8af4ff;
  --magenta: #ff2ee6;
  --magenta-soft: #ff8cf3;
  --violet: #7a3cff;
  --gold: #ffc63d;
  --text: #f4f6ff;
  --muted: #9aa6c8;
  --ok: #5cffb0;
  --bad: #ff5c7a;
  --font-display: "Exo 2", "Segoe UI", system-ui, sans-serif;
  --font-ui: "Rajdhani", "Segoe UI", system-ui, sans-serif;

  position: fixed; inset: 0; z-index: 60;
  display: none;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.25;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
#rb-meta.open { display: block; }
#rb-meta *, #rb-meta *::before, #rb-meta *::after { box-sizing: border-box; }
/* Resets at element specificity (:where zeroes the id) so every class rule below wins. */
:where(#rb-meta) button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
:where(#rb-meta) button:focus-visible, :where(#rb-meta) input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
:where(#rb-meta) img { display: block; max-width: 100%; }
:where(#rb-meta) input { font: inherit; color: var(--text); }
:where(#rb-meta) svg { flex: none; }

/* ---- backdrop ---------------------------------------------------------------------- */
.rb-bg {
  position: absolute; inset: 0; overflow: hidden; background: var(--ink);
}
.rb-bg::before {
  content: ""; position: absolute; inset: -4%;
  background: url("meta/bg.webp") center 40% / cover no-repeat;
  filter: saturate(1.25) brightness(0.62) blur(1.5px);
  transform: scale(1.04);
  animation: rb-drift 40s ease-in-out infinite alternate;
}
.rb-bg::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(120% 70% at 50% 100%, rgba(255, 46, 230, 0.22), transparent 60%),
    radial-gradient(90% 60% at 50% 0%, rgba(25, 232, 255, 0.12), transparent 60%),
    linear-gradient(180deg, rgba(6, 4, 15, 0.55), rgba(6, 4, 15, 0.25) 40%, rgba(6, 4, 15, 0.75));
}
.rb-bg .rb-grid {
  position: absolute; left: -20%; right: -20%; bottom: -10%; height: 55%;
  background-image:
    linear-gradient(rgba(25, 232, 255, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 46, 230, 0.14) 1px, transparent 1px);
  background-size: 64px 64px, 64px 64px;
  transform: perspective(600px) rotateX(62deg);
  transform-origin: 50% 100%;
  mask-image: linear-gradient(180deg, transparent, #000 40%, #000);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 40%, #000);
  animation: rb-grid 6s linear infinite;
  opacity: 0.7;
}
.rb-bg .rb-scan {
  position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(180deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}
@keyframes rb-drift { from { transform: scale(1.04) translateX(-1%); } to { transform: scale(1.08) translateX(1%); } }
@keyframes rb-grid { from { background-position: 0 0, 0 0; } to { background-position: 0 64px, 0 0; } }
@media (prefers-reduced-motion: reduce) {
  #rb-meta * { animation: none !important; transition: none !important; }
}

/* ---- shell ---------------------------------------------------------------------------- */
.rb-shell {
  position: absolute; inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: clamp(8px, 1.2vh, 14px);
  padding: clamp(8px, 1.4vw, 18px);
  padding-bottom: 0;
}
.rb-top {
  display: grid; grid-template-columns: minmax(230px, 320px) 1fr minmax(120px, 320px);
  align-items: start; gap: 12px; min-height: 96px;
}

/* Angled panels: the game's UI language. */
.rb-panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.rb-panel::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(135deg, rgba(25, 232, 255, 0.10), transparent 35%, transparent 70%, rgba(255, 46, 230, 0.10));
}
.rb-panel.hot { border-color: var(--line-hot); box-shadow: 0 0 24px rgba(25, 232, 255, 0.18), inset 0 0 24px rgba(25, 232, 255, 0.06); }

/* player card */
.rb-player { display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 12px 14px 10px; }
.rb-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #2a1a55, #05030d 70%);
  box-shadow: 0 0 0 2px rgba(25, 232, 255, 0.6), 0 0 18px rgba(25, 232, 255, 0.45);
  overflow: hidden;
}
.rb-avatar img { width: 100%; height: 100%; object-fit: cover; }
.rb-name-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rb-name {
  font-family: var(--font-display); font-weight: 800; font-style: italic; font-size: 22px; letter-spacing: 0.02em;
  text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.rb-name-btn { display: inline-flex; align-items: center; gap: 6px; min-width: 0; text-align: left; }
.rb-name-btn svg { flex: none; width: 14px; height: 14px; opacity: 0.6; }
.rb-name-btn:hover svg { opacity: 1; }
.rb-name-input {
  width: 100%; background: rgba(0,0,0,0.4); border: 1px solid var(--line-hot); padding: 2px 8px;
  font-family: var(--font-display); font-weight: 800; font-style: italic; font-size: 20px; text-transform: uppercase;
}
.rb-title-line { color: var(--cyan); font-weight: 600; font-size: 15px; letter-spacing: 0.06em; text-transform: uppercase; }
.rb-xp { height: 5px; margin-top: 6px; background: rgba(255,255,255,0.12); position: relative; }
.rb-xp i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, var(--cyan), var(--magenta)); box-shadow: 0 0 10px var(--cyan); }
.rb-wallet { grid-column: 1 / -1; display: flex; gap: 8px; margin-top: 2px; }
.rb-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px 5px 8px;
  background: rgba(0,0,0,0.35); border: 1px solid rgba(255,255,255,0.14);
  font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: 0.02em;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}
.rb-pill svg { width: 20px; height: 20px; }
.rb-pill.coins { color: #ffe08a; }
.rb-pill.coins .unit { font-size: 12px; letter-spacing: 0.16em; color: var(--muted); margin-left: 2px; }
.rb-pill.code { color: var(--cyan-soft); font-size: 14px; letter-spacing: 0.08em; }
.rb-sub { font-size: 13px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; margin: 6px 0 0 4px; }

/* wordmark + screen title */
.rb-heading { text-align: center; padding-top: 2px; }
.rb-wordmark {
  font-family: var(--font-display); font-weight: 800; font-style: italic; text-transform: uppercase;
  font-size: clamp(22px, 3vw, 38px); line-height: 0.95; letter-spacing: -0.01em;
  background: linear-gradient(180deg, #fff 0%, #9af6ff 45%, #ff2ee6 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 14px rgba(255, 46, 230, 0.55)) drop-shadow(0 2px 0 rgba(0,0,0,0.6));
}
.rb-screen-title {
  font-family: var(--font-display); font-weight: 800; font-style: italic; text-transform: uppercase;
  font-size: clamp(26px, 4.2vw, 56px); line-height: 1; letter-spacing: 0.06em; margin-top: 4px;
  color: #fff;
  text-shadow: 0 0 18px rgba(25, 232, 255, 0.9), 0 0 40px rgba(255, 46, 230, 0.6), 0 3px 0 rgba(0,0,0,0.7);
}
.rb-screen-sub { color: var(--cyan); font-weight: 700; letter-spacing: 0.32em; text-transform: uppercase; font-size: 13px; margin-top: 6px; }
.rb-screen-sub::before, .rb-screen-sub::after { content: "———"; opacity: 0.5; margin: 0 8px; letter-spacing: -0.1em; }

/* top-right actions */
.rb-actions { display: flex; justify-content: flex-end; gap: 10px; }
.rb-icon-btn {
  width: 54px; height: 54px; display: grid; place-items: center;
  background: var(--panel); border: 1px solid var(--line);
  clip-path: polygon(12px 0, calc(100% - 12px) 0, 100% 12px, 100% calc(100% - 12px), calc(100% - 12px) 100%, 12px 100%, 0 calc(100% - 12px), 0 12px);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.rb-icon-btn svg { width: 24px; height: 24px; }
.rb-icon-btn:hover { border-color: var(--line-hot); box-shadow: 0 0 18px rgba(25, 232, 255, 0.35); transform: translateY(-1px); }
.rb-icon-btn.magenta:hover { border-color: var(--magenta); box-shadow: 0 0 18px rgba(255, 46, 230, 0.4); }

/* ---- main --------------------------------------------------------------------------- */
.rb-main { min-height: 0; position: relative; }
.rb-screen { position: absolute; inset: 0; display: none; min-height: 0; }
.rb-screen.active { display: grid; }

/* ---- garage ------------------------------------------------------------------------- */
.rb-garage {
  grid-template-columns: minmax(200px, 250px) minmax(0, 1fr) minmax(260px, 360px);
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
}
.rb-garage > * { min-height: 0; min-width: 0; }
.rb-cats { padding: 8px 0; align-self: start; }
.rb-cat {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 16px;
  font-weight: 700; font-size: 17px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  border-left: 3px solid transparent; transition: background 0.12s, color 0.12s;
}
.rb-cat svg { width: 22px; height: 22px; }
.rb-cat:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.rb-cat.active { color: #fff; background: linear-gradient(90deg, rgba(255, 46, 230, 0.55), rgba(255, 46, 230, 0.08)); border-left-color: var(--magenta); text-shadow: 0 0 10px rgba(255, 46, 230, 0.8); }
.rb-cat.soon { opacity: 0.45; }
.rb-cat .tag { margin-left: auto; font-size: 11px; letter-spacing: 0.2em; color: var(--cyan); border: 1px solid var(--line); padding: 2px 6px; }

.rb-stage { position: relative; display: grid; grid-template-rows: 1fr auto; min-height: 0; }
.rb-stage-view { position: relative; min-height: 0; overflow: hidden; }
.rb-hero {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 4% 10% 10%;
  /* Explicit tracks: an implicit auto row would size to the render's 1000 px and blow the ball up. */
  grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr);
}
.rb-hero img {
  max-height: 100%; max-width: 100%; width: auto; height: 100%; min-height: 0; object-fit: contain;
  /* The renders carry their own dark scene: fade the edges so the ball and its
     light sit on the stage instead of a rectangle sitting on the stage. */
  mask-image: radial-gradient(ellipse 66% 62% at 50% 50%, #000 58%, rgba(0,0,0,0.55) 80%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 66% 62% at 50% 50%, #000 58%, rgba(0,0,0,0.55) 80%, transparent 100%);
  filter: saturate(1.1) contrast(1.05);
  animation: rb-float 5s ease-in-out infinite;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.rb-hero::after {
  content: ""; position: absolute; left: 50%; top: 52%; width: 48%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 120px 30px rgba(255, 46, 230, 0.18), 0 0 220px 80px rgba(25, 232, 255, 0.10);
}
.rb-hero.switching img { opacity: 0; transform: scale(0.96); }
.rb-hero.trail img { animation: none; }
@keyframes rb-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.4%); } }
.rb-pedestal {
  position: absolute; left: 50%; bottom: 6%; width: 62%; height: 18%; transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(255, 46, 230, 0.55), rgba(122, 60, 255, 0.35) 40%, transparent 70%);
  box-shadow: 0 0 60px rgba(255, 46, 230, 0.35);
  filter: blur(2px);
}
.rb-pedestal::before, .rb-pedestal::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(25, 232, 255, 0.7);
  animation: rb-ring 3s ease-out infinite;
}
.rb-pedestal::after { animation-delay: 1.5s; }
@keyframes rb-ring { from { transform: scale(0.55); opacity: 0.9; } to { transform: scale(1.15); opacity: 0; } }
.rb-rarity-tag {
  position: absolute; top: 14px; left: 14px; z-index: 2;
  padding: 5px 12px; font-weight: 700; letter-spacing: 0.2em; font-size: 13px; text-transform: uppercase;
  border: 1px solid currentColor; background: rgba(0,0,0,0.45);
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}
.rb-owned-tag { position: absolute; top: 14px; right: 14px; z-index: 2; color: var(--ok); font-weight: 700; letter-spacing: 0.2em; font-size: 13px; text-transform: uppercase; }
.rb-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 48px; height: 64px; display: grid; place-items: center; color: var(--cyan);
  opacity: 0.8; transition: opacity 0.12s, transform 0.12s;
}
.rb-arrow svg { width: 28px; height: 28px; filter: drop-shadow(0 0 8px rgba(25,232,255,0.9)); }
.rb-arrow:hover { opacity: 1; transform: translateY(-50%) scale(1.1); }
.rb-arrow.prev { left: 6px; } .rb-arrow.next { right: 6px; }
.rb-dots { display: flex; justify-content: center; gap: 8px; padding: 8px 0 10px; }
.rb-dots i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,0.25); transition: background 0.12s, transform 0.12s; }
.rb-dots i.on { background: #fff; box-shadow: 0 0 10px #fff; transform: scale(1.2); }
.rb-trail-preview { position: absolute; inset: 0; display: grid; place-items: center; }
.rb-trail-preview canvas { width: 92%; height: 70%; }

.rb-detail { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; align-self: start; }
.rb-detail > * { flex: none; }   /* a scrolling column must not squash its rows into each other */
.rb-item-name { font-family: var(--font-display); font-weight: 800; font-size: clamp(22px, 2vw, 30px); text-transform: uppercase; letter-spacing: 0.02em; line-height: 1.05; }
.rb-item-kind { font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; font-size: 14px; color: var(--muted); }
.rb-item-kind b { color: inherit; }
.rb-blurb { color: #c9d0ea; font-size: 15.5px; line-height: 1.45; min-height: 3.6em; }
.rb-prices { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rb-or { color: var(--muted); font-size: 13px; letter-spacing: 0.2em; }
.rb-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 22px; width: 100%;
  font-family: var(--font-display); font-weight: 800; font-size: 19px; letter-spacing: 0.12em; text-transform: uppercase;
  border: 1px solid transparent;
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  transition: transform 0.1s ease, filter 0.1s ease, box-shadow 0.1s ease;
}
.rb-btn svg { width: 22px; height: 22px; }
.rb-btn:active { transform: translateY(1px) scale(0.99); }
.rb-btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.rb-btn.primary { background: linear-gradient(90deg, #ff2ee6, #b21bff); color: #fff; box-shadow: 0 0 22px rgba(255, 46, 230, 0.5); text-shadow: 0 1px 0 rgba(0,0,0,0.4); }
.rb-btn.primary:hover:not([disabled]) { filter: brightness(1.12); box-shadow: 0 0 30px rgba(255, 46, 230, 0.75); }
.rb-btn.cyan { background: rgba(25, 232, 255, 0.08); border-color: var(--cyan); color: var(--cyan); box-shadow: 0 0 16px rgba(25, 232, 255, 0.25) inset; }
.rb-btn.cyan:hover:not([disabled]) { background: rgba(25, 232, 255, 0.18); box-shadow: 0 0 18px rgba(25, 232, 255, 0.45); }
.rb-btn.ghost { border-color: rgba(255,255,255,0.25); color: var(--text); }
.rb-btn.ghost:hover:not([disabled]) { border-color: #fff; }
.rb-btn.equipped { background: rgba(92, 255, 176, 0.12); border-color: var(--ok); color: var(--ok); }
.rb-btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rb-btn.sm { min-height: 42px; font-size: 15px; padding: 0 12px; }
.rb-hint { font-size: 13px; color: var(--muted); }

.rb-rail { grid-column: 1 / -1; position: relative; }
.rb-rail-scroll {
  display: flex; gap: 12px; overflow-x: auto; padding: 6px 4px 10px; scroll-snap-type: x proximity; scrollbar-width: none;
}
.rb-rail-scroll::-webkit-scrollbar { display: none; }
.rb-card {
  flex: 0 0 158px; scroll-snap-align: start;
  display: grid; grid-template-rows: 96px auto auto auto; justify-items: center; gap: 4px;
  padding: 10px 10px 12px; text-align: center;
  background: var(--panel-2); border: 1px solid var(--line);
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.rb-card:hover { transform: translateY(-3px); border-color: var(--cyan); }
.rb-card.active { border-color: var(--magenta); box-shadow: 0 0 22px rgba(255, 46, 230, 0.45); }
.rb-card .thumb { width: 92px; height: 92px; border-radius: 50%; object-fit: cover; filter: drop-shadow(0 8px 14px rgba(0,0,0,0.6)); }
.rb-card .thumb.trail { border-radius: 8px; width: 120px; height: 60px; object-fit: fill; }
.rb-card .nm { font-family: var(--font-display); font-weight: 800; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; line-height: 1.1; }
.rb-card .rr { font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; font-weight: 700; }
.rb-card .pr { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; font-size: 14px; color: #ffe08a; }
.rb-card .pr svg { width: 16px; height: 16px; }
.rb-card .pr.owned { color: var(--ok); }
.rb-card .pr.premium { color: var(--cyan-soft); }
.rb-card .eq { position: absolute; top: 8px; right: 10px; font-size: 10px; letter-spacing: 0.2em; color: var(--ok); }
.rb-card { position: relative; }

/* ---- leaderboards ---------------------------------------------------------------------- */
.rb-boards { grid-template-columns: minmax(0, 1fr) minmax(240px, 300px); grid-template-rows: auto minmax(0, 1fr); gap: 12px; }
.rb-boards > * { min-height: 0; min-width: 0; }
.rb-tabs { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.rb-tab {
  min-width: 140px; padding: 10px 22px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; font-size: 15px;
  color: var(--cyan-soft); background: var(--panel); border: 1px solid var(--line);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}
.rb-tab.active { color: #fff; background: linear-gradient(90deg, rgba(255, 46, 230, 0.65), rgba(122, 60, 255, 0.55)); border-color: var(--magenta); box-shadow: 0 0 20px rgba(255, 46, 230, 0.45); }
.rb-board { display: grid; grid-template-rows: auto auto 1fr auto; min-height: 0; }
.rb-board-meta {
  display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; padding: 10px 14px;
  border-bottom: 1px solid var(--line); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; font-size: 13px; color: var(--muted);
}
.rb-board-meta b { color: var(--magenta-soft); }
.rb-board-meta em { color: var(--cyan); font-style: normal; }
.rb-podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 10px; align-items: end; padding: 16px 16px 8px; }
.rb-pod {
  position: relative; text-align: center; padding: 30px 10px 14px;
  background: var(--panel-2); border: 1px solid var(--line);
  clip-path: polygon(14px 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%, 0 14px);
}
.rb-pod.first { padding-top: 40px; border-color: var(--gold); box-shadow: 0 0 26px rgba(255, 198, 61, 0.35); }
.rb-pod.second { border-color: var(--cyan); box-shadow: 0 0 18px rgba(25, 232, 255, 0.25); }
.rb-pod.third { border-color: var(--magenta); box-shadow: 0 0 18px rgba(255, 46, 230, 0.25); }
.rb-pod .num {
  position: absolute; top: 10px; left: 10px; width: 30px; height: 34px; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 16px;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: var(--cyan); color: #06040f;
}
.rb-pod.first .num { background: var(--gold); } .rb-pod.third .num { background: var(--magenta); }
.rb-pod .crown { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); width: 40px; height: 32px; color: var(--gold); filter: drop-shadow(0 0 10px rgba(255,198,61,0.9)); }
.rb-pod .av { width: 74px; height: 74px; margin: 0 auto 10px; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 2px rgba(255,255,255,0.7), 0 0 18px rgba(25,232,255,0.5); background: #10082a; }
.rb-pod.first .av { width: 90px; height: 90px; }
.rb-pod .av img { width: 100%; height: 100%; object-fit: cover; }
.rb-pod .nm { font-family: var(--font-display); font-weight: 800; text-transform: uppercase; font-size: 18px; letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rb-pod .sc { font-family: var(--font-display); font-weight: 700; font-size: 20px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.rb-pod.first .sc { color: var(--gold); } .rb-pod.second .sc { color: var(--cyan); } .rb-pod.third .sc { color: var(--magenta-soft); }
.rb-pod.empty { opacity: 0.35; }
.rb-table-wrap { min-height: 0; overflow-y: auto; padding: 0 12px; scrollbar-width: thin; scrollbar-color: rgba(25,232,255,0.4) transparent; }
.rb-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.rb-table th { text-align: left; font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 10px 8px 6px; border-bottom: 1px solid rgba(255,255,255,0.08); position: sticky; top: 0; background: rgba(10, 6, 28, 0.9); }
.rb-table td { padding: 8px; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 17px; font-weight: 600; }
.rb-table td.rank { color: var(--magenta-soft); font-family: var(--font-display); font-weight: 800; width: 56px; }
.rb-table td.score, .rb-table th.score, .rb-table td.games, .rb-table th.games { text-align: right; }
.rb-table td.games { color: var(--muted); width: 90px; }
.rb-table .pl { display: flex; align-items: center; gap: 10px; text-transform: uppercase; letter-spacing: 0.04em; }
.rb-table .pl img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 1px rgba(255,255,255,0.4); }
.rb-table tr.you td { background: linear-gradient(90deg, rgba(255, 46, 230, 0.28), rgba(255, 46, 230, 0.06)); color: #fff; }
.rb-table tr.you td.rank { color: #fff; }
.rb-table td.badge { width: 40px; text-align: center; color: var(--magenta-soft); }
.rb-table td.badge svg { width: 18px; height: 18px; }
.rb-me-row { border-top: 1px solid var(--magenta); padding: 6px 12px 8px; }
.rb-me-row table { width: 100%; border-collapse: collapse; }
.rb-me-row td { padding: 8px; font-size: 18px; font-weight: 700; background: linear-gradient(90deg, rgba(255, 46, 230, 0.35), rgba(255, 46, 230, 0.08)); }
.rb-empty { padding: 40px 16px; text-align: center; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700; }
.rb-side { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; scrollbar-width: none; }
.rb-side-panel { padding: 14px 16px; }
.rb-side-panel h4 { margin: 0 0 8px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; font-size: 13px; color: var(--cyan); }
.rb-big { font-family: var(--font-display); font-weight: 800; font-size: 28px; font-variant-numeric: tabular-nums; line-height: 1; }
.rb-kv { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin-top: 8px; }
.rb-kv .k { font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
.rb-kv .v { font-family: var(--font-display); font-weight: 800; font-size: 22px; color: var(--magenta-soft); font-variant-numeric: tabular-nums; }
.rb-kv .v.cyan { color: var(--cyan); }
.rb-side .rb-avatar { width: 72px; height: 72px; float: right; margin: -6px 0 0 8px; }
.rb-friend-add { display: flex; gap: 6px; margin-top: 8px; }
.rb-friend-add input {
  flex: 1; min-width: 0; background: rgba(0,0,0,0.4); border: 1px solid var(--line); padding: 8px 10px;
  letter-spacing: 0.18em; text-transform: uppercase; font-weight: 700;
}
.rb-friend-add input::placeholder { color: rgba(255,255,255,0.35); letter-spacing: 0.1em; }
.rb-friends-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 120px; overflow-y: auto; }
.rb-friends-list li { display: flex; justify-content: space-between; font-weight: 600; text-transform: uppercase; font-size: 14px; }
.rb-friends-list li span { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---- currency ------------------------------------------------------------------------------ */
.rb-coin { width: 20px; height: 20px; object-fit: contain; filter: drop-shadow(0 0 4px rgba(255, 198, 61, 0.55)); vertical-align: middle; }
.rb-coin.lg { width: 28px; height: 28px; }
.rb-pill .rb-coin { width: 22px; height: 22px; }
.rb-card .pr .rb-coin { width: 16px; height: 16px; }

/* ---- missions -------------------------------------------------------------------------------- */
.rb-missions { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); gap: 12px; }
.rb-missions-head { display: grid; grid-template-columns: repeat(3, auto) 1fr; gap: 24px; align-items: center; padding: 14px 20px; }
.rb-missions-head .k { font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.rb-missions-head .v { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 800; font-size: 26px; font-variant-numeric: tabular-nums; }
.rb-missions-head .v.gold { color: #ffe08a; text-shadow: 0 0 14px rgba(255, 198, 61, 0.5); }
.rb-missions-head .rb-hint { justify-self: end; text-align: right; max-width: 320px; }
.rb-mission-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; overflow-y: auto; min-height: 0; padding: 2px 4px 8px; scrollbar-width: thin; scrollbar-color: rgba(25,232,255,0.4) transparent; align-content: start; }
.rb-mission { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 18px 14px 16px; overflow: hidden; }
.rb-mission .body { min-width: 0; }
.rb-mission .ic { width: 56px; height: 56px; display: grid; place-items: center; color: var(--cyan); border: 1px solid var(--line); background: rgba(0,0,0,0.35); clip-path: polygon(25% 3%, 75% 3%, 100% 50%, 75% 97%, 25% 97%, 0 50%); }
.rb-mission .ic svg { width: 26px; height: 26px; }
.rb-mission .nm { font-family: var(--font-display); font-weight: 800; text-transform: uppercase; font-size: 17px; letter-spacing: 0.04em; }
.rb-mission .ds { color: #c9d0ea; font-size: 14px; margin-top: 2px; }
.rb-mission .bar { height: 6px; margin-top: 8px; background: rgba(255,255,255,0.12); position: relative; }
.rb-mission .bar i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, var(--cyan), var(--magenta)); box-shadow: 0 0 10px var(--cyan); }
.rb-mission .pr { display: flex; justify-content: space-between; margin-top: 6px; font-weight: 700; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
.rb-mission .rw { display: inline-flex; align-items: center; gap: 5px; color: #ffe08a; }
.rb-mission .rw .rb-coin { width: 16px; height: 16px; }
.rb-mission .state { font-family: var(--font-display); font-weight: 800; font-size: 15px; color: var(--muted); min-width: 56px; text-align: center; }
.rb-mission .state.done { color: var(--ok); display: inline-flex; align-items: center; gap: 4px; font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; }
.rb-mission .state.done svg { width: 16px; height: 16px; }
.rb-mission .claim { width: auto; min-width: 100px; }
.rb-mission.claimable { border-color: var(--gold); box-shadow: 0 0 22px rgba(255, 198, 61, 0.35); }
.rb-mission.claimable .ic { color: var(--gold); border-color: var(--gold); }
.rb-mission.claimable .bar i { background: linear-gradient(90deg, var(--gold), #fff2b0); box-shadow: 0 0 10px var(--gold); }
.rb-mission.claimed { opacity: 0.55; }
.rb-mission.claimed .ic { color: var(--ok); }

/* ---- bottom nav ---------------------------------------------------------------------- */
.rb-nav {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px;
  padding: 6px 0 max(10px, env(safe-area-inset-bottom)); max-width: 1100px; width: 100%; margin: 0 auto;
  position: relative;
}
.rb-nav::before {
  content: ""; position: absolute; left: -50vw; right: -50vw; top: -6px; bottom: 0; z-index: -1;
  background: linear-gradient(180deg, transparent, rgba(6, 4, 15, 0.85) 40%);
}
.rb-nav-btn {
  display: grid; grid-template-columns: 56px 1fr; align-items: center; gap: 12px; padding: 8px 14px; text-align: left;
  background: var(--panel); border: 1px solid var(--line);
  clip-path: polygon(16px 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%, 0 16px);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.rb-nav-btn .hex { width: 56px; height: 56px; display: grid; place-items: center; color: var(--cyan); border: 2px solid currentColor; clip-path: polygon(25% 3%, 75% 3%, 100% 50%, 75% 97%, 25% 97%, 0 50%); background: rgba(0,0,0,0.35); }
.rb-nav-btn .hex svg { width: 26px; height: 26px; }
.rb-nav-btn .t { font-family: var(--font-display); font-weight: 800; text-transform: uppercase; font-size: 19px; letter-spacing: 0.06em; }
.rb-nav-btn .s { color: var(--cyan); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; font-weight: 700; }
.rb-nav-btn.active { border-color: var(--magenta); box-shadow: 0 0 22px rgba(255, 46, 230, 0.45); }
.rb-nav-btn.active .hex { color: var(--magenta); box-shadow: 0 0 16px rgba(255, 46, 230, 0.6); }
.rb-nav-btn.active .s { color: var(--magenta-soft); }
.rb-nav-btn.soon { opacity: 0.5; cursor: default; }
.rb-nav-btn.soon .s { color: var(--muted); }

/* ---- rename dialog ------------------------------------------------------------------------- */
.rb-modal-back { position: absolute; inset: 0; z-index: 80; display: grid; place-items: center; background: rgba(4, 2, 12, 0.7); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); padding: 16px; }
.rb-modal { width: min(440px, 100%); padding: 22px 22px 18px; display: flex; flex-direction: column; gap: 12px; }
.rb-modal-title { font-family: var(--font-display); font-weight: 800; text-transform: uppercase; font-size: 24px; letter-spacing: 0.04em; }
.rb-modal-input {
  width: 100%; background: rgba(0,0,0,0.45); border: 1px solid var(--line-hot); padding: 12px 14px;
  font-family: var(--font-display); font-weight: 800; font-size: 24px; text-transform: uppercase; letter-spacing: 0.04em;
  box-shadow: 0 0 18px rgba(25, 232, 255, 0.25) inset;
}
.rb-modal-err { min-height: 1.2em; color: var(--bad); font-size: 13px; font-weight: 600; }
.rb-modal .rb-btn-row { grid-template-columns: 1fr 1fr; }

/* ---- toasts / modals ------------------------------------------------------------------- */
.rb-toasts { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.rb-toast {
  padding: 10px 18px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; font-size: 14px;
  background: rgba(10, 6, 28, 0.92); border: 1px solid var(--cyan); color: var(--cyan-soft); box-shadow: 0 0 22px rgba(25, 232, 255, 0.4);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  animation: rb-toast 0.25s ease-out;
}
.rb-toast.ok { border-color: var(--ok); color: var(--ok); box-shadow: 0 0 22px rgba(92, 255, 176, 0.4); }
.rb-toast.bad { border-color: var(--bad); color: #ffb3c0; box-shadow: 0 0 22px rgba(255, 92, 122, 0.4); }
.rb-toast.gold { border-color: var(--gold); color: #ffe08a; box-shadow: 0 0 22px rgba(255, 198, 61, 0.5); }
@keyframes rb-toast { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.rb-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--cyan); letter-spacing: 0.3em; text-transform: uppercase; font-weight: 700; font-size: 13px; }
.rb-loading::after { content: ""; width: 40px; height: 40px; margin-top: 14px; border: 2px solid rgba(25,232,255,0.2); border-top-color: var(--cyan); border-radius: 50%; animation: rb-spin 0.8s linear infinite; }
@keyframes rb-spin { to { transform: rotate(360deg); } }

/* ---- responsive ------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .rb-garage { grid-template-columns: 1fr minmax(240px, 320px); }
  .rb-cats { grid-column: 1 / -1; display: flex; gap: 6px; overflow-x: auto; padding: 4px; scrollbar-width: none; }
  .rb-cats .rb-cat { width: auto; white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; padding: 8px 12px; font-size: 14px; }
  .rb-cats .rb-cat.active { border-bottom-color: var(--magenta); background: rgba(255, 46, 230, 0.15); }
  .rb-garage { grid-template-rows: auto 1fr auto; }
}
/* Phones in either orientation: portrait by width, landscape by height. */
@media (max-width: 760px), (max-height: 520px) {
  #rb-meta { font-size: 15px; }
  .rb-shell { gap: 8px; padding: 8px; }
  .rb-top { grid-template-columns: 1fr auto; grid-template-rows: auto auto; min-height: 0; }
  .rb-heading { grid-column: 1 / -1; order: -1; }
  .rb-player { grid-template-columns: 48px 1fr; padding: 8px 10px; gap: 8px; }
  .rb-avatar { width: 48px; height: 48px; }
  .rb-name { font-size: 18px; }
  .rb-sub { display: none; }
  .rb-wallet { gap: 6px; }
  .rb-pill { font-size: 14px; padding: 4px 10px 4px 6px; }
  .rb-pill.code { display: none; }
  .rb-icon-btn { width: 44px; height: 44px; }
  /* Phones scroll the screen; the nav stays put. */
  /* Phones: a scrolling column, never a grid that can overlap. The nav stays put. */
  .rb-screen.active { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 8px; }
  .rb-screen.active > * { flex: none; min-height: 0; }
  .rb-cats { display: flex; gap: 6px; overflow-x: auto; padding: 4px; }
  .rb-stage { height: 320px; }
  .rb-stage-view { height: 100%; }
  .rb-hero { padding: 4% 6% 10%; }
  .rb-detail { padding: 12px 14px; gap: 8px; }
  .rb-rail { padding-bottom: 8px; }
  .rb-side { flex-direction: row; overflow-x: auto; overflow-y: hidden; padding-bottom: 8px; }
  .rb-side-panel { flex: 0 0 250px; }
  .rb-blurb { min-height: 0; font-size: 14px; }
  .rb-card { flex-basis: 128px; grid-template-rows: 72px auto auto auto; }
  .rb-card .thumb { width: 68px; height: 68px; }
  .rb-card .thumb.trail { width: 96px; height: 48px; }
  .rb-board { grid-template-rows: auto auto auto auto; }
  .rb-table-wrap { max-height: 320px; }
  .rb-missions-head { grid-template-columns: 1fr 1fr; gap: 10px 16px; padding: 12px 14px; }
  .rb-missions-head .v { font-size: 20px; }
  .rb-missions-head .rb-hint { grid-column: 1 / -1; justify-self: start; text-align: left; max-width: none; }
  .rb-mission-grid { grid-template-columns: 1fr; overflow: visible; }
  .rb-mission { grid-template-columns: 44px 1fr auto; gap: 10px; padding: 10px 12px; }
  .rb-mission .ic { width: 44px; height: 44px; }
  .rb-podium { padding: 10px 10px 4px; gap: 6px; }
  .rb-pod .av { width: 52px; height: 52px; } .rb-pod.first .av { width: 64px; height: 64px; }
  .rb-pod .nm { font-size: 14px; } .rb-pod .sc { font-size: 15px; }
  .rb-table td { font-size: 15px; padding: 7px 6px; }
  .rb-table td.games, .rb-table th.games { display: none; }
  .rb-tab { min-width: 0; padding: 8px 12px; font-size: 13px; }
  .rb-nav-btn { grid-template-columns: 40px 1fr; padding: 6px 8px; gap: 8px; }
  .rb-nav-btn .hex { width: 40px; height: 40px; } .rb-nav-btn .hex svg { width: 20px; height: 20px; }
  .rb-nav-btn .t { font-size: 14px; } .rb-nav-btn .s { display: none; }
}
/* Short desktop windows (1280x720 laptops): everything a size down, the detail panel scrolls in its row. */
@media (min-width: 761px) and (max-height: 800px) {
  .rb-shell { gap: 8px; padding: 8px 12px 0; }
  .rb-top { min-height: 0; }
  .rb-player { padding: 8px 12px 8px; grid-template-columns: 52px 1fr; }
  .rb-avatar { width: 52px; height: 52px; }
  .rb-name { font-size: 19px; }
  .rb-sub { margin-top: 3px; font-size: 11px; }
  .rb-wordmark { font-size: 22px; }
  .rb-screen-title { font-size: 36px; }
  .rb-screen-sub { font-size: 11px; margin-top: 3px; }
  .rb-icon-btn { width: 44px; height: 44px; }
  .rb-cat { padding: 8px 14px; font-size: 15px; }
  .rb-detail { padding: 12px 16px; gap: 8px; align-self: stretch; overflow-y: auto; min-height: 0; scrollbar-width: none; }
  .rb-item-name { font-size: 20px; }
  .rb-blurb { min-height: 0; font-size: 14px; }
  .rb-btn { min-height: 42px; font-size: 16px; }
  .rb-btn.sm { min-height: 36px; font-size: 14px; }
  .rb-card { flex-basis: 128px; grid-template-rows: 68px auto auto auto; padding: 8px 8px 10px; }
  .rb-card .thumb { width: 64px; height: 64px; }
  .rb-card .thumb.trail { width: 92px; height: 46px; }
  .rb-card .nm { font-size: 12px; }
  .rb-nav { padding: 4px 0 8px; }
  .rb-nav-btn { padding: 4px 10px; grid-template-columns: 44px 1fr; }
  .rb-nav-btn .hex { width: 44px; height: 44px; } .rb-nav-btn .hex svg { width: 22px; height: 22px; }
  .rb-nav-btn .t { font-size: 16px; }
  .rb-podium { padding: 10px 12px 6px; }
  .rb-pod { padding: 24px 8px 10px; } .rb-pod.first { padding-top: 30px; }
  .rb-pod .av { width: 56px; height: 56px; } .rb-pod.first .av { width: 68px; height: 68px; }
  .rb-pod .nm { font-size: 15px; } .rb-pod .sc { font-size: 17px; }
  .rb-mission { padding: 10px 14px 10px 12px; gap: 10px; grid-template-columns: 46px minmax(0, 1fr) auto; }
  .rb-mission .ic { width: 46px; height: 46px; }
  .rb-missions-head { padding: 10px 16px; }
  .rb-missions-head .v { font-size: 22px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  /* One header row: player card | title | actions. The screen scrolls under it. */
  .rb-shell { gap: 6px; padding: 6px 10px 0; }
  .rb-top { grid-template-columns: minmax(190px, 250px) 1fr auto; grid-template-rows: auto; align-items: center; }
  .rb-heading { order: 0; grid-column: auto; padding-top: 0; }
  .rb-heading .rb-wordmark { display: none; }
  .rb-screen-title { font-size: 22px; margin-top: 0; }
  .rb-screen-sub { display: none; }
  .rb-player { grid-template-columns: 40px 1fr; padding: 6px 8px; gap: 6px; }
  .rb-avatar { width: 40px; height: 40px; }
  .rb-name { font-size: 15px; }
  .rb-title-line { font-size: 11px; }
  .rb-xp { display: none; }
  .rb-wallet { margin-top: 0; }
  .rb-pill { font-size: 12px; padding: 2px 8px 2px 4px; } .rb-pill .rb-coin { width: 16px; height: 16px; }
  .rb-sub { display: none; }
  .rb-icon-btn { width: 38px; height: 38px; } .rb-icon-btn svg { width: 18px; height: 18px; }
  .rb-stage { height: 230px; }
  .rb-cats .rb-cat { padding: 6px 10px; font-size: 13px; }
  .rb-detail { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
  .rb-detail .rb-item-name { flex: 1 1 100%; font-size: 18px; }
  .rb-detail .rb-blurb { flex: 1 1 100%; }
  .rb-detail .rb-btn { width: auto; flex: 1 1 200px; }
  .rb-detail .rb-btn-row { flex: 1 1 200px; }
  .rb-nav { padding: 2px 0 6px; gap: 6px; }
  .rb-nav-btn { padding: 2px 8px; grid-template-columns: 32px 1fr; gap: 6px; } .rb-nav-btn .hex { width: 32px; height: 32px; } .rb-nav-btn .hex svg { width: 16px; height: 16px; } .rb-nav-btn .s { display: none; } .rb-nav-btn .t { font-size: 13px; }
  .rb-tab { padding: 6px 10px; font-size: 12px; min-width: 0; }
  .rb-podium { padding: 8px 8px 2px; }
  .rb-pod { padding: 20px 6px 8px; } .rb-pod.first { padding-top: 24px; }
  .rb-pod .av { width: 40px; height: 40px; } .rb-pod.first .av { width: 48px; height: 48px; }
  .rb-pod .nm { font-size: 12px; } .rb-pod .sc { font-size: 13px; }
  .rb-side { flex-direction: row; }
  .rb-mission-grid { grid-template-columns: 1fr 1fr; }
}
