:root {
  --ivory: #FAF9F6;
  --alabaster: #FCFCFA;
  --surface: #FFFFFF;
  --surface-muted: #F3F5F9;
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.14);
  --text: #111827;
  --text-2: #374151;
  --muted: #6B7280;
  --cobalt: #1D6BFF;
  --sky: #00A8FF;
  --sky-soft: rgba(0, 168, 255, 0.12);
  --cobalt-soft: rgba(29, 107, 255, 0.10);
  --emerald: #059669;
  --emerald-soft: rgba(5, 150, 105, 0.12);
  --amber: #D97706;
  --amber-soft: rgba(217, 119, 6, 0.12);
  --danger: #DC2626;
  --danger-soft: rgba(220, 38, 38, 0.10);
  --obsidian: #0F172A;
  --brand-grad: linear-gradient(135deg, #00A8FF 0%, #1D6BFF 100%);
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 12px 32px -6px rgba(15, 23, 42, 0.09), 0 2px 8px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 28px 64px -12px rgba(15, 23, 42, 0.18), 0 8px 24px -6px rgba(29, 107, 255, 0.12);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--ivory);
  color: var(--text);
  font-family: "Inter", "PingFang SC", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, input, select, textarea { font-family: inherit; }

.mono {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.hidden { display: none !important; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(107, 114, 128, 0.22); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(107, 114, 128, 0.40); }

.ico { width: 16px; height: 16px; flex-shrink: 0; }
.ico.sm { width: 14px; height: 14px; }

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #38BDF8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.28);
  display: inline-block;
}

/* ==================== Auth Screen ==================== */
.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 14% 16%, rgba(0, 168, 255, 0.16), transparent 44%),
    radial-gradient(circle at 86% 12%, rgba(29, 107, 255, 0.13), transparent 42%),
    #EDF3FA;
  overflow-y: auto;
}
.auth-ambient {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(15, 23, 42, 0.06) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
}
.auth-shell {
  position: relative;
  width: 100%;
  max-width: 960px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  overflow: hidden;
}
.auth-showcase {
  position: relative;
  padding: 40px 36px 32px;
  color: #FFFFFF;
  background: linear-gradient(150deg, #0095F6 0%, #1A62F5 54%, #133DA8 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}
.showcase-rings {
  position: absolute;
  inset: -40% -20% auto auto;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0) 68%);
  pointer-events: none;
}
.showcase-top { position: relative; z-index: 1; }
.showcase-logo-wrap {
  width: 76px;
  height: 76px;
  border-radius: 20px;
  padding: 3px;
  background: rgba(255, 255, 255, 0.25);
  box-shadow: 0 14px 32px rgba(9, 28, 86, 0.30);
  margin-bottom: 20px;
}
.showcase-logo { width: 100%; height: 100%; border-radius: 17px; display: block; object-fit: cover; }
.showcase-kicker {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 8px;
}
.showcase-title { margin: 0; font-size: 25px; line-height: 1.32; font-weight: 800; }
.showcase-desc { margin: 12px 0 0; font-size: 13.5px; line-height: 1.65; color: rgba(255, 255, 255, 0.88); }
.showcase-features {
  position: relative;
  z-index: 1;
  list-style: none;
  margin: 26px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.showcase-features li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
}
.feat-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.18);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.feat-icon svg { width: 17px; height: 17px; }
.showcase-features strong { display: block; font-size: 13px; font-weight: 700; }
.showcase-features span { display: block; font-size: 11.5px; color: rgba(255, 255, 255, 0.82); margin-top: 2px; line-height: 1.45; }
.showcase-footer { position: relative; z-index: 1; }
.showcase-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  padding: 6px 12px;
  border-radius: 99px;
  background: rgba(15, 23, 42, 0.22);
}

.auth-card { padding: 40px 38px; background: #FFFFFF; display: flex; flex-direction: column; justify-content: center; }
.auth-mobile-brand { display: none; align-items: center; gap: 10px; margin-bottom: 18px; }
.auth-mobile-brand img { width: 38px; height: 38px; border-radius: 10px; }
.brand-title { font-size: 15px; font-weight: 800; }
.brand-sub { font-size: 12px; color: var(--muted); }
.auth-form-head h2 { margin: 0; font-size: 21px; font-weight: 800; }
.auth-form-head p { margin: 6px 0 20px; font-size: 13px; color: var(--muted); }
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  background: var(--surface-muted);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 20px;
}
.auth-tab {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 9px;
  border-radius: 9px;
  cursor: pointer;
  transition: all .15s var(--ease);
}
.auth-tab.active { background: #FFFFFF; color: var(--text); box-shadow: var(--shadow-sm); }
.auth-field { margin-bottom: 14px; }
.auth-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.auth-row { display: flex; gap: 8px; }
.auth-row .field-inp { flex: 1; }
.sms-btn { height: 42px; flex-shrink: 0; }
.auth-inp { height: 42px; font-size: 13.5px; }
.auth-submit { width: 100%; height: 44px; justify-content: center; font-size: 14px; margin-top: 6px; }
.auth-note { font-size: 12px; color: var(--muted); text-align: center; margin-top: 12px; }

/* ==================== Buttons & Inputs ==================== */
.btn {
  border: 1px solid var(--border-strong);
  background: #FFFFFF;
  color: var(--text);
  padding: 7px 13px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  white-space: nowrap;
  transition: all .15s var(--ease);
  box-shadow: var(--shadow-xs);
}
.btn:hover { background: #F8FAFC; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.primary { background: var(--brand-grad); border-color: transparent; color: #FFFFFF; box-shadow: 0 6px 16px rgba(29, 107, 255, 0.25); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.secondary { background: #FFFFFF; border-color: rgba(29, 107, 255, 0.28); color: var(--cobalt); }
.btn.secondary:hover { background: var(--cobalt-soft); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); box-shadow: none; }
.btn.ghost:hover { background: rgba(15, 23, 42, 0.05); }
.btn.xs { padding: 4px 9px; font-size: 11.5px; border-radius: 7px; }

.field-lbl { font-size: 12px; font-weight: 600; color: var(--text-2); display: block; margin-bottom: 5px; }
.field-inp {
  width: 100%;
  background: #FFFFFF;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text);
  padding: 8px 11px;
  font-size: 13px;
  outline: none;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.field-inp:focus { border-color: var(--cobalt); box-shadow: 0 0 0 4px rgba(29, 107, 255, 0.12); }

/* ==================== Modal ==================== */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(15, 23, 42, 0.36);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-mask.open { display: flex; }
.modal-card {
  width: 100%;
  max-width: 400px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
}
.modal-card.modal-wide { max-width: 520px; }

/* ==================== Embedded OpenGame View ==================== */
.opengame-view {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #FFFFFF;
}
.opengame-bar {
  height: 48px;
  padding: 0 18px;
  background: var(--ivory);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}
.opengame-bar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.opengame-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opengame-bar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.opengame-frame { flex: 1; width: 100%; border: none; background: #FFFFFF; display: block; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 800; }
.icon-close {
  border: none;
  background: var(--surface-muted);
  color: var(--muted);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ==================== AIMaker-Inspired Studio Shell ==================== */
.studio-shell {
  display: flex;
  height: 100vh;
  width: 100vw;
  background: var(--ivory);
  overflow: hidden;
}

/* Far-Left Vertical Icon Rail */
.icon-rail {
  width: 66px;
  background: var(--ivory);
  border-right: 1px solid var(--border);
  padding: 14px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 30;
}
.rail-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.rail-logo {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(29, 107, 255, 0.22);
}
.rail-brand span { font-size: 11px; font-weight: 800; color: var(--text); letter-spacing: 0.4px; }

.rail-capsule {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 6px 4px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rail-btn {
  width: 48px;
  padding: 8px 4px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s var(--ease);
}
.rail-btn:hover { color: var(--text); background: #F3F4F6; }
.rail-btn.active { color: var(--cobalt); background: var(--cobalt-soft); }

.rail-bottom { position: relative; }
.pop-credits-row {
  margin-top: 10px;
  padding: 7px 9px;
  border-radius: 10px;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  color: #92400E;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.rail-avatar-btn {
  border: 2px solid #FFFFFF;
  background: transparent;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand-grad);
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.user-popover {
  position: absolute;
  left: 56px;
  bottom: 0;
  width: 210px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  box-shadow: var(--shadow-md);
  display: none;
  z-index: 200;
}
.user-popover.open { display: block; }
.pop-user-title { font-size: 13px; font-weight: 700; color: var(--text); }
.pop-user-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.pop-actions {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pop-btn {
  border: none;
  background: transparent;
  text-align: left;
  padding: 7px 8px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
}
.pop-btn:hover { background: var(--surface-muted); }
.pop-btn.danger { color: var(--danger); }
.pop-btn.danger:hover { background: var(--danger-soft); }

/* ==================== Collapsible Project / Template Drawer ==================== */
.project-drawer {
  width: 254px;
  background: var(--ivory);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex-shrink: 0;
  transition: width .18s var(--ease), padding .18s var(--ease);
}
.project-drawer.collapsed {
  width: 0;
  padding: 0;
  border-right: none;
  overflow: hidden;
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 2px;
}
.drawer-head h2 { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -0.01em; }
.drawer-head-btns { display: flex; gap: 4px; }

.icon-mini {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all .15s var(--ease);
}
.icon-mini:hover { background: rgba(15, 23, 42, 0.06); color: var(--text); }

.drawer-search-wrap { position: relative; margin-bottom: 12px; }
.search-ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.drawer-search {
  width: 100%;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #FFFFFF;
  padding: 0 10px 0 32px;
  font-size: 12.5px;
  color: var(--text);
  outline: none;
}
.drawer-search:focus { border-color: var(--cobalt); }

.drawer-body { flex: 1; min-height: 0; overflow-y: auto; padding-right: 2px; }
.drawer-sec-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  margin: 4px 2px 8px;
}
.drawer-sec-bar em { font-style: normal; color: var(--cobalt); margin-left: 3px; }
.link-mini {
  border: none;
  background: transparent;
  padding: 0;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--cobalt);
  cursor: pointer;
}
.link-mini.dark { color: #93C5FD; }

.proj-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all .15s var(--ease);
}
.proj-card:hover { border-color: rgba(29, 107, 255, 0.30); box-shadow: var(--shadow-sm); }
.proj-card.active {
  border-color: var(--cobalt);
  background: #F4F8FF;
  box-shadow: 0 0 0 3px rgba(29, 107, 255, 0.08);
}
.proj-tile {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--sky-soft);
  color: var(--cobalt);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.proj-tile.published { background: var(--emerald-soft); color: var(--emerald); }
.proj-meta { flex: 1; min-width: 0; }
.proj-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.proj-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.proj-del-btn {
  opacity: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all .15s var(--ease);
}
.proj-card:hover .proj-del-btn { opacity: 1; }
.proj-del-btn:hover { background: var(--danger-soft); color: var(--danger); }

.empty-sidebar {
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  padding: 14px 10px;
  text-align: center;
  background: rgba(255, 255, 255, 0.65);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

/* ==================== Main 2-Pane Creation Workspace ==================== */
.studio-main {
  flex: 1;
  min-width: 0;
  display: flex;
  min-height: 0;
}

/* Left Creation Chat Pane */
.chat-pane {
  width: 39%;
  min-width: 320px;
  max-width: 470px;
  background: var(--alabaster);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.chat-top {
  height: 54px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.reopen-btn { display: none; }
.project-drawer.collapsed ~ .studio-main .reopen-btn { display: grid; }

.active-project-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 14px;
  font-weight: 800;
}
.active-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  flex-shrink: 0;
}
#activeProjectName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.active-ver {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-muted);
  padding: 2px 7px;
  border-radius: 99px;
}
.tag-pill {
  font-size: 11px;
  font-weight: 700;
  color: var(--cobalt);
  background: var(--cobalt-soft);
  padding: 3px 9px;
  border-radius: 99px;
  flex-shrink: 0;
}

.chat-feed {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.brief-card {
  background: #F4F5F8;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 18px;
}
.brief-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.brief-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
}
.brief-title { margin: 0; font-size: 15px; font-weight: 800; color: var(--text); }
.brief-list {
  margin: 10px 0 0;
  padding-left: 16px;
  font-size: 13px;
  line-height: 1.75;
  color: var(--text-2);
}
.brief-list strong { color: var(--text); }
.quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(15, 23, 42, 0.07);
}
.chip {
  border: 1px solid var(--border);
  background: #FFFFFF;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 99px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all .15s var(--ease);
  box-shadow: var(--shadow-xs);
}
.chip:hover { border-color: var(--cobalt); color: var(--cobalt); transform: translateY(-1px); }

.msg-bubble {
  max-width: 90%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
}
.msg-bubble.user {
  align-self: flex-end;
  background: var(--cobalt);
  color: #FFFFFF;
  border-bottom-right-radius: 4px;
}
.msg-bubble.bot {
  align-self: flex-start;
  background: #FFFFFF;
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-xs);
}
.msg-bubble.thinking {
  align-self: flex-start;
  background: #F4F8FF;
  border: 1px solid rgba(29, 107, 255, 0.22);
  color: var(--cobalt);
  border-bottom-left-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.thinking-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cobalt);
  animation: pulseAI 1.1s ease-in-out infinite;
}
@keyframes pulseAI {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.1); }
}

/* Composer Floating Card */
.composer-wrap { padding: 8px 16px 12px; flex-shrink: 0; }
.model-drawer {
  margin-bottom: 10px;
  padding: 12px;
  border-radius: 14px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: none;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.model-drawer.open { display: grid; }

.composer-card {
  background: #FFFFFF;
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  padding: 12px 12px 10px;
  box-shadow: var(--shadow-md);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.composer-card:focus-within {
  border-color: var(--cobalt);
  box-shadow: 0 12px 32px -6px rgba(29, 107, 255, 0.16), 0 0 0 3px rgba(29, 107, 255, 0.10);
}
.composer-input {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
  min-height: 44px;
  max-height: 110px;
}
.composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}
.composer-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: nowrap;
}
.composer-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.tool-pill {
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 99px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.tool-pill:hover { background: #E9EEF6; color: var(--text); }
.composer-more-wrap { position: relative; }
.composer-more-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  min-width: 172px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  box-shadow: var(--shadow-md);
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 90;
}
.composer-more-menu.open { display: flex; }
.composer-more-menu button {
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}
.composer-more-menu button:hover {
  background: var(--surface-muted);
  color: var(--cobalt);
}
.send-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--brand-grad);
  color: #FFFFFF;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(29, 107, 255, 0.30);
  transition: all .15s var(--ease);
}
.send-circle:hover { transform: scale(1.06); }
.send-circle:disabled { opacity: 0.55; cursor: not-allowed; }
.composer-foot { font-size: 11px; color: var(--muted); text-align: center; margin-top: 7px; }

/* ==================== Right Unified Game Stage ==================== */
.stage-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #FFFFFF;
}
.stage-header {
  height: auto;
  min-height: 54px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  row-gap: 8px;
  flex-shrink: 0;
}
.stage-mode-bar {
  display: inline-flex;
  gap: 2px;
  background: var(--surface-muted);
  padding: 3px;
  border-radius: 11px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.stage-tab {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all .15s var(--ease);
}
.stage-tab:hover { color: var(--text); }
.stage-tab.active { background: #FFFFFF; color: var(--text); box-shadow: var(--shadow-sm); }

.stage-toolbar { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.device-toggle {
  display: inline-flex;
  background: var(--surface-muted);
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.dev-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 8px;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.dev-btn.active { background: #FFFFFF; color: var(--cobalt); box-shadow: var(--shadow-xs); }

.stage-icon-btn {
  height: 32px;
  padding: 0 9px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: #FFFFFF;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.stage-icon-btn:hover { background: var(--surface-muted); }
.stage-icon-btn.active { border-color: var(--cobalt); color: var(--cobalt); background: var(--cobalt-soft); }

.dark-refresh-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: #18181B;
  color: #FFFFFF;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .15s var(--ease);
}
.dark-refresh-btn:hover { transform: rotate(30deg); }
.publish-pill { border-radius: 99px; padding: 7px 16px; }

.stage-body { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }

/* Architectural Light Mobile Stage Backdrop */
.stage-preview {
  padding: 16px 20px;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 75% 15%, rgba(56, 189, 248, 0.10), transparent 45%),
    radial-gradient(circle at 20% 85%, rgba(251, 191, 36, 0.10), transparent 45%),
    #F5F7FB;
  overflow: hidden;
}

.sim-phones {
  width: 100%;
  max-width: 720px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}
.sim-phones.single-mode .phone-second { display: none; }
.sim-phones:not(.single-mode) .phone-device.sim-phone {
  height: min(670px, calc(100vh - 116px));
  width: auto;
  aspect-ratio: 9 / 19.2;
}
.sim-phones.landscape-mode {
  max-width: 980px;
  flex-direction: column;
  gap: 14px;
}
.sim-phones.landscape-mode .phone-device.sim-phone {
  width: min(760px, 94%);
  height: auto;
  aspect-ratio: 16 / 9.2;
  border-radius: 28px;
  padding: 10px 16px;
}
.sim-phones.landscape-mode:not(.single-mode) .phone-device.sim-phone {
  width: min(560px, 86%);
  height: auto;
  aspect-ratio: 16 / 9.2;
}
.sim-phones.landscape-mode .phone-island,
.sim-phones.landscape-mode .phone-home-bar {
  display: none;
}

.phone-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding: 2px 10px 6px;
  font-size: 11px;
}
.seat-tag { color: #CBD5E1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sim-status {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.18);
  color: #CBD5E1;
  flex-shrink: 0;
}
.sim-status.ready { background: rgba(16, 185, 129, 0.22); color: #6EE7B7; }

/* Floating Play Log Popover (Hidden by default) */
.sim-log-popover {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: 340px;
  background: var(--obsidian);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: none;
  z-index: 40;
}
.sim-log-popover.open { display: block; }
.sim-log-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #141E33;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  font-size: 11.5px;
  font-weight: 700;
  color: #E2E8F0;
}
.sim-log {
  height: 150px;
  padding: 10px 12px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  line-height: 1.55;
  color: #CBD5E1;
  overflow-y: auto;
  white-space: pre-wrap;
}

/* Visual Game Settings View */
.stage-settings {
  padding: 28px;
  overflow-y: auto;
  background: var(--ivory);
  align-items: center;
}
.settings-card {
  width: 100%;
  max-width: 660px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.settings-head { margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.settings-head h3 { margin: 0; font-size: 17px; font-weight: 800; }
.settings-head p { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
.meta-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.meta-form .full { grid-column: 1 / -1; }

.advanced-fold {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-muted);
  padding: 10px 14px;
  margin-top: 4px;
}
.advanced-fold summary {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-2);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.advanced-fold summary::-webkit-details-marker { display: none; }
.advanced-fold summary::after { content: "展开"; font-size: 11px; color: var(--cobalt); font-weight: 600; }
.advanced-fold[open] summary::after { content: "收起"; }
.advanced-grid { margin-top: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Code Mode Stage */
.stage-code { background: var(--obsidian); }
.code-subbar {
  height: 44px;
  padding: 0 14px;
  background: #141E33;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.code-subtabs { display: flex; gap: 6px; }
.etab {
  border: none;
  background: transparent;
  color: #94A3B8;
  font-size: 12.5px;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.etab:hover { color: #FFFFFF; }
.etab.active { background: rgba(56, 189, 248, 0.14); color: #7DD3FC; }
.shortcut-pill { font-size: 11px; color: #94A3B8; }

.code-editor-wrap { flex: 1; min-height: 0; display: flex; background: var(--obsidian); }
.code-gutter {
  width: 46px;
  padding: 14px 8px 14px 6px;
  background: #0B1220;
  border-right: 1px solid rgba(148, 163, 184, 0.12);
  color: #475569;
  font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.65;
  text-align: right;
  user-select: none;
  overflow: hidden;
  white-space: pre;
  flex-shrink: 0;
}
.code-area {
  width: 100%;
  height: 100%;
  border: none;
  resize: none;
  outline: none;
  background: var(--obsidian);
  color: #E2E8F0;
  padding: 14px 16px;
  font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.65;
  tab-size: 2;
}
.code-area.json-preview { height: 190px; border-radius: 10px; }

/* ==================== Full-Canvas Analytics View ==================== */
.analytics-view {
  flex: 1;
  min-width: 0;
  padding: 28px 34px 40px;
  overflow-y: auto;
  background: var(--ivory);
}
.analytics-container { max-width: 1160px; margin: 0 auto; }
.analytics-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.analytics-kicker { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: 0.8px; color: var(--cobalt); margin-bottom: 5px; }
.analytics-hero h2 { margin: 0; font-size: 24px; font-weight: 800; }
.analytics-subtitle { margin: 4px 0 0; font-size: 13px; color: var(--muted); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stat-card-top { display: flex; justify-content: space-between; align-items: center; }
.stat-card-lbl { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.stat-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.stat-icon.cobalt { background: var(--cobalt-soft); color: var(--cobalt); }
.stat-icon.sky { background: var(--sky-soft); color: #0284C7; }
.stat-icon.emerald { background: var(--emerald-soft); color: var(--emerald); }
.stat-icon.amber { background: var(--amber-soft); color: var(--amber); }
.stat-val { font-size: 28px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }

.panel-card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.panel-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.panel-card-head h3 { margin: 0; font-size: 15px; font-weight: 800; }
.panel-card-head p { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.chart-legend { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; background: var(--brand-grad); }

.trend-bars { min-height: 196px; }
.trend-svg { width: 100%; height: 190px; display: block; overflow: visible; }
.trend-empty-hint { margin-top: 8px; font-size: 12px; color: var(--muted); text-align: center; }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 700; background: #FAFBFD; }
tbody tr:hover { background: #F8FAFC; }
.rate-wrap { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.rate-bar { flex: 1; height: 6px; border-radius: 99px; background: var(--surface-muted); overflow: hidden; }
.rate-fill { height: 100%; border-radius: 99px; background: var(--brand-grad); }

.pill { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--sky-soft); color: #0284C7; }

/* ==================== Toast ==================== */
.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 999;
  background: var(--obsidian);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #FFFFFF;
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: none;
  max-width: 380px;
}
.toast.err { background: #7F1D1D; border-color: #EF4444; }

/* ==================== Responsive ==================== */
@media (max-width: 1100px) {
  .project-drawer { position: fixed; left: 66px; top: 0; bottom: 0; z-index: 25; box-shadow: var(--shadow-lg); }
  .chat-pane { width: 44%; min-width: 300px; }
}
@media (max-width: 840px) {
  .auth-shell { grid-template-columns: 1fr; max-width: 460px; }
  .auth-showcase { display: none; }
  .auth-mobile-brand { display: flex; }
  .auth-card { padding: 28px 24px; }
  .auth-grid-2 { grid-template-columns: 1fr; }
  .studio-main { flex-direction: column; overflow-y: auto; }
  .chat-pane { width: 100%; max-width: none; height: 420px; border-right: none; border-bottom: 1px solid var(--border); }
  .stage-pane { min-height: 540px; }
}

/* ==================== Clean Mobile-First Studio Extensions ==================== */
.engine-chat-pane {
  width: 396px;
  min-width: 330px;
  max-width: 430px;
}
.engine-chat-pane .chat-top {
  height: auto;
  min-height: 54px;
  padding: 10px 16px;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.assistant-head-left {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.assistant-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.engine-chat-select-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.pill-select {
  height: 32px;
  padding: 0 28px 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background-color: #FFFFFF;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  -webkit-appearance: none;
  appearance: none;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  min-width: 0;
  text-overflow: ellipsis;
  transition: border-color .15s var(--ease);
}
.pill-select:focus,
.pill-select:hover {
  border-color: var(--cobalt);
}
#engineChatSelect {
  flex: 1;
}
.stage-project-select {
  max-width: 185px;
  min-width: 120px;
}
.new-chat-btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #FFFFFF;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all .15s var(--ease);
}
.new-chat-btn:hover {
  border-color: var(--cobalt);
  color: var(--cobalt);
  background: #EFF6FF;
}
.engine-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: #F1F5F9;
  color: #475569;
  white-space: nowrap;
}
.engine-status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.engine-status-badge.ready {
  background: #ECFDF5;
  color: #047857;
}
.engine-status-badge.offline {
  background: #FEF2F2;
  color: #B91C1C;
}

.composer-mode-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-bottom: 7px;
  min-height: 24px;
}
.remix-toggle {
  border: 1px solid var(--border);
  background: #FFFFFF;
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all .15s ease;
}
.remix-toggle.active {
  background: #EFF6FF;
  border-color: #93C5FD;
  color: var(--cobalt);
}
.composer-hint {
  font-size: 11.5px;
  color: var(--muted);
}

.engine-welcome {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}
.engine-welcome h3 {
  margin: 0 0 6px;
  font-size: 14.5px;
  color: var(--ink);
}
.engine-welcome p {
  margin: 0 0 12px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
}
.starter-grid {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.starter-chip {
  text-align: left;
  padding: 9px 12px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: #F8FAFC;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.starter-chip:hover {
  border-color: var(--cobalt);
  background: #EFF6FF;
  color: var(--cobalt);
}

.tool-step-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px 0;
}
.tool-step-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #F1F5F9;
  color: #334155;
  border: 1px solid #E2E8F0;
}
.tool-step-pill.running {
  background: #EFF6FF;
  color: #1D4ED8;
  border-color: #BFDBFE;
}
.tool-step-pill.done {
  background: #ECFDF5;
  color: #047857;
  border-color: #A7F3D0;
}
.tool-step-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.deliverable-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 13px;
  border-radius: 12px;
  background: linear-gradient(135deg, #EFF6FF 0%, #F8FAFC 100%);
  border: 1px solid #BFDBFE;
}
.deliverable-info strong {
  display: block;
  font-size: 13px;
  color: #0F172A;
}
.deliverable-info span {
  font-size: 11.5px;
  color: #475569;
}
.deliverable-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.stage-head-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  min-width: 0;
}

/* Centered Realistic iPhone Portrait Bezel */
.mobile-stage-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.phone-device {
  height: min(736px, calc(100vh - 96px));
  max-height: 100%;
  width: auto;
  aspect-ratio: 9 / 19.2;
  max-width: 100%;
  background: linear-gradient(155deg, #2C313A 0%, #171A21 55%, #232832 100%);
  border-radius: 42px;
  padding: 11px 10px 9px;
  border: 1.5px solid #4B5563;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.14),
    0 28px 64px -16px rgba(15, 23, 42, 0.34),
    0 8px 20px -6px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  position: relative;
}
.phone-island {
  display: flex;
  justify-content: center;
  padding: 2px 0 7px;
  flex-shrink: 0;
}
.phone-island span {
  width: 78px;
  height: 14px;
  border-radius: 999px;
  background: #090B10;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.08);
}
.phone-viewport {
  flex: 1;
  min-height: 0;
  border-radius: 30px;
  overflow: hidden;
  background: #FBF7F0;
  position: relative;
  border: 1px solid rgba(0, 0, 0, 0.25);
}
.phone-viewport iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}
.phone-home-bar {
  display: flex;
  justify-content: center;
  padding-top: 6px;
  flex-shrink: 0;
}
.phone-home-bar span {
  width: 96px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
}
.engine-stage-empty {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(180deg, #FBF9F5 0%, #F3EEE4 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}
.engine-stage-empty .empty-orb {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  display: grid;
  place-items: center;
  font-size: 24px;
  margin-bottom: 12px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}
.engine-stage-empty h3 {
  margin: 0 0 6px;
  font-size: 15.5px;
  color: var(--ink);
}
.engine-stage-empty p {
  margin: 0;
  max-width: 280px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
}
.btn.danger {
  background: #EF4444;
  color: #FFFFFF;
  border-color: #EF4444;
}

/* ==================== IDE Package Upload & SDK Guide ==================== */
.modal-card.modal-xl {
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
}
.up-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border-radius: 10px;
  background: var(--surface-muted);
  margin-bottom: 14px;
}
.up-mode-btn {
  border: none;
  background: transparent;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s var(--ease);
}
.up-mode-btn.active {
  background: #FFFFFF;
  color: var(--cobalt);
  box-shadow: var(--shadow-xs);
}
.dropzone {
  border: 2px dashed rgba(29, 107, 255, 0.28);
  border-radius: 14px;
  padding: 20px 16px;
  text-align: center;
  background: #F8FAFF;
  cursor: pointer;
  transition: border-color .15s var(--ease), background .15s var(--ease);
  margin-bottom: 14px;
}
.dropzone:hover,
.dropzone.dragover {
  border-color: var(--cobalt);
  background: #EFF6FF;
}
.dropzone-icon { font-size: 26px; margin-bottom: 6px; }
.dropzone-title { font-size: 13.5px; font-weight: 700; color: var(--text); }
.dropzone-sub { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.dropzone-file {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 99px;
  background: #ECFDF5;
  color: #047857;
  font-size: 12px;
  font-weight: 700;
}
.cover-pick-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.cover-thumb {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface-muted);
  object-fit: cover;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
}
.cover-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.up-progress-wrap {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #F8FAFC;
  border: 1px solid var(--border);
}
.up-progress-bar {
  height: 8px;
  border-radius: 99px;
  background: #E2E8F0;
  overflow: hidden;
}
.up-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--brand-grad);
  transition: width .12s linear;
}
.up-progress-text {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  display: flex;
  justify-content: space-between;
}
.up-notices {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
  color: #065F46;
  font-size: 12px;
  line-height: 1.6;
}
.bundle-overview-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: var(--ivory);
  overflow-y: auto;
}
.bundle-overview-card {
  width: 100%;
  max-width: 540px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.bundle-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.bundle-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  background: var(--cobalt-soft);
  color: var(--cobalt);
}
.bundle-badge.ok {
  background: var(--emerald-soft);
  color: var(--emerald);
}
.bundle-badge.warn {
  background: var(--amber-soft);
  color: var(--amber);
}
.bundle-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px 0;
}
.bundle-meta-item {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-muted);
}
.bundle-meta-item span {
  display: block;
  font-size: 11px;
  color: var(--muted);
}
.bundle-meta-item strong {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  color: var(--text);
}
.sdk-dl-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.sdk-dl-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  text-decoration: none;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
}
.sdk-dl-card:hover {
  border-color: var(--cobalt);
  background: #EFF6FF;
}
.sdk-dl-card small {
  font-weight: 500;
  color: var(--cobalt);
}
.sdk-snippet-block {
  margin-bottom: 14px;
}
.sdk-snippet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-2);
}
.sdk-code-pre {
  margin: 0;
  padding: 12px;
  border-radius: 10px;
  background: var(--obsidian);
  color: #E2E8F0;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11.5px;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre;
}

/* ==================== Developer Asset Library (类 Syna 素材中心) ==================== */
.assets-view {
  flex: 1;
  min-width: 0;
  padding: 28px 34px 40px;
  overflow-y: auto;
  background: var(--ivory);
}
.assets-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.assets-cat-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.cat-pill {
  border: 1px solid var(--border);
  background: #FFFFFF;
  color: var(--text-2);
  border-radius: 99px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s var(--ease);
}
.cat-pill:hover { border-color: var(--cobalt); color: var(--cobalt); }
.cat-pill.active {
  background: var(--cobalt);
  border-color: var(--cobalt);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(29, 107, 255, 0.22);
}
.assets-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 260px;
}
.assets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}
.asset-card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
.asset-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.checkerboard {
  background-color: #F8FAFC;
  background-image:
    linear-gradient(45deg, #E2E8F0 25%, transparent 25%),
    linear-gradient(-45deg, #E2E8F0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #E2E8F0 75%),
    linear-gradient(-45deg, transparent 75%, #E2E8F0 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.asset-thumb-wrap {
  position: relative;
  height: 168px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.asset-thumb-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}
.asset-thumb-wrap.scene-fit img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.asset-ver-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(15, 23, 42, 0.72);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
}
.asset-cat-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--border);
}
.asset-card-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.asset-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.asset-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--muted);
}
.asset-style-tag {
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--cobalt-soft);
  color: var(--cobalt);
  font-weight: 600;
  font-size: 11px;
}
.asset-card-actions {
  display: flex;
  gap: 6px;
  margin-top: auto;
  padding-top: 4px;
  flex-wrap: wrap;
}
.assets-empty {
  grid-column: 1 / -1;
  background: #FFFFFF;
  border: 1px dashed var(--border-strong);
  border-radius: 18px;
  padding: 46px 24px;
  text-align: center;
  color: var(--muted);
}
.assets-empty h3 { margin: 8px 0 6px; color: var(--text); font-size: 16px; }

.style-presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.style-chip {
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text-2);
  border-radius: 99px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.style-chip:hover, .style-chip.active {
  background: var(--cobalt-soft);
  border-color: var(--cobalt);
  color: var(--cobalt);
}
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
}
.asset-detail-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
  margin-bottom: 14px;
}
@media (max-width: 780px) {
  .asset-detail-layout { grid-template-columns: 1fr; }
}
.asset-detail-preview {
  height: 280px;
  border-radius: 14px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 10px;
}
.asset-detail-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.asset-detail-side {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.asset-ver-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  margin: 6px 0;
}
.asset-ver-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 170px;
  overflow-y: auto;
}
.asset-ver-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  font-size: 12px;
}
.asset-ver-row.current {
  border-color: var(--cobalt);
  background: #EFF6FF;
}
.composer-asset-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.composer-asset-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 4px;
  border-radius: 99px;
  border: 1px solid rgba(29, 107, 255, 0.28);
  background: #EFF6FF;
  color: var(--cobalt);
  font-size: 11.5px;
  font-weight: 600;
}
.composer-asset-chip img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  background: #FFFFFF;
}
.composer-asset-chip button {
  border: none;
  background: transparent;
  color: var(--cobalt);
  font-weight: 700;
  cursor: pointer;
  padding: 0 2px;
}
.asset-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  max-height: 360px;
  overflow-y: auto;
  padding: 2px;
}
.asset-pick-card {
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #FFFFFF;
  overflow: hidden;
  cursor: pointer;
  transition: all .12s var(--ease);
}
.asset-pick-card.selected {
  border-color: var(--cobalt);
  box-shadow: 0 0 0 3px rgba(29, 107, 255, 0.14);
}
.asset-pick-thumb {
  height: 104px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
}
.asset-pick-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.asset-pick-name {
  padding: 7px 9px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==================== Developer Credits & WeChat Recharge ==================== */
.composer-credits-pill {
  height: 28px;
  border: 1px solid #FDE68A;
  background: #FFFBEB;
  color: #92400E;
  border-radius: 99px;
  padding: 0 10px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  transition: all .12s var(--ease);
}
.composer-credits-pill:hover {
  background: #FEF3C7;
  border-color: #F59E0B;
}
.cell-nowrap { white-space: nowrap; }
.credits-rule-banner {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
@media (max-width: 860px) {
  .credits-rule-banner { grid-template-columns: 1fr; }
}
.rule-item {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 15px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rule-item strong { font-size: 13px; color: var(--ink); }
.rule-item span { font-size: 12px; color: var(--muted); line-height: 1.45; }
.credits-subtabs { display: flex; gap: 6px; flex-wrap: wrap; }
.ledger-delta-pos { color: #059669; font-weight: 800; font-variant-numeric: tabular-nums; }
.ledger-delta-neg { color: #DC2626; font-weight: 800; font-variant-numeric: tabular-nums; }
.credits-kind-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: #F1F5F9;
  color: #334155;
}
.credits-kind-badge.pos { background: #ECFDF5; color: #047857; }
.credits-kind-badge.neg { background: #FEF2F2; color: #B91C1C; }

.recharge-balance-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  font-size: 13px;
  color: #92400E;
  margin-bottom: 14px;
}
.recharge-pkg-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 6px;
}
.recharge-pkg-card {
  position: relative;
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: #FFFFFF;
  cursor: pointer;
  transition: all .12s var(--ease);
  text-align: left;
}
.recharge-pkg-card:hover { border-color: #93C5FD; }
.recharge-pkg-card.selected {
  border-color: var(--cobalt);
  background: #F0F7FF;
  box-shadow: 0 0 0 3px rgba(29, 107, 255, 0.12);
}
.pkg-tag {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 99px;
  background: #2563EB;
  color: #FFFFFF;
}
.pkg-name { font-size: 13px; font-weight: 700; color: var(--ink); }
.pkg-credits { font-size: 20px; font-weight: 800; color: var(--cobalt); margin: 4px 0 2px; }
.pkg-price-row { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); margin-top: 6px; }
.pkg-price { font-size: 15px; font-weight: 800; color: var(--ink); }

.recharge-qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 10px 0 6px;
  gap: 12px;
}
.qr-frame {
  width: 210px;
  height: 210px;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #FFFFFF;
  box-shadow: var(--shadow-sm);
  display: grid;
  place-items: center;
}
.qr-frame img { width: 100%; height: 100%; object-fit: contain; }
.qr-price { font-size: 24px; font-weight: 800; color: var(--ink); }
.qr-credits { font-size: 14px; font-weight: 700; color: #059669; margin-top: 2px; }
.qr-order-id { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.qr-poll-status {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 99px;
  background: #ECFDF5;
  color: #047857;
  font-size: 12px;
  font-weight: 600;
}

.meta-section {
  grid-column: 1 / -1;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #F8FAFC;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.meta-section-title {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.meta-section-title small {
  font-weight: 500;
  font-size: 11.5px;
  color: var(--muted);
}
.check-row {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.check-row input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--cobalt);
  cursor: pointer;
}
.check-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 4px 0;
}
.field-hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.4;
}

.composer-wf-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 2px 6px;
  margin-bottom: 4px;
  border-bottom: 1px dashed var(--border);
}
.composer-wf-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.wf-toggle {
  display: inline-flex;
  align-items: center;
  background: #F1F5F9;
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 2px;
  gap: 2px;
  flex-shrink: 0;
}
.wf-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 99px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all .15s var(--ease);
}
.wf-btn.active {
  background: #FFFFFF;
  color: var(--cobalt);
  box-shadow: var(--shadow-xs);
}

.stage-plan {
  padding: 20px 24px 36px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--surface-muted);
}
.plan-shell {
  max-width: 920px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.pipeline-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
}
.pipe-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #F8FAFC;
  border: 1px solid transparent;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}
.pipe-step.done {
  background: #ECFDF5;
  border-color: #A7F3D0;
  color: #065F46;
}
.pipe-step.active {
  background: #EFF6FF;
  border-color: #BFDBFE;
  color: var(--cobalt);
}
.plan-card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.plan-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.plan-card-head h3 { margin: 0; font-size: 15.5px; font-weight: 800; }
.plan-card-head p { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.plan-textarea {
  width: 100%;
  min-height: 210px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink);
  background: #F8FAFC;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.pf-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.pf-item {
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 10px 12px;
  background: #F8FAFC;
  display: flex;
  gap: 9px;
  align-items: flex-start;
}
.pf-item.pass { background: #F0FDF4; border-color: #BBF7D0; }
.pf-item.warn { background: #FFFBEB; border-color: #FDE68A; }
.pf-item.fail { background: #FEF2F2; border-color: #FECACA; }
.pf-icon { font-size: 15px; line-height: 1.3; flex-shrink: 0; }
.pf-title { font-size: 12.5px; font-weight: 700; color: var(--ink); }
.pf-detail { font-size: 11.5px; color: var(--text-2); margin-top: 2px; line-height: 1.45; }
.pf-banner {
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 12px;
}
.pf-banner.ready { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.pf-banner.not-ready { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }
@media (max-width: 780px) {
  .pipeline-bar, .pf-list { grid-template-columns: 1fr; }
}

/* ==================== Syna-Level Agent Feed, Checkpoints & Runtime Error Banner ==================== */
.todo-card {
  border: 1px solid #DBEAFE;
  background: linear-gradient(180deg, #F8FBFF 0%, #FFFFFF 100%);
  border-radius: 14px;
  padding: 11px 14px;
  margin-bottom: 6px;
  box-shadow: var(--shadow-sm);
}
.todo-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 800;
  color: #1E3A8A;
  margin-bottom: 6px;
}
.todo-bar {
  height: 5px;
  border-radius: 999px;
  background: #E2E8F0;
  overflow: hidden;
  margin-bottom: 8px;
}
.todo-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563EB, #10B981);
  transition: width .25s ease;
}
.todo-list {
  display: grid;
  gap: 4px;
}
.todo-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--ink-2);
}
.todo-item.done { color: var(--muted); }
.todo-item.in_progress { color: #1D4ED8; font-weight: 700; }
.todo-item.failed { color: #DC2626; font-weight: 700; }

.reasoning-card {
  border: 1px dashed #CBD5E1;
  background: #F8FAFC;
  border-radius: 12px;
  padding: 7px 11px;
  font-size: 12px;
  color: var(--muted);
}
.reasoning-card > summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--text-2);
  user-select: none;
}
.reasoning-body {
  margin-top: 6px;
  white-space: pre-wrap;
  line-height: 1.55;
  max-height: 220px;
  overflow-y: auto;
}

.tool-card-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tool-card {
  border: 1px solid var(--border);
  background: #FFFFFF;
  border-radius: 11px;
  padding: 7px 11px;
  font-size: 12.5px;
  transition: border-color .15s;
}
.tool-card.running { border-color: #93C5FD; background: #EFF6FF; }
.tool-card.failed { border-color: #FECACA; background: #FEF2F2; }
.tool-card > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
.tool-card > summary::-webkit-details-marker { display: none; }
.tool-card-title { font-weight: 700; color: var(--ink); flex-shrink: 0; }
.tool-card-sum {
  color: var(--muted);
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.tool-card-chev { color: var(--muted); font-size: 11px; flex-shrink: 0; }
.tool-card[open] .tool-card-chev { transform: rotate(90deg); }
.tool-card-body {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 6px;
}
.tool-card-files {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.tool-file-chip {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 6px;
  background: #F1F5F9;
  color: var(--ink-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.tool-card-thumb {
  max-width: 150px;
  max-height: 150px;
  border-radius: 9px;
  border: 1px solid var(--border);
  object-fit: contain;
  background: repeating-conic-gradient(#F1F5F9 0% 25%, #FFFFFF 0% 50%) 50% / 12px 12px;
}
.tool-card-pre {
  margin: 0;
  padding: 7px 9px;
  border-radius: 8px;
  background: #F8FAFC;
  border: 1px solid var(--border);
  font-size: 11px;
  line-height: 1.45;
  max-height: 160px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.tool-card-err {
  color: #B91C1C;
  font-size: 12px;
  font-weight: 600;
}

.md-body { line-height: 1.65; word-break: break-word; }
.md-body p { margin: 0 0 8px; }
.md-body p:last-child { margin-bottom: 0; }
.md-body h1, .md-body h2, .md-body h3, .md-body h4 {
  margin: 10px 0 6px;
  font-weight: 800;
  line-height: 1.35;
}
.md-body h1 { font-size: 16px; }
.md-body h2 { font-size: 14.5px; }
.md-body h3, .md-body h4 { font-size: 13.5px; }
.md-body ul, .md-body ol { margin: 4px 0 8px; padding-left: 18px; }
.md-body li { margin: 2px 0; }
.md-body code {
  background: #EFF6FF;
  color: #1D4ED8;
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.md-body pre.md-code {
  margin: 6px 0;
  padding: 9px 11px;
  border-radius: 9px;
  background: #0F172A;
  color: #E2E8F0;
  font-size: 11.5px;
  line-height: 1.5;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.md-body pre.md-code code { background: none; color: inherit; padding: 0; }
.md-body blockquote {
  margin: 6px 0;
  padding: 4px 10px;
  border-left: 3px solid #93C5FD;
  color: var(--text-2);
  background: #F8FAFC;
}
.md-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 6px 0;
  font-size: 12px;
}
.md-body th, .md-body td {
  border: 1px solid var(--border);
  padding: 5px 8px;
  text-align: left;
}
.md-body th { background: #F8FAFC; font-weight: 700; }

.stream-caret {
  display: inline-block;
  width: 7px;
  height: 14px;
  margin-left: 3px;
  vertical-align: -2px;
  background: #2563EB;
  border-radius: 1px;
  animation: blinkCaret 0.9s steps(1) infinite;
}
@keyframes blinkCaret { 50% { opacity: 0; } }

.approval-card {
  border: 1px solid #93C5FD;
  background: linear-gradient(135deg, #EFF6FF 0%, #FFFFFF 65%);
  border-radius: 14px;
  padding: 13px 15px;
  box-shadow: var(--shadow-sm);
}
.approval-head { font-size: 13.5px; font-weight: 800; color: #1E3A8A; margin-bottom: 4px; }
.approval-desc { font-size: 12.5px; color: var(--text-2); margin-bottom: 10px; line-height: 1.5; }
.approval-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.mobile-stage-wrap { position: relative; flex-direction: column; }
.preview-error-banner {
  position: relative;
  z-index: 6;
  max-width: 440px;
  width: 100%;
  margin-bottom: 10px;
  border: 1px solid #FCA5A5;
  background: #FEF2F2;
  color: #991B1B;
  border-radius: 12px;
  padding: 9px 12px;
  box-shadow: var(--shadow-md);
  font-size: 12px;
}
.preview-err-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.preview-err-msg {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.preview-err-actions { display: flex; gap: 6px; flex-shrink: 0; }
.preview-err-details {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #FECACA;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  max-height: 90px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.checkpoint-wrap { position: relative; }
.checkpoint-popover {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 290px;
  background: #FFFFFF;
  border: 1px solid var(--border-strong);
  border-radius: 13px;
  box-shadow: var(--shadow-md);
  z-index: 40;
  padding: 10px 12px;
}
.checkpoint-popover.open { display: block; }
.cp-pop-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 8px;
}
.cp-pop-list {
  display: grid;
  gap: 7px;
  max-height: 280px;
  overflow-y: auto;
}
.cp-item {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 7px 9px;
  background: #F8FAFC;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.cp-item-title { font-size: 12px; font-weight: 700; color: var(--ink); }
.cp-item-meta { font-size: 11px; color: var(--muted); }

/* ==================== Model Tier, Multi-File Explorer & Headless Playtest QA ==================== */
.composer-wf-row { flex-wrap: wrap; gap: 8px; }
.model-tier-toggle { margin-left: auto; }

.og-explorer {
  display: flex;
  flex: 1;
  min-height: 0;
  width: 100%;
  background: #FFFFFF;
}
.og-file-sidebar {
  width: 228px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: #F8FAFC;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.og-file-sidehead {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
}
.og-file-tree {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.og-file-item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 6px 8px;
  border-radius: 7px;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}
.og-file-item:hover { background: #E2E8F0; }
.og-file-item.active {
  background: #DBEAFE;
  color: #1E40AF;
  font-weight: 700;
}
.og-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.og-file-size { font-size: 10.5px; color: var(--muted); flex-shrink: 0; }
.og-file-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.og-active-path {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.og-img-preview {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  background: repeating-conic-gradient(#F1F5F9 0% 25%, #FFFFFF 0% 50%) 50% / 14px 14px;
}
.og-img-preview img {
  max-width: 85%;
  max-height: 360px;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.og-img-meta { font-size: 12px; color: var(--muted); }

.playtest-report-empty {
  font-size: 12.5px;
  color: var(--muted);
  padding: 6px 2px;
}
.playtest-qa-grid {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 14px;
  align-items: start;
}
.playtest-shot {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
  background: #0F172A;
}
.playtest-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}
.pt-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: #F1F5F9;
  color: var(--ink-2);
}
.pt-pill.ok { background: #DCFCE7; color: #166534; }
.pt-pill.bad { background: #FEE2E2; color: #991B1B; }
@media (max-width: 780px) {
  .og-explorer { flex-direction: column; }
  .og-file-sidebar { width: 100%; max-height: 150px; border-right: 0; border-bottom: 1px solid var(--border); }
  .playtest-qa-grid { grid-template-columns: 1fr; }
}


