:root {
  /* —— 字体 —— */
  --font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', sans-serif;

  /* —— 字号 —— */
  --text-micro: 0.58rem;
  --text-2xs: 0.68rem;
  --text-xs: 0.72rem;
  --text-sm: 0.8125rem;
  --text-base: 0.9375rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.35rem;
  --text-2xl: 1.65rem;
  --text-3xl: 2rem;
  --text-3xl-md: 1.75rem;
  --text-4xl: 2.5rem;
  --text-5xl: 2.75rem;
  --text-display-md: clamp(2rem, 5vw, 3.25rem);
  --text-display-lg: clamp(2rem, 5vw, 3.5rem);
  --text-display-mobile: clamp(2rem, 10vw, 2.85rem);
  --text-display-sm-mobile: clamp(1.65rem, 7vw, 2.15rem);
  --text-display-xs-mobile: clamp(1.55rem, 6.5vw, 2rem);
  --text-display: clamp(2.35rem, 7.2vw, 5rem);
  --text-kicker: clamp(1.05rem, 2.2vw, 1.35rem);
  --text-lead: clamp(0.88rem, 1.55vw, 1.02rem);
  --text-desc: clamp(0.8rem, 1.4vw, 0.92rem);
  --text-input: clamp(0.95rem, 1.6vw, 1.08rem);

  /* —— 字重 —— */
  --weight-light: 300;
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-extrabold: 800;

  /* —— 行高 / 字距 —— */
  --leading-none: 1;
  --leading-tight: 1.2;
  --leading-snug: 1.35;
  --leading-normal: 1.5;
  --tracking-tight: -0.02em;
  --tracking-normal: 0;
  --tracking-wide: 0.03em;

  /* —— 圆角 / 阴影 —— */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);

  /* —— 品牌色 —— */
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --danger: #ef4444;
  --success: #22c55e;

  /* —— 布局 —— */
  --header-h: 56px;
  --sidebar-w: 280px;
  --bottom-nav-h: 0px;

  /* —— 语义色（浅色主题默认） —— */
  --bg: #f4f4f5;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --text: #18181b;
  --text-muted: #71717a;
  --border: #e4e4e7;
  --bubble-user: #6366f1;
  --bubble-user-text: #fff;
  --bubble-ai: #f4f4f5;
  --bubble-ai-text: #18181b;
  --input-bg: #ffffff;
  --overlay: rgba(0, 0, 0, 0.4);

  /* —— 营销首页（固定深色） —— */
  --landing-bg: #000;
  --landing-fg: #fafafa;
  --landing-fg-muted: #a1a1aa;
  --landing-surface: #111113;
  --landing-border: #27272a;
}

[data-theme="dark"] {
  --bg: #09090b;
  --bg-elevated: #18181b;
  --surface: #18181b;
  --surface-2: #27272a;
  --text: #fafafa;
  --text-muted: #a1a1aa;
  --border: #3f3f46;
  --bubble-user: #6366f1;
  --bubble-user-text: #fff;
  --bubble-ai: #27272a;
  --bubble-ai-text: #fafafa;
  --input-bg: #27272a;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --overlay: rgba(0, 0, 0, 0.6);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font);
  font-size: var(--text-md);
  line-height: var(--leading-normal);
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  font-family: inherit;
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: inherit;
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-md); }

p {
  margin: 0;
  line-height: var(--leading-normal);
}

small {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: var(--accent);
}

.hidden {
  display: none !important;
}

/* Auth */
#view-auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(145deg, var(--bg) 0%, var(--surface-2) 100%);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}

.auth-brand {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-brand h1 {
  margin: 0;
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
}

.auth-brand p {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
  font-size: var(--text-base);
}

.auth-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.auth-tabs button {
  flex: 1;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
}

.auth-tabs button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.auth-forgot-wrap {
  margin: 0.45rem 0 0;
  text-align: right;
}

.auth-forgot-wrap .link-btn {
  font-size: var(--text-sm);
}

.auth-back-login {
  width: 100%;
  margin-top: 0.65rem;
}

.auth-legal-consent {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.15rem 0.35rem;
  margin: 0.25rem 0 1rem;
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--text-muted);
}

.auth-legal-consent-row {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.45rem;
  cursor: pointer;
  user-select: none;
}

.auth-legal-consent-row input[type='checkbox'] {
  margin: 0.15rem 0 0;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.auth-legal-consent-links {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem;
}

.auth-legal-consent-links .link-btn {
  font-size: inherit;
}

.auth-legal-sep {
  color: var(--text-muted);
}

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  margin-bottom: 0.35rem;
  color: var(--text-muted);
}

.field input,
.field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
}

.field textarea {
  min-height: 5.5rem;
  resize: vertical;
  line-height: 1.5;
}

.field-hint {
  margin: 0.4rem 0 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-none);
  letter-spacing: var(--tracking-normal);
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.auth-card .btn-primary {
  width: 100%;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
}

.btn-sm {
  padding: 0.4rem 0.65rem;
  font-size: var(--text-sm);
}

.alert {
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  margin-bottom: 1rem;
}

.alert-error {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.alert-info {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

/* App shell */
#view-app {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 100vw;
}

.app-header {
  min-height: var(--header-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  background: color-mix(in srgb, var(--bg-elevated) 72%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 10;
}

#view-app .brand-logo-app {
  color: var(--text);
  font-weight: var(--weight-bold);
  letter-spacing: -0.02em;
}

.app-header-start {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  min-width: 0;
}

.app-header-end {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
  flex-shrink: 0;
}

.app-header-tools {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.brand-logo-app .brand-text {
  font-weight: var(--weight-bold);
  font-size: var(--text-base);
  letter-spacing: -0.02em;
  text-transform: none;
}

.credits-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.6rem;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  white-space: nowrap;
  line-height: 1;
}

button.credits-badge {
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}

button.credits-badge:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 18%, var(--surface-2));
}

.credits-icon {
  font-size: var(--text-base);
  line-height: 1;
}

.credits-badge strong {
  color: var(--accent);
  font-size: var(--text-base);
}

.credits-label {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
}

.header-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s, box-shadow 0.15s;
}

.header-tool-btn:active {
  transform: scale(0.96);
}

.header-tool-theme {
  background: linear-gradient(135deg, var(--accent), #818cf8);
  color: #fff;
  font-size: var(--text-lg);
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35);
}

.header-user-center-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.6rem 0.22rem 0.28rem;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  border-radius: 999px;
  background: var(--surface-2);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--text);
  flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s;
}

.header-user-center-btn:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-2));
}

.header-user-center-btn .header-user-avatar {
  width: 28px;
  height: 28px;
}

.header-user-center-btn .header-user-label {
  white-space: nowrap;
  line-height: 1;
}

.nav-desktop {
  display: none;
}

.plan-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.plan-badge:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.plan-badge.plan-free {
  border-color: rgba(34, 197, 94, 0.35);
  color: #16a34a;
}

.plan-badge.plan-starter {
  border-color: rgba(59, 130, 246, 0.35);
  color: #2563eb;
}

.plan-badge.plan-pro {
  border-color: rgba(139, 92, 246, 0.35);
  color: #7c3aed;
}

.plan-badge.plan-enterprise {
  border-color: rgba(234, 88, 12, 0.35);
  color: #ea580c;
}

.header-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), #818cf8);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: var(--weight-extrabold);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.header-user-avatar.has-image {
  color: transparent;
}

@media (max-width: 768px) {
  #btn-header-upgrade {
    display: none;
  }
}

.nav-feature-btn {
  padding: 0.45rem 0.95rem;
  border: none;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
  font-weight: var(--weight-bold);
  font-size: var(--text-sm);
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.nav-feature-btn:hover {
  color: var(--accent);
}

.nav-feature-btn.active {
  background: linear-gradient(135deg, var(--accent), #818cf8);
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.studio-workspace-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem 0;
  border-bottom: none;
  background: transparent;
}

.studio-workspace-tabs.hidden {
  display: none;
}

.studio-workspace-tab {
  padding: 0.4rem 0.85rem;
  border: none;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
  font-weight: var(--weight-bold);
  font-size: var(--text-sm);
}

.studio-workspace-tab:hover {
  color: var(--accent);
}

.studio-workspace-tab.active {
  background: linear-gradient(135deg, var(--accent), #818cf8);
  color: #fff;
}

.canvas-studio-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.canvas-studio-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  background: color-mix(in srgb, var(--bg-elevated) 55%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.canvas-studio-toolbar-start {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  min-width: 0;
}

.canvas-studio-title {
  margin: 0;
  font-size: var(--text-md);
  font-weight: var(--weight-extrabold);
}

.canvas-graph-name {
  font-weight: var(--weight-bold);
  color: var(--text);
  font-size: var(--text-base);
}

.canvas-graph-meta {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.canvas-studio-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.canvas-studio-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.canvas-studio-work {
  display: flex;
  flex: 1;
  min-height: 0;
  min-width: 0;
}

.canvas-studio-viewport {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  background-color: var(--bg);
  background-image: radial-gradient(
    circle,
    color-mix(in srgb, var(--text-muted) 22%, transparent) 1px,
    transparent 1px
  );
  background-size: 20px 20px;
  background-position: 0 0;
  cursor: grab;
  position: relative;
  touch-action: none;
  outline: none;
}

.canvas-studio-viewport.is-panning {
  cursor: grabbing;
}

.canvas-studio-viewport.is-space-pan {
  cursor: grab;
}

.canvas-viewport-stage {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
}

.canvas-edges-svg {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: auto;
  z-index: 1;
  overflow: visible;
}

.canvas-studio-surface {
  position: relative;
  z-index: 2;
}

.canvas-groups-layer,
.canvas-groups-chrome-layer,
.canvas-nodes-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.canvas-nodes-layer {
  z-index: 2;
}

.canvas-groups-layer {
  z-index: 1;
}

.canvas-groups-chrome-layer {
  z-index: 3;
}

.canvas-group-frame {
  position: absolute;
  box-sizing: border-box;
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--border));
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  pointer-events: none;
}

.canvas-groups-chrome-layer .canvas-group-bar {
  position: absolute;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  height: 22px;
  padding: 0 0.45rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 18%, var(--surface-2));
  color: var(--text-muted);
  font-size: var(--text-2xs);
  font-weight: var(--weight-bold);
  pointer-events: auto;
  cursor: grab;
}

.canvas-group-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: text;
}

.canvas-group-bar-actions {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
}

.canvas-group-bypass,
.canvas-group-ungroup {
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: var(--text-2xs);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  padding: 0 0.15rem;
  white-space: nowrap;
}

.canvas-group-bypass:hover,
.canvas-group-ungroup:hover {
  text-decoration: underline;
}

.canvas-nodes-layer .canvas-node {
  pointer-events: auto;
}

.canvas-edge-hit {
  stroke: transparent;
  pointer-events: stroke;
  cursor: pointer;
}

.canvas-edge-path {
  stroke: color-mix(in srgb, var(--accent) 55%, var(--text-muted));
  pointer-events: none;
  stroke-width: 2.5;
}

.canvas-edge-path.is-selected {
  stroke: var(--accent);
  stroke-width: 3.5;
}

.canvas-edge-preview {
  stroke: var(--accent);
  stroke-dasharray: 6 4;
  opacity: 0.85;
  pointer-events: none;
}

.canvas-studio-viewport.is-canvas-connecting {
  cursor: crosshair;
}

.canvas-viewport-overlay {
  position: absolute;
  right: 0.65rem;
  bottom: 0.65rem;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  pointer-events: none;
}

.canvas-zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.25rem 0.35rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--studio-glass-border, var(--border));
  background: var(--studio-glass-bg, color-mix(in srgb, var(--bg-elevated) 58%, transparent));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 6px 20px color-mix(in srgb, var(--bg) 70%, transparent);
  pointer-events: auto;
}

.canvas-zoom-btn {
  min-width: 1.65rem;
  height: 1.65rem;
  padding: 0;
  border: 1px solid var(--studio-glass-border, var(--border));
  border-radius: 6px;
  background: var(--studio-control-bg, var(--input-bg));
  color: var(--text);
  font-size: var(--text-md);
  line-height: 1;
  cursor: pointer;
}

.canvas-zoom-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.canvas-zoom-btn-text {
  min-width: auto;
  padding: 0 0.45rem;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
}

.canvas-zoom-label {
  min-width: 2.75rem;
  text-align: center;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--text-muted);
  user-select: none;
}

.canvas-viewport-tip {
  margin: 0;
  padding: 0.2rem 0.45rem;
  font-size: var(--text-2xs);
  color: var(--text-muted);
  border-radius: 6px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  pointer-events: none;
}

.canvas-minimap {
  position: absolute;
  top: 0.55rem;
  left: 0.55rem;
  z-index: 4;
  padding: 0.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow);
  pointer-events: auto;
  cursor: crosshair;
}

.canvas-minimap canvas {
  display: block;
  border-radius: 4px;
}

.canvas-marquee {
  position: absolute;
  z-index: 3;
  border: 1px dashed var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  pointer-events: none;
}

.canvas-studio-viewport.is-marquee {
  cursor: crosshair;
}

.canvas-zoom-btn.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-2));
}

.canvas-studio-viewport.is-snap-on {
  background-position: 0 0;
}

.canvas-node {
  --canvas-node-radius: 16px;
  position: absolute;
  min-width: 160px;
  max-width: 420px;
  box-sizing: border-box;
  background: var(--studio-node-bg, var(--studio-glass-bg, color-mix(in srgb, var(--bg-elevated) 58%, transparent)));
  border: 1px solid var(--studio-glass-border, var(--border));
  border-radius: var(--canvas-node-radius);
  box-shadow:
    0 8px 28px color-mix(in srgb, var(--bg) 72%, transparent),
    inset 0 1px 0 color-mix(in srgb, #fff 6%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-size: var(--text-sm);
  z-index: 2;
  overflow: hidden;
}

.canvas-node.is-picker-open {
  overflow: visible;
  z-index: 40;
}

.canvas-node.is-sized {
  display: flex;
  flex-direction: column;
}

.canvas-node.is-connecting {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent);
}

.canvas-node.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent);
}

.canvas-node.canvas-node--running {
  border-color: color-mix(in srgb, var(--accent) 70%, var(--border));
}

.canvas-node.canvas-node--error {
  border-color: var(--danger);
}

.canvas-node-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--studio-glass-border, var(--border));
  background: var(--studio-node-header-bg, var(--studio-muted-bg, color-mix(in srgb, var(--bg) 60%, var(--surface))));
  cursor: grab;
}

.canvas-node-header-actions {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
}

.canvas-node-bypass {
  border: 1px solid var(--studio-glass-border, var(--border));
  border-radius: 6px;
  background: var(--studio-node-control-bg, var(--studio-control-bg, var(--input-bg)));
  color: var(--text-muted);
  font-size: var(--text-micro);
  font-weight: var(--weight-bold);
  line-height: 1.2;
  padding: 0.1rem 0.35rem;
  cursor: pointer;
}

.canvas-node-bypass.is-active {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  color: var(--accent);
}

.canvas-node.canvas-node--bypassed {
  border-style: dashed;
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  opacity: 0.88;
}

.canvas-node.is-resizing {
  will-change: width, height;
  contain: layout style;
}

.canvas-node-title {
  font-weight: var(--weight-extrabold);
  font-size: var(--text-sm);
}

.canvas-node-remove {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--text-xl);
  line-height: 1;
  padding: 0 0.2rem;
}

.canvas-node-ports-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.35rem;
  padding: 0.5rem 0.55rem 0.55rem;
  align-items: start;
}

.canvas-node.is-sized .canvas-node-ports-row {
  flex: 1;
  min-height: 0;
  align-items: stretch;
}

.canvas-node-ports-in,
.canvas-node-ports-out {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.canvas-port {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.2rem;
  font-size: var(--text-2xs);
  color: var(--text-muted);
  cursor: crosshair;
  z-index: 2;
}

.canvas-port::before {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.canvas-port-in.is-drop-target .canvas-port-dot {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 40%, transparent);
  transform: scale(1.15);
}

.canvas-port-out {
  justify-content: flex-end;
}

.canvas-port-dot {
  position: relative;
  z-index: 1;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  border: 2px solid var(--studio-node-bg, var(--studio-glass-bg, var(--bg-elevated)));
  box-shadow: 0 0 0 1px var(--studio-glass-border, var(--border));
  transition: transform 0.12s, box-shadow 0.12s;
}

.canvas-node-resize {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  border: 1px solid var(--border);
  background: linear-gradient(
    135deg,
    transparent 0 45%,
    var(--accent) 45% 55%,
    transparent 55% 65%,
    var(--accent) 65% 75%,
    transparent 75%
  );
  cursor: nwse-resize;
  z-index: 3;
  opacity: 0.75;
}

.canvas-node-resize:hover {
  opacity: 1;
  border-color: var(--accent);
}

.canvas-port-in .canvas-port-dot {
  background: color-mix(in srgb, var(--accent) 55%, var(--text-muted));
}

.canvas-port.is-disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.canvas-port.is-disabled .canvas-port-dot {
  background: var(--text-muted);
  box-shadow: none;
}

.canvas-port.is-disabled .canvas-port-label {
  color: var(--text-muted);
}

.canvas-port-in.is-disabled:not(.is-connected) {
  pointer-events: none;
}

.canvas-port.is-connected.is-disabled .canvas-port-dot {
  background: color-mix(in srgb, var(--accent) 55%, var(--text-muted));
  opacity: 0.55;
}

.canvas-port.is-connected .canvas-port-dot {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent);
}

.canvas-studio-viewport.is-canvas-disconnecting {
  cursor: not-allowed;
}

.canvas-node-body-stack {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: 100%;
  min-width: 0;
}

.canvas-node-run-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.canvas-node-settings {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.15rem 0 0.5rem;
  border-bottom: 1px dashed color-mix(in srgb, var(--border) 70%, transparent);
}

.canvas-node-setting {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.canvas-node-setting-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
  line-height: 1.3;
}

.canvas-node-setting--model {
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.4rem;
}

.canvas-node-setting--model > .model-picker-label {
  flex: 0 0 auto;
  max-width: 42%;
}

.canvas-node-model-picker.model-picker {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
  width: auto;
}

.canvas-node-model-picker .model-picker-control {
  flex: 1 1 auto;
  min-width: 0;
}

.canvas-node-model-picker .model-picker-menu {
  z-index: 1200;
}

.canvas-node-setting-select,
.canvas-node-setting-textarea {
  width: 100%;
  box-sizing: border-box;
  font-size: var(--text-sm);
  line-height: 1.45;
  border: 1px solid var(--studio-glass-border, var(--border));
  border-radius: var(--radius-sm);
  background: var(--studio-node-control-bg, var(--studio-control-bg, var(--input-bg)));
  color: var(--text);
  padding: 0.45rem 0.55rem;
}

.canvas-node-setting-select {
  min-height: 2.1rem;
  cursor: pointer;
}

.canvas-node-setting-textarea {
  resize: vertical;
  min-height: 3.25rem;
}

.canvas-node-output-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.canvas-node-output {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 4.5rem;
  max-height: 14rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--studio-glass-border, var(--border));
  border-radius: 8px;
  background: var(--studio-node-control-bg, var(--input-bg));
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
  line-height: 1.45;
  cursor: text;
  user-select: text;
}

.canvas-node-output:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-color: var(--accent);
}

.canvas-node-setting-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.canvas-node-chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--studio-muted-bg, color-mix(in srgb, var(--bg) 60%, var(--surface)));
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  padding: 0.28rem 0.55rem;
  cursor: pointer;
  line-height: 1.35;
  transition:
    border-color 0.15s,
    color 0.15s,
    background 0.15s;
}

.canvas-node-chip:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  color: var(--text);
}

.canvas-node-chip.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: var(--weight-bold);
}

.canvas-node-body {
  min-width: 0;
}

.canvas-node.is-sized .canvas-node-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.canvas-node-inline,
.canvas-inspector-textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 3.25rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--studio-glass-border, var(--border));
  border-radius: 8px;
  background: var(--studio-node-control-bg, var(--input-bg));
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
  line-height: 1.45;
}

.canvas-node-upload-btn {
  display: block;
  text-align: center;
  padding: 0.5rem;
  border: 1px dashed var(--studio-glass-border, var(--border));
  border-radius: 6px;
  background: var(--studio-node-control-bg, color-mix(in srgb, var(--input-bg) 50%, transparent));
  cursor: pointer;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.canvas-node.is-sized .canvas-node-header {
  flex-shrink: 0;
}

.canvas-node.is-sized .canvas-node-body-stack {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.canvas-node.is-sized .canvas-node-settings,
.canvas-node.is-sized .canvas-node-run-meta,
.canvas-node.is-sized .canvas-node-web-sources {
  flex-shrink: 0;
}

.canvas-node.is-sized .canvas-node-output-wrap--fill {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.canvas-node.is-sized .canvas-node-body > .canvas-node-output-wrap--fill {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.canvas-node.is-sized .canvas-node-body > .canvas-node-inline {
  flex: 1;
  min-height: 0;
}

.canvas-node.is-sized .canvas-node-inline,
.canvas-node.is-sized .canvas-node-output {
  flex: 1;
  min-height: 0;
  height: auto;
  max-height: none;
  resize: none;
  overflow: auto;
}

.canvas-node.is-sized .canvas-node-setting-textarea {
  flex: 0 1 auto;
  resize: vertical;
  max-height: 9rem;
}

.canvas-node.is-sized .canvas-node-upload-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
}

.canvas-node-preview-media {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: color-mix(in srgb, var(--surface-2) 80%, transparent);
  overflow: hidden;
}

.canvas-node-setting-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--studio-glass-border, var(--border));
  border-radius: 8px;
  background: var(--studio-node-control-bg, var(--input-bg));
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
}

.canvas-node-preview-audio,
.canvas-node-preview-video {
  width: 100%;
  max-height: 160px;
  border-radius: 8px;
  background: var(--surface-2);
}

.canvas-node-preview-img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 140px;
  border-radius: 6px;
  display: block;
  object-fit: contain;
}

.canvas-node.is-sized .canvas-node-preview-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.canvas-node.is-sized .canvas-node-preview-media {
  flex: 1;
  min-height: 4.5rem;
  max-height: none;
  aspect-ratio: auto;
}

.canvas-node.is-sized .canvas-node-preview-img {
  flex: 1;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
  margin: 0 auto;
}

.canvas-node-muted {
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.canvas-node-progress {
  position: relative;
  width: 100%;
}

.canvas-node-progress-track {
  height: 1.15rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--border) 55%, var(--surface-2));
  overflow: hidden;
}

.canvas-node-progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0%, #818cf8 45%, #a78bfa 100%);
  transition: width 0.38s ease;
}

.canvas-node-progress.is-running .canvas-node-progress-fill {
  background: linear-gradient(
    90deg,
    var(--accent) 0%,
    #818cf8 35%,
    #c4b5fd 55%,
    #818cf8 75%,
    var(--accent) 100%
  );
  background-size: 220% 100%;
  animation: canvas-node-progress-shine 1.6s ease-in-out infinite;
}

.canvas-node-progress.is-done .canvas-node-progress-fill {
  background: linear-gradient(90deg, var(--accent), #818cf8);
  animation: none;
}

.canvas-node-progress.is-error .canvas-node-progress-fill {
  background: linear-gradient(90deg, var(--danger), #f87171);
  animation: none;
}

.canvas-node-progress-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-2xs);
  font-weight: var(--weight-bold);
  line-height: 1;
  color: var(--text-muted);
  pointer-events: none;
}

.canvas-node-progress.is-running .canvas-node-progress-text,
.canvas-node-progress.is-done .canvas-node-progress-text {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.canvas-node-progress.is-error .canvas-node-progress-text {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

@keyframes canvas-node-progress-shine {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: 0% 0;
  }
}

.canvas-node-error {
  margin: 0.25rem 0 0;
  font-size: var(--text-xs);
  color: var(--danger);
}

.canvas-palette {
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--studio-glass-border, var(--border));
}

.canvas-palette-group {
  margin-bottom: 0.5rem;
}

.canvas-palette-title {
  margin: 0 0 0.3rem;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.canvas-palette-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.canvas-template-btn {
  width: 100%;
  margin-top: 0.35rem;
}

.canvas-node-inspector {
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.canvas-inspector-select,
.canvas-inspector-input {
  width: 100%;
  margin-bottom: 0.5rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--studio-control-bg, var(--input-bg));
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
  box-sizing: border-box;
}

.canvas-inspector-delete {
  margin-top: 0.35rem;
}

.canvas-bridge-section {
  margin-bottom: 0.75rem;
}

.canvas-run-log {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.canvas-run-log-title {
  margin: 0 0 0.35rem;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--text-muted);
}

.canvas-run-log-body {
  margin: 0;
  max-height: 120px;
  overflow: auto;
  font-size: var(--text-xs);
  line-height: 1.45;
  white-space: pre-wrap;
  color: var(--text-muted);
}

.canvas-studio-inspector {
  width: min(100%, 280px);
}

.canvas-studio-viewport > .canvas-studio-empty {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  text-align: center;
  max-width: 28rem;
  margin: auto;
  pointer-events: none;
}

.canvas-studio-empty.hidden {
  display: none;
}

.canvas-empty-title {
  margin: 0 0 0.5rem;
  font-size: var(--text-lg);
  font-weight: var(--weight-extrabold);
}

.canvas-empty-lead,
.canvas-empty-hint {
  margin: 0 0 0.65rem;
  color: var(--text-muted);
  font-size: var(--text-base);
  line-height: 1.5;
}

.canvas-studio-inspector {
  width: min(100%, 300px);
  flex-shrink: 0;
  border-left: 1px solid var(--studio-glass-border, var(--border));
  background: var(--studio-glass-bg, color-mix(in srgb, var(--bg-elevated) 58%, transparent));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 0.75rem;
  overflow-y: auto;
}

.canvas-inspector-title {
  margin: 0 0 0.35rem;
  font-size: var(--text-base);
}

.canvas-inspector-desc {
  margin: 0 0 0.75rem;
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.45;
}

.canvas-inspector-empty-hint {
  margin: 0.35rem 0 0;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px dashed var(--border);
  background: var(--surface-2);
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text-muted);
}

.canvas-inspector-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  margin: 0.5rem 0 0.25rem;
  color: var(--text-muted);
}

.canvas-studio-inspector textarea {
  width: 100%;
  resize: vertical;
  min-height: 4rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--studio-control-bg, var(--input-bg));
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
}

.canvas-workflow-select {
  max-width: 11rem;
  padding: 0.28rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
}

.canvas-template-list {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.canvas-cloud-panel {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.canvas-cloud-panel .canvas-workflow-select {
  max-width: 100%;
  width: 100%;
}

.canvas-cloud-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.canvas-node-setting-hint {
  margin: 0.25rem 0 0;
  font-size: var(--text-xs);
  line-height: 1.45;
  color: var(--text-muted);
}

.canvas-run-history-panel {
  margin-top: 0.65rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.canvas-run-history-title {
  margin: 0 0 0.35rem;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--text-muted);
}

.canvas-run-history-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-xs);
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.canvas-palette-btn[draggable='true'] {
  cursor: grab;
}

#page-canvas .canvas-palette-btn {
  border-color: var(--border);
  background: var(--studio-muted-bg, color-mix(in srgb, var(--bg) 60%, var(--surface)));
  color: var(--text-muted);
}

#page-canvas .canvas-palette-btn:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 8%, var(--studio-muted-bg, var(--surface-2)));
}

#page-canvas .canvas-node-model-picker .model-picker-trigger {
  background: var(--studio-node-control-bg, var(--studio-control-bg, var(--input-bg)));
  border-color: var(--studio-glass-border, var(--border));
}

#page-canvas .canvas-node-model-picker .model-picker-trigger:hover,
#page-canvas .canvas-node-model-picker .model-picker-trigger[aria-expanded='true'] {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent);
}

.canvas-studio-toolbar-actions {
  flex-wrap: wrap;
  gap: 0.25rem;
}

.canvas-studio-toast {
  position: fixed;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: var(--text);
  color: var(--surface);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  z-index: 120;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.app-body.layout-canvas .sidebar {
  display: none !important;
}

#page-canvas.page.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.canvas-mobile-dock,
.canvas-mobile-backdrop,
.canvas-toolbar-more-btn,
.canvas-toolbar-more-sheet,
.canvas-mobile-overlay-portal {
  display: none;
}

.canvas-mobile-overlay-portal {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
}

@media (max-width: 768px) {
  .layout-canvas .studio-workspace-tabs {
    flex-shrink: 0;
  }

  .canvas-mobile-overlay-portal.is-canvas-active {
    display: block;
  }

  .canvas-mobile-dock {
    display: flex;
    flex-shrink: 0;
    align-items: stretch;
    gap: 0.35rem;
    padding: 0.4rem 0.5rem calc(0.4rem + env(safe-area-inset-bottom));
    border-top: 1px solid var(--studio-glass-border, var(--border));
    background: var(--studio-glass-bg, color-mix(in srgb, var(--bg-elevated) 58%, transparent));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 3;
  }

  .canvas-mobile-dock-btn {
    flex: 1;
    min-height: 2.35rem;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: var(--text-sm);
    font-weight: var(--weight-bold);
    cursor: pointer;
  }

  .canvas-mobile-dock-btn.is-active {
    border-color: var(--accent);
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, var(--surface-2));
  }

  .canvas-mobile-backdrop {
    display: block !important;
    position: fixed;
    inset: 0;
    z-index: 1;
    background: var(--overlay);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
      opacity 0.28s ease,
      visibility 0s linear 0.28s;
    touch-action: none;
  }

  .canvas-mobile-backdrop.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition:
      opacity 0.28s ease,
      visibility 0s;
  }

  .canvas-mobile-backdrop.hidden:not(.is-visible) {
    display: block !important;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  .canvas-studio-shell.is-toolbar-more-open .canvas-studio-viewport,
  .canvas-studio-shell.is-inspector-open .canvas-studio-viewport,
  .canvas-studio-shell.is-inspector-closing .canvas-studio-viewport {
    pointer-events: none;
  }

  .canvas-toolbar-more-btn {
    display: inline-flex;
  }

  .canvas-toolbar-more-sheet {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--canvas-mobile-overlay-bottom, 3.15rem);
    z-index: 3;
    max-height: min(58vh, 380px);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.55rem 0.55rem 0.7rem;
    border-top: 1px solid var(--border);
    border-radius: 14px 14px 0 0;
    background: var(--bg);
    box-shadow: 0 -16px 48px color-mix(in srgb, var(--bg) 55%, transparent);
    touch-action: manipulation;
    transform: translate3d(0, 110%, 0);
    visibility: hidden;
    pointer-events: none;
    transition:
      transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
      visibility 0.28s;
  }

  .canvas-mobile-overlay-portal.is-toolbar-more-open .canvas-toolbar-more-sheet {
    transform: translate3d(0, 0, 0);
    visibility: visible;
    pointer-events: auto;
  }

  .canvas-toolbar-more-sheet-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: flex-start;
  }

  .canvas-toolbar-more-sheet-inner .btn {
    flex: 1 1 calc(50% - 0.2rem);
    min-width: 7.5rem;
    justify-content: center;
  }

  .canvas-studio-toolbar {
    flex-wrap: nowrap;
    align-items: center;
    padding: 0.4rem 0.5rem;
    gap: 0.35rem;
    flex-shrink: 0;
  }

  .canvas-studio-toolbar-start {
    flex: 0 1 auto;
    min-width: 0;
  }

  .canvas-studio-title {
    display: none;
  }

  .canvas-graph-meta {
    display: none;
  }

  .canvas-graph-name {
    max-width: 5.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--text-sm);
  }

  .canvas-studio-toolbar-actions {
    flex: 1 1 0;
    min-width: 0;
    flex-wrap: nowrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.3rem;
    overflow: visible;
  }

  .canvas-studio-toolbar.is-more-open .canvas-toolbar-more-btn {
    border-color: var(--accent);
    color: var(--accent);
  }

  .canvas-studio-work {
    flex: 1 1 0;
    min-height: 0;
    min-width: 0;
    overflow: visible;
    position: relative;
  }

  .canvas-studio-body {
    flex: 1 1 0;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
    order: 1;
  }

  .canvas-studio-viewport {
    flex: 1 1 0;
    min-height: 0;
  }

  .canvas-viewport-tip {
    display: none;
  }

  .canvas-viewport-overlay {
    right: 0.45rem;
    bottom: 0.45rem;
  }

  .canvas-zoom-controls {
    flex-wrap: wrap;
    max-width: calc(100vw - 1.5rem);
    gap: 0.15rem;
    padding: 0.2rem 0.28rem;
  }

  .canvas-zoom-btn-text#canvas-snap-toggle {
    display: none;
  }

  .canvas-minimap {
    display: none;
  }

  .canvas-studio-inspector {
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--canvas-mobile-overlay-bottom, 3.15rem);
    z-index: 2;
    width: 100%;
    max-width: none;
    max-height: min(72vh, 520px);
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 14px 14px 0 0;
    background: var(--bg);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: 0 -16px 48px color-mix(in srgb, var(--bg) 55%, transparent);
    pointer-events: none;
    visibility: hidden;
    transform: translate3d(0, 100%, 0);
    transition:
      transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
      visibility 0s linear 0.28s;
    will-change: transform;
    touch-action: pan-y;
    padding-bottom: 0.75rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .canvas-mobile-overlay-portal.is-inspector-open:not(.is-inspector-closing) .canvas-studio-inspector,
  .canvas-studio-shell.is-inspector-open:not(.is-inspector-closing) .canvas-studio-inspector {
    transform: translate3d(0, 0, 0);
    visibility: visible;
    pointer-events: auto;
    transition:
      transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
      visibility 0s;
  }

  .canvas-mobile-overlay-portal.is-inspector-closing .canvas-studio-inspector,
  .canvas-studio-shell.is-inspector-closing .canvas-studio-inspector {
    transform: translate3d(0, 100%, 0);
    visibility: visible;
    pointer-events: none;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .canvas-mobile-overlay-portal.is-canvas-active.is-inspector-open,
  .canvas-mobile-overlay-portal.is-canvas-active.is-inspector-closing,
  .canvas-mobile-overlay-portal.is-canvas-active.is-toolbar-more-open {
    pointer-events: none;
  }

  .canvas-mobile-overlay-portal.is-inspector-open .canvas-mobile-backdrop.is-visible,
  .canvas-mobile-overlay-portal.is-inspector-open:not(.is-inspector-closing) .canvas-studio-inspector,
  .canvas-mobile-overlay-portal.is-inspector-closing .canvas-mobile-backdrop.is-visible,
  .canvas-mobile-overlay-portal.is-toolbar-more-open .canvas-mobile-backdrop.is-visible,
  .canvas-mobile-overlay-portal.is-toolbar-more-open .canvas-toolbar-more-sheet {
    pointer-events: auto;
  }

  .canvas-mobile-overlay-portal.is-inspector-focus-settings .canvas-palette,
  .canvas-mobile-overlay-portal.is-inspector-focus-settings .canvas-template-list,
  .canvas-mobile-overlay-portal.is-inspector-focus-settings .canvas-cloud-panel,
  .canvas-mobile-overlay-portal.is-inspector-focus-settings .canvas-bridge-section,
  .canvas-mobile-overlay-portal.is-inspector-focus-settings .canvas-run-history-panel {
    display: none;
  }

  .canvas-mobile-overlay-portal.is-inspector-focus-settings #canvas-node-inspector:not(.hidden),
  .canvas-mobile-overlay-portal.is-inspector-focus-settings #canvas-run-log:not(.hidden),
  .canvas-studio-shell.is-inspector-focus-settings #canvas-node-inspector:not(.hidden),
  .canvas-studio-shell.is-inspector-focus-settings #canvas-run-log:not(.hidden) {
    display: block;
  }

  .canvas-mobile-overlay-portal.is-inspector-focus-palette .canvas-node-inspector,
  .canvas-mobile-overlay-portal.is-inspector-focus-palette .canvas-run-log {
    display: none !important;
  }
}

@media (min-width: 769px) {
  .studio-workspace-tabs {
    display: none;
  }

  .canvas-studio-toolbar {
    flex-wrap: wrap;
  }

  .canvas-studio-shell.is-inspector-focus-settings .canvas-palette,
  .canvas-studio-shell.is-inspector-focus-settings .canvas-template-list,
  .canvas-studio-shell.is-inspector-focus-settings .canvas-cloud-panel,
  .canvas-studio-shell.is-inspector-focus-settings .canvas-bridge-section,
  .canvas-studio-shell.is-inspector-focus-settings .canvas-run-history-panel {
    display: none;
  }

  .canvas-studio-shell.is-inspector-focus-settings #canvas-node-inspector:not(.hidden),
  .canvas-studio-shell.is-inspector-focus-settings #canvas-run-log:not(.hidden) {
    display: block;
  }

  .canvas-studio-shell.is-inspector-focus-palette .canvas-node-inspector,
  .canvas-studio-shell.is-inspector-focus-palette .canvas-run-log {
    display: none !important;
  }

  .canvas-toolbar-more-sheet {
    display: flex;
    flex: 1 1 100%;
    width: 100%;
    order: 3;
    position: static;
    transform: none !important;
    visibility: visible !important;
    pointer-events: auto !important;
    max-height: none;
    overflow: visible;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
  }

  .canvas-toolbar-more-sheet-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: flex-end;
    width: 100%;
  }

  .canvas-toolbar-more-sheet-inner .btn {
    flex: 0 1 auto;
    min-width: 0;
  }
}

.pricing-promo-line {
  text-align: center;
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: var(--text-base);
}

.pricing-promo-line strong {
  color: var(--accent);
}

.pricing-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1.25rem;
}

.site-nav .site-nav-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
}

.site-nav .site-nav-link:hover {
  color: var(--accent);
}

#view-plans {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  max-width: 100vw;
  overflow-x: hidden;
  flex-direction: column;
}

.plans-page-main {
  flex: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  width: 100%;
}

.plans-page-hero {
  text-align: center;
  margin-bottom: 2rem;
}

.plans-page-hero h1 {
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  margin: 0.5rem 0 0.75rem;
  line-height: 1.2;
}

.plans-page-hero .lead {
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

.plans-payment-banner {
  max-width: 720px;
  margin: 1rem auto 0;
  padding: 0.65rem 1rem;
  font-size: var(--text-base);
  line-height: 1.45;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-radius: 10px;
}

.plans-page-section {
  margin-bottom: 2.5rem;
}

.plans-page-section h2 {
  font-size: var(--text-xl);
  margin: 0 0 0.5rem;
}

.plans-grid-page {
  margin-top: 1rem;
  gap: 1.1rem;
}

@media (min-width: 1200px) {
  .plans-grid-page {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.plan-current-box-lg {
  padding: 1.1rem 1.25rem;
}

.plans-notes-list {
  margin: 0 0 1.25rem;
  padding-left: 1.25rem;
  color: var(--text-muted);
  font-size: var(--text-base);
  line-height: 1.6;
}

.plans-model-pricing-section {
  padding: 1.25rem 1.35rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.plans-model-pricing-section .section-desc {
  margin-bottom: 1.25rem;
}

.plans-model-pricing-root {
  margin-top: 0.5rem;
}

.plans-pricing-stack {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.plans-pricing-block--table {
  padding-top: 0.25rem;
}

.plans-pricing-chip-lead {
  margin: 0 0 0.65rem;
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.5;
}

.plans-pricing-detail {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.plans-pricing-detail summary {
  cursor: pointer;
  font-weight: var(--weight-semibold);
  color: var(--accent);
  list-style: none;
}

.plans-pricing-detail summary::-webkit-details-marker {
  display: none;
}

.plans-pricing-detail-body {
  margin: 0.65rem 0 0;
  line-height: 1.6;
}

.plans-pricing-detail-body + .plans-pricing-detail-body {
  margin-top: 0.45rem;
}

.plans-pricing-detail-muted {
  font-size: var(--text-sm);
  opacity: 0.9;
}

.plans-pricing-bases {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.6rem;
  margin: 0;
}

.plans-pricing-base-chip {
  font-size: var(--text-sm);
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-2, var(--surface)));
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.plans-pricing-base-chip b {
  color: var(--text);
  font-weight: var(--weight-semibold);
}

.plans-pricing-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 1rem;
}

.plans-pricing-tab {
  font-size: var(--text-sm);
  padding: 0.38rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.plans-pricing-tab:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  color: var(--text);
}

.plans-pricing-tab.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--text);
  font-weight: var(--weight-semibold);
}

.plans-pricing-panel {
  margin: 0;
}

.plans-pricing-table-hint {
  margin: 0 0 0.75rem;
  font-size: var(--text-sm);
  line-height: 1.55;
  color: var(--text-muted);
}

.plans-pricing-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.plans-pricing-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: var(--text-base);
}

.plans-pricing-table th,
.plans-pricing-table td {
  padding: 0.42rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.plans-pricing-table th {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
  white-space: nowrap;
}

.plans-pricing-table tbody tr:hover {
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}

.plans-pricing-model-name {
  font-weight: var(--weight-medium);
}

.plans-pricing-num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.plans-pricing-plan {
  color: var(--text-muted);
  font-size: var(--text-sm);
  white-space: nowrap;
}

.plans-pricing-tier {
  display: inline-block;
  font-size: var(--text-xs);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.plans-pricing-tier--free { color: var(--text-muted); }
.plans-pricing-tier--economy {
  border-color: color-mix(in srgb, #3b82f6 35%, var(--border));
  color: #3b82f6;
}
.plans-pricing-tier--flagship {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  color: var(--accent);
}
.plans-pricing-tier--ultra {
  border-color: color-mix(in srgb, #a855f7 40%, var(--border));
  color: #a855f7;
}

.plans-page-notes {
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  gap: 1rem;
  align-items: stretch;
}

.plans-grid-account {
  margin-top: 1rem;
}

.plan-card {
  position: relative;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.plan-card:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.plan-card.current {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent),
    0 10px 28px color-mix(in srgb, var(--accent) 12%, transparent);
}

.plan-card-header {
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--plan-accent, var(--accent)) 8%, var(--surface)) 0%,
    var(--surface) 100%
  );
}

.plan-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.75rem 1rem 0.85rem;
}

.plan-card-footer {
  padding: 0 1rem 1rem;
  margin-top: auto;
}

.plan-card-block {
  margin: 0;
}

.plan-card-block + .plan-card-block {
  padding-top: 0.65rem;
  border-top: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
}

.plan-card-block-label {
  margin: 0 0 0.4rem;
  font-size: var(--text-2xs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.plan-card-stat {
  margin: 0;
  font-size: var(--text-base);
  line-height: 1.35;
  color: var(--text);
}

.plan-card-stat-primary {
  font-size: var(--text-md);
  font-weight: var(--weight-extrabold);
  color: var(--plan-accent, var(--accent));
}

.plan-card-stat-hint {
  margin: 0.25rem 0 0;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  line-height: 1.35;
  color: var(--text-muted);
}

.plan-card-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.plan-card-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  line-height: 1.2;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}

.plan-card-limit-grid {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
}

.plan-card-limit-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.4rem 0.45rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid color-mix(in srgb, var(--border) 90%, transparent);
  min-width: 0;
}

.plan-card-limit-label {
  font-size: var(--text-2xs);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.plan-card-limit-value {
  font-size: var(--text-base);
  font-weight: var(--weight-extrabold);
  color: var(--text);
  line-height: 1.1;
}

.plan-card-limit-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.plan-card-block-usage .plan-card-block-label {
  color: var(--accent);
}

.plan-card-usage {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.plan-card-usage-mixed {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text);
  padding: 0.45rem 0.5rem;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
}

.plan-card-usage-mixed strong {
  color: var(--accent);
  font-weight: var(--weight-extrabold);
}

.plan-card-usage-sub {
  margin: 0;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
}

.plan-card-usage-list {
  margin: 0;
  padding: 0 0 0 1rem;
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--text-muted);
}

.plan-card-usage-list li + li {
  margin-top: 0.2rem;
}

.plan-card-usage-foot {
  margin: 0;
  font-size: var(--text-2xs);
  line-height: 1.4;
  color: var(--text-muted);
}

.plan-card-usage-pack {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text-muted);
}

.plan-current-usage {
  color: var(--text) !important;
  font-weight: var(--weight-semibold);
}

.plan-card-block-desc .plan-card-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 0;
  line-height: 1.55;
}

.plan-card-feature-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.plan-card-feature-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.plan-card-feature-name {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--text);
}

.plan-card-model-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
}

.plan-card-model-chip {
  display: inline-block;
  max-width: 100%;
  padding: 0.15rem 0.42rem;
  font-size: var(--text-2xs);
  font-weight: var(--weight-semibold);
  line-height: 1.35;
  border-radius: 6px;
  background: color-mix(in srgb, var(--plan-accent, var(--accent)) 10%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--plan-accent, var(--accent)) 22%, var(--border));
  color: var(--text);
  word-break: break-word;
}

.plan-card-model-chip.is-empty {
  opacity: 0.55;
}

.plan-card-title-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.plan-card .plan-card-name {
  font-size: var(--text-lg);
  font-weight: var(--weight-extrabold);
  margin: 0;
  letter-spacing: -0.02em;
}

.plan-card-marketing {
  font-size: var(--text-2xs);
  font-weight: var(--weight-bold);
  padding: 0.14rem 0.45rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--plan-accent, var(--accent)) 18%, transparent);
  color: var(--plan-accent, var(--accent));
  border: 1px solid color-mix(in srgb, var(--plan-accent, var(--accent)) 28%, transparent);
}

.plan-card .plan-card-price {
  font-size: var(--text-2xl);
  font-weight: var(--weight-extrabold);
  color: var(--plan-accent, var(--accent));
  margin: 0;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.plan-card .plan-card-price span {
  display: block;
  margin-top: 0.2rem;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
  letter-spacing: 0;
}

.plan-card-free {
  --plan-accent: #16a34a;
}

.plan-card-starter {
  --plan-accent: #2563eb;
}

.plan-card-pro {
  --plan-accent: #7c3aed;
}

.plan-card-enterprise {
  --plan-accent: #ea580c;
}

.plan-card-credits {
  --plan-accent: #0d9488;
}

.plan-card-tag-pack {
  background: color-mix(in srgb, var(--plan-accent) 88%, #14b8a6);
}

.plan-card .plan-card-tag {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 1;
  font-size: var(--text-2xs);
  font-weight: var(--weight-bold);
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: var(--plan-accent, var(--accent));
  color: #fff;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--plan-accent, var(--accent)) 35%, transparent);
}

.plan-current-box {
  padding: 0.85rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  --plan-accent: var(--accent);
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--plan-accent) 12%, var(--surface)) 0%,
    color-mix(in srgb, var(--plan-accent) 5%, var(--surface-2)) 55%,
    var(--surface-2) 100%
  );
  border-color: color-mix(in srgb, var(--plan-accent) 28%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--plan-accent) 10%, transparent),
    0 6px 20px color-mix(in srgb, var(--plan-accent) 8%, transparent);
}

.plan-current-box-free {
  --plan-accent: #16a34a;
}

.plan-current-box-starter {
  --plan-accent: #2563eb;
}

.plan-current-box-pro {
  --plan-accent: #7c3aed;
}

.plan-current-box-enterprise {
  --plan-accent: #ea580c;
}

.plan-current-box .plan-current-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-extrabold);
  margin: 0 0 0.35rem;
  color: color-mix(in srgb, var(--plan-accent) 72%, var(--text));
}

.plan-current-box .plan-current-meta {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

.plan-usage-hint {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 0.65rem 0 0;
  line-height: 1.45;
}

.plan-card .plan-card-cta {
  width: 100%;
  margin: 0;
  cursor: pointer;
}

.plan-card .plan-card-cta.btn-ghost {
  color: var(--text);
  border-color: var(--border);
}

@media (max-width: 640px) {
  #btn-header-upgrade {
    display: none;
  }
}

.app-body {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 0.5rem;
}

.sidebar-header .btn {
  flex: 1;
}

.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.history-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.25rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  color: var(--text);
}

.history-item:hover {
  background: var(--surface-2);
}

.history-item.active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent);
}

.history-item .title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item .meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.main-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.page {
  flex: 1;
  display: none;
  flex-direction: column;
  min-height: 0;
}

.page.active {
  display: flex;
}

/* Chat — 左栏历史 + 主区 */
.chat-studio-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  min-width: 0;
  position: relative;
}

.chat-history-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 24;
  background: var(--overlay);
}

.chat-history-overlay.is-open {
  display: block;
}

.chat-history-rail {
  --chat-history-w: 232px;
  width: var(--chat-history-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--studio-glass-border, color-mix(in srgb, var(--border) 55%, transparent));
  background: var(--studio-glass-bg, color-mix(in srgb, var(--bg-elevated) 58%, transparent));
}

.chat-history-rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
}

.chat-history-rail-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.chat-history-rail-close {
  display: none;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: var(--text-xl);
  line-height: 1;
  cursor: pointer;
  padding: 0.1rem 0.25rem;
}

.chat-history-rail-close:hover {
  color: var(--text);
}

.chat-history-rail-actions {
  display: flex;
  gap: 0.45rem;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
}

.chat-history-rail-actions .btn {
  flex: 1;
}

.chat-history-rail .history-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.45rem;
}

.chat-studio-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-history-mobile-toggle {
  display: none;
  flex-shrink: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: var(--text-md);
  line-height: 1;
}

.chat-toolbar {
  padding: 0.5rem 1rem;
  border-bottom: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  background: transparent;
}

#page-chat .studio-toolbar.chat-toolbar {
  flex-direction: row;
  align-items: center;
}

.chat-toolbar-models {
  flex: 1 1 auto;
  min-width: 0;
}

#page-chat .chat-toolbar .model-picker {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
  width: 100%;
}

#page-chat .chat-toolbar .model-picker-control {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
}

#page-chat .chat-toolbar .model-picker-trigger {
  min-width: 0;
}

.studio-field-label,
.model-picker-label,
.studio-param-label,
.studio-aspect-label {
  flex: 0 0 auto;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
  white-space: nowrap;
  line-height: 1.2;
  margin: 0;
}

/* Unified studio toolbar (models only) */
.studio-toolbar {
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
}

.studio-model-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.65rem;
  width: 100%;
}

.studio-model-params-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1 1 100%;
  width: 100%;
  min-width: 0;
}

.studio-model-params-row.hidden {
  display: none;
}

.studio-param-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  width: 100%;
}

.studio-param-label {
  flex: 0 0 auto;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
  white-space: nowrap;
}

.studio-param-chips {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  gap: 0.35rem;
  align-items: center;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-bottom: 2px;
}

.studio-param-btn {
  flex: 0 0 auto;
  padding: 0.28rem 0.55rem;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 60%, var(--surface));
  color: var(--text-muted);
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s;
}

.studio-param-btn:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

.studio-param-btn.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.model-picker-detail {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
}

.model-picker-detail.hidden {
  display: none;
}

.model-picker-detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
  margin-bottom: 0.45rem;
}

.model-picker-detail-title {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--text);
}

.model-picker-detail-tag {
  font-size: var(--text-2xs);
  font-weight: var(--weight-bold);
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
}

.model-picker-detail-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.28rem 0.75rem;
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.45;
}

.model-picker-detail-grid dt {
  margin: 0;
  color: var(--text-muted);
  font-weight: var(--weight-semibold);
  white-space: nowrap;
}

.model-picker-detail-grid dd {
  margin: 0;
  color: var(--text);
  word-break: break-word;
}

/* Route / capability / compose — above prompt */
.studio-composer-controls {
  padding: 0 0 0.55rem;
  margin-bottom: 0.15rem;
}

.studio-composer-controls-top {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.studio-composer-route {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.55rem;
  width: 100%;
}

.studio-composer-route .studio-segmented {
  flex: 0 0 auto;
}

.studio-capability-row,
.studio-compose-row,
.studio-aspect-row,
.studio-voice-row,
.studio-model-params-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  flex: 1 1 auto;
  min-width: 0;
}

#studio-capability-row:not(.hidden) {
  flex: 1 1 100%;
  width: 100%;
}

.studio-composer-controls-top > .studio-model-params-row:not(.hidden) {
  flex: 1 1 100%;
  width: 100%;
}

.studio-aspect-label {
  flex: 0 0 auto;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
  white-space: nowrap;
}

.studio-aspect-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.studio-aspect-btn {
  padding: 0.28rem 0.55rem;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 60%, var(--surface));
  color: var(--text-muted);
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s;
}

.studio-aspect-btn:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

.studio-aspect-btn.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.studio-voice-toggle {
  flex: 0 0 auto;
  padding: 0.28rem 0.65rem;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 60%, var(--surface));
  color: var(--text-muted);
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s;
}

.studio-voice-toggle:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

.studio-voice-toggle.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.studio-voice-modes-wrap {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.studio-voice-ref-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.studio-voice-ref-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-voice-clone-hint {
  flex: 1 1 100%;
  width: 100%;
  margin: 0;
  padding: 0.15rem 0 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.45;
}

.chat-prompt-shell > .studio-voice-clone-hint {
  padding: 0.2rem 0.35rem 0;
}

.studio-compose-segmented {
  flex: 0 0 auto;
}

.studio-toolbar-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: var(--weight-semibold);
  flex: 0 0 auto;
}

.studio-route-hint {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.4;
}

.studio-media-privacy-notice {
  margin: 0.35rem 0 0;
  padding: 0.45rem 0.65rem;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  border-radius: 10px;
}

.studio-segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.2rem;
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg) 55%, var(--surface));
  border: 1px solid var(--border);
}

.studio-seg-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.studio-seg-btn:hover:not(:disabled) {
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.studio-seg-btn.active {
  background: var(--accent);
  color: #fff;
}

.studio-seg-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.studio-capability-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  flex: 1 1 auto;
}

.studio-cap-chip {
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.studio-cap-chip:hover:not(:disabled) {
  border-color: var(--accent);
}

.studio-cap-chip.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--input-bg));
  color: var(--accent);
}

.studio-cap-chip.is-soon {
  opacity: 0.72;
}

.studio-model-row .model-picker {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
}

.studio-attach-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.45rem;
  flex: 0 0 auto;
  align-self: flex-start;
}

.studio-attach-slot {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex: 0 0 auto;
}

.studio-attach-text-btn {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0.18rem 0.55rem;
  border: 1px solid color-mix(in srgb, var(--text-muted) 38%, var(--border) 62%);
  border-radius: 6px;
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  font-size: var(--text-sm);
  line-height: 1.35;
  white-space: nowrap;
  text-decoration: none;
  box-shadow: inset 0 0 0 0.5px color-mix(in srgb, var(--text) 6%, transparent);
  transition:
    color 0.15s,
    border-color 0.15s,
    background 0.15s;
}

.studio-attach-text-btn:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 52%, var(--border));
  background: color-mix(in srgb, var(--accent) 7%, var(--surface-2));
}

.studio-attach-text-btn.has-file {
  color: var(--accent);
  font-weight: var(--weight-semibold);
  border-color: color-mix(in srgb, var(--accent) 58%, var(--border));
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-2));
}

.studio-attach-thumb {
  width: 2.25rem;
  height: 2.25rem;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.studio-attach-filename {
  max-width: 5.5rem;
  font-size: var(--text-2xs);
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-attach-clear {
  position: absolute;
  top: -0.35rem;
  right: -0.35rem;
  width: 1.15rem;
  height: 1.15rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: var(--text-xs);
  line-height: 1.15rem;
  cursor: pointer;
  z-index: 2;
}

.vision-attach-btn.has-video {
  border-style: solid;
  border-color: var(--accent);
}

.chat-composer.dragover .chat-prompt-shell,
.chat-composer.dragover .studio-prompt-shell {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent);
}

.msg-assistant-media {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.msg-gen-image,
.msg-user-attach-preview.media-zoomable {
  max-width: min(100%, 420px);
  border-radius: 12px;
  border: 1px solid var(--border);
  cursor: zoom-in;
}

.msg-gen-image-card,
.msg-user-attach-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.45rem;
}

.msg-media-dl-btn,
.msg-audio-dl-btn {
  flex: 0 0 auto;
  margin-top: 0.15rem;
  padding: 0.22rem 0.55rem;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 55%, var(--surface));
  color: var(--text-muted);
  cursor: pointer;
}

.msg-media-dl-btn:hover,
.msg-audio-dl-btn:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

.msg-gen-image:hover,
.msg-user-attach-preview.media-zoomable:hover {
  box-shadow: 0 4px 20px color-mix(in srgb, var(--accent) 18%, transparent);
}

.msg-user-attach-preview-video {
  display: block;
  max-width: min(100%, 420px);
  max-height: 240px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #000;
}

.media-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.media-lightbox.hidden {
  display: none;
}

.media-lightbox-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(0, 0, 0, 0.82);
  cursor: zoom-out;
}

.media-lightbox-inner {
  position: relative;
  z-index: 1;
  max-width: min(96vw, 1200px);
  max-height: 92vh;
}

.media-lightbox-img {
  display: block;
  max-width: 100%;
  max-height: 92vh;
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
}

.media-lightbox-close {
  position: absolute;
  top: -0.5rem;
  right: -0.5rem;
  z-index: 2;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: var(--text-xl);
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.msg-audio-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-width: min(100%, 360px);
}

.msg-audio-player {
  display: block;
  width: 100%;
  max-width: 360px;
}

.msg-audio-caption {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--text-muted);
}

.msg-project-video-wrap {
  margin-top: 0.5rem;
}

.msg-project-video-status {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.msg-project-video-status.msg-project-video-error {
  color: var(--danger);
}

.msg-project-video-status.msg-project-video-expired,
.msg-project-video-expired {
  margin: 0.35rem 0 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.45;
}

.msg-project-save-hint {
  margin: 0.35rem 0 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.4;
}

.msg-project-video {
  display: block;
  width: 100%;
  max-width: min(100%, 480px);
  border-radius: 10px;
  background: #000;
}

.msg-project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin-top: 0.35rem;
}

.msg-project-links a,
.msg-project-dl-btn {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--accent);
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}

.msg-project-links a:hover,
.msg-project-dl-btn:hover {
  text-decoration: underline;
}

body.media-lightbox-open {
  overflow: hidden;
}

/* Model picker (custom dropdown — divider + upgrade badges) */
.model-picker {
  display: inline-flex;
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.4rem;
}

.model-picker-label {
  flex: 0 0 auto;
}

.model-picker-control {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

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

.model-picker-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: 1.2;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.model-picker-trigger.is-load-error {
  border-color: var(--danger);
  color: var(--danger);
}

.model-picker-trigger:hover,
.model-picker-trigger[aria-expanded="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.model-picker-trigger-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-picker-chevron {
  flex-shrink: 0;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.15s;
}

.model-picker-trigger[aria-expanded="true"] .model-picker-chevron {
  transform: rotate(-135deg) translateY(1px);
}

.model-picker-menu {
  position: absolute;
  z-index: 200;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: min(360px, 55vh);
  overflow-y: auto;
  margin: 0;
  padding: 0.4rem 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow), 0 12px 40px rgba(0, 0, 0, 0.12);
}

.model-picker-menu.hidden {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden;
}

.model-picker-menu:not(.hidden) {
  display: block;
  pointer-events: auto;
}

.model-picker-section-label {
  padding: 0.35rem 0.75rem 0.25rem;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.model-picker-divider {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.45rem 0.65rem;
  padding: 0;
  border: none;
}

.model-picker-divider::before,
.model-picker-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.model-picker-divider span {
  flex-shrink: 0;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
  white-space: nowrap;
}

.model-picker-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: background 0.12s;
}

.model-picker-item:hover:not(.is-locked),
.model-picker-item.is-selected:not(.is-locked) {
  background: rgba(99, 102, 241, 0.1);
}

.model-picker-item.is-selected:not(.is-locked) {
  box-shadow: inset 3px 0 0 var(--accent);
}

.model-picker-item.is-locked {
  cursor: not-allowed;
  opacity: 0.92;
}

.model-picker-item-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.5rem;
  width: 100%;
}

.model-picker-item-name {
  font-weight: var(--weight-semibold);
  font-size: var(--text-base);
  line-height: 1.3;
}

.model-picker-item.is-locked .model-picker-item-name {
  color: var(--text-muted);
}

.model-picker-item.has-desc {
  flex-direction: column;
  align-items: stretch;
  gap: 0.25rem;
}

.model-picker-item-desc {
  display: block;
  font-size: var(--text-xs);
  line-height: 1.35;
  color: var(--text-muted, #8b949e);
  text-align: left;
  font-weight: var(--weight-normal);
}

.model-picker-empty-hint {
  padding: 0.65rem 0.85rem;
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--text-muted, #8b949e);
}

.model-picker-item-brand {
  flex-shrink: 0;
  font-size: var(--text-2xs);
  font-weight: var(--weight-semibold);
  color: var(--accent, #6ea8fe);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: rgba(110, 168, 254, 0.12);
}

.model-picker-item-tag {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: var(--surface-2);
}

.model-picker-badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  padding: 0.15rem 0.5rem;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  line-height: 1.3;
  color: var(--bubble-user-text);
  background: linear-gradient(135deg, var(--accent), #818cf8);
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.45);
  vertical-align: middle;
}

.model-picker-item.is-locked .model-picker-badge {
  background: linear-gradient(135deg, var(--accent), #a855f7);
  margin-left: 0.1rem;
}

/* Chat + Vision + Canvas — 主区背景、置顶纯文字回复、底部统一输入条 */
#page-chat,
#page-vision,
#page-canvas {
  background: var(--bg);
}

#page-chat,
#page-vision,
#page-canvas,
.home-canvas-demo-viewport {
  --studio-glass-bg: color-mix(in srgb, var(--bg-elevated) 58%, transparent);
  --studio-glass-border: color-mix(in srgb, var(--border) 55%, transparent);
  --studio-control-bg: var(--input-bg);
  --studio-muted-bg: color-mix(in srgb, var(--bg) 60%, var(--surface));
}

#page-canvas,
.home-canvas-demo-viewport {
  --studio-node-bg: color-mix(in srgb, var(--bg-elevated) 44%, transparent);
  --studio-node-header-bg: color-mix(in srgb, var(--bg-elevated) 30%, transparent);
  --studio-node-control-bg: color-mix(in srgb, var(--input-bg) 62%, transparent);
}

.chat-main,
.vision-main {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.25rem 1.5rem 2.5rem;
  scroll-padding-bottom: 10rem;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.chat-messages::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.vision-main {
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.vision-main::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.msg-row {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  width: 100%;
  max-width: 100%;
}

.msg-row--assistant {
  flex-direction: row;
  justify-content: flex-start;
}

.msg-row--user {
  flex-direction: row;
  justify-content: flex-end;
}

.msg-row--system {
  justify-content: center;
}

.msg-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
}

.msg-avatar--user {
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), #818cf8);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: var(--weight-extrabold);
  background-size: cover;
  background-position: center;
}

.msg-avatar--user.has-image {
  color: transparent;
}

.msg-avatar-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: var(--weight-extrabold);
  letter-spacing: -0.02em;
  box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 35%, transparent);
}

.msg-row .msg {
  flex: 1;
  min-width: 0;
  max-width: calc(100% - 44px);
  padding: 0;
  border: none;
  border-radius: 0;
  background: none;
  line-height: 1.75;
  font-size: var(--text-md);
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-row--user .msg.user {
  flex: 0 1 auto;
  max-width: calc(100% - 44px);
  color: var(--accent);
  font-weight: var(--weight-medium);
  text-align: right;
}

.msg-user-rich {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
}

.msg-user-aspect-pill,
.msg-studio-cap-pill {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  font-size: var(--text-2xs);
  font-weight: var(--weight-bold);
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
}

.msg-assistant-rich .msg-studio-cap-pill {
  margin-bottom: 0.35rem;
}

.msg-assistant-rich .msg-assistant-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-inline-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}

.msg-inline-link:hover {
  color: var(--accent-hover, var(--accent));
}

.msg-media-gallery {
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border);
}

.msg-media-gallery-title {
  margin: 0 0 0.45rem;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--text-muted);
}

.msg-media-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
}

.msg-media-gallery-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: color-mix(in srgb, var(--bg) 40%, var(--surface));
}

.msg-media-gallery-img {
  display: block;
  width: 100%;
  max-height: 140px;
  object-fit: cover;
  cursor: zoom-in;
}

.msg-media-gallery-video {
  display: block;
  width: 100%;
  max-height: 140px;
  background: #000;
}

.msg-media-gallery-audio {
  display: block;
  width: 100%;
}

.msg-media-gallery-meta {
  padding: 0.35rem 0.45rem 0.4rem;
}

.msg-media-gallery-label {
  display: block;
  font-size: var(--text-2xs);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
  line-height: 1.35;
  word-break: break-word;
}

.msg-media-gallery-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.25rem;
}

.msg-search-preview {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}

.msg-search-preview-title {
  margin: 0 0 0.55rem;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--text-muted);
}

.msg-search-preview-title--hero {
  color: var(--accent);
}

.msg-search-preview-hero {
  margin-bottom: 0.75rem;
}

.msg-search-preview-card--hero {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: 0 8px 28px color-mix(in srgb, var(--accent) 10%, transparent);
}

.msg-search-preview-embed--hero {
  max-height: min(420px, 56vh);
}

.msg-search-preview-video--hero {
  max-height: min(360px, 52vh);
}

.msg-web-source-item--primary {
  padding: 0.55rem 0.65rem;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 4%, var(--surface));
}

.msg-web-source-type-pill--primary {
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

.msg-search-preview-audio {
  display: block;
  width: 100%;
}

.msg-search-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 0.65rem;
}

.msg-search-preview-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: color-mix(in srgb, var(--bg) 35%, var(--surface));
}

.msg-search-preview-embed,
.msg-web-source-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.msg-search-preview-embed-frame,
.msg-web-source-embed-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: none;
  background: #000;
}

.msg-search-preview-img {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  cursor: zoom-in;
}

.msg-search-preview-video {
  display: block;
  width: 100%;
  max-height: 180px;
  background: #000;
}

.msg-search-preview-link,
.msg-web-source-link-card {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.55rem 0.65rem;
  color: inherit;
  text-decoration: none;
  transition: background 0.15s;
}

.msg-search-preview-link:hover,
.msg-web-source-link-card:hover {
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}

.msg-search-preview-link-icon,
.msg-web-source-link-favicon {
  flex-shrink: 0;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 0.25rem;
  object-fit: contain;
  margin-top: 0.1rem;
}

.msg-search-preview-link-body,
.msg-web-source-link-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.msg-search-preview-link-title,
.msg-web-source-link-card-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: 1.35;
  color: var(--text);
  word-break: break-word;
}

.msg-search-preview-link-snippet,
.msg-web-source-link-card-snippet {
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.msg-web-source-link-card-domain {
  font-size: var(--text-2xs);
  color: color-mix(in srgb, var(--text-muted) 88%, transparent);
}

.msg-search-preview-meta {
  padding: 0 0.55rem 0.5rem;
}

.msg-search-preview-meta-link {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--accent);
  text-decoration: none;
  word-break: break-word;
}

.msg-search-preview-meta-link:hover {
  text-decoration: underline;
}

.msg-web-sources {
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border);
}

.msg-web-sources-title {
  margin: 0 0 0.4rem;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--text-muted);
}

.msg-web-sources-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.msg-web-source-link {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--accent);
  text-decoration: none;
  word-break: break-word;
}

.msg-web-source-link:hover {
  text-decoration: underline;
}

.msg-web-source-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}

.msg-web-source-type-pill,
.canvas-web-source-type-pill {
  font-size: var(--text-2xs);
  font-weight: var(--weight-bold);
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
}

.msg-web-source-media,
.canvas-web-source-media {
  margin-top: 0.35rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 50%, var(--surface));
}

.msg-web-source-media.is-media-failed::after,
.canvas-web-source-media.is-media-failed::after {
  content: '预览不可用（站点限制跨域），请用「打开网页」或「下载」';
  display: block;
  padding: 0.45rem 0.55rem;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.msg-web-source-preview-img,
.canvas-web-source-preview-img {
  display: block;
  max-width: 100%;
  max-height: 200px;
  object-fit: contain;
  cursor: zoom-in;
}

.msg-web-source-preview-video,
.canvas-web-source-preview-video {
  display: block;
  width: 100%;
  max-height: 180px;
  background: #000;
}

.msg-web-source-preview-audio,
.canvas-web-source-preview-audio {
  display: block;
  width: 100%;
}

.msg-web-source-actions,
.canvas-web-source-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.msg-web-source-btn,
.canvas-web-source-btn {
  font-size: var(--text-xs);
  padding: 0.15rem 0.45rem;
  text-decoration: none;
}

.msg-web-source-snippet {
  margin: 0.2rem 0 0;
  font-size: var(--text-xs);
  line-height: 1.45;
  color: var(--text-muted);
}

.canvas-web-sources {
  margin-top: 0.35rem;
}

.canvas-web-sources-list {
  margin: 0.25rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.canvas-web-source-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.45rem;
}

.canvas-web-source-head a {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--accent);
  text-decoration: none;
  word-break: break-word;
}

.canvas-web-source-head a:hover {
  text-decoration: underline;
}

.canvas-web-source-snippet {
  margin: 0.15rem 0 0;
  font-size: var(--text-2xs);
  line-height: 1.4;
  color: var(--text-muted);
}

.msg-row--assistant .msg.assistant {
  color: var(--text);
  text-align: left;
}

.msg.system {
  align-self: stretch;
  max-width: 100%;
  font-size: var(--text-base);
  color: var(--text-muted);
  line-height: 1.6;
  text-align: center;
}

.msg.assistant.loading-dots {
  color: var(--text-muted);
}

.chat-composer,
.vision-composer {
  flex-shrink: 0;
  padding: 0.75rem 1.5rem;
  padding-bottom: max(0.85rem, env(safe-area-inset-bottom));
  background: transparent;
  border: none;
  isolation: isolate;
}

.history-storage-notice {
  margin: 0 1.5rem 0.5rem;
  padding: 0.55rem 0.75rem;
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--text);
  background: color-mix(in srgb, #f59e0b 14%, var(--surface));
  border: 1px solid color-mix(in srgb, #f59e0b 35%, var(--border));
  border-radius: 10px;
}

.history-storage-notice.hidden {
  display: none;
}

.msg-media-omitted,
.msg-user-attach-pill {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.msg-user-attach-pill {
  display: inline-block;
  margin-bottom: 0.35rem;
}

.chat-composer-inner,
.vision-composer-inner,
.home-composer-inner {
  display: flex;
  align-items: flex-end;
  gap: 0.65rem;
  width: 100%;
}

.chat-prompt-shell,
.vision-prompt-shell {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  min-height: auto;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: transparent;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.chat-prompt-shell {
  padding: 0.6rem 0.75rem;
}

.composer-has-send {
  position: relative;
}

.composer-input-area {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.composer-action-rail {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  align-self: center;
  gap: 0.2rem;
}

.composer-prompt-with-voice {
  position: relative;
  flex-wrap: wrap;
  align-content: flex-start;
}

.chat-prompt-shell:focus-within,
.vision-prompt-shell:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent);
}

.vision-composer.dragover .vision-prompt-shell {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent);
}

#chat-input,
#home-studio-input,
.vision-composer textarea {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  min-height: 2.75rem;
  max-height: 10rem;
  resize: vertical;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  line-height: 1.55;
  font-size: var(--text-base);
  box-shadow: none;
}

.composer-has-send #chat-input,
.composer-has-send #home-studio-input {
  padding-right: 0;
  box-sizing: border-box;
}

#chat-input:focus,
#home-studio-input:focus,
.vision-composer textarea:focus {
  outline: none;
  box-shadow: none;
}

.vision-send-btn {
  flex: 0 0 auto;
  min-width: 4.5rem;
  align-self: flex-end;
  min-height: 2.75rem;
  height: auto;
  padding: 0.5rem 1.15rem;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
}

.vision-send-btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

/* 发送：纯圆按钮，与输入框垂直居中对齐 */
.composer-send-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  aspect-ratio: 1;
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--accent) 92%, #fff 8%) 0%,
    var(--accent) 55%,
    color-mix(in srgb, var(--accent) 78%, #4338ca 22%) 100%
  );
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent),
    0 4px 16px color-mix(in srgb, var(--accent) 42%, transparent);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    filter 0.15s ease,
    opacity 0.15s ease;
}

.composer-send-icon {
  display: block;
  width: 1rem;
  height: 1rem;
}

.composer-send-btn:hover:not(:disabled) {
  filter: brightness(1.06);
  transform: scale(1.05);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 65%, transparent),
    0 6px 20px color-mix(in srgb, var(--accent) 50%, transparent);
}

.composer-send-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.composer-send-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none;
  filter: none;
}

/* 语音输入：紧挨发送按钮，同一水平中线 */
.composer-voice-inset {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.composer-voice-inset .composer-voice-btn {
  pointer-events: auto;
}

.composer-voice-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  aspect-ratio: 1;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  touch-action: manipulation;
  transition: color 0.15s ease, background 0.15s ease;
}

.composer-voice-icon {
  display: block;
  width: 1.15rem;
  height: 1.15rem;
}

.composer-voice-btn:hover:not(:disabled):not(.is-active) {
  color: color-mix(in srgb, var(--accent) 70%, var(--text-muted));
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.composer-voice-btn.is-active,
.composer-voice-btn.is-listening.is-active,
.composer-prompt-with-voice.composer-voice-session .composer-voice-btn {
  color: var(--accent);
}

.composer-voice-btn.is-active:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.composer-voice-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.composer-voice-status {
  flex: 1 1 100%;
  width: 100%;
  order: 4;
  margin: 0.1rem 0 0;
  font-size: var(--text-xs);
  line-height: 1.35;
  color: var(--accent);
  min-height: 1rem;
}

.composer-voice-status.hidden {
  display: none;
}

.composer-voice-hold-bar {
  flex: 1 1 100%;
  width: 100%;
  order: 5;
  margin-top: 0.15rem;
}

.composer-voice-hold-bar.hidden {
  display: none;
}

.composer-voice-hold {
  width: 100%;
  padding: 0.62rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition:
    background 0.12s ease,
    color 0.12s ease,
    border-color 0.12s ease;
}

.composer-voice-hold.is-recording {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.composer-voice-hold:disabled {
  opacity: 0.55;
  cursor: wait;
}

.composer-prompt-with-voice.composer-voice-session #chat-input,
.composer-prompt-with-voice.composer-voice-session #home-studio-input {
  padding-bottom: 0.5rem;
}

.vision-main {
  padding: 1.25rem 1.5rem 1rem;
}

.vision-result {
  width: 100%;
  box-sizing: border-box;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  white-space: pre-wrap;
  line-height: 1.75;
  font-size: var(--text-md);
  color: var(--text);
  word-break: break-word;
}

.vision-result.is-empty {
  color: var(--text-muted);
  font-size: var(--text-base);
  line-height: 1.6;
}

.vision-result.is-loading {
  color: var(--text-muted);
}

.vision-prompt-shell {
  padding: 0.6rem 0.75rem 0.6rem 0.6rem;
}

.vision-attach-wrap {
  position: relative;
  flex: 0 0 auto;
  align-self: flex-start;
}

.vision-attach-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg) 40%, var(--input-bg));
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s, background 0.15s;
}

.vision-attach-btn:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--input-bg));
}

.vision-attach-btn.has-image {
  border-style: solid;
}

.vision-attach-icon {
  font-size: var(--text-3xl-md);
  font-weight: var(--weight-light);
  line-height: 1;
  color: var(--text-muted);
  pointer-events: none;
}

.vision-attach-btn.has-image .vision-attach-icon {
  display: none;
}

.vision-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.vision-clear-image {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-size: var(--text-md);
  line-height: 1;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  z-index: 1;
}

.vision-composer textarea {
  padding: 0.2rem 0.25rem 0.2rem 0;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.06);
}

/* Account — user center */
#page-account.page.active {
  overflow-y: auto;
  align-items: stretch;
  justify-content: flex-start;
  background:
    radial-gradient(
      120% 80% at 50% -30%,
      color-mix(in srgb, var(--accent) 14%, transparent),
      transparent 55%
    ),
    var(--bg);
}

.account-page-shell,
.account-center {
  flex: 1;
  width: 100%;
  max-width: min(1080px, 100%);
  margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
  box-sizing: border-box;
}

#page-account .account-page-shell {
  padding-bottom: max(4.75rem, calc(2rem + env(safe-area-inset-bottom, 0px)));
}

.account-page-topbar {
  display: none;
  margin-bottom: 0.75rem;
}

.account-back-studio-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  font-weight: var(--weight-semibold);
}

.account-back-studio-icon {
  font-size: var(--text-md);
  line-height: 1;
}

.account-page-hero {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.35rem 1.5rem;
  margin-bottom: 0;
  border-radius: calc(var(--radius) + 4px);
  box-shadow:
    var(--shadow),
    0 12px 40px color-mix(in srgb, var(--plan-accent, var(--accent)) 10%, transparent);
  position: relative;
  overflow: hidden;
}

.account-page-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    70% 120% at 100% 0%,
    color-mix(in srgb, var(--plan-accent, var(--accent)) 18%, transparent),
    transparent 55%
  );
  opacity: 0.65;
}

.account-page-hero > * {
  position: relative;
  z-index: 1;
}

.account-hero-kicker {
  margin: 0 0 0.2rem;
  font-size: var(--text-2xs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--plan-accent, var(--accent)) 55%, var(--text-muted));
}

.account-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1.15rem;
}

.account-stat-card {
  padding: 1rem 1.1rem;
  border-radius: calc(var(--radius) + 2px);
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.account-stat-card--accent {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--accent) 14%, var(--surface)) 0%,
    var(--surface) 70%
  );
}

.account-stat-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
}

.account-stat-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.35rem;
}

.account-stat-main--daily {
  align-items: flex-start;
}

.account-stat-value {
  font-size: var(--text-2xl);
  font-weight: var(--weight-extrabold);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.account-stat-value--sm {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
}

.account-stat-unit {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
}

.account-stat-bar {
  width: 100%;
  height: 6px;
  margin-top: 0.55rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--border) 80%, transparent);
  overflow: hidden;
}

.account-stat-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 65%, #a78bfa));
}

.account-stat-foot {
  width: 100%;
  margin-top: 0.35rem;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.account-stat-daily {
  font-size: var(--text-sm);
  line-height: 1.55;
  color: var(--text);
  font-weight: var(--weight-medium);
}

.account-page-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
  margin-top: 1.35rem;
}

.account-page-column--main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.account-panel {
  padding: 1.1rem 1.15rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.account-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.account-section-head .account-section-title {
  margin: 0;
}

.account-section-link {
  flex-shrink: 0;
  font-size: var(--text-sm);
}

.account-recent-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.account-recent-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  font: inherit;
  text-align: left;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
}

.account-recent-item:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  background: color-mix(in srgb, var(--accent) 4%, var(--bg));
}

.account-recent-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.account-recent-feature {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
}

.account-recent-credits {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--danger, #ef4444);
  font-variant-numeric: tabular-nums;
}

.account-recent-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.account-recent-empty {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  padding: 0.5rem 0;
}

.account-page-column--aside {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.account-aside-card {
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.account-aside-card--plan {
  padding: 1rem 1.15rem 1.1rem;
}

.account-aside-card--hint {
  background: color-mix(in srgb, var(--bg) 40%, var(--surface));
}

.account-aside-title {
  margin: 0 0 0.55rem;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.account-aside-muted,
.account-aside-daily {
  margin: 0;
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--text-muted);
}

.account-aside-notes-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: var(--text-base);
  line-height: 1.55;
}

.account-modal-billing-notes {
  margin: 0 0 1rem;
  padding-left: 1.15rem;
  font-size: var(--text-base);
  line-height: 1.6;
}

.account-billing-desc-wrap {
  margin: 0 0 0.75rem;
}

.account-aside-daily {
  color: var(--text);
  font-weight: var(--weight-medium);
}

.account-aside-foot {
  margin: 0.5rem 0 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.45;
}

#account-aside-plan-body .plan-current-title {
  font-size: var(--text-md);
  margin-bottom: 0.25rem;
}

#account-aside-plan-body .plan-current-meta {
  font-size: var(--text-sm);
  line-height: 1.5;
}

.account-page-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.account-page-main {
  min-width: 0;
}

.account-section-title {
  margin: 0 0 0.65rem;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.account-module-grid {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

#page-account:not(.active) .account-quick-settings-fab {
  display: none;
}

.account-quick-settings-fab {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right, 0px));
  bottom: max(1rem, env(safe-area-inset-bottom, 0px));
  z-index: 35;
}

.account-settings-fab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.85rem;
  height: 2.85rem;
  margin: 0;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  touch-action: manipulation;
  box-shadow:
    0 4px 18px rgba(0, 0, 0, 0.12),
    0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

.account-settings-fab-btn:hover {
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  box-shadow:
    0 6px 22px color-mix(in srgb, var(--accent) 22%, transparent),
    0 0 0 1px color-mix(in srgb, var(--accent) 28%, transparent);
}

.account-settings-fab-btn[aria-expanded='true'] {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.account-settings-fab-icon {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
}

.account-settings-popover {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.55rem);
  min-width: 15.5rem;
  max-width: min(18rem, calc(100vw - 2rem));
  padding: 0.85rem 1rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  background: var(--surface);
  box-shadow: var(--shadow), 0 12px 40px rgba(0, 0, 0, 0.14);
}

.account-settings-popover.hidden {
  display: none;
}

.account-user-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  margin-bottom: 0.85rem;
  box-shadow: var(--shadow);
}

.account-user-main {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.account-user-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  justify-content: center;
}

.account-hero-name {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: var(--weight-extrabold);
  line-height: 1.2;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin: 0.2rem 0 0;
  min-width: 0;
}

.account-hero-handle {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.account-hero-handle + .account-hero-plan::before {
  content: '·';
  margin-right: 0.45rem;
  color: var(--text-muted);
  font-weight: var(--weight-normal);
}

.account-hero-plan {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.5rem;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  line-height: 1.35;
  border-radius: 999px;
  white-space: nowrap;
  color: color-mix(in srgb, var(--plan-accent, var(--accent)) 88%, var(--text));
  background: color-mix(in srgb, var(--plan-accent, var(--accent)) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--plan-accent, var(--accent)) 32%, var(--border));
}

.account-hero-avatar-ring {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}

.account-page-hero .account-hero-avatar-ring {
  width: 72px;
  height: 72px;
}

.account-hero-avatar-ring .profile-avatar-letter {
  font-size: var(--text-xl);
}

.account-page-hero .account-hero-avatar-ring .profile-avatar-letter {
  font-size: var(--text-2xl);
}

.account-page-hero .account-hero-name {
  font-size: var(--text-xl);
}

.account-user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.account-user-actions .btn {
  flex: 1 1 auto;
  min-width: 7rem;
}

.account-page-hero .account-user-actions .btn {
  flex: 0 1 auto;
  min-width: 6.5rem;
}

.account-module-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

@media (min-width: 900px) {
  .account-page-shell,
  .account-center {
    padding: 1.5rem 2rem 2.5rem;
  }

  .account-page-layout {
    grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.85fr);
    gap: 1.35rem;
    align-items: start;
  }

  .account-page-column--aside {
    position: sticky;
    top: 1rem;
  }

  .account-page-hero {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1.75rem;
    padding: 1.5rem 1.85rem;
  }

  .account-user-main {
    flex: 1;
    gap: 1.15rem;
  }

  .account-hero-name {
    font-size: var(--text-2xl);
  }

  .account-user-actions {
    flex-shrink: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
    min-width: 7.5rem;
  }

  .account-page-hero .account-user-actions .btn {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
  }

  .account-stats-grid {
    gap: 1rem;
  }

  .account-stat-card {
    padding: 1.15rem 1.25rem;
  }

  .account-module-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }

  .account-module-grid .account-module-item {
    min-height: 7rem;
    padding: 1rem 1.1rem;
    align-items: flex-start;
  }

  .account-module-grid .account-module-desc {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .account-module-grid .account-module-chevron {
    align-self: center;
    margin-left: auto;
  }
}

@media (min-width: 1040px) {
  .account-module-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .account-module-grid .account-module-item {
    min-height: 6.75rem;
  }
}

.account-module-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font: inherit;
  text-align: left;
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  transition:
    border-color 0.15s,
    background 0.15s;
}

.account-module-item:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
}

.account-module-icon {
  flex-shrink: 0;
  width: 2.65rem;
  height: 2.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
  line-height: 1;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
}

.account-module-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.account-module-title {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
}

.account-module-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-module-chevron {
  flex-shrink: 0;
  font-size: var(--text-xl);
  color: var(--text-muted);
  line-height: 1;
}

.account-settings-card-compact {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem 0.35rem;
  box-shadow: var(--shadow);
}

.account-settings-heading {
  margin: 0 0 0.5rem;
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--text-muted);
}

.profile-avatar-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.profile-avatar-block-modal {
  margin-bottom: 0.75rem;
}

.profile-avatar-ring {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid color-mix(in srgb, var(--accent) 55%, var(--border));
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.profile-avatar-letter {
  font-size: var(--text-3xl);
  font-weight: var(--weight-extrabold);
  color: var(--accent);
}

.profile-avatar-upload {
  cursor: pointer;
}

.profile-edit-fields h2 {
  margin: 0 0 0.35rem;
  font-size: var(--text-xl);
}

.profile-edit-desc {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: var(--text-base);
}

.profile-save-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.profile-save-hint {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.profile-field-static {
  gap: 0.35rem;
}

.profile-static-value {
  margin: 0;
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text);
  word-break: break-all;
}

.profile-field-hint {
  margin: 0;
  font-size: var(--text-xs);
  line-height: 1.45;
  color: var(--text-muted);
}

.profile-email-action {
  align-self: flex-start;
  margin-top: 0.15rem;
}

.profile-email-action:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.account-card-wide {
  grid-column: 1 / -1;
}

.usage-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.usage-list-header h3 {
  margin: 0;
}

.usage-list-desc {
  margin: 0 0 1rem;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.usage-logs-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.usage-logs-empty {
  margin: 0;
  font-size: var(--text-base);
  color: var(--text-muted);
  text-align: center;
  padding: 1.5rem 0.5rem;
}

.usage-log-item {
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  background: var(--bg);
}

.usage-log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.usage-log-feature {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
}

.usage-log-feature-vision {
  background: color-mix(in srgb, #a855f7 22%, transparent);
  color: #c084fc;
}

.usage-log-credits {
  font-weight: var(--weight-bold);
  font-size: var(--text-base);
  color: #f87171;
}

.usage-log-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.account-card-billing h3 {
  margin: 0 0 1rem;
}

.account-billing-block {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.account-billing-subtitle {
  margin: 0;
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--text-muted);
}

.account-billing-desc {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.5;
}

.account-billing-divider {
  height: 1px;
  margin: 1rem 0;
  background: var(--border);
}

.account-billing-btn {
  width: 100%;
  margin-top: 0.35rem;
}

.billing-modal,
.account-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: var(--overlay);
}

.billing-modal.hidden,
.account-modal.hidden {
  display: none !important;
}

.billing-modal-card,
.account-modal-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 14px);
  padding: 1.25rem 1.35rem 1.35rem;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
}

.account-modal-card-wide {
  max-width: 480px;
}

.billing-modal-close,
.account-modal-close {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  border: none;
  background: transparent;
  font-size: var(--text-xl);
  cursor: pointer;
  color: var(--text-muted);
}

.account-modal-card h3 {
  margin: 0 2rem 0.35rem 0;
  font-size: var(--text-xl);
}

.account-modal-desc {
  margin: 0 0 1rem;
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.5;
}

.account-details-modal .kv {
  padding: 0.65rem 0;
}

.account-invite-stats {
  margin-top: 0.75rem;
}

.account-invite-link-btn {
  margin-top: 0.5rem;
  width: 100%;
}

.usage-logs-list-modal {
  max-height: 50vh;
  overflow-y: auto;
}

body.account-modal-open {
  overflow: hidden;
}

body.legal-modal-open {
  overflow: hidden;
}

.legal-modal-card {
  max-width: min(42rem, 96vw);
  padding: 1.35rem 1.5rem 1.5rem;
}

.legal-modal-card h3 {
  margin: 0 2rem 0.35rem 0;
  font-size: var(--text-lg);
  line-height: 1.35;
}

.legal-modal-meta {
  margin: 0 0 0.85rem;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.legal-modal-body {
  max-height: min(62vh, 34rem);
  overflow-y: auto;
  padding-right: 0.35rem;
  scrollbar-width: thin;
}

.legal-modal-intro {
  margin: 0 0 1rem;
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--text-muted);
}

.legal-modal-article {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.legal-modal-section h4 {
  margin: 0 0 0.45rem;
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  line-height: 1.45;
  color: var(--text);
}

.legal-modal-section p {
  margin: 0 0 0.55rem;
  font-size: var(--text-sm);
  line-height: 1.65;
  color: var(--text-muted);
}

.legal-modal-section p:last-child {
  margin-bottom: 0;
}

.legal-modal-section ul {
  margin: 0.15rem 0 0;
  padding-left: 1.15rem;
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--text-muted);
}

.legal-modal-section li + li {
  margin-top: 0.35rem;
}

.billing-modal-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 0.35rem 0 0.75rem;
}
.billing-pack-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.5rem 0;
}
.billing-pack-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  background: var(--bg);
  text-align: left;
}

.billing-pack-item > span:first-child {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.billing-pack-item > span:first-child small {
  display: block;
  margin-top: 0.15rem;
  color: var(--text-muted);
  font-weight: var(--weight-normal);
  line-height: 1.35;
}

.billing-pack-item > span:last-child {
  flex-shrink: 0;
  font-weight: var(--weight-bold);
  text-align: right;
}
.billing-pack-item:hover,
.billing-pack-item.selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg));
}
.billing-channel-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.75rem 0 0.5rem;
}
.billing-channel-row label {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.35rem;
  font-size: var(--text-sm);
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}
.billing-channel-row label.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.billing-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.billing-order-status {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.billing-pay-status.is-awaiting {
  color: #d97706;
}

.billing-pay-status.is-paid {
  color: #16a34a;
}

.billing-wechat-pay {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  align-items: center;
  text-align: center;
}

.billing-wechat-amount {
  margin: 0;
  font-size: var(--text-md);
  width: 100%;
}

.billing-wechat-amount strong {
  font-size: var(--text-xl);
  color: var(--accent);
}

.billing-wechat-memo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  padding: 0.45rem 0.55rem;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}

.billing-wechat-memo-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--text-muted);
}

.billing-wechat-memo code {
  font-size: var(--text-md);
  font-weight: var(--weight-extrabold);
  letter-spacing: 0.08em;
  color: var(--accent);
}

.billing-wechat-qr {
  width: min(220px, 72vw);
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
}

.billing-wechat-hint {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.45;
}

.billing-wechat-steps {
  margin: 0;
  padding-left: 1.1rem;
  text-align: left;
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.5;
  width: 100%;
}

.account-billing-unified {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.account-billing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.account-billing-actions .btn {
  flex: 1 1 auto;
  min-width: 8.5rem;
}

.account-billing-notice {
  margin: 0;
  padding: 0.65rem 0.75rem;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  border-radius: var(--radius-sm);
}

.account-details-compact {
  margin-top: 0.15rem;
}

.account-details-compact .kv {
  padding: 0.35rem 0;
  font-size: var(--text-base);
}

.billing-channel-row label.billing-channel-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.account-billing-btn-recharge {
  opacity: 0.85;
}

.account-settings-card h3 {
  margin: 0 0 0.35rem;
}

.account-settings-desc {
  margin: 0 0 1rem;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.account-settings-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.account-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.account-settings-label {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text);
  flex-shrink: 0;
}

.account-settings-select {
  flex: 1;
  min-width: 0;
  max-width: 11rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
}

.account-settings-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.account-settings-item:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-2));
}

.account-settings-item-icon {
  font-size: var(--text-xl);
  line-height: 1;
  flex-shrink: 0;
}

.account-settings-item-text {
  flex: 1;
  min-width: 0;
}

.account-settings-item-chevron {
  color: var(--text-muted);
  font-size: var(--text-xl);
  flex-shrink: 0;
}

.account-settings-item-danger {
  margin-top: 0.25rem;
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
}

.account-settings-item-danger:hover {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, var(--surface-2));
}

@media (max-width: 640px) {
  .account-user-actions .btn {
    flex: 1 1 calc(50% - 0.25rem);
  }
}

.account-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.account-card h3 {
  margin: 0 0 1rem;
  font-size: var(--text-md);
}

.kv {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-base);
}

.kv:last-child {
  border-bottom: none;
}

.kv span:first-child {
  color: var(--text-muted);
}

/* Bottom nav (mobile) — 品牌色功能入口 */
.bottom-nav {
  display: none;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  align-items: stretch;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.06);
}

.bottom-nav-primary {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  min-width: 0;
}

.bottom-nav-studio .bottom-nav-primary {
  grid-template-columns: 1fr;
  max-width: 12rem;
  margin: 0 auto;
}

.bottom-feature-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-height: 52px;
  padding: 0.5rem 0.35rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font: inherit;
  color: #fff;
  background: linear-gradient(145deg, var(--accent) 0%, #7c83f6 55%, #818cf8 100%);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.bottom-feature-btn:not(.active) {
  opacity: 0.82;
}

.bottom-feature-btn.active {
  box-shadow: 0 6px 22px rgba(99, 102, 241, 0.55);
  outline: 2px solid rgba(255, 255, 255, 0.55);
  outline-offset: -2px;
}

.bottom-feature-btn:active {
  transform: scale(0.98);
}

.bottom-feature-icon {
  font-size: var(--text-xl);
  line-height: 1;
}

.bottom-feature-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-extrabold);
  letter-spacing: 0.02em;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 20;
}

.menu-btn {
  display: none;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}

@media (max-width: 768px) {
  /* 底栏已移除；输入区仅用 safe-area 留白 */
  .chat-composer,
  .vision-composer {
    padding-top: 0.5rem;
    padding-bottom: 0.35rem;
  }

  #page-account .account-page-shell,
  #page-account .account-center,
  #page-feature .feature-detail-wrap {
    padding-bottom: 1rem;
  }

  .account-page-shell,
  .account-center {
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
  }

  .account-page-topbar {
    display: block;
  }

  .app-body.layout-account .menu-btn {
    display: none !important;
  }

  .account-stats-grid {
    grid-template-columns: 1fr;
  }

  .account-stat-value {
    font-size: var(--text-xl);
  }

  .account-page-hero {
    padding: 1rem 1.05rem;
  }

  .account-user-main {
    align-items: center;
  }

  .account-hero-name {
    font-size: var(--text-xl);
  }

  .account-page-hero .account-user-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .account-page-hero .account-user-actions .btn {
    flex: none;
    width: 100%;
    min-width: 0;
  }

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

  .kv span:last-child {
    text-align: right;
    max-width: 58%;
    word-break: break-word;
  }

  .copy-row {
    flex-wrap: wrap;
  }

  .copy-row input {
    min-width: 0;
    width: 100%;
    font-size: var(--text-sm);
  }

  .usage-log-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .app-header {
    gap: 0.35rem;
    padding: 0.35rem max(0.5rem, env(safe-area-inset-left)) 0.35rem
      max(0.5rem, env(safe-area-inset-right));
  }

  .brand-logo-app .brand-text {
    display: inline;
    font-size: var(--text-base);
  }

  .plan-badge {
    display: none;
  }

  .credits-badge {
    padding: 0.3rem 0.5rem;
    font-size: var(--text-xs);
  }

  .credits-label {
    display: none;
  }

  .app-header-end {
    gap: 0.3rem;
  }

  .app-header-tools {
    gap: 0.3rem;
  }

  .header-tool-btn {
    width: 34px;
    height: 34px;
  }

  .header-user-center-btn {
    padding: 0.2rem 0.45rem 0.2rem 0.22rem;
    font-size: var(--text-xs);
  }

  .header-user-center-btn .header-user-avatar {
    width: 26px;
    height: 26px;
  }

  .nav-desktop {
    display: none !important;
  }

  .site-header {
    flex-wrap: nowrap;
    gap: 0.35rem;
    padding: 0.5rem max(0.65rem, env(safe-area-inset-right)) 0.5rem
      max(0.65rem, env(safe-area-inset-left));
  }

  #view-home .site-header .btn-sm,
  #view-plans .site-header .btn-sm {
    padding: 0.35rem 0.5rem;
    font-size: var(--text-sm);
  }

  .hero-primary {
    padding: 1.5rem 1rem 1.75rem;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .home-section {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }

  .advantage-item {
    padding: 0.85rem 1rem;
    font-size: var(--text-base);
  }

  .vision-main {
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
  }

  .chat-composer,
  .vision-composer {
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
  }

  .vision-prompt-shell {
    min-height: auto;
    padding: 0.45rem 0.6rem;
  }

  .vision-attach-btn {
    width: 48px;
    height: 48px;
  }

  .vision-composer textarea {
    min-height: 2.25rem;
    max-height: 8rem;
  }

  .chat-toolbar {
    padding: 0.65rem 0.75rem;
  }

  .model-picker {
    max-width: none;
    width: 100%;
  }

  .model-picker-control {
    flex: 1 1 auto;
    min-width: 0;
  }

  /* 聊天页手机端：加大留白与行距，避免问答挤在两侧 */
  #page-chat .chat-messages {
    padding: 1.15rem max(1.05rem, env(safe-area-inset-right)) 3.25rem
      max(1.05rem, env(safe-area-inset-left));
    scroll-padding-bottom: 12rem;
    gap: 1.45rem;
  }

  #page-chat .msg {
    font-size: var(--text-lg);
    line-height: 1.85;
    letter-spacing: 0.02em;
    overflow-wrap: break-word;
  }

  #page-chat .msg-row {
    gap: 0.55rem;
  }

  #page-chat .msg-avatar,
  #page-chat .msg-avatar-logo {
    width: 32px;
    height: 32px;
  }

  #page-chat .msg-avatar-logo {
    font-size: var(--text-2xs);
    border-radius: 9px;
  }

  #page-chat .msg-row .msg {
    max-width: calc(100% - 40px);
  }

  #page-chat .msg-row--user .msg.user {
    text-align: right;
  }

  #page-chat .msg.system {
    font-size: var(--text-base);
    line-height: 1.65;
    padding: 0.35rem 0.25rem;
    text-align: center;
  }

  #page-chat .msg.assistant + .msg.user,
  #page-chat .msg.user + .msg.assistant {
    margin-top: 0.15rem;
  }

  #page-chat .feature-intro-panel {
    padding-left: max(1.05rem, env(safe-area-inset-left));
    padding-right: max(1.05rem, env(safe-area-inset-right));
  }

  #page-chat .feature-intro-inner {
    margin-top: 0.45rem;
    margin-bottom: 0.35rem;
    padding: 0.85rem 1rem;
  }

  #page-chat .chat-toolbar {
    padding: 0.55rem max(1.05rem, env(safe-area-inset-right)) 0.55rem
      max(1.05rem, env(safe-area-inset-left));
    flex-direction: row;
    align-items: center;
    gap: 0.45rem;
  }

  #page-chat .chat-toolbar-models {
    flex: 1 1 auto;
    min-width: 0;
  }

  #page-chat .chat-toolbar .model-picker,
  #page-chat .chat-toolbar .model-picker-control {
    width: 100%;
    max-width: none;
    flex: 1 1 auto;
    min-width: 0;
  }

  .chat-history-mobile-toggle {
    display: inline-flex;
  }

  .chat-history-rail-close {
    display: block;
  }

  .chat-history-overlay.is-open {
    z-index: 48;
    pointer-events: auto;
  }

  .chat-history-rail {
    position: fixed;
    left: 0;
    top: var(--header-h);
    bottom: env(safe-area-inset-bottom, 0px);
    z-index: 49;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
    background: var(--bg);
    border-right-color: var(--border);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    pointer-events: auto;
  }

  .chat-history-rail.is-open {
    transform: translateX(0);
  }

  .chat-studio-layout.is-history-open .chat-studio-main {
    pointer-events: none;
  }

  #page-chat .studio-composer-controls {
    padding-bottom: 0.4rem;
    margin-bottom: 0.1rem;
    background: transparent;
  }

  #page-chat .studio-composer-route {
    gap: 0.35rem 0.45rem;
  }

  #page-chat .studio-route-hint {
    font-size: var(--text-xs);
  }

  #page-chat .studio-seg-btn {
    padding: 0.32rem 0.6rem;
    font-size: var(--text-sm);
  }

  #page-chat .studio-cap-chip {
    font-size: var(--text-sm);
    padding: 0.28rem 0.55rem;
  }

  #page-chat .chat-composer {
    padding-top: 0.4rem;
    padding-bottom: max(0.3rem, env(safe-area-inset-bottom, 0px));
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
  }

  #page-chat .chat-composer-inner {
    gap: 0.5rem;
    align-items: stretch;
  }

  #page-chat .chat-prompt-shell {
    min-height: auto;
    padding: 0.45rem 0.6rem;
    border-radius: 12px;
    box-sizing: border-box;
  }

  #page-chat #chat-input {
    min-height: 2.25rem;
    font-size: var(--text-md);
    line-height: 1.5;
  }

  #page-chat .composer-send-btn {
    width: 2.15rem;
    height: 2.15rem;
  }

  #page-chat .composer-voice-btn {
    width: 2rem;
    height: 2rem;
  }

  #page-chat .composer-voice-hold {
    padding: 0.7rem 0.75rem;
    font-size: var(--text-base);
  }

  .home-studio-composer .chat-prompt-shell {
    min-height: auto;
    padding: 0.45rem 0.6rem;
  }

  #home-studio-input {
    min-height: 2.25rem;
    max-height: 8rem;
    font-size: var(--text-md);
    line-height: 1.5;
  }

  .home-composer-inner .composer-send-btn {
    width: 2.15rem;
    height: 2.15rem;
  }

  .home-composer-inner .composer-voice-btn {
    width: 2rem;
    height: 2rem;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: var(--header-h);
    bottom: env(safe-area-inset-bottom, 0px);
    z-index: 30;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .menu-btn {
    display: inline-flex;
  }

  #page-vision .sidebar,
  #page-account .sidebar {
    display: none;
  }
}

@media (min-width: 769px) {
  .chat-history-mobile-toggle {
    display: none !important;
  }

  .chat-history-rail-close {
    display: none !important;
  }

  .nav-desktop {
    display: flex;
    gap: 0.35rem;
    margin-left: 0.5rem;
  }

  .bottom-nav {
    display: none !important;
  }

  #page-vision .sidebar,
  #page-account .sidebar {
    display: none;
  }

  #page-chat .main-panel {
    width: 100%;
  }
}

.loading-dots::after {
  content: "";
  animation: dots 1.2s steps(4, end) infinite;
}

@keyframes dots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
}

/* Clickable brand / logo */
.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  margin: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font-weight: var(--weight-extrabold);
  font-size: var(--text-lg);
  color: var(--text);
  border-radius: var(--radius-sm);
}

.brand-logo:hover {
  color: var(--accent);
}

.brand-logo .logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--accent) 92%, #fff 8%),
    #9333ea 58%,
    color-mix(in srgb, var(--accent) 75%, #312e81)
  );
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--font);
  font-size: var(--text-micro);
  font-weight: var(--weight-extrabold);
  letter-spacing: -0.14em;
  text-indent: 0.08em;
  text-transform: none;
  line-height: 1;
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, #fff 28%, transparent),
    0 4px 16px color-mix(in srgb, var(--accent) 38%, transparent);
}

.brand-logo > [data-brand-text='name'],
.brand-logo > [data-brand-text='shortName'],
.home-launch-logo > [data-brand-text='name'],
.home-launch-logo > [data-brand-text='shortName'] {
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  text-transform: none;
}

.msg-avatar-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-family: var(--font);
  font-size: var(--text-micro);
  font-weight: var(--weight-extrabold);
  letter-spacing: -0.12em;
  text-indent: 0.06em;
  text-transform: none;
  line-height: 1;
  color: #fff;
}

.brand-logo-image {
  height: 1.75rem;
  width: auto;
  max-width: 10rem;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-logo .hidden,
.logo-mark.hidden,
[data-brand-text='name'].hidden {
  display: none !important;
}

#view-auth.site-has-auth-bg {
  background-image:
    linear-gradient(
      145deg,
      color-mix(in srgb, var(--bg) 85%, transparent),
      color-mix(in srgb, var(--surface-2) 90%, transparent)
    ),
    var(--site-auth-bg-url);
  background-size: cover;
  background-position: center;
}

/* Marketing home — 纯色背景，减轻首屏绘制与动画开销 */
#view-home,
#view-home.site-has-home-bg {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  max-width: 100vw;
  overflow-x: hidden;
}

/* 手机首页：优先首屏可交互 */
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .hero-model-chip {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .hero-models-showcase.is-ready .hero-models-track-inner {
    animation-duration: 56s;
  }

  .hero-models-showcase:not(.is-ready) {
    min-height: 2.6rem;
  }
}

@media (max-height: 720px) {
  #view-home > .home-body {
    justify-content: flex-start;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: 0.5rem;
  }
}

#view-home > .site-header,
#view-home > .home-body {
  position: relative;
  z-index: 1;
}

#view-home > .home-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  width: 100%;
  min-height: 0;
  padding: 0.5rem 0 1.25rem;
  box-sizing: border-box;
}

#view-home .home-main {
  flex: 0 1 auto;
}

#view-home .home-footer {
  flex-shrink: 0;
  margin-top: 0.5rem;
  border-top: none;
  padding-top: 1rem;
  padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header .spacer {
  flex: 1;
}

.site-header .btn {
  width: auto;
  flex-shrink: 0;
}

/* 首页主题切换（套餐页已移除，请在用户中心修改） */
#home-theme {
  flex-shrink: 0;
  min-width: 2.35rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  background: linear-gradient(135deg, var(--accent), #818cf8);
  color: #fff;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35);
}

#home-theme:hover {
  background: linear-gradient(135deg, var(--accent-hover), #6366f1);
  border-color: var(--accent);
}

.site-nav {
  display: none;
  gap: 1rem;
}

.site-nav a,
.site-nav .site-nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
}

.site-nav a:hover,
.site-nav .site-nav-link:hover {
  color: var(--accent);
}

.home-main {
  flex: 1;
}

#view-home .home-main {
  flex: 0 1 auto;
}

.hero {
  padding: 3rem 1.25rem 2.5rem;
  max-width: 960px;
  margin: 0 auto;
  text-align: center;
}

.hero-primary {
  padding: 2rem 1.25rem 2rem;
  max-width: 1080px;
}

.hero-eyebrow {
  margin: 0 0 0.75rem;
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero-title {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.25rem);
  line-height: 1.12;
  font-weight: var(--weight-extrabold);
  background: linear-gradient(135deg, var(--text) 20%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

[data-theme="dark"] .hero-title {
  background: linear-gradient(135deg, #fafafa 10%, #a5b4fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.hero-lead {
  margin: 1.25rem auto 0;
  max-width: 720px;
  color: var(--text-muted);
  font-size: clamp(1.05rem, 2.5vw, 1.2rem);
  line-height: 1.65;
}

.hero-models-showcase {
  position: relative;
  margin: 1.75rem auto 0;
  max-width: min(960px, 100%);
  min-height: 4.5rem;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(
    90deg,
    transparent 0%,
    #000 10%,
    #000 90%,
    transparent 100%
  );
  mask-image: linear-gradient(90deg, transparent 0%, #000 10%, #000 90%, transparent 100%);
  pointer-events: auto;
}

.hero-models-showcase.is-marquee-off {
  display: none !important;
}

.hero-models-marquee {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.hero-models-track {
  overflow: hidden;
  width: 100%;
}

.hero-models-track-inner {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.55rem;
  width: max-content;
  padding: 0.1rem 0;
}

.hero-models-showcase.is-ready .hero-models-track[data-direction='ltr'] .hero-models-track-inner {
  animation: hero-marquee-ltr 32s linear infinite;
}

.hero-models-showcase.is-ready .hero-models-track[data-direction='rtl'] .hero-models-track-inner {
  animation: hero-marquee-rtl 36s linear infinite;
}

.hero-models-showcase:hover .hero-models-track-inner,
.hero-models-showcase:focus-within .hero-models-track-inner {
  animation-play-state: paused;
}

.hero-model-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: clamp(0.78rem, 1.8vw, 0.88rem);
  font-weight: var(--weight-semibold);
  white-space: nowrap;
  color: color-mix(in srgb, var(--accent) 78%, var(--text-muted));
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 12px color-mix(in srgb, var(--accent) 10%, transparent);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.hero-model-chip:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow: 0 4px 18px color-mix(in srgb, var(--accent) 18%, transparent);
  transform: translateY(-1px);
}

[data-theme='dark'] .hero-model-chip {
  color: color-mix(in srgb, #c7d2fe 85%, var(--text-muted));
  background: color-mix(in srgb, #18181b 82%, transparent);
  border-color: color-mix(in srgb, #818cf8 32%, var(--border));
  box-shadow: 0 4px 16px color-mix(in srgb, #6366f1 14%, transparent);
}

@keyframes hero-marquee-ltr {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

@keyframes hero-marquee-rtl {
  from {
    transform: translateX(-50%);
  }
  to {
    transform: translateX(0);
  }
}

@media (max-width: 640px) {
  .hero-models-showcase {
    margin-top: 1.35rem;
  }

  .hero-models-marquee {
    gap: 0.45rem;
  }

  .hero-models-showcase.is-ready .hero-models-track[data-direction='ltr'] .hero-models-track-inner {
    animation-duration: 24s;
  }

  .hero-models-showcase.is-ready .hero-models-track[data-direction='rtl'] .hero-models-track-inner {
    animation-duration: 28s;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-models-showcase {
    overflow: visible;
    mask-image: none;
    -webkit-mask-image: none;
  }

  .hero-models-marquee {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.45rem 0.55rem;
  }

  .hero-models-track {
    overflow: visible;
    width: auto;
  }

  .hero-models-track-inner {
    flex-wrap: wrap;
    justify-content: center;
    width: auto;
    animation: none !important;
    transform: none !important;
  }

  .hero-models-track-inner .hero-model-chip:nth-child(n + 9) {
    display: none;
  }

  .hero-model-chip:hover {
    transform: none;
  }
}

.hero-footnote {
  margin: 1.25rem auto 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.btn-lg {
  padding: 0.7rem 1.35rem;
  font-size: var(--text-md);
}

.hero h2 {
  margin: 0;
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  line-height: 1.2;
}

.hero .lead {
  margin: 1rem auto 0;
  max-width: 640px;
  color: var(--text-muted);
  font-size: var(--text-lg);
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.75rem;
}

.hero-badge {
  display: inline-block;
  margin-bottom: 1rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}

.home-section {
  padding: 2.5rem 1.25rem;
  max-width: 1040px;
  margin: 0 auto;
}

.home-section h3 {
  text-align: center;
  margin: 0 0 0.5rem;
  font-size: var(--text-2xl);
}

.home-section .section-desc {
  text-align: center;
  color: var(--text-muted);
  margin: 0 0 1.75rem;
}

.home-section-features {
  padding-top: 1.25rem;
  padding-bottom: 1.5rem;
}

.home-features-title {
  text-align: center;
  margin: 0 0 0.5rem;
  font-size: clamp(1.5rem, 4vw, 2rem);
}

.home-features-duo {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  max-width: 1000px;
  margin: 0 auto;
}

.home-features-unified {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
  max-width: min(720px, 100%);
  margin: 0 auto;
  width: 100%;
}

.home-studio-composer {
  width: 100%;
}

#home-studio-input:focus {
  outline: none;
  box-shadow: none;
}

.home-feature-alt {
  text-align: center;
  margin: 0;
  font-size: var(--text-base);
  color: var(--text-muted);
}


@media (max-width: 720px) {
  .home-features-duo {
    grid-template-columns: 1fr;
  }
}

.feature-card-xl {
  padding: 2rem 1.5rem;
  min-height: 220px;
}

.feature-card-xl h3 {
  margin: 0 0 0.65rem;
  font-size: var(--text-xl);
}

.feature-card-xl p {
  font-size: var(--text-md);
  line-height: 1.6;
}

.icon-xl {
  font-size: var(--text-5xl);
  margin-bottom: 0.75rem;
}

.home-section-muted {
  padding-top: 2rem;
  padding-bottom: 3rem;
  opacity: 0.92;
}

.home-muted-title {
  text-align: center;
  margin: 0 0 1rem;
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
}

.home-muted-foot {
  text-align: center;
  margin: 1.5rem 0 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.advantage-num {
  flex-shrink: 0;
  width: 2.4rem;
  height: 2.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--weight-extrabold);
  letter-spacing: 0.03em;
  color: #fff;
  background: linear-gradient(145deg, var(--accent) 0%, #818cf8 100%);
  border: 1.5px solid color-mix(in srgb, var(--accent) 65%, #fff);
  border-radius: 10px;
  box-shadow: 0 3px 12px rgba(99, 102, 241, 0.32);
}

.advantage-body {
  flex: 1;
  min-width: 0;
  line-height: 1.55;
}

.advantage-list-compact .advantage-item {
  padding: 0.85rem 0;
  font-size: var(--text-base);
  align-items: center;
  gap: 0.85rem;
  background: transparent;
  border: none;
  box-shadow: none;
}

.link-btn {
  border: none;
  background: none;
  padding: 0;
  color: var(--accent);
  font: inherit;
  font-weight: var(--weight-semibold);
  cursor: pointer;
  text-decoration: underline;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.feature-card .icon {
  font-size: var(--text-3xl-md);
  margin-bottom: 0.5rem;
}

.feature-card h4 {
  margin: 0 0 0.5rem;
}

.feature-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-base);
  line-height: 1.5;
}

.feature-card-link {
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.feature-card-link:hover,
.feature-card-link:focus-visible {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(99, 102, 241, 0.18);
  outline: none;
}

/* 首页两大功能入口 — 品牌色底 */
.home-features-duo .feature-card-xl.feature-card-link {
  background: linear-gradient(145deg, var(--accent) 0%, #7c83f6 50%, #818cf8 100%);
  border-color: color-mix(in srgb, var(--accent) 80%, #fff);
  color: #fff;
  box-shadow: 0 10px 32px rgba(99, 102, 241, 0.38);
}

.home-features-duo .feature-card-xl.feature-card-link h3 {
  color: #fff;
}

.home-features-duo .feature-card-xl.feature-card-link p {
  color: rgba(255, 255, 255, 0.9);
}

.home-features-duo .feature-card-xl .feature-card-cta {
  display: inline-block;
  margin-top: 0.85rem;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--accent);
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.home-features-duo .feature-card-xl.feature-card-link:hover,
.home-features-duo .feature-card-xl.feature-card-link:focus-visible {
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 14px 40px rgba(99, 102, 241, 0.5);
  transform: translateY(-3px);
}

.home-features-unified .feature-card-xl.feature-card-link {
  background: linear-gradient(145deg, var(--accent) 0%, #7c83f6 50%, #818cf8 100%);
  border-color: color-mix(in srgb, var(--accent) 80%, #fff);
  color: #fff;
  box-shadow: 0 10px 32px rgba(99, 102, 241, 0.38);
}

.home-features-unified .feature-card-xl.feature-card-link h3 {
  color: #fff;
}

.home-features-unified .feature-card-xl.feature-card-link p {
  color: rgba(255, 255, 255, 0.9);
}

.home-features-unified .feature-card-xl .feature-card-cta {
  display: inline-block;
  margin-top: 0.85rem;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--accent);
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.home-features-unified .feature-card-xl.feature-card-link:hover,
.home-features-unified .feature-card-xl.feature-card-link:focus-visible {
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 14px 40px rgba(99, 102, 241, 0.5);
  transform: translateY(-3px);
}

.feature-card-cta {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--accent);
}

/* 聊天 / 视觉页内功能说明（可关闭，避免中间页一闪而过） */
.feature-intro-panel {
  flex-shrink: 0;
  padding: 0 1.5rem;
  width: 100%;
  box-sizing: border-box;
}

.feature-intro-inner {
  margin: 0.65rem 0 0.5rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.feature-intro-head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.feature-intro-icon {
  font-size: var(--text-3xl-md);
  line-height: 1;
  flex-shrink: 0;
}

.feature-intro-head h3 {
  margin: 0 0 0.2rem;
  font-size: var(--text-lg);
}

.feature-intro-head p {
  margin: 0;
  font-size: var(--text-base);
  color: var(--text-muted);
  line-height: 1.45;
}

.feature-intro-head > div {
  flex: 1;
  min-width: 0;
}

.feature-intro-close {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: var(--text-xl);
  line-height: 1;
  cursor: pointer;
}

.feature-intro-close:hover {
  background: var(--surface-2);
  color: var(--text);
}

.feature-intro-list {
  margin: 0 0 0.75rem;
  padding-left: 1.15rem;
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--text);
}

.feature-intro-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.65rem;
}

.feature-intro-scenes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.feature-intro-cost {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.feature-detail-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem 1.5rem;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

.feature-back-btn {
  margin-bottom: 1rem;
}

.feature-detail-hero {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.feature-detail-hero .icon-lg {
  font-size: var(--text-4xl);
  line-height: 1;
  flex-shrink: 0;
}

.feature-detail-hero h2 {
  margin: 0 0 0.35rem;
  font-size: var(--text-xl);
}

.feature-detail-hero .tagline {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.5;
}

.feature-detail-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin-bottom: 0.75rem;
}

.feature-detail-block h4 {
  margin: 0 0 0.5rem;
  font-size: var(--text-base);
}

.feature-detail-block ul {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--text-muted);
  line-height: 1.6;
  font-size: var(--text-base);
}

.feature-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.feature-pill {
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}

.feature-detail-actions {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.feature-detail-actions .btn-primary {
  width: 100%;
  max-width: 320px;
}

.app-body.feature-mode .sidebar {
  display: none !important;
}

.app-body.feature-mode #page-chat .sidebar,
.app-body.account-focus .sidebar {
  display: none !important;
}

.account-module-item.highlight {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.advantage-list {
  display: grid;
  gap: 0.75rem;
}

.advantage-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.advantage-body b {
  color: var(--accent);
}

.pricing-banner {
  text-align: center;
  padding: 2rem 1.5rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.1));
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.pricing-banner .price-tag {
  font-size: var(--text-3xl);
  font-weight: var(--weight-extrabold);
  color: var(--accent);
  margin: 0.5rem 0;
}

.invite-hint {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.invite-hint.valid {
  color: var(--success);
}

.invite-hint.invalid {
  color: var(--danger);
}

#view-auth {
  min-height: 100vh;
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.auth-shell .site-header {
  position: relative;
}

.auth-shell .auth-card-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.register-mode-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.register-mode-tabs button {
  flex: 1;
  padding: 0.5rem;
  font-size: var(--text-sm);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
}

.register-mode-tabs button.active {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent);
  font-weight: var(--weight-semibold);
}

.invite-code-row {
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.copy-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.copy-row input {
  flex: 1;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  font-family: monospace;
}

.home-footer {
  text-align: center;
  padding: 2rem 1rem 2.25rem;
  color: var(--text-muted);
  font-size: var(--text-sm);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  line-height: 1.55;
}

.home-footer-lead {
  margin: 0;
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--text);
  letter-spacing: 0.02em;
}

.home-footer-models {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
}

.home-footer-copy {
  margin: 0.35rem 0 0;
  font-size: var(--text-sm);
  opacity: 0.85;
}

@media (min-width: 769px) {
  .site-nav {
    display: flex;
  }
}

/* Very narrow phones (e.g. WeChat in-app browser) */
@media (max-width: 380px) {
  .site-header .brand-logo {
    font-size: var(--text-sm);
  }

  .site-header .brand-logo .logo-mark {
    width: 28px;
    height: 28px;
  }

  #home-register,
  #plans-register {
    padding-left: 0.4rem;
    padding-right: 0.4rem;
  }
}
