:root {
  color-scheme: dark;
  --app-bg: linear-gradient(180deg, #050505 0%, #080807 48%, #11100e 100%);
  --bg: #050505;
  --surface: #151513;
  --surface-strong: #22211e;
  --surface-soft: #2b2925;
  --line: #37342e;
  --line-strong: #555044;
  --text: #f5f1e8;
  --muted: #aaa79d;
  --mint: #7bd8b0;
  --amber: #f0b75a;
  --coral: #ff766e;
  --soft-panel: rgba(255, 255, 255, 0.035);
  --soft-panel-hover: rgba(255, 255, 255, 0.065);
  --chat-user-bg: var(--text);
  --chat-user-text: #11100e;
  --chat-input-bg: #232321;
  --chat-input-text: var(--text);
  --chat-input-muted: var(--muted);
  --chat-input-button-bg: var(--text);
  --chat-input-button-text: #11100e;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

:root[data-theme="light"] {
  color-scheme: light;
  --app-bg: linear-gradient(180deg, #f7f9fc 0%, #eef2f6 54%, #ffffff 100%);
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --surface-soft: #eef2f6;
  --line: #d7dde6;
  --line-strong: #aab4c2;
  --text: #171a20;
  --muted: #68707d;
  --mint: #147352;
  --amber: #9a6415;
  --coral: #b84740;
  --soft-panel: rgba(255, 255, 255, 0.78);
  --soft-panel-hover: #ffffff;
  --chat-user-bg: #ffffff;
  --chat-user-text: #171a20;
  --chat-input-bg: #ffffff;
  --chat-input-text: #171a20;
  --chat-input-muted: #667085;
  --chat-input-button-bg: #171a20;
  --chat-input-button-text: #ffffff;
  --shadow: 0 24px 60px rgba(32, 44, 64, 0.13);
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--app-bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  min-height: 100svh;
}

.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 16px 10px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(5, 5, 5, 0.92);
}

.rail-logo,
.profile-button,
.icon-button,
.send-button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.rail-logo {
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text);
  text-decoration: none;
  background: linear-gradient(135deg, rgba(123, 216, 176, 0.2), rgba(240, 183, 90, 0.18));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  font-size: 13px;
  font-weight: 800;
}

.rail-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.icon-button svg,
.send-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.theme-icons {
  display: grid;
  place-items: center;
}

.theme-icon {
  grid-area: 1 / 1;
  transition: opacity 150ms ease, transform 150ms ease;
}

.theme-icon-sun,
:root[data-theme="light"] .theme-icon-moon {
  opacity: 0;
  transform: scale(0.78) rotate(-18deg);
}

:root[data-theme="light"] .theme-icon-sun {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.theme-toggle {
  border-color: var(--line);
  background: var(--soft-panel);
}

.icon-button:hover,
.icon-button:focus-visible,
.icon-button.is-active {
  border-color: var(--line);
  background: var(--surface-strong);
  color: var(--text);
}

.icon-button:focus-visible,
.send-button:focus-visible,
.ghost-button:focus-visible,
.template-card:focus-visible,
.profile-button:focus-visible,
.send-text-button:focus-visible,
.game-vote-button:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
}

.icon-button.compact {
  width: 38px;
  height: 38px;
}

.profile-button {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(123, 216, 176, 0.45);
  border-radius: 50%;
  background: rgba(123, 216, 176, 0.14);
  color: var(--mint);
  font-size: 12px;
  font-weight: 800;
}

.profile-link {
  text-decoration: none;
}

.stage {
  display: flex;
  min-width: 0;
  min-height: 100svh;
  flex-direction: column;
  padding: 18px 28px 26px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  gap: 16px;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  width: 18px;
  height: 18px;
  border: 2px solid var(--mint);
  border-radius: 5px;
  box-shadow: 9px 6px 0 -5px var(--amber), -6px 8px 0 -5px var(--coral);
}

.top-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.top-actions form {
  margin: 0;
}

.ghost-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 15px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.primary-link {
  border-color: rgba(123, 216, 176, 0.45);
  background: rgba(123, 216, 176, 0.12);
  color: var(--mint);
}

.ghost-button:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.07);
}

.builder {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  justify-content: start;
  width: min(1060px, 100%);
  margin: 0 auto;
  padding: clamp(22px, 5svh, 42px) 0 8px;
}

.builder-core {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  border: 1px solid rgba(123, 216, 176, 0.32);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--mint);
  background: rgba(123, 216, 176, 0.08);
  font-size: 13px;
  font-weight: 700;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mint);
}

h1 {
  margin: 18px 0 28px;
  text-align: center;
  color: var(--text);
  font-size: 34px;
  font-weight: 760;
  line-height: 1.12;
}

.builder h1 {
  margin: 14px 0 20px;
}

.chat-log {
  display: grid;
  width: min(820px, 100%);
  min-height: 74px;
  max-height: 210px;
  gap: 12px;
  margin-bottom: 14px;
  overflow: auto;
}

.chat-log:not(.has-messages) {
  display: none;
}

.message {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(240, 183, 90, 0.16);
  color: var(--amber);
  font-size: 11px;
  font-weight: 850;
}

.message p {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.user-message {
  grid-template-columns: minmax(0, 1fr) 34px;
}

.user-message .avatar {
  grid-column: 2;
  grid-row: 1;
  background: rgba(123, 216, 176, 0.16);
  color: var(--mint);
}

.user-message p {
  grid-column: 1;
  grid-row: 1;
  background: rgba(123, 216, 176, 0.08);
  color: var(--text);
}

.composer {
  width: min(960px, 100%);
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.input-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px 4px;
}

textarea {
  width: 100%;
  min-height: 48px;
  max-height: 180px;
  resize: none;
  border: 0;
  outline: 0;
  padding: 11px 2px;
  background: transparent;
  color: var(--text);
  line-height: 1.45;
}

textarea::placeholder {
  color: #8d8b84;
}

.composer-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 0 10px 10px;
}

.send-button {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: var(--text);
  color: #11100e;
  transition: transform 150ms ease, background 150ms ease;
}

.send-button:hover {
  background: var(--mint);
  transform: translateY(-1px);
}

.template-dock {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  width: min(900px, 100%);
  margin: 24px auto 0;
}

.template-card {
  display: grid;
  min-height: 96px;
  align-content: start;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--soft-panel);
  color: var(--text);
  text-align: left;
}

.template-card:hover {
  border-color: var(--line-strong);
  background: var(--soft-panel-hover);
}

.template-card.is-selected {
  border-color: rgba(123, 216, 176, 0.82);
  background: rgba(123, 216, 176, 0.1);
}

.template-card span {
  color: var(--amber);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.template-card strong {
  font-size: 16px;
  line-height: 1.2;
}

.template-card small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.flash-stack {
  display: grid;
  gap: 8px;
  width: min(900px, 100%);
  margin: 8px auto 0;
}

.flash-message {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--soft-panel);
  color: var(--text);
}

.flash-message.success {
  border-color: rgba(123, 216, 176, 0.36);
  color: var(--mint);
}

.flash-message.warning,
.form-error {
  border-color: rgba(240, 183, 90, 0.42);
  color: var(--amber);
}

.auth-panel,
.workspace-panel,
.project-detail {
  width: min(900px, 100%);
  margin: 46px auto 0;
}

.chat-project-detail {
  display: grid;
  align-content: start;
  width: min(960px, 100%);
  min-height: calc(100svh - 120px);
  margin-top: 26px;
  padding-bottom: 28px;
}

.chat-project-title {
  display: grid;
  gap: 8px;
  margin: 42px 0 34px;
}

.chat-project-title span {
  color: var(--muted);
  font-size: 13px;
}

.chat-project-title h1 {
  width: min(720px, 100%);
  margin: 0;
  color: var(--text);
  font-size: clamp(30px, 5vw, 52px);
  line-height: 1.05;
}

.chat-session {
  display: grid;
  gap: 18px;
  width: min(960px, 100%);
}

.chat-job-list {
  gap: 28px;
}

.chat-empty-state {
  width: min(560px, 100%);
}

.auth-panel {
  display: grid;
  gap: 18px;
}

.auth-panel h1,
.project-hero h1 {
  margin: 0;
  text-align: left;
}

.auth-panel p,
.auth-switch,
.project-copy,
.project-hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.metadata-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.metadata-list div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.metadata-list dt {
  margin: 0 0 6px;
  color: var(--amber);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.metadata-list dd {
  margin: 0;
  color: var(--text);
  overflow-wrap: anywhere;
}

.muted-inline {
  color: var(--muted);
}

.codex-thread {
  display: grid;
  gap: 5px;
}

.codex-thread a,
.codex-thread code {
  color: var(--mint);
  font-family: inherit;
  font-weight: 800;
}

.codex-thread small {
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 14px;
  width: min(430px, 100%);
}

.auth-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.auth-form input {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  background: var(--surface);
  color: var(--text);
}

.auth-form input:focus {
  border-color: rgba(123, 216, 176, 0.72);
  outline: 0;
}

.send-text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  background: var(--text);
  color: #11100e;
  font-weight: 800;
  text-decoration: none;
}

.preview-button {
  justify-self: start;
}

.job-form {
  display: grid;
  gap: 12px;
}

.job-form textarea {
  min-height: 108px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}

.job-form textarea:focus {
  border-color: rgba(123, 216, 176, 0.72);
}

.job-form .send-text-button {
  justify-self: start;
}

.job-list {
  display: grid;
  gap: 10px;
}

.job-row {
  display: grid;
  gap: 14px;
  min-width: 0;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
}

.chat-job-list .job-row + .job-row {
  padding-top: 8px;
}

.job-mini-meta {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.job-mini-meta > span:not(.status-badge),
.job-row small {
  color: var(--muted);
  line-height: 1.35;
}

.user-prompt-bubble {
  justify-self: end;
  max-width: min(520px, 82%);
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius: 999px;
  padding: 13px 19px;
  background: var(--chat-user-bg);
  color: var(--chat-user-text);
}

.user-prompt-bubble span {
  display: block;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.job-row p {
  margin: 0;
  color: var(--text);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--mint) !important;
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.live-indicator::before {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--mint);
  box-shadow: 0 0 0 0 rgba(123, 216, 176, 0.45);
  content: "";
  animation: live-pulse 1400ms ease-out infinite;
}

@keyframes live-pulse {
  70% {
    box-shadow: 0 0 0 8px rgba(123, 216, 176, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(123, 216, 176, 0);
  }
}

.build-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border: 2px solid rgba(123, 216, 176, 0.22);
  border-top-color: var(--mint);
  border-radius: 999px;
  animation: build-spin 900ms linear infinite;
}

@keyframes build-spin {
  to {
    transform: rotate(360deg);
  }
}

.job-error {
  color: var(--coral);
}

.job-result {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  width: min(720px, 100%);
  margin-left: 44px;
}

.job-result strong {
  flex: 1 1 260px;
  color: var(--text);
  line-height: 1.35;
  font-weight: 700;
}

.job-result .ghost-button {
  min-height: 38px;
  padding: 0 16px;
  font-size: 13px;
}

.job-result-preparing {
  color: var(--muted);
}

.job-chat-output {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  margin-top: 4px;
  width: min(760px, 100%);
}

.job-chat-output.is-building .job-chat-avatar {
  box-shadow: 0 0 0 0 rgba(123, 216, 176, 0.34);
  animation: build-avatar-pulse 1500ms ease-out infinite;
}

@keyframes build-avatar-pulse {
  70% {
    box-shadow: 0 0 0 10px rgba(123, 216, 176, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(123, 216, 176, 0);
  }
}

.job-chat-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(123, 216, 176, 0.34);
  border-radius: 999px;
  background: rgba(123, 216, 176, 0.1);
  color: var(--mint);
  font-size: 11px;
  font-weight: 900;
}

.job-chat-bubble {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 2px 0 0;
}

.job-chat-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.job-chat-meta span {
  color: var(--mint);
  font-size: 12px;
  font-weight: 800;
}

.job-chat-meta .live-indicator {
  font-size: 10px;
}

.build-timer {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.build-timer.is-complete {
  color: color-mix(in srgb, var(--text) 68%, transparent);
}

.job-chat-meta code {
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.job-chat-bubble p {
  color: var(--text);
  font-size: 16px;
  line-height: 1.55;
}

.job-advanced-details {
  width: 100%;
  margin: 0;
  border: 0;
  padding-top: 0;
}

.job-advanced-details summary {
  width: fit-content;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
}

.job-advanced-details[open] summary {
  color: var(--mint);
}

.job-advanced-body {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.technical-job-list {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.technical-job-list h2 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
}

.older-job-details {
  width: min(760px, 100%);
}

.older-job-details summary {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}

.older-job-details[open] {
  display: grid;
  gap: 12px;
}

.followup-composer {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 42px;
  align-items: end;
  gap: 8px;
  width: min(720px, 100%);
  margin: min(10vh, 80px) auto 0;
  border: 1px solid color-mix(in srgb, var(--line) 76%, transparent);
  border-radius: 999px;
  padding: 10px;
  background: var(--chat-input-bg);
  box-shadow: var(--shadow);
}

.followup-composer textarea {
  max-height: 150px;
  min-height: 38px;
  border: 0;
  padding: 8px 2px;
  resize: none;
  background: transparent;
  color: var(--chat-input-text);
  outline: 0;
}

.followup-composer textarea::placeholder {
  color: var(--chat-input-muted);
}

.composer-plus,
.composer-send {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  font-size: 24px;
}

.composer-plus {
  background: transparent;
  color: var(--chat-input-muted);
}

.composer-send {
  background: var(--chat-input-button-bg);
  color: var(--chat-input-button-text);
  font-size: 22px;
}

.project-advanced-details {
  width: min(760px, 100%);
  margin: 18px auto 0;
}

.project-advanced-details summary {
  width: fit-content;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
}

.project-advanced-body {
  display: grid;
  gap: 16px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.codex-bridge-details {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.025);
}

.codex-bridge-details h3,
.codex-turns-details h3 {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.codex-bridge-list {
  display: grid;
  gap: 7px;
  margin: 0;
}

.codex-bridge-list div {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 10px;
}

.codex-bridge-list dt,
.codex-bridge-list dd {
  margin: 0;
  min-width: 0;
}

.codex-bridge-list dt {
  color: var(--amber);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.codex-bridge-list dd,
.codex-bridge-list code {
  color: var(--text);
  overflow-wrap: anywhere;
}

.codex-turns-details {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.16);
}

.codex-empty {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.codex-turn-list {
  display: grid;
  max-height: 720px;
  margin: 10px 0 0;
  padding: 0;
  gap: 8px;
  overflow: auto;
  list-style: none;
}

.codex-turn-event {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.035);
}

.codex-turn-event.assistant {
  border-color: rgba(123, 216, 176, 0.24);
  background: rgba(123, 216, 176, 0.06);
}

.codex-turn-event.command,
.codex-turn-event.command-started {
  border-color: rgba(240, 183, 90, 0.2);
}

.codex-turn-event.file-change {
  border-color: rgba(112, 162, 255, 0.24);
}

.codex-turn-event.stderr,
.codex-turn-event.failed {
  border-color: rgba(255, 118, 110, 0.28);
  background: rgba(255, 118, 110, 0.045);
}

.codex-event-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.codex-event-head span {
  color: var(--mint);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.codex-event-head small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.codex-turn-event pre {
  max-height: 420px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 9px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.status-badge.pending {
  border-color: rgba(240, 183, 90, 0.42);
  color: var(--amber);
}

.status-badge.running {
  border-color: rgba(123, 216, 176, 0.42);
  color: var(--mint);
}

.status-badge.succeeded {
  border-color: rgba(123, 216, 176, 0.58);
  background: rgba(123, 216, 176, 0.09);
  color: var(--mint);
}

.status-badge.failed,
.status-badge.cancelled {
  border-color: rgba(255, 118, 110, 0.48);
  color: var(--coral);
}

.auth-switch a,
.back-link {
  color: var(--mint);
}

.dashboard-builder {
  flex: 0 0 auto;
  justify-content: start;
  padding-top: clamp(18px, 3svh, 28px);
}

.workspace-panel {
  display: grid;
  gap: 16px;
  margin-top: 34px;
}

.analytics-page {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px 0 40px;
}

.analytics-hero {
  align-items: start;
  justify-items: start;
  min-height: auto;
  padding: clamp(18px, 3svh, 32px) 0 10px;
  text-align: left;
}

.analytics-hero h1 {
  margin-bottom: 8px;
}

.analytics-hero p {
  max-width: 680px;
}

.analytics-range-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 18px;
}

.analytics-range-tabs a {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--soft-panel);
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.analytics-range-tabs a:hover,
.analytics-range-tabs a.is-active {
  border-color: var(--line-strong);
  background: var(--surface-strong);
  color: var(--text);
}

.analytics-metric-grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 10px;
}

.analytics-metric-card {
  display: grid;
  min-height: 106px;
  align-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: var(--soft-panel);
}

.analytics-metric-card span,
.analytics-metric-card small {
  color: var(--muted);
  font-size: 12px;
}

.analytics-metric-card strong {
  color: var(--text);
  font-size: clamp(22px, 2vw, 30px);
  line-height: 1;
}

.analytics-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.55fr);
  gap: 16px;
}

.analytics-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
}

.analytics-wide-panel {
  min-width: 0;
}

.analytics-chart {
  display: flex;
  align-items: end;
  gap: 6px;
  height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--soft-panel);
}

.analytics-chart-column {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: end;
  flex: 1 1 0;
  min-width: 10px;
  height: 100%;
  gap: 2px;
}

.analytics-bar {
  display: block;
  min-height: 4px;
  border-radius: 999px 999px 2px 2px;
}

.analytics-bar.views,
.analytics-legend i.views {
  background: var(--mint);
}

.analytics-bar.plays,
.analytics-legend i.plays {
  background: var(--amber);
}

.analytics-bar.shares,
.analytics-legend i.shares {
  background: var(--coral);
}

.analytics-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 12px;
}

.analytics-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.analytics-legend i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.analytics-rank-list,
.analytics-event-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.analytics-rank-list li {
  display: grid;
  gap: 8px;
}

.analytics-rank-list div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.analytics-rank-list strong,
.analytics-event-list strong {
  overflow-wrap: anywhere;
}

.analytics-rank-list span,
.analytics-event-list span,
.analytics-event-list small {
  color: var(--muted);
}

.analytics-rank-bar {
  display: block;
  height: 6px;
  max-width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--mint), var(--amber));
}

.analytics-table-wrap {
  overflow-x: auto;
}

.analytics-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.analytics-table th,
.analytics-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: right;
  vertical-align: top;
}

.analytics-table th:first-child,
.analytics-table td:first-child {
  text-align: left;
}

.analytics-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.analytics-table a {
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
}

.analytics-table a:hover {
  color: var(--mint);
}

.analytics-table small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.analytics-event-list li {
  display: grid;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.section-heading h2 {
  margin: 0;
  font-size: 20px;
}

.section-heading span {
  color: var(--muted);
  font-size: 13px;
}

.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--soft-panel);
}

.empty-state p {
  margin: 6px 0 0;
  color: var(--muted);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.project-card {
  display: grid;
  min-height: 118px;
  align-content: start;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--soft-panel);
  color: var(--text);
  text-decoration: none;
}

.project-card:hover {
  border-color: var(--line-strong);
  background: var(--soft-panel-hover);
}

.project-card span {
  color: var(--amber);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.project-card strong {
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.project-card small {
  color: var(--muted);
  line-height: 1.35;
}

.projects-drawer {
  width: min(1060px, 100%);
  margin: 12px auto 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-strong) 82%, transparent);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.16);
}

.projects-drawer summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  padding: 0 16px;
  cursor: pointer;
  list-style: none;
}

.projects-drawer summary::-webkit-details-marker {
  display: none;
}

.projects-drawer summary > span:first-child {
  display: grid;
  gap: 3px;
}

.projects-drawer summary strong {
  font-size: 15px;
}

.projects-drawer summary small {
  color: var(--muted);
  font-size: 12px;
}

.projects-drawer-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 11px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.projects-drawer-close-label,
.projects-drawer[open] .projects-drawer-open-label {
  display: none;
}

.projects-drawer[open] .projects-drawer-close-label {
  display: inline;
}

.projects-drawer-chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 150ms ease;
}

.projects-drawer[open] .projects-drawer-chevron {
  transform: translateY(2px) rotate(225deg);
}

.projects-drawer-body {
  max-height: 360px;
  overflow: auto;
  border-top: 1px solid var(--line);
  padding: 14px;
}

.drawer-project-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.discovery-feed {
  display: grid;
  gap: 0;
  width: min(1180px, 100%);
  margin: 16px auto 0;
  padding: 4px 0 30px;
}

.discovery-row-heading div {
  display: grid;
  gap: 5px;
}

.discovery-row-heading p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.discovery-spacer {
  min-height: clamp(84px, 14svh, 132px);
}

.discovery-sections {
  display: grid;
  gap: 26px;
}

.discovery-row {
  display: grid;
  gap: 11px;
}

.discovery-row-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.discovery-row-heading h3 {
  margin: 0;
  font-size: 19px;
}

.discovery-card-row {
  display: grid;
  grid-auto-columns: minmax(218px, 252px);
  grid-auto-flow: column;
  gap: 14px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}

.discovery-card {
  display: grid;
  overflow: hidden;
  min-height: 332px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft-panel);
  color: var(--text);
  text-decoration: none;
  scroll-snap-align: start;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.discovery-card:hover {
  border-color: var(--line-strong);
  background: var(--soft-panel-hover);
  transform: translateY(-2px);
}

.discovery-cover {
  position: relative;
  display: grid;
  min-height: 138px;
  align-content: space-between;
  gap: 10px;
  padding: 13px;
  isolation: isolate;
  overflow: hidden;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--cover-a) 78%, #000 22%), color-mix(in srgb, var(--cover-b) 82%, #000 18%)),
    var(--surface-soft);
}

.discovery-cover::before,
.discovery-cover::after {
  position: absolute;
  z-index: -1;
  content: "";
  border: 1px solid rgba(255, 255, 255, 0.26);
  opacity: 0.7;
  transform: rotate(-12deg);
}

.discovery-cover::before {
  right: -24px;
  bottom: 22px;
  width: 118px;
  height: 58px;
}

.discovery-cover::after {
  top: 34px;
  left: -18px;
  width: 88px;
  height: 88px;
  border-radius: 50%;
}

.discovery-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.discovery-cover-type {
  width: fit-content;
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(0, 0, 0, 0.32);
  color: #ffffff;
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.discovery-cover strong {
  max-width: 88%;
  color: #ffffff;
  font-size: 20px;
  line-height: 1.08;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.34);
  overflow-wrap: anywhere;
}

.discovery-cover-play {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.42);
  color: #ffffff;
}

.discovery-cover-play svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  stroke: none;
}

.discovery-card-body {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 12px;
}

.discovery-card-kicker,
.discovery-card-footer,
.discovery-stats,
.discovery-reaction-stack,
.discovery-card-tags {
  display: flex;
  align-items: center;
}

.discovery-card-kicker {
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.discovery-card-title {
  min-height: 42px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.discovery-card-body small,
.discovery-card-description {
  color: var(--muted);
  line-height: 1.35;
}

.discovery-card-description {
  display: -webkit-box;
  min-height: 38px;
  overflow: hidden;
  font-size: 13px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.discovery-card-tags {
  gap: 5px;
  min-height: 25px;
  overflow: hidden;
}

.discovery-card-tags span {
  flex: 0 0 auto;
  max-width: 88px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 7px;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.discovery-card-footer {
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
}

.discovery-stats {
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.discovery-reaction-stack {
  flex-direction: row-reverse;
  justify-content: flex-end;
  min-width: 0;
}

.discovery-reaction-stack > span {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  margin-left: -6px;
  border: 1px solid var(--surface);
  border-radius: 50%;
  background: var(--surface-strong);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
  font-size: 14px;
}

.project-detail {
  display: grid;
  gap: 22px;
}

.project-hero {
  display: grid;
  gap: 12px;
}

.chat-project-actions,
.public-game-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.public-game-shell {
  --public-bg: #070707;
  --public-surface: #111111;
  --public-surface-soft: #191919;
  --public-panel: #101010;
  --public-panel-strong: #171717;
  --public-line: #2c2c2c;
  --public-line-strong: #464646;
  --public-text: #f5f5f5;
  --public-heading: #ffffff;
  --public-muted: #b6b6b6;
  --public-subtle: #8b8b8b;
  --public-primary: #5f7cff;
  --public-primary-hover: #7790ff;
  --public-primary-soft: rgba(95, 124, 255, 0.18);
  --public-input: #111111;
  --public-tab: #151515;
  --public-media: #161616;
  --public-shadow: 0 18px 48px rgba(0, 0, 0, 0.36);
  background: var(--public-bg);
  color: var(--public-text);
  color-scheme: dark;
}

:root[data-theme="light"] .public-game-shell {
  --public-bg: #ffffff;
  --public-surface: #ffffff;
  --public-surface-soft: #f8fafc;
  --public-panel: #ffffff;
  --public-panel-strong: #fafafa;
  --public-line: #e5e7eb;
  --public-line-strong: #b8bec8;
  --public-text: #232527;
  --public-heading: #111827;
  --public-muted: #374151;
  --public-subtle: #6b7280;
  --public-primary: #335fff;
  --public-primary-hover: #2349d8;
  --public-primary-soft: #eef2ff;
  --public-input: #ffffff;
  --public-tab: #f4f4f5;
  --public-media: #eef0f3;
  --public-shadow: 0 12px 34px rgba(17, 24, 39, 0.16);
  color-scheme: light;
}

.public-game-shell .app-shell {
  display: block;
  min-height: 100svh;
}

.public-game-shell .rail {
  display: none;
}

.public-game-shell .stage {
  min-height: 100svh;
  padding: 0 24px 40px;
  background: var(--public-bg);
  color: var(--public-text);
}

.public-game-shell .topbar {
  min-height: 58px;
  border-bottom: 1px solid var(--public-line);
}

.public-store-topbar {
  display: grid;
  grid-template-columns: auto auto minmax(220px, 480px) auto;
  align-items: center;
  justify-content: stretch;
  gap: 28px;
}

.public-store-topbar .top-actions {
  justify-self: end;
}

.public-game-shell .brand-lockup {
  color: var(--public-heading);
}

.public-store-nav {
  display: inline-flex;
  align-items: center;
  gap: 26px;
}

.public-store-nav a,
.public-store-nav span {
  color: var(--public-heading);
  font-size: 16px;
  font-weight: 750;
  text-decoration: none;
}

.public-store-search {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  border: 1px solid var(--public-line-strong);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--public-surface-soft);
  color: var(--public-subtle);
}

.public-store-search svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.public-game-shell .ghost-button {
  border-color: var(--public-line-strong);
  background: var(--public-surface);
  color: var(--public-text);
}

.public-game-shell .theme-toggle {
  border-color: var(--public-line-strong);
  background: var(--public-surface);
  color: var(--public-subtle);
}

.public-game-shell .theme-toggle:hover,
.public-game-shell .theme-toggle:focus-visible {
  border-color: var(--public-primary);
  background: var(--public-primary-soft);
  color: var(--public-heading);
}

.public-game-shell .ghost-button:hover {
  border-color: var(--public-primary);
  background: var(--public-primary-soft);
}

.public-game-shell .primary-link,
.public-game-shell .send-text-button {
  border-color: var(--public-primary);
  background: var(--public-primary);
  color: #ffffff;
}

.public-game-shell .flash-message {
  background: var(--public-surface-soft);
  color: var(--public-text);
}

.public-game-shell .muted-inline {
  color: var(--public-subtle);
}

.public-game-shell .empty-state {
  border-color: var(--public-line);
  background: var(--public-surface-soft);
  color: var(--public-heading);
}

.public-game-shell .empty-state p {
  color: var(--public-subtle);
}

.public-game-shell .game-vote-button:focus-visible,
.public-game-shell .reaction-option-button:focus-visible {
  outline-color: var(--public-primary);
}

.public-game-page {
  display: grid;
  gap: 24px;
  width: min(1214px, 100%);
  margin: 30px auto 0;
  color: var(--public-text);
}

.game-overview {
  display: grid;
  grid-template-columns: minmax(0, 800px) minmax(300px, 390px);
  align-items: start;
  gap: 22px;
}

.game-media {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--public-media);
}

.game-media iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #050505;
}

.game-media .empty-state {
  height: 100%;
}

.game-summary {
  display: grid;
  align-content: start;
  min-height: 100%;
  gap: 8px;
}

.game-summary h1 {
  margin: 12px 0 8px;
  text-align: left;
  color: var(--public-heading);
  font-size: clamp(30px, 3.5vw, 42px);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.game-creator-line,
.game-meta-line {
  margin: 0;
  color: var(--public-muted);
  font-size: 20px;
  line-height: 1.35;
}

.game-creator-line strong {
  color: var(--public-heading);
}

.game-play-button {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 76px;
  border: 0;
  border-radius: 8px;
  background: var(--public-primary);
  color: #ffffff;
  text-decoration: none;
}

.game-primary-actions {
  display: grid;
  gap: 10px;
  margin: clamp(48px, 8vw, 92px) 0 8px;
}

.game-play-button span {
  width: 0;
  height: 0;
  margin-left: 8px;
  border-top: 19px solid transparent;
  border-bottom: 19px solid transparent;
  border-left: 32px solid #ffffff;
}

.game-play-button.is-disabled {
  min-height: 56px;
  background: var(--public-line);
  color: var(--public-subtle);
  font-weight: 800;
}

.game-remix-button {
  display: grid;
  place-items: center;
  min-height: 48px;
  border: 1px solid var(--public-line);
  border-radius: 8px;
  background: var(--public-panel);
  color: var(--public-heading);
  font-size: 16px;
  font-weight: 850;
  text-decoration: none;
}

.game-remix-button:hover,
.game-remix-button:focus-visible {
  border-color: var(--public-primary);
  color: var(--public-primary);
  outline: 0;
}

.game-social-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  overflow: visible;
  position: relative;
}

.game-social-actions form {
  margin: 0;
}

.game-vote-button {
  display: grid;
  grid-template-rows: 30px auto auto;
  justify-items: center;
  width: 100%;
  min-height: 72px;
  border: 0;
  border-radius: 0;
  padding: 4px 2px;
  background: transparent;
  color: var(--public-text);
  text-align: center;
  text-decoration: none;
}

.game-vote-button:hover,
.game-vote-button.is-selected {
  color: var(--public-primary);
}

.game-vote-button span {
  color: var(--public-subtle);
  font-size: 29px;
  line-height: 1;
}

.game-vote-button.is-selected span,
.game-vote-button:hover span {
  color: var(--public-primary);
}

.game-vote-button strong {
  color: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.1;
}

.game-vote-button small {
  color: var(--public-subtle);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
}

.reaction-picker {
  display: grid;
  position: relative;
}

.reaction-picker-trigger {
  cursor: default;
}

.reaction-picker-menu {
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  z-index: 20;
  display: block;
  width: min(464px, calc(100vw - 28px));
  max-height: 430px;
  overflow: hidden;
  border: 1px solid var(--public-line);
  border-radius: 18px;
  padding: 8px;
  background: var(--public-panel);
  box-shadow: var(--public-shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(0, 8px) scale(0.94);
  transform-origin: bottom right;
  transition: opacity 140ms ease, transform 140ms ease;
}

.reaction-picker-menu form {
  display: grid;
  margin: 0;
}

.reaction-submit-form {
  display: none !important;
}

.reaction-chain-composer {
  display: grid;
  grid-template-columns: 1fr 34px auto;
  gap: 6px;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--public-line);
}

.reaction-chain-slots {
  display: flex;
  gap: 5px;
  min-width: 0;
}

.reaction-chain-slot,
.reaction-chain-clear,
.reaction-chain-send {
  border: 0;
  font: inherit;
}

.reaction-chain-slot {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px dashed var(--public-line-strong);
  border-radius: 999px;
  background: var(--public-surface-soft);
  color: var(--public-subtle);
}

.reaction-chain-slot span {
  font-size: 24px;
  line-height: 1;
}

.reaction-chain-slot.is-filled {
  border-style: solid;
  border-color: var(--public-primary);
  background: var(--public-primary-soft);
  color: var(--public-heading);
}

.reaction-chain-clear {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: transparent;
  color: var(--public-subtle);
  font-size: 22px;
  line-height: 1;
}

.reaction-chain-clear:hover,
.reaction-chain-clear:focus-visible {
  background: var(--public-surface-soft);
  color: var(--public-heading);
}

.reaction-chain-send {
  min-height: 36px;
  border-radius: 999px;
  padding: 0 14px;
  background: var(--public-primary);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.reaction-chain-send:disabled {
  background: var(--public-line);
  color: var(--public-subtle);
}

.reaction-category-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 8px 0;
  border-bottom: 1px solid var(--public-line);
  scrollbar-width: thin;
}

.reaction-tab-button {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 5px;
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  padding: 0 10px;
  background: transparent;
  color: var(--public-subtle);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
}

.reaction-tab-button span {
  font-size: 19px;
  line-height: 1;
}

.reaction-tab-button:hover,
.reaction-tab-button:focus-visible,
.reaction-tab-button.is-active {
  background: var(--public-primary-soft);
  color: var(--public-primary);
  outline: 0;
}

.reaction-category-panel {
  display: none;
  grid-template-columns: repeat(9, 44px);
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
  padding: 8px 0 0;
  scrollbar-width: thin;
}

.reaction-category-panel.is-active {
  display: grid;
}

.reaction-picker:hover .reaction-picker-menu,
.reaction-picker:focus-within .reaction-picker-menu,
.reaction-picker.is-open .reaction-picker-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translate(0, 0) scale(1);
}

.reaction-option-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--public-heading);
  text-decoration: none;
  transition: background 140ms ease, transform 140ms ease;
}

.reaction-option-button span {
  font-size: 26px;
  line-height: 1;
}

.reaction-option-button:hover,
.reaction-option-button:focus-visible,
.reaction-option-button.is-selected {
  background: var(--public-primary-soft);
  transform: translateY(-4px) scale(1.12);
}

.reaction-custom-form {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--public-line);
}

.reaction-custom-input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--public-line);
  border-radius: 999px;
  padding: 0 12px;
  background: var(--public-input);
  color: var(--public-heading);
  font: inherit;
  font-size: 19px;
  line-height: 40px;
}

.reaction-custom-input:focus {
  border-color: var(--public-primary);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(51, 95, 255, 0.14);
}

.reaction-custom-submit {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: var(--public-primary);
  color: #ffffff;
  font: inherit;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

.reaction-custom-submit:hover,
.reaction-custom-submit:focus-visible {
  background: var(--public-primary-hover);
}

.reaction-stack {
  display: flex;
  grid-column: 1 / -1;
  justify-content: center;
  min-height: 34px;
  margin: -2px 0 0;
  pointer-events: none;
}

.reaction-stack-item {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  margin-left: -8px;
  border: 1px solid var(--public-line);
  border-radius: 999px;
  background: var(--public-panel);
  box-shadow: var(--public-shadow);
  font-size: 19px;
  line-height: 1;
  opacity: 0;
  transform: translateY(12px) scale(0.7) rotate(-5deg);
  animation: reaction-stack-pop 620ms cubic-bezier(0.22, 1.3, 0.36, 1) forwards;
  animation-delay: calc(var(--i) * 85ms);
  z-index: var(--z);
}

.reaction-stack-item:first-child {
  margin-left: 0;
}

.reaction-stack-item.is-chain {
  width: auto;
  min-width: 56px;
  padding: 0 8px;
  border-color: var(--public-primary);
  background: var(--public-primary-soft);
}

.reaction-chain-entity {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.reaction-chain-emoji {
  display: inline-grid;
  place-items: center;
  line-height: 1;
}

.reaction-stack-item.is-chain .reaction-chain-emoji + .reaction-chain-emoji {
  margin-left: -3px;
}

@keyframes reaction-stack-pop {
  58% {
    opacity: 1;
    transform: translateY(-5px) scale(1.08) rotate(3deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0deg);
  }
}

.public-game-actions {
  margin-top: 6px;
}

.public-game-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.public-game-tags span {
  border-radius: 999px;
  padding: 5px 10px;
  background: var(--public-primary-soft);
  color: var(--public-primary);
  font-size: 13px;
  font-weight: 800;
}

.game-page-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-height: 50px;
  background: var(--public-tab);
}

.game-page-tabs a,
.game-page-tabs span {
  display: grid;
  place-items: center;
  border-bottom: 4px solid transparent;
  color: var(--public-heading);
  font-size: 20px;
  font-weight: 700;
  text-decoration: none;
}

.game-page-tabs .is-active {
  border-bottom-color: var(--public-text);
}

.public-game-main,
.public-game-comments,
.game-cms-panel {
  display: grid;
  gap: 14px;
}

.remix-page {
  display: grid;
  gap: 18px;
  width: min(900px, 100%);
  margin: 46px auto 0;
  color: var(--public-text);
}

.remix-panel {
  display: grid;
  gap: 18px;
  border: 1px solid var(--public-line);
  border-radius: 8px;
  padding: clamp(18px, 3vw, 28px);
  background: var(--public-panel);
  box-shadow: var(--public-shadow);
}

.remix-source-card {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
}

.remix-source-card h1 {
  margin: 10px 0 8px;
  color: var(--public-heading);
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.remix-source-card p {
  margin: 0;
  color: var(--public-muted);
  font-size: 18px;
  line-height: 1.4;
}

.remix-cover {
  display: grid;
  place-items: end start;
  min-height: 128px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 8px;
  padding: 14px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--cover-a) 74%, #050505), color-mix(in srgb, var(--cover-b) 70%, #050505));
  color: #ffffff;
}

.remix-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.remix-cover strong {
  font-size: 18px;
  line-height: 1.1;
}

.remix-form {
  display: grid;
  gap: 14px;
}

.remix-form label {
  display: grid;
  gap: 8px;
  color: var(--public-muted);
  font-size: 14px;
  font-weight: 800;
}

.remix-form textarea {
  min-height: 150px;
  resize: vertical;
  border: 1px solid var(--public-line);
  border-radius: 8px;
  padding: 14px;
  background: var(--public-input);
  color: var(--public-heading);
  font: inherit;
  font-size: 18px;
  line-height: 1.45;
}

.remix-form textarea:focus {
  border-color: var(--public-primary);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(51, 95, 255, 0.14);
}

.public-game-main {
  width: min(760px, 100%);
}

.public-game-main .section-heading,
.public-game-comments .section-heading {
  align-items: center;
}

.public-game-main h2,
.public-game-comments h2 {
  color: var(--public-heading);
  font-size: 24px;
}

.public-game-main .section-heading span,
.public-game-comments .section-heading span {
  color: var(--public-subtle);
}

.public-game-main p {
  margin: 0;
  color: var(--public-muted);
  font-size: 20px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.public-game-comments {
  width: min(860px, 100%);
  border-top: 1px solid var(--public-line);
  padding-top: 22px;
}

.comment-form,
.game-cms-form {
  display: grid;
  gap: 12px;
}

.comment-form textarea,
.game-cms-form textarea,
.game-cms-form input {
  width: 100%;
  border: 1px solid var(--public-line-strong);
  border-radius: 8px;
  padding: 12px;
  background: var(--public-input);
  color: var(--public-text);
}

.game-cms-form input {
  min-height: 44px;
}

.game-cms-form input[type="file"] {
  min-height: 0;
  padding: 10px;
}

.game-cms-form small {
  color: var(--public-subtle);
  font-size: 12px;
}

.thumbnail-preview {
  display: grid;
  gap: 7px;
  width: min(260px, 100%);
}

.thumbnail-preview img {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--public-line);
  border-radius: 8px;
  object-fit: cover;
}

.thumbnail-preview span {
  color: var(--public-muted);
  font-size: 12px;
}

.checkbox-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--public-muted);
  font-size: 13px;
}

.checkbox-line input {
  width: auto;
  min-height: 0;
}

.comment-form textarea:focus,
.game-cms-form textarea:focus,
.game-cms-form input:focus {
  border-color: var(--public-primary);
  outline: 0;
}

.comment-form .send-text-button,
.game-cms-form .send-text-button {
  justify-self: start;
}

.comment-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.comment-list li {
  display: grid;
  gap: 6px;
  border: 1px solid var(--public-line);
  border-radius: 8px;
  padding: 12px;
  background: var(--public-panel);
}

.comment-list strong {
  color: var(--public-heading);
  font-size: 14px;
}

.comment-list p {
  margin: 0;
  color: var(--public-muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.comment-list small {
  color: var(--public-subtle);
}

.game-cms-panel {
  width: min(760px, 100%);
  border: 1px solid var(--public-line);
  border-radius: 8px;
  padding: 14px;
  background: var(--public-panel-strong);
}

.game-cms-panel summary {
  width: fit-content;
  color: var(--public-primary);
  cursor: pointer;
  font-weight: 800;
}

.game-cms-form label {
  display: grid;
  gap: 7px;
  color: var(--public-subtle);
  font-size: 13px;
  font-weight: 800;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) 66px;
  }

  .rail {
    grid-row: 2;
    flex-direction: row;
    justify-content: space-between;
    padding: 8px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-right: 0;
  }

  .rail-nav {
    flex: 0 1 auto;
    flex-direction: row;
  }

  .stage {
    min-height: calc(100svh - 66px);
    padding: 14px 14px 18px;
  }

  .topbar {
    min-height: 46px;
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .brand-lockup {
    max-width: 46vw;
    font-size: 13px;
  }

  .brand-lockup span:last-child {
    overflow-wrap: anywhere;
  }

  .top-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 100%;
  }

  .top-actions .ghost-button {
    min-height: 36px;
    padding: 0 12px;
  }

  .builder {
    justify-content: start;
    min-height: auto;
    padding-top: 32px;
  }

  h1 {
    margin-bottom: 20px;
    font-size: 27px;
  }

  .chat-log {
    max-height: 190px;
  }

  .composer {
    border-radius: 24px;
  }

  .chat-project-detail {
    min-height: calc(100svh - 112px);
    margin-top: 12px;
  }

  .chat-project-title {
    margin: 22px 0 20px;
  }

  .chat-project-title h1 {
    font-size: 30px;
  }

  .user-prompt-bubble {
    max-width: 94%;
    border-radius: 24px;
  }

  .job-chat-output {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .job-result {
    margin-left: 40px;
  }

  .job-chat-avatar {
    width: 30px;
    height: 30px;
  }

  .followup-composer {
    grid-template-columns: 34px minmax(0, 1fr) 38px;
    margin-top: 34px;
    border-radius: 24px;
    padding: 8px;
  }

  .composer-plus,
  .composer-send {
    width: 34px;
    height: 34px;
  }

  .template-dock {
    grid-template-columns: 1fr;
    margin-top: 24px;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .analytics-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analytics-layout {
    grid-template-columns: 1fr;
  }

  .analytics-chart {
    height: 170px;
    gap: 4px;
    padding: 10px;
  }

  .analytics-chart-column {
    min-width: 8px;
  }

  .projects-drawer {
    margin-top: 12px;
  }

  .projects-drawer summary {
    min-height: 54px;
    padding: 0 12px;
  }

  .projects-drawer-body {
    max-height: 320px;
    padding: 12px;
  }

  .discovery-feed {
    margin-top: 22px;
    padding-bottom: 24px;
  }

  .discovery-row-heading {
    align-items: start;
    flex-direction: column;
  }

  .discovery-spacer {
    min-height: 52px;
  }

  .discovery-card-row {
    grid-auto-columns: minmax(214px, 78vw);
    gap: 12px;
  }

  .discovery-card {
    min-height: 318px;
  }

  .discovery-cover {
    min-height: 128px;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
  }

  .metadata-list {
    grid-template-columns: 1fr;
  }

  .public-game-page {
    margin-top: 16px;
  }

  .public-game-shell .stage {
    min-height: 100svh;
    padding: 0 14px 30px;
  }

  .public-game-shell .topbar {
    min-height: 54px;
  }

  .public-store-topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
  }

  .public-store-nav,
  .public-store-search {
    display: none;
  }

  .game-overview {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .game-summary h1 {
    margin-top: 0;
    font-size: 34px;
  }

  .game-creator-line,
  .game-meta-line,
  .public-game-main p {
    font-size: 17px;
  }

  .game-play-button {
    min-height: 62px;
  }

  .game-primary-actions {
    margin: 14px 0 6px;
  }

  .remix-source-card {
    grid-template-columns: 1fr;
  }

  .remix-cover {
    min-height: 150px;
  }

  .game-page-tabs {
    min-height: 46px;
  }

  .game-page-tabs a,
  .game-page-tabs span {
    font-size: 16px;
  }

  .codex-bridge-list div {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}

@media (max-width: 460px) {
  .rail-logo,
  .profile-button {
    width: 36px;
    height: 36px;
  }

  .rail-nav {
    gap: 4px;
  }

  .icon-button {
    width: 39px;
    height: 39px;
  }

  .top-actions {
    gap: 6px;
  }

  .top-actions .ghost-button {
    min-height: 34px;
    padding: 0 10px;
  }

  .theme-toggle {
    width: 36px;
    height: 36px;
  }

  .brand-lockup {
    gap: 8px;
  }

  .input-row {
    gap: 6px;
    padding-right: 8px;
    padding-left: 8px;
  }

  .send-button {
    align-self: flex-end;
  }

  .analytics-metric-grid {
    grid-template-columns: 1fr;
  }

  .public-game-shell .stage {
    padding-right: 12px;
    padding-left: 12px;
  }

  .game-summary h1 {
    font-size: 29px;
  }

  .game-social-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }

  .game-vote-button {
    min-height: 66px;
  }

  .game-vote-button strong {
    font-size: 11px;
  }

  .reaction-picker-menu {
    width: min(330px, calc(100vw - 24px));
    max-height: 392px;
  }

  .reaction-chain-composer {
    grid-template-columns: 1fr 32px auto;
  }

  .reaction-chain-slots {
    gap: 4px;
  }

  .reaction-chain-slot {
    width: 38px;
    height: 38px;
  }

  .reaction-chain-send {
    min-height: 34px;
    padding: 0 11px;
  }

  .reaction-tab-button {
    min-height: 34px;
    padding: 0 8px;
  }

  .reaction-tab-button strong {
    font-size: 11px;
  }

  .reaction-category-panel {
    grid-template-columns: repeat(6, 40px);
    max-height: 196px;
  }

  .reaction-option-button {
    width: 40px;
    height: 40px;
  }

  .reaction-option-button span {
    font-size: 24px;
  }

  .public-game-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .public-game-actions > * {
    width: 100%;
  }
}

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