:root {
  --paper: #faf7f1;
  --card: #fffdf8;
  --ink: #16150f;
  --muted: #8c8372;
  --faint: #a39b88;
  --rule: #e3ddd0;
  --shade: #eae4d6;
  --green: #1b5e4a;
  --red: #b03a2e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

main { max-width: 820px; margin: 0 auto; padding: 0 2rem 5rem; }

a { color: inherit; }
.note a, .lede a { color: var(--green); text-underline-offset: 3px; }

/* masthead */

.masthead {
  display: flex; justify-content: space-between; align-items: baseline;
  max-width: 820px; margin: 0 auto;
  padding: 2rem 2rem .6rem;
  border-bottom: 2px solid var(--ink);
}
.masthead .brand {
  font: 600 1.05rem/1 ui-serif, Georgia, serif;
  letter-spacing: .02em; text-decoration: none;
}
.masthead nav { display: flex; gap: 1.5rem; }
.masthead nav a {
  font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); text-decoration: none;
}
.masthead nav a:hover { color: var(--ink); }

.foot {
  max-width: 820px; margin: 0 auto; padding: 1.5rem 2rem 3rem;
  border-top: 1px solid var(--rule);
}
.foot nav { display: flex; gap: 1.5rem; }
.foot a {
  font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); text-decoration: none;
}
.foot a:hover { color: var(--ink); }

/* Reserved advertising space. Height is fixed so filling it shifts nothing. */
.ad { display: block; margin: 3.5rem 0 0; }
.ad-label {
  display: block; margin-bottom: .4rem;
  font-size: .58rem; letter-spacing: .2em; text-transform: uppercase; color: #b7af9c;
}
.ad-box {
  width: 100%; max-width: 728px; height: 90px;
  border: 1px dashed var(--rule); border-radius: 2px; background: #f5f1e8;
}
@media (max-width: 620px) {
  .ad-box { height: 100px; }
}

/* type */

h1 {
  font: 500 2.1rem/1.2 ui-serif, Georgia, serif;
  letter-spacing: -.01em; margin: 2.5rem 0 .75rem;
}
h2 { font: 500 1.3rem/1.3 ui-serif, Georgia, serif; margin: 3rem 0 .4rem; }
h3 {
  font: 500 .68rem/1 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
  margin: 2rem 0 .5rem;
}

.deck {
  font: italic 500 1.2rem/1.45 ui-serif, Georgia, serif;
  color: var(--green); max-width: 50ch; margin: -.35rem 0 1.1rem;
}

.lede {
  font: 1.05rem/1.6 ui-serif, Georgia, serif;
  color: #4b463b; max-width: 58ch; margin: 0 0 1.75rem;
}
.note { color: var(--muted); font-size: .88rem; max-width: 68ch; }

/* buttons */

.btn {
  display: inline-block;
  font: 500 .92rem/1 inherit;
  padding: .85rem 1.9rem;
  border: 1px solid var(--ink); border-radius: 2px;
  background: var(--ink); color: var(--paper);
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: #2b2920; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--shade); }
.btn:disabled { opacity: .4; cursor: default; }

.secondary { margin-top: 1rem; }
.link {
  font: inherit; background: none; border: 0; padding: 0;
  color: var(--muted); text-decoration: underline; text-underline-offset: 3px;
  cursor: pointer;
}

/* counters */

.hud { display: flex; align-items: flex-end; gap: 3rem; margin: 2.5rem 0; }
.hud .k {
  display: block; margin-bottom: .1rem;
  font-size: .64rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
}
.hud .v {
  font: 500 2rem/1 ui-serif, Georgia, serif; font-variant-numeric: tabular-nums;
}
.hud .muted .v { color: var(--muted); }

.counter { margin-left: auto; text-align: right; min-width: 260px; }
.counter .v { font-size: 1.1rem; }
.ruler { position: relative; height: 10px; margin-top: .5rem; border-top: 1px solid var(--ink); }
.ruler i { position: absolute; top: 0; width: 1px; height: 5px; background: #cfc7b6; }
.ruler b { position: absolute; top: -1px; left: 0; height: 2px; background: var(--red); }

/* doors */

.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; max-width: 700px; }

.door {
  position: relative; aspect-ratio: 3 / 4.4;
  background: var(--card);
  border: 1px solid var(--ink); border-radius: 2px 2px 0 0;
  padding: 1rem; font: inherit; text-align: left;
  box-shadow: 6px 6px 0 var(--shade);
  cursor: pointer;
  transition: box-shadow .16s, transform .16s;
}
.door:hover:not(:disabled) { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 #ded7c6; }
.door:disabled { cursor: default; }
.door:focus-visible { outline: 2px solid var(--green); outline-offset: 5px; }

.door .n {
  position: absolute; top: 1rem; left: 1rem;
  font: 500 .78rem/1 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: .2em; color: var(--muted);
}
.door .seam {
  position: absolute; left: 1rem; right: 1rem; top: 3rem; bottom: 1rem;
  border: 1px solid #ece6d9;
}
.door .knob {
  position: absolute; right: 1.4rem; top: 50%;
  width: 7px; height: 7px; border-radius: 50%; background: var(--ink);
}

.door.picked {
  box-shadow: 6px 6px 0 var(--ink), inset 0 0 0 2px var(--ink);
  transform: none;
}
.door.picked .n { color: var(--ink); }
.door.picked::after {
  content: "Your pick";
  position: absolute; left: 0; right: 0; bottom: 1rem;
  text-align: center;
  font: 500 .6rem/1 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: .18em; text-transform: uppercase; color: var(--ink);
}

.door.open {
  background: #f4f0e6; border-color: #cfc7b6; border-style: dashed; box-shadow: none;
  transform: none;
}
.door.prize { border-color: var(--green); box-shadow: 6px 6px 0 var(--green); transform: none; }
/* The door you ended on. Green when that was the car, so a win never shows
   a red outline around a green door. */
.door.final { outline: 2px solid var(--red); outline-offset: 5px; }
.door.final.prize { outline-color: var(--green); }
.door.open .seam, .door.open .knob,
.door.prize .seam, .door.prize .knob { display: none; }

.reveal {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .9rem; padding: 2rem 1rem 1rem;
}
.reveal svg { display: block; width: 78%; height: auto; fill: none; }
.reveal .cap {
  font: 500 .72rem/1 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: .22em; text-transform: uppercase;
}
.door.open .reveal svg { stroke: #b4ab96; }
.door.open .reveal .cap { color: var(--faint); }
.door.prize .reveal svg { stroke: var(--green); }
.door.prize .reveal .cap { color: var(--green); }

.ask { display: flex; align-items: center; gap: .75rem; margin-top: 1rem; min-height: 3rem; }
.ask[hidden] { display: none; }

/* The running instruction. It is the only thing telling you what to do next,
   so it reads at body size in full-strength ink, above the buttons. */
.status {
  font: 1.1rem/1.5 ui-serif, Georgia, serif;
  color: var(--ink);
  margin: 2rem 0 0;
  min-height: 1.6em;
  max-width: 60ch;
}
.status .ok { color: var(--green); font-weight: 600; }
.status .no { color: var(--red); font-weight: 600; }

/* the three cases */

.cases { margin: 1.5rem 0 1.75rem; }
.case {
  display: grid; grid-template-columns: 170px 1fr;
  gap: 1.5rem; align-items: center;
  padding: 1.1rem 0; border-bottom: 1px solid var(--rule);
}
.case:first-child { border-top: 1px solid var(--rule); }
.caseline { margin: 0; font-size: .95rem; color: #4b463b; }
.caseline b { font-weight: 600; color: var(--ink); }
.outcome { display: flex; gap: 1.25rem; margin: .45rem 0 0; font-size: .9rem; }
.win { color: var(--green); font-weight: 600; }
.lose { color: var(--muted); }
.mini.yours { outline: 2px solid var(--red); outline-offset: 3px; }
.mini.yours.prize { outline-color: var(--green); }

/* landing explainer */

.steps {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem; margin: 1.5rem 0 1rem;
}
.mini-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.mini {
  position: relative; aspect-ratio: 3 / 4.4;
  border: 1px solid var(--ink); border-radius: 2px 2px 0 0;
  background: var(--card);
}
.mini.picked { box-shadow: 3px 3px 0 var(--ink); }
.mini.open { background: #f4f0e6; border-color: #cfc7b6; border-style: dashed; }
.mini.prize { border-color: var(--green); box-shadow: 3px 3px 0 var(--green); }
.mini svg {
  position: absolute; left: 10%; right: 10%; top: 50%;
  width: 80%; height: auto; transform: translateY(-50%); fill: none;
}
.mini.open svg { stroke: #b4ab96; }
.mini.prize svg { stroke: var(--green); }
.step .cap {
  font-size: .86rem; color: var(--muted); margin: .9rem 0 0;
}
.step .cap b { color: var(--ink); font-weight: 600; }

ul.plain {
  list-style: none; padding: 0; margin: 1rem 0 1.25rem;
  max-width: 64ch; color: #4b463b;
}
ul.plain li {
  padding: .6rem 0 .6rem 1.4rem; border-bottom: 1px solid var(--rule);
  position: relative; font-size: .95rem;
}
ul.plain li::before {
  content: ""; position: absolute; left: 0; top: 1.15rem;
  width: 6px; height: 6px; background: var(--green);
}
ul.plain li:last-child { border-bottom: 0; }

/* reports */

.headline {
  padding: 2rem 0 2.25rem;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--rule);
  margin: 1.5rem 0 2rem;
}
.headline .k {
  font-size: .64rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted); margin: 0;
}
.headline .big {
  font: 500 4.75rem/1 ui-serif, Georgia, serif;
  letter-spacing: -.035em; color: var(--green);
  font-variant-numeric: tabular-nums;
  margin: .4rem 0 .6rem;
}
.headline .caption {
  font: 1.05rem/1.55 ui-serif, Georgia, serif;
  color: #4b463b; max-width: 52ch; margin: 0;
}

.panel {
  border: 1px solid var(--rule); border-radius: 2px;
  background: var(--card);
  padding: 1.25rem 1.25rem .9rem;
  margin: 1rem 0 2.25rem;
}
.panel-k {
  font-size: .64rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 .25rem;
}
.legend {
  display: flex; flex-wrap: wrap; gap: 1.5rem;
  font-size: .75rem; color: var(--muted);
  border-top: 1px solid var(--rule); padding-top: .7rem; margin-top: .2rem;
}
.sw { display: inline-block; vertical-align: middle; margin-right: .45rem; }
.sw.bar { width: 10px; height: 10px; background: var(--green); opacity: .78; }
.sw.line { width: 18px; height: 0; border-top: 2px solid var(--red); }

.record {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 1rem 2.5rem;
  background: #eef4f1;
  border: 1px solid #b9d2c7;
  border-radius: 2px;
  padding: 1.35rem 1.6rem;
  margin: 1.5rem 0 2.25rem;
}
.record .k {
  font-size: .64rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--green); margin: 0 0 .15rem; opacity: .8;
}
.record .big {
  font: 500 2.6rem/1 ui-serif, Georgia, serif;
  color: var(--green); font-variant-numeric: tabular-nums; margin: 0;
}
.record .big span {
  font-size: .8rem; letter-spacing: .14em; text-transform: uppercase;
  vertical-align: .55em; margin-left: .15rem;
}
.record .note { flex: 1 1 280px; margin: 0; color: #4f6b61; }

.grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem; margin: 1.75rem 0;
}
.stat {
  display: flex; flex-direction: column; gap: .25rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--rule); border-radius: 2px; background: var(--card);
}
.stat .k {
  font-size: .64rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
}
.stat .v {
  font: 500 1.35rem/1.1 ui-serif, Georgia, serif; font-variant-numeric: tabular-nums;
}

.chart, .gauge { width: 100%; height: auto; margin: .75rem 0 1.75rem; overflow: visible; }
.bar { fill: var(--green); opacity: .78; }
.curve { fill: none; stroke: var(--red); stroke-width: 2; }
.axis { stroke: var(--ink); stroke-width: 1; }
.tick, .empty { fill: var(--muted); font-size: 11px; }
.track { fill: var(--shade); }
.fill { fill: var(--green); }
.marker { stroke: var(--red); stroke-width: 2; }
.vmarker { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 4 3; opacity: .45; }

@media (max-width: 620px) {
  main, .masthead { padding-left: 1.25rem; padding-right: 1.25rem; }
  h1 { font-size: 1.6rem; }
  .hud { gap: 1.5rem; }
  .hud .v { font-size: 1.5rem; }
  .counter { min-width: 0; }
  .board { gap: .75rem; }
  .door { padding: .6rem; }
  .reveal { padding: 1.6rem .4rem .6rem; gap: .5rem; }
  .reveal .cap { font-size: .58rem; letter-spacing: .12em; }
  .ask { flex-wrap: wrap; }
  .steps { grid-template-columns: 1fr; gap: 2rem; }
  .case { grid-template-columns: 1fr; gap: .9rem; }
  .case .mini-board { max-width: 200px; }
  .masthead .brand { font-size: .95rem; }
  .foot { padding-left: 1.25rem; padding-right: 1.25rem; }
}
