/* ============================================================
   NANO BANANA GOD MODE v2 — style.css
   Professional dark UI, Claude Desktop aesthetic
   ============================================================ */

/* ---- Design Tokens — Dark (default) ---- */
:root {
  --accent:     #6366f1;
  --accent-dim: rgba(99,102,241,.12);
  --accent-2:   #4f46e5;
  --bg:         #0c0c0d;
  --panel:      #141416;
  --panel2:     #1c1c1f;
  --panel3:     #252529;
  --input-bg:   #0e0e10;
  --border:     rgba(255,255,255,.07);
  --border2:    rgba(255,255,255,.12);
  --border3:    rgba(255,255,255,.20);
  --text:       #e4e4e7;
  --dim:        #c4c4c8;
  --muted:      #9ca3af;
  --r:          10px;
  --rs:         6px;
}

/* ---- Design Tokens — Light ---- */
body.light {
  --bg:         #f4f4f5;
  --panel:      #ffffff;
  --panel2:     #f4f4f5;
  --panel3:     #e4e4e7;
  --input-bg:   #fafafa;
  --border:     rgba(0,0,0,.08);
  --border2:    rgba(0,0,0,.14);
  --border3:    rgba(0,0,0,.22);
  --text:       #18181b;
  --dim:        #52525b;
  --muted:      #a1a1aa;
  --accent-dim: rgba(99,102,241,.10);
}

/* Theme toggle button */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--panel2);
  border: 1px solid var(--border2);
  border-radius: var(--rs);
  color: var(--dim);
  font-size: .72em;
  font-weight: 600;
  letter-spacing: .04em;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  font-family: inherit;
}

.theme-toggle:hover {
  background: var(--panel3);
  color: var(--text);
  border-color: var(--border3);
}

.theme-toggle svg { width: 13px; height: 13px; flex-shrink: 0; }

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

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: 140px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scrollbar-width: thin;
  scrollbar-color: var(--panel3) var(--bg);
}

body::-webkit-scrollbar { width: 6px; }
body::-webkit-scrollbar-track { background: var(--bg); }
body::-webkit-scrollbar-thumb { background: var(--panel3); border-radius: 3px; }
body::-webkit-scrollbar-thumb:hover { background: var(--muted); }

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

button { font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ============================================================
   2. LAYOUT
   ============================================================ */
.container {
  max-width: 1560px;
  margin: 0 auto;
  padding: 16px 20px;
}

.grid-wrapper {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 16px;
  align-items: start;
}

.main-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.sidebar {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

/* ============================================================
   3. HEADER
   ============================================================ */
header {
  padding: 20px 0 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

header h1 {
  font-size: 1.6em;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 4px;
}

.version-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: var(--panel3);
  border: 1px solid var(--border2);
  border-radius: 20px;
  font-size: .66em;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .04em;
  text-transform: uppercase;
  vertical-align: middle;
  margin-left: 8px;
  position: relative;
  top: -1px;
}

.subtitle {
  font-size: .78em;
  color: #c8cdd6;
  margin-top: 3px;
  letter-spacing: .01em;
}

/* ============================================================
   4. IMPORT & LIBRARY DOCKS
   ============================================================ */
.import-dock {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 14px;
}

.import-title {
  font-size: .68em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #c8cdd6;
  margin-bottom: 8px;
}

.import-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.input-import {
  flex: 1;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  color: var(--text);
  padding: 7px 10px;
  font-size: .8em;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  min-width: 0;
}

.input-import:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99,102,241,.15);
}

.btn-decode {
  flex-shrink: 0;
  background: var(--panel3);
  border: 1px solid var(--border2);
  border-radius: var(--rs);
  color: var(--dim);
  padding: 7px 12px;
  font-size: .78em;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}

.btn-decode:hover {
  background: var(--accent-dim);
  color: #a5b4fc;
  border-color: var(--accent);
}

.library-dock {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 14px;
}

.library-dock .import-row { gap: 6px; }

.preset-select {
  flex: 1;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  color: var(--text);
  padding: 7px 32px 7px 10px;
  font-size: .8em;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2352525b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  min-width: 0;
}

.preset-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99,102,241,.15);
}

.btn-load {
  flex-shrink: 0;
  background: var(--panel3);
  border: 1px solid var(--border2);
  border-radius: var(--rs);
  color: var(--dim);
  padding: 7px 14px;
  font-size: .78em;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: .03em;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-load:hover { background: var(--accent-dim); color: #a5b4fc; border-color: var(--accent); }
.btn-load:active { opacity: .85; }

.mode-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px 2px 6px;
  background: var(--panel3);
  border: 1px solid var(--border2);
  border-radius: 20px;
  font-size: .64em;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.mode-indicator::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}

.mode-indicator.active::before { background: #4ade80; }
.mode-indicator.active { color: #4ade80; border-color: rgba(74,222,128,.25); }

/* ============================================================
   5. MODULE CARDS
   ============================================================ */
.module {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: visible;
  transition: border-color .15s;
}

.module:hover { border-color: var(--border2); }

.module-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  font-size: .72em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--dim);
  border-bottom: 1px solid var(--border);
  user-select: none;
  transition: color .15s;
}

.module-header:hover { color: var(--text); }

.mod-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--panel3);
  border: 1px solid var(--border2);
  border-radius: 6px;
  color: var(--accent);
  flex-shrink: 0;
}

.mod-icon svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chevron {
  margin-left: auto;
  display: flex;
  align-items: center;
  color: var(--muted);
  transition: transform .2s ease;
  flex-shrink: 0;
}

.chevron svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.module.collapsed .chevron { transform: rotate(-90deg); }

.module-grid {
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  align-items: start;
}

.module.collapsed .module-grid { display: none; }
.module.collapsed .module-body { display: none; }
.module.collapsed .hero-section { display: none; }

/* Section color accents */
.sect-pink .module-header { border-left: 3px solid #ec4899; }
.sect-cyan .module-header  { border-left: 3px solid #22d3ee; }
.sect-gold .module-header  { border-left: 3px solid #f59e0b; }
.sect-pink .mod-icon { color: #ec4899; }
.sect-cyan .mod-icon { color: #22d3ee; }
.sect-gold .mod-icon { color: #f59e0b; }

/* ============================================================
   6. HERO SECTION
   ============================================================ */
.hero-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.hero-full-row { grid-column: 1 / -1; }

/* ============================================================
   7. FORM CONTROLS
   ============================================================ */
label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .68em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--dim);
  margin-bottom: 5px;
}

input[type="text"],
textarea,
select {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  color: var(--text);
  padding: 8px 10px;
  font-size: .83em;
  line-height: 1.4;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99,102,241,.15);
}

input[type="text"]::placeholder,
textarea::placeholder { color: var(--muted); }

select {
  cursor: pointer;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2352525b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

select option {
  background: var(--panel2);
  color: var(--text);
}

textarea {
  resize: vertical;
  min-height: 68px;
}

/* ============================================================
   8. FIELD GROUP & GUIDE BUTTON
   ============================================================ */
.field-group {
  display: flex;
  flex-direction: column;
}

.btn-guide {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 5px;
  padding: 5px 10px;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: var(--rs);
  color: var(--dim);
  font-size: .72em;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  align-self: flex-start;
  line-height: 1;
}

.btn-guide:hover {
  background: var(--accent-dim);
  color: #a5b4fc;
  border-color: var(--accent);
}

.btn-guide svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ============================================================
   9. OPT-INFO
   ============================================================ */
.opt-info {
  display: none;
  border-left: 2px solid var(--accent);
  background: var(--panel2);
  font-size: .74em;
  color: var(--dim);
  padding: 6px 9px;
  margin-top: 4px;
  border-radius: 0 var(--rs) var(--rs) 0;
  line-height: 1.45;
}

.opt-info.show { display: block; }

/* ============================================================
   10. TOOLTIP BADGE
   ============================================================ */
.tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: var(--panel3);
  border: 1px solid var(--border2);
  border-radius: 50%;
  font-size: .6em;
  font-weight: 700;
  color: var(--muted);
  cursor: help;
  transition: all .15s;
  flex-shrink: 0;
  line-height: 1;
  vertical-align: middle;
}

.tip:hover {
  background: var(--accent-dim);
  color: #a5b4fc;
  border-color: var(--accent);
}

/* ============================================================
   11. CHIP SYSTEM
   ============================================================ */
.multi-select-container {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.chips-controls {
  display: flex;
  gap: 5px;
  align-items: center;
}

.btn-add {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: var(--panel3);
  border: 1px solid var(--border2);
  border-radius: var(--rs);
  color: var(--dim);
  font-size: .72em;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}

.btn-add:hover {
  background: var(--accent-dim);
  color: #a5b4fc;
  border-color: var(--accent);
}

.btn-clear {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--rs);
  color: var(--muted);
  font-size: .72em;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}

.btn-clear:hover { color: #f87171; border-color: rgba(239,68,68,.3); }

.chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 28px;
  padding: 4px 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-dim);
  border: 1px solid rgba(99,102,241,.3);
  border-radius: 20px;
  font-size: .72em;
  color: #a5b4fc;
  padding: 3px 8px 3px 10px;
  font-weight: 500;
  white-space: nowrap;
}

.chip-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  background: rgba(99,102,241,.2);
  border: none;
  border-radius: 50%;
  color: #a5b4fc;
  font-size: .8em;
  cursor: pointer;
  transition: background .12s, color .12s;
  line-height: 1;
  flex-shrink: 0;
}

.chip-x:hover { background: rgba(248,113,113,.25); color: #f87171; }

.chips-ph {
  font-size: .74em;
  color: var(--muted);
  padding: 4px 2px;
  font-style: italic;
}

/* ============================================================
   12. ASPECT RATIO
   ============================================================ */
.param-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 14px;
}

.param-box-title {
  font-size: .68em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: 10px;
}

.ar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.ar-btn {
  background: var(--panel3);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  padding: 8px 4px;
  text-align: center;
  font-size: .68em;
  font-weight: 600;
  color: var(--dim);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  line-height: 1.3;
}

.ar-btn:hover { background: var(--panel2); border-color: var(--border2); color: var(--text); }

.ar-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: #a5b4fc;
}

/* ============================================================
   13. CHECKBOX WRAPPERS
   ============================================================ */
.check-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  cursor: pointer;
  margin-bottom: 5px;
  transition: border-color .15s, background .15s;
  font-size: .8em;
  color: var(--dim);
  user-select: none;
}

.check-wrapper:hover { border-color: var(--border2); background: var(--panel3); }

.check-wrapper input[type="checkbox"] {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.realism-check span { color: #4ade80; font-weight: 600; }
.ref-check span     { color: #60a5fa; font-weight: 600; }

/* ============================================================
   14. NEGATIVE PROMPT BUILDER
   ============================================================ */
.neg-builder-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.neg-check {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  background: var(--panel3);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  cursor: pointer;
  font-size: .72em;
  color: var(--dim);
  user-select: none;
  transition: border-color .15s, color .15s;
}

.neg-check:hover { border-color: rgba(248,113,113,.3); color: #f87171; }

.neg-check input[type="checkbox"] {
  accent-color: #f87171;
  flex-shrink: 0;
  width: 13px;
  height: 13px;
  cursor: pointer;
}

/* ============================================================
   15. SIDEBAR ACTIONS
   ============================================================ */
.sidebar-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px;
}

.sidebar-section-title {
  font-size: .65em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.sidebar-action {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  color: var(--dim);
  font-size: .76em;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  text-align: left;
  width: 100%;
  margin-bottom: 5px;
}

.sidebar-action:last-child { margin-bottom: 0; }
.sidebar-action:hover { background: var(--panel3); color: var(--text); border-color: var(--border2); }
.sidebar-action.danger:hover { color: #f87171; border-color: rgba(239,68,68,.3); background: rgba(239,68,68,.05); }

.sidebar-action svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ============================================================
   16. CUSTOM PRESET SAVING
   ============================================================ */
.preset-save-row {
  display: flex;
  gap: 5px;
  margin-top: 8px;
}

.preset-save-row input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  font-size: .78em;
}

.preset-save-btn {
  flex-shrink: 0;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--rs);
  padding: 6px 10px;
  font-size: .75em;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}

.preset-save-btn:hover { background: var(--accent-2); }

.custom-presets-list { margin-top: 8px; }

.custom-preset-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  margin-bottom: 4px;
  transition: border-color .15s;
}

.custom-preset-item:hover { border-color: var(--border2); }

.custom-preset-name {
  flex: 1;
  font-size: .75em;
  color: var(--dim);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: none;
  border: none;
  text-align: left;
  transition: color .15s;
}

.custom-preset-name:hover { color: var(--accent); }

.custom-preset-del {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  padding: 2px 4px;
  font-size: .8em;
  transition: color .15s;
  flex-shrink: 0;
}

.custom-preset-del:hover { color: #f87171; }

/* ============================================================
   17. SLIDERS
   ============================================================ */
.slider-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.slider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.slider-label {
  font-size: .68em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--dim);
}

.slider-value {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: .72em;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 1px 6px;
  border-radius: 4px;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  padding: 8px 0;
  background: var(--panel3);
  border-radius: 2px;
  outline: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--bg);
  cursor: pointer;
  transition: transform .15s, background .15s;
}

input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); background: var(--accent-2); }

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--bg);
  cursor: pointer;
  transition: transform .15s;
}

input[type="range"]::-moz-range-thumb:hover { transform: scale(1.2); }

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: var(--panel3);
}

/* ============================================================
   18. RADIO PILLS
   ============================================================ */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.radio-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  background: var(--panel3);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  cursor: pointer;
  font-size: .74em;
  font-weight: 500;
  color: var(--dim);
  transition: background .15s, border-color .15s, color .15s;
  user-select: none;
}

.radio-pill input { display: none; }

.radio-pill:hover { background: var(--panel2); border-color: var(--border2); color: var(--text); }

.radio-pill:has(input:checked) {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: #a5b4fc;
  font-weight: 600;
}

/* ============================================================
   19. TOGGLE SWITCH
   ============================================================ */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  position: absolute;
  inset: 0;
  cursor: pointer;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--panel3);
  border: 1px solid var(--border2);
  border-radius: 20px;
  transition: background .2s, border-color .2s;
}

.toggle-track::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  top: 2px;
  left: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s ease;
}

.toggle-switch input:checked ~ .toggle-track {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle-switch input:checked ~ .toggle-track::after {
  transform: translateX(16px);
}

.toggle-label {
  font-size: .78em;
  color: var(--dim);
  flex: 1;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

/* ============================================================
   20. MULTI-PROMPT
   ============================================================ */
.multiprompt-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 7px;
}

.multiprompt-row input[type="text"] { flex: 1; min-width: 0; }

.weight-select {
  width: 65px;
  flex-shrink: 0;
  padding: 8px 6px;
}

.multiprompt-preview {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  padding: 8px 10px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: .78em;
  color: #a5b4fc;
  min-height: 36px;
  word-break: break-all;
  margin-top: 4px;
  line-height: 1.5;
}

/* ============================================================
   21. STRENGTH METER
   ============================================================ */
.strength-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.strength-bar-track {
  width: 80px;
  height: 3px;
  background: var(--panel3);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}

.strength-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width .4s ease, background .4s ease;
}

.strength-label {
  font-size: .68em;
  font-weight: 600;
  color: var(--muted);
  min-width: 60px;
  transition: color .4s;
}

/* ============================================================
   22. OUTPUT DOCK
   ============================================================ */
.output-dock {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--panel);
  border-top: 1px solid var(--border2);
  padding: 10px 20px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 8px 12px;
  box-shadow: 0 -8px 32px rgba(0,0,0,.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.prompt-container {
  grid-column: 1;
  grid-row: 1 / 3;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.prompt-label {
  font-size: .68em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
}

.char-count {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-weight: 700;
  color: var(--accent);
}

.char-count.warn { color: #f87171; }

.final-text {
  width: 100%;
  min-height: 52px;
  max-height: 90px;
  resize: none;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: .8em;
  background: var(--input-bg);
  border: 1px solid var(--border2);
  border-radius: var(--rs);
  color: #c4d4ec;
  padding: 8px 10px;
  line-height: 1.5;
  transition: border-color .15s;
  outline: none;
}

.final-text:focus { border-color: var(--accent); }

.dock-right {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}

.dock-main-actions { display: flex; gap: 6px; }
.dock-secondary-actions { display: flex; gap: 5px; }

.btn-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: #fff;
  color: #111;
  border: none;
  border-radius: var(--rs);
  padding: 9px 18px;
  font-size: .8em;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
  transition: background .15s, opacity .15s;
  white-space: nowrap;
}

.btn-copy:hover { background: #e4e4e7; }
.btn-copy:active { opacity: .85; }

.btn-copy svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.btn-reset {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel3);
  color: var(--dim);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  padding: 9px 12px;
  font-size: .8em;
  font-weight: 600;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
  white-space: nowrap;
}

.btn-reset:hover { color: #f87171; border-color: rgba(239,68,68,.3); background: rgba(239,68,68,.05); }

.btn-reset svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.dock-icon-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: var(--panel2);
  color: var(--dim);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  padding: 6px 10px;
  font-size: .73em;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}

.dock-icon-btn:hover { background: var(--panel3); color: var(--text); border-color: var(--border2); }

.dock-icon-btn svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ============================================================
   23. UNDO / REDO
   ============================================================ */
.btn-undo,
.btn-redo {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--panel2);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  padding: 6px 10px;
  font-size: .73em;
  font-weight: 600;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s, opacity .15s;
  white-space: nowrap;
}

.btn-undo svg,
.btn-redo svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.btn-undo:not(:disabled):hover,
.btn-redo:not(:disabled):hover { color: var(--text); border-color: var(--border2); background: var(--panel3); }

.btn-undo:disabled,
.btn-redo:disabled { opacity: .35; cursor: default; }

/* ============================================================
   24. HISTORY MODAL
   ============================================================ */
.history-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 10001;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

.history-overlay.open {
  opacity: 1;
  pointer-events: all;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.history-panel {
  width: min(760px, 96vw);
  max-height: 65vh;
  background: var(--panel);
  border: 1px solid var(--border2);
  border-radius: var(--r) var(--r) 0 0;
  transform: translateY(40px);
  opacity: 0;
  transition: transform .25s cubic-bezier(.4,0,.2,1), opacity .25s cubic-bezier(.4,0,.2,1);
  display: flex;
  flex-direction: column;
  box-shadow: 0 -20px 60px rgba(0,0,0,.6);
  overflow: hidden;
}

.history-overlay.open .history-panel { transform: translateY(0); opacity: 1; }

.history-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.history-head h3 {
  font-size: .84em;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
}

.history-search {
  flex: 1;
  max-width: 240px;
  padding: 5px 10px;
  background: var(--input-bg);
  border: 1px solid var(--border2);
  border-radius: var(--rs);
  color: var(--text);
  font-size: .78em;
  outline: none;
  transition: border-color .15s;
  margin-left: auto;
}

.history-search:focus { border-color: var(--accent); }

.history-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  scrollbar-width: thin;
  scrollbar-color: var(--panel3) transparent;
}

.history-body::-webkit-scrollbar { width: 5px; }
.history-body::-webkit-scrollbar-track { background: transparent; }
.history-body::-webkit-scrollbar-thumb { background: var(--panel3); border-radius: 3px; }

.history-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.history-item:hover { border-color: var(--border2); background: var(--panel3); }

.history-meta {
  font-size: .65em;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
  padding-top: 1px;
  font-variant-numeric: tabular-nums;
}

.history-text {
  flex: 1;
  font-size: .78em;
  color: var(--dim);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  min-width: 0;
}

.history-load {
  flex-shrink: 0;
  background: var(--panel3);
  border: 1px solid var(--border2);
  border-radius: var(--rs);
  color: var(--dim);
  padding: 4px 10px;
  font-size: .7em;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}

.history-load:hover { background: var(--accent-dim); color: #a5b4fc; border-color: var(--accent); }

.history-empty {
  text-align: center;
  padding: 32px 16px;
  font-size: .78em;
  color: var(--muted);
}

/* ============================================================
   25. A/B COMPARE
   ============================================================ */
.ab-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 10001;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

.ab-overlay.open {
  opacity: 1;
  pointer-events: all;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.ab-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(.96);
  width: min(960px, 95vw);
  max-height: 85vh;
  background: var(--panel);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  z-index: 10002;
  box-shadow: 0 24px 80px rgba(0,0,0,.7);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: transform .2s cubic-bezier(.4,0,.2,1), opacity .2s;
  overflow: hidden;
}

.ab-panel.open { transform: translate(-50%, -50%) scale(1); opacity: 1; pointer-events: all; }

.ab-head {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 10px;
}

.ab-head h3 { font-size: .84em; font-weight: 700; color: var(--text); flex: 1; }

.ab-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--panel3) transparent;
}

.ab-body::-webkit-scrollbar { width: 5px; }
.ab-body::-webkit-scrollbar-thumb { background: var(--panel3); border-radius: 3px; }

.ab-col { display: flex; flex-direction: column; gap: 8px; }

.ab-col-title {
  font-size: .68em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}

.ab-col textarea {
  height: 180px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: .78em;
  resize: none;
  min-height: 180px;
}

.ab-diff-toggle {
  padding: 8px 18px;
  border-top: 1px solid var(--border);
  background: var(--panel2);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-ab-diff {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--panel3);
  color: var(--dim);
  border: 1px solid var(--border2);
  border-radius: var(--rs);
  padding: 5px 12px;
  font-size: .76em;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}

.btn-ab-diff:hover { background: var(--accent-dim); color: #a5b4fc; border-color: var(--accent); }

.btn-ab-diff svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.diff-add    { color: #4ade80; }
.diff-remove { color: #f87171; text-decoration: line-through; }

#abDiffResult,
.ab-diff-result {
  display: none;
  background: var(--panel3);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  padding: 12px 14px;
  margin-top: 10px;
  line-height: 1.6;
}

/* ============================================================
   26b. VARIANTS PANEL
   ============================================================ */
#variantsOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 10010;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

#variantsOverlay.open {
  opacity: 1;
  pointer-events: all;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

#variantsPanel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(.95);
  z-index: 10011;
  width: min(560px, 94vw);
  max-height: 82vh;
  background: var(--panel);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: transform .22s cubic-bezier(.34,1.26,.64,1), opacity .18s;
  box-shadow: 0 24px 72px rgba(0,0,0,.6);
}

#variantsPanel.open { transform: translate(-50%,-50%) scale(1); opacity: 1; pointer-events: all; }

.variants-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.variants-head h3 { font-size: .84em; font-weight: 700; color: var(--text); flex: 1; }

.variants-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
}

.variants-body::-webkit-scrollbar { width: 5px; }
.variants-body::-webkit-scrollbar-thumb { background: var(--panel3); border-radius: 3px; }

.variant-card {
  background: var(--panel3);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  padding: 12px 14px;
  margin-bottom: 10px;
}

.variant-card:last-child { margin-bottom: 0; }

.variant-label {
  font-size: .67em;
  font-weight: 700;
  letter-spacing: .07em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.variant-text {
  font-size: .8em;
  color: var(--text);
  line-height: 1.55;
  margin-bottom: 10px;
}

.variant-copy-btn {
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: var(--radius-s);
  color: var(--text-muted);
  font-size: .7em;
  padding: 4px 12px;
  cursor: pointer;
  font-family: inherit;
  transition: background .14s, color .14s;
}

.variant-copy-btn:hover { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }

.variants-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: .8em;
  transition: background .14s, color .14s, border-color .14s;
}

.variants-close:hover { background: rgba(239,68,68,.1); color: #f87171; border-color: rgba(239,68,68,.3); }

/* ============================================================
   26. WIKI MODAL
   ============================================================ */
.wiki-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

.wiki-overlay.open {
  opacity: 1;
  pointer-events: all;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.wiki-panel {
  width: min(740px, 95vw);
  max-height: 80vh;
  background: var(--panel);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
  transform: translateY(20px) scale(.97);
  opacity: 0;
  transition: transform .22s cubic-bezier(.4,0,.2,1), opacity .22s;
  overflow: hidden;
}

.wiki-overlay.open .wiki-panel { transform: translateY(0) scale(1); opacity: 1; }

.wiki-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.wiki-head h3 { font-size: .84em; font-weight: 700; color: var(--text); flex-shrink: 0; }

.wiki-count {
  font-size: .68em;
  color: var(--muted);
  background: var(--panel3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1px 7px;
  font-weight: 600;
}

.wiki-search {
  flex: 1;
  max-width: 260px;
  padding: 6px 10px;
  background: var(--input-bg);
  border: 1px solid var(--border2);
  border-radius: var(--rs);
  color: var(--text);
  font-size: .78em;
  outline: none;
  transition: border-color .15s;
  margin-left: auto;
}

.wiki-search:focus { border-color: var(--accent); }

.wiki-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  align-content: start;
  scrollbar-width: thin;
  scrollbar-color: var(--panel3) transparent;
}

.wiki-body::-webkit-scrollbar { width: 5px; }
.wiki-body::-webkit-scrollbar-thumb { background: var(--panel3); border-radius: 3px; }

.wiki-card {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  cursor: pointer;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wiki-card:hover { border-color: var(--accent); background: var(--panel3); }

.wiki-card-name {
  font-size: .8em;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wiki-card-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  background: var(--panel3);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: .63em;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  align-self: flex-start;
}

.wiki-card-desc {
  font-size: .72em;
  color: var(--dim);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: all .2s;
}

.wiki-card.expanded .wiki-card-desc {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}

.wiki-card-more {
  font-size: .67em;
  color: var(--accent);
  margin-top: 4px;
  display: block;
  user-select: none;
}

.wiki-card.expanded .wiki-card-more { color: var(--muted); }

.wiki-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 16px;
  font-size: .78em;
  color: var(--muted);
}

/* ============================================================
   27. CLOSE BUTTONS
   ============================================================ */
.wiki-close,
.history-close,
.ab-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: 50%;
  color: var(--dim);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  flex-shrink: 0;
  line-height: 1;
}

.wiki-close svg,
.history-close svg,
.ab-close svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.wiki-close:hover,
.history-close:hover,
.ab-close:hover { background: rgba(239,68,68,.1); color: #f87171; border-color: rgba(239,68,68,.3); }

/* ============================================================
   28. CHROMA BOX
   ============================================================ */
.chroma-box { grid-column: span 2; }

@media (max-width: 480px) {
  .chroma-box { grid-column: span 1; }
}

/* ============================================================
   29. RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .grid-wrapper { grid-template-columns: 1fr; }
  .sidebar { position: static; top: auto; }
}

@media (max-width: 640px) {
  .container { padding: 10px 12px; }
  .module-grid { grid-template-columns: 1fr; }
  .hero-section { grid-template-columns: 1fr; }
  .ab-body { grid-template-columns: 1fr; }

  .output-dock {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    padding: 10px 12px;
  }

  .prompt-container { grid-column: 1; grid-row: 1; }
  .dock-right { grid-column: 1; grid-row: 2; }
  .dock-main-actions { flex-wrap: wrap; }
  .dock-secondary-actions { flex-wrap: wrap; }
  .ar-grid { grid-template-columns: repeat(3, 1fr); }
  .neg-builder-grid { grid-template-columns: 1fr; }
  header h1 { font-size: 1.3em; }
}

/* ============================================================
   30. SCROLLBAR (global)
   ============================================================ */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--panel3) transparent;
}

*::-webkit-scrollbar { width: 5px; height: 5px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--panel3); border-radius: 3px; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ============================================================
   31. FEATHER ICON SVG SIZING
   feather.replace() injects <svg> directly inside <i data-feather>
   All icon contexts listed below
   ============================================================ */
.mod-icon svg {
  width: 13px; height: 13px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.btn-guide svg {
  width: 12px; height: 12px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.sidebar-action svg {
  width: 13px; height: 13px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}

.dock-icon-btn svg {
  width: 13px; height: 13px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}

.btn-copy svg {
  width: 13px; height: 13px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}

.btn-reset svg {
  width: 13px; height: 13px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}

.btn-undo svg,
.btn-redo svg {
  width: 13px; height: 13px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}

.chevron svg {
  width: 13px; height: 13px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border-width: 0;
}

.mono { font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace; }
.text-accent { color: var(--accent); }
.text-dim    { color: var(--dim); }
.text-muted  { color: var(--muted); }

.gap-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.divider  { height: 1px; background: var(--border); margin: 10px 0; }

/* ============================================================
   32. LIGHT THEME OVERRIDES
   Hardcoded colors that need to adapt to light mode
   ============================================================ */

/* Header gradient */
body.light header {
  background: linear-gradient(135deg, #eef2ff 0%, #f8faff 100%);
  border-bottom-color: rgba(99,102,241,.2);
}

/* Inputs & selects */
body.light input,
body.light textarea,
body.light select {
  color: var(--text);
  background: var(--input-bg);
  border-color: var(--border2);
}

body.light input::placeholder,
body.light textarea::placeholder { color: var(--muted); }

/* Output textarea */
body.light .final-text {
  color: #18181b;
  background: var(--input-bg);
}

/* Strength meter label */
body.light #strengthLabel { /* inherits color from JS */ }

/* Chips */
body.light .chip {
  background: var(--panel3);
  border-color: var(--border2);
  color: var(--text);
}

/* AR buttons */
body.light .ar-btn {
  background: var(--panel2);
  border-color: var(--border2);
  color: var(--dim);
}
body.light .ar-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* Mode indicator */
body.light .mode-indicator {
  background: var(--panel2);
  border-color: var(--border2);
  color: var(--dim);
}

/* Wiki card */
body.light .wiki-card { background: var(--panel2); }
body.light .wiki-card:hover { background: var(--panel3); }

/* Tooltip (JS-positioned) — stays dark for readability */
/* (no override — dark tooltip on light bg is fine) */

/* History & AB modals */
body.light .history-panel,
body.light .ab-panel,
body.light .wiki-panel,
body.light #variantsPanel {
  background: var(--panel);
  border-color: var(--border2);
}

/* Scrollbars in light mode */
body.light * {
  scrollbar-color: var(--panel3) transparent;
}

/* negative prompt text stays red-ish */
body.light #negative_prompt { color: #dc2626; }

/* ============================================================
   33. TOOL NAV LINK (link tra le pagine)
   ============================================================ */
.btn-tool-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--panel2);
  border: 1px solid var(--border2);
  border-radius: var(--rs);
  color: var(--dim);
  font-size: .72em;
  font-weight: 600;
  letter-spacing: .04em;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}

.btn-tool-nav:hover {
  background: var(--accent-dim);
  color: #a5b4fc;
  border-color: var(--accent);
  text-decoration: none;
}

.btn-tool-nav svg {
  width: 13px; height: 13px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}

/* ============================================================
   33b. TAB NAVIGATION (legacy, non usato)
   ============================================================ */
.tool-tabs {
  display: flex;
  gap: 2px;
  margin-top: 14px;
  border-bottom: 1px solid var(--border);
}

.tool-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: .78em;
  font-weight: 600;
  letter-spacing: .03em;
  cursor: pointer;
  transition: color .15s, border-color .15s;
  margin-bottom: -1px;
  font-family: inherit;
}

.tool-tab:hover { color: var(--text); }

.tool-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tool-tab svg {
  width: 14px; height: 14px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}

/* ============================================================
   33b. LOGO SPEC BADGES
   ============================================================ */
.logo-spec-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: rgba(245,158,11,.08);
  border: 1px solid rgba(245,158,11,.25);
  border-radius: 20px;
  font-size: .68em;
  font-weight: 600;
  color: #f59e0b;
  letter-spacing: .03em;
  white-space: nowrap;
}

/* ============================================================
   34. BTN GENERA (Imagen 4)
   ============================================================ */
.btn-generate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: var(--rs);
  padding: 9px 16px;
  font-size: .8em;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
  transition: opacity .15s, box-shadow .15s;
  white-space: nowrap;
  box-shadow: 0 2px 12px rgba(99,102,241,.35);
}

.btn-generate:hover  { opacity: .88; box-shadow: 0 4px 20px rgba(99,102,241,.55); }
.btn-generate:active { opacity: .75; }
.btn-generate svg    { width:13px; height:13px; stroke:currentColor; fill:none; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; flex-shrink:0; }

/* ============================================================
   34. IMAGEN 4 MODAL
   ============================================================ */
.imagen-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 10020;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

.imagen-overlay.open {
  opacity: 1;
  pointer-events: all;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.imagen-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(.96);
  width: min(640px, 95vw);
  max-height: 88vh;
  background: var(--panel);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  z-index: 10021;
  box-shadow: 0 24px 80px rgba(0,0,0,.7);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: transform .22s cubic-bezier(.4,0,.2,1), opacity .2s;
  overflow: hidden;
}

.imagen-panel.open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  pointer-events: all;
}

.imagen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.imagen-head-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.imagen-logo {
  font-size: 1.1em;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.imagen-head h3 {
  font-size: .82em;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .04em;
}

.imagen-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: 20px;
}

.imagen-placeholder {
  text-align: center;
  font-size: .82em;
  color: var(--muted);
  line-height: 1.6;
  max-width: 340px;
}

.imagen-placeholder strong { color: var(--text); }

.imagen-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: var(--dim);
  font-size: .82em;
}

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

.imagen-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--panel3);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: imagenSpin .8s linear infinite;
}

.imagen-img {
  max-width: 100%;
  max-height: 60vh;
  border-radius: var(--rs);
  display: block;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
}

.imagen-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: #f87171;
  font-size: .82em;
  text-align: center;
  max-width: 380px;
}

.imagen-error svg { width: 28px; height: 28px; stroke: #f87171; fill: none; stroke-width: 1.5; }

.imagen-footer {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--panel2);
}

.imagen-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel3);
  border: 1px solid var(--border2);
  border-radius: var(--rs);
  color: var(--dim);
  padding: 7px 14px;
  font-size: .78em;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}

.imagen-action-btn:hover { background: var(--accent-dim); color: #a5b4fc; border-color: var(--accent); }
.imagen-action-btn svg   { width:13px; height:13px; stroke:currentColor; fill:none; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; flex-shrink:0; }

/* End of style.css */
