/* Can you find pi with random numbers? A sky event field (the square of points, the estimate and its chart, the run
   buttons) beside a navy panel. Navy text on sky, never white. Base in ../style.css. */
.stage { display: grid; }
.field { position: relative; overflow: hidden; background: var(--sky); color: var(--ink); padding: 0 var(--pad) 22px; display: flex; flex-direction: column; }
.field > * { position: relative; }
.giant { position: absolute; top: 62px; right: calc(-1 * clamp(28px, 5vw, 80px)); width: clamp(120px, 22vw, 300px); aspect-ratio: 1; color: var(--ink); }
.giant svg { width: 100%; height: 100%; display: block; }
@media (max-width: 899px) { .giant { top: 36px; right: -22vw; width: 64vw; color: rgba(20, 33, 61, 0.14); } }
.field h1 { font-size: clamp(36px, 9vw, 68px); margin: 22px 0 20px; max-width: min(8em, calc(100% - clamp(80px, 16vw, 220px))); }

/* The square of points beside the read-outs (stacked on phones). */
.sim { display: grid; gap: 14px; max-width: 760px; }
.board { background: #fff; aspect-ratio: 1; width: 100%; max-width: min(360px, 62vw); }
.board canvas { display: block; width: 100%; height: 100%; }
.side { min-width: 0; display: grid; gap: 12px; align-content: start; }
.status { display: flex; gap: clamp(18px, 4vw, 40px); }
.num { font-size: clamp(22px, 4.6vw, 34px); font-weight: 800; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* The estimate, big, with the digits that already match pi on white. */
.pi { font-size: clamp(40px, 9vw, 64px); font-weight: 800; letter-spacing: -0.04em; line-height: 1.05; font-variant-numeric: tabular-nums; margin-top: 6px; }
.pi b { background: #fff; padding: 0 0.06em; font-weight: 800; }
.off { font-size: 16px; margin-top: 4px; }
.last { font-size: 15px; min-height: 1.5em; font-variant-numeric: tabular-nums; }

/* The estimate as points were added: a navy line, the real pi dashed, each step across 10 times more points. */
.chart { position: relative; height: clamp(96px, 16vh, 150px); border-left: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.chart svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.chart .line { fill: none; stroke: var(--ink); stroke-width: 2.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.chart .real { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 5 5; vector-effect: non-scaling-stroke; opacity: 0.6; }
.chart .hi, .chart .lo, .chart .mid, .chart .x { position: absolute; font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; }
.chart .hi { top: 2px; left: 6px; } .chart .lo { bottom: 2px; left: 6px; } .chart .mid { right: 4px; transform: translateY(-110%); }
.chart .x { bottom: -17px; transform: translateX(-50%); font-weight: 700; }
.chart .empty { position: absolute; inset: 0; display: grid; place-items: center; font-size: 15px; text-align: center; padding: 0 12px; }

.runs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 26px; max-width: 760px; }
.go { padding: 14px 4px; border: 2px solid var(--ink); border-radius: 0; background: transparent; color: var(--ink); font: 800 13px var(--font); letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; cursor: pointer; transition: background 0.15s var(--ease), color 0.15s var(--ease); }
.go.primary { background: var(--ink); color: #fff; }
.go.reset { border-style: dashed; }
@media (hover: hover) { .go:hover:not(:disabled) { background: #fff; color: var(--ink); } }
.go:active:not(:disabled) { transform: scale(0.97); }
.go:disabled { opacity: 0.45; cursor: default; }

.panel { background: var(--navy); color: #fff; padding: 24px var(--pad) 28px; }
.soft, .ev.soft { color: var(--navy-soft); }
.panel-title { font-size: clamp(28px, 5vw, 38px); letter-spacing: -0.02em; line-height: 1.05; }
.panel .hook { margin-top: 12px; font-size: 18px; }
.panel .more { display: inline-block; margin-top: 28px; color: #fff; }
.result { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 22px; padding-top: 10px; border-top: 2px solid rgba(255, 255, 255, 0.3); }
.result .val { font-size: clamp(22px, 4.6vw, 30px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; margin-top: 4px; font-variant-numeric: tabular-nums; }
.verdict { margin-top: 14px; font-size: 17px; }
.actions { margin-top: 18px; }
.actions button { padding: 14px 20px; border: 2px solid #fff; border-radius: 0; background: transparent; color: #fff; font: 800 13px var(--font); letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; }
@media (hover: hover) { .actions button:hover { background: var(--orange); border-color: var(--orange); color: var(--ink); } }

/* The math: what each digit costs, the method in steps, one worked count, and every digit's price on a green field. */
.math { padding-top: clamp(40px, 7vw, 72px); }
.math h2 { font-size: clamp(36px, 6vw, 64px); padding-bottom: 14px; border-bottom: var(--rule) solid var(--ink); }
.math .therefore { margin-top: clamp(20px, 3vw, 32px); font-size: clamp(18px, 2vw, 22px); max-width: 36em; color: var(--ink-soft); }
.math .ladder { list-style: none; margin: clamp(20px, 3vw, 32px) 0 0; padding: 0; max-width: 900px; }
.math .ladder li { display: grid; grid-template-columns: 5em 9em 1fr; align-items: center; gap: 12px; padding: 7px 0; border-top: 1px solid rgba(20, 33, 61, 0.15); font-size: 17px; }
.math .ladder b { font-size: clamp(17px, 2vw, 22px); font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; white-space: nowrap; }
.math .ladder i { display: block; height: 14px; min-width: 2px; background: var(--ink); }
.math .ladder .best { border-top: var(--rule) solid var(--ink); border-bottom: var(--rule) solid var(--ink); font-weight: 700; }
.math .ladder .best i { background: var(--orange); }
.math .ladder-note { margin-top: 10px; font-size: 15px; color: var(--ink-soft); }
.math .steps-math { margin: clamp(28px, 4vw, 44px) 0 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 14px; max-width: 40em; }
.math .steps-math li { counter-increment: s; display: grid; grid-template-columns: 34px 1fr; gap: 12px; font-size: clamp(17px, 1.8vw, 20px); color: var(--ink-soft); }
.math .steps-math li::before { content: counter(s); display: grid; place-items: center; width: 34px; height: 34px; background: var(--ink); color: #fff; font-weight: 800; }
.math .steps-math b { color: var(--ink); }
.math .worked { margin-top: clamp(24px, 4vw, 40px); font-size: clamp(28px, 5.6vw, 72px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.math .worked .hl { background: var(--orange); padding: 0 0.12em; }
.math .worked .eq { display: block; font-size: clamp(16px, 1.6vw, 20px); font-weight: 700; color: var(--ink-soft); letter-spacing: 0; margin-bottom: 0.4em; }
.math .odds { margin-top: clamp(32px, 5vw, 56px); background: var(--green); color: #fff; padding: clamp(20px, 4vw, 40px); }
.math .odds h3 { font-size: clamp(24px, 3vw, 34px); letter-spacing: -0.02em; }
.math table { width: 100%; border-collapse: collapse; margin: 18px 0 20px; }
.math th, .math td { padding: 10px 0; border-top: 2px solid rgba(255, 255, 255, 0.5); text-align: right; vertical-align: baseline; font-variant-numeric: tabular-nums; white-space: nowrap; }
.math tr:first-child th { font-size: 13px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; border-top: 0; white-space: normal; }
.math th:first-child { text-align: left; }
.math tr:not(:first-child) th, .math td { font-size: clamp(16px, 2.6vw, 26px); font-weight: 800; letter-spacing: -0.02em; }
.math .odds p { max-width: 40em; color: rgba(255, 255, 255, 0.92); }
.math .source { margin-top: 32px; font-size: 15px; color: var(--ink-soft); max-width: 60em; }

@media (min-width: 900px) {
  .stage { grid-template-columns: minmax(0, 1.55fr) minmax(380px, 1fr); min-height: 100svh; }
  .field { padding-bottom: 36px; }
  .field h1 { font-size: clamp(40px, 4.4vw, 60px); }
  /* Less of this one runs off the edge than on other pages: cut in half, the letter pi reads as a T. */
  .giant { width: clamp(120px, 14vw, 200px); right: -14px; }
  .sim { grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 24px; margin-top: 10px; }
  .board { max-width: none; }
  .panel { padding-top: 76px; padding-bottom: 36px; display: flex; flex-direction: column; }
  .panel .more { margin-top: auto; padding-top: 28px; align-self: flex-start; }
}
/* Phones, once points are in: the title and giant pictogram give their room to the square and the controls. */
@media (max-width: 899px) {
  .playing .field h1, .playing .giant { display: none; }
  .playing .sim { margin-top: 14px; }
  .sim { grid-template-columns: minmax(0, 46vw) minmax(0, 1fr); gap: 12px; }
  .board { max-width: none; }
  .chart { grid-column: 1 / -1; }
  .side { display: contents; }
  .status { flex-direction: column; gap: 8px; }
  .estimate, .last { grid-column: 1 / -1; }
  .go { font-size: 11px; letter-spacing: 0.02em; }
}
@media (max-width: 640px) {
  .math .ladder li { grid-template-columns: 4.2em 7.4em 1fr; gap: 8px; font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
