@import url('https://fonts.googleapis.com/css2?family=Syne:wght@700;800&family=DM+Mono:wght@400;500&family=Cormorant+Garamond:wght@600;700&family=Playfair+Display:wght@700;900&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #08080f;
  --bg2:       #0a0a15;
  --bg3:       #0f0f1a;
  --border:    #1a1a2e;
  --border2:   #2a2a4a;
  --text:      #ffffff;
  --muted:     #888888;
  --dim:       #444444;
  --accent:    #f5a623;
  --red:       #e94560;
  --green:     #4ade80;
  --mono:      'DM Mono', monospace;
  --serif:     'Playfair Display', Georgia, serif;
  --display:   'Syne', sans-serif;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: Georgia, serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }

/* ── TOP BAR ── */
.topbar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  height: 52px;
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-logo {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 4px;
  color: var(--accent);
  text-transform: uppercase;
  margin-right: 32px;
  flex-shrink: 0;
}

.tabs { display: flex; gap: 4px; }

.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--dim);
  padding: 0 20px;
  height: 52px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}
.tab-btn:hover { color: var(--muted); }
.tab-btn.active {
  background: #14142a;
  border-bottom-color: var(--accent);
  color: var(--text);
}

/* ── PANELS ── */
.panel { display: none; padding: 52px 24px 80px; max-width: 760px; margin: 0 auto; }
.panel.active { display: block; animation: fadeUp 0.5s ease; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: 0.4; } 50% { opacity: 1; } }

/* ── HEADINGS ── */
.panel-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 5px;
  color: var(--red);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.panel-title {
  font-family: var(--serif);
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 32px;
  background: linear-gradient(135deg, #fff 40%, #888);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.panel-title-optimizer {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(34px, 5vw, 52px);
  font-weight: 700;
  line-height: 1.05;
  margin-bottom: 32px;
  color: var(--text);
}
.panel-title-optimizer span { color: var(--accent); }

/* ── FORM ELEMENTS ── */
.field { margin-bottom: 22px; }

.field-label {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 4px;
  color: var(--dim);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.field-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.char-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
}
.char-count.over { color: #f87171; }

input[type=text], textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 15px 18px;
  color: var(--text);
  font-size: 15px;
  font-family: Georgia, serif;
  line-height: 1.6;
  transition: border-color 0.2s;
  outline: none;
  resize: vertical;
}
input[type=text]:focus, textarea:focus { border-color: var(--accent); }

/* ── CHIP GROUPS ── */
.chip-group { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 9px 16px;
  color: var(--dim);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: all 0.2s;
  user-select: none;
}
.chip:hover { color: var(--muted); border-color: #3a3a5a; }
.chip.active {
  background: #1a0a12;
  border-color: var(--red);
  color: var(--text);
}
.chip.active-gold {
  background: #16100a;
  border-color: var(--accent);
  color: var(--accent);
}
.chip.active-platform { background: #0f0f2a; }

/* ── BUTTONS ── */
.btn-run {
  width: 100%;
  background: linear-gradient(135deg, var(--red), #c0392b);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 17px;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--mono);
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.btn-run:disabled {
  background: var(--bg3);
  color: #333;
  cursor: not-allowed;
}
.btn-run-gold {
  background: linear-gradient(135deg, var(--accent), var(--red));
  color: #000;
}

.btn-copy {
  background: var(--bg3);
  color: var(--muted);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 11px;
  font-family: var(--mono);
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 1px;
}
.btn-copy.copied {
  background: #0f2a0f;
  color: var(--green);
  border-color: var(--green);
}

/* ── PROGRESS ── */
.progress-label {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--red);
  letter-spacing: 1px;
  margin-bottom: 6px;
  animation: pulse 1.5s infinite;
}
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 28px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--accent));
  border-radius: 99px;
  transition: width 0.8s cubic-bezier(.4,0,.2,1);
}

/* ── OUTPUT CARDS ── */
.output-card {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 16px;
  padding: 22px 26px;
  margin-bottom: 18px;
  animation: fadeUp 0.4s ease;
}
.output-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.output-card-title {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
}
.output-card-desc {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
}
.output-card-body {
  color: #ccc;
  font-size: 14px;
  line-height: 1.8;
  white-space: pre-wrap;
  font-family: Georgia, serif;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 6px;
}

/* ── VARIANT CARDS ── */
.variant-card {
  background: linear-gradient(135deg, #0d0d1f, #0a0a18);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 22px;
  margin-bottom: 14px;
  position: relative;
  animation: fadeUp 0.4s ease;
  transition: border-color 0.2s;
}
.variant-card:hover { border-color: #2a2a5a; }
.variant-card.top-pick { border-color: var(--accent); }

.top-pick-badge {
  position: absolute;
  top: -10px;
  left: 20px;
  background: linear-gradient(90deg, var(--accent), var(--red));
  border-radius: 99px;
  padding: 2px 12px;
  font-size: 10px;
  font-family: var(--mono);
  letter-spacing: 2px;
  color: #000;
  font-weight: 700;
  text-transform: uppercase;
}

.variant-inner { display: flex; gap: 14px; align-items: flex-start; }

.score-ring-wrap { flex-shrink: 0; margin-top: 4px; }

.variant-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.variant-num {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--dim);
  text-transform: uppercase;
}
.variant-hook {
  font-size: 11px;
  background: #12122a;
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 2px 8px;
  color: var(--muted);
  font-family: var(--mono);
}
.variant-tag {
  font-size: 10px;
  background: #0f1a0f;
  border: 1px solid #1a3a1a;
  border-radius: 6px;
  padding: 2px 8px;
  color: var(--green);
  font-family: var(--mono);
}

.variant-text {
  color: #ddd;
  font-size: 14px;
  line-height: 1.75;
  font-family: Georgia, serif;
  white-space: pre-wrap;
  margin: 0 0 10px;
  max-height: 110px;
  overflow: hidden;
  position: relative;
}
.variant-text.expanded { max-height: none; }
.variant-text-fade {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 40px;
  background: linear-gradient(transparent, #0a0a18);
  pointer-events: none;
}

.variant-footer {
  display: flex;
  align-items: center;
  gap: 10px;
}
.variant-chars {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
}
.variant-chars.over { color: #f87171; }
.variant-why {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── ANALYSIS BOX ── */
.analysis-box {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 22px;
  margin-bottom: 26px;
  animation: fadeUp 0.4s ease;
}
.analysis-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.analysis-tip-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 4px;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.analysis-tip {
  color: #ccc;
  font-size: 14px;
  font-family: Georgia, serif;
  line-height: 1.6;
}
.weakness-row {
  display: flex;
  gap: 8px;
  margin-bottom: 5px;
}
.weakness-arrow { color: var(--red); font-family: var(--mono); font-size: 12px; }
.weakness-text { color: #666; font-size: 13px; font-family: Georgia, serif; }

/* ── RESEARCH NOTES ── */
details summary {
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 12px 0;
  user-select: none;
  list-style: none;
}
.research-notes-body {
  background: #0a0a15;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 22px;
  color: #555;
  font-size: 13px;
  font-family: var(--mono);
  line-height: 1.7;
  white-space: pre-wrap;
  max-height: 280px;
  overflow-y: auto;
}

/* ── SUCCESS / ERROR ── */
.success-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 4px;
  color: var(--green);
  text-transform: uppercase;
  margin-bottom: 18px;
}
.error-box {
  background: #1a0a0a;
  border: 1px solid var(--red);
  border-radius: 12px;
  padding: 14px 18px;
  color: var(--red);
  font-family: var(--mono);
  font-size: 12px;
  margin-bottom: 20px;
}

/* ── HINT ── */
.hint-text {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  margin-top: 8px;
}

/* ── TOGGLE EXPAND ── */
.toggle-expand {
  background: none;
  border: none;
  color: var(--dim);
  font-size: 11px;
  font-family: var(--mono);
  cursor: pointer;
  padding: 2px 0 8px;
  letter-spacing: 1px;
}
