/* ================================================================
   INKRAFT — Premium Redesign (Linear · Vercel · Perplexity)
   Complete production stylesheet — inkraft.io
   ================================================================ */

/* ── 1. GOOGLE FONTS ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── 2. DESIGN TOKENS ────────────────────────────────────────── */
:root {
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --accent-green: #10B981;
  --accent-amber: #F59E0B;
  --accent-red: #EF4444;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

[data-theme="v1"] {
  --bg-page: #0A0A14;
  --bg-card: #111128;
  --bg-surface: #16162E;
  --bg-hover: rgba(255,255,255,0.04);
  --bg-active: rgba(124,111,247,0.12);
  --text-primary: #F0EFFF;
  --text-secondary: #9B99C4;
  --text-tertiary: #5C5A7A;
  --text-muted: #5C5A7A;
  --border: rgba(255,255,255,0.07);
  --border-hover: rgba(124,111,247,0.4);
  --accent: #7C6FF7;
  --accent-dim: rgba(124,111,247,0.15);
  --accent-glow: 0 0 24px rgba(124,111,247,0.3);
  --shadow-card: 0 1px 1px rgba(0,0,0,0.4), 0 8px 32px rgba(0,0,0,0.4);
  --shadow-elevated: 0 0 0 1px rgba(255,255,255,0.05), 0 24px 64px rgba(0,0,0,0.6);
}

[data-theme="v2"] {
  --bg-page: #F7F6F3;
  --bg-card: #FFFFFF;
  --bg-surface: #F2F1EE;
  --bg-hover: rgba(0,0,0,0.03);
  --bg-active: rgba(124,111,247,0.06);
  --text-primary: #0D0C1A;
  --text-secondary: #5C5A6E;
  --text-tertiary: #9896AA;
  --text-muted: #9896AA;
  --border: rgba(0,0,0,0.07);
  --border-hover: rgba(124,111,247,0.4);
  --accent: #6B4EFF;
  --accent-dim: rgba(107,78,255,0.08);
  --accent-glow: 0 0 24px rgba(107,78,255,0.15);
  --shadow-card: 0 1px 2px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.06);
  --shadow-elevated: 0 2px 4px rgba(0,0,0,0.04), 0 12px 40px rgba(0,0,0,0.1);
}

/* ── 3. RESET & BASE ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.3s ease, color 0.3s ease;
  position: relative;
}

[data-theme="v1"] body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.12;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: var(--font); }
input, select, textarea { font-family: var(--font); }

/* ── 4. LAYOUT ───────────────────────────────────────────────── */
#app-main { flex: 1; padding: 0 24px; width: 100%; max-width: 100%; }

/* ── 5. HEADER ───────────────────────────────────────────────── */
.v2-top-bar { display: none; }
[data-theme="v2"] .v2-top-bar {
  display: block; height: 2px;
  background: linear-gradient(90deg, var(--accent), #A78BFA, var(--accent));
}

.app-header {
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s;
}
[data-theme="v1"] .app-header { background: rgba(10,10,20,0.75); }
[data-theme="v2"] .app-header { background: rgba(247,246,243,0.75); }

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

.header-center { display: flex; align-items: center; gap: 10px; }
.header-logo {
  font-size: 17px; font-weight: 700; color: var(--text-primary);
  letter-spacing: -0.03em; display: flex; align-items: center; gap: 4px;
}
.header-logo::first-letter { color: var(--accent); }
.header-tagline {
  font-size: 10px; font-weight: 600; color: var(--text-tertiary);
  letter-spacing: 0.12em; text-transform: uppercase;
}

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

.settings-btn, .history-btn {
  height: 32px; padding: 0 12px; border-radius: var(--radius-sm);
  background: transparent; border: none; color: var(--text-secondary);
  font-size: 13px; font-weight: 500; cursor: pointer;
  display: flex; align-items: center; gap: 6px; transition: all 0.2s;
  position: relative;
}
.settings-btn:hover, .history-btn:hover {
  background: var(--bg-hover); color: var(--text-primary);
}
.settings-btn-icon, .history-btn-icon { font-size: 15px; display: flex; align-items: center; }
.settings-btn-label, .history-btn-label { font-size: 13px; font-weight: 500; }

.api-key-status-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent-green);
  position: absolute; top: 6px; right: 6px;
}
.api-key-status-dot.hidden { display: none; }

.version-toggle {
  display: flex; background: var(--bg-surface); padding: 2px;
  border-radius: 16px; border: 1px solid var(--border);
}
.v-btn {
  height: 24px; padding: 0 12px; border-radius: 12px; border: none;
  background: transparent; color: var(--text-tertiary);
  font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.v-btn.active {
  background: var(--accent); color: white;
  box-shadow: 0 2px 8px var(--accent-dim);
}

/* ── 6. READING PROGRESS BAR ────────────────────────────────── */
.reading-progress-bar {
  position: fixed; top: 0; left: 0; width: 100%; height: 2px;
  z-index: 9999; pointer-events: none; background: transparent;
}
.reading-progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), #A78BFA);
  box-shadow: 0 0 6px rgba(124,111,247,0.5);
  transition: width 0.1s linear;
}

/* ── 7. HERO SECTION ─────────────────────────────────────────── */
.hero-section {
  max-width: 640px; margin: 0 auto;
  text-align: center;
  padding: 64px 0 48px;
  animation: fadeInUp 0.6s ease both;
}
.hero-section.hidden { display: none; }

.hero-badge {
  display: inline-flex; align-items: center;
  padding: 6px 14px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
  margin-bottom: 24px; color: var(--accent);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  position: relative; overflow: hidden;
}
.hero-badge::before {
  content: ''; position: absolute; inset: -1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  background-size: 200% 100%;
  animation: shimmerBorder 3s infinite linear;
  z-index: -1; opacity: 0.25; border-radius: 20px;
}

.hero-title {
  font-size: clamp(32px, 6vw, 52px);
  font-weight: 800; letter-spacing: -0.03em; line-height: 1.1;
  color: var(--text-primary); margin-bottom: 20px;
}
.hero-title-accent {
  background: linear-gradient(135deg, #7C6FF7, #A78BFA, #C4B5FD);
  background-size: 300% 300%;
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  animation: gradient-shift 4s ease infinite;
}

.hero-subtitle {
  font-size: 16px; line-height: 1.7; color: var(--text-secondary);
  max-width: 460px; margin: 0 auto 32px;
}

.hero-stats {
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 32px; animation: fadeInUp 0.6s ease both; animation-delay: 0.1s;
}
.hero-stat {
  display: flex; flex-direction: column; align-items: center; padding: 0 32px;
}
.hero-stat-number {
  font-size: 28px; font-weight: 800; color: var(--accent);
  line-height: 1; margin-bottom: 4px;
}
.hero-stat-label {
  font-size: 11px; color: var(--text-tertiary); font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.hero-stat-divider { width: 1px; height: 32px; background: var(--border); }

.hero-features {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 8px; margin-bottom: 32px;
  animation: fadeInUp 0.6s ease both; animation-delay: 0.2s;
}
.hero-feature {
  font-size: 12px; font-weight: 500; padding: 6px 14px; border-radius: 20px;
  background: var(--bg-surface); border: 1px solid var(--border);
  color: var(--text-secondary); transition: all 0.2s;
}
.hero-feature:hover {
  border-color: var(--accent); color: var(--accent);
  background: var(--accent-dim); transform: translateY(-1px);
}

.hero-dismiss {
  font-size: 14px; font-weight: 500; color: var(--text-tertiary);
  background: transparent; border: none; cursor: pointer;
  padding: 10px 20px; border-radius: var(--radius-sm);
  transition: all 0.2s; display: inline-flex; align-items: center; gap: 6px;
  animation: fadeInUp 0.6s ease both; animation-delay: 0.3s;
}
.hero-dismiss:hover { color: var(--text-primary); background: var(--bg-hover); }

/* ── 8. MAIN APP CARD ────────────────────────────────────────── */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.3s ease;
}
[data-theme="v1"] .glass-card {
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255,255,255,0.06);
}
.glass-card:hover { box-shadow: var(--shadow-elevated); }

#input-section {
  max-width: 720px; margin: 0 auto 40px; padding: 28px; position: relative;
}

.input-primary { display: flex; flex-direction: column; gap: 8px; }
.input-primary label {
  font-size: 12px; font-weight: 600; color: var(--text-secondary);
  letter-spacing: 0.02em;
}

/* ── 9. FORM ELEMENTS ────────────────────────────────────────── */
#keyword-input {
  width: 100%; height: 52px; padding: 0 20px;
  font-size: 15px; font-family: var(--font); color: var(--text-primary);
  background: var(--bg-surface);
  border: 1.5px solid var(--border); border-radius: var(--radius-md);
  transition: all 0.2s ease;
}
[data-theme="v1"] #keyword-input { background: rgba(255,255,255,0.04); }
#keyword-input::placeholder { color: var(--text-tertiary); }
#keyword-input:focus {
  background: var(--bg-card); border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim); outline: none;
}

select, .option-field select {
  width: 100%; height: 44px; padding: 0 14px;
  font-size: 14px; font-family: var(--font); color: var(--text-primary);
  background: var(--bg-surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); appearance: none; transition: all 0.2s;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%239896AA' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  padding-right: 36px; cursor: pointer;
}
[data-theme="v1"] select { background-color: rgba(255,255,255,0.04); }
select:focus {
  background-color: var(--bg-card); border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim); outline: none;
}
select option { background: var(--bg-card); color: var(--text-primary); }

.option-field input[type="text"] {
  width: 100%; height: 44px; padding: 0 14px;
  font-size: 14px; font-family: var(--font); color: var(--text-primary);
  background: var(--bg-surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); transition: all 0.2s;
}
[data-theme="v1"] .option-field input[type="text"] { background: rgba(255,255,255,0.04); }
.option-field input[type="text"]::placeholder { color: var(--text-tertiary); }
.option-field input[type="text"]:focus {
  background: var(--bg-card); border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim); outline: none;
}

.option-field { display: flex; flex-direction: column; gap: 6px; }
.option-field label {
  font-size: 12px; font-weight: 600; color: var(--text-secondary);
}

.wordcount-helper {
  font-size: 11px; color: var(--text-tertiary); margin-top: 4px;
}

/* Toggle & Advanced Options */
.toggle-row { margin-top: 12px; }
.toggle-btn {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 500; color: var(--text-tertiary);
  background: none; border: none; cursor: pointer; transition: color 0.2s;
  padding: 4px 0;
}
.toggle-btn:hover { color: var(--text-primary); }
.toggle-icon {
  display: inline-block; transition: transform 0.3s ease; font-size: 14px;
}
.toggle-btn.open .toggle-icon { transform: rotate(180deg); }
.options-panel { max-height: 0; overflow: hidden; transition: max-height 0.4s cubic-bezier(0.4,0,0.2,1), opacity 0.3s; opacity: 0; }
.options-panel.collapsed { max-height: 0; opacity: 0; }
.options-panel:not(.collapsed) { max-height: 1200px; opacity: 1; padding-top: 16px; }
.options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }

.options-summary { font-size: 12px; color: var(--text-tertiary); margin-bottom: 16px; }
.options-summary strong { color: var(--text-secondary); font-weight: 500; }

.reset-settings-link { font-size: 12px; color: var(--text-tertiary); }

/* ── 10. STYLE CARDS ─────────────────────────────────────────── */
.image-style-section { margin-top: 24px; }
.image-style-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-tertiary);
  display: block; margin-bottom: 4px;
}
.image-style-subtitle {
  font-size: 12px; color: var(--text-tertiary); margin-bottom: 16px;
}
.image-style-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.style-card {
  position: relative; text-align: center; background: var(--bg-card);
  border: 1.5px solid var(--border); border-radius: var(--radius-md);
  padding: 16px 12px; cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.2, 0.64, 1);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.style-card:hover {
  border-color: var(--accent); transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 24px var(--accent-dim);
}
.style-card.selected {
  border-color: var(--accent); border-width: 2px;
  background: var(--accent-dim);
}
.style-check {
  position: absolute; top: 8px; right: 8px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
  opacity: 0; transform: scale(0.5); transition: all 0.2s;
}
.style-card.selected .style-check { opacity: 1; transform: scale(1); }

.style-icon { display: flex; align-items: center; justify-content: center; color: var(--accent); transition: color 0.2s; }
.style-icon svg { width: 28px; height: 28px; }
.style-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.style-desc { font-size: 11px; color: var(--text-tertiary); }

/* ── 11. GENERATE BUTTON ─────────────────────────────────────── */
.generate-row {
  display: flex; align-items: center; justify-content: center;
  gap: 16px; margin-top: 8px;
}
.primary-btn {
  height: 52px; padding: 0 32px; border-radius: var(--radius-md); border: none;
  background: linear-gradient(135deg, #7C6FF7 0%, #9B6FF7 50%, #7C6FF7 100%);
  background-size: 200% 200%; color: white;
  font-size: 15px; font-weight: 600; letter-spacing: -0.01em;
  font-family: var(--font);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(124,111,247,0.3);
}
.primary-btn:hover:not(:disabled) {
  background-position: right center; transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(124,111,247,0.4);
}
.primary-btn:active:not(:disabled) {
  transform: translateY(0); box-shadow: 0 2px 8px rgba(124,111,247,0.3);
}
.primary-btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }
.primary-btn.loading { animation: shimmer 2s infinite linear; }

.btn-icon { filter: drop-shadow(0 0 4px rgba(255,255,255,0.5)); transition: all 0.2s; }
.primary-btn:hover:not(:disabled) .btn-icon { transform: scale(1.1) rotate(5deg); filter: drop-shadow(0 0 8px rgba(255,255,255,0.8)); }
.btn-text { white-space: nowrap; }

.shortcut-hint {
  font-size: 12px; color: var(--text-tertiary); font-weight: 500;
  font-family: var(--font-mono);
}

.secondary-btn {
  padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-surface);
  color: var(--text-secondary); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 6px;
}
.secondary-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── 12. ONBOARDING & CHIPS ──────────────────────────────────── */
.onboarding-banner {
  max-width: 680px; margin: 0 auto 24px;
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; border-radius: var(--radius-md);
  font-size: 13px; line-height: 1.5;
  background: var(--accent-dim);
  border: 1px solid rgba(124,111,247,0.2);
  transition: opacity 0.3s, transform 0.3s;
}
[data-theme="v1"] .onboarding-banner { color: #C4BAFF; }
[data-theme="v2"] .onboarding-banner { color: #3C3489; }
.onboarding-banner.hidden { display: none; }
.onboarding-icon { font-size: 16px; margin-top: 1px; flex-shrink: 0; }
.onboarding-text { flex: 1; }
.onboarding-text strong { font-weight: 600; color: var(--text-primary); }
.onboarding-settings-link {
  background: none; border: none; color: var(--accent);
  font-size: 13px; font-weight: 500; cursor: pointer;
  padding: 0; margin-left: 4px; text-decoration: underline;
}
.onboarding-settings-link:hover { color: #5A3FDD; }
.onboarding-close {
  background: none; border: none; color: var(--text-tertiary);
  font-size: 13px; cursor: pointer; padding: 2px 4px; transition: color 0.15s;
}
.onboarding-close:hover { color: var(--text-primary); }

.example-chips {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 10px; max-width: 640px; margin: 0 auto;
}
.chip {
  padding: 8px 16px; border-radius: 20px;
  font-size: 13px; font-weight: 500;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-secondary); cursor: pointer; transition: all 0.2s;
}
.chip:hover {
  border-color: var(--accent); color: var(--accent);
  background: var(--accent-dim); transform: translateY(-1px);
}

/* ── 13. LOADING STATES ──────────────────────────────────────── */
#loading-section {
  max-width: 680px; margin: 0 auto 40px; padding: 32px;
  text-align: center; background: var(--bg-card);
}

.loader-container { padding: 8px 0; }
.loader-desktop { display: block; }
.loader-mobile { display: none; }

.loader-steps {
  display: flex; flex-direction: column; gap: 16px;
  margin-bottom: 32px; text-align: left;
  max-width: 320px; margin-left: auto; margin-right: auto;
}
.loader-step {
  display: flex; align-items: center; gap: 12px;
  opacity: 0.4; transition: opacity 0.3s;
}
.loader-step.active { opacity: 1; }
.step-indicator {
  display: flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  border: 1.5px solid var(--text-tertiary); position: relative;
  flex-shrink: 0;
}
.loader-step.active .step-indicator {
  border-color: var(--accent); box-shadow: 0 0 8px var(--accent-dim);
}
.step-dot {
  display: none; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
}
.loader-step.active .step-dot { display: block; animation: pulse 1s infinite alternate; }
.step-number { font-size: 11px; font-weight: 600; color: var(--text-tertiary); }
.loader-step.active .step-number { display: none; }
.step-label { font-size: 14px; font-weight: 500; color: var(--text-secondary); }
.loader-step.active .step-label { color: var(--text-primary); }

.progress-bar {
  height: 3px; border-radius: 2px; background: var(--border);
  overflow: hidden; margin-bottom: 12px;
}
.progress-fill {
  height: 100%; width: 0%; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), #A78BFA);
  transition: width 0.3s ease;
  box-shadow: 0 0 8px rgba(124,111,247,0.5);
}
.progress-bar-mobile { margin-bottom: 16px; }
.loading-percent { font-size: 13px; color: var(--text-tertiary); font-weight: 600; }
.loading-status-mobile { font-size: 14px; font-weight: 500; color: var(--text-primary); margin-bottom: 4px; }
.loading-time-hint { font-size: 12px; color: var(--text-tertiary); }

.skeleton-loader {
  margin-top: 32px; display: flex; flex-direction: column; gap: 12px;
}
.skeleton-line {
  height: 16px; border-radius: 8px; background: var(--border);
  animation: skeleton 1.5s infinite ease-in-out;
}

/* ── 14. ERROR SECTION ───────────────────────────────────────── */
#error-section {
  max-width: 680px; margin: 0 auto 40px; padding: 32px;
  text-align: center; background: var(--bg-card);
}
.error-container { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.error-icon { font-size: 36px; }
#error-message { font-size: 14px; color: var(--text-secondary); line-height: 1.6; max-width: 400px; }
.error-actions { display: flex; gap: 12px; margin-top: 8px; }
.retry-btn { height: 44px; }

/* ── 15. OUTPUT SECTION & TABS ───────────────────────────────── */
#output-section {
  max-width: 800px; margin: 0 auto 60px;
  animation: fadeInUp 0.5s ease both;
}

.tabs-header {
  border-bottom: 1px solid var(--border); margin-bottom: 24px;
}
.tabs-nav {
  display: flex; gap: 4px; padding: 0; overflow-x: auto;
  scrollbar-width: none; -ms-overflow-style: none;
}
.tabs-nav::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 10px 16px; background: none; border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-tertiary); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.2s; white-space: nowrap;
  font-family: var(--font);
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.dot-indicator {
  display: inline-block; width: 4px; height: 4px; border-radius: 50%;
  background: var(--accent); margin-left: 6px; vertical-align: middle;
}

.tab-panel { display: none; animation: fadeIn 0.3s ease; padding: 24px; }
.tab-panel.active { display: block; }
.tab-panel.glass-card { margin-bottom: 0; }

.tab-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.tab-toolbar h2 { font-size: 16px; font-weight: 700; color: var(--text-primary); margin: 0; }
.toolbar-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar-badges { gap: 6px; }
.toolbar-actions { gap: 6px; }

.copy-btn {
  padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 600;
  border: 1px solid var(--border); background: transparent;
  color: var(--text-tertiary); cursor: pointer; transition: all 0.2s;
  white-space: nowrap; font-family: var(--font);
}
.copy-btn:hover { background: var(--bg-surface); color: var(--accent); border-color: var(--accent); }
.copy-btn.copied { background: var(--accent-dim); color: var(--accent); border-color: transparent; }

.change-style-link {
  font-size: 12px; font-weight: 500; color: var(--accent);
  text-decoration: none; transition: opacity 0.2s;
}
.change-style-link:hover { opacity: 0.8; text-decoration: underline; }

/* Badges */
.reading-badge, .word-badge, .quality-badge {
  padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
  display: inline-flex; align-items: center;
}
.word-badge { background: var(--accent-dim); color: var(--accent); }
.reading-badge { background: var(--bg-surface); color: var(--text-secondary); border: 1px solid var(--border); }
.quality-badge { border: 1px solid; }
.quality-badge.badge-good, .quality-badge[style*="green"] { background: rgba(16,185,129,0.1); color: var(--accent-green); border-color: rgba(16,185,129,0.2); }
.quality-badge.badge-warn { background: rgba(245,158,11,0.1); color: var(--accent-amber); border-color: rgba(245,158,11,0.2); }
.quality-badge.badge-bad { background: rgba(239,68,68,0.1); color: var(--accent-red); border-color: rgba(239,68,68,0.2); }
.badge-neutral { background: var(--accent-dim); color: var(--accent); }
.markdown-body ul li p, .markdown-body ol li p { margin-bottom: 0px; }

/* ── 15a. STREAMING CURSOR ────────────────────────────────────── */
.streaming-cursor::after {
  content: "▋"; display: inline-block;
  animation: pulse 1s infinite steps(2, start);
  color: var(--accent); margin-left: 4px;
}
.regen-bar {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  background: var(--accent-dim); border: 1px solid rgba(124,111,247,0.2);
  border-radius: var(--radius-md); flex-wrap: wrap; margin-top: 12px;
}
.regen-bar.hidden { display: none; }
.regen-divider { width: 1px; height: 20px; background: rgba(124,111,247,0.2); }

.regen-btn {
  padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 500;
  border: 1px solid rgba(124,111,247,0.25); color: var(--accent);
  background: transparent; cursor: pointer; transition: all 0.2s;
  white-space: nowrap; font-family: var(--font);
}
.regen-btn:hover { background: var(--accent); color: white; transform: translateY(-1px); }
.regen-all { background: var(--accent); color: white; border-color: var(--accent); }
.regen-all:hover { filter: brightness(1.1); }

/* ── 17. ARTICLE CONTENT TYPOGRAPHY ──────────────────────────── */
.markdown-body, .article-body { max-width: 680px; margin: 0 auto; color: var(--text-secondary); }
.tab-content { color: var(--text-secondary); }

.markdown-body h1, .article-body h1 {
  font-size: 28px; font-weight: 800; letter-spacing: -0.02em;
  line-height: 1.2; margin-bottom: 16px; color: var(--text-primary);
}
.markdown-body h2, .article-body h2 {
  font-size: 21px; font-weight: 700; letter-spacing: -0.01em;
  margin-top: 40px; margin-bottom: 12px; color: var(--text-primary);
  border-left: 3px solid var(--accent); padding-left: 14px;
}
.markdown-body h3, .article-body h3 {
  font-size: 17px; font-weight: 600;
  margin-top: 28px; margin-bottom: 10px; color: var(--text-primary);
}
.markdown-body p, .article-body p {
  font-size: 15px; line-height: 1.8; margin-bottom: 16px;
}
.markdown-body strong, .markdown-body b, .article-body strong, .article-body b {
  font-weight: 600; color: var(--text-primary);
}
.markdown-body ul, .markdown-body ol, .article-body ul, .article-body ol {
  margin-bottom: 16px; padding-left: 24px;
}
.markdown-body li, .article-body li {
  font-size: 15px; line-height: 1.8; margin-bottom: 8px;
}
.markdown-body li::marker, .article-body li::marker { color: var(--accent); }

.markdown-body a, .article-body a {
  color: var(--accent); text-decoration: underline;
  text-underline-offset: 2px;
}

.markdown-body blockquote, .article-body blockquote {
  border-left: 3px solid var(--accent); background: var(--accent-dim);
  padding: 16px 20px; margin: 24px 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: normal; font-size: 15px; color: var(--text-primary);
}

.markdown-body table, .article-body table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  margin: 24px 0; border-radius: var(--radius-md);
  overflow: hidden; border: 1px solid var(--border);
}
.markdown-body th, .article-body th {
  background: var(--accent-dim); color: var(--accent);
  font-size: 12px; font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase; padding: 10px 16px; text-align: left;
}
.markdown-body td, .article-body td {
  padding: 10px 16px; border-top: 1px solid var(--border); font-size: 14px;
}
[data-theme="v2"] .markdown-body tr:nth-child(even) td,
[data-theme="v2"] .article-body tr:nth-child(even) td { background: #FAFAFA; }
[data-theme="v1"] .markdown-body tr:nth-child(even) td,
[data-theme="v1"] .article-body tr:nth-child(even) td { background: rgba(255,255,255,0.02); }

/* ── 18. CALLOUT BOXES ───────────────────────────────────────── */
.callout-tip, .callout-warn, .callout-win {
  padding: 14px 18px; margin: 24px 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 14px; line-height: 1.6;
}
.callout-tip { background: rgba(124,111,247,0.08); border-left: 3px solid var(--accent); }
.callout-warn { background: rgba(245,158,11,0.08); border-left: 3px solid var(--accent-amber); }
.callout-win { background: rgba(16,185,129,0.08); border-left: 3px solid var(--accent-green); }
.callout-icon { font-size: 16px; margin-right: 8px; }
.callout-tip strong { color: var(--accent); font-size: 13px; font-weight: 600; display: block; margin-bottom: 3px; }
.callout-warn strong { color: var(--accent-amber); font-size: 13px; font-weight: 600; display: block; margin-bottom: 3px; }
.callout-win strong { color: var(--accent-green); font-size: 13px; font-weight: 600; display: block; margin-bottom: 3px; }

/* ── 19. SEO METADATA FIELDS ─────────────────────────────────── */
.seo-meta-body { max-width: 680px; margin: 0 auto; }
.seo-field-group { padding: 16px 0; border-bottom: 1px solid var(--border); }
.seo-field-group:last-child { border-bottom: none; }
.seo-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-tertiary);
  display: block; margin-bottom: 8px;
}
.seo-editable, [contenteditable] {
  font-size: 14px; line-height: 1.6; padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent; background: transparent;
  transition: all 0.15s; color: var(--text-primary); display: block; width: 100%;
}
.seo-editable:hover, [contenteditable]:hover {
  background: var(--bg-surface); border-color: var(--border);
}
.seo-editable:focus, [contenteditable]:focus {
  background: var(--bg-card); border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim); outline: none;
}

.char-bar { height: 3px; border-radius: 2px; margin-top: 8px; width: 100%; max-width: 200px; background: var(--border); position: relative; overflow: hidden; }
.char-fill { height: 100%; position: absolute; left: 0; top: 0; border-radius: 2px; transition: width 0.3s, background-color 0.3s; }
.char-good { background: var(--accent-green); }
.char-warn { background: var(--accent-amber); }
.char-bad { background: var(--accent-red); }

/* ── 20. IMAGE PROMPT BOXES ──────────────────────────────────── */
.image-prompt-body { max-width: 680px; margin: 0 auto; }
.prompt-box { border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; margin-bottom: 20px; }
.prompt-header {
  padding: 10px 16px; font-size: 11px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
[data-theme="v1"] .prompt-header { background: rgba(124,111,247,0.12); color: #A78BFA; }
[data-theme="v2"] .prompt-header { background: rgba(107,78,255,0.06); color: #6B4EFF; }
.prompt-body {
  padding: 14px 16px; font-family: var(--font-mono);
  font-size: 12px; line-height: 1.7; color: var(--text-secondary);
  background: var(--bg-card); white-space: pre-wrap;
}

/* Image prompt empty state */
.image-prompt-empty { position: relative; border-radius: var(--radius-md); overflow: hidden; }
.empty-prompt-preview { display: flex; flex-direction: column; gap: 12px; filter: blur(2px); opacity: 0.5; }
.empty-prompt-card { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.empty-prompt-header { padding: 8px 14px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; background: var(--accent-dim); color: var(--accent); }
.empty-prompt-body { padding: 12px 14px; font-size: 12px; color: var(--text-tertiary); font-family: var(--font-mono); }
.empty-prompt-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
  background: rgba(0,0,0,0.1); backdrop-filter: blur(1px);
}
.empty-prompt-icon { font-size: 28px; }
.empty-prompt-overlay p { font-size: 13px; font-weight: 500; color: var(--text-secondary); }

/* Section wrappers & rewrite buttons */
.section-wrapper { position: relative; }
.heading-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.rewrite-btn {
  font-size: 11px; font-weight: 500; padding: 4px 10px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg-surface);
  color: var(--text-tertiary); opacity: 0; transition: all 0.15s;
  cursor: pointer; white-space: nowrap; margin-top: 40px;
  font-family: var(--font);
}
.section-wrapper:hover .rewrite-btn, .rewrite-btn:focus { opacity: 1; }
.rewrite-btn:hover { color: var(--accent); border-color: var(--accent); }

/* Output footer */
.output-footer { text-align: center; padding: 24px 0; }
.new-article-btn {
  padding: 10px 24px; border-radius: var(--radius-md);
  background: var(--bg-surface); border: 1px solid var(--border);
  color: var(--text-secondary); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all 0.2s; margin-bottom: 16px;
  font-family: var(--font);
}
.new-article-btn:hover { border-color: var(--accent); color: var(--accent); }
.output-watermark { font-size: 11px; color: var(--text-tertiary); }
.watermark-icon { color: var(--accent); }

/* ── 21. HISTORY SIDEBAR ─────────────────────────────────────── */
.history-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  z-index: 1000; opacity: 0; pointer-events: none;
  transition: opacity 0.3s; backdrop-filter: blur(4px);
}
.history-overlay.open { opacity: 1; pointer-events: auto; }

.history-sidebar {
  position: fixed; top: 0; right: 0; bottom: 0; width: 320px;
  background: var(--bg-card); border-left: 1px solid var(--border);
  z-index: 1001; transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  box-shadow: -8px 0 40px rgba(0,0,0,0.2);
  display: flex; flex-direction: column;
}
.history-sidebar.open { transform: translateX(0); }

.history-drag-handle { display: none; }
.drag-bar { display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--border); margin: 0 auto; }
.history-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.history-header h2 { font-size: 16px; font-weight: 600; margin: 0; }
.history-close-btn {
  background: none; border: none; font-size: 18px; color: var(--text-tertiary);
  cursor: pointer; transition: color 0.15s; padding: 4px;
}
.history-close-btn:hover { color: var(--text-primary); }

.history-search { padding: 12px 16px; }
.history-search input {
  width: 100%; height: 36px; padding: 0 12px; font-size: 13px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-family: var(--font); transition: all 0.2s;
}
.history-search input::placeholder { color: var(--text-tertiary); }
.history-search input:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); outline: none;
}

.history-list {
  padding: 8px 16px; overflow-y: auto; flex: 1;
  display: flex; flex-direction: column; gap: 4px;
}
.history-item {
  padding: 12px 16px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background 0.15s;
  text-align: left; background: transparent; width: 100%;
  border: none; font-family: var(--font);
}
.history-item:hover { background: var(--bg-hover); }
.hi-title {
  font-size: 13px; font-weight: 600; color: var(--text-primary);
  margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hi-kw, .hi-keyword {
  font-size: 11px; color: var(--text-tertiary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hi-meta { font-size: 11px; color: var(--text-tertiary); }
.history-empty {
  font-size: 13px; color: var(--text-tertiary);
  text-align: center; padding: 40px 0;
}

/* ── 22. SETTINGS MODAL ──────────────────────────────────────── */
.settings-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.35);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  z-index: 2000; opacity: 0; pointer-events: none; transition: opacity 0.3s;
  display: flex; align-items: center; justify-content: center;
}
.settings-overlay.open { opacity: 1; pointer-events: auto; }

.settings-modal {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  margin: auto;
  width: 90%; max-width: 600px; max-height: 90vh;
  height: fit-content;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-elevated);
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.175,0.885,0.32,1.275), opacity 0.3s;
  opacity: 0; pointer-events: none; z-index: 2001;
}
.settings-modal.open {
  transform: scale(1); opacity: 1; pointer-events: auto;
}

.settings-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.settings-header h2 { font-size: 18px; font-weight: 700; margin: 0; }
.settings-close-btn {
  background: none; border: none; font-size: 18px; color: var(--text-tertiary);
  cursor: pointer; transition: color 0.15s; padding: 4px;
}
.settings-close-btn:hover { color: var(--text-primary); }

.settings-body {
  padding: 24px; overflow-y: auto; flex: 1;
  display: flex; flex-direction: column; gap: 24px;
}
.settings-section {
  display: flex; flex-direction: column; gap: 16px;
  border-bottom: 1px solid var(--border); padding-bottom: 24px;
}
.settings-section:last-child { border-bottom: none; padding-bottom: 0; }
.settings-section h3 {
  font-size: 14px; font-weight: 600; color: var(--text-primary);
  display: flex; align-items: center; gap: 8px; margin: 0;
}
.section-icon { font-size: 16px; }
.settings-desc { font-size: 13px; color: var(--text-tertiary); line-height: 1.5; margin: 0; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.settings-field, .settings-field-full { display: flex; flex-direction: column; gap: 6px; }
.settings-field-full { grid-column: 1 / -1; }
.settings-field label, .settings-field-full label {
  font-size: 12px; font-weight: 500; color: var(--text-secondary);
}

.settings-body input[type="text"],
.settings-body input[type="password"],
.settings-body select {
  width: 100%; font-size: 14px; padding: 10px 14px;
  border-radius: var(--radius-sm); background: var(--bg-surface);
  border: 1.5px solid var(--border); color: var(--text-primary);
  font-family: var(--font); transition: all 0.2s;
}
.settings-body input:focus, .settings-body select:focus {
  background: var(--bg-card); border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim); outline: none;
}
.settings-body input::placeholder { color: var(--text-tertiary); }

.api-key-input-wrapper { display: flex; gap: 8px; }
.api-key-input-wrapper input { flex: 1; }
.vis-btn {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--bg-surface);
  cursor: pointer; font-size: 16px; transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.vis-btn:hover { border-color: var(--accent); }

.settings-help { font-size: 12px; color: var(--text-tertiary); }
.settings-help a { color: var(--accent); text-decoration: none; }
.settings-help a:hover { text-decoration: underline; }

.danger-zone {
  padding: 16px; border-radius: var(--radius-md);
  background: rgba(239,68,68,0.05); border: 1px solid rgba(239,68,68,0.15);
}
.danger-zone h3 { color: var(--accent-red); }
.data-actions { display: flex; gap: 12px; }
.danger-btn {
  padding: 8px 14px; border-radius: var(--radius-sm);
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3);
  color: var(--accent-red); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all 0.2s; font-family: var(--font);
}
.danger-btn:hover { background: rgba(239,68,68,0.2); }

.settings-footer {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 12px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  background: var(--bg-surface);
}
.settings-footer .primary-btn { height: 40px; padding: 0 20px; font-size: 14px; }

/* ── 23. TOAST NOTIFICATIONS ─────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 3000; display: flex; flex-direction: column;
  gap: 10px; align-items: center; pointer-events: none;
}
.toast {
  padding: 12px 20px; border-radius: var(--radius-xl);
  font-size: 13px; font-weight: 500;
  border: 1px solid var(--border); box-shadow: var(--shadow-elevated);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  animation: slideUp 0.3s cubic-bezier(0.175,0.885,0.32,1.275) forwards;
  pointer-events: auto;
}
[data-theme="v1"] .toast { background: rgba(22,22,46,0.95); color: #F0EFFF; }
[data-theme="v2"] .toast { background: rgba(255,255,255,0.95); color: #0D0C1A; }
.toast.toast-exit { animation: slideDown 0.3s ease-in forwards; }

/* ── 24. UTILITIES ───────────────────────────────────────────── */
.hidden { display: none !important; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ── 25. FOOTER ──────────────────────────────────────────────── */
#app-footer {
  text-align: center; padding: 24px 16px 32px;
  border-top: 1px solid var(--border); margin-top: auto;
}
#footer-text {
  font-size: 12px; color: var(--text-tertiary); font-weight: 500;
}

/* ── 26. KEYFRAME ANIMATIONS ─────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes gradient-shift { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
@keyframes shimmerBorder { 0% { background-position: 200% center; } 100% { background-position: -200% center; } }
@keyframes shimmer { 0% { background-position: 200% center; } 100% { background-position: -200% center; } }
@keyframes bounceDown { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(4px); } }
@keyframes pulse { 0% { transform: scale(0.8); opacity: 0.5; } 100% { transform: scale(1.2); opacity: 1; } }
@keyframes skeleton { 0%, 100% { opacity: 0.4; } 50% { opacity: 0.8; } }
@keyframes slideUp { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes slideDown { from { transform: translateY(0); opacity: 1; } to { transform: translateY(16px); opacity: 0; } }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.spinner {
  width: 20px; height: 20px; border: 2px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── 27. RESPONSIVE BREAKPOINTS ──────────────────────────────── */
@media (max-width: 1024px) {
  #input-section { padding: 24px; }
  .options-grid { gap: 16px; }
}

@media (max-width: 768px) {
  .image-style-grid { grid-template-columns: repeat(3, 1fr); }
  .hero-title { font-size: clamp(28px, 7vw, 40px); }
  .hero-stats { gap: 16px; }
  .hero-stat { padding: 0 16px; }
  #input-section { padding: 20px; }
  .settings-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .app-header { padding: 0 16px; }
  .header-tagline { display: none; }
  .settings-btn-label, .history-btn-label { display: none; }

  .hero-section { padding: 40px 16px 32px; }
  .hero-title { font-size: clamp(26px, 7vw, 32px); }
  .hero-stats { flex-wrap: wrap; justify-content: space-around; }
  .hero-stat { padding: 12px; }
  .hero-stat-number { font-size: 24px; }
  .hero-stat-divider { display: none; }

  #app-main { padding: 0 16px; }
  #input-section { padding: 16px; border-radius: var(--radius-lg); }
  .options-grid { grid-template-columns: 1fr; gap: 12px; }
  .image-style-grid { grid-template-columns: repeat(2, 1fr); }

  .tabs-nav { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .shortcut-hint { display: none; }
  .generate-row { flex-direction: column; }
  .primary-btn { width: 100%; }

  .toolbar-right { flex-wrap: wrap; }
  .toolbar-actions { flex-wrap: wrap; }

  /* Mobile Bottom Sheet */
  .history-sidebar {
    top: auto; right: 0; left: 0; bottom: 0; width: 100%;
    height: auto; max-height: 75vh;
    border-left: none; border-top: 1px solid var(--border);
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
  }
  .history-sidebar.open { transform: translateY(0); }
  .history-drag-handle {
    display: flex; justify-content: center; padding: 12px 0 0;
  }
  .history-header { padding: 12px 20px 16px; }

  /* Mobile Settings Modal */
  .settings-modal {
    width: 100%; height: 100dvh; max-height: none; max-width: none;
    border-radius: 0; top: 0; left: 0; right: 0; bottom: 0;
    margin: 0;
    transform: translateY(100%); opacity: 1;
    transition: transform 0.4s cubic-bezier(0.32,0.72,0,1);
  }
  .settings-modal.open { transform: translateY(0); }
  .settings-grid { grid-template-columns: 1fr; gap: 12px; }
  .settings-footer { border-radius: 0; }
  .data-actions { flex-direction: column; }

  .loader-desktop { display: none; }
  .loader-mobile { display: block; }
}
