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

:root {
  --bg: #070708;
  --surface: #0e0e10;
  --surface-raised: #151518;
  --border: #1e1e22;
  --border-active: #2e2e35;
  --text: #e8e8ed;
  --text-secondary: #94949e;
  --text-tertiary: #5c5c66;
  --accent: #6c6cf0;
  --accent-hover: #8888f8;
  --accent-subtle: rgba(108,108,240,0.1);
  --error: #ef4444;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 7px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

/* ─── 飘动光影背景 ─── */
body::before,
body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(80px);
}

body::before {
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(108,108,240,0.55) 0%, rgba(108,108,240,0.15) 40%, transparent 70%);
  top: -250px;
  right: -200px;
  opacity: 0.7;
  animation: orbFloat1 25s ease-in-out infinite alternate;
}

body::after {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(255,160,60,0.55) 0%, rgba(255,120,40,0.15) 40%, transparent 70%);
  bottom: -150px;
  left: -150px;
  opacity: 0.65;
  animation: orbFloat2 30s ease-in-out infinite alternate;
}

/* 中间光晕 */
.ambient-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.ambient-glow::before {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99,102,241,0.25), transparent 60%);
  top: 50%;
  left: 30%;
  transform: translate(-50%, -50%);
  filter: blur(60px);
  animation: orbFloat3 20s ease-in-out infinite alternate;
}

.ambient-glow::after {
  content: '';
  position: absolute;
  width: 350px;
  height: 350px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,160,60,0.2), transparent 60%);
  top: 40%;
  right: 20%;
  transform: translate(50%, -50%);
  filter: blur(50px);
  animation: orbFloat4 22s ease-in-out infinite alternate-reverse;
}

@keyframes orbFloat1 {
  0% { transform: translate(0, 0) scale(1); opacity: 0.6; }
  33% { transform: translate(-60px, 80px) scale(1.1); opacity: 0.75; }
  66% { transform: translate(30px, -60px) scale(0.95); opacity: 0.6; }
  100% { transform: translate(-40px, 30px) scale(1.05); opacity: 0.7; }
}

@keyframes orbFloat2 {
  0% { transform: translate(0, 0) scale(1); opacity: 0.55; }
  50% { transform: translate(80px, -60px) scale(1.15); opacity: 0.7; }
  100% { transform: translate(-40px, 50px) scale(0.9); opacity: 0.6; }
}

@keyframes orbFloat3 {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 0.4; }
  50% { transform: translate(-40%, -55%) scale(1.2); opacity: 0.5; }
  100% { transform: translate(-55%, -45%) scale(0.9); opacity: 0.4; }
}

@keyframes orbFloat4 {
  0% { transform: translate(50%, -50%) scale(1); opacity: 0.3; }
  50% { transform: translate(40%, -60%) scale(1.15); opacity: 0.4; }
  100% { transform: translate(55%, -40%) scale(0.95); opacity: 0.3; }
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 48px 24px;
  position: relative;
  z-index: 1;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 48px;
}

.logo {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--accent);
  margin-bottom: 8px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 15px;
}

/* ─── 输入区 ─── */
.input-area {
  background: #ffffff1a;
  border: 1px solid #a2a0fd3b;
  border-radius: 40px;
  padding: 20px 20px 24px;
  margin: 0 auto 16px;
  transition: border-color 0.3s, box-shadow 0.3s;
  position: relative;
  overflow: hidden;
  width: 90%;
  border-bottom: 2px solid #a2a0fd40;
  box-shadow: 0 15px 20px #ffffff1c;
}

.input-area:focus-within {
  border-color: #ea580c57;
  background: #ea580c0d;
  box-shadow: 0 15px 20px #ea580c2e;
}

.input-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.input-label {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0;
  color: transparent;
  background: linear-gradient(90deg, var(--text-tertiary) 0%, var(--text-tertiary) 30%, rgba(255,255,255,0.9) 50%, var(--text-tertiary) 70%, var(--text-tertiary) 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: ShinyText_shine__VD2fp 3s linear infinite;
}
.provider-switch {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 99px;
  padding: 2px;
  gap: 0;
  transition: all 0.2s;
}
.provider-badge {
  padding: 4px 14px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: all 0.2s;
  cursor: pointer;
  white-space: nowrap;
}
.provider-badge.premium {
  background: #ea580c;
  color: #fff;
}
.provider-badge.basic {
  background: transparent;
  color: rgba(255,255,255,0.5);
}
.provider-badge.premium.inactive {
  background: transparent;
  color: rgba(255,255,255,0.35);
}
.provider-badge.basic.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
}
.provider-switch:hover {
  border-color: rgba(255,255,255,0.2);
}

@keyframes ShinyText_shine__VD2fp {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid #a2a0fd52;
  border-radius: 20px;
  border-bottom: 1px solid #a2a0fd5c;
  color: var(--text);
  font-size: 15px;
  padding: 14px 16px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.7;
  transition: border-color 0.25s, box-shadow 0.25s;
}

textarea:focus {
  outline: none;
  border-color: #6c6cf0a6;
  box-shadow: 0 0 0 3px rgba(108,108,240,0.08);
}

textarea::placeholder {
  color: var(--text-tertiary);
}

.btn-primary {
  margin-top: 0;
  padding: 10px 28px;
  background: linear-gradient(341deg, #223cffb3 1%, #de5125cc);
  color: #fff;
  border: none;
  border-radius: 9999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
  position: relative;
  min-height: 42px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

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

.btn-text, .btn-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.hidden {
  display: none !important;
}

/* ─── 选项折叠栏 ─── */
.options-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
  padding: 6px 6px 6px 12px;
  border-top: 1px solid rgba(162,160,253,0.15);
  min-height: 48px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.options-bar:hover {
  background: rgba(162,160,253,0.04);
}

.bar-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.bar-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid rgba(162,160,253,0.2);
  border-radius: 99px;
  font-size: 12px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.bar-pill:hover {
  border-color: rgba(108,108,240,0.4);
  background: rgba(108,108,240,0.08);
}

.bar-pill.has-selection {
  border-color: rgba(108,108,240,0.5);
  background: rgba(108,108,240,0.12);
}

.pill-label {
  color: var(--text-tertiary);
  font-weight: 500;
}

.bar-pill.has-selection .pill-label {
  color: var(--accent);
}

.pill-value {
  color: var(--text-secondary);
  font-weight: 400;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-pill.has-selection .pill-value {
  color: var(--text);
}

.bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.elapsed-timer {
  font-size: 12px;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  animation: fadeIn 0.2s ease;
}

.cooldown-timer {
  font-size: 12px;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ─── 分类弹出面板 ─── */
.pill-panel {
  padding: 10px 0 2px 12px;
  animation: panelSlideIn 0.2s ease;
}

.pill-panel:not(.hidden) + .pill-panel {
  border-top: 1px solid rgba(162,160,253,0.06);
  padding-top: 8px;
}

@keyframes panelSlideIn {
  from { opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; }
  to   { opacity: 1; max-height: 60px; }
}

.option-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.chip {
  padding: 4px 12px;
  font-size: 12px;
  border: 1px solid rgba(162,160,253,0.25);
  border-radius: 99px;
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.chip:hover {
  background: rgba(108,108,240,0.12);
  border-color: rgba(108,108,240,0.4);
  color: var(--text);
}

.chip.active {
  background: rgba(108,108,240,0.18);
  border-color: rgba(108,108,240,0.5);
  color: #fff;
}

/* Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

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

/* Error */
.error-area {
  background: rgba(239,68,68,0.06);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--error);
  font-size: 14px;
  margin-bottom: 16px;
  animation: fadeIn 0.2s ease;
}

/* Result */
.result-area {
  animation: fadeIn 0.35s ease;
}

.result-area.highlight-flash {
  animation: highlightFlash 0.8s ease;
}

@keyframes highlightFlash {
  0% { opacity: 0; transform: translateY(10px); }
  15% { opacity: 1; transform: translateY(0); }
  40% { box-shadow: 0 0 30px rgba(108,108,240,0.3); }
  100% { box-shadow: none; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.result-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.toolbar-actions {
  display: flex;
  gap: 6px;
}

.btn-secondary {
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: var(--surface-raised);
  border-color: var(--border-active);
  color: var(--text);
}

/* Device Frame */
.device-frame {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

.device-notch {
  height: 22px;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.device-notch::after {
  content: '';
  width: 52px;
  height: 5px;
  background: var(--text-tertiary);
  border-radius: 3px;
  opacity: 0.25;
}

#preview {
  width: 100%;
  height: 520px;
  border: none;
  background: white;
}

/* ─── 画廊 (旧 - 展开网格) ─── */
.gallery-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.gallery-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.gallery-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 2px 10px;
  min-width: 24px;
  text-align: center;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
}

.gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 64px 20px;
  color: var(--text-secondary);
}

.gallery-empty-icon {
  font-size: 28px;
  color: var(--text-tertiary);
  display: block;
  margin-bottom: 14px;
  opacity: 0.4;
}

.gallery-empty-hint {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 6px;
}

.gallery-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: all 0.2s;
  cursor: default;
}

.gallery-card:hover {
  border-color: var(--border-active);
  background: var(--surface-raised);
}

.gallery-card.active {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.gallery-card-body {
  padding: 16px;
  flex: 1;
  min-width: 0;
}

.gallery-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.gallery-card-title-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.gallery-card-date {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
  flex-shrink: 0;
}

.gallery-card-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}


/* Footer */
.footer {
  text-align: center;
  margin-top: 80px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--text-tertiary);
  font-size: 13px;
}

.footer a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

.footer a:hover {
  color: var(--accent);
}

/* Responsive */
@media (max-width: 640px) {
  .container { padding: 24px 16px; }
  .input-area { padding: 16px 16px 20px; }
  #preview { height: 400px; }
  .result-toolbar { flex-direction: column; gap: 8px; align-items: flex-start; }
  .gallery-grid { grid-template-columns: 1fr; }
  body::before { width: 350px; height: 350px; }
  body::after { width: 250px; height: 250px; }
}

@media (prefers-reduced-motion: reduce) {
  body::before,
  body::after,
  .ambient-glow::before,
  .ambient-glow::after {
    animation: none !important;
  }
}

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-raised);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-sm);
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  z-index: 100;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  white-space: nowrap;
}

.toast.hidden {
  display: none;
}

.toast-icon {
  font-size: 16px;
  flex-shrink: 0;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(16px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(-50%) translateY(0); }
  to { opacity: 0; transform: translateX(-50%) translateY(16px); }
}

/* Responsive */
@media (max-width: 640px) {
  .container { padding: 24px 16px; }
  .input-area { padding: 16px 16px 20px; }
  #preview { height: 400px; }
  .result-toolbar { flex-direction: column; gap: 8px; align-items: flex-start; }
  .gallery-grid { grid-template-columns: 1fr; }
  body::before { width: 350px; height: 350px; }
  body::after { width: 250px; height: 250px; }
  .options-bar { flex-wrap: wrap; padding: 6px; }
  .bar-pills { flex-wrap: wrap; gap: 4px; }
  .toast { font-size: 13px; padding: 10px 18px; bottom: 20px; }
}

/* ─── View Switching ─── */
.main-view.hidden,
.project-view.hidden {
  display: none !important;
}

/* ─── Carousel ─── */
.gallery-section {
  margin-bottom: 20px;
  position: relative;
}
.gallery-section.collapsed .carousel-wrap {
  max-height: 0;
  opacity: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
}
.carousel-wrap {
  max-height: 380px;
  overflow: hidden;
  position: relative;
  mask-image: linear-gradient(to bottom, transparent 0%, black 6%, black 85%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 6%, black 85%, transparent 100%);
  transition: max-height 0.4s ease, opacity 0.3s ease;
}
.carousel-track {
  display: flex;
  flex-direction: column;
  animation: scrollUp 30s linear infinite;
}
.carousel-track:hover {
  animation-play-state: paused;
}
.carousel-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  min-height: 48px;
}
.carousel-item:hover {
  background: rgba(255,255,255,0.04);
}
.carousel-item-thumb {
  width: 64px;
  height: 40px;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}
.carousel-item-thumb iframe {
  width: 400%;
  height: 500%;
  border: none;
  transform: scale(0.25);
  transform-origin: 0 0;
  pointer-events: none;
  user-select: none;
}
.carousel-item-info {
  flex: 1;
  min-width: 0;
}
.carousel-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}
.carousel-item-desc {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.carousel-item-del {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-tertiary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
}
.carousel-item:hover .carousel-item-del {
  opacity: 1;
}
.carousel-item-del:hover {
  color: var(--error);
  background: rgba(239,68,68,0.08);
}

@keyframes scrollUp {
  0% { transform: translateY(0); }
  100% { transform: translateY(-50%); }
}

/* Toggle button */
.gallery-toggle {
  display: block;
  width: 100%;
  padding: 8px;
  margin-top: 4px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.gallery-toggle:hover {
  border-color: var(--border-active);
  color: var(--text-secondary);
  background: rgba(255,255,255,0.02);
}
.gallery-toggle.expanded {
  color: var(--accent);
}

/* ─── Old gallery grid (hidden by default) ─── */
.gallery-grid.hidden {
  display: none !important;
}
.gallery-grid:not(.hidden) {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.gallery-card {
  cursor: pointer;
}
.gallery-card-thumb {
  width: 100%;
  height: 180px;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: #fff;
  position: relative;
}
.gallery-card-thumb iframe {
  width: 400%;
  height: 500%;
  border: none;
  transform: scale(0.25);
  transform-origin: 0 0;
  pointer-events: none;
  user-select: none;
}
.gallery-card-body {
  padding: 14px;
}
.gallery-card-actions {
  display: flex;
  border-top: 1px solid var(--border);
}
.gallery-btn {
  flex: 1;
  padding: 9px 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.gallery-btn:hover {
  background: var(--bg);
}
.gallery-btn-del {
  border-left: 1px solid var(--border);
  max-width: 42px;
  color: var(--text-tertiary);
  font-size: 16px;
  line-height: 1;
}
.gallery-btn-del:hover {
  color: var(--error);
  background: rgba(239,68,68,0.06);
}

/* ─── Project View ─── */
.project-view {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  overflow: hidden;
  position: relative;
  z-index: 1;
}

/* ─── Project Menubar ─── */
.project-menubar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  min-height: 48px;
  flex-shrink: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.menubar-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
}
.menubar-tab {
  padding: 6px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  background: transparent;
  font-family: inherit;
  flex-shrink: 0;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.menubar-tab:hover {
  color: var(--text);
  background: rgba(255,255,255,0.04);
}
.menubar-tab.active {
  color: var(--text);
  background: var(--accent-subtle);
  border-color: rgba(108,108,240,0.3);
}
.menubar-tab .tab-delete {
  display: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font-size: 12px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  margin: 0 -4px 0 0;
  transition: all 0.15s;
}
.menubar-tab:hover .tab-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.menubar-tab .tab-delete:hover {
  color: var(--error);
  background: rgba(239,68,68,0.12);
}
.menubar-tab-single {
  color: var(--text-secondary);
  font-size: 13px;
  padding: 6px 4px;
  pointer-events: none;
}
.menubar-close {
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-tertiary);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.menubar-close:hover {
  color: var(--error);
  background: rgba(239,68,68,0.08);
  border-color: rgba(239,68,68,0.2);
}
.menubar-add-page {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(108,108,240,0.3);
  border-radius: var(--radius-xs);
  background: var(--accent-subtle);
  color: var(--accent);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
  line-height: 1;
}
.menubar-add-page:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.menubar-spacer {
  flex: 1;
  min-width: 8px;
}
.menubar-refresh {
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-tertiary);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
  line-height: 1;
}
.menubar-refresh:hover {
  color: var(--accent);
  background: rgba(255,255,255,0.04);
}
.menubar-tooltip {
  position: fixed;
  padding: 6px 10px;
  background: var(--surface-raised);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-xs);
  font-size: 12px;
  color: var(--text);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  white-space: nowrap;
  z-index: 300;
}
.menubar-tooltip.show {
  opacity: 1;
}
.menubar-action {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: inherit;
}
.menubar-action:hover {
  background: rgba(255,255,255,0.04);
  border-color: var(--border-active);
  color: var(--text);
}

/* ─── Project Iframe ─── */
.project-iframe-wrap {
  flex: 1;
  position: relative;
  background: #fff;
  overflow: hidden;
}
.project-iframe-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
}
.project-iframe-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: var(--bg);
}
.project-iframe-wrap iframe:not([srcdoc=""]) ~ .project-iframe-empty,
.project-iframe-wrap iframe:not([src=""]) ~ .project-iframe-empty {
  display: none;
}
.empty-icon {
  font-size: 40px;
  color: var(--text-tertiary);
  opacity: 0.3;
  margin-bottom: 12px;
}
.empty-text {
  font-size: 14px;
  color: var(--text-tertiary);
  max-width: 320px;
  text-align: center;
  line-height: 1.7;
}

/* ─── Chat Panel (matching main input style) ─── */
.chat-panel {
  flex-shrink: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  max-height: 160px;
}
.chat-placeholder {
  text-align: center;
  padding: 16px;
  color: var(--text-tertiary);
  font-size: 13px;
}
.chat-placeholder span {
  font-size: 18px;
  display: block;
  margin-bottom: 4px;
  opacity: 0.5;
}
.chat-message {
  max-width: 85%;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.6;
  animation: fadeIn 0.2s ease;
}
.chat-message.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-message.assistant {
  align-self: flex-start;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.chat-input-area {
  padding: 12px 16px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.chat-input-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  color: var(--text-tertiary);
}
.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.chat-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid rgba(162,160,253,0.32);
  border-radius: 20px;
  border-bottom: 1px solid rgba(162,160,253,0.36);
  color: var(--text);
  font-size: 14px;
  padding: 10px 16px;
  font-family: inherit;
  line-height: 1.6;
  resize: none;
  max-height: 120px;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.chat-input:focus {
  outline: none;
  border-color: rgba(108,108,240,0.65);
  box-shadow: 0 0 0 3px rgba(108,108,240,0.08);
}
.chat-input::placeholder {
  color: var(--text-tertiary);
}
.chat-send-btn {
  padding: 10px 20px;
  background: linear-gradient(341deg, #223cffb3 1%, #de5125cc);
  color: #fff;
  border: none;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: inherit;
  letter-spacing: -0.01em;
}
.chat-send-btn:hover:not(:disabled) {
  filter: brightness(1.15);
  transform: translateY(-1px);
}
.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─── Chat Loading Dots ─── */
.chat-dots {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}
.chat-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-tertiary);
  animation: dotBounce 1.2s ease infinite;
}
.chat-dots span:nth-child(2) { animation-delay: 0.15s; }
.chat-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes dotBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ─── Add Page Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.15s ease;
}
.modal-overlay.hidden {
  display: none;
}
.modal-card {
  background: var(--surface-raised);
  border: 1px solid var(--border-active);
  border-radius: var(--radius);
  padding: 24px;
  width: 360px;
  max-width: 90vw;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.modal-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.modal-close {
  width: 28px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-tertiary);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.modal-close:hover {
  color: var(--text);
  background: rgba(255,255,255,0.06);
}
.modal-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.modal-input:focus {
  border-color: var(--accent);
}
.modal-input::placeholder {
  color: var(--text-tertiary);
}
.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  justify-content: flex-end;
}
.modal-btn {
  padding: 8px 20px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  border: none;
}
.modal-btn-cancel {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.modal-btn-cancel:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text);
}
.modal-btn-confirm {
  background: var(--accent);
  color: #fff;
}
.modal-btn-confirm:hover {
  background: var(--accent-hover);
}
