:root {
  --bg-0: #FFFFFF;
  --bg-1: #F7F7F9;
  --bg-2: #EEEEF2;
  --bg-3: #E2E2E8;
  --bg-input: #FFFFFF;
  --border: #D0D0DA;
  --border-focus: #FF2D8A;
  --text-0: #0D1B3E;
  --text-1: #2A3558;
  --text-2: #8088A0;
  --accent: #FF2D8A;
  --accent-light: rgba(255,45,138,0.10);
  --accent2: #00FF88;
  --accent2-light: rgba(0,255,136,0.10);
  --purple: #6B21A8;
  --purple-light: rgba(107,33,168,0.10);
  --darkblue: #0D1B3E;
  --radius: 6px;
  --font: 'Instrument Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }

body {
  font-family: var(--font);
  background: linear-gradient(168deg, #FFFFFF 0%, #F9F8FC 35%, #F4F2F8 70%, #F0EEF5 100%);
  color: var(--text-0);
  min-height: 100vh;
  line-height: 1.5;
  position: relative;
}

/* Paper texture overlay via SVG feTurbulence noise */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  filter: url(#paperNoise);
  opacity: 0.38;
  mix-blend-mode: multiply;
  background: rgba(235,230,225,0.5);
}

/* Ensure all content sits above the paper texture */
body > * {
  position: relative;
  z-index: 1;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-2); }

/* ── HEADER ── */
.forge-header {
  background-image: url('/images/purple-pink-gradient.png');
  background-repeat: repeat-x;
  background-position: center center;
  background-size: auto 100%;
  border-bottom: 2px solid var(--accent);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(13,27,62,0.25);
}
.forge-header-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.forge-header-left > div { min-width: 0; }
.forge-brand-logo {
  width: 58px;
  height: 58px;
  object-fit: contain;
  flex: 0 0 auto;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.28));
}
.forge-logo {
  font-family: var(--mono);
  font-size: 1.35rem;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -0.03em;
}
.forge-logo em { font-style: normal; color: #FF2D8A; }
.forge-subtitle {
  font-size: 0.8rem;
  color: #00FF88;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
  opacity: 0.85;
  margin-top: -2px;
}
.btn-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 500;
  background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0.05) 100%);
  color: rgba(255,255,255,0.55);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 5px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 200ms ease;
  position: relative; overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.15);
}
.btn-reset::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, transparent 100%);
  pointer-events: none;
}
.btn-reset:hover { color: #FF2D8A; border-color: #FF2D8A; box-shadow: 0 0 10px rgba(255,45,138,0.2), inset 0 1px 0 rgba(255,255,255,0.15); }
.btn-reset:active { box-shadow: 0 0 16px rgba(255,45,138,0.4), 0 0 30px rgba(255,45,138,0.15); transform: scale(0.96); }

.forge-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-toggle-stack {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-toggle,
.btn-reset,
.ai-assist-toggle {
  height: 32px;
  box-sizing: border-box;
}

.ai-assist-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #00FF88;
  background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0.05) 100%);
  border: 1px solid currentColor;
  border-radius: var(--radius);
  padding: 5px 12px;
  cursor: pointer;
  transition: all 200ms ease;
  position: relative;
  box-shadow: 0 0 10px rgba(0,255,136,0.12), inset 0 1px 0 rgba(255,255,255,0.12);
  min-width: 86px;
  flex-shrink: 0;
  white-space: nowrap;
}
.ai-assist-toggle::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, transparent 100%);
  pointer-events: none;
}
.ai-assist-toggle:hover { box-shadow: 0 0 12px rgba(0,255,136,0.22), inset 0 1px 0 rgba(255,255,255,0.12); }
.ai-assist-toggle:active { box-shadow: 0 0 16px rgba(0,255,136,0.35); transform: scale(0.96); }
.ai-assist-toggle.ai-assist-off {
  color: rgba(255,255,255,0.42);
  border-color: currentColor;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
}

.lang-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0.05) 100%);
  border: 1px solid #00FF88;
  border-radius: var(--radius);
  padding: 5px 12px;
  cursor: pointer;
  transition: all 200ms ease;
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
  min-width: 72px;
  flex-shrink: 0;
  white-space: nowrap;
}
.lang-toggle::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, transparent 100%);
  pointer-events: none;
}
.lang-toggle:hover { border-color: #00FF88; box-shadow: 0 0 10px rgba(0,255,136,0.2), inset 0 1px 0 rgba(255,255,255,0.12); }
.lang-toggle:active { box-shadow: 0 0 16px rgba(0,255,136,0.35); transform: scale(0.96); }
.lang-opt {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.06em;
  transition: all 150ms;
}
.lang-opt.lang-active {
  color: #00FF88;
}
.lang-sep {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.2);
}

/* ── MODEL TABS ── */
.model-tabs {
  display: flex;
  gap: 2px;
  padding: 12px 20px 0;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 50; /* lift above forge-main so the Claude submenu can overlay content */
}
.model-tab {
  font-family: var(--font);
  background: linear-gradient(180deg, rgba(240,240,245,0.9) 0%, rgba(226,226,232,0.8) 100%);
  border: 1px solid var(--border);
  border-bottom: none;
  box-sizing: border-box;
  padding: 7px 14px;
  border-radius: var(--radius) var(--radius) 0 0;
  cursor: pointer;
  transition: all 200ms ease;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 44px;
  flex: 1;
  text-align: center;
}
.model-tabs > .model-tab,
.model-tab-group {
  flex: 1 1 0;
  width: 0;
}
.model-tabs > .model-tab { padding-left: 0; padding-right: 0; }
.model-tab::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.5) 0%, transparent 100%);
  pointer-events: none;
}
.model-tab:hover { background: linear-gradient(180deg, rgba(248,248,252,0.95) 0%, rgba(238,238,245,0.85) 100%); }
.model-tab:active { box-shadow: 0 0 12px rgba(107,33,168,0.2), inset 0 1px 2px rgba(0,0,0,0.06); transform: scale(0.97); }
.model-tab.tab-active {
  background: linear-gradient(180deg, #FFFFFF 0%, var(--bg-0) 100%);
  border-color: var(--border);
  border-bottom-color: var(--bg-0);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9);
}
.model-tab.tab-active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent);
}
.model-logo {
  display: block;
  max-width: 72px;
  max-height: 27px;
  object-fit: contain;
  flex-shrink: 0;
}
.model-logo-belgpt { max-height: 30px; }
/* Claude family tabs: model name overlaid on the bottom half of the icon */
.model-logo-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.model-tab-name {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  height: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  font-family: 'Styrene A Web', 'Styrene A', 'Styrene B', 'Styrene', var(--font);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-0);
  text-shadow: 0 0 3px rgba(255,255,255,0.95), 0 0 6px rgba(255,255,255,0.85);
  pointer-events: none;
}
/* Claude model group: one tab that opens a submenu of the three Claude models */
.model-tab-group {
  position: relative;
  box-sizing: border-box;
  min-width: 0;
  display: flex;
}
.model-tab-group > .model-tab {
  flex: 1 1 0;
  width: calc(100% + 2px);
  margin-left: -1px;
  margin-right: -1px;
}
.claude-submenu {
  position: fixed; /* JS positions it under the Claude tab; fixed escapes the tab bar's overflow clip */
  transform: translateX(-50%);
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 150px;
  padding: 6px;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(13,27,62,0.22);
}
.claude-submenu[hidden] { display: none; }
.model-subtab {
  font-family: var(--font);
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}
.model-subtab:hover { background: var(--bg-2); }
.model-subtab.subtab-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.tab-dot { display: none; }
.model-tooltip {
  position: fixed;
  z-index: 1000;
  padding: 6px 10px;
  border-radius: var(--radius);
  background: rgba(17, 24, 39, 0.92);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1;
  box-shadow: 0 6px 18px rgba(0,0,0,0.22);
  opacity: 0;
  transform: translate(-50%, -4px);
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease;
}
.model-tooltip.tooltip-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ── LAYOUT ── */
.forge-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: 1600px;
  margin: 0 auto;
  min-height: calc(100vh - 94px);
}
.panel-controls {
  padding: 20px;
  overflow-y: auto;
  max-height: calc(100vh - 94px);
  border-right: 1px solid var(--border);
}
.panel-output {
  padding: 20px;
  position: sticky;
  top: 94px;
  max-height: calc(100vh - 94px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ── LABELS ── */
.step-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--purple);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 4px;
  opacity: 0.85;
}
.section-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-0);
  margin-bottom: 12px;
}

/* ── TASK TYPE GRID ── */
.task-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}
.task-btn {
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 700;
  background: #FFFFFF;
  color: var(--text-1);
  border: 1px solid #C8C8D4;
  border-radius: var(--radius);
  padding: 9px 8px 11px;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease, transform 100ms ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-shadow: 0 2px 0 #D8D8E2;
  position: relative;
  overflow: hidden;
  height: 126px;
}
.task-btn::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: #500088;
  pointer-events: none;
  z-index: 1;
}
.task-btn:hover {
  color: var(--text-0);
  border-color: #CC079A;
  background: #FFF6FC;
}
.task-btn:active {
  transform: translateY(1px);
}
.task-btn.task-active,
.task-btn.task-active:hover {
  background-color: #FFFFFF;
  background-image: none;
  border-color: #CC079A;
  color: var(--text-0);
  box-shadow: 0 3px 0 #CC079A;
}
.task-btn.task-active::before {
  background: #CC079A;
}
.task-btn-image {
  display: block;
  width: 82px;
  height: 72px;
  object-fit: contain;
  filter: none;
  transition: filter 160ms ease;
  pointer-events: none;
  position: relative;
  z-index: 2;
}
.task-btn:hover .task-btn-image {
  filter: none;
}
.task-btn.task-active .task-btn-image {
  filter:
    drop-shadow(0 0 3px rgba(126,255,61,0.72))
    drop-shadow(0 0 7px rgba(91,220,48,0.38));
}
.task-btn[data-type="create"] .task-btn-image {
  width: 82px;
  height: 72px;
}
.task-label {
  position: relative;
  z-index: 2;
  line-height: 1.1;
  pointer-events: none;
  transition: color 160ms ease, font-size 160ms ease;
}
.task-btn.task-active .task-label {
  width: calc(100% + 12px);
  color: var(--purple);
  font-size: 1.23rem;
  white-space: nowrap;
}

/* ── FORM ELEMENTS ── */
select, input[type="text"], input[type="number"], textarea {
  font-family: var(--font);
  font-size: 0.84rem;
  background: var(--bg-input);
  color: var(--text-0);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  width: 100%;
  outline: none;
  transition: border-color 150ms;
}
select:focus, input:focus, textarea:focus {
  border-color: #FF2D8A;
  box-shadow: 0 0 0 2px rgba(255,45,138,0.10);
}
textarea {
  font-family: var(--mono);
  font-size: 0.8rem;
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}
textarea.raw-prompt { min-height: 110px; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238A857D' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
}
input[type="number"] { width: 100px; }
.field { margin-bottom: 14px; }
.field-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 5px;
}

/* ── ACCORDION ── */
.acc-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
  background: var(--bg-1);
}
.acc-wrap[data-hidden="true"] { display: none; }
.acc-header {
  font-family: var(--font);
  font-size: 0.84rem;
  font-weight: 600;
  background: var(--bg-1);
  color: var(--text-1);
  border: none;
  padding: 10px 14px;
  width: 100%;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 150ms;
}
#configPanel .acc-header {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  column-gap: 10px;
}
#configPanel .acc-header::before {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #9699A3;
  border: 1px solid #737780;
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.45);
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
#configPanel .acc-header.acc-impact::before {
  background: #72FF45;
  border-color: #3CC817;
  box-shadow:
    0 0 5px rgba(114,255,69,0.95),
    0 0 11px rgba(114,255,69,0.75),
    inset 0 1px 1px rgba(255,255,255,0.65);
}
.acc-header:hover { background: var(--bg-2); color: var(--text-0); }
.acc-header.acc-open { background: var(--bg-2); border-bottom: 1px solid var(--border); }
.acc-header.acc-impact,
.acc-header.acc-impact:hover { color: var(--purple); }
.acc-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.chevron { font-size: 0.7rem; color: var(--text-2); transition: transform 250ms; }
.chevron-up { transform: rotate(180deg); }
.acc-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 300ms ease, padding 300ms ease;
  padding: 0 14px;
}
.acc-body.acc-body-open { max-height: 1400px; padding: 12px 14px 14px; }
.help-dot {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--purple); color: #FFFFFF;
  font-size: 0.6rem; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; transition: transform 150ms;
  user-select: none;
}
.help-dot:hover { transform: scale(1.15); background: #FF2D8A; }
.help-dot:active { box-shadow: 0 0 12px rgba(255,45,138,0.5); transform: scale(1.05); }
.tip-bubble {
  max-height: 0; overflow: hidden;
  transition: max-height 280ms ease, padding 280ms ease;
  padding: 0 14px;
  background: linear-gradient(135deg, #0D1B3E 0%, #1A1040 100%); color: #E2E2E8;
  font-size: 0.76rem; line-height: 1.6;
  border-top: 2px solid #FF2D8A;
}
.tip-bubble.tip-visible { max-height: 300px; padding: 10px 14px; }

/* ── SEGMENTED ── */
.seg-group { display: flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.seg-btn {
  flex: 1; font-family: var(--font); font-size: 0.76rem; font-weight: 500;
  background: linear-gradient(180deg, rgba(255,255,255,0.9) 0%, rgba(238,238,242,0.8) 100%);
  color: var(--text-2); border: none;
  border-right: 1px solid var(--border); padding: 8px 6px;
  cursor: pointer; transition: all 200ms ease; text-align: center;
  position: relative; overflow: hidden;
}
.seg-btn::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.5) 0%, transparent 100%);
  pointer-events: none;
}
.seg-btn:last-child { border-right: none; }
.seg-btn:hover { background: linear-gradient(180deg, rgba(245,245,250,0.95) 0%, rgba(230,230,238,0.85) 100%); }
.seg-btn:active {
  box-shadow: 0 0 12px rgba(255,45,138,0.3), inset 0 1px 2px rgba(0,0,0,0.06);
  transform: scale(0.96);
}
.seg-btn.seg-active {
  background: linear-gradient(180deg, #FF5AA5 0%, #FF2D8A 100%);
  color: #fff; font-weight: 600;
  box-shadow: 0 0 10px rgba(255,45,138,0.3), inset 0 1px 0 rgba(255,255,255,0.3);
}
.seg-btn.seg-active:active {
  box-shadow: 0 0 20px rgba(255,45,138,0.5), 0 0 35px rgba(255,45,138,0.2), inset 0 1px 2px rgba(0,0,0,0.1);
}

/* ── TOGGLE ── */
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; }
.toggle-label { font-size: 0.82rem; color: var(--text-1); }
.toggle-track {
  width: 40px; height: 22px; border-radius: 11px;
  background: var(--bg-3); border: 1px solid var(--border);
  cursor: pointer; position: relative; transition: all 150ms; flex-shrink: 0;
}
.toggle-track.toggle-on { background: #FF2D8A; border-color: #FF2D8A; }
.toggle-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--text-2); position: absolute; top: 2px; left: 2px;
  transition: all 150ms;
}
.toggle-track.toggle-on .toggle-thumb { transform: translateX(18px); background: #fff; }

/* ── CHECKBOX ── */
.cb-group { display: flex; flex-direction: column; gap: 6px; }
.cb-item { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.82rem; color: var(--text-1); }
.cb-item input[type="checkbox"] {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border: 1px solid var(--border);
  border-radius: 3px; background: var(--bg-input); cursor: pointer;
  flex-shrink: 0; transition: all 150ms; position: relative;
}
.cb-item input[type="checkbox"]:checked { background: var(--purple); border-color: var(--purple); }
.cb-item input[type="checkbox"]:checked::after {
  content: ''; position: absolute; left: 4.5px; top: 1px;
  width: 5px; height: 9px; border: solid #fff;
  border-width: 0 2px 2px 0; transform: rotate(45deg);
}

/* ── RADIO ── */
.radio-group { display: flex; flex-direction: column; gap: 6px; }
.radio-item { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--text-1); cursor: pointer; }
.radio-item input[type="radio"] {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--border); background: var(--bg-input);
  cursor: pointer; flex-shrink: 0; position: relative; transition: all 150ms;
}
.radio-item input[type="radio"]:checked { border-color: var(--purple); }
.radio-item input[type="radio"]:checked::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--purple);
}

/* ── SLIDER ── */
.slider-wrap { display: flex; align-items: center; gap: 10px; }
.slider-edge { font-size: 0.7rem; color: var(--text-2); width: 70px; flex-shrink: 0; }
.slider-edge-r { text-align: right; }
input[type="range"] {
  -webkit-appearance: none; appearance: none; flex: 1;
  height: 4px; background: var(--bg-3); border-radius: 2px;
  outline: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px;
  border-radius: 50%; background: #FF2D8A;
  border: 2px solid #FFFFFF; cursor: pointer;
  box-shadow: 0 0 6px rgba(255,45,138,0.4);
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: #FF2D8A; border: 2px solid #FFFFFF; cursor: pointer;
}
.slider-val {
  font-family: var(--mono); font-size: 0.72rem;
  color: var(--purple); text-align: center; margin-top: 4px; font-weight: 600;
}

/* ── OUTPUT PANEL ── */
.output-header {
  display: flex; flex-direction: column;
  margin-bottom: 10px; gap: 10px;
}
.output-stats-head {
  display: flex; flex-direction: column;
  position: relative;
}
.output-stats-labelrow {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.output-stats-title {
  font-size: 0.95rem; font-weight: 600; color: var(--text-0);
}
.output-stats-divider {
  width: 100%;
  height: 2px;
  background: #FF2D8A;
  border-radius: 999px;
}
.output-meta {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.score-wrap { display: flex; align-items: center; gap: 10px; cursor: pointer; border-radius: var(--radius); padding: 2px 4px; }
.score-wrap:hover { background: var(--bg-2); }
.score-ring { position: relative; width: 50px; height: 50px; flex-shrink: 0; }
.score-ring svg { transform: rotate(-90deg); width: 50px; height: 50px; }
.ring-bg { fill: none; stroke: var(--bg-3); stroke-width: 4; }
.ring-fg { fill: none; stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset 500ms ease, stroke 300ms; }
.score-num {
  position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 0.78rem; font-weight: 700;
}
.score-side { font-size: 0.7rem; color: var(--text-2); line-height: 1.3; }
.stat-pill {
  font-family: var(--mono); font-size: 0.72rem;
  color: var(--text-2); background: var(--bg-2);
  padding: 3px 8px; border-radius: 4px;
}
.stat-pill.warn { color: #f59e0b; }
.stat-pill.danger { color: #ef4444; }
.btn-copy {
  font-family: var(--font); font-size: 0.82rem; font-weight: 600;
  background: linear-gradient(180deg, #FF5AA5 0%, #FF2D8A 100%);
  color: #fff; border: none;
  padding: 8px 20px; border-radius: var(--radius);
  cursor: pointer; transition: all 200ms ease; white-space: nowrap;
  position: relative; overflow: hidden;
  box-shadow: 0 2px 8px rgba(255,45,138,0.2), inset 0 1px 0 rgba(255,255,255,0.3);
}
.btn-copy::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.25) 0%, transparent 100%);
  border-radius: var(--radius) var(--radius) 0 0;
  pointer-events: none;
}
.btn-copy:hover {
  background: linear-gradient(180deg, #FF6AB0 0%, #FF3D95 100%);
  box-shadow: 0 4px 14px rgba(255,45,138,0.3), inset 0 1px 0 rgba(255,255,255,0.3);
}
.btn-copy:active {
  box-shadow: 0 0 20px rgba(255,45,138,0.5), 0 0 40px rgba(255,45,138,0.2), inset 0 1px 2px rgba(0,0,0,0.1);
  transform: scale(0.96);
}
.btn-copy.btn-copied { opacity: 0.7; }
.btn-generate {
  font-family: var(--font); font-size: 0.82rem; font-weight: 700;
  background: linear-gradient(135deg, #FF5AA5 0%, #FF2D8A 38%, #8B5CF6 70%, #FF5AA5 100%);
  background-size: 260% 260%;
  color: #fff; border: none;
  padding: 8px 18px 8px 26px; border-radius: var(--radius);
  cursor: pointer; transition: all 200ms ease; white-space: nowrap;
  position: relative; overflow: hidden;
  box-shadow: 0 2px 10px rgba(255,45,138,0.24), inset 0 1px 0 rgba(255,255,255,0.28);
  animation: generateGradientDrift 5.5s ease-in-out infinite;
}
.btn-generate::before {
  content: '✦';
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 0.78rem;
  color: #FFFFFF;
  opacity: 0.78;
  text-shadow: 0 0 5px rgba(255,255,255,0.5);
  animation: generateSparkle 4.8s ease-in-out infinite;
}
.btn-generate::after {
  content: none;
}
.btn-generate:hover {
  background: linear-gradient(135deg, #FF66AD 0%, #F51F7E 38%, #7C3AED 70%, #FF66AD 100%);
  background-size: 260% 260%;
  box-shadow: 0 4px 14px rgba(255,45,138,0.28), inset 0 1px 0 rgba(255,255,255,0.3);
}
.btn-generate:active { transform: scale(0.96); }
.btn-generate:disabled,
.btn-ai-suggest:disabled {
  opacity: 0.55;
  cursor: wait;
}
.field.ai-enabled { position: relative; }
.field.ai-loading textarea,
.field.ai-loading input {
  opacity: 0.72;
  animation: aiPulse 1.1s ease-in-out infinite alternate;
}
.ai-field-actions {
  display: flex; align-items: center; gap: 6px;
  position: absolute; top: 6px; right: 6px; z-index: 2;
}
.ai-field-actions[hidden],
.btn-generate[hidden] {
  display: none !important;
}
.btn-ai-suggest {
  font-family: var(--font); font-size: 0.66rem; font-weight: 600;
  background: linear-gradient(180deg, rgba(255,255,255,0.95) 0%, rgba(238,238,242,0.9) 100%);
  color: var(--text-2); border: 1px solid var(--border);
  padding: 4px 8px; border-radius: var(--radius);
  cursor: pointer; transition: all 200ms ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}
.btn-ai-suggest:hover { color: #FF2D8A; border-color: #FF2D8A; }
.undo-link {
  font-size: 0.68rem; color: var(--purple);
  background: transparent; border: none; cursor: pointer;
  padding: 0; text-decoration: underline;
}
.ai-mode-pill {
  font-family: var(--mono); font-size: 0.68rem;
  color: var(--text-2); background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 4px 8px;
  white-space: nowrap;
}
.ai-toast {
  position: fixed; right: 18px; bottom: 18px; z-index: 40;
  max-width: 340px; background: #fff; color: var(--text-1);
  border: 1px solid #ef4444; border-left: 4px solid #ef4444;
  border-radius: var(--radius); padding: 10px 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.18);
  font-size: 0.82rem; line-height: 1.45;
}
.ai-toast button {
  margin-top: 8px;
}
.lockout-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(31,31,43,0.32);
  display: none; align-items: center; justify-content: center;
  padding: 18px;
}
.lockout-backdrop.visible { display: flex; }
.lockout-modal {
  width: min(420px, 100%);
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  box-shadow: 0 18px 54px rgba(0,0,0,0.24);
}
.lockout-title { font-weight: 700; color: var(--text-0); margin-bottom: 6px; }
.lockout-body { color: var(--text-2); font-size: 0.86rem; line-height: 1.45; margin-bottom: 12px; }
#appModalBody { white-space: pre-line; }
.lockout-actions { display: flex; gap: 8px; margin-top: 10px; }
@keyframes aiPulse {
  from { background-color: #fff; }
  to { background-color: #fff5fa; }
}
@keyframes generateGradientDrift {
  0%, 100% { background-position: 0% 0%; }
  50% { background-position: 100% 100%; }
}
@keyframes generateSparkle {
  0%, 78%, 100% { opacity: 0.55; transform: translateY(-50%) scale(0.92) rotate(0deg); }
  84% { opacity: 1; transform: translateY(-50%) scale(1.08) rotate(12deg); }
  90% { opacity: 0.72; transform: translateY(-50%) scale(0.98) rotate(0deg); }
}
@media (prefers-reduced-motion: reduce) {
  .btn-generate,
  .btn-generate::before {
    animation: none;
  }
}
.output-box {
  flex: 1; font-family: var(--mono); font-size: 0.78rem; line-height: 1.7;
  background: #FFFFFF; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; overflow-y: auto;
  white-space: pre-wrap; word-wrap: break-word; min-height: 300px;
  color: var(--text-1); border-top: 3px solid #00FF88;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.04), 0 1px 4px rgba(0,0,0,0.06);
}
.output-box .sec-head { color: var(--purple); font-weight: 700; }
.output-box .empty-st { color: var(--text-2); font-style: italic; }
.output-box .sys-divider { color: #FF2D8A; font-weight: 700; letter-spacing: 0.05em; }
.output-footer {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.app-version,
.powered-by {
  font-size: 0.68rem;
  color: var(--text-2);
  opacity: 0.78;
}
.app-version {
  text-align: left;
  cursor: pointer;
  border-radius: 4px;
}
.app-version:hover { color: #FF2D8A; opacity: 1; }
.app-version:focus-visible {
  outline: 2px solid #FF2D8A;
  outline-offset: 3px;
}
.powered-by { text-align: right; }

.model-note {
  font-size: 0.72rem; color: var(--text-2); background: var(--bg-2);
  border-left: 2px solid var(--purple); padding: 6px 10px; margin-top: 8px;
  border-radius: 0 var(--radius) var(--radius) 0; line-height: 1.5;
}
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.conditional { display: none; }
.conditional.visible { display: block; }
.output-title-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.output-model-label { display: block; font-size: 0.72rem; color: var(--text-2); margin-left: 0; font-weight: 500; }
.output-title-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 12px; flex-wrap: wrap;
}
.output-title-copy {
  display: flex; align-items: center; gap: 10px;
}

/* ── SAVED CONFIGS ── */
.saved-configs {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.saved-configs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.saved-configs-title {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.85;
}
.save-row {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.save-row input[type="text"] {
  flex: 1;
  font-size: 0.82rem;
  padding: 7px 10px;
}
.btn-save {
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 600;
  background: linear-gradient(180deg, #FF5AA5 0%, #FF2D8A 100%);
  color: #fff;
  border: none;
  padding: 7px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 200ms ease;
  white-space: nowrap;
  flex-shrink: 0;
  position: relative; overflow: hidden;
  box-shadow: 0 2px 6px rgba(255,45,138,0.2), inset 0 1px 0 rgba(255,255,255,0.3);
}
.btn-save::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.25) 0%, transparent 100%);
  pointer-events: none;
}
.btn-save:hover {
  background: linear-gradient(180deg, #FF6AB0 0%, #FF3D95 100%);
  box-shadow: 0 4px 12px rgba(255,45,138,0.3), inset 0 1px 0 rgba(255,255,255,0.3);
}
.btn-save:active {
  box-shadow: 0 0 18px rgba(255,45,138,0.5), 0 0 35px rgba(255,45,138,0.2), inset 0 1px 2px rgba(0,0,0,0.1);
  transform: scale(0.96);
}
.btn-save:hover { background: linear-gradient(180deg, #FF6AB0 0%, #FF3D95 100%); }
.btn-save:disabled { opacity: 0.4; cursor: not-allowed; }
.config-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.config-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  transition: all 150ms;
}
.config-card:hover { border-color: var(--text-2); }
.config-info {
  flex: 1;
  min-width: 0;
}
.config-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.config-meta {
  font-size: 0.68rem;
  color: var(--text-2);
  display: flex;
  gap: 8px;
  margin-top: 1px;
}
.config-meta .config-tag {
  background: var(--bg-3);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 0.64rem;
}
.config-preview {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--text-2);
  margin-top: 4px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
}
.config-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.btn-config {
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 500;
  background: linear-gradient(180deg, rgba(255,255,255,0.9) 0%, rgba(238,238,242,0.8) 100%);
  color: var(--text-1);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 200ms ease;
  position: relative; overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}
.btn-config::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.4) 0%, transparent 100%);
  pointer-events: none;
}
.btn-config:hover { color: var(--text-0); border-color: var(--text-2); }
.btn-config:active { box-shadow: 0 0 10px rgba(107,33,168,0.25), inset 0 1px 2px rgba(0,0,0,0.06); transform: scale(0.95); }
.btn-config.btn-load:hover { color: #FF2D8A; border-color: #FF2D8A; box-shadow: 0 0 8px rgba(255,45,138,0.2), inset 0 1px 0 rgba(255,255,255,0.7); }
.btn-config.btn-del:hover { color: #ef4444; border-color: #ef4444; box-shadow: 0 0 8px rgba(239,68,68,0.2), inset 0 1px 0 rgba(255,255,255,0.7); }
.btn-config.btn-export:hover { color: #3b82f6; border-color: #3b82f6; box-shadow: 0 0 8px rgba(59,130,246,0.2), inset 0 1px 0 rgba(255,255,255,0.7); }
.btn-config.btn-history:hover { color: #10A37F; border-color: #10A37F; box-shadow: 0 0 8px rgba(16,163,127,0.2), inset 0 1px 0 rgba(255,255,255,0.7); }
.config-empty {
  font-size: 0.78rem;
  color: var(--text-2);
  font-style: italic;
  padding: 8px 0;
}
.import-export-row {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}
.btn-ie {
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 500;
  background: linear-gradient(180deg, rgba(255,255,255,0.9) 0%, rgba(238,238,242,0.8) 100%);
  color: var(--text-2);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 200ms ease;
  position: relative; overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}
.btn-ie::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.4) 0%, transparent 100%);
  pointer-events: none;
}
.btn-ie:hover { color: #FF2D8A; border-color: #FF2D8A; box-shadow: 0 0 8px rgba(255,45,138,0.2), inset 0 1px 0 rgba(255,255,255,0.7); }
.btn-ie:active { box-shadow: 0 0 14px rgba(255,45,138,0.35), inset 0 1px 2px rgba(0,0,0,0.06); transform: scale(0.96); }
.btn-ie-file { display: none; }

#btnInterview { margin-bottom: 4px; }
.interview-window {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  width: min(380px, calc(100vw - 24px));
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 18px 54px rgba(0,0,0,0.24);
  overflow: hidden;
}
.interview-window[hidden] { display: none; }
.interview-header {
  padding: 12px 14px;
  border-bottom: 2px solid var(--accent);
  font-weight: 700;
  color: var(--text-0);
}
.interview-messages {
  flex: 1;
  min-height: 120px;
  overflow-y: auto;
  padding: 12px;
}
.iv-msg {
  max-width: 85%;
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: pre-wrap;
}
.iv-msg-ai {
  background: var(--bg-1);
  border: 1px solid var(--border);
}
.iv-msg-user {
  margin-left: auto;
  background: var(--accent-light);
  border: 1px solid var(--accent);
}
.iv-msg-notice {
  margin: 8px auto;
  color: var(--text-2);
  font-size: 0.78rem;
  font-style: italic;
  text-align: center;
}
.iv-msg-notice button {
  display: block;
  margin: 7px auto 0;
}
.interview-input-row { padding: 0 12px 10px; }
.interview-input-row textarea {
  width: 100%;
  min-height: 64px;
  resize: vertical;
}
.interview-actions {
  display: flex;
  gap: 7px;
  padding: 0 12px 12px;
}
.interview-actions button { flex: 1; }
.interview-actions .btn-generate { min-width: 0; }
.interview-actions [hidden] { display: none; }

@media (min-width: 901px) {
  .model-tabs {
    position: sticky;
    top: 84px;
    z-index: 90;
  }
  .forge-main {
    min-height: calc(100vh - 140px);
  }
  .panel-controls,
  .panel-output {
    max-height: calc(100vh - 140px);
  }
  .panel-output {
    top: 140px;
  }
}

@media (max-width: 900px) {
  .forge-main { grid-template-columns: 1fr; }
  .panel-controls { max-height: none; border-right: none; border-bottom: 1px solid var(--border); }
  .panel-output { position: static; max-height: none; }
  .model-tabs { overflow-x: auto; }
}

@media (max-width: 640px) {
  .forge-header {
    padding: 8px 10px;
    gap: 8px;
  }
  .forge-header-left { gap: 5px; }
  .forge-brand-logo {
    width: 48px;
    height: 48px;
  }
  .forge-logo {
    max-width: 118px;
    font-size: 1.05rem;
    line-height: 1.08;
    letter-spacing: 0;
  }
  .forge-subtitle {
    max-width: 118px;
    margin-top: 2px;
    font-size: 0.62rem;
    line-height: 1.2;
    letter-spacing: 0.05em;
  }
  .forge-header-right {
    gap: 6px;
    flex: 0 0 auto;
  }
  .header-toggle-stack {
    width: 78px;
    flex-direction: column;
    gap: 6px;
  }
  .header-toggle-stack .ai-assist-toggle,
  .header-toggle-stack .lang-toggle {
    width: 78px;
    min-width: 78px;
    height: 32px;
    padding-left: 6px;
    padding-right: 6px;
  }
  .btn-reset {
    width: 68px;
    min-width: 68px;
    height: 70px;
    padding: 6px;
    flex-direction: column;
    gap: 0;
    line-height: 1.1;
  }
  .btn-reset span { display: block; }
  .interview-window {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 80vh;
    border-radius: var(--radius) var(--radius) 0 0;
  }
}
