/* ============================================================
   VULU — Component primitives + shell chrome styles
   ============================================================ */

/* ---------- Button ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  height: 40px; padding: 0 16px;
  border-radius: var(--r-ctl);
  font-size: 14px; font-weight: 600; letter-spacing: 0.01em;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease), color var(--dur) var(--ease);
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn .ic { width: 18px; height: 18px; }

.btn--primary {
  background: var(--green);
  color: var(--green-ink);
  border-color: var(--green);
}
.btn--primary:hover { background: #5be88e; }

.btn--neutral {
  background: var(--fill);
  color: var(--text);
  border-color: var(--border);
}
.btn--neutral:hover { background: var(--fill-hover); border-color: #313838; }

.btn--ghost {
  background: transparent; color: var(--text-2); border-color: transparent;
}
.btn--ghost:hover { background: var(--fill); color: var(--text); }

.btn--sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn--icon { width: 40px; padding: 0; }
.btn--icon.btn--sm { width: 32px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- CurrencyPill ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 11px 0 9px;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  font-size: 13px; font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.pill:hover { background: var(--raised-2); border-color: #313838; }
.pill__ic {
  width: 18px; height: 18px; display: grid; place-items: center;
  border-radius: 999px; flex: 0 0 auto;
}
.pill__ic svg { width: 13px; height: 13px; }
.pill--cash  .pill__ic { background: var(--green-tint); color: var(--green); }
.pill--gems  .pill__ic { background: rgba(190,56,243,0.14); color: var(--purple); }
.pill--fuel  .pill__ic { background: rgba(242,210,74,0.14); color: var(--gold); }
.pill--robux .pill__ic { background: rgba(148,163,184,0.16); color: var(--grey-dot); }
.pill__num { font-variant-numeric: tabular-nums; }
.pill__add {
  margin-left: 1px; width: 16px; height: 16px;
  display: grid; place-items: center;
  color: var(--muted);
}

/* ---------- Avatar ---------- */
.avatar {
  position: relative; flex: 0 0 auto;
  border-radius: 999px;
  display: inline-grid; place-items: center;
  background: var(--raised-2);
  color: var(--text-2);
  font-weight: 600;
  overflow: visible;
}
.avatar__img {
  width: 100%; height: 100%;
  border-radius: 999px; object-fit: cover;
  background: linear-gradient(135deg, #1b2120, #11201a);
  display: grid; place-items: center;
}
.avatar--live { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--red); }
.avatar__dot {
  position: absolute; right: -1px; bottom: -1px;
  width: 30%; height: 30%; min-width: 9px; min-height: 9px;
  border-radius: 999px; border: 2px solid var(--bg);
}
.avatar__dot--online  { background: var(--green); }
.avatar__dot--busy    { background: var(--red); }
.avatar__dot--offline { background: var(--muted); }

/* ---------- Card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 18px;
}

/* ---------- NavItem ---------- */
.nav {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--r-ctl);
  color: var(--text-2);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 14px; font-weight: 600;
  text-align: left;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  position: relative;
}
.nav .ic { width: 22px; height: 22px; flex: 0 0 auto; }
.nav:hover { background: var(--raised); color: var(--text); }
.nav--active { color: var(--green); background: var(--green-tint); }
.nav--active:hover { background: var(--green-tint); color: var(--green); }

/* icon-only variant (rail / tab bar) */
.nav--icon { width: auto; justify-content: center; padding: 11px; }
.nav--icon .nav__label { display: none; }

/* unread badge */
.nav__badge {
  position: absolute;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px;
  background: var(--red); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.nav .nav__badge { position: static; margin-left: auto; }
.nav--icon .nav__badge { position: absolute; top: 4px; right: 4px; }
.tab .nav__badge { position: absolute; top: 4px; right: calc(50% - 20px); }

/* ============================================================
   SHELL
   ============================================================ */
.app { height: 100%; display: flex; flex-direction: column; }

/* ---------- Top bar (mobile + tablet) ---------- */
.topbar {
  height: var(--topbar-h);
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  background: rgba(6,8,8,0.72);
  backdrop-filter: saturate(1.4) blur(16px);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
}
.topbar__right { display: flex; align-items: center; gap: 8px; }

/* ---------- Logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; }
.logo__mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--green); color: var(--green-ink);
  display: grid; place-items: center;
  font-weight: 800; font-size: 17px; letter-spacing: -0.03em;
  flex: 0 0 auto;
}
.logo__word {
  font-size: 18px; font-weight: 700; letter-spacing: -0.02em; color: var(--text);
}

/* ---------- Mobile bottom tab bar ---------- */
.tabbar {
  height: var(--tabbar-h);
  flex: 0 0 auto;
  display: grid; grid-template-columns: repeat(5, 1fr);
  align-items: center;
  background: rgba(6,8,8,0.86);
  backdrop-filter: saturate(1.4) blur(18px);
  -webkit-backdrop-filter: saturate(1.4) blur(18px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tab {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: transparent; border: 0; cursor: pointer;
  color: var(--muted);
  padding: 8px 0 6px;
  font-size: 10.5px; font-weight: 600;
  transition: color var(--dur) var(--ease);
}
.tab .ic { width: 24px; height: 24px; }
.tab:hover { color: var(--text-2); }
.tab--active { color: var(--green); }
.tab--create .tab__plus {
  width: 44px; height: 34px; border-radius: 11px;
  background: var(--green); color: var(--green-ink);
  display: grid; place-items: center;
  margin-bottom: 1px;
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.tab--create:hover .tab__plus { background: #5be88e; }
.tab--create:active .tab__plus { transform: translateY(1px); }
.tab--create .ic { width: 26px; height: 26px; }

/* ---------- Body row (tablet + desktop) ---------- */
.bodyrow { flex: 1 1 auto; display: flex; min-height: 0; min-width: 0; }

/* ---------- Tablet slim rail ---------- */
.rail {
  width: var(--rail-w); flex: 0 0 auto;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; padding: 12px 0;
  transition: margin-left var(--dur) var(--ease);
}
.rail--collapsed { margin-left: calc(var(--rail-w) * -1); }
.rail__items { display: flex; flex-direction: column; gap: 6px; width: 100%; align-items: center; flex: 1 1 auto; }
.rail .nav--icon { width: 48px; height: 48px; }
.rail .tab__plus,
.rail__create {
  width: 48px; height: 48px; border-radius: 13px;
  background: var(--green); color: var(--green-ink);
  display: grid; place-items: center; cursor: pointer; border: 0;
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.rail__create:hover { background: #5be88e; }
.rail__create:active { transform: translateY(1px); }

/* tooltip */
.tip { position: relative; }
.tip__bub {
  position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%) scale(0.96);
  background: var(--raised-2); color: var(--text);
  border: 1px solid var(--border);
  padding: 5px 9px; border-radius: 8px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity 140ms var(--ease), transform 140ms var(--ease);
  z-index: 60;
}
.tip:hover .tip__bub { opacity: 1; transform: translateY(-50%) scale(1); }
.tip__bub .nav__badge { position: static; margin-left: 6px; display: inline-block; }

/* ---------- Desktop sidebar ---------- */
.sidebar {
  width: var(--sidebar-w); flex: 0 0 auto;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 18px 14px 14px;
}
.sidebar__top { padding: 4px 8px 16px; }
.sidebar__group { display: flex; flex-direction: column; gap: 3px; }
.sidebar__sep {
  height: 1px; background: var(--divider);
  margin: 14px 8px;
}
.sidebar__kicker {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); padding: 4px 12px 8px;
}
.sidebar__spacer { flex: 1 1 auto; }
.sidebar__foot {
  border-top: 1px solid var(--divider);
  padding-top: 12px; margin-top: 12px;
  display: flex; flex-direction: column; gap: 12px;
}
.userchip {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: var(--r-ctl);
  cursor: pointer; border: 1px solid transparent;
  transition: background var(--dur) var(--ease);
}
.userchip:hover { background: var(--raised); }
.userchip__name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.userchip__handle { font-size: 12px; color: var(--muted); }
.foot__pills { display: flex; gap: 8px; }

/* ⌘K trigger */
.cmdk {
  display: flex; align-items: center; gap: 10px; width: 100%;
  height: 38px; padding: 0 10px 0 12px;
  background: var(--input-bg); border: 1px solid var(--border);
  border-radius: var(--r-ctl); cursor: text;
  color: var(--muted); font-size: 13px; font-weight: 500;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.cmdk:hover { border-color: #313838; }
.cmdk .ic { width: 16px; height: 16px; }
.cmdk__kbd { margin-left: auto; display: flex; gap: 3px; }
.kbd {
  min-width: 18px; height: 18px; padding: 0 4px;
  display: grid; place-items: center;
  background: var(--raised-2); border: 1px solid var(--border);
  border-radius: 5px; font-size: 11px; font-weight: 600; color: var(--text-2);
}

/* ---------- Main column ---------- */
.mainwrap { flex: 1 1 auto; min-width: 0; min-height: 0; overflow-y: auto; }
.main {
  max-width: var(--main-max);
  margin: 0 auto;
  padding: 28px 24px 64px;
}
.main--mobile { padding: 20px 16px 28px; }

/* ---------- Right context panel ---------- */
.rightpanel {
  width: var(--rightpanel-w); flex: 0 0 auto;
  border-left: 1px solid var(--border);
  background: var(--surface);
  overflow-y: auto;
  padding: 18px 16px;
  transition: margin-right var(--dur) var(--ease);
}
.rightpanel--collapsed { margin-right: calc(var(--rightpanel-w) * -1); }
.rightpanel__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.rightpanel__title { font-size: 13px; font-weight: 700; letter-spacing: 0.02em; }
.rp-reopen {
  position: absolute; right: 16px; top: 76px; z-index: 30;
}

/* desktop top strip (holds reopen + breadcrumb) */
.deskbar {
  height: 56px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(6,8,8,0.6);
  backdrop-filter: blur(12px);
}
.deskbar__crumb { font-size: 13px; color: var(--text-2); font-weight: 600; }
.deskcol { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; min-height: 0; }

/* ---------- Placeholder content ---------- */
.ph {
  display: flex; flex-direction: column; gap: 20px;
}
.ph__hero {
  border: 1px dashed var(--border);
  border-radius: var(--r-card);
  padding: 44px 24px;
  text-align: center;
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,0.012) 0 10px, transparent 10px 20px);
}
.ph__kicker {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 12px;
}
.ph__title { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 6px; }
.ph__sub { color: var(--text-2); font-size: 14px; margin: 0; }
.ph__badge {
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 16px;
  padding: 5px 12px; border-radius: 999px;
  background: var(--green-tint); color: var(--green);
  font-size: 12px; font-weight: 700;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
}
.ph__badge .dot { width: 7px; height: 7px; border-radius: 999px; background: var(--green); }

/* showcase */
.sc { display: grid; gap: 14px; }
.sc__row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sc__label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); margin: 4px 0 2px;
}
.sc__sep { height: 1px; background: var(--divider); margin: 4px 0; }

/* ---------- Bottom sheet (mobile) ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0,0,0,0.55);
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur) var(--ease);
}
.scrim--open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 81;
  background: var(--raised);
  border-top: 1px solid var(--border);
  border-radius: 18px 18px 0 0;
  padding: 10px 16px calc(20px + env(safe-area-inset-bottom, 0));
  transform: translateY(100%);
  transition: transform var(--dur) var(--ease);
}
.sheet--open { transform: translateY(0); }
.sheet__grip { width: 40px; height: 4px; border-radius: 999px; background: var(--border); margin: 6px auto 14px; }
.sheet__item {
  display: flex; align-items: center; gap: 14px;
  width: 100%; padding: 13px 8px; border: 0; background: transparent;
  color: var(--text); font-size: 15px; font-weight: 600; cursor: pointer;
  border-radius: 10px; text-align: left;
}
.sheet__item:hover { background: var(--raised-2); }
.sheet__item .ic { width: 22px; height: 22px; color: var(--text-2); }

/* ---------- Command palette / centered modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: start center;
  padding-top: 14vh;
  background: rgba(0,0,0,0.5);
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur) var(--ease);
}
.modal--open { opacity: 1; pointer-events: auto; }
.palette {
  width: min(560px, 92vw);
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transform: translateY(-8px) scale(0.99);
  transition: transform var(--dur) var(--ease);
}
.modal--open .palette { transform: translateY(0) scale(1); }
.palette__input {
  display: flex; align-items: center; gap: 11px;
  padding: 16px 18px; border-bottom: 1px solid var(--divider);
}
.palette__input .ic { width: 18px; height: 18px; color: var(--muted); }
.palette__input input {
  flex: 1 1 auto; background: transparent; border: 0; outline: none;
  color: var(--text); font-size: 16px; font-family: inherit;
}
.palette__input input::placeholder { color: var(--muted); }
.palette__list { padding: 8px; max-height: 320px; overflow-y: auto; }
.palette__row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 10px; cursor: pointer;
  color: var(--text-2); font-size: 14px; font-weight: 500;
}
.palette__row:hover, .palette__row--active { background: var(--raised-2); color: var(--text); }
.palette__row .ic { width: 18px; height: 18px; }
.palette__hint { font-size: 12px; color: var(--muted); margin-left: auto; }
.palette__foot {
  display: flex; gap: 14px; padding: 10px 16px;
  border-top: 1px solid var(--divider);
  font-size: 12px; color: var(--muted);
}

/* ============================================================
   RESPONSIVE VISIBILITY — three genuinely distinct chromes
   ============================================================ */
.chrome-mobile, .chrome-tablet, .chrome-desktop { display: none; }

@media (max-width: 640px) {
  .chrome-mobile { display: flex; flex-direction: column; height: 100%; }
}
@media (min-width: 641px) and (max-width: 1024px) {
  .chrome-tablet { display: flex; flex-direction: column; height: 100%; }
}
@media (min-width: 1025px) {
  .chrome-desktop { display: flex; height: 100%; }
}

/* overlay gating: sheet on mobile only, modal on >=641 only */
.only-mobile { display: none; }
.gt-mobile   { display: none; }
@media (max-width: 640px) { .only-mobile { display: contents; } }
@media (min-width: 641px) { .gt-mobile   { display: contents; } }

/* CSP-safe extracted web shell styles: fill the visible viewport without inline CSS. */
html, body {
  margin: 0;
  height: 100%;
  height: 100dvh;
  height: var(--app-height, 100dvh);
  background: var(--main-bg, #0a0c0b);
}

#root {
  width: 100%;
  max-width: 100vw;
  height: 100%;
  height: 100dvh;
  height: var(--app-height, 100dvh);
  overflow: hidden;
}

.app3 .stage .chat .stream,
.app3 > .lives .lives__body,
.app3 .stage .mlist {
  overflow-y: auto;
  overflow-x: hidden;
  overflow-anchor: none;
}

.app3 > .rail,
.app3 > .lives,
.app3 .stage .chat,
.app3 .stage .mlist {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  background: linear-gradient(162deg, rgba(255,255,255,0.10), rgba(255,255,255,0.035) 47%, rgba(255,255,255,0.065)) !important;
}

.app3 .lvcard {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}
