:root {
  --bg: #100e0c;
  --panel: #1b1713;
  --panel-2: #241f19;
  --line: #3a3228;
  --ink: #f6efe4;
  --muted: #c4b4a2;
  --faint: #a89884;
  --ember: #ef8b3a;
  --ember-2: #ffb06a;
  --good: #b6d39a;
  --bad: #f0b09a;
  --warn: #e6c56e;
  --focus: #ffd7a8;
  --serif: "iA Writer Quattro S", "Liberation Serif", "Nimbus Roman", Georgia, serif;
  --sans: "iA Writer Duo S", "Noto Sans", "Liberation Sans", "Segoe UI", sans-serif;
  --mono: "iA Writer Mono S", "Liberation Mono", ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  background:
    radial-gradient(900px 420px at 0% -10%, #3a2414 0%, transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
}

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--ember);
  color: #1a1008;
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 2;
}

.skip:focus { top: 12px; }

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 20px 72px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--ember-2);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 3.1rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 0.92;
}

h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
}

.lede {
  margin: 10px 0 0;
  max-width: 46rem;
  color: var(--muted);
}

code {
  font-family: var(--mono);
  font-size: 0.92em;
  color: var(--ember-2);
}

.row, .split {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.split { align-items: end; }

.split label { flex: 1; }

#status {
  min-height: 1.4em;
  margin: 0 0 14px;
  color: var(--muted);
}

#status[data-kind="ok"] { color: var(--good); }
#status[data-kind="bad"] { color: var(--bad); }
#status[data-kind="warn"] { color: var(--warn); }

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.85fr);
  gap: 16px;
  align-items: start;
}

.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

aside { position: sticky; top: 12px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
}

.card h2 { margin-bottom: 10px; }
.head h2 { margin-bottom: 0; }
.stack { margin-top: 12px; }
.actions { margin-top: 10px; }
.vars { display: grid; gap: 10px; }

@media (min-width: 801px) {
  .vars:has(label:nth-child(2)) { grid-template-columns: 1fr 1fr; }
}

label, .stack {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
}

input, textarea, button { font: inherit; color: inherit; }

input, textarea {
  width: 100%;
  background: #120f0c;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--ink);
}

textarea {
  min-height: 240px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 0.92rem;
  line-height: 1.5;
}

.kbd {
  margin: 8px 0 0;
  color: var(--faint);
  font-size: 0.8rem;
}

button {
  cursor: pointer;
  border-radius: 999px;
}

button:disabled { cursor: default; }

.solid, .ghost, .text, .chip, .lib-del {
  min-height: 40px;
}

.solid {
  background: var(--ember);
  color: #1a1008;
  border: 0;
  padding: 10px 16px;
  font-weight: 700;
}

.ghost, .lib-del {
  background: transparent;
  border: 1px solid var(--line);
  padding: 10px 14px;
}

.chip {
  background: #2a2118;
  border: 1px solid #4d3b2a;
  padding: 8px 12px;
  min-height: 36px;
}

.text {
  background: transparent;
  border: 0;
  color: var(--ember-2);
  padding: 4px 6px;
}

.file {
  position: relative;
  cursor: pointer;
}

.file input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.solid:hover { background: var(--ember-2); }
.ghost:hover, .chip:hover, .lib-del:hover { border-color: var(--ember-2); }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.score-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.meter {
  --p: 0;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--ember) calc(var(--p) * 1%), #2c261e 0);
  flex: none;
}

.meter span {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--panel);
  display: grid;
  place-items: center;
  align-content: center;
}

.meter b {
  font-family: var(--serif);
  font-size: 1.55rem;
  line-height: 1;
}

.meter small {
  color: var(--faint);
  font-size: 0.68rem;
}

#meta, .empty, .hint, .label, .lib small {
  color: var(--faint);
}

#meta { margin: 4px 0 2px; }

.check {
  width: 100%;
  display: grid;
  grid-template-columns: 12px 1fr;
  column-gap: 10px;
  row-gap: 2px;
  align-items: center;
  text-align: left;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 6px 0;
  color: inherit;
}

.check.ok { align-items: center; }

.check-label { font-weight: 650; }

.hint { grid-column: 2; font-size: 0.84rem; }

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bad);
}

.check:not(.ok) .dot { margin-top: 5px; align-self: start; }

.check.ok .dot { background: var(--good); }

#note {
  margin: 8px 0 0;
  color: var(--muted);
  min-height: 1.2em;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: 0.84rem;
  line-height: 1.45;
  max-height: 180px;
  overflow: auto;
}

mark {
  background: #4a2a1c;
  color: #ffd0c0;
  border-radius: 4px;
  padding: 0 3px;
}

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

#filter { margin-bottom: 10px; }

.lib {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
  border-top: 1px solid var(--line);
}

.lib.on .lib-open strong { color: var(--ember-2); }

.lib-open {
  display: grid;
  justify-items: start;
  gap: 2px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 6px 4px;
  text-align: left;
  color: inherit;
}

.lib-del { padding: 6px 10px; min-height: 36px; }

.versions {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.versions button {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: inherit;
}

.versions button.here { border-color: var(--ember); color: var(--ember-2); }

#examples { margin-top: 12px; }

.label { margin: 0 0 8px; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 800px) {
  .grid { grid-template-columns: 1fr; }
  aside { position: static; }
  h1 { font-size: 2.4rem; }
}

@media (max-width: 640px) {
  .wrap { padding: 18px 14px 48px; }
  header { flex-direction: column; align-items: stretch; }
  .split, header .row, .actions { flex-direction: column; align-items: stretch; }
  header .row button, .actions button { width: 100%; }
  textarea { min-height: 160px; }
  h1 { font-size: 2.35rem; }
}

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