/* ─────────────────────────────────────────────
   Gamoo app preview — gamoo.app/app
   ───────────────────────────────────────────── */

:root {
  --bg: #0d0c0b;
  --bg-2: #121110;
  --panel: #161513;
  --surface: #1c1b19;
  --surface-2: #252321;
  --line: rgba(255, 246, 232, 0.075);
  --line-2: rgba(255, 246, 232, 0.13);
  --line-3: rgba(255, 246, 232, 0.2);
  --text: #f4f0e8;
  --muted: rgba(244, 240, 232, 0.64);
  --subtle: rgba(244, 240, 232, 0.42);
  --ember: #ff6b2c;
  --ember-2: #ff8a4c;
  --amber: #ffb547;
  --sky: #4c7dff;
  --lime: #e4fd55;
  --ok: #86d993;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 20px;
  --side-w: 252px;

  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Bricolage Grotesque', var(--font);
  --mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Film grain — inset must stay 0 (negative inset causes edge strips in Chrome) */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9000;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 280px 280px;
}

img { display: block; max-width: 100%; }
button, input, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
kbd { font: 500 11px/1 var(--mono); color: var(--subtle); border: 1px solid var(--line-2); border-radius: 5px; padding: 3px 5px; }
:focus-visible { outline: 2px solid var(--ember-2); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.eyebrow {
  margin: 0 0 12px;
  font: 600 11px/1 var(--font);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ember-2);
}

/* ───────── Primitives ───────── */

.brand { display: inline-flex; align-items: center; gap: 9px; }
.brand__mark { width: 24px; height: 24px; stroke: none; }
.brand__name { font: 600 17px/1 var(--display); font-variation-settings: 'opsz' 24; }
.brand--sm .brand__mark { width: 20px; height: 20px; }
.brand--sm .brand__name { font-size: 15px; }

.tag {
  font: 600 10px/1 var(--font);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ember-2);
  background: rgba(255, 107, 44, 0.12);
  border: 1px solid rgba(255, 107, 44, 0.25);
  padding: 4px 6px;
  border-radius: 5px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 16px;
  border-radius: 10px;
  font-weight: 500; font-size: 14px;
  transition: background .2s, border-color .2s, transform .2s var(--ease), opacity .2s;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn--sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn--block { width: 100%; }
.btn--light { background: var(--text); color: #141210; }
.btn--light:hover { background: #fff; }
.btn--ghost { border: 1px solid var(--line-2); color: var(--text); background: rgba(255, 255, 255, 0.02); }
.btn--ghost:hover { background: rgba(255, 255, 255, 0.06); border-color: var(--line-3); }
.btn--accent { background: linear-gradient(180deg, #ff7a3d, #f2581a); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 6px 18px -8px rgba(255, 90, 31, .8); }
.btn--accent:hover { background: linear-gradient(180deg, #ff8a4c, #ff6224); }
.btn:active { transform: scale(0.98); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; border-radius: 9px;
  color: var(--muted);
  transition: background .2s, color .2s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.icon-btn--ring { border: 1px solid var(--line-2); border-radius: 50%; width: 32px; height: 32px; }
.icon-btn--ring svg { width: 16px; height: 16px; }
.icon-btn--sm { width: 28px; height: 28px; border-radius: 7px; }
.icon-btn--sm svg { width: 15px; height: 15px; }

.send {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--text); color: #141210;
  transition: opacity .2s, transform .2s var(--ease), background .2s;
}
.send svg { width: 17px; height: 17px; stroke-width: 2.2; }
.send:hover:not(:disabled) { background: #fff; transform: translateY(-1px); }
.send:disabled { opacity: .28; cursor: default; }

.mono {
  --c1: #888; --c2: #333;
  display: inline-grid; place-items: center;
  width: 22px; height: 22px; border-radius: 6px;
  background: linear-gradient(140deg, var(--c1) 0%, var(--c1) 46%, var(--c2) 100%);
  font: 700 9.5px/1 var(--mono);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
  flex: none;
}
.mono--lg { width: 40px; height: 40px; border-radius: 10px; font-size: 13px; }
.mono--xl { width: 64px; height: 64px; border-radius: 16px; font-size: 20px; }
.duo { display: inline-flex; align-items: center; }
.duo .mono + .mono { margin-left: -6px; box-shadow: 0 0 0 2px var(--panel), inset 0 0 0 1px rgba(255,255,255,.14); }

/* ───────── Shell ───────── */

.shell {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

.mbar { display: none; }

.side {
  position: sticky; top: 0;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  padding: 14px 10px 12px 12px;
  gap: 10px;
}
.side__top { display: flex; align-items: center; gap: 8px; padding: 4px 6px 6px; }
.side__close { display: none; margin-left: auto; }

.ws {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 7px 8px; border-radius: 10px;
  text-align: left;
  transition: background .2s;
}
.ws:hover { background: rgba(255, 255, 255, 0.05); }
.ws__avatar, .user__avatar {
  display: grid; place-items: center;
  width: 24px; height: 24px; border-radius: 7px;
  background: linear-gradient(140deg, #3a3633, #24221f);
  border: 1px solid var(--line-2);
  font: 600 11px/1 var(--font); color: var(--muted);
}
.ws__name { font-size: 14px; font-weight: 500; flex: 1; }
.ws__chev { width: 15px; height: 15px; color: var(--subtle); }

.side__nav { display: flex; flex-direction: column; gap: 1px; overflow-y: auto; flex: 1; }
.side__label {
  margin: 18px 10px 6px;
  font: 500 12px/1 var(--font);
  color: var(--subtle);
}
.side__link {
  display: flex; align-items: center; gap: 10px;
  width: 100%; height: 34px; padding: 0 10px; border-radius: 9px;
  font-size: 14px; color: var(--muted); text-align: left;
  transition: background .18s, color .18s;
}
.side__link svg { width: 17px; height: 17px; }
.side__link kbd { margin-left: auto; }
.side__link:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.side__link.is-active { background: rgba(255, 255, 255, 0.07); color: var(--text); }

.side__foot { display: flex; flex-direction: column; gap: 8px; }
.beta {
  position: relative;
  padding: 14px; border-radius: 14px;
  border: 1px solid var(--line-2);
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(255, 107, 44, 0.22), transparent 60%),
    radial-gradient(90% 70% at 0% 100%, rgba(76, 125, 255, 0.18), transparent 60%),
    var(--panel);
}
.beta__title { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font-weight: 600; font-size: 14px; }
.beta__copy { margin: 0 0 12px; font-size: 13px; line-height: 1.45; color: var(--muted); }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--ember); box-shadow: 0 0 0 0 rgba(255, 107, 44, .6); animation: pulse 2.2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(255, 107, 44, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 107, 44, 0); } }

.user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; text-align: left; transition: background .2s; }
.user:hover { background: rgba(255, 255, 255, 0.05); }
.user__avatar { width: 30px; height: 30px; border-radius: 50%; }
.user__txt { display: flex; flex-direction: column; font-size: 13.5px; font-weight: 500; line-height: 1.25; }
.user__txt small { font-size: 12px; font-weight: 400; color: var(--subtle); }

.scrim { display: none; }

.stage {
  position: relative;
  margin: 8px 8px 8px 0;
  min-height: calc(100dvh - 16px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--bg-2);
  overflow: clip;
  min-width: 0;
}

/* ───────── Hero ───────── */

.hero {
  position: relative;
  isolation: isolate;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  padding: clamp(84px, 15vh, 156px) 24px 132px;
  min-height: min(88vh, 880px);
}

.glow {
  position: absolute;
  left: -12%; right: -12%; bottom: -6%;
  height: 78%;
  z-index: -1;
  filter: blur(64px);
  pointer-events: none;
}
.glow i { position: absolute; border-radius: 50%; }
.glow i:nth-child(1) { left: -2%; bottom: 22%; width: 62%; height: 62%; background: radial-gradient(closest-side, rgba(58, 98, 255, .95), transparent); animation: drift-a 19s ease-in-out infinite alternate; }
.glow i:nth-child(2) { left: 30%; bottom: -6%; width: 58%; height: 78%; background: radial-gradient(closest-side, rgba(255, 86, 24, .95), transparent); animation: drift-b 23s ease-in-out infinite alternate; }
.glow i:nth-child(3) { right: -4%; bottom: 14%; width: 46%; height: 66%; background: radial-gradient(closest-side, rgba(255, 181, 71, .75), transparent); animation: drift-a 27s ease-in-out infinite alternate-reverse; }
.glow i:nth-child(4) { left: 44%; bottom: 40%; width: 20%; height: 26%; background: radial-gradient(closest-side, rgba(228, 253, 85, .45), transparent); animation: drift-b 17s ease-in-out infinite alternate-reverse; }
.hero::before {
  /* darken the top so the headline sits on near-black like Lovable */
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, var(--bg-2) 0%, rgba(18, 17, 16, .72) 28%, rgba(18, 17, 16, 0) 52%);
}
@keyframes drift-a { to { transform: translate3d(6%, -4%, 0) scale(1.06); } }
@keyframes drift-b { to { transform: translate3d(-7%, 3%, 0) scale(.96); } }

.announce {
  display: inline-flex; align-items: center; gap: 9px;
  height: 32px; padding: 0 10px 0 4px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: rgba(22, 21, 19, .6);
  backdrop-filter: blur(10px);
  font-size: 13px; color: var(--muted);
  transition: border-color .2s, color .2s;
}
.announce:hover { border-color: var(--line-3); color: var(--text); }
.announce svg { width: 14px; height: 14px; }
.announce__tag {
  height: 24px; padding: 0 9px; border-radius: 999px;
  display: inline-grid; place-items: center;
  background: var(--text); color: #141210;
  font-weight: 600; font-size: 12px;
}

.hero__title {
  margin: 26px 0 0;
  font: 600 clamp(2.6rem, 6.2vw, 4.75rem)/1.02 var(--display);
  font-variation-settings: 'opsz' 96;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.hero__sub {
  margin: 16px auto 0;
  max-width: 34em;
  font-size: clamp(15px, 1.5vw, 17.5px);
  line-height: 1.5;
  color: var(--muted);
  text-wrap: balance;
}

/* Prompt box */
.prompt {
  position: relative;
  width: min(740px, 100%);
  margin-top: 36px;
  padding: 16px 12px 12px 18px;
  text-align: left;
  background: rgba(24, 23, 21, .8);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--line-2);
  border-radius: 24px;
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(255, 255, 255, .05);
  transition: border-color .2s, box-shadow .2s;
}
.prompt:focus-within { border-color: rgba(255, 246, 232, .24); box-shadow: 0 40px 90px -40px rgba(0, 0, 0, .9), 0 0 0 4px rgba(255, 107, 44, .1), inset 0 1px 0 rgba(255, 255, 255, .05); }
.prompt textarea {
  display: block; width: 100%;
  min-height: 52px; max-height: 220px;
  padding: 0 72px 0 0;
  background: none; border: 0; outline: 0; resize: none;
  font-size: 16px; line-height: 1.55;
}
.prompt textarea::placeholder, .chat__form textarea::placeholder { color: var(--subtle); }
.prompt__bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.prompt__left, .prompt__right { display: flex; align-items: center; gap: 6px; min-width: 0; }

.pair { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pair__plus { color: var(--subtle); font-size: 14px; }
.pick {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 8px 0 5px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, .025);
  font-size: 13.5px; font-weight: 500;
  white-space: nowrap; min-width: 0;
  transition: background .2s, border-color .2s;
}
.pick:hover, .pick[aria-expanded="true"] { background: rgba(255, 255, 255, .06); border-color: var(--line-3); }
.pick__role { font-size: 12px; font-weight: 400; color: var(--subtle); }
.pick__name { overflow: hidden; text-overflow: ellipsis; }
.pick svg { width: 14px; height: 14px; color: var(--subtle); }

.mode {
  display: inline-flex; align-items: center; gap: 4px;
  height: 32px; padding: 0 8px 0 10px; border-radius: 8px;
  font-size: 13.5px; color: var(--muted);
  transition: background .2s, color .2s;
}
.mode:hover { background: rgba(255, 255, 255, .06); color: var(--text); }
.mode svg { width: 14px; height: 14px; }

.ideas {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  margin-top: 18px; max-width: 740px;
}
.idea {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 12px 0 7px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: rgba(13, 12, 11, .5);
  backdrop-filter: blur(8px);
  font-size: 13px; color: var(--muted);
  white-space: nowrap;
  transition: color .2s, border-color .2s, background .2s;
}
.idea .mono { width: 18px; height: 18px; border-radius: 5px; font-size: 7.5px; }
.idea .duo .mono + .mono { margin-left: -5px; box-shadow: 0 0 0 1.5px #1a1816; }
.idea:hover { color: var(--text); border-color: var(--line-3); background: rgba(13, 12, 11, .7); }

/* ───────── Library ───────── */

.library {
  position: relative; z-index: 1;
  margin: -64px 16px 0;
  padding: 16px 20px 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 -30px 60px -40px rgba(0, 0, 0, .8);
}
.library__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  height: 32px; padding: 0 12px; border-radius: 8px;
  font-size: 14px; color: var(--muted); white-space: nowrap;
  transition: background .2s, color .2s;
}
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { background: var(--surface-2); color: var(--text); }
.ghost-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.ghost-link svg { width: 14px; height: 14px; transition: transform .2s var(--ease); }
.ghost-link:hover { color: var(--text); }
.ghost-link:hover svg { transform: translateX(2px); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 268px), 1fr)); gap: 22px 16px; }

.card { display: block; width: 100%; text-align: left; }
.card__img {
  position: relative; overflow: hidden;
  aspect-ratio: 16 / 10;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.card__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .7s var(--ease), filter .4s; }
.card__img::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, .55)); opacity: 0; transition: opacity .3s; }
.card:hover .card__img img, .card:focus-visible .card__img img { transform: scale(1.045); }
.card:hover .card__img::after, .card:focus-visible .card__img::after { opacity: 1; }
.card__cta {
  position: absolute; right: 10px; bottom: 10px; z-index: 1;
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 11px; border-radius: 8px;
  background: var(--text); color: #141210;
  font-size: 12.5px; font-weight: 500;
  opacity: 0; transform: translateY(6px);
  transition: opacity .25s, transform .25s var(--ease);
}
.card__cta svg { width: 13px; height: 13px; }
.card:hover .card__cta, .card:focus-visible .card__cta { opacity: 1; transform: none; }
.card__layers { position: absolute; left: 10px; top: 10px; z-index: 1; display: flex; gap: 4px; }
.card__layers span {
  font: 500 10.5px/1 var(--mono);
  padding: 5px 6px; border-radius: 5px;
  background: rgba(10, 9, 8, .62); backdrop-filter: blur(6px);
  color: rgba(244, 240, 232, .85);
}
.card__meta { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.card__title { margin: 0; font-weight: 500; font-size: 14.5px; line-height: 1.3; }
.card__sub { margin: 2px 0 0; font-size: 12.5px; color: var(--subtle); }

.panel__note { margin: 0 0 16px; font-size: 13.5px; color: var(--subtle); }
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 10px; }
.gcard {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .015);
  text-align: left; width: 100%;
  transition: border-color .2s, background .2s;
}
.gcard:hover { border-color: var(--line-3); background: rgba(255, 255, 255, .04); }
.gcard__txt { min-width: 0; flex: 1; }
.gcard__name { display: block; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gcard__meta { display: block; font: 400 11.5px/1.4 var(--mono); color: var(--subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge {
  font: 500 10.5px/1 var(--font);
  padding: 4px 6px; border-radius: 5px;
  color: var(--amber); background: rgba(255, 181, 71, .1); border: 1px solid rgba(255, 181, 71, .22);
  white-space: nowrap;
}

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 56px 16px 40px; }
.empty__gm { width: 108px; height: 108px; margin-bottom: 12px; }
.empty h3 { margin: 0; font: 600 18px/1.3 var(--display); }
.empty p { margin: 8px 0 18px; max-width: 30em; font-size: 14px; color: var(--muted); }
.empty__actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* ───────── How ───────── */

.how { padding: clamp(80px, 11vw, 128px) clamp(20px, 4vw, 48px) 40px; max-width: 1180px; margin: 0 auto; }
.how__title {
  margin: 0;
  font: 600 clamp(2rem, 4.4vw, 3.4rem)/1.04 var(--display);
  font-variation-settings: 'opsz' 96;
  letter-spacing: -0.02em;
  max-width: 14em;
  text-wrap: balance;
}
.how__sub { margin: 16px 0 0; max-width: 36em; color: var(--muted); font-size: 16px; }
.how__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 44px; }
.how__card {
  padding: 14px 14px 22px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.how__card h3 { margin: 20px 6px 0; font: 600 17px/1.3 var(--display); }
.how__card p { margin: 8px 6px 0; font-size: 14px; line-height: 1.55; color: var(--muted); }

.viz {
  position: relative; overflow: hidden;
  height: 196px; border-radius: 12px;
  background:
    radial-gradient(80% 90% at 85% 100%, rgba(255, 107, 44, .16), transparent 60%),
    radial-gradient(70% 80% at 0% 0%, rgba(76, 125, 255, .14), transparent 60%),
    #0f0e0d;
  border: 1px solid var(--line);
}

.viz--windows .win { position: absolute; width: 64%; border-radius: 9px; overflow: hidden; border: 1px solid var(--line-2); background: #151413; box-shadow: 0 20px 40px -20px rgba(0,0,0,.9); }
.win__bar { display: flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-bottom: 1px solid var(--line); background: #1b1a18; }
.win__bar i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.18); }
.win__bar span { margin-left: 6px; font: 500 10px/1 var(--mono); color: var(--subtle); }
.win__body { height: 96px; display: grid; place-items: center; }
.win__body img { width: 100%; height: 100%; object-fit: cover; }
.win--host { left: 6%; top: 60px; z-index: 2; }
.win--guest { right: 6%; top: 14px; border-style: dashed; background: rgba(21, 20, 19, .7); }
.win--guest .win__bar { background: transparent; }
.win__ghost { font: 500 11px/1 var(--mono); color: var(--subtle); }

.viz--pipe { display: flex; align-items: center; justify-content: space-between; padding: 0 16px; gap: 10px; }
.node {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 64px; height: 64px; border-radius: 14px;
  background: rgba(76, 125, 255, .16); border: 1px solid rgba(76, 125, 255, .4);
  font: 600 13px/1.1 var(--font);
}
.node small { font: 400 10.5px/1.3 var(--mono); color: var(--muted); }
.node--guest { background: rgba(255, 107, 44, .14); border-color: rgba(255, 107, 44, .4); }
.pipe { flex: 1; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.pipe__lane { position: relative; display: block; height: 22px; border-radius: 6px; background: rgba(255,255,255,.035); border: 1px solid var(--line); overflow: hidden; }
.pipe__lane b { position: absolute; inset: 0; display: grid; place-items: center; font: 500 10.5px/1 var(--mono); color: var(--muted); z-index: 1; }
.flow { position: absolute; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 10px var(--amber); }
.flow--r { animation: flow-r 2.2s linear infinite; }
.flow--l { background: var(--sky); box-shadow: 0 0 10px var(--sky); animation: flow-l 1.8s linear infinite; }
.flow--both { background: var(--lime); box-shadow: 0 0 10px var(--lime); animation: flow-r 1.6s ease-in-out infinite alternate; }
@keyframes flow-r { from { left: -6px; } to { left: 100%; } }
@keyframes flow-l { from { left: 100%; } to { left: -6px; } }

.viz--stack { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 0; perspective: 600px; }
.plate {
  width: 74%; height: 34px; margin-top: -6px;
  display: grid; place-items: center;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  background: rgba(28, 27, 25, .92);
  font: 500 11px/1 var(--mono); color: var(--muted);
  transform: rotateX(28deg);
  box-shadow: 0 10px 20px -12px rgba(0,0,0,.9);
}
.plate:first-child { margin-top: 0; }
.plate--hot { color: #fff; border-color: rgba(255, 107, 44, .65); background: linear-gradient(90deg, rgba(255, 107, 44, .35), rgba(255, 181, 71, .25)); box-shadow: 0 0 30px -6px rgba(255, 107, 44, .6); }

.foot { padding: 40px clamp(20px, 4vw, 48px) 32px; max-width: 1180px; margin: 0 auto; border-top: 1px solid var(--line); margin-top: 72px; }
.foot__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.foot__row p { margin: 0; font-size: 13.5px; color: var(--muted); }
.foot__row a:not(.brand) { color: var(--text); text-decoration: underline; text-decoration-color: var(--line-3); text-underline-offset: 3px; }
.foot__legal { margin: 18px 0 0; max-width: 60em; font-size: 12px; line-height: 1.55; color: var(--subtle); }

/* ───────── Popovers & dialogs ───────── */

.pop {
  position: fixed; z-index: 500;
  width: min(360px, calc(100vw - 16px));
  border-radius: 16px;
  border: 1px solid var(--line-2);
  background: rgba(26, 25, 23, .96);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .85);
  animation: pop-in .18s var(--ease);
}
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.pop__head { padding: 14px 14px 10px; border-bottom: 1px solid var(--line); }
.pop__title { margin: 0; font-weight: 600; font-size: 14px; }
.pop__sub { margin: 2px 0 10px; font-size: 12.5px; color: var(--subtle); }
.pop__search, .palette__search { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border-radius: 9px; background: rgba(255,255,255,.04); border: 1px solid var(--line); }
.pop__search svg, .palette__search svg { width: 15px; height: 15px; color: var(--subtle); }
.pop__search input, .palette__search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; font-size: 14px; }
.pop__list { max-height: min(360px, 52vh); overflow-y: auto; padding: 6px; overscroll-behavior: contain; }
.prow {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 8px; border-radius: 10px; text-align: left;
  transition: background .15s;
}
.prow:hover, .prow:focus-visible { background: rgba(255, 255, 255, .06); }
.prow__txt { flex: 1; min-width: 0; }
.prow__name { display: block; font-size: 14px; font-weight: 500; }
.prow__meta { display: block; font: 400 11.5px/1.4 var(--mono); color: var(--subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow__check { color: var(--ember-2); }
.prow__empty { padding: 18px 10px; font-size: 13.5px; color: var(--subtle); text-align: center; }

.pop--menu { width: 280px; padding: 6px; }
.pop--menu button { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 10px; border-radius: 10px; text-align: left; transition: background .15s; }
.pop--menu button:hover, .pop--menu button[aria-checked="true"] { background: rgba(255,255,255,.06); }
.pop--menu b { font-weight: 500; font-size: 14px; }
.pop--menu span { font-size: 12.5px; color: var(--subtle); }

dialog { color: var(--text); }
dialog::backdrop { background: rgba(8, 7, 6, .6); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }

.palette {
  width: min(560px, calc(100vw - 24px));
  margin: 12vh auto auto;
  padding: 10px;
  border-radius: 18px;
  border: 1px solid var(--line-2);
  background: rgba(24, 23, 21, .98);
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, .9);
}
.palette__search { height: 44px; }
.palette__search input { font-size: 15px; }
.palette__list { max-height: 50vh; overflow-y: auto; margin-top: 8px; }
.palette__group { margin: 10px 8px 4px; font-size: 12px; color: var(--subtle); }

.modal {
  position: relative;
  width: min(460px, calc(100vw - 24px));
  padding: 0;
  border-radius: 22px;
  border: 1px solid var(--line-2);
  background: var(--panel);
  overflow: hidden;
  box-shadow: 0 50px 120px -30px rgba(0, 0, 0, .95);
}
.modal[open] { animation: modal-in .28s var(--ease); }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal__glow {
  position: absolute; left: -20%; right: -20%; top: -60%; height: 110%;
  background:
    radial-gradient(closest-side at 30% 60%, rgba(58, 98, 255, .5), transparent),
    radial-gradient(closest-side at 70% 70%, rgba(255, 86, 24, .55), transparent);
  filter: blur(40px);
  pointer-events: none;
}
.modal__x { position: absolute; right: 10px; top: 10px; z-index: 2; }
.wl { position: relative; padding: 36px 28px 26px; }
.wl h2 { margin: 0; font: 600 28px/1.1 var(--display); letter-spacing: -0.015em; }
.wl__copy { margin: 10px 0 22px; color: var(--muted); font-size: 14.5px; }
.field {
  width: 100%; height: 46px; padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: rgba(0, 0, 0, .25);
  font-size: 15px; outline: 0;
  transition: border-color .2s, box-shadow .2s;
}
.field:focus { border-color: rgba(255, 138, 76, .6); box-shadow: 0 0 0 4px rgba(255, 107, 44, .12); }
.field[aria-invalid="true"] { border-color: #ff6b6b; }
.wl__err { margin: 8px 0 0; font-size: 13px; color: #ff8b8b; }
.wl__label { margin: 18px 0 8px; font-size: 13px; color: var(--subtle); }
.wl__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 22px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 10px 0 5px; border-radius: 8px;
  border: 1px solid var(--line-2);
  font-size: 13px; color: var(--muted);
  transition: background .15s, border-color .15s, color .15s;
}
.chip .mono { width: 20px; height: 20px; border-radius: 5px; font-size: 8px; }
.chip[aria-pressed="true"] { color: var(--text); border-color: rgba(255, 138, 76, .55); background: rgba(255, 107, 44, .12); }
.wl__fine { margin: 12px 0 0; font-size: 12px; color: var(--subtle); text-align: center; }
.wl--done { text-align: center; padding-top: 44px; }
.wl__gm { width: 64px; height: 64px; margin: -4px 0 14px; filter: drop-shadow(0 12px 18px rgba(0, 0, 0, .5)); }
.wl__gm--done { width: 104px; height: 104px; margin: 0 auto 14px; animation: gm-hop 1.8s ease-in-out infinite; }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 900;
  transform: translate(-50%, 16px);
  padding: 10px 14px; border-radius: 10px;
  background: var(--text); color: #141210;
  font-size: 13.5px; font-weight: 500;
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, .7);
  opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s var(--ease);
  max-width: calc(100vw - 32px);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ───────── Studio ───────── */

.shell[data-view="studio"] { grid-template-columns: minmax(0, 1fr); }
.shell[data-view="studio"] .side,
.shell[data-view="studio"] .mbar,
.shell[data-view="studio"] .scrim { display: none; }
.shell[data-view="studio"] .stage { margin: 0; border: 0; border-radius: 0; min-height: 0; height: 100vh; height: 100dvh; background: var(--bg); }

.studio { display: flex; flex-direction: column; height: 100%; }

.sbar {
  flex: none;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px;
  height: 54px; padding: 0 10px;
}
.sbar__left, .sbar__right { display: flex; align-items: center; gap: 6px; min-width: 0; }
.sbar__right { justify-content: flex-end; }
.sbar .brand__mark { width: 22px; height: 22px; }
.proj { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px; border-radius: 8px; font-size: 14px; font-weight: 500; min-width: 0; transition: background .2s; }
.proj span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj svg { width: 14px; height: 14px; color: var(--subtle); }
.proj:hover { background: rgba(255,255,255,.05); }

.seg { display: flex; gap: 2px; padding: 3px; border-radius: 11px; background: rgba(255,255,255,.04); border: 1px solid var(--line); }
.seg button {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 11px; border-radius: 8px;
  font-size: 13px; color: var(--muted);
  transition: background .2s, color .2s;
}
.seg button svg { width: 15px; height: 15px; }
.seg button:hover { color: var(--text); }
.seg button[aria-selected="true"] { background: var(--surface-2); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.04) inset; }
.seg [data-pane="chat"] { display: none; }

.sbody { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(340px, 410px) minmax(0, 1fr); }

/* Chat */
.chat { display: flex; flex-direction: column; min-height: 0; }
.chat__log {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 16px;
  padding: 14px 16px 18px;
  scrollbar-width: thin; scrollbar-color: var(--surface-2) transparent;
}
.msg { animation: msg-in .3s var(--ease); font-size: 14.5px; line-height: 1.6; }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } }
.msg p { margin: 0; }
.msg p + p, .msg p + ul, .msg ul + p { margin-top: 10px; }
.msg ul { margin: 10px 0 0; padding-left: 18px; color: var(--muted); }
.msg li + li { margin-top: 4px; }
.msg--user {
  align-self: flex-end; max-width: 88%;
  padding: 10px 14px;
  border-radius: 16px 16px 4px 16px;
  background: var(--surface-2);
  white-space: pre-wrap;
}
.msg--agent { color: var(--text); }
.agent-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
.agent-head .brand__mark { width: 16px; height: 16px; }

.think { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--subtle); }
.think svg { width: 14px; height: 14px; transition: transform .2s; }
.think[aria-expanded="true"] svg { transform: rotate(90deg); }
.think--live span {
  background: linear-gradient(90deg, var(--subtle) 0%, var(--text) 50%, var(--subtle) 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: 0 0; } }
.think__body { margin: 8px 0 0; padding-left: 12px; border-left: 2px solid var(--line-2); font-size: 13.5px; color: var(--subtle); }

.steps { border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.015); overflow: hidden; }
.steps__head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.steps__head b { font-weight: 500; color: var(--text); }
.steps ol { list-style: none; margin: 0; padding: 6px; }
.step { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; padding: 7px 6px; border-radius: 8px; animation: msg-in .3s var(--ease); }
.step__icon { width: 18px; height: 18px; margin-top: 1px; display: grid; place-items: center; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-3); border-top-color: var(--ember-2); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.step__icon svg { width: 16px; height: 16px; color: var(--ok); stroke-width: 2.4; }
.step__title { font-size: 13.5px; font-weight: 500; line-height: 1.35; }
.step.is-live .step__title { color: var(--text); }
.step__detail { display: block; margin-top: 2px; font: 400 11.5px/1.45 var(--mono); color: var(--subtle); }
.file {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 5px; padding: 3px 7px 3px 5px;
  border-radius: 6px; border: 1px solid var(--line);
  font: 500 11px/1.2 var(--mono); color: var(--muted);
  background: rgba(255,255,255,.02);
}
.file svg { width: 12px; height: 12px; }

.note {
  display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  border: 1px solid rgba(255, 181, 71, .22);
  background: rgba(255, 181, 71, .06);
  font-size: 13px; line-height: 1.5; color: rgba(255, 225, 180, .9);
  animation: msg-in .3s var(--ease);
}
.note svg { width: 17px; height: 17px; color: var(--amber); margin-top: 1px; }

.version {
  border: 1px solid var(--line-2); border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01));
  padding: 12px; animation: msg-in .3s var(--ease);
}
.version__top { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.version__top b { font-weight: 600; }
.version__top span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.version__time { margin-left: auto; color: var(--subtle) !important; font-size: 12px; flex: none; }
.version__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); flex: none; }
.version__actions { display: flex; gap: 6px; margin-top: 12px; }
.version__actions .btn { flex: 1; }

.follow { display: flex; flex-wrap: wrap; gap: 6px; animation: msg-in .3s var(--ease); }
.follow button {
  height: 30px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--line-2); font-size: 12.5px; color: var(--muted);
  transition: color .15s, border-color .15s, background .15s;
}
.follow button:hover { color: var(--text); border-color: var(--line-3); background: rgba(255,255,255,.04); }

.chat__form {
  margin: 0 12px 12px;
  padding: 12px 10px 10px 14px;
  border-radius: 18px;
  border: 1px solid var(--line-2);
  background: var(--panel);
  transition: border-color .2s;
}
.chat__form:focus-within { border-color: var(--line-3); }
.chat__form textarea { display: block; width: 100%; min-height: 24px; max-height: 160px; background: none; border: 0; outline: 0; resize: none; font-size: 14.5px; line-height: 1.5; }
.chat__bar { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.chat__mode { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--subtle); }
.chat__mode svg { width: 13px; height: 13px; }
.chat__bar .send { margin-left: auto; width: 30px; height: 30px; }
.chat__bar .send svg { width: 15px; height: 15px; }

/* View */
.view { display: flex; min-height: 0; padding: 0 10px 10px 2px; }
.frame {
  position: relative; flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  border-radius: 14px; overflow: hidden;
  border: 1px solid var(--line-2);
  background: #0a0908;
}
.frame__bar { flex: none; display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 7px; border-bottom: 1px solid var(--line); background: var(--panel); }
.addr {
  flex: 1; min-width: 0;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 28px; padding: 0 12px; border-radius: 8px;
  background: rgba(255,255,255,.035);
  font: 400 12px/1 var(--mono); color: var(--muted);
}
.addr span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.addr__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); flex: none; }
.addr__dot.is-live { background: var(--ok); box-shadow: 0 0 8px var(--ok); }

.vpane { position: relative; flex: 1; min-height: 0; display: flex; }
.vpane--scroll { overflow-y: auto; display: block; }

/* Game preview */
.game { position: relative; flex: 1; overflow: hidden; background: #050505; container-type: size; }
.game > img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transform: scale(1.12);
  filter: blur(22px) brightness(.4) saturate(.7);
  transition: filter 1.1s var(--ease), transform 1.6s var(--ease);
}
.game[data-state="ready"] > img { filter: none; transform: scale(1.02); animation: kenburns 26s ease-in-out 1.6s infinite alternate; }
@keyframes kenburns { from { transform: scale(1.02); } to { transform: scale(1.09) translate(-1.5%, -1%); } }

.game__fallback {
  position: absolute; inset: 0; display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  text-align: center; padding: 24px;
  background:
    radial-gradient(60% 60% at 30% 40%, color-mix(in srgb, var(--fa, #4c7dff) 45%, transparent), transparent 70%),
    radial-gradient(60% 60% at 70% 65%, color-mix(in srgb, var(--fb, #ff6b2c) 45%, transparent), transparent 70%),
    #0b0a09;
}
.game.is-fallback > img { display: none; }
.game.is-fallback .game__fallback { display: flex; }
.game__fallback p { margin: 0; max-width: 22em; font-size: 14px; color: var(--muted); }
.fb__duo { display: flex; }
.fb__duo .mono + .mono { margin-left: -14px; box-shadow: 0 0 0 4px #0b0a09, inset 0 0 0 1px rgba(255,255,255,.14); }

.build {
  position: absolute; inset: 0; z-index: 3;
  display: grid; place-items: center;
  transition: opacity .6s, visibility .6s;
}
.game[data-state="ready"] .build { opacity: 0; visibility: hidden; }
.build__card {
  width: min(320px, 80%);
  padding: 22px 22px 18px; border-radius: 16px;
  background: rgba(14, 13, 12, .72);
  border: 1px solid var(--line-2);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  text-align: center;
}
.build__gm { width: 64px; height: 64px; margin: 0 auto 12px; animation: gm-bob 1.1s ease-in-out infinite; }
.build__step { margin: 0; font-size: 14px; font-weight: 500; min-height: 1.5em; }
.build__bar { height: 4px; margin: 14px 0 8px; border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; }
.build__bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--sky), var(--ember), var(--amber)); transition: width .6s var(--ease); }
.build__pct { margin: 0; font: 500 11.5px/1 var(--mono); color: var(--subtle); }

.game__stats {
  position: absolute; left: 12px; top: 12px; z-index: 2;
  display: inline-flex; align-items: center; gap: 8px;
  height: 28px; padding: 0 10px; border-radius: 8px;
  background: rgba(8, 8, 7, .62); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.08);
  font: 500 11.5px/1 var(--mono); color: rgba(244,240,232,.8);
  opacity: 0; transition: opacity .6s .4s;
}
.game__stats b { font-weight: 500; color: #fff; }
.live { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.game[data-state="ready"] .game__stats { opacity: 1; }

/* HUD — generic pixel overlay */
.hud { position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0; transition: opacity .8s .5s; }
.game[data-state="ready"] .hud { opacity: 1; }
.hud__cross { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; }
.hud__cross::before, .hud__cross::after { content: ''; position: absolute; background: rgba(255,255,255,.85); }
.hud__cross::before { left: 8px; top: 0; width: 2px; height: 18px; }
.hud__cross::after { top: 8px; left: 0; height: 2px; width: 18px; }

.hud__toast {
  position: absolute; right: 12px; top: 12px;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px 8px 8px;
  background: rgba(16, 14, 22, .82);
  border: 2px solid rgba(80, 60, 120, .9);
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.6);
  font: 500 12px/1.35 var(--mono);
  transform: translateX(calc(100% + 24px));
  transition: transform .6s var(--ease) .9s;
  image-rendering: pixelated;
}
.game[data-state="ready"] .hud__toast { transform: none; }
.hud__toast b { display: block; font-weight: 500; color: #d9a6ff; }
.hud__toast span { color: #f1f1f1; }
.hud__toast .mono { border-radius: 2px; }

.hud__bottom {
  position: absolute; left: 50%; bottom: 3.2%;
  width: min(56cqw, 430px);
  transform: translateX(-50%);
}
.hud__rows { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 2px; }
.hud__icons { display: flex; gap: 0.6%; width: 46%; }
.hud__icons--r { flex-direction: row-reverse; }
.hud__icons svg { width: 9.6%; height: auto; aspect-ratio: 1; fill: currentColor; stroke: none; shape-rendering: crispEdges; filter: drop-shadow(1px 1px 0 rgba(0,0,0,.55)); }
.hud__xp { position: relative; height: 5px; margin: 3px 0 3px; background: rgba(0,0,0,.6); border: 1px solid rgba(0,0,0,.8); }
.hud__xp i { position: absolute; left: 0; top: 0; bottom: 0; width: 38%; background: linear-gradient(180deg, #b6ff5c, #6fd02a); }
.hud__xp span { position: absolute; left: 50%; top: -16px; transform: translateX(-50%); font: 700 12px/1 var(--mono); color: #8cff4a; text-shadow: 1px 1px 0 #1a3a05; }
.hotbar { display: grid; grid-template-columns: repeat(9, 1fr); background: rgba(20, 20, 20, .55); border: 2px solid rgba(0, 0, 0, .75); box-shadow: inset 0 0 0 2px rgba(140, 140, 140, .5); }
.slot { position: relative; aspect-ratio: 1; border: 2px solid rgba(70, 70, 70, .55); display: grid; place-items: center; }
.slot.is-on { border: 3px solid #f2f2f2; box-shadow: 0 0 0 2px #1a1a1a; z-index: 1; margin: -2px; }
.slot svg { width: 64%; height: 64%; stroke: none; shape-rendering: crispEdges; }
.slot em { position: absolute; right: 6%; bottom: 0; font: 700 10px/1 var(--mono); font-style: normal; color: #fff; text-shadow: 1px 1px 0 #3a3a3a; }

.game[data-hud="generic"] .hud__bottom, .game[data-hud="generic"] .hud__cross { display: none; }

/* Bridge pane */
.bridge { padding: 26px clamp(18px, 3vw, 34px) 34px; max-width: 920px; margin: 0 auto; }
.bridge__head h3 { margin: 0; font: 600 22px/1.2 var(--display); letter-spacing: -0.01em; }
.bridge__head p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.diagram { display: grid; grid-template-columns: minmax(0, 1fr) minmax(120px, .7fr) minmax(0, 1fr); align-items: stretch; gap: 0; margin: 24px 0 26px; }
.bnode {
  padding: 16px; border-radius: 14px;
  border: 1px solid var(--line-2);
  background: var(--panel);
}
.bnode__top { display: flex; align-items: center; gap: 10px; }
.bnode__role { display: block; font: 600 10.5px/1 var(--font); text-transform: uppercase; letter-spacing: 0.08em; color: var(--subtle); margin-bottom: 4px; }
.bnode__name { font-weight: 600; font-size: 15px; }
.bnode p { margin: 10px 0 12px; font-size: 13px; color: var(--muted); line-height: 1.45; }
.bnode dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; font: 400 11.5px/1.4 var(--mono); }
.bnode dt { color: var(--subtle); }
.bnode dd { margin: 0; color: var(--text); text-align: right; }
.bnode--host { border-color: rgba(76, 125, 255, .35); background: linear-gradient(180deg, rgba(76,125,255,.08), transparent 60%), var(--panel); }
.bnode--guest { border-color: rgba(255, 107, 44, .35); background: linear-gradient(180deg, rgba(255,107,44,.08), transparent 60%), var(--panel); }
.bpipe { position: relative; display: flex; align-items: center; justify-content: center; }
.bpipe::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 2px; margin-top: -1px; background: repeating-linear-gradient(90deg, var(--line-3) 0 6px, transparent 6px 11px); }
.bpipe__core { position: relative; z-index: 1; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-2); background: #141311; text-align: center; font-size: 12.5px; font-weight: 500; }
.bpipe__core small { display: block; margin-top: 3px; font: 400 10.5px/1.3 var(--mono); color: var(--subtle); }
.bpipe .flow { z-index: 0; }
.bpipe .flow--r { animation-duration: 2.6s; }
.bpipe .flow--l { animation-duration: 2.1s; margin-top: 4px; }

.channels { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.chan { display: grid; grid-template-columns: 112px minmax(0, 1fr) auto auto; align-items: center; gap: 16px; padding: 14px 16px; }
.chan + .chan { border-top: 1px solid var(--line); }
.chan__dir { font: 500 11px/1.3 var(--mono); color: var(--subtle); }
.chan__name { display: block; font-size: 14px; font-weight: 500; }
.chan__desc { display: block; margin-top: 2px; font-size: 13px; color: var(--muted); line-height: 1.45; }
.chan__ms { font: 500 12px/1 var(--mono); color: var(--muted); white-space: nowrap; }
.chan.is-off .chan__name, .chan.is-off .chan__desc, .chan.is-off .chan__ms { opacity: .4; }
.switch { position: relative; width: 36px; height: 21px; border-radius: 999px; background: rgba(255,255,255,.12); transition: background .2s; flex: none; }
.switch::after { content: ''; position: absolute; left: 3px; top: 3px; width: 15px; height: 15px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); }
.switch[aria-checked="true"] { background: var(--ember); }
.switch[aria-checked="true"]::after { transform: translateX(15px); }
.bridge__foot { margin: 14px 2px 0; font-size: 12.5px; color: var(--subtle); }

/* Code pane */
.code { flex: 1; min-width: 0; display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.tree { border-right: 1px solid var(--line); padding: 10px 6px; overflow-y: auto; background: var(--bg); font: 400 12.5px/1.2 var(--mono); }
.tree__dir { display: flex; align-items: center; gap: 7px; padding: 7px 8px; color: var(--muted); }
.tree__dir svg, .tree__file svg { width: 14px; height: 14px; }
.tree__dir small { margin-left: auto; color: var(--subtle); font-size: 10.5px; }
.tree__file { display: flex; align-items: center; gap: 7px; width: 100%; padding: 7px 8px 7px 24px; border-radius: 7px; color: var(--muted); text-align: left; }
.tree__file:hover { background: rgba(255,255,255,.04); color: var(--text); }
.tree__file[aria-current="true"] { background: rgba(255,255,255,.07); color: var(--text); }
.code__main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.code__tab { flex: none; padding: 10px 16px; border-bottom: 1px solid var(--line); font: 500 12px/1 var(--mono); color: var(--muted); }
.code__pre { flex: 1; margin: 0; overflow: auto; padding: 16px 18px 28px; font: 400 12.5px/1.7 var(--mono); color: #e6e1d8; tab-size: 4; }
.code__pre .c { color: #8a8478; font-style: italic; }
.code__pre .k { color: #ff9a6b; }
.code__pre .s { color: #c9e58a; }
.code__pre .n { color: #ffcf7a; }
.code__pre .t { color: #8fb2ff; }
.code__pre .f { color: #f2e8d6; font-weight: 500; }
.code__pre .p { color: #d9a6ff; }

/* ───────── Gamoo placements (art and moods live in /mascot.css) ───────── */

.prompt__gm {
  position: absolute; right: -30px; top: -62px; z-index: 3;
  width: 100px; height: 100px;
  pointer-events: none;
  filter: drop-shadow(0 16px 22px rgba(0, 0, 0, .5));
  animation: gm-float 5s ease-in-out infinite;
}
.beta__gm { position: absolute; right: -4px; top: -30px; width: 52px; height: 52px; transform: rotate(-8deg); filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .55)); }
.empty__gm .gm { transform-origin: 50% 90%; animation: gm-breathe 3.2s ease-in-out infinite; }
.viz__gm { position: absolute; z-index: 3; width: 60px; height: 60px; filter: drop-shadow(0 10px 16px rgba(0, 0, 0, .6)); }
.viz__gm--win { right: 14px; bottom: 10px; transform: rotate(-6deg); }
.viz__gm--stack { left: 12px; bottom: 10px; transform: rotate(6deg); }

/* ───────── Responsive ───────── */

@media (max-width: 1080px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .mbar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    position: sticky; top: 0; z-index: 50;
    height: 56px; padding: 0 12px 0 8px;
    background: rgba(13, 12, 11, .82);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  }
  .side {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 200;
    width: min(300px, 86vw);
    background: var(--bg);
    border-right: 1px solid var(--line-2);
    transform: translateX(-102%);
    transition: transform .3s var(--ease);
  }
  .side__close { display: inline-grid; }
  .shell.side-open .side { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 150; background: rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity .3s; }
  .shell.side-open .scrim { opacity: 1; pointer-events: auto; }
  .stage { margin: 0 8px 8px; min-height: calc(100dvh - 64px); }
  .how__grid { grid-template-columns: minmax(0, 1fr); max-width: 560px; }
}

@media (max-width: 860px) {
  .sbar { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "left right" "seg seg"; height: auto; padding: 8px 10px 6px; row-gap: 8px; }
  .sbar__left { grid-area: left; }
  .sbar__right { grid-area: right; }
  .seg { grid-area: seg; }
  .seg button { flex: 1; justify-content: center; }
  .seg [data-pane="chat"] { display: inline-flex; }
  .sbar__share { display: none; }
  .sbody { grid-template-columns: minmax(0, 1fr); }
  .studio[data-mpane="chat"] .view { display: none; }
  .studio[data-mpane="view"] .chat { display: none; }
  .view { padding: 0 8px 8px; }
  .diagram { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .bpipe { min-height: 74px; }
  .bpipe::before { left: 50%; right: auto; top: 0; bottom: 0; width: 2px; height: auto; margin: 0 0 0 -1px; background: repeating-linear-gradient(180deg, var(--line-3) 0 6px, transparent 6px 11px); }
  .bpipe .flow { display: none; }
  .chan { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; }
  .chan__dir { grid-column: 1 / -1; }
  .chan__ms { display: none; }
  .code { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .tree { border-right: 0; border-bottom: 1px solid var(--line); display: flex; overflow-x: auto; padding: 6px; gap: 2px; }
  .tree__dir { display: none; }
  .tree__file { width: auto; padding: 7px 10px; white-space: nowrap; }
}

@media (max-width: 640px) {
  .hero { padding: 64px 14px 112px; min-height: 0; }
  .hero__title { margin-top: 22px; }
  .prompt { margin-top: 48px; padding: 14px 10px 10px 14px; border-radius: 20px; }
  .prompt textarea { padding-right: 44px; }
  .prompt__gm { right: -4px; top: -44px; width: 68px; height: 68px; }
  .prompt__bar { flex-wrap: wrap; row-gap: 10px; }
  .prompt__left { flex: 1 1 100%; order: -1; }
  .prompt__left > .icon-btn { display: none; }
  .pair { flex: 1; }
  .pick { flex: 1 1 0; justify-content: flex-start; }
  .pick__role { display: none; }
  .pick svg { margin-left: auto; }
  .prompt__right { margin-left: auto; }
  .ideas { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; width: calc(100% + 28px); margin-left: -14px; margin-right: -14px; padding: 0 14px; scrollbar-width: none; }
  .ideas::-webkit-scrollbar { display: none; }
  .library { margin: -52px 6px 0; padding: 12px 12px 20px; border-radius: 16px; }
  .library__head .ghost-link { display: none; }
  .how { padding-top: 72px; }
  .wl { padding: 34px 20px 22px; }
  .wl h2 { font-size: 24px; }
  .hud__toast { font-size: 10.5px; padding: 6px 9px 6px 6px; }
  .game__stats b:last-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
