:root {
  --bg: #12161c;
  --ink: #14181e;
  --paper: #efe8dc;
  --muted: rgba(239, 232, 220, 0.62);
  --faint: rgba(239, 232, 220, 0.42);
  --line: rgba(239, 232, 220, 0.16);
  --serif: Newsreader, "Iowan Old Style", Palatino, Georgia, serif;
  --sans: "Familjen Grotesk", "Avenir Next", "Segoe UI", sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(70% 42% at 8% -8%, rgba(239, 232, 220, 0.075), transparent 58%),
    var(--bg);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.45;
  color-scheme: dark;
}

body::before {
  content: "";
  position: fixed;
  inset: 16px;
  border: 1px solid rgba(239, 232, 220, 0.14);
  pointer-events: none;
  z-index: 4;
}

button,
textarea { font-family: inherit; }

::selection {
  background: var(--paper);
  color: var(--ink);
}

.sr,
.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus { outline: none; }

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

.stage {
  width: min(72rem, calc(100% - 6.5rem));
  margin: 0 auto;
  min-height: 100dvh;
  padding: 2.75rem 0;
  display: grid;
  align-content: center;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  grid-template-areas:
    "mast act"
    "note act"
    "result result";
  align-items: start;
}

.mast { grid-area: mast; padding-right: clamp(1.5rem, 3vw, 2.75rem); }
.act { grid-area: act; }
.note { grid-area: note; align-self: end; padding: 2rem clamp(1.5rem, 3vw, 2.75rem) 0.2rem 0; }
.result { grid-area: result; }

h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-optical-sizing: auto;
  font-size: clamp(3.4rem, 5.4vw, 5.75rem);
  line-height: 0.9;
  letter-spacing: -0.035em;
  hyphens: none;
  text-wrap: balance;
}

.dek {
  max-width: 18em;
  margin: 1.35rem 0 0;
  color: var(--muted);
  font-family: var(--serif);
  font-weight: 480;
  font-size: clamp(1.2rem, 1.5vw, 1.45rem);
  line-height: 1.35;
}

.dek span { display: block; }

.act {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-left: clamp(1.5rem, 3vw, 2.75rem);
  border-left: 1px solid var(--line);
}

body:not([data-kind="text"]) .try-label,
body:not([data-kind="text"]) .chips { display: none; }

.modes { order: 1; }
.panel { order: 2; }
.try-label { order: 3; }
.chips { order: 4; }
.stay { order: 5; }
.form-note { order: 6; }
.go { order: 7; }
.noscript { order: 8; }

.modes {
  display: flex;
  gap: 1.65rem;
  margin: 0 0 1.35rem;
}

.modes button {
  position: relative;
  min-height: 44px;
  padding: 0.35rem 0 0.7rem;
  border: 0;
  background: none;
  color: var(--faint);
  font: 600 1.02rem/1 var(--sans);
  letter-spacing: 0.01em;
  cursor: pointer;
}

.modes button[aria-checked="true"] { color: var(--paper); }

.modes button[aria-checked="true"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.35rem;
  height: 1.5px;
  background: var(--paper);
}

textarea {
  display: block;
  width: 100%;
  min-height: 5.75rem;
  margin: 0;
  padding: 0.15rem 0 0.85rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--paper);
  font: 500 1.35rem/1.4 var(--serif);
  font-optical-sizing: auto;
  resize: none;
  appearance: none;
  -webkit-appearance: none;
}

textarea::placeholder { color: rgba(239, 232, 220, 0.38); }

textarea:focus-visible {
  outline: none;
  border-bottom-color: var(--paper);
}

.try-label {
  margin: 1.55rem 0 0.35rem;
  color: var(--faint);
  font: 600 0.72rem/1 var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.chips {
  margin: 0;
  padding: 0;
  list-style: none;
}

.chips li + li { border-top: 1px solid var(--line); }

.chip {
  display: grid;
  grid-template-columns: 1.7rem minmax(0, 1fr);
  column-gap: 0.75rem;
  align-items: baseline;
  width: 100%;
  margin: 0;
  padding: 0.72rem 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: rgba(239, 232, 220, 0.78);
  font: italic 480 1.12rem/1.35 var(--serif);
  text-align: left;
  cursor: pointer;
}

.chip .idx {
  font-family: var(--sans);
  font-style: normal;
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--faint);
}

.chip:hover,
.chip:focus-visible { color: var(--paper); }

.drop {
  display: block;
  width: 100%;
  min-height: 7.75rem;
  padding: 0.2rem 0 1.2rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--paper);
  font: italic 480 1.45rem/1.3 var(--serif);
  text-align: left;
  cursor: pointer;
}

.drop.is-hot { border-bottom-color: var(--paper); }

.preview { margin-top: 1rem; }

.preview img,
.preview video {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 240px;
  margin: 0;
  object-fit: contain;
  background: rgba(239, 232, 220, 0.04);
}

.preview-note,
.stay,
.form-note,
.noscript {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.4;
}

.stay {
  margin: 1.15rem 0 0.85rem;
  color: var(--faint);
  font-size: 0.92rem;
}

.form-note,
.preview-note {
  margin-top: 0.45rem;
  color: var(--paper);
}

.replace {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--paper);
  font: 600 0.95rem/1.3 var(--sans);
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

.caption {
  display: block;
  margin: 1.25rem 0 0.35rem;
  color: var(--faint);
  font: 600 0.72rem/1 var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.caption-box { min-height: 4.5rem; font-size: 1.15rem; }

.go {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 52px;
  margin: 0;
  padding: 0.8rem 1.45rem;
  border: 0;
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  font: 700 1.05rem/1 var(--sans);
  cursor: pointer;
}

.go:hover { background: #f7f3ea; }

.go:focus-visible {
  outline: 2px solid var(--paper);
  outline-offset: 4px;
}

.go:disabled { cursor: wait; opacity: 0.55; }

.noscript { margin: 0.85rem 0 0; color: var(--muted); }

.how-row { margin: 0; }

.how-toggle {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: 500 0.98rem/1.4 var(--sans);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.how { margin-top: 0.85rem; }

.how ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.how li {
  max-width: 28rem;
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.4;
}

.result { scroll-margin-top: 1.5rem; min-width: 0; }

.result:not(:empty) {
  margin-top: 4.25rem;
  padding-top: 2.25rem;
  border-top: 1px solid var(--line);
}

.col { max-width: 40rem; }

.readout {
  display: grid;
  grid-template-columns: minmax(22rem, 30rem) minmax(0, 1fr);
  gap: 2.5rem 3rem;
  align-items: start;
}

.visuals {
  display: flex;
  flex-direction: column;
  gap: 1.85rem;
  min-width: 0;
}

.mix {
  display: grid;
  grid-template-columns: 11.5rem minmax(0, 1fr);
  grid-template-areas:
    "title title"
    "ring legend";
  gap: 0.35rem 1.1rem;
  align-items: center;
  margin: 0;
}

.mix h3,
.meters h3 {
  margin: 0 0 0.15rem;
  color: var(--faint);
  font: 600 0.72rem/1 var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.mix h3 { grid-area: title; }

.donut {
  grid-area: ring;
  width: 11.5rem;
  height: 11.5rem;
}

.mix-legend {
  grid-area: legend;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mix-legend li {
  display: grid;
  grid-template-columns: 0.7rem minmax(0, 1fr) auto;
  column-gap: 0.6rem;
  align-items: baseline;
  margin: 0;
  padding: 0.32rem 0;
  font-size: 1.02rem;
  line-height: 1.3;
}

.swatch {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  align-self: center;
}

.pct {
  font-family: var(--serif);
  font-weight: 560;
  font-size: 1.45rem;
  line-height: 1;
}

.meter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 0.75rem;
  row-gap: 0.28rem;
  align-items: center;
  margin-top: 0.85rem;
}

.meter-label {
  grid-column: 1;
  font-size: 0.98rem;
  line-height: 1.25;
}

.meter-num {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.meter-track {
  grid-column: 1;
  display: block;
  height: 0.62rem;
  background: rgba(239, 232, 220, 0.12);
  border-radius: 99px;
  overflow: hidden;
}

.meter-fill {
  display: block;
  height: 100%;
  border-radius: 99px;
}

.meter-fill.push { background: #c9843a; }
.meter-fill.harm { background: #8C4A5A; }

.meter-num {
  font-family: var(--serif);
  font-weight: 560;
  font-size: 1.25rem;
  line-height: 1;
  text-align: right;
}

.headline {
  margin: 0;
  max-width: 18em;
  font-family: var(--serif);
  font-weight: 500;
  font-optical-sizing: auto;
  font-size: clamp(1.85rem, 3vw, 2.65rem);
  line-height: 1.12;
  letter-spacing: -0.025em;
  text-wrap: balance;
  overflow-wrap: break-word;
}

.push-num {
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
  margin: 1.15rem 0 0;
  font-family: var(--serif);
  font-weight: 560;
  font-optical-sizing: auto;
  font-size: clamp(6rem, 12vw, 8.75rem);
  line-height: 0.82;
  letter-spacing: -0.045em;
}

.push-of {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  line-height: 1.3;
  text-transform: uppercase;
  white-space: nowrap;
}

.push-label {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.35;
}

.when-block { margin-top: 2.35rem; }

.when-block h3 {
  margin: 0;
  color: var(--faint);
  font: 600 0.72rem/1 var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.bullets {
  margin: 0.7rem 0 0;
  padding: 0;
  list-style: none;
}

.bullets li {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  column-gap: 0.75rem;
  align-items: baseline;
  margin: 0;
  padding: 0.85rem 0 0;
  border-top: 1px solid var(--line);
  font-size: 1.08rem;
  line-height: 1.4;
}

.bullets li:first-child { border-top: 0; padding-top: 0.15rem; }

.b-num {
  font-family: var(--serif);
  font-weight: 560;
  font-size: 1.35rem;
  line-height: 1;
}

.b-text { overflow-wrap: break-word; }

.bullets li.plain {
  display: block;
  margin-top: 0.95rem;
  padding-top: 0;
  border-top: 0;
  color: rgba(239, 232, 220, 0.8);
  font-family: var(--serif);
  font-style: italic;
  font-weight: 480;
  font-size: 1.08rem;
}

.refused-body,
.model-error {
  margin: 0.85rem 0 0;
  max-width: 36rem;
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1.4;
}

.model-error { margin-top: 0; }

@media (max-width: 860px) {
  body::before { display: none; }

  .stage {
    display: block;
    width: auto;
    margin: 0;
    padding: 1.1rem 1.15rem 0.85rem;
  }

  .mast,
  .note,
  .act { padding: 0; }

  .act {
    margin-top: 1.15rem;
    border-left: 0;
  }

  h1 {
    max-width: none;
    font-size: 2rem;
    line-height: 0.95;
  }

  .dek {
    margin-top: 0.55rem;
    font-size: 1rem;
    line-height: 1.35;
  }

  .modes {
    gap: 1.25rem;
    margin-bottom: 0.75rem;
  }

  .modes button {
    min-height: 40px;
    padding-bottom: 0.55rem;
    font-size: 1rem;
  }

  textarea {
    min-height: 4.6rem;
    padding-bottom: 0.55rem;
    font-size: 1.05rem;
  }

  .try-label { order: 8; margin-top: 1.15rem; }
  .chips { order: 9; }

  .chip {
    padding: 0.48rem 0;
    font-size: 0.98rem;
  }

  .stay { margin: 0.7rem 0 0.7rem; }

  .go {
    width: 100%;
    min-height: 48px;
  }

  .drop {
    min-height: 4.6rem;
    padding-bottom: 0.8rem;
    font-size: 1.2rem;
  }

  .caption { margin-top: 0.9rem; }
  .caption-box { min-height: 3.4rem; }

  .note { margin-top: 1.35rem; }

  .result:not(:empty) {
    margin-top: 2.25rem;
    padding-top: 1.4rem;
  }

  .push-num { font-size: 4.6rem; }

  .readout {
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
  }

  .mix {
    grid-template-columns: 8.6rem minmax(0, 1fr);
  }

  .donut {
    width: 8.6rem;
    height: 8.6rem;
  }

  .meter {
    column-gap: 0.55rem;
  }
}

@media (max-width: 860px) and (min-height: 700px) {
  .stage { padding-top: 1.5rem; }
  h1 { font-size: 2.15rem; }
}
