/* A dark arcade look, the same for everyone. */
:root { color-scheme: dark; }
:root {
  --bg: #0d0d14; --bg-2: #12121b; --panel: #17171f; --panel-2: #1e1e29; --line: #272735; --text: #f1f1f6; --muted: #a3a3b8;
  --accent: #7c5cff; --accent-2: #ff4fa3; --accent-3: #2ee6a8; --accent-text: #fff; --danger: #ff5d6c; --ok: #2ee6a8; --warn: #ffb547;
  --radius: 14px; --shadow: 0 10px 30px -12px rgba(0, 0, 0, .6);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; min-height: 100vh;
  background: radial-gradient(900px 500px at 15% -10%, rgba(124, 92, 255, .20), transparent 60%),
              radial-gradient(700px 400px at 95% 0%, rgba(255, 79, 163, .12), transparent 60%), var(--bg);
  background-attachment: fixed;
}
a { color: var(--accent); }
h1 { font-size: 28px; line-height: 1.15; margin: 8px 0 12px; letter-spacing: -.02em; font-weight: 800; }
h2 { font-size: 17px; margin: 24px 0 10px; letter-spacing: -.01em; }
.card h2 { margin-top: 0; }
.muted { color: var(--muted); }
code { font-family: var(--mono); font-size: .9em; background: var(--panel-2); padding: 1px 5px; border-radius: 5px; }

/* side nav: a slim rail of icons on the left that opens to show labels */
:root { --rail: 68px; --rail-open: 232px; --tabbar: 0px; }
/* --rail-w is the room the nav takes from the left of the page. */
body { --rail-w: var(--rail); padding-left: var(--rail-w); }
body.rail-wide { --rail-w: var(--rail-open); }
.rail {
  position: fixed; z-index: 30; left: 0; top: 0; bottom: 0; width: var(--rail);
  border-right: 1px solid var(--line); background: color-mix(in srgb, var(--bg-2) 92%, transparent); backdrop-filter: blur(12px);
  transition: width .2s var(--ease-out, ease), box-shadow .2s;
}
.rail.open { width: var(--rail-open); }
body.rail-peek .rail { box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
body.rail-peek::after { content: ""; position: fixed; inset: 0; z-index: 29; background: rgba(0, 0, 0, .4); animation: fade-in .2s; }
.rail nav { height: 100%; display: flex; flex-direction: column; gap: 2px; padding: 12px 12px 14px; overflow-y: auto; overflow-x: hidden; }
.rail:not(.open) nav { overflow: visible; }
.rail-top { display: flex; align-items: center; gap: 8px; height: 40px; margin-bottom: 12px; }
.rail-toggle { flex: none; padding: 0; border: 0; background: none; box-shadow: none; border-radius: 10px; width: 44px; height: 40px; }
.rail-toggle:hover { background: none; } .rail-toggle:hover .logo { transform: scale(1.06); }
.logo {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; font: 800 14px var(--mono); color: #fff; transition: transform .15s;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 6px 18px -6px var(--accent);
}
.brand { flex: 1; min-width: 0; color: var(--text); text-decoration: none; font-weight: 800; font-size: 19px; letter-spacing: -.03em; white-space: nowrap; }
.rail-collapse { flex: none; display: grid; place-items: center; padding: 6px; border-radius: 8px; }
.rail-collapse:hover { background: var(--panel-2); }
.rail:not(.open) .brand, .rail:not(.open) .rail-collapse { display: none; }
.rail-head { padding: 12px 10px 4px; font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.rail:not(.open) .rail-head { font-size: 0; height: 1px; margin: 8px 10px; padding: 0; background: var(--line); }
.rail:not(.open) .rail-top + .rail-head { display: none; }
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rail-item {
  position: relative; display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border: 0; border-radius: 10px;
  background: none; box-shadow: none; color: var(--muted); font: inherit; font-weight: 600; font-size: 14px; text-decoration: none; justify-content: flex-start;
  white-space: nowrap; cursor: pointer;
}
.rail-item:hover { color: var(--text); background: var(--panel-2); }
.rail-item:active { transform: none; }
.rail-item.on { color: var(--text); background: color-mix(in srgb, var(--accent) 26%, transparent); }
.rail-item.on .ico { color: #c6b8ff; }
.rail-new .ico { color: var(--accent-3); }
.rail-fill { flex: 1; min-height: 12px; }
.rail-bottom { display: flex; flex-direction: column; gap: 2px; }
.studio-only { display: none; }
body.studio-page .studio-only { display: flex; }
.rail-bottom > div.studio-only { flex-direction: column; }
.rail-label { overflow: hidden; text-overflow: ellipsis; }
/* Slim: labels become tooltips beside the icon. */
.rail:not(.open) .rail-label {
  position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%); padding: 4px 10px; border-radius: 8px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text); font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow); pointer-events: none; opacity: 0; transition: opacity .12s; z-index: 5; overflow: visible;
}
.rail:not(.open) .rail-item:hover .rail-label, .rail:not(.open) .rail-item:focus-visible .rail-label { opacity: 1; }
.rail:not(.open) .menu summary .rail-label { display: none; }
.rail .menu summary { align-items: center; gap: 10px; padding: 3px; border-radius: 12px; color: var(--text); font-weight: 600; font-size: 14px; white-space: nowrap; min-width: 0; }
.rail .menu summary:hover { background: var(--panel-2); }
.rail .menu-items { left: calc(100% + 10px); right: auto; top: auto; bottom: 0; z-index: 40; }
.rail.open .menu-items { left: 0; bottom: calc(100% + 8px); }
main { max-width: 1180px; margin: 0 auto; padding: 12px 24px 60px; }

/* top bar: search, usage and your account */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; height: 64px; padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
body.studio-page .topbar { display: none; }
.top-search { flex: 1; max-width: 640px; margin: 0 auto; position: relative; display: flex; align-items: center; }
.top-search .ico { position: absolute; left: 16px; color: var(--muted); pointer-events: none; }
.top-search input { height: 44px; padding: 0 18px 0 46px; border-radius: 999px; border: 1px solid transparent; background: var(--panel-2); font-size: 15px; }
.top-search input::placeholder { color: var(--muted); }
.top-search input:focus { background: var(--panel); }
.top-right { flex: none; display: flex; align-items: center; gap: 10px; }
.usage-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line);
  color: var(--text); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.usage-chip .ico { width: 16px; height: 16px; color: var(--accent-3); }
.usage-chip:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.usage-chip.warn { border-color: color-mix(in srgb, var(--warn) 60%, var(--line)); }
.usage-chip.warn .ico { color: var(--warn); }
.top-icon { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: none; box-shadow: none; color: var(--text); }
.top-icon:hover { background: var(--panel-2); }
.top-icon[aria-pressed="false"] { color: var(--muted); }
.topbar .menu summary .rail-label { display: none; }
.topbar .menu-items { z-index: 40; }
.menu-who { padding: 6px 10px 8px; margin-bottom: 4px; border-bottom: 1px solid var(--line); font-weight: 700; color: var(--muted); font-size: 13px; }
@media (max-width: 900px) { .usage-chip span { display: none; } .usage-chip { padding: 0 10px; } }

/* Phones: the rail becomes a tab bar along the bottom. */
@media (max-width: 640px) {
  :root { --tabbar: calc(60px + env(safe-area-inset-bottom)); }
  body, body.rail-wide { --rail-w: 0px; padding-bottom: var(--tabbar); }
  .rail, .rail.open { top: auto; right: 0; width: auto; height: var(--tabbar); border-right: 0; border-top: 1px solid var(--line); box-shadow: none !important; }
  .rail nav, .rail:not(.open) nav { flex-direction: row; align-items: stretch; justify-content: space-around; gap: 0; padding: 4px 6px env(safe-area-inset-bottom); overflow: visible; }
  .rail-top, .rail-head, .rail:not(.open) .rail-head, .rail-fill, .tab-hide { display: none !important; }
  .rail-bottom { display: contents; }
  .rail-item, .rail .menu summary {
    flex: 1; flex-direction: column; justify-content: center; gap: 2px; height: auto; padding: 4px 2px; font-size: 11px; border-radius: 10px;
  }
  .rail-item:hover, .rail .menu summary:hover { background: none; }
  .rail-item.on { background: none; color: var(--text); }
  .rail-item.on .ico { color: #c6b8ff; }
  .rail .rail-label, .rail:not(.open) .rail-label { position: static; transform: none; opacity: 1; padding: 0; border: 0; background: none; box-shadow: none; font-size: 11px; color: inherit; }
  .rail .menu, .rail-bottom > .studio-only { flex: 1; display: flex; }
  body:not(.studio-page) .rail-bottom > .studio-only { display: none; }
  .rail .menu summary { padding: 4px 2px; }
  .rail .menu summary .avatar.md { width: 26px; height: 26px; font-size: 12px; }
  .rail .menu summary .rail-label, .rail:not(.open) .menu summary .rail-label { display: block; max-width: 72px; font-weight: 600; }
  .rail .menu-items, .rail.open .menu-items { left: auto; right: 6px; top: auto; bottom: calc(100% + 8px); }
  main { padding: 10px 16px 40px; }
  .topbar { height: 56px; padding: 0 12px; gap: 8px; }
  .top-search input { height: 40px; }
  .top-right { gap: 4px; }
  .top-right .button { padding: 7px 12px; }
  .top-icon { display: none; }
  #toast, .undo-toast { bottom: calc(16px + var(--tabbar)); }
}

/* controls */
button, .button {
  font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); border-radius: 10px;
  padding: 8px 14px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: transform .12s, background .12s, border-color .12s, box-shadow .12s;
}
button:hover, .button:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
button:active, .button:active { transform: scale(.97); }
button.primary, .button.primary {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--accent-2))); color: var(--accent-text);
  border-color: transparent; box-shadow: 0 6px 20px -8px var(--accent);
}
button.primary:hover, .button.primary:hover { box-shadow: 0 8px 26px -6px var(--accent); }
button.danger { background: color-mix(in srgb, var(--danger) 18%, var(--panel)); border-color: color-mix(in srgb, var(--danger) 50%, transparent); color: var(--danger); }
button.big { padding: 11px 22px; font-size: 16px; border-radius: 12px; }
button.small { padding: 4px 10px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; transform: none; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 500; text-decoration: underline; text-underline-offset: 2px; box-shadow: none; }
.icon-btn { background: none; border: 0; padding: 2px 6px; color: var(--muted); font-size: 16px; line-height: 1; }
.icon-btn:hover { color: var(--text); }
input, textarea, select {
  font: inherit; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2); color: var(--text);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
textarea { min-height: 90px; resize: vertical; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.error { color: var(--danger); margin: 6px 0; }
.error:empty { display: none; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline input { flex: 1; min-width: 0; }
.inline select { width: auto; flex: 0 0 auto; }
.grow { flex: 1; }
.stack > * + * { margin-top: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.badge { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 99px; text-transform: uppercase; letter-spacing: .04em; }
.pill.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.pill.warn { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }

/* avatars */
.avatar {
  display: inline-grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: #fff; font-weight: 800; text-decoration: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .3); box-shadow: 0 0 0 2px var(--panel);
}
.avatar.xs { width: 20px; height: 20px; font-size: 11px; }
.avatar.sm { width: 28px; height: 28px; font-size: 13px; }
.avatar.md { width: 34px; height: 34px; font-size: 15px; }
.avatar.xl { width: 88px; height: 88px; font-size: 40px; box-shadow: 0 10px 30px -10px var(--accent); }
.who { font-weight: 700; color: var(--text); text-decoration: none; }
.who:hover { text-decoration: underline; }

/* account menu */
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; display: flex; }
.menu summary::-webkit-details-marker { display: none; }
.menu-items {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 180px; padding: 6px; display: grid; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.menu-items a, .menu-items button.link { padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; text-align: left; justify-content: flex-start; font-weight: 500; }
.menu-items a:hover, .menu-items button.link:hover { background: var(--panel-2); }

/* home */
.hero { text-align: center; padding: 34px 0 18px; }
.hero-title { text-wrap: balance; font-size: clamp(30px, 8vw, 56px); font-weight: 900; letter-spacing: -.035em; margin: 0 0 12px; }
.grad { background: linear-gradient(90deg, var(--accent), var(--accent-2) 60%, var(--warn)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { color: var(--muted); font-size: 17px; max-width: 620px; margin: 0 auto 24px; }
.prompt-hero { max-width: 760px; margin: 0 auto; text-align: left; }
.prompt-hero-box {
  display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; border-radius: 16px; background: #13131b; border: 1px solid #2c2c3a;
  box-shadow: 0 20px 60px -25px var(--accent), inset 0 1px 0 rgba(255, 255, 255, .04); font-family: var(--mono);
}
.prompt-hero-box:focus-within { border-color: var(--accent); }
.prompt-hero-box .caret { color: var(--accent-2); font-size: 18px; line-height: 1.6; }
textarea.big-prompt { border: 0; background: transparent; padding: 0; min-height: 0; font: 17px/1.6 var(--mono); color: #f1f1f6; resize: none; box-shadow: none; }
.prompt-hero-foot { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.chip { font-size: 13px; font-weight: 500; padding: 5px 11px; border-radius: 99px; background: var(--panel); color: var(--muted); }
.chip:hover { color: var(--text); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 34px 0 14px; }
.section-head h1, .section-head h2 { margin: 0; }
.tabs { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.tab { border: 0; background: none; padding: 5px 12px; font-size: 14px; color: var(--muted); box-shadow: none; }
.tab.on { background: var(--panel-2); color: var(--text); }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty-emoji { font-size: 48px; }

/* game cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.game-card {
  display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none;
  color: var(--text); transition: transform .15s, box-shadow .15s, border-color .15s;
}
.game-card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); box-shadow: 0 16px 40px -16px var(--accent); }
.cover { position: relative; aspect-ratio: 16 / 10; display: grid; place-items: center; overflow: hidden; }
.cover::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .04) 0 2px, transparent 2px 4px); }
.cover-emoji { font-size: 72px; filter: drop-shadow(0 6px 12px rgba(0, 0, 0, .35)); transition: transform .2s; position: relative; z-index: 1; }
.cover.small .cover-emoji { font-size: 40px; }
.game-card:hover .cover-emoji { transform: scale(1.12) rotate(-6deg); }
.game-card-body { padding: 12px 14px 14px; }
.game-card-title { font-weight: 800; font-size: 16px; display: flex; gap: 8px; align-items: center; overflow-wrap: anywhere; }
.game-card-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; font-size: 13px; color: var(--muted); }
.by { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.by .avatar { box-shadow: none; }
.stats { display: inline-flex; gap: 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stats .liked { color: var(--accent-2); }
.game-card-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.by { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* live previews: the cover stays underneath until the game has drawn */
.thumb { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #05050a; isolation: isolate; }
.thumb > .cover { position: absolute; inset: 0; aspect-ratio: auto; transition: opacity .5s var(--ease-out); }
.thumb-frame {
  position: absolute; top: 0; left: 0; width: 250%; height: 250%; transform: scale(.4); transform-origin: 0 0;
  border: 0; background: #000; pointer-events: none; user-select: none; opacity: 0; transition: opacity .5s var(--ease-out);
}
.thumb.live .thumb-frame { opacity: 1; }
.thumb.live > .cover { opacity: 0; }
/* a subtle CRT: scanlines and a soft vignette over the playing game */
.thumb::after {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0; transition: opacity .5s;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .18) 0 1px, transparent 1px 3px),
              radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, .55) 100%);
}
.thumb.live::after { opacity: 1; animation: crt-flicker 4s steps(2) infinite; }
@keyframes crt-flicker { 50% { opacity: .9; } }
.live-badge, .building-badge, .here-badge {
  position: absolute; z-index: 3; left: 10px; top: 10px; font: 700 11px/1 var(--mono); letter-spacing: .06em;
  padding: 5px 8px; border-radius: 99px; background: rgba(5, 5, 10, .7); color: var(--accent-3); backdrop-filter: blur(6px);
}
.live-badge { opacity: 0; transform: translateY(-4px); transition: opacity .3s, transform .3s var(--spring); }
.thumb.live .live-badge { opacity: 1; transform: none; }
.building-badge { color: var(--warn); top: auto; bottom: 10px; }
.here-badge { left: auto; right: 10px; display: inline-flex; align-items: center; gap: 2px; color: var(--text); }
.here-badge .dot-live { width: 6px; height: 6px; }
.thumb.building > .cover { filter: saturate(.55) brightness(.8); }
.game-card.playing {
  border-color: color-mix(in srgb, var(--accent-3) 55%, var(--line));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-3) 35%, transparent), 0 8px 20px -12px var(--accent-3);
}
.game-card.playing:hover { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-3) 50%, transparent), 0 10px 22px -12px var(--accent-3); }
.game-card:active { transform: translateY(-1px) scale(.99); }

/* cover pictures: the author's pick or a playtest screenshot, over the art */
.cover-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.cover.has-img::after { z-index: 2; background: linear-gradient(180deg, transparent 55%, rgba(5, 5, 10, .55)); }
.cover.has-img .cover-emoji { opacity: 0; }
.game-card:hover .cover-img { transform: scale(1.03); }
.cover-img { transition: transform .4s var(--ease-out); }
/* genre and status tags along the bottom of the cover */
.card-tags { position: absolute; z-index: 3; left: 10px; right: 10px; bottom: 10px; display: flex; gap: 6px; flex-wrap: wrap; pointer-events: none; transition: opacity .3s; }
.tag { display: inline-flex; align-items: center; gap: 2px; font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 99px;
  background: rgba(10, 10, 16, .72); color: #f1f1f6; backdrop-filter: blur(6px); white-space: nowrap; }
.thumb.live .card-tags { opacity: 0; }
.thumb .building-badge ~ .card-tags { bottom: 38px; }
.game-card-desc { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.game-card-meta .by { padding: 3px 10px 3px 3px; border-radius: 99px; background: var(--panel-2); color: var(--text); font-weight: 600; }
.stat-ico { font-size: .85em; opacity: .85; }

/* the cover picker in the share card */
.cover-pick { display: flex; gap: 14px; align-items: center; margin: 14px 0; }
.cover-pick-img { flex: none; width: 140px; border-radius: 10px; overflow: hidden; }
.cover-pick-label { font-weight: 700; }
.cover-pick p { margin: 2px 0 8px; font-size: 13px; }
.cover-pick .inline { flex-wrap: wrap; gap: 8px; }
.cover-pick button { white-space: nowrap; }

/* home: the prompt, then a light preview of a few big covers */
.home-hero { padding-top: 7vh; }
.home-preview { margin: 56px 0 10px; }
.home-preview-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.home-preview-head h2 { margin: 0; font-size: 18px; color: var(--muted); font-weight: 600; }
.see-all { font-weight: 700; text-decoration: none; white-space: nowrap; }
.see-all:hover { text-decoration: underline; }
.home-preview-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.preview-tile { position: relative; display: block; border-radius: 20px; overflow: hidden; color: #fff; text-decoration: none; isolation: isolate;
  transition: transform .2s var(--ease-out), box-shadow .2s; }
.preview-tile .cover { aspect-ratio: 4 / 5; }
.preview-tile .cover.has-img::after { background: linear-gradient(180deg, transparent 50%, rgba(5, 5, 10, .85)); }
.preview-tile:hover { transform: translateY(-4px); box-shadow: 0 18px 40px -18px var(--accent); }
.preview-tile:hover .cover-img { transform: scale(1.04); }
.preview-tile-text { position: absolute; z-index: 3; left: 14px; right: 14px; bottom: 12px; }
.preview-tile-title { font-weight: 700; font-size: 17px; text-shadow: 0 1px 8px rgba(0, 0, 0, .6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-tile-by { display: flex; align-items: center; gap: 6px; font-size: 13px; opacity: .85; margin-top: 2px; }
@media (max-width: 800px) { .home-preview-row { grid-template-columns: repeat(2, 1fr); } }

/* the arcade page: categories, a sort, and big portrait cover cards. It
   uses the full width of the window, past the page column. */
.arcade-page { margin-inline: calc(50% - min(1000px, 50vw - var(--rail-w, 0px) / 2 - 24px)); }
.arcade-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin: 8px 0 18px; }
.arcade-back { justify-self: start; color: var(--text); font-weight: 600; text-decoration: none; font-size: 16px; }
.arcade-back:hover { color: var(--accent); }
.arcade-title { margin: 0; font-size: 22px; text-align: center; }
.arcade-sort { justify-self: end; width: auto; min-width: 180px; text-align: left; appearance: none; padding: 9px 40px 9px 18px; border-radius: 10px; border: 0; font: 600 15px system-ui, sans-serif; color: #fff; cursor: pointer;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='white' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 14px center; }
.cats { display: flex; gap: 8px; align-items: center; justify-content: safe center; overflow-x: auto; scrollbar-width: none; padding: 4px 4px 14px; margin: 0 0 18px; border-bottom: 1px solid var(--line); }
.cats::-webkit-scrollbar { display: none; }
.cat { flex: none; display: flex; flex-direction: column; align-items: center; gap: 8px; width: 104px; color: var(--text); text-decoration: none; font-size: 13.5px; }
.cat-ico { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; font-size: 28px; background: var(--panel-2);
  transition: background .15s, transform .15s, box-shadow .15s; }
.cat:hover .cat-ico { transform: translateY(-2px); background: color-mix(in srgb, var(--accent) 25%, var(--panel-2)); }
.cat.on .cat-ico { background: color-mix(in srgb, var(--accent) 45%, var(--panel-2)); box-shadow: 0 0 0 2px var(--accent); }
.cat.on .cat-label { color: color-mix(in srgb, var(--accent) 55%, #fff); font-weight: 600; }
.cat-label { text-align: center; white-space: nowrap; }
.cat-sep { flex: none; width: 1px; height: 40px; margin: 0 6px 22px; background: var(--line); }
.arcade-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.arcade-grid .game-card { border-radius: 26px; }
.arcade-grid .thumb { aspect-ratio: 4 / 5; border-radius: 26px 26px 0 0; }
.arcade-grid .game-card-body { padding: 14px 18px 16px; }
.arcade-grid .game-card-title { font-size: 18px; font-weight: 600; }
.arcade-grid .game-card-meta { margin-top: 12px; }
@media (max-width: 600px) {
  .arcade-page { margin-inline: 0; }
  .arcade-head { grid-template-columns: 1fr auto; }
  .arcade-title { display: none; }
  .arcade-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .arcade-grid .game-card-desc, .arcade-grid .stats span:nth-child(n+2) { display: none; }
  .arcade-grid .game-card-body { padding: 10px 12px 12px; }
  .arcade-grid .game-card-title { font-size: 15px; }
  .cat { width: 80px; font-size: 12px; }
  .cat-ico { width: 54px; height: 54px; font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) { .game-card:hover, .preview-tile:hover { transform: none; } }

/* profile and account */
.profile { display: flex; align-items: center; gap: 22px; padding: 20px 0 6px; flex-wrap: wrap; }
.profile h1 { margin: 0; }
.profile p { margin: 2px 0 0; }
.profile > .button { margin-left: auto; }
.profile-stats { display: flex; gap: 22px; margin-top: 10px; }
.profile-stats div { display: grid; }
.profile-stats strong { font-size: 22px; }
.profile-stats span { color: var(--muted); font-size: 13px; }
.status-card { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 18px 0; padding: 14px 16px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.status-card p { margin: 0; flex: 1; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 800px) { .options { grid-template-columns: 1fr; } }

/* auth and new game */
.auth { max-width: 400px; margin: 30px auto; text-align: center; }
.auth .card { text-align: left; margin-top: 18px; }
.auth-art { font-size: 56px; }
.new-game { max-width: 780px; margin: 10px auto; }
.new-game h1 { font-size: 36px; font-weight: 900; }
.title-row { max-width: 760px; margin: 12px auto 0; }

/* game page */
.game-head { margin-bottom: 14px; }
.game-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.game-title-row h1 { font-size: 32px; font-weight: 900; margin: 0; overflow-wrap: anywhere; }
.rename-form { flex: 1; max-width: 560px; }
.rename { font-size: 20px; font-weight: 700; }
.game-byline { display: flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--muted); flex-wrap: wrap; }
.player-box { position: relative; }
.player {
  width: 100%; aspect-ratio: 16 / 10; border: 0; border-radius: var(--radius); background: #000; display: block;
  box-shadow: 0 0 0 1px var(--line), 0 24px 70px -24px var(--accent);
}
.empty-player { background: radial-gradient(circle at 50% 40%, #241a4a, #07070c 70%); }
.build-overlay {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; padding: 20px; text-align: center;
  color: #f1f1f6; text-decoration: none; border-radius: var(--radius); font-family: var(--mono);
}
.build-overlay[hidden] { display: none; }
.build-overlay.corner {
  inset: auto 12px 12px auto; max-width: min(420px, calc(100% - 24px)); display: block; text-align: left; padding: 10px 14px;
  background: rgba(10, 10, 16, .82); border: 1px solid #2c2c3a; backdrop-filter: blur(6px); border-radius: 12px;
}
.overlay-title { font-weight: 800; font-size: 17px; font-family: system-ui, sans-serif; }
.build-overlay.corner .overlay-title { font-size: 14px; }
.overlay-line { color: #a9a9bd; font-size: 13px; max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.build-overlay:not(.corner) .overlay-line { white-space: normal; overflow-wrap: anywhere; }
.overlay-hint { color: #d97757; font-size: 12px; }
.action { padding: 7px 13px; border-radius: 99px; background: var(--panel); }
.action.like.on { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent-2) 50%, var(--line)); }
.action.like.pop { animation: pop .35s ease; }
@keyframes pop { 50% { transform: scale(1.25); } }
.plays { color: var(--muted); font-size: 14px; margin-left: auto; }
.game-desc { padding: 12px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.prompt-label { font-size: 12px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.prompt-text { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.game-desc.open .prompt-text { display: block; }
.prompt-tools { display: flex; gap: 14px; margin-top: 6px; font-size: 13px; }
.game-desc:empty { display: none; }
.segmented { display: flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.segmented button { flex: 1; border: 0; background: none; box-shadow: none; padding: 6px 4px; font-size: 13px; color: var(--muted); }
.segmented button.on { background: var(--panel-2); color: var(--text); }
.collabs { display: flex; gap: 6px; flex-wrap: wrap; }
.collab { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 4px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; }
.versions { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.versions li { padding: 10px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.version-top { display: flex; align-items: center; gap: 8px; }
.vnum { font: 800 14px var(--mono); }
.version-note { margin: 2px 0; }
.version-actions { font-size: 13px; color: var(--muted); }
.changes-dialog { width: min(1000px, 100%); }
.changes-dialog .cmp-head { margin-bottom: 4px; }
.changes-note { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0 0 10px; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.changes-note .v-who { display: inline-flex; align-items: center; gap: 4px; color: var(--text); }
.changes-body .patch { max-height: none; }
.changes-body .files { list-style: none; padding: 0; margin: 6px 0; font-family: var(--mono); font-size: 12px; }
.changes-body .add, .patch .add { color: var(--ok); }
.changes-body .del, .patch .del { color: var(--danger); }
.patch { max-height: 360px; overflow: auto; font: 12px/1.45 var(--mono); background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; }
.patch-file + .patch-file { border-top: 1px solid var(--line); }
.patch-head { position: sticky; top: 0; display: flex; justify-content: space-between; gap: 8px; padding: 6px 8px; background: var(--panel-2); border-bottom: 1px solid var(--line); font-weight: 700; }
.patch-head .path { min-width: 0; overflow-wrap: anywhere; }
.patch-head .nums { flex-shrink: 0; }
.patch-body { margin: 0; padding: 6px 8px; font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; }
.patch .hunk { color: var(--muted); font-style: italic; }

/* chat */
.chat-list {
  list-style: none; padding: 16px 0 0; margin: 0 0 12px; max-height: 360px; overflow-y: auto; font-size: 14px;
  /* Rows scrolled up fade out under the heading instead of being cut in half. */
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 18px); mask-image: linear-gradient(to bottom, transparent, #000 18px);
}
.chat-list li { padding: 4px 0; overflow-wrap: anywhere; }
.chat-list li.message { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; }
.bubble { min-width: 0; flex: 1; }
.bubble-head { display: flex; align-items: center; gap: 6px; }
.bubble .text { white-space: pre-wrap; }
.chat-list .when { font-size: 12px; color: var(--muted); font-weight: 400; }
.chat-list .msg-tools { margin-left: auto; display: flex; align-items: center; gap: 2px; flex: none; }
.chat-list .del, .chat-list .rx-add, .chat-list .reply-btn { visibility: hidden; }
.chat-list .del:focus, .chat-list li.tapped .del, .chat-list .reply-btn:focus-visible, .chat-list li.tapped .reply-btn,
.chat-list .rx-add:focus-visible, .chat-list li.tapped .rx-add, .chat-list li.picking .rx-add { visibility: visible; }
/* Touch screens keep :hover where the last tap was, so they go by taps. */
@media (hover: hover) { .chat-list li:hover .del, .chat-list li:hover .rx-add, .chat-list li:hover .reply-btn { visibility: visible; } }
.chat-list .reply-btn { font-size: 14px; padding: 3px 7px; border-radius: 99px; }
.chat-list .reply-btn:hover { background: var(--panel-2); }
/* @mentions, and comments that mention the viewer */
.mention { color: var(--accent); font-weight: 600; text-decoration: none; border-radius: 4px; padding: 0 2px; }
.mention.me { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--text); }
.chat-list li.message.mentioned { background: color-mix(in srgb, var(--accent) 9%, transparent); box-shadow: inset 3px 0 0 var(--accent); border-radius: 8px; padding-left: 8px; padding-right: 4px; }
/* replies: the answered comment, quoted short; clicking it goes there */
.reply-quote {
  display: block; width: 100%; text-align: left; margin: 3px 0 2px; padding: 3px 8px; font: inherit; font-size: 12.5px; font-weight: 400;
  color: var(--muted); background: var(--panel-2); border: 0; border-left: 3px solid color-mix(in srgb, var(--accent) 60%, var(--line)); border-radius: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
}
button.reply-quote:hover { color: var(--text); }
.reply-quote strong { color: var(--text); font-weight: 600; }
.reply-quote.gone { font-style: italic; cursor: default; }
.chat-list li.message.flash { animation: msg-flash 1.6s var(--ease-out); }
@keyframes msg-flash { 0%, 30% { background: color-mix(in srgb, var(--accent) 30%, transparent); } 100% { background: transparent; } }
.reply-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; padding: 4px 4px 4px 10px; font-size: 13px; background: var(--panel-2); border-left: 3px solid var(--accent); border-radius: 6px; }
.reply-bar[hidden] { display: none; }
.reply-bar-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* The message box grows as you type, up to about eight lines. */
.chat-form { position: relative; align-items: flex-end; }
.chat-input { flex: 1; min-width: 0; min-height: 0; max-height: 200px; resize: none; overflow-y: auto; font: inherit; font-size: 14px; line-height: 1.45; padding: 8px 12px; }
.mention-pop {
  position: absolute; left: 0; bottom: calc(100% + 6px); z-index: 20; list-style: none; margin: 0; padding: 4px; min-width: 180px; max-width: 100%;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
}
.mention-pop[hidden] { display: none; }
.mention-pop li { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.mention-pop li.on { background: color-mix(in srgb, var(--accent) 22%, var(--panel-2)); }
.mention-pop .avatar { pointer-events: none; }
.mention-pop .request-icon { background: var(--panel-2); font-size: 12px; }
.mention-pop li .muted { margin-left: auto; padding-left: 10px; font-size: 12px; }
.request-sent { margin-top: 4px; font-size: 12px; color: var(--muted); }
.notify-banner { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 6px 6px 6px 10px; font-size: 13px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
.notify-banner span { flex: 1; }
/* reactions: chips under a comment, and the picker that adds one */
.chat-list .rx-add { font-size: 13px; padding: 3px 7px; border-radius: 99px; white-space: nowrap; }
.chat-list .rx-add:hover, .chat-list li.picking .rx-add { background: var(--panel-2); }
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.reactions[hidden], .rx-picker [hidden] { display: none; }
.rx-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px 1px 7px; border: 1px solid var(--line); border-radius: 99px;
  background: var(--panel-2); color: var(--text); font: inherit; font-size: 13px; line-height: 22px; font-weight: 400;
}
button.rx-chip:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.rx-chip.mine { background: color-mix(in srgb, var(--accent) 22%, var(--panel-2)); border-color: color-mix(in srgb, var(--accent) 70%, var(--line)); }
.rx-emoji { font-size: 15px; line-height: 1; }
.rx-count { font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.rx-chip.mine .rx-count { color: var(--text); }
/* Eight quick emoji and "more" on one row; more adds a second row of eight. */
.rx-picker {
  display: grid; grid-template-columns: repeat(8, minmax(26px, 30px)) minmax(18px, 22px); gap: 2px;
  width: fit-content; max-width: 100%; margin-top: 6px; padding: 4px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); animation: line-in .15s var(--ease-out);
}
.rx-picker button { width: 100%; height: 32px; padding: 0; border: 0; border-radius: 8px; background: none; font-size: 18px; line-height: 1; }
.rx-picker button:focus-visible, .rx-picker .rx-more[aria-expanded="true"] { background: var(--line); }
@media (hover: hover) { .rx-picker button:hover { background: var(--line); } }
.rx-picker .rx-more { font-size: 16px; color: var(--muted); }
.chat-list li.activity, .chat-list li.activity-group { text-align: center; }
.chat-list .activity-group .event { font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--muted); }
.chat-list .activity-group .event:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.chat-list .activity-group.open .event { color: var(--text); }
.chat-list .event { display: inline-block; font-size: 12px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); border-radius: 99px; padding: 2px 10px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; pointer-events: none; z-index: 50;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line); padding: 10px 18px; border-radius: 99px; font-weight: 600;
  box-shadow: 0 14px 40px -10px var(--accent); transition: opacity .2s, transform .2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Agent session: a terminal-style transcript, dark in both themes. */
.session {
  --t-bg: #111117; --t-text: #e4e4e8; --t-muted: #8c8c96; --t-line: #2a2a33;
  --t-accent: #d97757; --t-ok: #4cc38a; --t-err: #ef6b6b; --t-prompt: #1d1d25;
  margin-top: 18px; background: var(--t-bg); color: var(--t-text); border-color: var(--t-line);
  font: 13px/1.55 var(--mono);
}
.session { background: #07070b; border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); box-shadow: 0 0 0 1px #000, 0 24px 60px -28px var(--accent); }
.session-head { display: flex; align-items: center; gap: 12px; margin: -16px -16px 12px; padding: 10px 14px; border-bottom: 1px solid var(--t-line); background: #101016; border-radius: var(--radius) var(--radius) 0 0; }
.session-head h2 { margin: 0; font: 600 13px var(--mono); color: var(--t-text); flex: 1; }
.live-note { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }

.session .muted, .session .t-note, .session .billed { color: var(--t-muted); }
.session a:not(.avatar), .session button.link { color: var(--t-accent); }
.transcript { max-height: 520px; overflow-y: auto; padding-right: 4px; }
.t-empty { color: var(--t-muted); padding: 6px 0; }
.t-empty[hidden] { display: none; }
.turn { padding: 4px 0 12px; }
.turn + .turn { border-top: 1px solid var(--t-line); padding-top: 12px; }
.t-prompt { display: flex; gap: 8px; align-items: flex-start; background: var(--t-prompt); border-left: 3px solid var(--t-accent); border-radius: 6px; padding: 7px 10px; margin-bottom: 8px; }
.t-prompt .avatar { box-shadow: none; margin-top: 1px; }
.t-prompt .who { font-weight: 700; color: var(--t-accent); }
.billed { font-size: 12px; }
.caret { color: var(--t-muted); flex: 0 0 auto; }
.t-text, .t-args, .t-thinking-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.t-line { display: flex; gap: 8px; padding: 3px 0; }
.t-line > div { min-width: 0; overflow-wrap: anywhere; }
.dot { flex: 0 0 auto; color: var(--t-text); }
.t-tool .dot { color: var(--t-ok); }
.t-tool.running .dot { color: var(--t-accent); animation: blink 1s steps(2, start) infinite; }
.t-tool.error .dot, .t-error, .t-error .dot { color: var(--t-err); }
.t-tool.stopped .dot { color: var(--t-muted); }
.t-out { position: relative; padding: 0 0 4px 34px; color: var(--t-muted); }
.t-out::before { content: "⎿"; position: absolute; left: 14px; top: 0; }
.t-out pre { margin: 0; font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; }
.t-out button.more { font-size: 12px; color: var(--t-muted); }
.t-fold summary { cursor: pointer; list-style: none; padding: 3px 0; color: var(--t-muted); }
.t-fold summary::-webkit-details-marker { display: none; }
.t-fold summary::after { content: " (click to expand)"; font-size: 12px; }
.t-fold[open] summary::after { content: ""; }
.t-thinking { font-style: italic; }
.t-thinking-body { color: var(--t-muted); font-style: italic; padding: 0 0 6px 14px; border-left: 2px solid var(--t-line); margin-left: 4px; }
.t-done { color: var(--t-muted); padding-top: 6px; }
.t-done.ok { color: var(--t-ok); }
.t-working { color: var(--t-accent); padding-top: 6px; }
.t-fail { margin-top: 6px; padding: 10px 12px; border-radius: 8px; background: rgba(239, 107, 107, .1); border: 1px solid rgba(239, 107, 107, .35); color: var(--t-err); }
.t-fail .t-text { color: var(--t-text); margin-top: 2px; }
.t-actions { display: inline-flex; gap: 14px; margin-top: 6px; }
.t-fail .t-actions { display: flex; }
.spinner { display: inline-block; width: 1em; text-align: center; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { to { visibility: hidden; } }
.prompt-row { display: flex; align-items: flex-start; gap: 8px; margin-top: 12px; border: 1px solid var(--t-line); border-radius: 10px; padding: 8px 8px 8px 12px; background: #0b0b10; }
.prompt-row:focus-within { border-color: var(--t-accent); }
.prompt-row .caret { padding-top: 3px; color: var(--t-accent); }
.prompt-row textarea { min-height: 0; flex: 1; border: 0; padding: 3px 0; background: transparent; color: var(--t-text); font: inherit; resize: vertical; box-shadow: none; }
.prompt-row button[hidden], .prompt-row[hidden], .session[hidden] { display: none; }
.session .drafts { margin-top: 10px; }
.drafts:empty { display: none; }
.drafts { display: grid; gap: 8px; }
.draft { font-size: 12px; padding: 8px 10px; border: 1px dashed var(--t-line); border-radius: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.draft .avatar { box-shadow: none; }
.draft-text { flex-basis: 100%; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--t-text); }
.typing { display: inline-flex; gap: 3px; }
.typing i { width: 4px; height: 4px; border-radius: 50%; background: var(--t-muted); animation: bounce 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 50% { transform: translateY(-3px); opacity: .5; } }
.session .error { color: var(--t-err); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (max-width: 600px) { .session-head .muted { display: none; } .plays { margin-left: 0; } }

.dot-live { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); animation: pulse 2s infinite; flex: 0 0 auto; }
@keyframes pulse { 50% { opacity: .45; } }
.new-chip { font-size: 12px; font-weight: 700; color: var(--accent-3); }

/* version actions as pills */
.version-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; font-size: 0; }
.version-actions a, .version-actions button.link { font-size: 12px; font-weight: 600; text-decoration: none; padding: 2px 9px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); }
.version-actions a:hover, .version-actions button.link:hover { border-color: var(--accent); }
.version-actions button.restore { color: var(--accent-2); }
.versions li.live { border-left: 3px solid var(--ok); padding-left: 10px; margin-left: -13px; }

/* home live feed */
.live-feed { margin-top: 40px; }
.live-feed h2 { display: flex; align-items: center; gap: 10px; }
.live-feed ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; }
.live-feed li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; }
.live-feed li:hover { background: var(--panel-2); }
.live-feed li > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.live-feed li a:not(.avatar):not(.who) { font-weight: 700; text-decoration: none; }
.live-feed .when { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* presence and remixes */
.stack-avatars { display: inline-flex; }
.stack-avatars .avatar + .avatar { margin-left: -6px; }
.remixes:empty { display: none; }
.remixes h2 { margin-top: 4px; }
.remix-strip { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.remix-tile { flex: 0 0 150px; text-decoration: none; color: var(--text); font-size: 13px; }
.remix-tile .cover { border-radius: 10px; }
.remix-title { font-weight: 700; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* the game is loading */
.player-wrap.loading .player { background: linear-gradient(110deg, #0b0b12 30%, #1c1830 50%, #0b0b12 70%) 0 0 / 300% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -300% 0; } }

@media (max-width: 600px) {
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .chip { white-space: nowrap; }
  .prompt-hero-foot .big { width: 100%; }
}
.t-line.t-note { color: var(--t-muted); font-style: italic; }

/* ---- motion ---- */
:root { --ease-out: cubic-bezier(.2, .8, .2, 1); --spring: cubic-bezier(.34, 1.56, .64, 1); }
#app > * { animation: rise .35s var(--ease-out) both; }
#app > *:nth-child(2) { animation-delay: .04s; }
#app > *:nth-child(3) { animation-delay: .08s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.turn > .enter { animation: line-in .28s var(--ease-out) both; }
@keyframes line-in { from { opacity: 0; transform: translateY(4px); } }
.t-working { display: flex; align-items: baseline; gap: 0; white-space: nowrap; }
.t-working .verb { display: inline-block; margin-left: 6px; }
.t-working .verb.swap { animation: verb-in .3s var(--ease-out); }
@keyframes verb-in { from { opacity: 0; transform: translateY(5px); filter: blur(2px); } }
.t-working .elapsed, .t-working .hint { color: var(--t-muted); }
.t-working .elapsed { margin-left: 6px; font-variant-numeric: tabular-nums; }
.spinner { color: var(--t-accent); }
.t-tool.running .dot { animation: glow 1.2s ease-in-out infinite; }
@keyframes glow { 50% { opacity: .25; transform: scale(.8); } }
.player-wrap { position: relative; }
.player-wrap .player + .player { position: absolute; inset: 0; }
.player { transition: opacity .45s var(--ease-out); }
.player.fresh { opacity: 0; }
.build-overlay { animation: fade-in .3s var(--ease-out); transition: opacity .3s, transform .3s; }
.build-overlay.out { opacity: 0; transform: translateY(6px); pointer-events: none; }
@keyframes fade-in { from { opacity: 0; } }
.build-overlay.corner { animation: pop-in .35s var(--spring); }
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(.96); } }
.burst { position: absolute; left: 50%; top: 50%; pointer-events: none; z-index: 5; }
.burst i { position: absolute; width: 9px; height: 9px; border-radius: 2px; background: var(--c); transform: rotate(var(--r)); animation: spark 1.1s var(--ease-out) forwards; }
@keyframes spark { to { transform: translate(var(--x), var(--y)) rotate(calc(var(--r) + 220deg)) scale(.4); opacity: 0; } }
.game-card .cover-emoji, .action, button, .button { will-change: transform; }
.action.like.on { animation: none; }
.action.like.pop { animation: pop .4s var(--spring); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:focus:not(:focus-visible) { outline: none; }
.toast-enter { animation: pop-in .3s var(--spring); }
#toast { transition: opacity .25s, transform .35s var(--spring); }
.draft { animation: fade-in .25s var(--ease-out); }
.chat-list li { animation: line-in .25s var(--ease-out); }
.versions li { transition: background .2s; }
.versions li.live { animation: fade-in .4s; }
.prompt-row { transition: border-color .2s, box-shadow .2s; }
.prompt-row:focus-within { box-shadow: 0 0 0 3px rgba(217, 119, 87, .18); }
.prompt-hero-box { transition: border-color .2s, box-shadow .3s; }
.prompt-hero-box:focus-within { box-shadow: 0 24px 70px -22px var(--accent), 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }

/* Session, Claude Code style: prose for the agent, prompts as bubbles,
   tool calls folded into one-line summaries, a composer with the stop
   button inside it. Mono only where it's code. */
.session { font: 14px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif; background: #0c0c11; padding-bottom: 12px; }
.session-head { gap: 10px; background: #111118; }
.session-head h2 { font: 600 14px system-ui, sans-serif; }
.session-head h2 .muted { font-weight: 400; font-size: 13px; }
.agent-mark { color: var(--t-accent); font-size: 16px; }
.state-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: #1b1b24; color: var(--t-muted); border: 1px solid var(--t-line); }
.state-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--t-muted); }
.state-chip[data-state=working] { color: var(--t-accent); border-color: rgba(217, 119, 87, .4); }
.state-chip[data-state=working] i { background: var(--t-accent); animation: pulse 1.2s infinite; }
.state-chip[data-state=idle] i { background: var(--t-ok); }
.state-chip.pop { animation: pop-in .3s var(--spring); }
.transcript { padding: 4px 6px 0 2px; scroll-behavior: auto; }
.turn { padding: 6px 0 16px; }
.turn + .turn { border-top: 0; padding-top: 6px; }
.t-prompt, .t-prompt.mine { display: flex; flex-direction: column; align-items: flex-end; background: none; border: 0; padding: 0; margin: 4px 0 12px; gap: 4px; }
.t-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.t-meta .who { color: var(--t-text); }
.t-prompt .bubble { max-width: min(560px, 88%); background: #23232e; border: 1px solid #2e2e3a; border-radius: 16px 16px 4px 16px; padding: 9px 14px; color: var(--t-text); }
.t-prompt:not(.mine) .bubble { border-color: color-mix(in srgb, var(--accent) 35%, #2e2e3a); }
.t-message { padding: 4px 0 8px; color: var(--t-text); }
.t-group { margin: 2px 0 6px; }
.t-group summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: var(--t-muted); font-size: 13.5px; padding: 3px 8px 3px 0; border-radius: 6px; transition: color .15s; }
.t-group summary::-webkit-details-marker { display: none; }
.t-group summary:hover { color: var(--t-text); }
.t-group .chev { display: inline-block; transition: transform .2s var(--ease-out); font-size: 15px; }
.t-group[open] .chev { transform: rotate(90deg); }
.t-group.now summary { color: var(--t-text); }
.t-group-now code { font-family: var(--mono); font-size: 12.5px; background: #1b1b24; color: var(--t-muted); padding: 1px 6px; border-radius: 5px; }
.t-failed { color: var(--t-err); }
.t-group-body { margin: 4px 0 6px 3px; padding: 6px 10px; border-left: 2px solid var(--t-line); font: 12.5px/1.55 var(--mono); animation: line-in .2s var(--ease-out); }
.t-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 4px 11px; border-radius: 99px; border: 1px solid var(--t-line); background: #15151c; color: var(--t-muted); }
.t-chip.ok { color: var(--t-ok); border-color: rgba(76, 195, 138, .35); }
.t-working { font-size: 13.5px; }
.composer { position: relative; align-items: flex-end; border-radius: 16px; padding: 10px 10px 10px 16px; background: #14141b; border-color: #2c2c37; margin-top: 10px; }
.composer textarea { font: 14px/1.55 system-ui, sans-serif; resize: none; max-height: 220px; field-sizing: content; }
.composer.busy { border-color: rgba(217, 119, 87, .45); }
.composer-btns { display: flex; }
.send-btn, .stop-btn { width: 32px; height: 32px; border-radius: 50%; padding: 0; font-size: 17px; font-weight: 800; }
.send-btn { background: var(--t-accent); color: #fff; border: 0; transition: transform .15s var(--spring), opacity .15s; }
.send-btn:hover { transform: scale(1.08); }
.send-btn:active { transform: scale(.92); }
.send-btn:disabled { opacity: .45; transform: none; }
.stop-btn { background: transparent; border: 2px solid var(--t-text); display: grid; place-items: center; animation: pop-in .25s var(--spring); }
.stop-btn i { width: 10px; height: 10px; border-radius: 2px; background: var(--t-text); }
.stop-btn:hover { border-color: var(--t-err); }
.stop-btn:hover i { background: var(--t-err); }
.stop-btn.stopping { opacity: .5; animation: pulse 1s infinite; }
.composer-foot { display: flex; justify-content: space-between; gap: 10px; padding: 6px 6px 0; font-size: 12px; color: var(--t-muted); }
.composer-foot[hidden] { display: none; }
.composer-foot a { color: var(--t-muted); }
kbd { font: 11px var(--mono); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--t-line, #333); background: #1b1b24; }
@media (max-width: 600px) { .composer-foot > span { display: none; } }
.overlay-title .elapsed { color: #a9a9bd; font-weight: 500; font-variant-numeric: tabular-nums; margin-left: 4px; }
.overlay-line.swap { animation: verb-in .25s var(--ease-out); }
.build-overlay.corner { width: min(420px, calc(100% - 24px)); justify-items: start; }
.overlay-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; overflow: hidden; border-radius: 0 0 var(--radius) var(--radius); }
.overlay-bar::after { content: ""; position: absolute; inset: 0; width: 40%; background: linear-gradient(90deg, transparent, var(--accent-2), var(--accent), transparent); animation: indeterminate 1.6s var(--ease-out) infinite; }
@keyframes indeterminate { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.build-overlay:not(.corner) .overlay-bar { border-radius: 0 0 var(--radius) var(--radius); }
.t-working .hint { margin-left: 6px; }
.t-working .tokens { margin-left: 6px; color: var(--t-muted); font-variant-numeric: tabular-nums; cursor: help; }
.t-chip[title], .t-tokens[title] { cursor: help; }
.t-tokens { margin-top: 4px; font-size: 12.5px; color: var(--t-muted); }
.shimmer-text { background: linear-gradient(90deg, var(--t-muted) 0%, var(--t-text) 45%, var(--t-muted) 90%) 0 0 / 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer-text 1.8s linear infinite; }
@keyframes shimmer-text { from { background-position: 120% 0; } to { background-position: -100% 0; } }

/* Sign-up and connecting ChatGPT */
.auth-tabs { margin-bottom: 4px; }
.peek-wrap { position: relative; }
.peek-wrap input { padding-right: 40px; }
.peek { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); font-size: 15px; }
.onboard { max-width: 640px; margin: 24px auto; text-align: center; }
.onboard .connect { text-align: left; margin-top: 18px; }
.center { text-align: center; }
.connect { display: grid; gap: 14px; }
.connect-card h2 { margin-top: 0; }
.step { display: flex; gap: 12px; align-items: flex-start; }
.step-n { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 6px 16px -6px var(--accent); }
.step p { margin: 2px 0 8px; font-size: 14px; }
.grow { flex: 1; min-width: 0; }
.os-tabs { max-width: 280px; margin-bottom: 8px; }
.cmd-row { display: flex; gap: 8px; align-items: center; background: #0b0b10; border: 1px solid var(--line); border-radius: 10px; padding: 8px 8px 8px 12px; }
.cmd { flex: 1; min-width: 0; background: none; padding: 0; font-size: 12.5px; white-space: nowrap; overflow-x: auto; color: var(--text); scrollbar-width: thin; }
.copy-btn.done { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.drop-zone { margin-top: 6px; border: 1.5px dashed var(--line); border-radius: 12px; padding: 10px; transition: border-color .2s, background .2s, box-shadow .3s; }
.drop-zone.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.drop-zone.working { border-style: solid; border-color: var(--accent); animation: pulse 1s infinite; }
.drop-zone.ok { border-style: solid; border-color: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 18%, transparent); }
.drop-zone.bad { animation: shake .35s; border-color: var(--danger); }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.paste-box { width: 100%; border: 0; background: transparent; font: 13px var(--mono); resize: none; box-shadow: none; padding: 4px; min-height: 0; }
.paste-box:focus { outline: none; box-shadow: none; }
.drop-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.connect-btn { margin-left: auto; }
.fine { font-size: 12.5px; margin: 0; }
.api-alt > summary { cursor: pointer; font-weight: 600; color: var(--muted); list-style: none; }
.api-alt > summary::-webkit-details-marker { display: none; }
.api-alt > summary::before { content: "› "; display: inline-block; transition: transform .2s; }
.api-alt[open] > summary::before { transform: rotate(90deg); }
.api-alt[open] > summary { margin-bottom: 12px; }
.auth form > button[type=submit] { width: 100%; }
.api-alt > summary::before { margin-right: 6px; }
.oauth { display: grid; justify-items: center; gap: 12px; padding: 8px 0 4px; text-align: center; position: relative; }
.oauth-btn { min-width: 280px; font-size: 17px; }
.oai { font-size: 18px; margin-right: 2px; }
.oauth-step { font-weight: 600; }
.user-code { display: flex; align-items: center; gap: 4px; font: 800 30px var(--mono); letter-spacing: .06em; }
.user-code span { display: inline-block; min-width: .8em; padding: 6px 4px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); animation: pop-in .35s var(--spring) both; animation-delay: calc(var(--i) * 35ms); }
.user-code .copy-btn { margin-left: 10px; font: 600 13px system-ui, sans-serif; letter-spacing: 0; }
.oauth-status { color: var(--muted); display: flex; align-items: center; gap: 6px; }
.oauth-status .spinner { color: var(--accent); }
.oauth-status.ok { color: var(--ok); font-weight: 700; animation: pop-in .3s var(--spring); }

/* ---- fullscreen from the preview ---- */
.fs-btn {
  position: absolute; top: 10px; right: 10px; z-index: 4; width: 38px; height: 38px; padding: 0; border-radius: 11px;
  background: rgba(10, 10, 16, .72); border: 1px solid rgba(255, 255, 255, .16); color: #fff; backdrop-filter: blur(6px);
  opacity: 0; transform: translateY(-4px) scale(.9);
  transition: opacity .2s var(--ease-out), transform .3s var(--spring), border-color .15s, box-shadow .2s;
}
.fs-btn[hidden] { display: none; }
.fs-host:hover > .fs-btn, .fs-btn:focus-visible { opacity: 1; transform: none; }
.fs-btn:hover { border-color: var(--accent); box-shadow: 0 6px 22px -6px var(--accent); transform: scale(1.08); }
@media (hover: none) { .fs-btn { opacity: .92; transform: none; } }
/* four corner brackets, drawn so no icon font is needed */
.fs-ico {
  display: block; width: 16px; height: 16px; margin: auto; --c: linear-gradient(currentColor, currentColor);
  background: var(--c) 0 0 / 6px 2px no-repeat, var(--c) 0 0 / 2px 6px no-repeat, var(--c) 100% 0 / 6px 2px no-repeat, var(--c) 100% 0 / 2px 6px no-repeat,
    var(--c) 0 100% / 6px 2px no-repeat, var(--c) 0 100% / 2px 6px no-repeat, var(--c) 100% 100% / 6px 2px no-repeat, var(--c) 100% 100% / 2px 6px no-repeat;
  transition: transform .3s var(--spring);
}
.fs-btn:hover .fs-ico { transform: scale(1.15); }
.is-fs .fs-ico { transform: scale(.75); }
.fs-host.is-fs { background: #000; display: flex; align-items: center; justify-content: center; }
.fs-host.faux-fs { position: fixed; inset: 0; z-index: 100; animation: fade-in .2s var(--ease-out); }
.fs-host.is-fs .player-wrap { width: 100%; height: 100%; }
.fs-host.is-fs .player { width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; box-shadow: none; }
.fs-host.is-fs > .fs-btn { opacity: .35; }
.fs-host.is-fs > .fs-btn:hover, .fs-host.is-fs > .fs-btn:focus-visible { opacity: 1; }
body.no-scroll { overflow: hidden; }

/* ---- version compare ---- */
.card-head-btns { display: flex; gap: 6px; }
button.small.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 22%, var(--panel-2)); }
.pick-hint {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: -2px 0 8px; padding: 6px 10px; font-size: 13px; font-weight: 600;
  border-radius: 10px; background: color-mix(in srgb, var(--accent) 14%, transparent); border: 1px dashed color-mix(in srgb, var(--accent) 60%, transparent);
  animation: pop-in .3s var(--spring);
}
.versions .pick {
  width: 20px; height: 20px; padding: 0; border-radius: 6px; font-size: 12px; font-weight: 800; flex: none;
  border: 1.5px solid color-mix(in srgb, var(--accent) 70%, var(--line)); background: var(--bg-2); color: #fff; animation: pop-in .25s var(--spring) both;
}
.versions .pick.on { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; }
.versions li.picked { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.shake { animation: shake .35s; }

.compare-backdrop {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px;
  background: rgba(5, 5, 10, .72); backdrop-filter: blur(6px); animation: fade-in .2s var(--ease-out); transition: opacity .2s;
}
.compare-backdrop.out { opacity: 0; }
.compare {
  width: min(1400px, 100%); max-height: 100%; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 16px 18px 18px; box-shadow: 0 30px 90px -20px var(--accent); animation: pop-in .35s var(--spring);
}
.cmp-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.cmp-head h2 { margin: 0; flex: 1; display: flex; align-items: center; gap: 6px; font-size: 19px; }
.cmp-close { font-size: 26px; padding: 0 6px; }
.cmp-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(170px, 220px) minmax(0, 1fr); gap: 16px; align-items: start; }
.cmp-pane { min-width: 0; animation: rise .35s var(--ease-out) both; }
.cmp-pane + .cmp-mid + .cmp-pane { animation-delay: .06s; }
.cmp-label { display: flex; align-items: baseline; gap: 6px; margin-bottom: 8px; min-width: 0; }
.cmp-label .vnum { font-size: 18px; }
.cmp-pane.live .vnum, .live-tag { color: var(--ok); }
.live-tag { font-weight: 700; font-size: 14px; }
.cmp-note { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cmp-stage { position: relative; border-radius: var(--radius); }
.cmp-pane.live .cmp-stage .player, .cmp-pane.live .cmp-start { box-shadow: 0 0 0 2px color-mix(in srgb, var(--ok) 70%, transparent), 0 24px 70px -24px var(--ok); }
.cmp-start {
  width: 100%; aspect-ratio: 16 / 10; display: grid; place-content: center; justify-items: center; gap: 10px; border-radius: var(--radius); border: 0;
  background: radial-gradient(circle at 50% 40%, #241a4a, #07070c 70%); box-shadow: 0 0 0 1px var(--line); font-size: 15px; color: var(--muted);
}
.cmp-start:hover { color: var(--text); }
.cmp-play {
  display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; font-size: 24px; color: #fff; padding-left: 4px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 10px 30px -8px var(--accent); transition: transform .3s var(--spring);
}
.cmp-start:hover .cmp-play { transform: scale(1.12); }
.cmp-tools { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.cmp-tools .make-live { margin-left: auto; }
.cmp-mid { align-self: stretch; padding: 12px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); font-size: 13px; min-width: 0; animation: fade-in .4s .1s both; }
.cmp-mid-head { font-size: 12px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .05em; }
.cmp-arrow { display: flex; align-items: center; gap: 8px; font: 800 16px var(--mono); margin: 6px 0 2px; }
.cmp-arrow span { color: var(--accent-2); }
.cmp-mid .files { list-style: none; padding: 0; margin: 10px 0; font: 12px var(--mono); }
.cmp-mid .files li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; border-top: 1px solid var(--line); animation: line-in .25s var(--ease-out) both; }
.cmp-mid .files .path { overflow-wrap: anywhere; min-width: 0; }
.cmp-mid .nums { white-space: nowrap; }
.cmp-mid .add { color: var(--ok); }
.cmp-mid .del { color: var(--danger); }
.cmp-saves { margin: 8px 0 0; padding: 0; list-style: none; color: var(--muted); }
.cmp-saves li { padding: 2px 0; overflow-wrap: anywhere; }
.cmp-saves .vnum { font-size: 12px; color: var(--text); }
@media (max-width: 900px) {
  .compare-backdrop { padding: 8px; place-items: start center; }
  .compare { padding: 12px; }
  .cmp-grid { grid-template-columns: minmax(0, 1fr); }
  .cmp-head h2 { font-size: 16px; }
}

/* an Undo toast: one click undoes, otherwise the bar runs out and it happens */
.undo-toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; overflow: hidden;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line); padding: 8px 8px 8px 18px; border-radius: 99px; font-weight: 600;
  box-shadow: 0 14px 40px -10px var(--accent); animation: undo-in .35s var(--spring); transition: opacity .25s, transform .25s var(--ease-out);
}
.undo-toast.out { opacity: 0; transform: translate(-50%, 20px); }
.undo-toast button { border-radius: 99px; }
.undo-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transform-origin: left; animation: drain linear forwards; }
@keyframes drain { to { transform: scaleX(0); } }
@keyframes undo-in { from { opacity: 0; transform: translate(-50%, 24px) scale(.94); } }

/* Co-op building: the prompt queue ("Up next") in the session panel, claim
   tags, the crew card and the "Built by" strip. */
.claim-tag { display: inline-flex; align-items: center; max-width: 16em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 99px; color: #ffd98a; background: color-mix(in srgb, var(--warn) 16%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 38%, transparent); }
.session .claim-tag { font-size: 11px; }
.up-next { margin-top: 12px; padding: 10px; border: 1px dashed #34343f; border-radius: 14px; background: #0f0f15; animation: fade-in .25s var(--ease-out); }
.up-next[hidden] { display: none; }
.q-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; margin: 0 2px 8px; }
.q-title { font-weight: 700; color: var(--t-text); }
.q-count { min-width: 20px; padding: 0 6px; border-radius: 99px; text-align: center; font-weight: 700; font-size: 11.5px; background: #22222c; color: var(--t-accent); }
.q-list { display: grid; gap: 6px; }
.q-card { position: relative; display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: start; padding: 8px 10px; border-radius: 12px; background: #16161e; border: 1px solid #262631; transition: border-color .2s, background .2s, opacity .25s, transform .25s; }
.q-card.next { border-color: rgba(217, 119, 87, .45); background: linear-gradient(90deg, rgba(217, 119, 87, .10), #16161e 55%); }
.q-card.mine { border-left: 3px solid var(--t-accent); }
.q-card.enter { animation: pop-in .35s var(--spring); }
.q-card.leaving { opacity: 0; transform: translateX(12px) scale(.97); }
.q-card.bumped { animation: bump .45s var(--spring); }
.q-card.flash { animation: pop-in .35s var(--spring), flash 1.4s var(--ease-out); }
@keyframes bump { 40% { transform: scale(1.025); } }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px rgba(217, 119, 87, .45); } }
.q-rank { font: 700 11px var(--mono); color: var(--t-muted); text-transform: uppercase; padding-top: 3px; letter-spacing: .04em; }
.q-card.next .q-rank { color: var(--t-accent); }
.q-body { min-width: 0; }
.q-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; }
.q-meta .avatar { box-shadow: none; }
.q-meta .who { color: var(--t-text); font-weight: 700; }
.q-voters { display: inline-flex; margin-left: 2px; }
.q-voters .avatar { width: 16px; height: 16px; font-size: 9px; border: 1.5px solid #16161e; }
.q-voters .avatar + .avatar { margin-left: -5px; }
.q-text { margin-top: 3px; color: var(--t-text); white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.q-actions { display: flex; gap: 12px; margin-top: 4px; font-size: 12px; }
.q-actions button.link { color: var(--t-muted); }
.q-actions button.link:hover { color: var(--t-accent); }
.q-editing { margin-top: 6px; display: grid; gap: 6px; }
.q-edit { width: 100%; font: 13.5px/1.5 system-ui, sans-serif; background: #0c0c11; color: var(--t-text); border: 1px solid #3a3a48; border-radius: 8px; padding: 6px 8px; resize: vertical; }
.q-edit-btns { display: flex; gap: 6px; }
.vote { position: relative; display: grid; justify-items: center; gap: 0; min-width: 40px; padding: 4px 6px; border-radius: 10px; background: #1c1c25; border: 1px solid #2e2e3a; color: var(--t-muted); line-height: 1.15; }
.vote .arrow { font-size: 11px; transition: transform .25s var(--spring); }
.vote .n { display: inline-block; font-weight: 800; font-size: 14px; color: var(--t-text); font-variant-numeric: tabular-nums; }
.vote:not(:disabled):hover { border-color: var(--t-accent); color: var(--t-accent); }
.vote:not(:disabled):hover .arrow { transform: translateY(-2px); }
.vote.on { background: rgba(217, 119, 87, .16); border-color: rgba(217, 119, 87, .6); color: var(--t-accent); }
.vote.on .n { color: var(--t-accent); }
.vote:disabled { cursor: default; opacity: .75; }
.vote .n.pop { animation: vote-pop .5s var(--spring); }
@keyframes vote-pop { 0% { transform: scale(1); } 35% { transform: scale(1.7) translateY(-3px); color: #ffd98a; } 100% { transform: scale(1); } }
.mini-burst { position: absolute; left: 50%; top: 40%; pointer-events: none; }
.mini-burst i { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--c); animation: spark .55s var(--ease-out) forwards; }
.send-btn.queue-mode { background: #2a2a36; color: var(--t-accent); border: 1.5px solid rgba(217, 119, 87, .6); margin-right: 6px; }
.composer-btns { align-items: center; }

/* Crew card */
.crew-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.crew-toggle { display: flex; align-items: center; gap: 8px; width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; box-shadow: none; }
.crew-toggle h2 { margin: 0; }
.crew-toggle .small-note { margin-left: auto; }
.crew-caret { font-size: 12px; color: var(--muted); transition: transform .15s var(--ease-out); }
.crew.open .crew-caret { transform: rotate(90deg); }
.crew-body[hidden] { display: none; }
.crew .card-head { margin-bottom: 0; }
.crew.open .crew-body { margin-top: 10px; }
.crew-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; animation: fade-in .25s var(--ease-out); }
.crew-av { position: relative; display: inline-flex; }
.presence-dot { position: absolute; right: -2px; bottom: -2px; width: 10px; height: 10px; border-radius: 50%; background: #555566; border: 2px solid var(--panel); }
.crew-row.online .presence-dot { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.crew-who { display: inline-flex; align-items: center; gap: 4px; }
.crown { font-size: 12px; }
.unclaimed { font-size: 12px; font-style: italic; }
.claim-tag.idle { color: var(--muted); background: transparent; border-color: var(--line); opacity: .75; }
.idle-note { font-size: 12px; font-style: italic; }
.crew-doing { font-size: 12px; font-weight: 600; color: var(--muted); padding: 1px 8px; border-radius: 99px; border: 1px solid var(--line); }
.crew-doing.on { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.crew-row .icon-btn { margin-left: -4px; font-size: 14px; }
.claim-form[hidden], .fine[hidden] { display: none; }
.small-note { font-size: 12.5px; }

/* Built by */
.built-by { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.built-by:empty { display: none; }
.bb-label { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-right: 2px; }
.bb-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); text-decoration: none; font-size: 13px; font-weight: 600; animation: pop-in .35s var(--spring) both; animation-delay: calc(var(--i) * 50ms); transition: border-color .15s, transform .15s; }
.bb-chip:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); transform: translateY(-1px); }
.bb-chip .avatar { box-shadow: none; }
.bb-n { font: 800 12px var(--mono); color: var(--accent-3); }
.v-who { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.v-who .avatar { box-shadow: none; }
.version-top { flex-wrap: nowrap; min-width: 0; white-space: nowrap; }
.version-top > * { flex-shrink: 0; }
/* The claim stays inline and gives way first, then the author's handle. */
.version-top .claim-tag { flex-shrink: 100; min-width: 3em; display: block; }
.version-top .v-who { flex-shrink: 1; min-width: 0; overflow: hidden; }
@media (prefers-reduced-motion: reduce) {
  .q-card, .q-card.enter, .q-card.bumped, .vote .n.pop, .bb-chip { animation: none; }
}

/* "Enable device code sign-in" help under the ChatGPT code */
.oauth-hint { margin-top: 4px; }
.oauth-hint summary { cursor: pointer; color: var(--muted); }
.oauth-hint summary:hover { color: var(--text); }
.oauth-hint p { margin: 6px 0 0; }
.oauth-hint { max-width: 460px; text-align: left; }
.oauth-hint summary { text-align: center; }
.hint-list { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.hint-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }

/* Before the device code: turn the setting on first */
.oauth-pre { max-width: 460px; display: grid; gap: 8px; }
.oauth-pre p { margin: 0; }
.oauth-pre-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 4px; }
.oauth-alt { font-size: 14px; }

/* The link method: open, sign in, paste the localhost address back */
.link-steps { width: 100%; max-width: 520px; text-align: left; }
.link-steps .button { margin-top: 2px; }
.link-paste-row { display: flex; gap: 8px; align-items: center; margin-top: 6px; padding: 4px; border: 1.5px dashed var(--line); border-radius: 12px; transition: border-color .2s, box-shadow .3s; }
.link-paste-row:focus-within { border-color: var(--accent); }
.link-paste-row.working { border-style: solid; border-color: var(--accent); animation: pulse 1s infinite; }
.link-paste-row.ok { border-style: solid; border-color: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 18%, transparent); }
.link-paste-row.bad { animation: shake .35s; border-color: var(--danger); }
.link-paste { flex: 1; min-width: 0; border: 0; background: transparent; box-shadow: none; font: 13px var(--mono); }
.link-paste:focus { outline: none; box-shadow: none; }
@media (max-width: 600px) {
  .oauth-btn { min-width: 0; width: 100%; }
  .oauth-pre-actions > button, .hint-actions > button { flex: 1 1 100%; }
  /* A nine-character code at full size is wider than a phone's card. */
  .connect > * { min-width: 0; }
  .user-code { font-size: 22px; flex-wrap: wrap; justify-content: center; row-gap: 8px; }
  .user-code .copy-btn { margin-left: 6px; }
}

/* While the agent works on a playable game: one small pill in the corner of
   the player, never wider than it. */
.build-overlay.corner {
  display: flex; align-items: center; gap: 8px; width: auto; max-width: calc(100% - 24px); overflow: hidden;
  padding: 7px 12px; border-radius: 99px; font-family: system-ui, sans-serif; font-size: 13px; font-weight: 700;
}
.build-overlay.corner .spinner { color: var(--accent); flex: none; }
.build-overlay.corner .pill-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.build-overlay.corner .elapsed { color: #a9a9bd; font-weight: 500; font-variant-numeric: tabular-nums; flex: none; }
.build-overlay.corner .overlay-bar { border-radius: 0 0 99px 99px; }

/* importing */
.import-link { text-align: center; margin-top: 18px; }
.import-page .card h2 { font-size: 17px; }
.import-drop { display: grid; justify-items: center; gap: 6px; padding: 26px 12px; text-align: center; }
.import-drop-ico { font-size: 30px; }
.import-busy { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.import-busy[hidden] { display: none; }
.branch-input { max-width: 160px; }
.steps { padding-left: 18px; margin: 0; }
.steps li + li { margin-top: 4px; }
.repo-list { display: grid; gap: 6px; max-height: 360px; overflow-y: auto; }
.repo { display: grid; gap: 2px; text-align: left; width: 100%; }
.repo-name { font-weight: 600; overflow-wrap: anywhere; }
.inline.wrap { flex-wrap: wrap; }
.setup-callout { border: 1px solid var(--accent); border-radius: 10px; padding: 10px 12px; background: color-mix(in srgb, var(--accent) 8%, transparent); }
.setup-callout p { margin: 0 0 8px; }
.setup-callout.warn { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, transparent); }
.play-dir { max-width: 140px; }
@media (max-width: 560px) { .import-page .inline { flex-wrap: wrap; } .import-page .inline input { flex: 1 1 100%; } .branch-input { max-width: none; } }
.gh-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
details.fine summary { cursor: pointer; color: var(--muted, #9a9aa8); }
details.fine[open] summary { margin-bottom: 8px; }


/* ---- the game page as a studio ----
   On a desktop the page itself doesn't scroll: a top bar, a collapsible
   panel of tabs on the left and the game filling the rest, edge to edge.
   Each pane scrolls on its own. */
body.studio-page { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
body.studio-page main { flex: 1; min-height: 0; max-width: none; margin: 0; padding: 0; display: flex; }
#app > .studio { animation: none; }
.studio { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.studio-bar { flex: none; display: flex; align-items: center; gap: 14px; padding: 8px 16px; min-height: 52px; border-bottom: 1px solid var(--line); background: var(--bg-2); }
.studio .game-head { flex: 1; min-width: 0; margin: 0; display: flex; align-items: center; gap: 4px 14px; }
.studio .game-title-row { flex-wrap: nowrap; min-width: 0; flex: 0 1 auto; }
.studio .game-title-row h1 { font-size: 19px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; }
.studio .game-title-row > :not(h1) { flex: none; }
.studio .rename-form { min-width: 260px; }
.studio .rename { font-size: 15px; padding: 5px 8px; }
.studio .game-byline { margin: 0; font-size: 13px; flex-wrap: nowrap; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.studio .game-byline .avatar { box-shadow: none; flex: none; }
.bar-right { flex: none; display: flex; align-items: center; gap: 14px; }
.bar-here { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ok); white-space: nowrap; }
.bar-here:empty { display: none; }
.bar-here .avatar { border: 2px solid var(--bg-2); box-shadow: none; }
.studio .plays { margin: 0; font-size: 13px; white-space: nowrap; }
.share-wrap { position: relative; }
.share-btn[hidden] { display: none; }
.share-btn.on { border-color: var(--accent); }
.share-pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: min(360px, calc(100vw - 24px)); animation: pop-in .25s var(--spring); }
.share-pop[hidden] { display: none; }

.studio-body { flex: 1; min-height: 0; display: flex; }
.studio-panel { flex: 0 0 var(--panel-w, 380px); width: var(--panel-w, 380px); min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg-2); border-right: 1px solid var(--line); }
.studio.collapsed .studio-panel { display: none; }
.panel-resizer { position: absolute; left: -4px; top: 0; bottom: 0; z-index: 4; width: 9px; cursor: col-resize; touch-action: none; }
.panel-resizer::after { content: ""; position: absolute; left: 3px; top: 0; bottom: 0; width: 3px; background: var(--accent); opacity: 0; transition: opacity .15s; }
.panel-resizer:hover::after, .panel-resizer:focus-visible::after, .studio.resizing .panel-resizer::after { opacity: .7; }
.panel-resizer:focus-visible { outline: none; }
.studio.collapsed .panel-resizer { display: none; }
.studio.resizing { cursor: col-resize; user-select: none; }
.studio.resizing iframe { pointer-events: none; }
.studio-tabs { flex: none; display: flex; padding: 0 8px; border-bottom: 1px solid var(--line); }
.studio-tabs button { position: relative; flex: 1; padding: 11px 4px 9px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; box-shadow: none; color: var(--muted); font-size: 14px; }
.studio-tabs button:hover { color: var(--text); }
.studio-tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.studio-tabs button:active { transform: none; }
.unread { position: absolute; top: 7px; right: 10%; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 8px var(--accent-2); }
.unread[hidden] { display: none; }
.pane { flex: 1; min-height: 0; }
.pane[hidden] { display: none; }
.pane-scroll { overflow-y: auto; overscroll-behavior: contain; padding: 14px; }
.pane-empty { text-align: center; padding: 48px 18px; }
.pane-empty h2 { margin: 8px 0 6px; }
.pane-empty p { margin: 0; font-size: 14px; }
.pane-empty-ico { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; font-size: 24px; background: var(--panel-2); border: 1px solid var(--line); color: var(--accent); }

/* Chat: the agent session or the crew chat, each scrolling inside the tab,
   with its composer pinned to the bottom. */
.pane-chat { display: flex; flex-direction: column; gap: 10px; padding: 10px; }
.chat-switch { flex: none; }
.chat-switch[hidden] { display: none; }
.chat-switch button { position: relative; }
.chat-switch .unread { top: 4px; right: 8px; }
.pane-chat .session { flex: 1; min-height: 0; display: flex; flex-direction: column; margin: 0; padding: 12px 12px 10px; box-shadow: none; }
.pane-chat .session.off { display: none; }
.pane-chat .session-head { flex: none; margin: -12px -12px 8px; }
.pane-chat .transcript { flex: 1; min-height: 0; max-height: none; overscroll-behavior: contain; }
.session-dock { flex: none; }
.session-dock .drafts { max-height: 120px; overflow-y: auto; }
.session-dock .q-list { max-height: 28vh; overflow-y: auto; overscroll-behavior: contain; }
.composer-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.composer-chips[hidden] { display: none; }
.composer-chips .chip { padding: 4px 11px; font-size: 12.5px; background: #15151c; border-color: var(--t-line); color: var(--t-muted); }
.composer-chips .chip:hover { color: var(--t-text); border-color: rgba(217, 119, 87, .55); }
.pane-chat .composer { border-radius: 22px; padding: 12px 10px 10px 18px; margin-top: 8px; }
.pane-chat .composer textarea { min-height: 4.6em; }
.pane-chat .composer-btns { align-self: flex-end; }
.crew-view { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.crew-view[hidden] { display: none; }
.crew-view .crew { flex: none; max-height: 40%; overflow-y: auto; padding: 12px; box-shadow: none; }
.crew-view .chat { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0 12px 12px; box-shadow: none; }
.crew-view .chat-list { flex: 1; min-height: 0; max-height: none; margin-bottom: 10px; overscroll-behavior: contain; }
.crew-view .chat form { flex: none; }
.crew-view .chat .chat-input { border-radius: 18px; padding-left: 14px; }
.crew-view .chat .notify-banner, .crew-view .chat .reply-bar { flex: none; }

/* The game fills the rest; like, remix and fullscreen float in its top-right
   corner and the agent's pill in its bottom-left, clear of the middle. */
.stage { position: relative; flex: 1; min-width: 0; display: flex; background: #000; }
.stage .player-box { flex: 1; min-width: 0; display: flex; }
.stage .player-wrap { flex: 1; min-width: 0; position: relative; }
.stage .player { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; box-shadow: none; }
.stage .build-overlay:not(.corner) { border-radius: 0; }
/* Nothing over the running game blurs what's behind it: a backdrop blur over a
   canvas is redrawn every frame the game draws, on the player's GPU. */
.stage .build-overlay.corner { inset: auto auto 14px 14px; max-width: calc(100% - 28px); z-index: 3; background: rgba(10, 10, 16, .9); backdrop-filter: none; }
.stage-actions { position: absolute; top: 12px; right: 12px; z-index: 4; display: flex; align-items: center; gap: 6px; max-width: calc(100% - 24px); }
.stage-actions .action, .stage-actions .fs-btn {
  height: 36px; padding: 0 13px; border-radius: 99px; font-size: 14px; white-space: nowrap; color: #fff;
  background: rgba(10, 10, 16, .86); border: 1px solid rgba(255, 255, 255, .16);
}
.stage-actions .action:hover, .stage-actions .fs-btn:hover { border-color: var(--accent); }
.stage-actions .action.like.on { color: #ff8cc6; }
.stage-actions .fs-btn { position: static; width: 36px; padding: 0; opacity: 1; transform: none; }
.stage-actions .fs-btn[hidden] { display: none; }
.stage-err { position: absolute; top: 58px; right: 12px; z-index: 4; max-width: min(360px, calc(100% - 24px)); margin: 0; padding: 8px 12px; border-radius: 10px; background: rgba(10, 10, 16, .88); border: 1px solid color-mix(in srgb, var(--danger) 50%, transparent); }
.is-fs .stage-actions > :not(.fs-btn), .is-fs .stage-err { display: none; }
.is-fs .stage-actions { opacity: .35; transition: opacity .2s; }
.is-fs .stage-actions:hover, .is-fs .stage-actions:focus-within { opacity: 1; }
.panel-toggle {
  position: absolute; left: 0; top: 50%; z-index: 5; transform: translateY(-50%); width: 22px; height: 60px; padding: 0;
  border-radius: 0 12px 12px 0; border-left: 0; background: rgba(23, 23, 31, .92); color: var(--muted); font-size: 18px;
}
.panel-toggle:hover { color: var(--text); }
.panel-toggle:active { transform: translateY(-50%) scale(.95); }
.panel-toggle .chev { display: inline-block; transition: transform .25s var(--ease-out); }
.studio.collapsed .panel-toggle .chev { transform: rotate(180deg); }
.panel-toggle .unread { top: 4px; right: 4px; }
.studio:not(.collapsed) .panel-toggle .unread { display: none; }

/* Design first: the mode badge in the top bar, the design card in the agent
   session, the Design tab and the "design ready" screen over the game. */
.mode-wrap { position: relative; flex: none; }
.mode-badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font: 700 11px/1.6 system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); white-space: nowrap; }
button.mode-badge { box-shadow: none; }
button.mode-badge:hover { color: var(--text); border-color: var(--mode); }
.mode-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--mode); box-shadow: 0 0 8px var(--mode); }
.mode-badge, .mode-menu .mode-badge { --mode: var(--muted); }
.mode-badge.mode-design { --mode: #ffb547; color: #ffd27a; border-color: rgba(255, 181, 71, .4); }
.mode-badge.mode-build { --mode: var(--accent); color: #c6b8ff; border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.mode-badge.mode-polish { --mode: var(--ok); color: #9af0cf; border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.mode-menu { position: absolute; left: 0; top: calc(100% + 8px); z-index: 30; width: 290px; padding: 6px; display: grid; gap: 2px; }
.mode-menu button { display: grid; justify-content: stretch; justify-items: start; gap: 3px; padding: 8px 10px; border: 0; background: none; box-shadow: none; text-align: left; font-weight: 400; font-size: 13px; border-radius: 10px; }
.mode-menu button:hover, .mode-menu button.on { background: var(--panel-2); }
.mode-menu button:active { transform: none; }

.design-card { margin: 12px 0 6px; padding: 12px 14px; border-radius: 14px; background: #14141c; border: 1px solid rgba(255, 181, 71, .28); font: 14px/1.5 system-ui, sans-serif; animation: line-in .25s var(--ease-out); }
.design-card[hidden] { display: none; }
.design-card.compact { padding: 8px 12px; border-color: var(--t-line); }
.dc-head, .dc-line { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.dc-line { font-size: 13px; }
.dc-line .link { margin-left: auto; flex: none; white-space: nowrap; }
.dc-line .dc-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dc-line .muted { flex: none; white-space: nowrap; }
.dc-ico { color: #ffb547; }
.dc-label { font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #ffd27a; flex: 1; }
.dc-title { font-weight: 800; font-size: 17px; margin-top: 4px; }
.design-card.compact .dc-title { font-size: 13px; margin: 0; font-weight: 700; }
.dc-summary { color: var(--t-muted); font-size: 13px; margin-top: 2px; }
.dz-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.dz-tag { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: rgba(124, 92, 255, .16); color: #c6b8ff; border: 1px solid rgba(124, 92, 255, .35); }
.dz-tag.t1 { background: rgba(255, 79, 163, .13); color: #ffa3cf; border-color: rgba(255, 79, 163, .32); }
.dz-tag.t2 { background: rgba(46, 230, 168, .1); color: #9af0cf; border-color: rgba(46, 230, 168, .3); }
.dz-tag.t3, .dz-tag.t4 { background: rgba(255, 255, 255, .06); color: #cfcfe0; border-color: rgba(255, 255, 255, .18); }
.dz-rules { display: grid; gap: 6px; margin: 8px 0; }
.dz-rule { display: flex; gap: 10px; align-items: baseline; font-size: 13px; }
.dz-rule-k { flex: none; width: 42px; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.dz-rule.win .dz-rule-k { color: var(--ok); }
.dz-rule.lose .dz-rule-k { color: var(--danger); }
.dc-sections { list-style: none; margin: 8px 0 0; padding: 0; border-top: 1px solid var(--t-line); }
.dc-sections li { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--t-line); font-size: 13px; }
.dc-sec { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dc-by { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; flex-wrap: wrap; justify-content: flex-end; }
.dc-free { font-size: 12px; }
.dc-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; font-size: 12.5px; }
.dc-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.design-pane { display: flex; flex-direction: column; gap: 4px; }
.design-pane > .pane-empty { margin: auto 0; }
.pane-empty-chips { margin-top: 14px; }
.pane-empty-chips .chip { border-color: rgba(255, 181, 71, .4); color: #ffd27a; }
.dz-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; }
.dz-kicker { font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #ffd27a; }
.dz-title { margin: 2px 0 0; font-size: 22px; }
.dz-md { font-size: 14px; color: #d6d6e2; overflow-wrap: anywhere; }
.dz-md p { margin: 0 0 6px; }
.dz-md ul, .dz-md ol { margin: 0 0 6px; padding-left: 20px; }
.dz-md h4 { margin: 8px 0 4px; font-size: 13px; }
.dz-md pre { margin: 0 0 6px; padding: 8px 10px; background: var(--panel-2); border-radius: 8px; overflow-x: auto; font-size: 12px; }
.dz-section { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.dz-section.claimed { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.dz-section.mine { border-color: #ffb547; box-shadow: 0 0 0 1px rgba(255, 181, 71, .25); }
.dz-sec-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.dz-sec-head h3 { flex: 1; min-width: 0; margin: 0; font-size: 15px; overflow-wrap: anywhere; }
.dz-claim { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.dz-claimer { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; }
.dz-claimer.idle { opacity: .55; }
.dz-claim .claim-btn { color: #ffd27a; border-color: rgba(255, 181, 71, .35); }
.dz-assets { margin-top: 14px; }
.dz-assets h3 { margin: 0 0 6px; font-size: 14px; }
.dz-assets ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.dz-assets li { display: flex; gap: 8px; align-items: baseline; font-size: 13px; min-width: 0; }
.dz-assets li > :last-child { margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; font-size: 12px; }
.dz-asset-type { flex: none; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 1px 6px; border-radius: 6px; background: var(--panel-2); color: var(--muted); }
.dz-asset-name { font-weight: 600; }
.dz-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 4px; }

.build-overlay.design-ready { background: radial-gradient(circle at 50% 35%, rgba(255, 181, 71, .14), rgba(7, 7, 12, .94) 65%), #07070c; gap: 10px; font-family: system-ui, sans-serif; }
.build-overlay.design-ready .overlay-title { font-size: 28px; letter-spacing: -.02em; }
.overlay-kicker { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #ffd27a; }
.overlay-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.build-overlay.design-ready .dz-tags { justify-content: center; margin: 0; }

/* The Assets tab: one row per asset, with a preview, who made it and
   whether the game uses it. On a wide screen the panel widens for it. */
.tab-n { margin-left: 5px; font-size: 11px; font-weight: 700; color: var(--muted); }
.tab-n:empty { display: none; }
@media (min-width: 1180px) {
  .studio.tab-assets .studio-panel { flex-basis: max(540px, var(--panel-w, 380px)); width: max(540px, var(--panel-w, 380px)); }
}
.assets-pane { container-type: inline-size; }
.as-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.as-title { display: flex; align-items: baseline; gap: 8px; }
.as-title h2 { margin: 0; font-size: 18px; }
.as-note { margin: 0 0 10px; font-size: 13px; }
.as-filters { margin-bottom: 10px; }
.as-filters button { display: inline-flex; gap: 5px; justify-content: center; white-space: nowrap; }
.as-n { font-size: 11px; color: var(--muted); font-weight: 700; }
.as-none { text-align: center; padding: 24px 0; }
.as-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.as-row {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; grid-template-areas: "thumb main main" "thumb side acts";
  gap: 6px 12px; align-items: center; padding: 8px 10px 8px 8px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line);
  animation: rise .3s var(--ease-out) both;
}
.as-row:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.as-row.todo { background: color-mix(in srgb, var(--panel) 60%, transparent); border-style: dashed; }
.as-thumb {
  grid-area: thumb; align-self: start; width: 52px; height: 52px; border-radius: 10px; display: grid; place-items: center; overflow: hidden; padding: 0;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); font-size: 18px; font-weight: 700;
}
.as-thumb.img { background: repeating-conic-gradient(#22222e 0% 25%, #1a1a24 0% 50%) 50% / 12px 12px; }
.as-thumb img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.as-thumb.audio { cursor: pointer; color: var(--accent-3); font-size: 22px; }
.as-thumb.audio:hover { border-color: var(--accent-3); }
.as-thumb.audio.playing { background: color-mix(in srgb, var(--accent-3) 22%, var(--panel-2)); border-color: var(--accent-3); }
.as-thumb.audio.playing .as-ico { animation: pulse 1s ease-in-out infinite; }
.as-thumb.todo { border-style: dashed; background: none; }
.as-main { grid-area: main; min-width: 0; }
.as-line { display: flex; align-items: center; gap: 6px; min-width: 0; flex-wrap: wrap; }
.as-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; max-width: 100%; }
.as-type { flex: none; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 1px 6px; border-radius: 6px; background: var(--panel-2); color: var(--muted); }
.as-prompt { font-size: 13px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.as-meta { display: flex; gap: 8px; align-items: center; margin-top: 3px; font-size: 12px; min-width: 0; }
.as-meta:empty { display: none; }
.as-meta > .muted { flex: none; white-space: nowrap; }
.as-file { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; font-size: 11px; color: var(--muted); }
.as-side { grid-area: side; display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.as-by { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; min-width: 0; }
.as-by .avatar { box-shadow: none; flex: none; }
.as-by .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-by.agent { color: var(--muted); }
.as-agent { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--panel-2); border: 1px solid var(--line); color: var(--accent); font-size: 11px; }
.as-status { flex: none; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.as-status.used { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.as-status.todo { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.as-status.unlisted { color: #c6b8ff; border-color: color-mix(in srgb, var(--accent) 40%, transparent); border-style: dashed; }
.as-acts { grid-area: acts; display: flex; align-items: center; gap: 2px; justify-content: flex-end; }
.as-dl { text-decoration: none; }
.as-del { font-size: 14px; }
.as-del:hover { color: var(--danger); }
.as-use { white-space: nowrap; }
.as-form { display: grid; gap: 10px; margin-bottom: 12px; padding: 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); animation: rise .25s var(--ease-out) both; }
.as-form label { margin: 0; display: grid; gap: 4px; }
.as-form textarea { min-height: 0; }
.as-form input[type=file] { padding: 7px; }
.as-form-row.two { display: grid; grid-template-columns: minmax(0, 1fr) 130px; gap: 10px; }
.as-form-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.as-form-foot .muted { flex: 1; min-width: 160px; font-size: 12px; }
/* Wide enough: one line per asset, a table. */
@container (min-width: 500px) {
  .as-row { grid-template-columns: 56px minmax(0, 1fr) 128px auto; grid-template-areas: "thumb main side acts"; }
  /* Rows that can be generated have more buttons: they go on a line below. */
  .as-row.gen { grid-template-columns: 56px minmax(0, 1fr) 128px; grid-template-areas: "thumb main side" "thumb acts acts"; }
  .as-thumb { width: 56px; height: 56px; align-self: center; }
  .as-side { flex-direction: column; align-items: flex-start; gap: 4px; }
}

/* Phone: the page scrolls again. The game takes the first screen, the
   panel's tabs follow below it. */
@media (max-width: 640px) {
  body.studio-page { height: auto; overflow: visible; display: block; }
  body.studio-page main { display: block; }
  .studio-panel { flex: none; }
  .panel-resizer { display: none; }
  .studio-bar { padding: 6px 12px; gap: 10px; min-height: 0; height: 52px; }
  .studio .game-head { flex-direction: column; align-items: flex-start; gap: 0; }
  .studio .game-title-row { max-width: 100%; }
  .studio .game-title-row h1 { font-size: 16px; }
  .studio .game-byline { font-size: 12px; max-width: 100%; }
  .studio .game-byline .avatar { display: none; }
  .studio .rename-form { min-width: 0; }
  .bar-right { gap: 8px; }
  .studio .plays, .here-n { display: none; }
  .studio-body { flex-direction: column; }
  .stage { order: -1; flex: none; height: calc(100svh - var(--tabbar) - 52px); min-height: 300px; }
  .panel-toggle { display: none; }
  .studio-panel, .studio.collapsed .studio-panel { display: flex; width: auto; border-right: 0; }
  .studio-tabs { position: sticky; top: 0; z-index: 6; background: var(--bg-2); }
  .pane-chat { flex: none; height: calc(100svh - var(--tabbar) - 43px); }
  .pane-scroll { overflow: visible; }
  .stage-actions .action { padding: 0 11px; }
  .mode-menu { position: fixed; left: 12px; right: 12px; top: 56px; width: auto; }
}

.outage { position: fixed; top: 12px; left: 50%; z-index: 100; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 8px 16px; border-radius: 999px;
  background: rgba(23, 23, 31, .95); border: 1px solid var(--line); color: var(--text); font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); }
/* Generating images in the Assets tab. */
.as-head-btns { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.as-make-all { white-space: nowrap; border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.as-acts { flex-wrap: wrap; }
.as-gen { white-space: nowrap; }
.as-gen.on { color: #c6b8ff; border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.as-code { font: 700 11px var(--mono); }
.as-row.making { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent); }
.as-row.making .as-thumb { background: linear-gradient(110deg, var(--panel-2) 30%, color-mix(in srgb, var(--accent) 25%, var(--panel-2)) 50%, var(--panel-2) 70%) 0 0 / 300% 100%; animation: shimmer 1.6s linear infinite; }
.as-making { line-height: 1.5; }
.as-making .spinner { color: var(--accent); }
.as-making .elapsed { font-variant-numeric: tabular-nums; }
.as-gen-help {
  display: flex; gap: 12px; margin: 0 0 12px; padding: 12px 14px; border-radius: 12px; animation: rise .25s var(--ease-out) both;
  background: color-mix(in srgb, var(--accent) 9%, var(--panel)); border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line));
}
.as-gen-help-ico { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #c6b8ff; background: color-mix(in srgb, var(--accent) 22%, transparent); }
.as-gen-help-body { min-width: 0; }
.as-gen-help-body p { margin: 2px 0 10px; font-size: 13.5px; color: var(--muted); }
.as-gen-help-btns { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* The build wait: what the stage shows while there's nothing to play yet. */
.build-wait { position: absolute; inset: 0; z-index: 2; overflow: hidden; display: grid; place-items: center; padding: 24px 16px; background: #07070c; animation: fade-in .4s var(--ease-out); transition: opacity .4s; }
.build-wait[hidden] { display: none; }
.build-wait.out { opacity: 0; pointer-events: none; }
.build-wait::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 45%, rgba(7, 7, 12, .15), rgba(7, 7, 12, .78) 80%); pointer-events: none; }
.bw-art { position: absolute; inset: -60px; filter: blur(30px) saturate(1.25) brightness(.6); transform: scale(1.08); }
.bw-art img { width: 100%; height: 100%; object-fit: cover; image-rendering: auto; }
.bw-art.gradient { filter: blur(36px) saturate(1.1) brightness(.75); animation: bw-drift 16s ease-in-out infinite alternate; }
@keyframes bw-drift { from { transform: scale(1.08) rotate(0deg); } to { transform: scale(1.22) rotate(6deg) translate(2%, -2%); } }
.bw-card {
  position: relative; z-index: 1; width: min(520px, 100%); max-height: 100%; overflow-y: auto; overscroll-behavior: contain;
  display: grid; gap: 12px; justify-items: center; text-align: center; padding: 26px 24px 22px; border-radius: 20px;
  background: rgba(10, 10, 16, .5); border: 1px solid rgba(255, 255, 255, .09); backdrop-filter: blur(10px); box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .8);
}
.bw-kicker { font: 800 12px system-ui, sans-serif; letter-spacing: .14em; text-transform: uppercase; color: #ffd27a; }
.bw-title { margin: 0; font-size: clamp(26px, 3.6vw, 42px); line-height: 1.05; font-weight: 900; letter-spacing: -.025em; overflow-wrap: anywhere; text-shadow: 0 4px 24px rgba(0, 0, 0, .5); }
.bw-step { display: flex; align-items: baseline; gap: 8px; max-width: 100%; min-width: 0; font: 13px var(--mono); color: #d0d0e2; }
.bw-step .spinner { color: var(--accent); flex: none; }
.bw-step-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bw-step-text.swap { animation: verb-in .25s var(--ease-out); }
.bw-clock { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.bw-bar { position: relative; width: min(320px, 100%); height: 3px; border-radius: 99px; overflow: hidden; background: rgba(255, 255, 255, .1); }
.bw-bar::after { content: ""; position: absolute; inset: 0; width: 40%; background: linear-gradient(90deg, transparent, var(--accent-2), var(--accent), transparent); animation: indeterminate 1.6s var(--ease-out) infinite; }
.bw-actions { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 2px; }
.bw-ping { display: inline-flex; align-items: center; gap: 8px; border-radius: 99px; padding: 7px 10px 7px 12px; background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .14); color: var(--text); font-weight: 600; }
.bw-ping:hover { border-color: var(--accent-3); }
.bw-switch { position: relative; flex: none; width: 30px; height: 18px; border-radius: 99px; background: #3a3a4c; transition: background .2s; }
.bw-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease-out); }
.bw-ping.on { border-color: color-mix(in srgb, var(--accent-3) 55%, transparent); }
.bw-ping.on .bw-switch { background: var(--accent-3); }
.bw-ping.on .bw-switch::after { transform: translateX(12px); }
.bw-watch { font-size: 13px; color: #ffd27a; }
.bw-crew { width: 100%; display: grid; gap: 8px; }
.bw-crew:empty { display: none; }
.bw-crew-head { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.bw-crew-list { display: grid; gap: 6px; }
.bw-game {
  display: flex; align-items: center; gap: 10px; min-width: 0; padding: 6px 12px 6px 6px; border-radius: 12px; text-align: left; text-decoration: none; color: var(--text);
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .08); transition: border-color .15s, transform .15s;
}
.bw-game:hover { border-color: color-mix(in srgb, var(--accent) 60%, transparent); transform: translateY(-1px); }
.bw-game .cover { flex: none; width: 40px; height: 40px; aspect-ratio: auto; border-radius: 9px; }
.bw-game .cover-emoji { font-size: 20px; }
.bw-game-text { display: grid; min-width: 0; }
.bw-game-title { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bw-game-by { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); overflow: hidden; white-space: nowrap; }
.bw-game-by .dot-live { width: 6px; height: 6px; }
@media (max-width: 640px) {
  .build-wait { padding: 14px 12px; }
  .bw-card { padding: 18px 14px 16px; gap: 10px; }
  .bw-title { font-size: 26px; }
  .bw-crew-list .bw-game:nth-child(n+4) { display: none; }
}
@media (prefers-reduced-motion: reduce) { .bw-art.gradient { animation: none; } }

/* News: unread crew chat and finished agent runs. */
.news-dot { position: absolute; z-index: 3; width: 10px; height: 10px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 2px var(--bg), 0 0 10px var(--accent-2); pointer-events: none; }
.game-card-title .news-dot { position: static; flex: none; width: 9px; height: 9px; box-shadow: 0 0 10px var(--accent-2); animation: pop-in .3s var(--spring); }
.news-host { position: relative; }
.nav-mine > .news-dot { top: 8px; left: 27px; width: 8px; height: 8px; }
.menu > summary > .news-dot { top: 0; right: 0; }
.menu-notify { text-align: left; }

/* explore: starter prompts and image references */
.hero-explore { margin: 14px 0 0; font-size: 14px; }
.hero-explore a { color: var(--muted); text-decoration: none; }
.hero-explore a:hover { color: var(--text); }
.explore-head { margin: 6px 0 0; }
.explore-head > p { margin: 0 0 16px; max-width: 760px; }
.ref-wrap { margin: 0 0 22px; }
.new-game .ref-wrap { margin-top: 16px; }
.ref-bar { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; transition: border-color .15s; }
.ref-bar.drag { border-color: var(--accent); }
.ref-top { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 64px; }
.ref-add { width: 40px; height: 40px; padding: 0; flex: none; font-size: 18px; border-radius: 10px; }
.ref-list { display: flex; gap: 8px; flex-wrap: wrap; min-width: 0; flex: 1; }
.ref-hint { color: var(--muted); }
.ref-chip { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); max-width: 260px; }
.ref-chip img { width: 36px; height: 36px; object-fit: cover; border-radius: 7px; flex: none; }
.ref-chip span { display: grid; min-width: 0; line-height: 1.25; }
.ref-chip b { font-size: 12px; }
.ref-chip small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref-x { border: 0; background: none; padding: 2px 8px; font-size: 18px; color: var(--muted); box-shadow: none; }
.ref-kinds { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.ref-kind { justify-content: flex-start; gap: 12px; padding: 12px 16px; border: 0; border-radius: 0; background: none; text-align: left; font-weight: 400; box-shadow: none; }
.ref-kind + .ref-kind { border-left: 1px solid var(--line); }
.ref-kind:hover { background: var(--panel-2); }
.ref-kind span:last-child { display: grid; line-height: 1.3; }
.ref-kind b { font-weight: 600; }
.ref-kind small { color: var(--muted); font-size: 13px; }
.ref-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--panel-2); color: var(--muted); flex: none; }
@media (max-width: 600px) { .ref-kinds { grid-template-columns: 1fr; } .ref-kind + .ref-kind { border-left: 0; border-top: 1px solid var(--line); } }

.ex-cover { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #05050a; }
.ex-cover > img, .ex-cover > svg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.ex-label { position: absolute; left: 10px; bottom: 10px; font-size: 11px; font-weight: 600; letter-spacing: .02em; padding: 3px 8px; border-radius: 99px; color: #fff; background: rgba(0, 0, 0, .5); backdrop-filter: blur(6px); }
.ex-kicker { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-2); }
.ex-detail { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 26px; align-items: stretch; }
.ex-media .ex-cover { border-radius: 16px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.ex-side { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.ex-side h2 { font-size: 26px; margin: 2px 0 14px; letter-spacing: -.02em; }
.ex-label-sm { font-size: 12px; letter-spacing: .1em; color: var(--muted); margin-bottom: 6px; }
.ex-prompt { white-space: pre-wrap; line-height: 1.6; font-size: 15px; overflow-y: auto; max-height: 360px; padding-right: 6px; }
.ex-actions { display: grid; gap: 8px; margin-top: auto; padding-top: 16px; }
.ex-build { width: 100%; }
.ex-edit { width: 100%; }
.ex-note { margin: 2px 0 0; font-size: 13px; text-align: center; }
.ex-strip { display: flex; gap: 10px; overflow-x: auto; padding: 18px 2px 8px; scrollbar-width: thin; }
.ex-thumb { flex: none; width: 112px; border-radius: 9px; overflow: hidden; border: 2px solid transparent; opacity: .55; transition: opacity .15s, transform .15s, border-color .15s; }
.ex-thumb .ex-label { display: none; }
.ex-thumb:hover { opacity: .9; }
.ex-thumb.on { opacity: 1; border-color: var(--accent); transform: translateY(-3px); }
.ex-built { margin-top: 18px; }
@media (max-width: 860px) { .ex-detail { grid-template-columns: 1fr; } .ex-prompt { max-height: none; } }

/* Agent model card on the account page */
.model-card { display: grid; gap: 8px; margin: 18px 0; }
.model-card h2 { margin: 0; }
.model-card p { margin: 0; }
.model-card label { margin-top: 6px; }
.model-card select, .model-other input { width: 100%; min-width: 0; }
.model-other { display: flex; gap: 6px; }
.model-other[hidden] { display: none; }
.model-card .effort button { text-transform: none; }
.model-card .effort button.on { color: var(--text); font-weight: 700; }
.warn-note { color: var(--warn); font-size: 13.5px; }
.model-now { font-size: 14px; }
.t-fail .model-link { display: inline-block; margin-top: 4px; font-size: 13px; }
.run-model { white-space: nowrap; cursor: help; text-decoration: underline dotted color-mix(in srgb, currentColor 45%, transparent); text-underline-offset: 3px; }
/* sharing parts with other games */
.share-parts { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0; font-size: 13px; color: var(--muted); }
.share-parts input { margin-top: 3px; }

/* explore carousel */
.ex-media { position: relative; touch-action: pan-y; }
.ex-left { min-width: 0; }
.ex-slide { animation: ex-in .35s var(--ease-out, ease-out); }
@keyframes ex-in { from { opacity: 0; transform: scale(.985); } to { opacity: 1; transform: none; } }
.ex-arrow { position: absolute; top: 50%; translate: 0 -50%; width: 44px; height: 44px; padding: 0; border-radius: 99px; font-size: 26px; line-height: 1;
  color: #fff; background: rgba(0, 0, 0, .45); border-color: rgba(255, 255, 255, .18); backdrop-filter: blur(8px); opacity: .85; }
.ex-arrow:hover { opacity: 1; background: rgba(0, 0, 0, .65); }
.ex-arrow:active { transform: scale(.94); }
.ex-arrow.prev { left: 12px; }
.ex-arrow.next { right: 12px; }
.ex-count { position: absolute; right: 12px; bottom: 10px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; color: #fff; background: rgba(0, 0, 0, .5); font-variant-numeric: tabular-nums; }
.ex-strip { justify-content: safe center; padding-top: 14px; }
.ex-thumb { display: block; padding: 0; background: none; box-shadow: none; }
.ex-thumb .ex-cover { width: 100%; }
.ex-thumb:hover { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.ex-thumb.on:hover { border-color: var(--accent); }
@media (hover: none), (pointer: coarse) { .ex-arrow { width: 38px; height: 38px; font-size: 22px; } }
@media (prefers-reduced-motion: reduce) { .ex-thumb.on { transform: none; } .ex-slide { animation: none; } }
@media (max-width: 600px) { .ex-thumb { width: 84px; } }
.ref-go { flex: none; margin-left: auto; }
.ref-tip { margin: 8px 2px 0; font-size: 13px; }
@media (max-width: 600px) { .ref-top { flex-wrap: wrap; } .ref-go { width: 100%; } }

/* inspiration wall: every prompt as a big picture card, like Playground */
.ex-back { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 10px; color: var(--muted); text-decoration: none; font-size: 15px; }
.ex-back:hover { color: var(--text); }
.ex-wall { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.ex-tile { display: flex; flex-direction: column; border-radius: 22px; background: var(--panel); border: 1px solid var(--line); color: var(--text); text-decoration: none; overflow: hidden; transition: transform .2s, border-color .2s, box-shadow .2s; }
.ex-tile-art { position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 0 0 20px 20px; background: var(--bg-2); }
.ex-tile-art > img, .ex-tile-art > svg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.ex-pill { position: absolute; left: 10px; bottom: 10px; max-width: calc(100% - 20px); font-size: 12px; padding: 4px 10px; border-radius: 99px; background: rgba(12,12,18,.72); backdrop-filter: blur(6px); color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-tile-text { display: flex; flex-direction: column; gap: 4px; padding: 12px 16px 16px; }
.ex-tile-text b { font-size: 17px; font-weight: 600; }
.ex-tile-text small { font-size: 13.5px; line-height: 1.4; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ex-tile:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: var(--shadow); }
.ex-tile:hover .ex-tile-art > img, .ex-tile:hover .ex-tile-art > svg { transform: scale(1.04); }
.ex-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.ex-media, .ex-slide, .ex-slide .ex-cover { border-radius: 22px; }
@media (max-width: 1000px) { .ex-wall { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .ex-wall { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .ex-tile { border-radius: 16px; } .ex-tile-art { border-radius: 0 0 14px 14px; }
  .ex-tile-text { padding: 8px 10px 12px; } .ex-tile-text b { font-size: 14px; } .ex-tile-text small { display: none; } .ex-pill { font-size: 10.5px; padding: 3px 8px; left: 6px; bottom: 6px; } }
@media (prefers-reduced-motion: reduce) { .ex-tile, .ex-tile-art > img, .ex-tile-art > svg { transition: none; } .ex-tile:hover { transform: none; } }
.ref-go[hidden], .ref-tip[hidden] { display: none; }

.remix-dialog { max-width: 640px; }
.remix-prompt { width: 100%; min-height: 140px; resize: vertical; }
