/* Radar setup. Apple system look: iOS/macOS dark mode by default, grouped inset lists, system
   font, one accent (system blue), green only for success. Light mode is the iOS light equivalent. */

:root {
  --bg: #000000;
  --cell: #1c1c1e;
  --cell-2: #2c2c2e;
  --fill: rgba(118, 118, 128, 0.24);
  --sep: rgba(84, 84, 88, 0.65);
  --label: #ffffff;
  --label-2: rgba(235, 235, 245, 0.6);
  --label-3: rgba(235, 235, 245, 0.3);
  --blue: #0a84ff;
  --blue-soft: rgba(10, 132, 255, 0.18);
  --green: #30d158;
  --orange: #ff9f0a;
  --red: #ff453a;
  --on-blue: #ffffff;
  --radius: 12px;
  /* Content width. One column on phones and small windows; wide windows get a wider, two-column
     footprint (see the "wide windows" block at the end). */
  --page: 640px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, sans-serif;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f2f2f7;
  --cell: #ffffff;
  --cell-2: #f2f2f7;
  --fill: rgba(118, 118, 128, 0.12);
  --sep: rgba(60, 60, 67, 0.29);
  --label: #000000;
  --label-2: rgba(60, 60, 67, 0.6);
  --label-3: rgba(60, 60, 67, 0.3);
  --blue: #007aff;
  --blue-soft: rgba(0, 122, 255, 0.12);
  --green: #34c759;
  --orange: #ff9500;
  --red: #ff3b30;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--label);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.4;
  letter-spacing: -0.41px;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(92px + env(safe-area-inset-bottom));
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--blue-soft); outline-offset: 1px; box-shadow: 0 0 0 1px var(--blue); }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; z-index: 10; background: var(--cell); padding: 8px 12px; border-radius: 8px; }

/* ---------- navigation bar ---------- */

.top {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--sep);
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
}
.top-row, main, .banner { max-width: var(--page); margin-left: auto; margin-right: auto; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 36px; }

.progress { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.step-label { font-size: 15px; font-weight: 600; color: var(--label); white-space: nowrap; }
.segs { display: flex; gap: 4px; flex: 1; max-width: 200px; }
.seg {
  flex: 1; height: 4px; padding: 0; border: 0; border-radius: 2px; cursor: pointer;
  background: var(--fill);
  position: relative;
  transition: background-color 0.2s var(--ease);
}
.seg::before { content: ""; position: absolute; inset: -10px 0; } /* taller tap target */
.seg--done { background: var(--label-3); }
.seg--current { background: var(--blue); }

.saved { font-size: 13px; color: var(--label-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 38%; }

.theme {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--fill); color: var(--label);
  border: 0; cursor: pointer;
}
.theme .sun { display: none; }
:root:not([data-theme="light"]) .theme .sun { display: inline; }
:root:not([data-theme="light"]) .theme .moon { display: none; }

.banner {
  margin-top: 16px; padding: 12px 16px 12px 44px;
  border-radius: var(--radius); font-size: 15px;
  background: var(--cell); color: var(--label-2);
  position: relative;
}
.banner::before {
  content: "i"; position: absolute; left: 14px; top: 12px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--blue); color: var(--on-blue);
  font: 700 13px/20px Georgia, serif; font-style: italic; text-align: center;
}
@media (max-width: 671px) { .banner { margin-left: 16px; margin-right: 16px; } }

/* ---------- screen ---------- */

main { padding: 20px 16px 32px; outline: none; }
main > div { animation: enter 0.22s var(--ease); }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

h1 { font-size: 34px; line-height: 1.12; letter-spacing: 0.37px; font-weight: 700; margin: 8px 0 8px; }
h2 { font-size: 17px; font-weight: 600; margin: 0 0 2px; }
.lede { color: var(--label-2); margin: 0 0 6px; }
.note { color: var(--label-2); font-size: 15px; margin: 0 0 22px; }
.lede + :not(.note) { margin-top: 22px; }
p { margin: 0 0 10px; }

/* Inset grouped section. */
.card {
  background: var(--cell);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
}
.hint { font-size: 13px; color: var(--label-2); margin: 2px 0 10px; letter-spacing: -0.08px; }

/* Grouped list of tappable rows (welcome). */
.group { list-style: none; padding: 0; margin: 0 0 20px; background: var(--cell); border-radius: var(--radius); overflow: hidden; }
.group li + li .cell::before {
  content: ""; position: absolute; top: 0; right: 0; left: 60px; border-top: 0.5px solid var(--sep);
}
.cell {
  position: relative; width: 100%;
  display: flex; align-items: center; gap: 14px;
  min-height: 60px; padding: 10px 16px;
  background: transparent; border: 0; color: inherit; font: inherit; text-align: left;
  cursor: pointer;
  transition: background-color 0.15s var(--ease);
}
.cell:active { background: var(--cell-2); }
@media (hover: hover) { .cell:hover { background: var(--cell-2); } }
.badge {
  width: 30px; height: 30px; border-radius: 7px; flex: none;
  display: grid; place-items: center;
  background: var(--blue); color: var(--on-blue); font-size: 15px; font-weight: 600;
}
.cell-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cell-title { font-size: 17px; }
.cell-sub { font-size: 13px; color: var(--label-2); letter-spacing: -0.08px; }
.cell-value { font-size: 15px; color: var(--label-2); white-space: nowrap; }
.chevron {
  width: 8px; height: 8px; flex: none; margin-left: 2px;
  border-right: 2px solid var(--label-3); border-top: 2px solid var(--label-3);
  transform: rotate(45deg);
}

/* ---------- fields ---------- */

label, .label { display: block; font-size: 15px; font-weight: 600; margin: 0 0 6px; letter-spacing: -0.24px; }
.field { padding: 4px 0 16px; }
.field + .field { border-top: 0.5px solid var(--sep); padding-top: 14px; }
.field:last-child { padding-bottom: 2px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }

input[type="text"], input[type="url"], input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  font: inherit; font-size: 17px; /* 16px+ stops iOS zooming on focus */
  color: var(--label);
  background: var(--fill);
  border: 0;
  border-radius: 10px;
  padding: 11px 12px;
  min-height: 44px;
  -webkit-appearance: none; appearance: none;
  transition: box-shadow 0.15s var(--ease);
}
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--label-2) 50%), linear-gradient(135deg, var(--label-2) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px;
  background-color: var(--fill);
}
textarea { min-height: 104px; resize: vertical; line-height: 1.4; }
input::placeholder, textarea::placeholder { color: var(--label-3); }
input:focus, select:focus, textarea:focus { outline: none; box-shadow: 0 0 0 2px var(--blue); }

.money { position: relative; }
.money::before { content: "$"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--label-2); }
.money input { padding-left: 26px; }
.money::after { content: "/hr"; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--label-2); }

.adder { display: flex; gap: 8px; }
.adder input { flex: 1; min-width: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chips:empty { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 2px;
  background: var(--cell-2); color: var(--label);
  border-radius: 8px; padding: 5px 4px 5px 10px; font-size: 15px;
  max-width: 100%;
}
:root[data-theme="light"] .chip { background: var(--fill); }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip button {
  width: 24px; height: 24px; border-radius: 50%; border: 0; cursor: pointer;
  background: transparent; color: var(--label-3); font-size: 17px; line-height: 1;
}
.chip button:hover { color: var(--label); }
.count { font-size: 13px; color: var(--label-2); font-weight: 400; margin-left: 6px; }
.count.good { color: var(--green); }

/* Segmented-control style multi-select. */
.toggles { display: flex; flex-wrap: wrap; gap: 6px; }
.toggle {
  border: 0; background: var(--fill); color: var(--label);
  border-radius: 9px; padding: 8px 12px; font: inherit; font-size: 15px; cursor: pointer;
  min-height: 36px;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.toggle[aria-pressed="true"] { background: var(--blue); color: var(--on-blue); font-weight: 600; }

.error { color: var(--red); font-size: 13px; margin-top: 6px; }

/* ---------- buttons ---------- */

.btn {
  font: inherit; font-weight: 600; font-size: 17px;
  background: var(--blue); color: var(--on-blue);
  border: 0; border-radius: 14px;
  padding: 13px 22px; min-height: 50px; cursor: pointer;
  transition: opacity 0.15s var(--ease), transform 0.1s var(--ease);
}
.btn:active { opacity: 0.8; transform: scale(0.985); }
.btn:disabled { background: var(--fill); color: var(--label-3); cursor: not-allowed; transform: none; }
.btn--quiet { background: var(--fill); color: var(--blue); }
.btn--small { padding: 7px 14px; min-height: 36px; font-size: 15px; border-radius: 10px; font-weight: 500; }
.linkish { background: none; border: 0; color: var(--blue); font: inherit; font-size: 17px; cursor: pointer; padding: 0; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--sep);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 12px;
}
@media (min-width: 672px) {
  .nav { padding-left: max(16px, calc((100% - var(--page)) / 2)); padding-right: max(16px, calc((100% - var(--page)) / 2)); }
}
/* A quiet text Back, and one large pill that takes the rest of the row on a phone. */
#back { background: none; color: var(--blue); padding: 13px 8px; min-width: 64px; font-weight: 400; }
#next { flex: 1; margin-left: auto; }
@media (min-width: 672px) { #next { flex: 0 0 240px; } }

/* ---------- lane preview ---------- */

.terms { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 4px; }
.term { font-size: 13px; border-radius: 7px; padding: 4px 8px; background: var(--cell-2); color: var(--label-2); }
:root[data-theme="light"] .term { background: var(--fill); }
.term b { font-weight: 600; color: var(--label); }
.term.literal { background: transparent; box-shadow: inset 0 0 0 1px var(--sep); }
.term.set-aside { background: transparent; box-shadow: inset 0 0 0 1px var(--orange); color: var(--orange); }
.term.set-aside b { color: var(--orange); }

.preview { margin-top: 4px; }
.bucket { margin-top: 16px; }
.bucket h3 { font-size: 13px; margin: 0 0 4px; font-weight: 600; color: var(--label-2); display: flex; align-items: center; gap: 8px; }
.bucket h3 .pip { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); flex: none; }
.bucket.override h3 .pip { background: var(--orange); }
.bucket.dropped h3 .pip { background: var(--label-3); }
.bucket ul { list-style: none; padding: 0; margin: 0; font-size: 15px; }
.bucket li { padding: 8px 0; border-bottom: 0.5px solid var(--sep); }
.bucket li:last-child { border-bottom: 0; }
.bucket.dropped li { color: var(--label-2); }
details.more summary { cursor: pointer; color: var(--blue); font-size: 15px; margin-top: 6px; list-style: none; }
details.more summary::-webkit-details-marker { display: none; }

/* ---------- trade-offs ---------- */

.duel { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 560px) { .duel { grid-template-columns: 1fr 1fr; } }
.option {
  text-align: left; font: inherit; color: var(--label);
  background: var(--cell); border: 0; border-radius: var(--radius);
  padding: 16px; cursor: pointer; display: flex; flex-direction: column; gap: 3px;
  box-shadow: inset 0 0 0 1px transparent;
  transition: box-shadow 0.15s var(--ease), transform 0.1s var(--ease);
}
@media (hover: hover) { .option:hover { box-shadow: inset 0 0 0 2px var(--blue); } }
.option:active { transform: scale(0.985); }
.option .what { font-weight: 600; font-size: 17px; }
.option .pay { font-size: 28px; font-weight: 700; letter-spacing: 0.36px; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.option .line { font-size: 15px; color: var(--label-2); }
.option .diff { color: var(--label); font-weight: 500; }
.option .pick { margin-top: 10px; font-size: 15px; font-weight: 600; color: var(--blue); }
.or { text-align: center; color: var(--label-3); font-size: 13px; }
@media (min-width: 560px) { .or { display: none; } }

.meter { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.meter .track { flex: 1; height: 6px; background: var(--fill); border-radius: 3px; overflow: hidden; }
.meter .track span { display: block; height: 100%; background: var(--blue); border-radius: 3px; transition: width 0.25s var(--ease); }
.meter .track[aria-valuenow="20"] span, .meter.full .track span { background: var(--green); }
.meter .num { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 56px; text-align: right; }

.weights { display: grid; gap: 9px; margin-top: 14px; }
.weight { display: grid; grid-template-columns: 84px 1fr 42px; gap: 10px; align-items: center; font-size: 15px; }
.weight .w-track { position: relative; height: 6px; background: var(--fill); border-radius: 3px; }
.weight .w-now { position: absolute; left: 0; top: 0; bottom: 0; background: var(--label-2); border-radius: 3px; transition: width 0.25s var(--ease); }
.weight .w-start { position: absolute; top: -4px; bottom: -4px; width: 2px; border-radius: 1px; background: var(--blue); }
.weight .w-num { text-align: right; font-variant-numeric: tabular-nums; color: var(--label-2); font-size: 13px; }
.legend { font-size: 13px; color: var(--label-2); margin-top: 10px; }
.legend i { display: inline-block; width: 2px; height: 11px; background: var(--blue); vertical-align: -1px; margin: 0 4px 0 2px; }

.game-actions { display: flex; gap: 8px; justify-content: space-between; margin-top: 12px; flex-wrap: wrap; }

/* ---------- resume + review ---------- */

ol.steps-list { padding-left: 22px; margin: 0; }
ol.steps-list li { margin-bottom: 10px; }
ol.steps-list li::marker { color: var(--label-2); }
code, .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.88em; background: var(--fill); padding: 1px 6px; border-radius: 5px; }

.review-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
dl.kv { margin: 8px 0 0; display: grid; grid-template-columns: minmax(96px, 34%) 1fr; font-size: 15px; }
dl.kv dt, dl.kv dd { padding: 9px 0; border-top: 0.5px solid var(--sep); margin: 0; }
dl.kv dt { color: var(--label-2); padding-right: 12px; }
dl.kv dd { overflow-wrap: anywhere; }
.source { font-size: 11px; font-weight: 600; color: var(--label-2); background: var(--fill); border-radius: 5px; padding: 2px 6px; margin-left: 8px; white-space: nowrap; vertical-align: 2px; }
.quote { color: var(--label); }
.quote::before { content: "\201C"; } .quote::after { content: "\201D"; }

.issues { list-style: none; padding: 0; margin: 4px 0 0; }
.issues li { padding: 9px 0; border-top: 0.5px solid var(--sep); font-size: 15px; display: flex; gap: 10px; align-items: baseline; }
.issues .lvl { font-size: 12px; font-weight: 600; min-width: 64px; }
.issues .required .lvl { color: var(--red); }
.issues .warning .lvl { color: var(--label-2); }

.done { text-align: center; padding: 40px 8px; }
.done .check {
  width: 72px; height: 72px; margin: 0 auto 16px; border-radius: 50%;
  background: var(--green); position: relative;
}
.done .check::after {
  content: ""; position: absolute; left: 25px; top: 18px; width: 18px; height: 30px;
  border-right: 5px solid #fff; border-bottom: 5px solid #fff; transform: rotate(45deg);
}

/* ---------- wide windows ---------- */

@media (min-width: 900px) {
  :root { --page: min(1120px, calc(100vw - 64px)); }
  .banner { margin-left: auto; margin-right: auto; }

  /* Each screen becomes a two-column grid of cards. Titles, intros and anything that is not a
     card run the full width; cards flow into columns. */
  main > div:not(.done) {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 20px; grid-auto-flow: row dense; align-items: start;
  }
  main > div > :not(.card), main > div > .card--wide { grid-column: 1 / -1; }
  main > div > h1, main > div > .lede, main > div > .note { max-width: 760px; }
  h1 { font-size: 40px; }
  /* Everything after the intro starts on one line, so side-by-side cards align at the top. */
  main > div > .lede + :not(.note) { margin-top: 0; }
  main > div > .lede:not(:has(+ .note)) { margin-bottom: 22px; }

  /* Welcome: the step list is the main thing, the reassurance sits beside it. */
  main > div > .group { grid-column: 1; margin-bottom: 20px; }

  /* Lane: questions on the left, the live preview beside them, following as you scroll. */
  main > div > .lane-questions { grid-column: 1; }
  main > div > .card--aside { grid-column: 2; position: sticky; top: 72px;
    max-height: calc(100vh - 170px); overflow: auto; }
  .lane-questions textarea { min-height: 150px; }

  /* Trade-offs: the pair on the left, what it is learning on the right. */
  .game { display: grid; grid-template-columns: minmax(0, 1fr) 340px; column-gap: 20px; align-items: start; }
  .game > .banner { grid-column: 1 / -1; }
  .game > .duel, .game > .game-actions { grid-column: 1; }
  .game > .game-meter { grid-column: 2; grid-row: 1 / span 3; margin-top: 0 !important; position: sticky; top: 72px; }
  .game > .banner ~ .game-meter { grid-row: 2 / span 2; }
  .option { min-height: 260px; }
}

@media (min-width: 1400px) {
  .option .pay { font-size: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
