:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  --bg: #111516;
  --surface: #191e20;
  --well: #15191b;
  --line: #353d40;
  --text: #f1f3f1;
  --muted: #afbabb;
  --accent: #91e4dd;
  --accent-ink: #102a2d;
  --danger: #ffc1bb;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.55;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, p { margin: 0; }
a { color: inherit; }
button, textarea, input { font: inherit; }
button, a, textarea { -webkit-tap-highlight-color: transparent; }
button:not(:disabled) { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
::selection { background: var(--accent); color: var(--accent-ink); }

.wrap { width: min(1120px, calc(100% - 96px)); margin-inline: auto; }
.top { border-bottom: 1px solid var(--line); }
.top-inner { position: relative; display: flex; min-height: 72px; align-items: center; justify-content: space-between; gap: 16px; }
.skip { position: absolute; z-index: 2; left: 0; top: 12px; transform: translateY(-200%); padding: 12px; background: var(--bg); }
.skip:focus { transform: none; }
.brand { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 22px; font-weight: 700; letter-spacing: -.04em; text-decoration: none; }
.brand-mark { display: block; flex: none; width: 40px; height: 40px; object-fit: contain; }
.top-link, .inline-link { color: var(--text); text-underline-offset: 5px; }
.top-link { display: inline-flex; align-items: center; min-height: 44px; gap: 10px; font-size: 14px; text-decoration: none; }
.top-link:hover, .inline-link:hover { color: var(--accent); }
.top-link span, .inline-link span { color: var(--accent); }
.intro { padding-block: 66px 34px; }
h1 { font-size: clamp(56px, 7.5vw, 100px); font-weight: 700; line-height: 1; letter-spacing: -.07em; }
h1 span { color: var(--accent); }
.intro-bottom { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-top: 22px; }
.intro-bottom > :first-child { max-width: 54ch; color: var(--muted); font-size: clamp(16px, 2.2vw, 18px); }
.version { white-space: nowrap; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

.workbench { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: clip; }
.input-panel, .output-panel { min-width: 0; padding: 23px 24px 17px; }
.output-panel { border-left: 1px solid var(--line); }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 44px; margin-bottom: 10px; }
.panel-heading label, .panel-heading h2 { font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.text-button { min-height: 44px; padding: 4px 0 4px 12px; border: 0; background: transparent; color: var(--accent); font-size: 14px; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.text-button:not(:disabled):hover { text-decoration: underline; }
.text-button:disabled { color: var(--muted); opacity: .62; }
textarea, .output-body { width: 100%; min-height: 214px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--well); color: var(--text); font: inherit; }
textarea { display: block; resize: vertical; }
.output-body { max-height: 380px; overflow: auto; overflow-wrap: anywhere; }
#empty { display: grid; min-height: 178px; align-content: center; justify-items: center; color: var(--muted); font-family: inherit; }
#output { margin: 0; padding-left: 20px; }
#output li { padding-block: 2px; }
#output li::marker { color: var(--accent); }
.panel-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 50px; margin-top: 13px; }
.panel-foot p, .result-note, .rating-anchors { color: var(--muted); font-size: 14px; }
.result-note:not(:empty), .error:not(:empty) { margin-top: 12px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 44px; padding: 9px 16px; border: 1px solid transparent; border-radius: 8px; font-weight: 600; transition: transform 150ms ease, background-color 150ms ease; }
.button:not(:disabled):hover { transform: translateY(-1px); }
.button:not(:disabled):active { transform: translateY(1px); }
.button:disabled { opacity: .58; }
.primary { color: var(--accent-ink); background: var(--accent); }
.primary:not(:disabled):hover { background: #b3efe9; }
.secondary { border-color: var(--line); background: var(--surface); color: var(--text); }
.secondary:not(:disabled):hover { background: #22292b; }
.error { color: var(--danger); font-size: 14px; }

.feedback { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: start; padding-block: 30px 33px; }
.feedback h2 { margin-bottom: 4px; font-size: 19px; letter-spacing: -.02em; }
#aggregate, #rating-hint { color: var(--muted); font-size: 14px; }
.rating-summary { display: flex; align-items: baseline; gap: 7px; font-variant-numeric: tabular-nums; }
.rating-star { color: var(--accent); }
.rating-provenance, .rating-breakdown { color: var(--muted); font-size: 14px; }
.rating-provenance { margin-top: 3px; }
.rating-breakdown summary { width: fit-content; min-height: 44px; padding-block: 11px; color: var(--accent); cursor: pointer; }
.rating-breakdown dl { display: grid; grid-template-columns: 1fr auto; gap: 4px 20px; width: min(100%, 165px); margin: 0; }
.rating-breakdown dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.feedback-action { justify-self: end; width: min(100%, 406px); }
.personal-rating { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 12px; margin-bottom: 4px; }
.personal-rating p, .personal-rating .text-button { color: var(--muted); font-size: 14px; }
.personal-rating .text-button { padding-left: 0; }
#rating-hint { text-align: right; }
fieldset { margin: 0 0 12px; padding: 0; border: 0; }
legend { margin-bottom: 8px; padding: 0; font-weight: 600; }
.rating-options { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.rating-options label { position: relative; display: block; cursor: pointer; }
.rating-options input, .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; border: 0; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.rating-options input + span { display: grid; min-height: 44px; place-content: center; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.rating-options label:hover input + span { border-color: var(--muted); }
.rating-options input:checked + span { color: var(--accent); border-color: var(--accent); }
.rating-options input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.rating-anchors { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; }
.rating-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

@media (max-width: 720px) {
  .wrap { width: calc(100% - 40px); }
  .top-inner { min-height: 62px; }
  .brand-mark { width: 36px; height: 36px; }
  .intro { padding-block: 42px 24px; }
  .intro-bottom { align-items: start; flex-direction: column; gap: 9px; margin-top: 15px; }
  .workbench, .feedback { grid-template-columns: minmax(0, 1fr); }
  .input-panel, .output-panel { padding: 14px 16px; }
  .output-panel { border-left: 0; border-top: 1px solid var(--line); }
  .feedback { gap: 12px; }
  .feedback-action { justify-self: start; }
  #rating-hint { text-align: left; }
}
@media (max-width: 355px) {
  .wrap { width: calc(100% - 32px); }
  h1 { font-size: 52px; }
  .panel-foot p { font-size: 13px; }
  .button { gap: 7px; padding-inline: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
