:root {
  --ink: #101113;
  --muted: #626975;
  --line: #d9dde4;
  --paper: #f3f0e9;
  --panel: #ffffff;
  --accent: #e23d2f;
  --accent-dark: #b72f25;
  --teal: #0b7c75;
  --mint: #d8f2ed;
  --blue: #214f93;
  --gold: #f4b741;
  --violet: #6d4bd2;
  --shadow: 0 24px 80px rgba(16, 17, 19, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(216, 242, 237, 0.72) 0%, rgba(216, 242, 237, 0) 34%),
    linear-gradient(225deg, rgba(244, 183, 65, 0.18) 0%, rgba(244, 183, 65, 0) 34%),
    linear-gradient(180deg, #faf8f3, var(--paper)),
    var(--paper);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  padding: 18px 0 34px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 0;
}

.brand,
.nav-actions {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  font-weight: 800;
  font-size: 20px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: white;
}

.nav-actions {
  gap: 20px;
  color: var(--muted);
  font-weight: 600;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(460px, 1.1fr);
  align-items: start;
  gap: 38px;
  padding: 26px 0 0;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  max-width: 700px;
  margin-bottom: 16px;
  font-size: clamp(38px, 4.4vw, 58px);
  line-height: 1.04;
  letter-spacing: 0;
}

.hero-text {
  max-width: 630px;
  color: #39404a;
  font-size: 18px;
  line-height: 1.55;
}

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

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

.hero-proof article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 14px 38px rgba(16, 17, 19, 0.06);
}

.hero-proof span {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.hero-proof strong {
  display: block;
  margin-bottom: 7px;
  font-size: 15px;
  line-height: 1.25;
}

.hero-proof p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.ai-compare {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin-top: 12px;
  border: 1px solid rgba(11, 124, 117, 0.18);
  border-radius: 8px;
  padding: 13px 14px;
  background: var(--mint);
  color: #073d39;
}

.ai-compare span {
  color: #315d59;
  font-weight: 700;
}

.ai-compare strong {
  font-weight: 900;
}

.primary-btn,
.ghost-btn {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 20px;
  cursor: pointer;
  font-weight: 800;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: white;
  box-shadow: 0 12px 24px rgba(226, 61, 47, 0.24);
}

.primary-btn:hover {
  background: var(--accent-dark);
}

.ghost-btn {
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
}

.compact {
  min-height: 42px;
}

.hero-card,
.panel,
.rewrite-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(16, 17, 19, 0.09);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-visual {
  position: relative;
  display: grid;
  gap: 12px;
  align-items: start;
  isolation: isolate;
}

.clarity-stage {
  position: relative;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(16, 17, 19, 0.96), rgba(24, 38, 54, 0.9)),
    #101113;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 32px 90px rgba(16, 17, 19, 0.24);
  overflow: hidden;
}

#clarityScene {
  display: block;
  width: 100%;
  height: 235px;
  background: transparent;
}

#clarityScene.scene-fallback {
  background:
    linear-gradient(135deg, rgba(16, 17, 19, 0.96), rgba(24, 38, 54, 0.9)),
    repeating-linear-gradient(90deg, transparent 0 32px, rgba(255, 255, 255, 0.05) 32px 34px);
}

.scene-label {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  display: grid;
  gap: 2px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.08);
  color: white;
  backdrop-filter: blur(18px);
}

.stage-copy {
  position: absolute;
  right: 16px;
  top: 18px;
  z-index: 2;
  display: grid;
  gap: 5px;
  width: min(260px, 42%);
  color: white;
  text-align: right;
}

.stage-copy span {
  color: #9fb8d8;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.stage-copy strong {
  font-size: 17px;
  line-height: 1.25;
}

.stage-pipeline {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 14px;
  z-index: 2;
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto;
  gap: 10px;
  align-items: center;
}

.stage-pipeline span {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #eef3fb;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.stage-pipeline i {
  display: block;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(226, 61, 47, 0.25), rgba(244, 183, 65, 0.85), rgba(11, 124, 117, 0.85));
}

.scene-label span {
  color: #c9d0da;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.scene-label strong {
  font-size: 28px;
  line-height: 1;
}

.hero-card {
  position: relative;
  z-index: 3;
  overflow: hidden;
  width: 100%;
  margin: 0;
  transform: none;
  backdrop-filter: blur(18px);
}

.preview-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #17191d;
  color: #aab2c0;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.red {
  background: #ff5f57;
}

.yellow {
  background: #ffbd2e;
}

.green {
  background: #28c840;
}

.preview-title {
  margin-left: auto;
  font-size: 13px;
  font-weight: 700;
}

.preview-body {
  padding: 16px;
}

.impact-meter {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  align-items: end;
  margin-bottom: 12px;
  border: 1px solid rgba(33, 79, 147, 0.16);
  border-radius: 8px;
  padding: 12px;
  background: linear-gradient(135deg, #f9fbff, #edf5ff);
}

.impact-meter span,
.impact-meter small {
  color: var(--muted);
  font-weight: 800;
}

.impact-meter strong {
  grid-row: span 2;
  color: var(--blue);
  font-size: 34px;
  line-height: 0.9;
}

.scan-line {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-weight: 800;
}

.scan-line strong {
  color: var(--accent);
}

.scan-bar {
  height: 12px;
  margin: 10px 0 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #eceff3;
}

.scan-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--gold));
}

.preview-message,
.preview-output {
  border-radius: 8px;
  padding: 12px;
  line-height: 1.45;
}

.preview-message {
  background: #f3f4f6;
  color: var(--muted);
}

.preview-output {
  margin-bottom: 0;
  background: var(--mint);
  color: #073d39;
  font-weight: 800;
}

.proof-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.proof-row span {
  border-radius: 999px;
  padding: 8px 10px;
  background: #fff1d7;
  color: #7b5200;
  font-size: 12px;
  font-weight: 900;
}

.tool-section {
  padding: 34px 0 32px;
}

.section-heading {
  max-width: 760px;
  margin-bottom: 18px;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(30px, 3.4vw, 44px);
  line-height: 1.06;
  letter-spacing: 0;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(420px, 1.05fr);
  gap: 16px;
}

.panel {
  padding: 18px;
}

.composer,
.results {
  align-self: start;
}

.results {
  max-height: 760px;
  overflow: auto;
}

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

.panel-head h3 {
  margin-bottom: 5px;
  font-size: 20px;
}

.panel-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.mini-badge,
.status-pill,
.engine-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
}

.mini-badge {
  background: #eef1f5;
  color: #586171;
}

.status-pill {
  background: var(--mint);
  color: var(--teal);
}

.engine-pill {
  background: #edf2ff;
  color: var(--blue);
}

.pill-stack {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

textarea {
  width: 100%;
  min-height: 280px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  outline: none;
  color: var(--ink);
  background: #fbfcfd;
  line-height: 1.6;
}

textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(11, 124, 117, 0.13);
}

.advanced-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.advanced-controls label {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.advanced-controls input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.advanced-controls strong {
  color: var(--ink);
}

.mode-pills {
  display: flex;
  gap: 8px;
}

.mode-pills button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 11px;
  background: white;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.mode-pills button.active {
  border-color: var(--teal);
  background: var(--mint);
  color: var(--teal);
}

.input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

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

.score-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: #fbfcfd;
}

.score-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.score-card strong {
  display: block;
  font-size: 22px;
}

.score-card.dark {
  background: #17191d;
  color: white;
}

.score-card.dark span {
  color: #b8c0ce;
}

.clarity-lab {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: linear-gradient(135deg, #ffffff, #f6f8fb);
}

.meter-row {
  display: grid;
  grid-template-columns: 68px 1fr 42px;
  gap: 12px;
  align-items: center;
}

.meter-row span,
.meter-row strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.meter-row strong {
  color: var(--ink);
  text-align: right;
}

.meter-row div {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ebf0;
}

.meter-row i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--gold), var(--teal));
  transition: width 240ms ease;
}

.insight-block {
  margin-top: 14px;
}

.insight-block h4 {
  margin-bottom: 8px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.insight-block p {
  margin-bottom: 0;
  color: #343b45;
  line-height: 1.6;
}

.highlight-box {
  min-height: 130px;
  max-height: 170px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  background: #fbfcfd;
  color: #343b45;
  line-height: 1.7;
}

.insight-columns {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 12px;
}

.signal-list,
.evidence-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 270px;
  overflow: auto;
}

.signal-list li,
.evidence-list li {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fbfcfd;
  color: #343b45;
  line-height: 1.45;
}

.evidence-list li {
  display: grid;
  gap: 3px;
}

.evidence-list strong {
  color: var(--accent-dark);
}

.evidence-list span {
  color: var(--muted);
  font-size: 13px;
}

.intent-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 0;
}

.intent-switcher button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  background: white;
  color: var(--muted);
  cursor: pointer;
  font-weight: 900;
}

.intent-switcher button.active {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.mark {
  border-radius: 5px;
  padding: 1px 4px;
  background: #ffe1dd;
  color: var(--accent-dark);
  font-weight: 800;
}

.rewrite-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.rewrite-card {
  padding: 16px;
  box-shadow: none;
  opacity: 0.74;
  transition:
    opacity 160ms ease,
    transform 160ms ease,
    border-color 160ms ease;
}

.rewrite-card.active {
  border-color: rgba(226, 61, 47, 0.45);
  opacity: 1;
  transform: translateY(-4px);
  box-shadow: 0 20px 60px rgba(226, 61, 47, 0.14);
}

.rewrite-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.rewrite-head span {
  display: inline-block;
  margin-bottom: 0;
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.rewrite-head button {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  background: white;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.rewrite-head button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.rewrite-card p {
  margin-bottom: 0;
  color: #20252d;
  line-height: 1.65;
}

.command-center {
  display: grid;
  grid-template-columns: minmax(260px, 0.7fr) 1fr;
  gap: 18px;
  align-items: stretch;
  margin-top: 14px;
  border-radius: 8px;
  padding: 18px;
  background: #17191d;
  color: white;
  box-shadow: var(--shadow);
}

.command-center h3 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.12;
}

.impact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.impact-grid article {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.06);
}

.impact-grid span {
  color: #b8c0ce;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.impact-grid strong {
  display: block;
  margin: 8px 0;
  font-size: 24px;
}

.impact-grid p {
  margin-bottom: 0;
  color: #c6ccd6;
  font-size: 13px;
  line-height: 1.45;
}

.feature-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: center;
  margin: 28px 0 42px;
  padding: 28px;
  border-radius: 8px;
  background: #14161a;
  color: white;
}

.feature-strip h3 {
  margin-bottom: 8px;
  font-size: 28px;
}

.feature-strip p {
  margin-bottom: 0;
  color: #c6ccd6;
  line-height: 1.7;
}

.feature-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.feature-list span {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.06);
  font-weight: 800;
}

@media (max-width: 920px) {
  .hero-grid,
  .workspace,
  .command-center,
  .feature-strip {
    grid-template-columns: 1fr;
  }

  .score-grid,
  .impact-grid,
  .rewrite-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero-grid {
    padding-top: 28px;
  }

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

  .hero-card {
    transform: none;
    width: 100%;
    margin-top: 0;
  }

  .feature-list {
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
  }

  .nav-actions {
    display: none;
  }

  .hero {
    padding-bottom: 26px;
  }

  .hero-text {
    font-size: 16px;
  }

  .score-grid,
  .rewrite-grid,
  .impact-grid,
  .insight-columns {
    grid-template-columns: 1fr;
  }

  #clarityScene {
    height: 220px;
  }

  .stage-copy {
    position: static;
    width: auto;
    padding: 0 16px 12px;
    text-align: left;
  }

  .stage-pipeline {
    position: static;
    grid-template-columns: 1fr;
    padding: 0 16px 16px;
  }

  .stage-pipeline i {
    display: none;
  }

  .advanced-controls,
  .advanced-controls label {
    grid-template-columns: 1fr;
  }

  .mode-pills {
    flex-wrap: wrap;
  }

  .panel,
  .preview-body,
  .feature-strip {
    padding: 18px;
  }

  textarea {
    min-height: 250px;
  }

  .input-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .compact {
    width: 100%;
  }
}
