/* ==========================================================================
   NovaForge AI - Universal Image Engine Style System
   Vanilla CSS Design System: Dark Theme, Glassmorphism, Neon Accents
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-app: #07090E;
  --bg-panel: #0D111A;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(28, 38, 58, 0.85);
  --bg-glass: rgba(15, 23, 42, 0.65);
  --bg-input: #0A0E17;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: #6366F1;
  --border-glow: rgba(99, 102, 241, 0.35);

  --accent-primary: #6366F1;
  --accent-primary-hover: #4F46E5;
  --accent-cyan: #06B6D4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.3);
  --accent-purple: #A855F7;
  --accent-gradient: linear-gradient(135deg, #6366F1 0%, #06B6D4 100%);
  --accent-gradient-warm: linear-gradient(135deg, #EC4899 0%, #8B5CF6 100%);

  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-subtle: #64748B;
  --text-accent: #818CF8;

  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;

  /* Geometry & Shadows */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.35);

  /* Typography */
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Scrollbar Design Tokens */
  --scrollbar-track: rgba(255, 255, 255, 0.02);
  --scrollbar-thumb: rgba(99, 102, 241, 0.32);
  --scrollbar-thumb-hover: rgba(99, 102, 241, 0.65);
  --scrollbar-thumb-active: #818CF8;
}

/* Reset & Global */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body.dark-theme {
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.45;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 30%, rgba(6, 182, 212, 0.06) 0%, transparent 45%);
  background-attachment: fixed;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Light Theme System */
body.light-theme {
  --bg-app: #F6F8FC;
  --bg-panel: #FFFFFF;
  --bg-card: rgba(255, 255, 255, 0.95);
  --bg-card-hover: #FFFFFF;
  --bg-glass: rgba(255, 255, 255, 0.88);
  --bg-input: #EDF2F8;

  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-focus: #4F46E5;
  --border-glow: rgba(99, 102, 241, 0.2);

  --text-main: #0F172A;
  --text-muted: #334155;
  --text-subtle: #64748B;
  --text-accent: #4F46E5;

  --shadow-card: 0 4px 16px rgba(15, 23, 42, 0.04);
  --shadow-glow: 0 0 16px rgba(99, 102, 241, 0.15);

  --scrollbar-track: rgba(0, 0, 0, 0.03);
  --scrollbar-thumb: rgba(99, 102, 241, 0.35);
  --scrollbar-thumb-hover: rgba(79, 70, 229, 0.65);
  --scrollbar-thumb-active: #4F46E5;

  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.45;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 85% 30%, rgba(6, 182, 212, 0.04) 0%, transparent 45%);
  background-attachment: fixed;
  transition: background-color 0.25s ease, color 0.25s ease;
}

body.light-theme .app-header {
  background: rgba(255, 255, 255, 0.92);
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

body.light-theme .brand-name {
  color: #0F172A;
}

body.light-theme .mode-tabs {
  background: rgba(0, 0, 0, 0.05);
}

body.light-theme .preset-card {
  background: #FFFFFF;
  border-color: rgba(0, 0, 0, 0.08);
}
body.light-theme .preset-card:hover {
  background: #F8FAFC;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
body.light-theme .preset-card.active {
  background: #F0F4FF;
  border-color: var(--accent-primary);
}

body.light-theme .dim-nav-tab {
  background: #F1F5F9;
  border-color: rgba(0, 0, 0, 0.06);
  color: #475569;
}
body.light-theme .dim-nav-tab:hover {
  background: #E2E8F0;
  color: #0F172A;
}
body.light-theme .dim-nav-tab.active {
  background: #EEF2FF;
  border-color: #6366F1;
  color: #4F46E5;
}

body.light-theme .dimension-chips-pool {
  background: #F8FAFC;
  border-color: rgba(0, 0, 0, 0.08);
}

body.light-theme .dim-chip {
  background: #FFFFFF;
  color: #334155;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
body.light-theme .dim-chip:hover {
  background: #F1F5F9;
  color: #0F172A;
  border-color: rgba(99, 102, 241, 0.3);
}
body.light-theme .dim-chip.active {
  background: #EEF2FF;
  color: #4F46E5;
  border-color: #6366F1;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.2);
}

body.light-theme .quick-tag-pill {
  background: #FFFFFF;
  border-color: rgba(0, 0, 0, 0.08);
  color: #475569;
}
body.light-theme .quick-tag-pill:hover {
  background: #EEF2FF;
  border-color: #6366F1;
  color: #4338CA;
}

body.light-theme .nav-scroll-btn {
  background: #FFFFFF;
  border-color: rgba(0, 0, 0, 0.1);
  color: #475569;
}
body.light-theme .nav-scroll-btn:hover {
  background: #EEF2FF;
  border-color: #6366F1;
  color: #4338CA;
}

body.light-theme .dimension-nav-tabs::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.04);
}
body.light-theme .dimension-nav-tabs::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.3);
}

body.light-theme .dimension-desc-bar {
  background: #F1F5F9;
  color: #64748B;
  border-left-color: #6366F1;
}

body.light-theme .dim-chip-card {
  background: #FFFFFF;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
body.light-theme .dim-chip-card:hover {
  background: #F8FAFC;
  border-color: rgba(99, 102, 241, 0.35);
}
body.light-theme .dim-chip-card.active {
  background: #EEF2FF;
  border-color: #6366F1;
  box-shadow: 0 0 0 1px #6366F1;
}
body.light-theme .dim-chip-card.active .chip-title {
  color: #312E81;
}
body.light-theme .dim-chip-card.active .chip-subtitle {
  color: #4F46E5;
}

body.light-theme .active-tray-bar {
  background: #F1F5F9;
  border-color: rgba(99, 102, 241, 0.2);
}

body.light-theme .tray-pill {
  background: #EEF2FF;
  border-color: rgba(99, 102, 241, 0.3);
  color: #312E81;
}

body.light-theme .compiled-prompt-display {
  background: #F8FAFC;
  border-color: rgba(0, 0, 0, 0.08);
  color: #334155;
}

body.light-theme .result-viewport {
  background: #EDF2F7;
  border-color: rgba(0, 0, 0, 0.08);
}

body.light-theme .revised-prompt-box {
  background: #FFFFFF;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

body.light-theme .revised-prompt-label {
  color: #4F46E5;
}

body.light-theme .revised-prompt-box p {
  color: #334155;
}

body.light-theme .btn-copy-revised {
  border-color: rgba(0, 0, 0, 0.1);
  color: #64748B;
}

body.light-theme .btn-copy-revised:hover {
  background: #F1F5F9;
  color: #0F172A;
  border-color: #4F46E5;
}

body.light-theme .presets-vertical-list::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
}

body.light-theme .modal-card {
  background: #FFFFFF;
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

body.light-theme .btn-icon {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
  color: #475569;
}
body.light-theme .btn-icon:hover {
  color: #0F172A;
  background: rgba(0, 0, 0, 0.08);
}

body.light-theme .status-indicator {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.06);
  color: #334155;
}

body.light-theme .form-group input,
body.light-theme .form-group textarea,
body.light-theme .prompt-input-container textarea,
body.light-theme .spec-field select,
body.light-theme .spec-field input {
  background: #F1F5F9;
  border-color: rgba(0, 0, 0, 0.1);
  color: #0F172A;
}

body.light-theme .form-group-switch {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.08);
}

body.light-theme .upload-canvas-zone {
  background: #F8FAFC;
  border-color: rgba(0, 0, 0, 0.12);
}

body.light-theme .canvas-thumbnail-box {
  background: #FFFFFF;
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

body.light-theme .inpaint-canvas-stage {
  background: #F1F5F9;
}

body.light-theme .inpaint-modal-toolbar {
  background: #F8FAFC;
}

body.light-theme .btn-tool {
  background: #FFFFFF;
  color: #475569;
}

body.light-theme .btn-tool.active {
  background: #EEF2FF;
  border-color: #4F46E5;
  color: #4F46E5;
}

body.light-theme .radio-pill-group {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
}

body.light-theme .pill-option.active {
  background: #FFFFFF;
  color: #0F172A;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

/* Custom Futuristic Sleek Scrollbars */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  background-clip: padding-box;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.45);
}
::-webkit-scrollbar-thumb:active {
  background: var(--scrollbar-thumb-active);
}
::-webkit-scrollbar-corner {
  background: transparent;
}

/* Header - Ultra Compact */
.app-header {
  height: 46px;
  background: rgba(13, 17, 26, 0.88);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 50;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}

.logo-orb {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  background: var(--accent-gradient);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.5);
  animation: pulse-glow 3s infinite alternate ease-in-out;
}

@keyframes pulse-glow {
  0% { transform: scale(0.96); filter: drop-shadow(0 0 4px #6366F1); }
  100% { transform: scale(1.04); filter: drop-shadow(0 0 10px #06B6D4); }
}

.brand-name {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #FFF;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-badge {
  font-size: 0.58rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  background: rgba(99, 102, 241, 0.2);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

/* Mode Switcher Buttons */
.mode-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.35);
  padding: 2px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.mode-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-btn:hover {
  color: var(--text-main);
}

.mode-btn.active {
  background: var(--accent-gradient);
  color: #FFF;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

/* Header Right */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  border: 1px solid var(--border-subtle);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--warning);
  box-shadow: 0 0 5px var(--warning);
}

.status-indicator.connected .status-dot {
  background: var(--success);
  box-shadow: 0 0 7px var(--success);
}

.btn-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  color: #FFF;
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-primary);
}

/* ==========================================================================
   Layout System: Balanced 3-Column Studio Cockpit (Zero Page Scroll)
   Proportions:
   - Col 1 (Config & Presets): ~300px (Presets list + Engine parameters + Hero Button)
   - Col 2 (Studio & Matrix):  ~620px (Custom prompt + Dimensions Console + Inspector)
   - Col 3 (Visual Showcase):  Flex 1 (~900px+ Grand Canvas Viewport + History Strip)
   ========================================================================== */
html, body {
  height: 100vh;
  overflow: hidden;
}

.app-layout {
  display: grid;
  grid-template-columns: 295px minmax(540px, 630px) minmax(420px, 1fr);
  gap: 10px;
  max-width: 1920px;
  margin: 0 auto;
  padding: 8px 12px 10px 12px;
  height: calc(100vh - 46px);
  overflow: hidden;
  box-sizing: border-box;
}

@media (max-width: 1280px) {
  .app-layout {
    grid-template-columns: 280px minmax(500px, 580px) 1fr;
  }
}

@media (max-width: 1080px) {
  html, body {
    overflow: auto;
  }
  .app-layout {
    grid-template-columns: 1fr;
    height: auto;
    overflow-y: visible;
  }
}

/* Base Panel Rules */
.panel {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

.config-panel {
  /* Column 1: Config & Presets Hub */
}

.studio-panel {
  /* Column 2: Creative & Matrix Studio */
}

.showcase-panel {
  /* Column 3: Grand Visual Showcase */
  flex: 1;
  min-width: 0;
}

/* Shared Card Styles - Compact & Crisp */
.section-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  margin-bottom: 0;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s ease;
}

.section-header, .section-header-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
}

.title-with-pill {
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-num {
  font-family: var(--font-heading);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.12);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(6, 182, 212, 0.25);
}

.section-header h2, .section-header-compact h2 {
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);
}

.pill-count {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.btn-text, .btn-text-xs {
  background: none;
  border: none;
  color: var(--text-subtle);
  font-size: 0.72rem;
  cursor: pointer;
  transition: color 0.2s;
}

.btn-text:hover, .btn-text-xs:hover {
  color: var(--accent-cyan);
}

/* ==========================================================================
   Column 1: 01. Preset Palette & Category Filters
   ========================================================================== */
.preset-card-box {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.category-filters-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  margin-bottom: 5px;
  flex-shrink: 0;
  cursor: grab;
  user-select: none;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
  -webkit-overflow-scrolling: touch;
}

.category-filters-scroll.grabbing {
  cursor: grabbing;
}

.category-filters-scroll::-webkit-scrollbar {
  height: 3px;
}

.category-filters-scroll::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 999px;
}

.category-filters-scroll::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 999px;
  transition: all 0.2s ease;
}

.category-filters-scroll:hover::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb-hover);
  box-shadow: 0 0 6px rgba(99, 102, 241, 0.4);
}

.category-filters {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.cat-filter-btn {
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.72rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
}

.cat-filter-btn:hover {
  color: #FFF;
  background: rgba(255, 255, 255, 0.08);
}

.cat-filter-btn.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent-primary);
  color: #FFF;
  font-weight: 600;
}

.presets-vertical-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

.presets-vertical-list::-webkit-scrollbar {
  width: 4px;
}

.presets-vertical-list::-webkit-scrollbar-track {
  background: transparent;
}

.presets-vertical-list::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 4px;
  transition: all 0.2s ease;
}

.presets-vertical-list:hover::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb-hover);
  box-shadow: 0 0 6px rgba(99, 102, 241, 0.35);
}

.preset-card {
  flex-shrink: 0;
  background: rgba(10, 14, 23, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.preset-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: transparent;
  transition: background 0.2s;
}

.preset-card:hover {
  transform: translateX(2px);
  border-color: rgba(99, 102, 241, 0.4);
  background: rgba(18, 26, 42, 0.9);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.preset-card.active {
  border-color: var(--accent-primary);
  background: rgba(22, 32, 54, 0.95);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.25);
}

.preset-card.active::before {
  background: var(--accent-gradient);
}

.preset-badge-tag {
  font-size: 0.62rem;
  color: var(--accent-cyan);
  font-weight: 600;
  margin-bottom: 2px;
  display: block;
  line-height: 1.2;
}

.preset-name {
  font-family: var(--font-heading);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.25;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preset-desc {
  font-size: 0.68rem;
  color: var(--text-subtle);
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==========================================================================
   Column 2: 03. Custom Creative Prompt Input
   ========================================================================== */
.prompt-section {
  flex-shrink: 0;
}

.prompt-input-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.prompt-input-container textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.84rem;
  line-height: 1.45;
  resize: none;
  height: 66px;
  min-height: 66px;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.prompt-input-container textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.quick-subject-tags {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 1px 0;
}

.quick-subject-tags::-webkit-scrollbar {
  display: none;
}

.quick-tag-hint {
  font-size: 0.68rem;
  color: var(--text-subtle);
  white-space: nowrap;
  font-weight: 600;
}

.quick-tag-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 0.69rem;
  padding: 2px 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
}

.quick-tag-pill:hover {
  background: rgba(99, 102, 241, 0.18);
  color: #FFF;
  border-color: var(--accent-primary);
}

/* ==========================================================================
   03. Inpaint Canvas Studio (Edit Mode)
   ========================================================================== */
.canvas-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brush-size-control {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.brush-size-control input[type="range"] {
  width: 80px;
  accent-color: var(--accent-primary);
}

.btn-subtle {
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-subtle:hover, .btn-subtle.active {
  color: #FFF;
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent-primary);
}

/* ==========================================================================
   03. Inpaint Canvas Studio (Edit Mode - Compact & Controlled Size)
   ========================================================================== */
.inpaint-section {
  flex-shrink: 0;
  padding: 8px 12px;
}

.upload-canvas-zone {
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-sm);
  background: rgba(8, 12, 20, 0.55);
  padding: 8px 12px;
  position: relative;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.empty-upload-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  padding: 8px 12px;
  transition: all 0.2s ease;
  text-align: left;
}

.empty-upload-box:hover {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.06);
}

.empty-upload-box svg {
  color: var(--accent-cyan);
  flex-shrink: 0;
}

.upload-text-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.upload-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.2;
}

.upload-tip {
  font-size: 0.69rem;
  color: var(--text-subtle);
  line-height: 1.25;
}

.canvas-wrapper {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 2px 0;
}

.canvas-thumbnail-box {
  width: 86px;
  height: 86px;
  flex-shrink: 0;
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: #000;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.canvas-thumbnail-box:hover {
  transform: scale(1.03);
  border-color: var(--accent-cyan);
}

#base-canvas, #mask-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.canvas-side-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  text-align: left;
}

.canvas-desc-line {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.canvas-res-tag {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.canvas-hint-text {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.canvas-action-btns {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-primary-sm {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-sm);
  color: #FFF;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
  transition: all 0.15s ease;
}

.btn-primary-sm:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.5);
}

.btn-danger-text {
  color: var(--danger) !important;
}

.btn-danger-text:hover {
  background: rgba(239, 68, 68, 0.1) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
}

.pill-badge-state {
  font-size: 0.65rem;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: rgba(6, 182, 212, 0.1);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.25);
  font-weight: 600;
}

.pill-badge-state.active {
  background: rgba(168, 85, 247, 0.18);
  color: #C084FC;
  border-color: rgba(168, 85, 247, 0.35);
}

/* ==========================================================================
   Inpaint Modal Dialog (Spacious 512x512 Darkroom Canvas)
   ========================================================================== */
.inpaint-modal-card {
  max-width: 640px;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
}

.modal-subtitle {
  display: block;
  font-size: 0.68rem;
  color: var(--text-subtle);
  margin-top: 2px;
}

.inpaint-modal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid var(--border-subtle);
  gap: 10px;
}

.tool-btn-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-tool {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-tool:hover {
  color: #FFF;
  border-color: rgba(99, 102, 241, 0.4);
}

.btn-tool.active {
  background: rgba(99, 102, 241, 0.25);
  border-color: var(--accent-primary);
  color: #FFF;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

.modal-brush-control {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.modal-brush-control input[type="range"] {
  width: 90px;
  accent-color: var(--accent-primary);
}

.btn-tool-subtle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 1px solid transparent;
  color: var(--text-subtle);
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-tool-subtle:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.2);
}

.inpaint-canvas-stage {
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 7, 12, 0.85);
  overflow: auto;
}

.inpaint-modal-board {
  width: 480px;
  height: 480px;
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: #000;
}

#modal-base-canvas, #modal-mask-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

#modal-mask-canvas {
  cursor: crosshair;
}

.inpaint-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
}

.modal-footer-hint {
  font-size: 0.68rem;
  color: var(--text-subtle);
}

.modal-actions {
  display: flex;
  gap: 8px;
}

/* ==========================================================================
   Column 1: 02. Engine Specifications Card & Hero Generation Trigger
   ========================================================================== */
.engine-specs-card {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.specs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.spec-field label {
  display: block;
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--text-subtle);
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.spec-field select, .spec-field input[type="text"] {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 5px 7px;
  color: var(--text-main);
  font-size: 0.76rem;
  font-family: var(--font-body);
}

.spec-field select:focus, .spec-field input[type="text"]:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.radio-pill-group {
  display: flex;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.pill-option {
  flex: 1;
  padding: 3px 0;
  border: none;
  background: transparent;
  color: var(--text-subtle);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.pill-option.active {
  background: rgba(255, 255, 255, 0.1);
  color: #FFF;
}

/* Hero Generate Button */
.btn-generate-hero {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--accent-gradient);
  color: #FFF;
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 3px 14px rgba(99, 102, 241, 0.45);
  transition: all 0.2s ease;
}

.btn-generate-hero:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.65);
}

.btn-generate-hero:active {
  transform: translateY(0);
}

.btn-generate-hero:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-content {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* ==========================================================================
   Column 2: 04. Professional Photography Dimension Matrix Console
   ========================================================================== */
.dimensions-section {
  flex: 1;
  min-height: 340px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
}

/* 10 Dimension Nav Container with Scroll Chevron Controls */
.dimension-nav-container {
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
  flex-shrink: 0;
}

.nav-scroll-btn {
  width: 20px;
  height: 25px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
  padding: 0;
}

.nav-scroll-btn:hover {
  background: rgba(99, 102, 241, 0.2);
  color: #FFF;
  border-color: var(--accent-primary);
}

.dimension-nav-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 4px;
  flex: 1;
  min-width: 0;
  scrollbar-width: thin;
  cursor: grab;
}

.dimension-nav-tabs.grabbing {
  cursor: grabbing;
  user-select: none;
}

.dimension-nav-tabs::-webkit-scrollbar {
  height: 3px;
}

.dimension-nav-tabs::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 3px;
}

.dimension-nav-tabs::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.4);
  border-radius: 3px;
}

.dimension-nav-tabs::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

.dim-nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  flex-shrink: 0;
  position: relative;
}

.dim-nav-tab:hover {
  color: #FFF;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(99, 102, 241, 0.35);
}

.dim-nav-tab.active {
  background: rgba(99, 102, 241, 0.22);
  border-color: var(--accent-primary);
  color: #FFF;
  font-weight: 600;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.25);
}

.dim-tab-badge {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: var(--radius-full);
  background: var(--accent-gradient);
  color: #FFF;
  line-height: 1.1;
}

/* Active Dimension Description & Guideline Bar */
.dimension-desc-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  background: rgba(255, 255, 255, 0.02);
  border-left: 2px solid var(--accent-cyan);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.68rem;
  color: var(--text-subtle);
  flex-shrink: 0;
  margin: 1px 0;
}

.dimension-desc-bar .desc-icon {
  color: var(--accent-cyan);
  font-size: 0.7rem;
}

.dimension-desc-bar .desc-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Dimension Cards Grid (Shows at least 3 full rows of rich cards) */
.dimension-chips-pool {
  flex: 1;
  min-height: 180px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 6px 8px;
  background: rgba(8, 12, 22, 0.6);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  scrollbar-width: thin;
  align-content: flex-start;
}

.dimension-chips-pool::-webkit-scrollbar {
  width: 4px;
}

.dimension-chips-pool::-webkit-scrollbar-track {
  background: transparent;
}

.dimension-chips-pool::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 4px;
  transition: all 0.2s ease;
}

.dimension-chips-pool:hover::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb-hover);
  box-shadow: 0 0 6px rgba(99, 102, 241, 0.35);
}

.dim-chip-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 5px 7px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  box-sizing: border-box;
  transition: all 0.15s ease;
  position: relative;
}

.dim-chip-card:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(99, 102, 241, 0.35);
  transform: translateY(-1px);
}

.dim-chip-card.active {
  background: rgba(99, 102, 241, 0.22);
  border-color: var(--accent-primary);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

.chip-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3px;
}

.chip-title {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.dim-chip-card.active .chip-title {
  color: #FFF;
}

.chip-rec-badge {
  font-size: 0.56rem;
  padding: 1px 3px;
  border-radius: 3px;
  background: rgba(245, 158, 11, 0.2);
  color: #FBBF24;
  border: 1px solid rgba(245, 158, 11, 0.3);
  line-height: 1.1;
  font-weight: 700;
  flex-shrink: 0;
}

.chip-check-mark {
  font-size: 0.7rem;
  color: var(--accent-cyan);
  font-weight: 700;
  margin-left: auto;
  flex-shrink: 0;
}

.chip-subtitle {
  font-size: 0.61rem;
  color: var(--text-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.1;
}

.dim-chip-card.active .chip-subtitle {
  color: rgba(255, 255, 255, 0.75);
}

/* Active Recipe Tray Bar */
.active-tray-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: rgba(14, 20, 36, 0.85);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(99, 102, 241, 0.25);
  flex-shrink: 0;
  min-height: 32px;
}

.tray-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-cyan);
  white-space: nowrap;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 4px;
}

.tray-chips-scroll {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
}

.tray-chips-scroll::-webkit-scrollbar {
  display: none;
}

.tray-empty-hint {
  font-size: 0.7rem;
  color: var(--text-subtle);
  font-style: italic;
}

.tray-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  font-size: 0.7rem;
  color: var(--text-main);
  white-space: nowrap;
}

.tray-pill-dim {
  color: var(--accent-cyan);
  font-weight: 600;
  font-size: 0.65rem;
}

.tray-pill-val {
  font-weight: 500;
}

.tray-pill-del {
  background: none;
  border: none;
  color: var(--text-subtle);
  font-size: 0.82rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 2px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}

.tray-pill-del:hover {
  color: var(--danger);
}

/* ==========================================================================
   Column 2: 05. Live Compiled Prompt Inspector Monitor
   ========================================================================== */
.prompt-inspector-card {
  flex: 0 0 auto;
  height: 190px;
  max-height: 195px;
  display: flex;
  flex-direction: column;
  padding: 8px 10px;
  overflow: hidden;
}

.inspector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.inspector-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan);
  animation: pulse-dot-anim 1.8s infinite;
}

@keyframes pulse-dot-anim {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.4); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

.btn-copy-prompt {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 2px 6px;
  cursor: pointer;
}

.btn-copy-prompt:hover {
  color: #FFF;
  background: rgba(255, 255, 255, 0.1);
}

.compiled-prompt-display {
  background: rgba(8, 11, 18, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 9px;
  color: var(--text-muted);
  font-family: 'Consolas', monospace;
  font-size: 0.72rem;
  line-height: 1.4;
  flex: 1;
  min-height: 0;
  max-height: 122px;
  overflow-y: auto;
  user-select: all;
  margin-bottom: 4px;
}

.active-chips-summary {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}

.active-chips-summary::-webkit-scrollbar {
  display: none;
}

.summary-tag {
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  color: var(--accent-cyan);
  white-space: nowrap;
}

/* ==========================================================================
   Column 3: Grand Visual Showcase & History Strip (Flex 1)
   ========================================================================== */
.showcase-panel {
  flex: 1;
  min-width: 0;
}

.result-showcase-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 10px 12px;
  gap: 8px;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  flex-shrink: 0;
}

.result-header h2 {
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);
}

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

.btn-subtle-sm {
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.72rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-subtle-sm:hover {
  background: rgba(255, 255, 255, 0.12);
}

.result-viewport {
  flex: 1;
  min-height: 0;
  width: 100%;
  background: rgba(7, 10, 16, 0.9);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-subtle);
  font-size: 0.8rem;
  text-align: center;
  padding: 12px;
}

.hologram-ring {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-full);
  border: 2px dashed rgba(99, 102, 241, 0.35);
  animation: spin 16s linear infinite;
}

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

.result-image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transition: transform 0.3s ease;
  border-radius: var(--radius-sm);
}

.result-image:hover {
  transform: scale(1.015);
}

/* Loading Overlay */
.result-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(7, 10, 16, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 10;
}

.cyber-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(99, 102, 241, 0.2);
  border-top-color: var(--accent-cyan);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}

.loading-status-text {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.progress-bar-track {
  width: 180px;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  width: 0%;
  height: 100%;
  background: var(--accent-gradient);
  animation: fake-progress 15s ease-out forwards;
}

/* Revised Prompt Box - 上图下字独立拼接卡片 (彻底消除任何重叠遮挡) */
.revised-prompt-box {
  position: static;
  flex-shrink: 0;
  background: rgba(10, 15, 26, 0.88);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  max-height: 85px;
  overflow-y: auto;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.revised-prompt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.revised-prompt-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  color: var(--accent-cyan);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.btn-copy-revised {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-copy-revised:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-color: var(--accent-cyan);
}

.revised-prompt-box p {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
  word-break: break-word;
}

/* History Strip in Column 3 */
.history-card {
  flex-shrink: 0;
  padding: 8px 12px;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.history-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.history-title {
  font-weight: 600;
  color: var(--text-main);
  font-size: 0.78rem;
}

.btn-text-sm {
  background: none;
  border: none;
  color: var(--text-subtle);
  font-size: 0.7rem;
  cursor: pointer;
}

.btn-text-sm:hover {
  color: var(--danger);
}

.history-thumbnails-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  min-height: 42px;
}

.history-thumb {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  flex: 0 0 42px;
  position: relative;
  transition: transform 0.2s, border-color 0.2s;
}

.history-thumb:hover {
  transform: scale(1.08);
  border-color: var(--accent-primary);
}

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

.btn-del-thumb {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.75);
  color: #FFF;
  border: none;
  font-size: 11px;
  line-height: 13px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  transition: background 0.15s ease;
}

.history-thumb:hover .btn-del-thumb {
  display: flex;
}

.btn-del-thumb:hover {
  background: var(--danger);
}

/* ==========================================================================
   Modal Dialog
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: var(--bg-panel);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  animation: modal-enter 0.2s ease-out;
}

@keyframes modal-enter {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
}

.modal-title h3 {
  font-size: 1.05rem;
  font-weight: 600;
}

.btn-close-modal {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-body {
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-group-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.form-group-header-flex label {
  margin-bottom: 0;
}

.btn-text-xs {
  background: none;
  border: none;
  color: var(--accent-cyan);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: opacity 0.2s;
}

.btn-text-xs:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.form-group input, .form-group textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text-main);
  font-size: 0.88rem;
  font-family: var(--font-body);
}

.form-group textarea {
  resize: vertical;
  line-height: 1.5;
  font-family: 'Consolas', monospace;
  font-size: 0.82rem;
}

.form-group input:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.form-help {
  display: block;
  font-size: 0.72rem;
  color: var(--text-subtle);
  margin-top: 5px;
}

.input-password-wrapper {
  position: relative;
}

.btn-toggle-eye {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.7;
}

.form-group-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.switch-label strong {
  display: block;
  font-size: 0.85rem;
  color: var(--text-main);
}

.switch-label span {
  font-size: 0.72rem;
  color: var(--text-subtle);
}

/* Switch styling */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #334155;
  transition: 0.3s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
}

input:checked + .slider {
  background-color: var(--accent-primary);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

/* Test Ping Button */
.test-ping-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-test-connection {
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.8rem;
  cursor: pointer;
}

.btn-test-connection:hover {
  background: rgba(255, 255, 255, 0.15);
}

.ping-result-msg {
  font-size: 0.78rem;
}

.ping-result-msg.success { color: var(--success); }
.ping-result-msg.error { color: var(--danger); }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.btn-cancel {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-save-settings {
  padding: 8px 20px;
  background: var(--accent-gradient);
  border: none;
  color: #FFF;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* ==========================================================================
   User Auth Zone (Header) & Auth Modal (Login / Register / Captcha)
   ========================================================================== */
.user-auth-zone {
  display: flex;
  align-items: center;
}

.btn-auth-entry {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(6, 182, 212, 0.15));
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-full);
  color: #FFF;
  font-size: 0.74rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-auth-entry:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(6, 182, 212, 0.3));
  border-color: var(--accent-primary);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}

.user-profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px 2px 3px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
}

.user-avatar-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-cyan));
  color: #FFF;
  font-size: 0.68rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  box-shadow: 0 0 6px rgba(99, 102, 241, 0.5);
}

.user-name-text {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--text-main);
  max-width: 90px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-user-logout {
  background: none;
  border: none;
  color: var(--text-subtle);
  font-size: 0.68rem;
  padding: 1px 4px;
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.15s ease;
}

.btn-user-logout:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

.auth-modal-card {
  max-width: 420px;
  width: 100%;
}

.auth-modal-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.auth-tabs {
  display: flex;
  gap: 8px;
  background: rgba(0, 0, 0, 0.25);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.auth-tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: calc(var(--radius-sm) - 2px);
  cursor: pointer;
  transition: all 0.15s ease;
}

.auth-tab-btn.active {
  background: var(--accent-primary);
  color: #FFF;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.auth-form {
  padding: 18px 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-rule-hint {
  font-size: 0.65rem;
  color: var(--text-subtle);
}

.auth-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-field-icon {
  position: absolute;
  left: 10px;
  color: var(--text-subtle);
  pointer-events: none;
}

.auth-input-wrapper input {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 34px 8px 32px;
  color: var(--text-main);
  font-size: 0.8rem;
  transition: all 0.2s ease;
}

.auth-input-wrapper input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.btn-toggle-pwd {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-subtle);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-toggle-pwd:hover {
  color: var(--text-main);
}

.captcha-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.captcha-row input {
  flex: 1;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-main);
  font-size: 0.82rem;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.captcha-row input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.captcha-img-box {
  width: 120px;
  height: 38px;
  background: #1E293B;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s;
}

.captcha-img-box:hover {
  border-color: var(--accent-primary);
}

.captcha-img-box svg {
  width: 100%;
  height: 100%;
}

.btn-refresh-captcha {
  width: 36px;
  height: 38px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-refresh-captcha:hover {
  color: #FFF;
  background: rgba(255, 255, 255, 0.1);
  transform: rotate(45deg);
}

.auth-feedback-msg {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.auth-feedback-msg.error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #F87171;
}

.auth-feedback-msg.success {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34D399;
}

.btn-auth-submit {
  width: 100%;
  padding: 9px;
  background: linear-gradient(135deg, var(--accent-primary), #4338CA);
  border: none;
  border-radius: var(--radius-sm);
  color: #FFF;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
  transition: all 0.2s ease;
  margin-top: 4px;
}

.btn-auth-submit:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.5);
}

.btn-auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.auth-modal-footer {
  padding: 10px 20px 14px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.68rem;
  color: var(--text-subtle);
  line-height: 1.4;
}

/* Light Theme Adaptations for Auth */
body.light-theme .auth-tabs {
  background: #F1F5F9;
}

body.light-theme .auth-tab-btn {
  color: #64748B;
}

body.light-theme .auth-tab-btn.active {
  background: #4F46E5;
  color: #FFF;
}

body.light-theme .auth-input-wrapper input,
body.light-theme .captcha-row input {
  background: #F8FAFC;
  border-color: #CBD5E1;
  color: #0F172A;
}

body.light-theme .btn-auth-entry {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(6, 182, 212, 0.08));
  border-color: rgba(79, 70, 229, 0.25);
  color: #4F46E5;
}

body.light-theme .user-profile-badge {
  background: #F1F5F9;
  border-color: #E2E8F0;
}

body.light-theme .auth-modal-footer {
  background: #F8FAFC;
}

/* ==========================================================================
   16. 全局交互确认弹窗 (Custom Confirm Dialog)
   ========================================================================== */
.confirm-modal-card {
  max-width: 400px;
  width: 100%;
  padding: 22px 24px 20px;
  background: var(--bg-panel);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.85);
  animation: modal-enter 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.confirm-modal-body {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.confirm-icon-wrapper {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.confirm-icon-wrapper.danger {
  background: rgba(239, 68, 68, 0.15);
  color: #EF4444;
  border: 1px solid rgba(239, 68, 68, 0.35);
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.2);
}

.confirm-icon-wrapper.warning {
  background: rgba(245, 158, 11, 0.15);
  color: #F59E0B;
  border: 1px solid rgba(245, 158, 11, 0.35);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.2);
}

.confirm-icon-wrapper.primary {
  background: rgba(99, 102, 241, 0.15);
  color: #818CF8;
  border: 1px solid rgba(99, 102, 241, 0.35);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.2);
}

.confirm-text-content {
  flex: 1;
  min-width: 0;
}

.confirm-dialog-title {
  margin: 0 0 6px 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.confirm-dialog-desc {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn-confirm-cancel {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-confirm-cancel:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-confirm-ok {
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-confirm-ok.btn-confirm-danger {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

.btn-confirm-ok.btn-confirm-danger:hover {
  background: linear-gradient(135deg, #F87171, #EF4444);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.5);
}

.btn-confirm-ok.btn-confirm-primary {
  background: linear-gradient(135deg, var(--accent-primary), #4F46E5);
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.btn-confirm-ok.btn-confirm-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.5);
}

/* Light theme support */
body.light-theme .confirm-modal-card {
  background: #FFFFFF;
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.16);
}

body.light-theme .btn-confirm-cancel {
  background: #F1F5F9;
  border-color: #CBD5E1;
  color: #475569;
}

body.light-theme .btn-confirm-cancel:hover {
  background: #E2E8F0;
  color: #0F172A;
}

