:root {
  --bg: #f5efe4;
  --panel: rgba(16, 22, 32, 0.9);
  --panel-soft: rgba(27, 36, 50, 0.8);
  --ink: #f7f2e8;
  --muted: #c9c0b2;
  --accent: #f2673a;
  --accent-soft: #ffb37f;
  --line: rgba(255, 255, 255, 0.12);
  --shadow: 0 24px 70px rgba(16, 19, 24, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(242, 103, 58, 0.22), transparent 24rem),
    radial-gradient(circle at bottom right, rgba(52, 88, 152, 0.18), transparent 22rem),
    linear-gradient(135deg, #efe2cb 0%, #f7f2ea 48%, #efe8dc 100%);
  color: #131722;
}

.page-shell {
  width: min(1600px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: end;
  margin-bottom: 24px;
}

.hero-copy,
.hero-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 28px;
  color: #182130;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.64), rgba(255, 250, 243, 0.54)),
    linear-gradient(120deg, rgba(242, 103, 58, 0.14), rgba(255, 255, 255, 0));
}

.hero-card {
  padding: 24px;
  background: var(--panel);
  color: var(--ink);
}

.hero-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.meta-pill {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
}

.meta-pill span,
.text-meta {
  color: var(--muted);
  font-size: 0.84rem;
}

.meta-pill strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: 0.96rem;
}

.eyebrow,
.panel-label {
  margin: 0 0 8px;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow {
  color: #8e593f;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-family: "Avenir Next Condensed", "Avenir Next", sans-serif;
  font-size: clamp(2.8rem, 6vw, 5.1rem);
  line-height: 0.94;
  letter-spacing: -0.05em;
}

.hero-text {
  margin-top: 14px;
  max-width: 46rem;
  line-height: 1.5;
  color: #314258;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(242, 103, 58, 0.16);
  color: var(--accent-soft);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

#statusMessage {
  margin-top: 18px;
  color: var(--muted);
  line-height: 1.5;
}

.workspace {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.panel {
  background: var(--panel-soft);
  color: var(--ink);
  padding: 22px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-history {
  grid-column: 1 / -1;
}

.panel-curation {
  grid-column: 1 / -1;
}

.panel h2 {
  font-size: 1.45rem;
  letter-spacing: -0.03em;
}

.control-stack {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.style-picker {
  display: grid;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

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

select,
input,
textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  background: rgba(10, 14, 21, 0.58);
  color: var(--ink);
}

select {
  min-width: 140px;
  padding: 12px 14px;
}

input {
  padding: 14px 16px;
}

textarea {
  min-height: 420px;
  padding: 18px;
  resize: vertical;
  line-height: 1.55;
}

textarea::placeholder {
  color: rgba(247, 242, 232, 0.42);
}

.instruction-box {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.text-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.text-meta.split {
  align-items: center;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.count-pill {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(242, 103, 58, 0.16);
  color: var(--accent-soft);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  cursor: pointer;
  transition: transform 180ms ease, opacity 180ms ease, background 180ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

#rewriteButton {
  background: linear-gradient(135deg, var(--accent), #ff9c5b);
  color: #1a1010;
  font-weight: 700;
}

#saveCuratedButton {
  background: linear-gradient(135deg, #ffb14a, #ffd483);
  color: #23180f;
  font-weight: 700;
}

button.secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  padding: 14px 18px;
  text-decoration: none;
  transition: transform 180ms ease, opacity 180ms ease, background 180ms ease;
}

.nav-link:hover {
  transform: translateY(-1px);
}

.nav-link.primary {
  background: linear-gradient(135deg, var(--accent), #ff9c5b);
  color: #1a1010;
  font-weight: 700;
}

.nav-link.inline-link {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

button.ghost {
  background: rgba(255, 255, 255, 0.04);
}

.warning-box {
  margin-top: 16px;
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(242, 103, 58, 0.1);
  border: 1px solid rgba(242, 103, 58, 0.24);
  color: #ffd7be;
  line-height: 1.45;
}

.curation-textarea {
  min-height: 240px;
}

.history-empty {
  border-radius: 20px;
  padding: 18px;
  margin-top: 15px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.history-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.curated-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.history-item {
  display: block;
  width: 100%;
  border: 0;
  text-align: left;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
}

.curated-item {
  display: block;
  width: 100%;
  border: 0;
  text-align: left;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 218, 165, 0.08);
  color: var(--ink);
}

.history-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: var(--accent-soft);
}

.curated-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: #ffd483;
}

.history-item p {
  color: var(--ink);
  line-height: 1.45;
}

.curated-item p {
  color: var(--ink);
  line-height: 1.45;
}

.history-item small {
  display: block;
  margin-top: 12px;
  color: var(--muted);
}

.curated-item small {
  display: block;
  margin-top: 12px;
  color: var(--muted);
}

.panel-actions.compact {
  margin-top: 0;
}

.detector-workspace {
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  align-items: start;
}

.detector-sidebar,
.detector-main {
  min-height: 100%;
}

.detector-sidebar {
  position: sticky;
  top: 24px;
}

.detector-notes {
  margin-top: 16px;
  white-space: pre-line;
}

.detector-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.detector-item-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 16px;
  border-radius: 22px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
}

.detector-item-card.active {
  outline: 2px solid rgba(255, 179, 127, 0.55);
}

.detector-item-card.strong-pass {
  background: rgba(111, 214, 132, 0.13);
}

.detector-item-card.borderline {
  background: rgba(255, 198, 84, 0.11);
}

.detector-item-card.fail {
  background: rgba(242, 103, 58, 0.12);
}

.detector-meta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.88rem;
}

.detector-text-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.detector-text-grid textarea {
  min-height: 320px;
}

.detector-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.detector-field {
  text-transform: uppercase;
}

.detector-field input {
  margin-top: 8px;
}

.quality-grid {
  margin-top: 16px;
}

.detector-notes-area {
  min-height: 140px;
}

.verdict-strong-pass {
  background: rgba(111, 214, 132, 0.16);
  color: #dafadb;
}

.verdict-borderline {
  background: rgba(255, 198, 84, 0.18);
  color: #ffe5a6;
}

.verdict-fail {
  background: rgba(242, 103, 58, 0.16);
  color: #ffd7be;
}

@media (max-width: 900px) {
  .hero,
  .workspace,
  .detector-workspace,
  .detector-text-grid,
  .detector-form-grid {
    grid-template-columns: 1fr;
  }

  .detector-sidebar {
    position: static;
  }

  .hero-meta {
    grid-template-columns: 1fr;
  }

  textarea {
    min-height: 280px;
  }
}
