:root {
  color-scheme: light;
  --font-display: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  --font-ui: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --color-page-bg: #F7F4EE;
  --color-workspace-bg: #FFFFFF;
  --color-panel-bg: #FFFFFF;
  --color-source-reading-bg: #FFF9F2;
  --color-result-reading-bg: #F2F7FB;
  --color-review-bg: #F5F6F7;
  --color-text: #202421;
  --color-text-muted: #626A65;
  --color-border: #D9DDD9;
  --color-border-soft: #E4E8E5;
  --color-brand: #007A63;
  --color-brand-hover: #005F4E;
  --color-source-accent: #C46F4A;
  --color-result-accent: #3E7FA6;
  --color-bronze: #8A6A32;
  --color-bronze-dark: #765A2A;
  --color-focus-ring: #0EA5E9;
  --color-pending-bg: #FFF0C9;
  --color-pending: #C98200;
  --color-applied-bg: #F3D9DE;
  --color-applied: #B65364;
  --color-ignored-bg: #D6DEE4;
  --color-ignored: #3F5F70;
  --background: var(--color-page-bg);
  --surface: var(--color-panel-bg);
  --surface-soft: var(--color-review-bg);
  --text: var(--color-text);
  --muted: var(--color-text-muted);
  --border: var(--color-border);
  --accent: var(--color-brand);
  --accent-dark: var(--color-brand-hover);
  --accent-soft: #EBF7F2;
  --warning-bg: #FFF4DC;
  --warning-border: #E4C67C;
  --danger: #A33B35;
  --focus: var(--color-focus-ring);
  --shadow: 0 16px 45px rgba(30, 39, 33, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--color-page-bg);
  color: var(--color-text);
  font-family: var(--font-ui);
  font-weight: 400;
  line-height: 1.55;
}

button,
textarea,
input {
  font: inherit;
}

.page {
  width: min(100% - 32px, 1440px);
  margin: 0 auto;
  padding: 30px 0 34px;
}

.intro {
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 650;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 8px;
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 5vw, 3.1rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.lead {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 1.12rem;
}

.privacy-note {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 10px 14px;
  border: 1px solid #C8DDE2;
  border-radius: 12px;
  background: #EEF6F7;
  color: #264E59;
}

.privacy-note strong {
  flex: 0 0 auto;
}

.privacy-note span {
  min-width: 0;
}

.workspace,
.limits {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--color-panel-bg);
  box-shadow: var(--shadow);
}

.workspace {
  background: var(--color-workspace-bg);
  padding: clamp(16px, 2.4vw, 24px);
}

.field-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.panel-header.field-heading {
  align-items: flex-start;
  margin-bottom: 0;
}

.field-heading label {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
}

.field-heading p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.counter {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.82rem;
}

.text-panel textarea {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 18px 20px;
  resize: none;
  border: 1px solid var(--color-border-soft);
  border-radius: 10px;
  background: var(--color-source-reading-bg);
  color: var(--text);
  font-size: 0.96rem;
  line-height: 1.65;
  overflow-x: hidden;
  overflow-y: auto;
  box-sizing: border-box;
}

.text-preview {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 18px 20px;
  border: 1px solid var(--color-border-soft);
  border-radius: 10px;
  background: var(--color-source-reading-bg);
  color: var(--text);
  font: inherit;
  font-size: 0.96rem;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow-x: hidden;
  overflow-y: auto;
  box-sizing: border-box;
}

#sourcePreview,
#sourceText {
  background: var(--color-source-reading-bg);
}

#resultPreview,
#resultText {
  background: var(--color-result-reading-bg);
}

.result-highlight-notice {
  width: 100%;
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.text-highlight {
  border-radius: 4px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.text-highlight--pending {
  background: var(--color-pending-bg);
  box-shadow: inset 0 -2px 0 var(--color-pending);
}

.text-highlight--applied {
  background: var(--color-applied-bg);
  color: inherit;
  box-shadow: inset 0 -3px 0 var(--color-applied);
  text-decoration-line: underline;
  text-decoration-style: solid;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--color-applied);
  text-underline-offset: 2px;
}

.text-highlight--ignored {
  background: var(--color-ignored-bg);
  border-bottom: 2px dashed var(--color-ignored);
  color: inherit;
  box-shadow: none;
  text-decoration: none;
}

.text-highlight.is-located {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: 2px;
  border-radius: 4px;
  animation: located-highlight-pulse 1.5s ease-out;
}

.text-highlight--pending.is-located {
  box-shadow:
    inset 0 -2px 0 var(--color-pending),
    0 0 0 1px rgba(255, 255, 255, 0.95);
}

.text-highlight--applied.is-located {
  box-shadow:
    inset 0 -3px 0 var(--color-applied),
    0 0 0 1px rgba(255, 255, 255, 0.95);
}

.text-highlight--ignored.is-located {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.95);
  border-bottom: 2px dashed var(--color-ignored);
}

@keyframes located-highlight-pulse {
  0% {
    outline-color: var(--color-focus-ring);
  }

  100% {
    outline-color: var(--color-focus-ring);
  }
}

.source-text {
  min-height: 0;
}

textarea:focus,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: 2px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 12px 16px;
  margin-bottom: 12px;
}

.option-card {
  display: grid;
  grid-template-columns: minmax(280px, auto) minmax(240px, 1fr) auto;
  align-items: center;
  column-gap: 24px;
  row-gap: 6px;
  min-width: 0;
  margin-top: 0;
  padding: 12px 14px;
  border: 1px solid var(--warning-border);
  border-radius: 12px;
  background: var(--warning-bg);
  color: #302D27;
}

.check-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  cursor: pointer;
  min-width: 0;
}

.check-row input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--accent);
}

.check-row span {
  min-width: 0;
}

.check-row strong,
.option-short-warning {
  display: block;
}

.option-short-warning {
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: normal;
  line-height: 1.3;
}

.check-row small {
  display: none;
}

.option-short-warning,
.warning {
  color: var(--color-bronze-dark);
}

.option-details {
  margin: 0;
  color: var(--color-bronze-dark);
  font-size: 0.9rem;
  white-space: nowrap;
}

.option-details[open] {
  grid-column: 1 / -1;
}

.option-details .warning {
  white-space: normal;
}

.option-details summary,
.limits summary {
  width: fit-content;
  cursor: pointer;
  font-weight: 700;
}

.option-details summary {
  color: var(--color-bronze-dark);
}

.warning {
  margin: 8px 0 0;
  font-size: 0.9rem;
}

.paragraph-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.edit-button {
  margin-top: 10px;
}

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

.primary-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 18px;
  justify-content: flex-end;
  align-self: center;
  min-width: 0;
  margin-top: 0;
}

.toolbar-feedback {
  grid-column: 1 / -1;
  justify-self: end;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  min-width: 0;
}

.toolbar-feedback:empty {
  display: none;
}

.primary-actions {
  flex: 0 0 auto;
}

.workspace-expand-button {
  display: inline-flex;
}

.button {
  min-height: 46px;
  padding: 10px 17px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 650;
  transition: background-color 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.button:active {
  transform: translateY(1px);
}

.button-primary {
  background: var(--accent);
  color: #fff;
}

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

.button-secondary {
  border-color: var(--color-border);
  background: var(--surface);
  color: var(--text);
}

.button-secondary:hover,
.button-quiet:hover {
  background: var(--color-workspace-bg);
}

.button-quiet {
  border-color: var(--border);
  background: var(--surface);
  color: var(--accent);
}

.button-quiet:hover {
  border-color: var(--color-border);
  background: #F0F4F1;
}

.status {
  min-height: 1.5em;
  margin: 0;
  color: var(--accent-dark);
  font-weight: 650;
}

.toolbar-feedback .status:empty {
  display: none;
}

.status.is-error {
  color: var(--danger);
}

.undo-clear {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 0;
  color: var(--accent-dark);
  font-weight: 650;
}

.undo-clear-status {
  color: var(--muted);
}

.undo-clear-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 4px 6px 4px 4px;
  border: 1px solid #b9d8c9;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  cursor: pointer;
  font-weight: 650;
}

.undo-clear-button:hover {
  color: var(--accent-dark);
}

.undo-clear-circle {
  display: grid;
  place-items: center;
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent-dark);
  line-height: 1;
}

.undo-clear-ring {
  position: absolute;
  inset: 0;
  width: 44px;
  height: 44px;
  transform: rotate(-90deg);
}

.undo-clear-ring-track,
.undo-clear-ring-progress {
  fill: none;
  stroke-width: 4.5;
}

.undo-clear-ring-track {
  stroke: #C8DDD3;
}

.undo-clear-ring-progress {
  stroke: var(--accent);
  stroke-dasharray: 113.1;
  stroke-dashoffset: 112;
  stroke-linecap: round;
}

.undo-clear.is-active .undo-clear-ring-progress {
  animation: undo-ring-progress 12s linear forwards;
}

.undo-clear-arrow {
  position: relative;
  z-index: 1;
  color: var(--accent-dark);
  font-size: 1.25rem;
}

.undo-clear-text {
  padding-right: 4px;
}

@keyframes undo-ring-progress {
  from {
    stroke-dashoffset: 112;
  }

  to {
    stroke-dashoffset: 0;
  }
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.workspace-grid.has-result {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.workspace-grid.has-review {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(320px, 0.85fr);
}

body.workspace-expanded {
  overflow: hidden;
}

.workspace.is-expanded {
  position: fixed;
  inset: 12px;
  z-index: 1000;
  width: auto;
  max-width: none;
  height: calc(100vh - 24px);
  height: calc(100dvh - 24px);
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #FFFFFF;
  box-shadow: 0 18px 60px rgba(31, 42, 38, 0.18);
}

.workspace.is-expanded .toolbar {
  flex: 0 0 auto;
}

.workspace.is-expanded .workspace-grid {
  flex: 1 1 auto;
  min-height: 0;
}

.workspace.is-expanded .summary {
  flex: 0 0 auto;
}

.workspace.is-expanded .workspace-grid .text-panel,
.workspace.is-expanded .workspace-grid .review-panel,
.workspace.is-expanded .workspace-grid.has-review .review-panel {
  height: 100%;
  min-height: 0;
}

.workspace.is-expanded .workspace-grid:not(.has-result) .source-panel {
  height: 100%;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.workspace.is-expanded .workspace-grid:not(.has-result) #sourceText {
  height: 100%;
  min-height: 0;
}

.text-panel,
.review-panel {
  min-width: 0;
  max-width: 100%;
  min-height: 0;
  height: clamp(460px, calc(100vh - 270px), 710px);
  height: clamp(460px, calc(100dvh - 270px), 710px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.result-section {
  margin-top: 0;
  padding-top: 0;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 0;
}

.result-panel-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-header {
  height: 96px;
  min-height: 96px;
  padding: 14px 16px;
  box-sizing: border-box;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.source-panel .panel-header {
  box-shadow: inset 3px 0 0 var(--color-source-accent);
}

.result-panel .panel-header,
.result-section .panel-header {
  box-shadow: inset 3px 0 0 var(--color-result-accent);
}

.panel-body {
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 14px 16px;
  box-sizing: border-box;
}

.text-panel .panel-body {
  overflow: hidden;
  background: var(--color-workspace-bg);
}

.panel-footer {
  min-height: 88px;
  padding: 12px 16px 16px;
  box-sizing: border-box;
  border-top: 1px solid var(--border);
}

.summary {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  padding: 8px 14px;
  border-radius: 12px;
  background: #F6F7F4;
}

@media (min-width: 761px) {
  .workspace-grid:not(.has-result) .source-panel {
    height: auto;
    grid-template-rows: auto auto auto;
  }

  .workspace-grid:not(.has-result) .source-panel .panel-header {
    height: auto;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px 14px;
    padding: 10px 14px;
  }

  .workspace-grid:not(.has-result) .source-panel .panel-header > div {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px 12px;
    min-width: 0;
  }

  .workspace-grid:not(.has-result) .source-panel .panel-header p {
    margin: 0;
  }

  .workspace-grid:not(.has-result) .source-panel .panel-body {
    padding: 12px 14px;
  }

  .workspace-grid:not(.has-result) #sourceText {
    height: clamp(300px, 42vh, 430px);
    height: clamp(300px, 42dvh, 430px);
    min-height: clamp(300px, 42vh, 430px);
    min-height: clamp(300px, 42dvh, 430px);
  }

  .workspace-grid:not(.has-result) .source-panel .panel-footer {
    min-height: 0;
    padding: 10px 14px 12px;
  }
}

.review-panel {
  min-width: 0;
  max-width: 100%;
  background: var(--color-review-bg);
  grid-template-rows: 96px minmax(0, 1fr);
  overflow-x: hidden;
  overflow-y: hidden;
  box-sizing: border-box;
}

.review-panel-header {
  background: var(--color-review-bg);
}

.review-panel h2 {
  margin: 0;
  font-size: 1.05rem;
}

.review-panel-note {
  margin: 5px 0 0;
  color: var(--color-text-muted);
  font-size: 0.88rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.review-content,
.hyphen-review,
.hyphen-list {
  min-width: 0;
  max-width: 100%;
}

.review-panel .panel-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-top: 8px;
  overflow: hidden;
}

#reviewContent {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: hidden;
  box-sizing: border-box;
}

.summary h2 {
  flex: 0 0 auto;
  margin: 0;
  font-size: 0.98rem;
}

.summary-line {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.summary p:last-child,
.limits p:last-child {
  margin-bottom: 0;
}

.joined-list {
  margin: 8px 0 0;
  padding-left: 22px;
}

.joined-words {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.joined-words h3 {
  margin: 0;
  font-size: 0.98rem;
}

.joined-list code {
  white-space: normal;
  color: #3f493f;
}

.summary-warning {
  margin: 8px 0 0;
  color: var(--color-text-muted);
  font-size: 0.88rem;
  line-height: 1.45;
  font-weight: 400;
}

.hyphen-review {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  margin-top: 0;
  padding-top: 0;
}

.hyphen-controls {
  flex: 0 0 auto;
  display: grid;
  gap: 6px;
  margin-top: 0;
  min-width: 0;
  max-width: 100%;
}

.hyphen-controls .button {
  min-height: 40px;
  padding: 7px 10px;
  max-width: 100%;
  white-space: normal;
}

.hyphen-controls > .button-primary {
  width: 100%;
}

.hyphen-list {
  display: grid;
  flex: 1 1 auto;
  gap: 7px;
  margin-top: 10px;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.hyphen-item {
  min-width: 0;
  max-width: 100%;
  height: auto;
  max-height: none;
  padding: 9px 10px;
  border: 1px solid #E1E4E6;
  border-radius: 10px;
  background: var(--color-panel-bg);
  overflow: visible;
}

.hyphen-item-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.hyphen-item-main--applied {
  grid-template-columns: minmax(0, 1fr) auto;
}

.hyphen-check {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.hyphen-original {
  min-width: 0;
  font-size: 0.95rem;
  line-height: 1.3;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.hyphen-locate {
  width: fit-content;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: #216B8C;
  text-align: left;
  cursor: pointer;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: #76A8BE;
  text-underline-offset: 0.18em;
}

.hyphen-locate:hover {
  color: #164F6A;
  text-decoration-color: #164F6A;
}

.hyphen-arrow {
  display: none;
  color: var(--muted);
}

.hyphen-suggestion-label {
  display: none;
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.3;
}

.hyphen-suggestion {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  min-height: 38px;
  margin-top: 7px;
  padding: 6px 8px;
  border: 1px solid var(--color-border-soft);
  border-radius: 8px;
  font-size: 0.95rem;
}

.hyphen-applied {
  color: #9A4050;
  font-size: 0.83rem;
  line-height: 1.3;
  font-weight: 700;
}

.hyphen-pending {
  color: var(--color-pending);
  font-size: 0.83rem;
  line-height: 1.3;
  font-weight: 700;
}

.hyphen-not-applied {
  color: var(--color-ignored);
  font-size: 0.83rem;
  line-height: 1.3;
  font-weight: 700;
}

.hyphen-review-status {
  color: #5B6470;
  font-size: 0.83rem;
  line-height: 1.3;
  font-weight: 700;
}

.hyphen-undo {
  max-width: 100%;
  min-height: 40px;
  padding: 6px 10px;
  font-size: 0.84rem;
  white-space: normal;
}

.hyphen-item-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin-top: 7px;
  min-width: 0;
}

.hyphen-risk-note {
  min-width: 0;
  max-width: 100%;
  margin: 4px 0 0;
  color: #8B5A16;
  font-size: 0.82rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.limits {
  margin-top: 16px;
  padding: 20px 22px;
  box-shadow: none;
}

.limits summary {
  font-size: 1.02rem;
}

.limits p {
  margin-top: 10px;
  color: var(--muted);
}

.ad-slot {
  margin: 0;
  padding: 0;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 22px;
  padding: 16px 2px 0;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.site-footer p {
  margin: 0;
}

.site-footer-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.site-footer a,
.legal-page a {
  color: #216B8C;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: #76A8BE;
  text-underline-offset: 0.18em;
}

.site-footer a:hover,
.legal-page a:hover {
  color: #164F6A;
  text-decoration-color: #164F6A;
}

.legal-page {
  width: min(100% - 32px, 920px);
}

.legal-back {
  margin: 0 0 14px;
  font-weight: 650;
}

.legal-card {
  padding: 28px;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background: var(--color-panel-bg);
  box-shadow: var(--shadow);
}

.legal-card h1 {
  max-width: none;
  margin-bottom: 20px;
}

.legal-card h2 {
  margin: 24px 0 8px;
  font-size: 1.12rem;
}

.legal-card p {
  color: var(--color-text);
  overflow-wrap: anywhere;
}

.legal-updated {
  margin: 26px 0 0;
  color: var(--color-text-muted);
  font-size: 0.92rem;
}

[hidden] {
  display: none !important;
}

.workspace.is-expanded {
  padding: 10px 12px;
}

.workspace.is-expanded .toolbar {
  gap: 8px;
  margin-bottom: 8px;
}

.workspace.is-expanded .toolbar-feedback {
  gap: 8px;
  line-height: 1.25;
}

.workspace.is-expanded .status {
  min-height: 0;
  line-height: 1.25;
}

.workspace.is-expanded .option-card {
  padding: 9px 12px;
  row-gap: 4px;
}

.workspace.is-expanded .button {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.9rem;
  line-height: 1.2;
}

.workspace.is-expanded .panel-header {
  height: auto;
  min-height: 0;
  padding: 10px 14px;
}

.workspace.is-expanded .review-panel {
  grid-template-rows: auto minmax(0, 1fr);
}

.workspace.is-expanded .review-panel .panel-header {
  height: auto;
  min-height: 0;
  padding: 10px 14px;
}

.workspace.is-expanded .review-panel-note {
  margin: 3px 0 0;
  font-size: 0.82rem;
  line-height: 1.25;
}

.workspace.is-expanded .review-panel .panel-body {
  padding-top: 8px;
}

.workspace.is-expanded .panel-header p {
  font-size: 0.84rem;
  line-height: 1.3;
}

.workspace.is-expanded .panel-body {
  min-height: 0;
  padding: 10px 12px;
}

.workspace.is-expanded .text-panel .panel-body {
  flex: 1 1 auto;
}

.workspace.is-expanded .text-preview,
.workspace.is-expanded .text-panel textarea {
  min-height: 0;
  padding: 14px 16px;
  font-size: 0.95rem;
  line-height: 1.58;
}

.workspace.is-expanded .source-panel .panel-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 12px;
  min-height: 0;
  padding: 8px 14px;
}

.workspace.is-expanded .source-panel .panel-footer p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.3;
}

.workspace.is-expanded .edit-button {
  margin-top: 0;
}

.workspace.is-expanded .result-panel-footer {
  gap: 6px;
  min-height: 0;
  padding: 8px 12px;
}

.workspace.is-expanded .result-highlight-notice {
  margin: 0 0 6px;
  font-size: 0.8rem;
  line-height: 1.3;
}

.workspace.is-expanded .result-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.workspace.is-expanded .result-actions .button {
  width: 100%;
  min-width: 0;
  white-space: normal;
}

.workspace.is-expanded .hyphen-controls {
  gap: 6px;
  margin: 0 0 6px;
}

.workspace.is-expanded .hyphen-controls .button {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 0.9rem;
}

.workspace.is-expanded .hyphen-controls > .button-primary {
  min-height: 38px;
}

.workspace.is-expanded .hyphen-list {
  gap: 6px;
  margin-top: 6px;
}

.workspace.is-expanded .hyphen-item {
  padding: 8px 10px;
}

.workspace.is-expanded .hyphen-item-main {
  gap: 5px;
}

.workspace.is-expanded .hyphen-original,
.workspace.is-expanded .hyphen-locate {
  font-size: 0.9rem;
  line-height: 1.25;
}

.workspace.is-expanded .hyphen-suggestion {
  min-height: 34px;
  margin-top: 5px;
  padding: 5px 9px;
  font-size: 0.9rem;
}

.workspace.is-expanded .hyphen-undo {
  min-height: 34px;
  padding: 5px 9px;
  font-size: 0.84rem;
}

.workspace.is-expanded .hyphen-item-meta {
  gap: 5px 8px;
  margin-top: 5px;
}

.workspace.is-expanded .hyphen-risk-note,
.workspace.is-expanded .hyphen-applied,
.workspace.is-expanded .hyphen-pending,
.workspace.is-expanded .hyphen-not-applied,
.workspace.is-expanded .hyphen-review-status {
  font-size: 0.78rem;
  line-height: 1.25;
}

.workspace.is-expanded .summary {
  min-height: 42px;
  margin-top: 8px;
  padding: 8px 14px;
}

@media (min-width: 1280px) {
  .workspace.is-expanded .hyphen-item {
    display: grid;
    grid-template-columns: auto minmax(125px, 0.9fr) minmax(180px, 1.25fr) max-content;
    align-items: center;
    column-gap: 6px;
    row-gap: 6px;
  }

  .workspace.is-expanded .hyphen-item-main {
    display: contents;
  }

  .workspace.is-expanded .hyphen-check {
    grid-column: 1;
    grid-row: 1;
  }

  .workspace.is-expanded .hyphen-locate {
    grid-column: 2;
    grid-row: 1;
    width: auto;
    min-width: 0;
  }

  .workspace.is-expanded .hyphen-item-main--applied .hyphen-locate {
    grid-column: 1 / 3;
  }

  .workspace.is-expanded .hyphen-suggestion {
    grid-column: 3;
    grid-row: 1;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding-inline: 8px;
    font-size: 0.86rem;
  }

  .workspace.is-expanded .hyphen-applied,
  .workspace.is-expanded .hyphen-pending,
  .workspace.is-expanded .hyphen-not-applied,
  .workspace.is-expanded .hyphen-review-status {
    grid-column: 4;
    grid-row: 1;
    justify-self: end;
    white-space: nowrap;
    font-size: 0.76rem;
  }

  .workspace.is-expanded .hyphen-item-meta {
    grid-column: 1 / -1;
    margin-top: 0;
  }
}

@media (max-height: 800px) and (min-width: 761px) {
  .page {
    padding-top: 20px;
    padding-bottom: 28px;
  }

  .intro {
    margin-bottom: 12px;
  }

  .eyebrow {
    margin-bottom: 3px;
  }

  h1 {
    margin-bottom: 6px;
  }

  .lead {
    margin-bottom: 9px;
  }

  .privacy-note {
    padding: 8px 12px;
  }

  .workspace {
    padding: 14px;
  }

  .toolbar {
    gap: 8px 12px;
    margin-bottom: 10px;
  }

  .option-card {
    padding: 10px 12px;
  }

  .text-panel,
  .review-panel {
    height: clamp(410px, calc(100vh - 235px), 610px);
    height: clamp(410px, calc(100dvh - 235px), 610px);
  }

  .workspace-grid:not(.has-result) #sourceText {
    height: clamp(260px, 38vh, 360px);
    height: clamp(260px, 38dvh, 360px);
    min-height: clamp(260px, 38vh, 360px);
    min-height: clamp(260px, 38dvh, 360px);
  }
}

@media (max-width: 620px) {
  .page {
    width: min(100% - 22px, 920px);
    padding-top: 28px;
  }

  .privacy-note {
    display: block;
  }

  .privacy-note strong {
    display: block;
  }

  .field-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .option-card {
    grid-template-columns: 1fr;
    row-gap: 8px;
  }

  .check-row {
    grid-column: auto;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: flex-start;
  }

  .check-row input {
    margin-top: 2px;
  }

  .check-row span {
    grid-column: auto;
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .option-details {
    white-space: normal;
  }

  textarea {
    height: clamp(260px, 48vh, 520px);
    min-height: 210px;
  }

  .source-text {
    min-height: 150px;
  }

  .actions .button {
    width: 100%;
  }

  .hyphen-controls .button {
    width: 100%;
  }

  .option-details {
    grid-column: auto;
    margin-left: 0;
  }
}

@media (max-width: 1180px) {
  .workspace-grid.has-review {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .workspace-grid.has-review .review-panel {
    grid-column: 1 / -1;
    height: clamp(360px, 50vh, 560px);
  }

  .summary {
    align-items: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 1040px) and (min-width: 761px) {
  .toolbar {
    grid-template-columns: 1fr;
  }

  .primary-row {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .toolbar,
  .primary-row {
    align-items: stretch;
  }

  .workspace-expand-button {
    display: none;
  }

  .toolbar {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .toolbar-feedback {
    width: 100%;
    justify-content: flex-start;
  }

  .privacy-note {
    display: block;
  }

  .privacy-note strong {
    display: block;
  }

  .panel-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 4px 10px;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .panel-header.field-heading {
    align-items: start;
  }

  .panel-header.field-heading > div {
    display: contents;
  }

  .panel-header.field-heading label {
    grid-column: 1;
    grid-row: 1;
  }

  .panel-header.field-heading .counter {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .panel-header.field-heading p {
    grid-column: 1 / -1;
    width: 100%;
    max-width: none;
    margin: 0;
    line-height: 1.4;
    white-space: normal;
    overflow: visible;
  }

  .option-card {
    grid-template-columns: 1fr;
    row-gap: 8px;
  }

  .check-row {
    grid-column: auto;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: flex-start;
  }

  .check-row input {
    margin-top: 2px;
  }

  .check-row span {
    grid-column: auto;
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .option-details {
    grid-column: auto;
    white-space: normal;
  }

  .primary-row {
    justify-content: flex-start;
  }

  .workspace-grid.has-result,
  .workspace-grid.has-review {
    grid-template-columns: 1fr;
  }

  .summary {
    display: block;
    padding: 10px 12px;
  }

  .summary h2 {
    margin-bottom: 4px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .legal-card {
    padding: 20px;
  }

  .text-panel,
  .review-panel,
  .workspace-grid.has-review .review-panel {
    height: auto;
  }

  .review-panel,
  .workspace-grid.has-review .review-panel {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .review-panel .panel-header {
    display: block;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .review-panel h2 {
    margin: 0;
  }

  .review-panel-note {
    margin: 6px 0 0;
    line-height: 1.45;
    white-space: normal;
    overflow: visible;
  }

  .panel-body {
    min-height: 0;
  }

  textarea {
    height: clamp(260px, 48vh, 520px);
    resize: vertical;
  }

  .workspace-grid.has-review .review-panel {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }

  .text-highlight.is-located {
    animation: none;
  }
}
