:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #5b6761;
  --paper: #f7f6f0;
  --panel: #ffffff;
  --line: #d9ded7;
  --teal: #14746f;
  --blue: #2d5f9a;
  --red: #b3433f;
  --amber: #9f6a16;
  --green: #3d7c4b;
  --shadow: 0 14px 40px rgba(23, 33, 29, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
}

button,
textarea {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  border-color: var(--teal);
}

button.primary {
  border-color: var(--teal);
  background: var(--teal);
  color: white;
}

.app-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 22px clamp(16px, 4vw, 44px) 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  position: sticky;
  top: 0;
  z-index: 3;
  backdrop-filter: blur(12px);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 2.6vw, 2.4rem);
}

h2 {
  font-size: 1rem;
  margin-bottom: 10px;
}

.header-actions,
.report-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(360px, 1.05fr);
  gap: 18px;
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 18px clamp(16px, 4vw, 44px) 24px;
}

.input-pane,
.result-pane {
  min-width: 0;
}

.input-pane {
  display: grid;
  gap: 14px;
}

.field-block,
.audit-section,
.score-strip,
.summary-grid,
.report-actions {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.field-block {
  padding: 14px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 800;
}

textarea {
  width: 100%;
  min-height: 310px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  background: #fbfcfa;
  line-height: 1.48;
}

.field-block p,
footer p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.result-pane {
  display: grid;
  gap: 12px;
}

.score-strip {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 12px;
  padding: 14px;
}

.score-box {
  display: grid;
  place-items: center;
  min-height: 116px;
  border-radius: 8px;
  background: #17211d;
  color: white;
}

.score-box strong {
  font-size: 3rem;
  line-height: 1;
}

.score-box span {
  color: #dbe8e2;
  font-size: 0.86rem;
}

.visual-panel {
  display: grid;
  align-content: center;
  gap: 10px;
  min-width: 0;
}

.visual-panel > span {
  font-weight: 800;
}

.visual-bars {
  display: grid;
  gap: 8px;
}

.bar-row {
  display: grid;
  grid-template-columns: 86px 1fr 34px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  background: #edf1ec;
  overflow: hidden;
}

.bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.bar-row.warn .bar-track i {
  background: var(--red);
}

.bar-row.soft .bar-track i {
  background: var(--amber);
}

.bar-row.neutral .bar-track i {
  background: var(--blue);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 10px;
  gap: 8px;
}

.metric {
  min-height: 74px;
  border-radius: 6px;
  border: 1px solid #e7ebe6;
  padding: 10px;
  display: grid;
  align-content: space-between;
}

.metric span {
  color: var(--muted);
  font-size: 0.84rem;
}

.metric strong {
  font-size: 1.55rem;
}

.audit-section {
  padding: 14px;
}

.next-review {
  display: grid;
  gap: 8px;
  border-left: 5px solid var(--teal);
}

.next-review h2 {
  margin-bottom: 0;
}

.next-review strong {
  color: var(--teal);
  font-size: 1.05rem;
}

.next-review p {
  margin: 0;
  line-height: 1.45;
}

.next-review span {
  color: var(--muted);
  font-size: 0.9rem;
}

details.audit-section summary {
  cursor: pointer;
  font-weight: 800;
}

.issue-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 7px;
}

.issue-list li {
  border-left: 4px solid var(--blue);
  background: #f6f8f7;
  border-radius: 6px;
  padding: 9px 10px;
  overflow-wrap: anywhere;
}

.issue-list li.empty {
  border-left-color: var(--green);
  color: var(--muted);
}

.sentence-list li {
  display: grid;
  gap: 6px;
}

.sentence-list em {
  color: var(--amber);
  font-size: 0.86rem;
  font-style: normal;
  font-weight: 700;
}

.line-pill {
  width: fit-content;
  border-radius: 999px;
  background: #e9f2f1;
  color: var(--teal);
  padding: 2px 8px;
  font-size: 0.78rem;
  font-weight: 800;
}

code {
  color: #1e4f8a;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.compact-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.report-actions {
  padding: 10px;
}

#status-line {
  color: var(--muted);
  font-size: 0.9rem;
}

.markdown-output {
  min-height: 200px;
}

footer {
  padding: 0 clamp(16px, 4vw, 44px) 28px;
}

footer p {
  max-width: 980px;
}

@media (max-width: 880px) {
  .app-header {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .result-pane {
    order: -1;
  }

  textarea {
    min-height: 230px;
  }
}

@media (max-width: 560px) {
  .app-header,
  .workspace,
  footer {
    padding-left: 12px;
    padding-right: 12px;
  }

  .header-actions,
  .report-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .report-actions {
    grid-template-columns: 1fr 1fr;
  }

  #status-line {
    grid-column: 1 / -1;
  }

  button {
    padding: 0 10px;
  }

  .score-strip {
    grid-template-columns: 1fr;
  }

  .score-box {
    min-height: 88px;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bar-row {
    grid-template-columns: 78px 1fr 28px;
  }
}
