:root {
  color-scheme: light;
  --paper: #fbf7ee;
  --surface: #fffdf8;
  --surface-strong: #f2eadc;
  --ink: #17202a;
  --muted: #64707d;
  --line: #ded3c2;
  --navy: #173b63;
  --rust: #a84d2a;
  --green: #177245;
  --amber: #b16b15;
  --shadow: 0 18px 45px rgba(41, 32, 22, 0.09);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(135deg, rgba(23, 59, 99, 0.06), transparent 32%),
    radial-gradient(circle at top right, rgba(168, 77, 42, 0.12), transparent 34rem),
    var(--paper);
  color: var(--ink);
  font-family: "IBM Plex Sans", "Aptos", "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(23, 59, 99, 0.28);
  outline-offset: 3px;
}

.page-shell {
  width: min(1360px, calc(50% + 50% - 36px));
  margin: 0 auto;
  padding: 34px 0 60px;
}

.hero {
  display: grid;
  gap: 24px;
}

.hero-copy {
  display: block;
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--rust);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  max-width: 12ch;
  overflow-wrap: normal;
  font-size: clamp(3.2rem, 5.6vw, 5.7rem);
  line-height: 0.95;
  letter-spacing: -0.055em;
}

.lede {
  max-width: 39rem;
  margin: 18px 0 0;
  color: #3c4856;
  font-size: 1.08rem;
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.92fr) minmax(420px, 1.18fr) minmax(270px, 0.7fr);
  gap: 18px;
  align-items: start;
}

.control-panel,
.result-panel,
.review-rail > section,
.content-grid article,
.detail-section,
.faq-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow);
}

.control-panel,
.result-panel,
.review-rail > section {
  padding: 18px;
}

.control-panel {
  display: grid;
  gap: 18px;
}

.field-stack {
  display: grid;
  gap: 8px;
}

label,
legend {
  color: #273342;
  font-weight: 800;
}

textarea,
select {
  width: calc(50% + 50%);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffaf0;
  color: var(--ink);
}

textarea {
  min-height: 130px;
  padding: 13px;
  resize: vertical;
}

select {
  padding: 11px 12px;
}

.field-note,
.status-note,
.saved-list,
.review-card li {
  color: var(--muted);
  font-size: 0.92rem;
}

.chip-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 9px;
}

.chip,
.action-row button,
.rail-actions button,
.row-actions button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffaf0;
  color: #283444;
  font-weight: 800;
}

.chip {
  padding: 8px 12px;
}

.chip.is-active {
  border-color: var(--navy);
  background: var(--navy);
  color: #fffdf8;
}

.control-row {
  display: grid;
  gap: 8px;
}

.action-row,
.rail-actions,
.row-actions,
.panel-heading,
.mini-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.action-row {
  flex-wrap: wrap;
}

.action-row button,
.rail-actions button {
  padding: 10px 14px;
}

.primary-action {
  border-color: var(--rust) !important;
  background: var(--rust) !important;
  color: white !important;
}

.panel-heading,
.mini-heading {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-heading h2,
.mini-heading h2,
.selected-card h2,
.saved-card h2,
.review-card h2,
.content-grid h2,
.detail-section h2,
.faq-section h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: -0.025em;
}

.status-pill {
  border: 1px solid rgba(23, 114, 69, 0.28);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(23, 114, 69, 0.1);
  color: var(--green);
  font-weight: 800;
  white-space: nowrap;
}

.title-rows {
  display: grid;
  gap: 10px;
}

.title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fffaf0;
}

.title-row.is-selected {
  border-color: rgba(168, 77, 42, 0.7);
  box-shadow: inset 4px 0 0 var(--rust);
}

.title-button {
  display: block;
  width: calc(50% + 50%);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 900;
  text-align: left;
}

.metric-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.metric-line span {
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--surface-strong);
  color: #425061;
  font-size: 0.78rem;
  font-weight: 800;
}

.row-actions {
  flex-direction: column;
  align-items: stretch;
}

.row-actions button {
  padding: 7px 10px;
}

.review-rail {
  display: grid;
  gap: 18px;
}

.selected-card {
  background: #17202a !important;
  color: #fffdf8;
}

.selected-card .eyebrow,
.selected-card dt {
  color: #f0b891;
}

.selected-card h2 {
  font-size: 1.45rem;
}

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

.score-grid div {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  padding: 9px;
}

.score-grid dt,
.score-grid dd {
  margin: 0;
}

.score-grid dd {
  font-size: 1.4rem;
  font-weight: 900;
}

.saved-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
}

.review-card ul {
  margin: 10px 0 0;
  padding-left: 20px;
}

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

.content-grid article,
.detail-section,
.faq-section {
  padding: 22px;
}

.content-grid p,
.detail-section p,
.faq-item p {
  color: #445060;
}

.example-list {
  display: grid;
  gap: 9px;
  padding-left: 20px;
}

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

.faq-section {
  margin-top: 18px;
}

.faq-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.faq-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fffaf0;
}

.faq-item button {
  width: calc(50% + 50%);
  border: 0;
  background: transparent;
  padding: 15px;
  color: var(--ink);
  font-weight: 900;
  text-align: left;
}

.faq-item p {
  margin: 0;
  padding: 0 15px 15px;
}

.faq-item.is-closed p {
  display: none;
}

@media (max-width: 1080px) {
  .hero-copy,
  .tool-grid,
  .content-grid,
  .detail-section {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: calc(50% + 50% - 24px);
    padding-top: 22px;
  }

  h1 {
    font-size: clamp(2.8rem, 14vw, 4rem);
    line-height: 0.92;
  }

  .lede {
    margin-top: 12px;
    font-size: 1rem;
  }

  .control-panel,
  .result-panel,
  .review-rail > section {
    padding: 14px;
  }

  .control-panel {
    gap: 10px;
  }

  textarea {
    min-height: 74px;
  }

  .chip {
    padding: 6px 10px;
  }

  .title-row {
    grid-template-columns: 1fr;
  }

  .row-actions {
    flex-direction: row;
  }

  .panel-heading,
  .mini-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}
