/* 企飞智能生图大师 · AI 视觉创作台 Professional Studio Stylesheet v7 */
:root {
  --bg-dark: #070a0f;
  --bg-card: rgba(15, 21, 33, 0.82);
  --bg-card-hover: rgba(22, 30, 46, 0.9);
  --bg-input: rgba(10, 14, 22, 0.95);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(124, 58, 237, 0.6);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --primary: #8b5cf6;
  --primary-glow: rgba(139, 92, 246, 0.35);
  --primary-gradient: linear-gradient(135deg, #7c3aed 0%, #4f46e5 50%, #06b6d4 100%);
  --accent-cyan: #06b6d4;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --radius-xl: 20px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --shadow-lg: 0 20px 40px -15px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 30px rgba(124, 58, 237, 0.25);
  --font-sans: 'Plus Jakarta Sans', 'Noto Sans SC', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 10% 15%, rgba(124, 58, 237, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 90% 85%, rgba(6, 182, 212, 0.08) 0%, transparent 45%),
    linear-gradient(to bottom, #05070b, #090d14);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* =====================================================
   Top Navigation - Grand & Atmospheric Header
   ===================================================== */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 32px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: linear-gradient(180deg, rgba(12, 17, 29, 0.96) 0%, rgba(8, 12, 20, 0.92) 100%);
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.45);
}

.top-nav-left {
  flex: 1;
  display: flex;
}

.brand-logo-centered {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  position: relative;
}

/* Subtle ambient aura behind brand */
.brand-logo-centered::before {
  content: '';
  position: absolute;
  width: 140%;
  height: 140%;
  top: -20%;
  left: -20%;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.18) 0%, rgba(6, 182, 212, 0.08) 50%, transparent 75%);
  pointer-events: none;
  z-index: -1;
  filter: blur(16px);
}

.brand-logo-centered .logo-icon {
  width: 52px;
  height: 52px;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #9333ea 0%, #6366f1 50%, #06b6d4 100%);
  border-radius: 16px;
  box-shadow: 0 8px 28px rgba(147, 51, 234, 0.5), 0 0 16px rgba(6, 182, 212, 0.35);
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.brand-logo-centered .logo-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.brand-logo-centered .logo-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 60%, #93c5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.25;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.5));
}

.brand-logo-centered .logo-tag {
  font-size: 13px;
  color: #38bdf8;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 4px;
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.45);
}

.top-nav-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

/* =====================================================
   Main Studio Grid Layout (Desktop)
   ===================================================== */
.studio-container {
  display: grid;
  grid-template-columns: 440px 1fr;
  gap: 20px;
  padding: 20px 24px;
  max-width: 1720px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lg);
  transition: border-color 0.2s;
}

.panel-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: #e2e8f0;
}

.title-icon {
  font-size: 16px;
}

.subtitle-hint {
  font-size: 11px;
  color: var(--text-dim);
}

/* Buttons */
.btn-random-dice {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: #cbd5e1;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-random-dice:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--accent-cyan);
  border-color: rgba(6, 182, 212, 0.4);
  transform: translateY(-1px);
}

.btn-optimize-inline {
  display: flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(6, 182, 212, 0.2));
  border: 1px solid rgba(139, 92, 246, 0.5);
  color: #e0e7ff;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-optimize-inline:hover {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.4), rgba(6, 182, 212, 0.3));
  border-color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
  transform: translateY(-1px);
}

.btn-optimize-inline.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Prompt Input */
.prompt-input-wrapper {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  transition: all 0.2s;
}

.prompt-input-wrapper:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.2);
}

.prompt-textarea {
  width: 100%;
  min-height: 85px;
  background: transparent;
  border: none;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
}

.prompt-textarea::placeholder {
  color: var(--text-dim);
  font-size: 13px;
}

.prompt-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.meta-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.char-count {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.btn-text-revert {
  background: none;
  border: none;
  color: #a78bfa;
  font-size: 11px;
  cursor: pointer;
  text-decoration: underline;
  transition: color 0.2s;
}

.btn-text-revert:hover {
  color: #c4b5fd;
}

.btn-text-clear {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 11px;
  cursor: pointer;
  transition: color 0.2s;
}

.btn-text-clear:hover {
  color: #ef4444;
}

/* Optimization Drawer */
.opt-drawer {
  margin-top: 10px;
  background: rgba(124, 58, 237, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.opt-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 12px;
}

.opt-badge {
  font-weight: 700;
  color: var(--accent-cyan);
}

.opt-summary {
  font-size: 11px;
  color: var(--text-muted);
  flex: 1;
  margin: 0 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.opt-drawer-body {
  padding: 10px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.opt-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  font-size: 11px;
}

.opt-item {
  display: flex;
  gap: 6px;
  background: rgba(0, 0, 0, 0.25);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
}

.opt-k {
  color: var(--text-dim);
  white-space: nowrap;
}

.opt-v {
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Style Tags */
.style-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 86px;
  overflow-y: auto;
  padding-right: 2px;
}

.style-tag {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.style-tag:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

/* Ratio Selector */
.ratio-selector {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-bottom: 12px;
}

.ratio-card {
  flex: 1 1 0%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 6px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
}

.ratio-card input[type="radio"] {
  display: none;
}

.ratio-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.ratio-card.active {
  border-color: var(--primary);
  background: rgba(139, 92, 246, 0.15);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.2);
}

.ratio-icon-box {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}

.ratio-1-1 .ratio-box-inner {
  width: 22px;
  height: 22px;
  border: 2px solid #cbd5e1;
  border-radius: 3px;
}

.ratio-16-9 .ratio-box-inner {
  width: 26px;
  height: 15px;
  border: 2px solid #cbd5e1;
  border-radius: 3px;
}

.ratio-9-16 .ratio-box-inner {
  width: 15px;
  height: 26px;
  border: 2px solid #cbd5e1;
  border-radius: 3px;
}

.ratio-card.active .ratio-box-inner {
  border-color: var(--primary);
  background: rgba(139, 92, 246, 0.35);
}

.ratio-label {
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}

.ratio-res {
  font-size: 9px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* Model Row */
.model-row {
  width: 100%;
}

.model-buttons {
  display: flex;
  gap: 8px;
  width: 100%;
}

.model-btn {
  flex: 1 1 0%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.model-btn:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.model-btn.active {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.12);
}

.model-name {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

.model-tag {
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
}

.model-btn.active .model-tag {
  color: var(--accent-cyan);
}

/* Action Submit Card */
.action-submit-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-generate {
  width: 100%;
  height: 50px;
  background: var(--primary-gradient);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(124, 58, 237, 0.4);
  transition: all 0.3s;
}

.btn-generate:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(124, 58, 237, 0.6);
}

.btn-generate:active {
  transform: translateY(0);
}

.btn-generate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-gen-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.btn-gen-icon {
  font-size: 18px;
}

.shortcut-tip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
}

.shortcut-tip kbd {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* =====================================================
   Right Viewport Panel (Desktop & Unified Core)
   ===================================================== */
.viewport-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.viewport-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  min-height: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  padding: 24px;
  width: 100%;
}

/* 1. Empty State */
.state-empty-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  width: 100%;
}

.empty-sparkle-icon {
  font-size: 38px;
  margin-bottom: 12px;
  opacity: 0.85;
}

.empty-title-text {
  font-size: 16px;
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: 6px;
}

.empty-clean-text {
  font-size: 13px;
  color: var(--text-dim);
  max-width: 340px;
  line-height: 1.6;
}

/* 2. Loading State */
.state-loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  width: 100%;
}

.loading-ring-wrapper {
  position: relative;
  width: 76px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.loading-spinner {
  position: absolute;
  inset: 0;
  border: 3px solid rgba(139, 92, 246, 0.2);
  border-top-color: var(--accent-cyan);
  border-right-color: var(--primary);
  border-radius: 50%;
  animation: spinRing 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

@keyframes spinRing {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-pulse {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.25) 0%, transparent 70%);
  animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { transform: scale(0.9); opacity: 0.4; }
  50% { transform: scale(1.15); opacity: 0.8; }
}

.loading-center-icon {
  font-size: 24px;
}

.loading-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.loading-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.timer-badge {
  padding: 4px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

/* 3. Result State */
.state-result-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.result-image-wrapper {
  width: 100%;
  max-height: 60vh;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-image {
  width: 100%;
  height: auto;
  max-height: 60vh;
  object-fit: contain;
  display: block;
}

.result-actions-bar {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-bottom: 12px;
}

.res-action-btn {
  flex: 1 1 0%;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.res-action-btn.secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: #e2e8f0;
}

.res-action-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.res-action-btn.primary {
  background: var(--primary-gradient);
  border: none;
  color: #fff;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}

.res-action-btn.primary:hover {
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.6);
  transform: translateY(-1px);
}

.result-spec-chips {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.spec-divider {
  color: var(--border-subtle);
}

.spec-chip.highlight {
  color: var(--accent-green);
  font-weight: 600;
}

.prompt-readout-card {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: left;
}

.readout-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.readout-label {
  font-size: 11px;
  color: var(--text-dim);
}

.btn-copy-pill {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-copy-pill:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.readout-text {
  font-size: 12px;
  color: var(--text-main);
  line-height: 1.6;
}

/* History Panel */
.history-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.history-title {
  font-size: 13px;
  font-weight: 700;
  color: #e2e8f0;
}

.btn-link-sm {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 11px;
  cursor: pointer;
}

.btn-link-sm:hover {
  color: #ef4444;
}

.history-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.history-item {
  width: 70px;
  height: 70px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.2s;
}

.history-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.history-item:hover {
  border-color: var(--primary);
  transform: scale(1.05);
}

.history-item.active {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
}

/* Lightbox Modal */
.lightbox-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(10px);
}

.lightbox-container {
  position: relative;
  z-index: 1001;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-close {
  position: absolute;
  top: -40px;
  right: -10px;
  background: none;
  border: none;
  color: #fff;
  font-size: 36px;
  cursor: pointer;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 82vh;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9);
}

.lightbox-bottom-bar {
  margin-top: 14px;
}

.btn-modal-action {
  background: var(--primary-gradient);
  border: none;
  color: #fff;
  padding: 8px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.5);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--border-subtle);
  color: #fff;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  z-index: 2000;
  backdrop-filter: blur(10px);
  animation: toastFade 0.3s ease-out;
}

@keyframes toastFade {
  from { opacity: 0; transform: translate(-50%, 15px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* =====================================================
   MOBILE FIRST DEEP ADAPTATION (< 768px)
   ===================================================== */
@media (max-width: 768px) {
  html, body {
    width: 100vw !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .top-nav {
    padding: 18px 16px !important;
    gap: 12px !important;
  }

  .top-nav-left {
    display: none !important;
  }

  .brand-logo-centered {
    gap: 12px !important;
    text-align: left !important;
  }

  .brand-logo-centered .logo-icon {
    width: 44px !important;
    height: 44px !important;
    font-size: 24px !important;
    border-radius: 13px !important;
    box-shadow: 0 6px 20px rgba(147, 51, 234, 0.45) !important;
  }

  .brand-logo-centered .logo-title {
    font-size: 21px !important;
    font-weight: 800 !important;
    letter-spacing: 0.2px !important;
  }

  .brand-logo-centered .logo-tag {
    font-size: 11px !important;
    letter-spacing: 1.5px !important;
    margin-top: 3px !important;
  }

  /* Single Column Full Width Layout */
  .studio-container {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 10px 12px !important;
    margin: 0 !important;
    gap: 12px !important;
  }

  .control-panel, .viewport-panel {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
  }

  .panel-card, .viewport-card {
    width: 100% !important;
    max-width: 100% !important;
    padding: 12px 14px !important;
    border-radius: 12px !important;
  }

  .card-header {
    margin-bottom: 8px !important;
  }

  .card-title {
    font-size: 13px !important;
  }

  .prompt-textarea {
    font-size: 16px !important;
    min-height: 80px !important;
  }

  .style-tags-container {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 6px !important;
    padding-bottom: 4px !important;
  }

  .style-tag {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    padding: 6px 12px !important;
    font-size: 12px !important;
  }

  /* Equal 3-column ratio selector */
  .ratio-selector {
    display: flex !important;
    flex-direction: row !important;
    gap: 6px !important;
    width: 100% !important;
    margin-bottom: 10px !important;
  }

  .ratio-card {
    flex: 1 1 0% !important;
    min-width: 0 !important;
    padding: 8px 4px !important;
  }

  .ratio-icon-box {
    width: 22px !important;
    height: 22px !important;
    margin-bottom: 4px !important;
  }

  .ratio-1-1 .ratio-box-inner { width: 18px !important; height: 18px !important; }
  .ratio-16-9 .ratio-box-inner { width: 20px !important; height: 12px !important; }
  .ratio-9-16 .ratio-box-inner { width: 12px !important; height: 20px !important; }

  .ratio-label { font-size: 11px !important; }
  .ratio-res { font-size: 9px !important; }

  /* Equal 2-column model buttons */
  .model-buttons {
    display: flex !important;
    flex-direction: row !important;
    gap: 6px !important;
    width: 100% !important;
  }

  .model-btn {
    flex: 1 1 0% !important;
    min-width: 0 !important;
    padding: 8px 6px !important;
  }

  .model-name { font-size: 12px !important; }
  .model-tag { font-size: 10px !important; }

  /* Generate Button */
  .btn-generate {
    width: 100% !important;
    height: 48px !important;
    min-height: 48px !important;
    border-radius: 12px !important;
  }

  .btn-gen-content {
    font-size: 15px !important;
  }

  .shortcut-tip {
    display: none !important;
  }

  /* Viewport Card & States on Mobile */
  .viewport-card {
    min-height: 220px !important;
    padding: 14px !important;
  }

  .state-empty-box {
    padding: 24px 12px !important;
  }

  .empty-sparkle-icon {
    font-size: 32px !important;
  }

  .empty-title-text {
    font-size: 15px !important;
  }

  .empty-clean-text {
    font-size: 12px !important;
  }

  .state-loading-box {
    padding: 24px 12px !important;
  }

  .loading-title {
    font-size: 16px !important;
  }

  .result-image-wrapper {
    max-height: 55vh !important;
  }

  .result-image {
    max-height: 55vh !important;
  }

  .res-action-btn {
    height: 40px !important;
    font-size: 13px !important;
  }

  .lightbox-container {
    max-width: 95vw !important;
  }

  .lightbox-close {
    top: 10px !important;
    right: 10px !important;
    width: 36px !important;
    height: 36px !important;
    background: rgba(0, 0, 0, 0.6) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 26px !important;
    line-height: 1 !important;
  }

  .lightbox-img {
    max-height: 75vh !important;
  }
}

/* =====================================================
   ABSOLUTE HIGHEST SPECIFICITY HIDING RULE
   ===================================================== */
.hidden, [hidden] {
  display: none !important;
}


/* Hide optimization drawer completely */
.opt-drawer, #optimization-drawer { display: none !important; }


/* =====================================================
   Top Navigation & Top-right History Button
   ===================================================== */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(16px);
  background: rgba(7, 11, 18, 0.88);
}

.top-nav-left {
  flex: 1;
  display: flex;
}

.brand-logo-centered {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

.top-nav-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.btn-top-history {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9999px;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(8px);
}

.btn-top-history:hover {
  background: rgba(139, 92, 246, 0.22);
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 0 0 16px rgba(139, 92, 246, 0.3);
  transform: translateY(-1px);
}

.history-btn-icon {
  font-size: 15px;
}

.history-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 9999px;
  background: var(--primary-gradient);
  color: #fff;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.4);
}

/* =====================================================
   History Drawer / Modal
   ===================================================== */
.history-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  transition: opacity 0.25s ease;
}

.history-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 7, 18, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.history-drawer {
  position: relative;
  z-index: 10;
  width: 480px;
  max-width: 100vw;
  height: 100%;
  background: #0b0f19;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  box-shadow: -15px 0 40px rgba(0, 0, 0, 0.7);
  animation: drawerSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes drawerSlideIn {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

.history-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(15, 21, 33, 0.95);
}

.history-drawer-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
}

.history-drawer-title .count-pill {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.history-drawer-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-clear-history-pill {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-clear-history-pill:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: #ef4444;
}

.btn-close-drawer {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-close-drawer:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.history-drawer-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.history-card-item {
  display: flex;
  gap: 14px;
  padding: 12px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.history-card-item:hover {
  background: rgba(30, 41, 59, 0.75);
  border-color: rgba(139, 92, 246, 0.45);
  transform: translateY(-1px);
}

.history-card-thumb-wrap {
  width: 92px;
  height: 92px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
  cursor: pointer;
  position: relative;
}

.history-card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.history-card-item:hover .history-card-thumb {
  transform: scale(1.05);
}

.history-card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.history-card-prompt {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-main);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
}

.history-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.history-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-card-action {
  padding: 5px 11px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-card-action.primary {
  background: rgba(139, 92, 246, 0.25);
  border-color: rgba(139, 92, 246, 0.5);
  color: #c4b5fd;
}

.btn-card-action:hover {
  background: rgba(255, 255, 255, 0.16);
}

.btn-card-action.primary:hover {
  background: rgba(139, 92, 246, 0.45);
  color: #fff;
}

.drawer-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
  color: var(--text-dim);
}

.drawer-empty-state .empty-icon {
  font-size: 44px;
  margin-bottom: 12px;
  opacity: 0.65;
}

.drawer-empty-state h4 {
  font-size: 16px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.drawer-empty-state p {
  font-size: 13px;
}

@media (max-width: 768px) {
  .top-nav {
    padding: 18px 16px !important;
  }
  .top-nav-left {
    display: none !important;
  }
  .brand-logo-centered {
    gap: 12px !important;
  }
  .brand-logo-centered .logo-icon {
    width: 44px !important;
    height: 44px !important;
    font-size: 24px !important;
    border-radius: 13px !important;
  }
  .brand-logo-centered .logo-title {
    font-size: 21px !important;
  }
  .brand-logo-centered .logo-tag {
    font-size: 11px !important;
    margin-top: 3px !important;
  }
  .btn-top-history {
    padding: 8px 13px !important;
    font-size: 12px !important;
    gap: 5px !important;
  }
  .history-drawer {
    width: 100vw !important;
  }
}
