:root {
  color-scheme: light;
  --paper: #f2efe7;
  --paper-bright: #fbfaf5;
  --ink: #151922;
  --muted: #686a6d;
  --grid: rgba(21, 25, 34, 0.09);
  --cobalt: #155be7;
  --orange: #f05a24;
  --yellow: #f4c430;
  --magenta: #e21b79;
  --line: #cbc6b9;
  --radius: 22px;
  --shadow: 0 28px 80px rgba(34, 32, 25, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  background:
    radial-gradient(circle at 8% 4%, rgba(255,255,255,.92), transparent 32rem),
    linear-gradient(180deg, #f8f5ed 0, var(--paper) 55%);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 4px;
}

.masthead {
  width: min(1500px, calc(100% - 40px));
  min-height: 78px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.edition {
  width: max-content;
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.edition span,
.eyebrow,
.budget span,
.meter-label,
.corner-label,
.keyboard-hint,
.legend,
.toy-note {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.edition span {
  color: var(--muted);
  font-size: 10px;
}

.edition strong {
  font-size: 14px;
  letter-spacing: .025em;
}

.toy-note {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.toy-note span {
  color: var(--orange);
  padding-right: 5px;
}

.text-button {
  justify-self: end;
  border: 0;
  border-bottom: 1px solid currentColor;
  padding: 6px 0;
  color: var(--ink);
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}

.shell {
  width: min(1500px, calc(100% - 40px));
  margin: 24px auto 36px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
}

.field-card,
.control-card,
.help-panel {
  border: 1px solid var(--line);
  background: rgba(251, 250, 245, .76);
  box-shadow: var(--shadow);
}

.field-card {
  min-width: 0;
  border-radius: var(--radius);
  overflow: hidden;
}

.field-heading {
  min-height: 86px;
  padding: 17px 22px 15px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

h1,
h2,
p {
  text-wrap: pretty;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(25px, 3.2vw, 43px);
  font-weight: 500;
  line-height: .96;
  letter-spacing: -.035em;
}

.budget {
  min-width: 104px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 10px;
  border: 1px solid var(--ink);
  border-radius: 999px;
}

.budget span {
  font-size: 9px;
  color: var(--muted);
}

.budget strong {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
}

.canvas-wrap {
  position: relative;
  height: clamp(420px, calc(100vh - 245px), 720px);
  min-height: 420px;
  overflow: hidden;
  isolation: isolate;
  background-color: var(--paper-bright);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(rgba(21,25,34,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(21,25,34,.035) 1px, transparent 1px);
  background-size: 80px 80px, 80px 80px, 16px 16px, 16px 16px;
  touch-action: none;
}

.canvas-wrap::before,
.canvas-wrap::after {
  content: "";
  position: absolute;
  z-index: 0;
  pointer-events: none;
}

.canvas-wrap::before {
  inset: 0;
  background: radial-gradient(ellipse at 50% 45%, transparent 30%, rgba(242, 239, 231, .42) 100%);
}

.canvas-wrap::after {
  inset: 14px;
  border: 1px solid rgba(21,25,34,.13);
}

canvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.corner-label {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  font-size: 8px;
  color: rgba(21,25,34,.48);
}

.corner-label--nw {
  top: 24px;
  left: 27px;
}

.corner-label--se {
  right: 27px;
  bottom: 24px;
  padding: 4px 6px;
  border: 1px solid currentColor;
}

.motion-cover {
  position: absolute;
  z-index: 3;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(21,91,231,.055), transparent);
}

.field-footer {
  min-height: 54px;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--line);
}

.field-footer p {
  margin: 0;
}

#fieldPrompt {
  font-size: 13px;
}

.keyboard-hint {
  color: var(--muted);
  font-size: 8px;
  text-align: right;
}

kbd {
  padding: 2px 4px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: #fff;
  font-family: inherit;
  color: var(--ink);
}

.control-card {
  padding: 22px;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.briefing {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.briefing p:last-child {
  margin: 0;
  color: #33363a;
  font-size: 13px;
  line-height: 1.55;
}

.meter-label {
  margin-bottom: 7px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 9px;
}

.phase-meter {
  height: 4px;
  overflow: hidden;
  background: #ded9cd;
}

.phase-meter span {
  display: block;
  width: 14%;
  height: 100%;
  background: var(--cobalt);
  transition: width 360ms cubic-bezier(.2,.8,.2,1), background-color 180ms ease;
}

.anchor-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.anchor-fieldset legend {
  width: 100%;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
}

.anchor-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.anchor-button {
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.64);
  color: var(--ink);
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  text-align: left;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background-color 120ms ease;
}

.anchor-button:not(:disabled):hover {
  transform: translateY(-1px);
  border-color: var(--cobalt);
}

.anchor-button[aria-pressed="true"] {
  border-color: var(--cobalt);
  background: rgba(21,91,231,.1);
}

.anchor-button[aria-pressed="true"] .anchor-key {
  background: var(--cobalt);
  color: white;
}

.anchor-button:disabled {
  opacity: .48;
  cursor: not-allowed;
}

.anchor-button--fixed {
  border-color: var(--magenta);
  background: rgba(226,27,121,.07);
}

.anchor-button--fixed[aria-pressed="true"] .anchor-key {
  background: var(--magenta);
}

.anchor-key {
  width: 21px;
  height: 21px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: white;
  font: 10px/1 "SFMono-Regular", Consolas, monospace;
}

.anchor-name {
  min-width: 0;
  padding-left: 5px;
  font-size: 10px;
  letter-spacing: .035em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.primary-actions {
  display: grid;
  gap: 8px;
}

.release-button,
.continue-button {
  min-height: 58px;
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 0 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--orange);
  color: white;
  font-weight: 750;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(240,90,36,.24);
}

.release-button:disabled {
  background: #c9c3b8;
  color: #76736e;
  box-shadow: none;
  cursor: not-allowed;
}

.secondary-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.secondary-button:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.result-panel {
  padding: 17px;
  border: 1px solid var(--ink);
  border-radius: 14px;
  background: var(--ink);
  color: white;
}

.result-panel[hidden] {
  display: none;
}

.result-panel .eyebrow {
  color: #b8bcc6;
}

.result-panel h2 {
  margin: 0 0 8px;
  font: 500 22px/1.05 Georgia, serif;
}

.result-panel p:not(.eyebrow) {
  margin: 0 0 14px;
  color: #d8d9dc;
  font-size: 12px;
  line-height: 1.5;
}

.continue-button {
  min-height: 46px;
  background: white;
  color: var(--ink);
  box-shadow: none;
}

.legend {
  margin-top: auto;
  padding-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 8px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-line {
  width: 18px;
  height: 3px;
  display: inline-block;
  background: var(--cobalt);
}

.legend-line--warm { background: var(--yellow); }
.legend-line--hot { background: var(--magenta); }

.help-panel {
  width: min(950px, calc(100% - 40px));
  margin: -12px auto 40px;
  padding: 24px;
  border-radius: var(--radius);
  grid-template-columns: .8fr 1.2fr;
  gap: 30px;
}

.help-panel:not([hidden]) {
  display: grid;
}

.help-panel h2 {
  margin: 0;
  font: 500 28px/1.05 Georgia, serif;
}

.help-panel ol {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
  font-size: 13px;
  line-height: 1.45;
}

.help-panel > p {
  grid-column: 2;
  margin: -12px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.noscript {
  position: fixed;
  inset: auto 12px 12px;
  z-index: 99;
  padding: 14px;
  border-radius: 8px;
  background: #181b23;
  color: white;
  text-align: center;
}

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

@media (max-width: 960px) {
  .masthead {
    grid-template-columns: 1fr auto;
  }

  .toy-note {
    grid-column: 1 / -1;
    grid-row: 2;
    padding: 8px 0;
    border-top: 1px solid var(--line);
  }

  .shell {
    grid-template-columns: 1fr;
  }

  .control-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .briefing {
    padding: 0 18px 0 0;
    border: 0;
    border-right: 1px solid var(--line);
  }

  .meter-block,
  .anchor-fieldset,
  .legend {
    grid-column: 1 / -1;
  }

  .result-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .masthead,
  .shell,
  .help-panel {
    width: min(100% - 22px, 1500px);
  }

  .masthead {
    min-height: 61px;
    gap: 10px;
  }

  .edition span {
    display: none;
  }

  .text-button {
    min-height: 44px;
  }

  .shell {
    margin-top: 12px;
    gap: 10px;
  }

  .field-card,
  .control-card,
  .help-panel {
    border-radius: 16px;
  }

  .field-heading {
    min-height: 72px;
    padding: 13px 15px;
  }

  h1 {
    font-size: 25px;
  }

  .budget {
    min-width: 91px;
    padding: 8px 10px;
  }

  .canvas-wrap {
    height: min(58svh, 500px);
    min-height: 390px;
  }

  .corner-label--nw {
    top: 21px;
    left: 20px;
  }

  .corner-label--se {
    right: 20px;
    bottom: 20px;
  }

  .field-footer {
    min-height: 48px;
    padding: 8px 14px;
  }

  #fieldPrompt {
    font-size: 11px;
  }

  .keyboard-hint {
    display: none;
  }

  .control-card {
    padding: 17px;
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .briefing,
  .meter-block,
  .anchor-fieldset,
  .legend,
  .result-panel {
    grid-column: 1;
  }

  .briefing {
    padding: 0 0 14px;
    border: 0;
    border-bottom: 1px solid var(--line);
  }

  .anchor-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .primary-actions {
    position: sticky;
    bottom: 8px;
    z-index: 8;
    padding: 5px;
    border-radius: 15px;
    background: rgba(242,239,231,.92);
    backdrop-filter: blur(10px);
  }

  .help-panel:not([hidden]) {
    display: block;
  }

  .help-panel ol {
    margin: 18px 0;
  }

  .help-panel > p {
    margin: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }

  .motion-cover {
    display: none;
  }
}
