:root {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: #203635;
  background: #f3f5f1;
  font-synthesis: none;
  --teal: #176b60;
  --muted: #667570;
  --line: #dbe3dd;
}

* { box-sizing: border-box; }
body { margin: 0; }
.workspace { max-width: 1024px; margin: 0 auto; padding: 54px 32px 30px; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; color: var(--teal); font-size: 13px; font-weight: 700; letter-spacing: .16em; }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border: 1px solid #a9c8bb; border-radius: 8px; font-size: 25px; font-weight: 400; letter-spacing: 0; }
h1 { margin: 18px 0 10px; font-size: clamp(28px, 4vw, 40px); line-height: 1.15; font-weight: 650; letter-spacing: -.035em; }
.heading > p { margin: 0 0 30px; color: var(--muted); font-size: 16px; line-height: 1.6; }
.calculator { background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: 0 8px 32px #20363506; }
form { padding: 30px; }
.field-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; margin-bottom: 10px; }
label { font-size: 15px; font-weight: 650; }
.count, .read-only { color: var(--muted); font-size: 12px; }
.count { font-variant-numeric: tabular-nums; }
.field-viewport { max-width: 100%; overflow-x: auto; padding: 3px; margin: -3px; }
textarea {
  display: block;
  width: 100%;
  min-width: 54ch;
  height: 96px;
  padding: 18px;
  border: 1px solid #bdcec5;
  border-radius: 8px;
  background: #fff;
  color: #203635;
  font: 16px/1.7 Consolas, "Liberation Mono", Menlo, monospace;
  white-space: pre;
  overflow-x: auto;
  overflow-y: auto;
  resize: vertical;
  scrollbar-width: auto;
  scrollbar-color: #91aba0 #eff3ef;
}
textarea::placeholder { color: #7c8c85; }
textarea:focus-visible, input:focus-visible, button:focus-visible, .relation-summary:focus-visible { outline: 3px solid #9bd1be; outline-offset: 2px; }
textarea[aria-invalid="true"], input[aria-invalid="true"] { border-color: #ac493d; }
#factors { background: #f7f9f6; border-color: var(--line); }
.hint, .error { font-size: 12px; line-height: 1.6; margin: 8px 0 0; }
.hint { color: var(--muted); }
.error { color: #a2382c; }
.error:empty { display: none; }
.output-heading { margin-top: 26px; }
.thread-setting { margin-top: 26px; }
.thread-setting label { display: block; margin-bottom: 10px; }
#threads { width: 100px; padding: 10px 12px; border: 1px solid #bdcec5; border-radius: 7px; background: #fff; color: #203635; font: 16px Consolas, monospace; }
#threads:disabled { background: #f7f9f6; color: var(--muted); }
.ecm-setting { margin-top: 22px; }
.ecm-setting label { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; }
#ecm-pretesting { width: 17px; height: 17px; margin: 0; accent-color: var(--teal); }
.actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 34px; }
.button { min-width: 112px; padding: 12px 24px; border: 1px solid transparent; border-radius: 7px; font: inherit; font-size: 14px; font-weight: 650; cursor: pointer; transition: background-color .15s; }
.button-clear { background: #fff; border-color: #cbd8d0; color: #354b41; }
.button-clear:hover { background: #f0f5f0; }
.button-factor { color: #fff; background: var(--teal); }
.button-factor:hover:enabled { background: #10564d; }
.button-factor:disabled { color: #818a84; background: #e6eae6; cursor: not-allowed; }
.status-area { padding: 24px 30px 22px; border-top: 1px solid var(--line); background: #f9fbf8; }
.status-topline { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
h2 { margin: 0; text-transform: uppercase; color: var(--muted); font-size: 11px; letter-spacing: .12em; font-weight: 700; }
.elapsed { color: var(--muted); font: 12px Consolas, monospace; }
.status-message { margin: 10px 0 22px; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.status-area[data-state="working"] .status-message::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--teal); margin-right: 9px; animation: pulse 1.6s ease-in-out infinite; }
.status-area[data-state="error"] .status-message { color: #a2382c; }
.relation-summary { margin: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: 14px/1.7 Consolas, "Liberation Mono", Menlo, monospace; font-variant-numeric: tabular-nums; white-space: nowrap; overflow-x: auto; scrollbar-color: #91aba0 #eff3ef; }
.relation-progress { margin-top: 22px; }
.progress-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; color: var(--muted); }
.progress-heading label { font-size: 12px; font-weight: 400; }
#relation-percentage { font: 12px Consolas, "Liberation Mono", monospace; font-variant-numeric: tabular-nums; }
#relations-progress { display: block; appearance: none; width: 100%; height: 8px; border: 0; border-radius: 4px; overflow: hidden; background: #e0e9e2; color: var(--teal); }
#relations-progress::-webkit-progress-bar { background: #e0e9e2; border-radius: 4px; }
#relations-progress::-webkit-progress-value { background: var(--teal); border-radius: 4px; }
#relations-progress::-moz-progress-bar { background: var(--teal); border-radius: 4px; }
.status-note { margin: 18px 0 0; font-size: 11px; line-height: 1.7; color: var(--muted); }
footer { text-align: center; color: var(--muted); margin-top: 24px; font-size: 12px; line-height: 1.7; }
footer p { margin: 3px 0; }
noscript { display: block; padding: 20px; color: #a2382c; }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }
@media (max-width: 600px) {
  .workspace { padding: 28px 16px 22px; }
  form { padding: 22px 18px; }
  .status-area { padding: 22px 18px; }
  .actions .button { flex: 1; }
}
