/* ==========================================================================
   zetamac.css — the /zetamac/ game page, native to base.css v3 ("tilde rail").
   Same split as the rail itself: Source Serif 4 for prose, IBM Plex Mono for
   anything operational or numeric — problems, timers, scores, buttons, form
   controls. One centered column in the space right of the rail; hairlines
   instead of cards; green as the working accent, pink strictly on hover.
   ========================================================================== */

.wrap.wrap-wide {
  /* 44rem game column (--z-measure) + the wrap's own padding. Overriding
     --wrap-max (not max-width) keeps base .wrap's geometry in sync, so
     /zetamac/ gets the same anchored-left-of-center column as every other
     page. (The old max-width:none workaround predates the rail offset
     moving to body padding; .wrap no longer overflows the viewport.) */
  --wrap-max: calc(44rem + 2 * var(--content-pad));
}

/* This sheet only loads on /zetamac/. Reserve the scrollbar gutter so the
   centered column doesn't slide sideways when a screen change grows or
   shrinks the page past the viewport height. */
html {
  scrollbar-gutter: stable;
}

/* The JS toggles visibility via the hidden attribute. Author display values
   (flex/grid) would otherwise beat the UA's [hidden]{display:none}. */
[hidden] {
  display: none !important;
}

/* Every screen shares this one measure, so switching screens never changes
   the column's width or position — no jumping between landing, settings,
   game, and results. */
.zetamac {
  --z-measure: 44rem;
  max-width: var(--z-measure);
  margin-inline: auto;
  padding-top: 12px;
}

/* Numbers everywhere (timers, scores, problems) sit in mono with fixed-width
   digits so the display doesn't shimmy as they tick over. */
.z-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ---- Screens ------------------------------------------------------------- */
.z-screen--game {
  position: relative;
}

.z-title {
  font-size: 30px;
  font-weight: 600;
  line-height: 1.16;
  margin-bottom: 18px;
}
.z-heading {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 20px;
}
.z-subheading {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 10px;
}
.z-intro {
  color: var(--ink-muted);
  margin-bottom: 36px;
  text-wrap: pretty;
}
.z-block {
  margin-bottom: 20px;
  text-wrap: pretty;
}
.z-dim {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-muted);
}

/* ---- Notice strip -------------------------------------------------------- */
.z-notice {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 28px;
  padding: 6px 0 6px 12px;
  border-left: 2px solid var(--green);
  font-family: var(--font-mono);
  font-size: 13px;
}
.z-notice-close {
  font: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--ink-muted);
  transition: color 150ms ease;
}
.z-notice-close:hover {
  color: var(--pink);
}

/* ---- Landing modes: hairline rows, archive-style ------------------------- */
.z-modes {
  border-top: 1px solid var(--hairline);
}
.z-mode {
  font: inherit;
  color: var(--ink);
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--hairline-soft);
  width: 100%;
  padding: 16px 0 18px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.z-mode-name {
  font-family: var(--font-mono);
  font-size: 14px;
  text-transform: lowercase;
  color: var(--green);
  transition: color 150ms ease;
}
.z-mode-name::before {
  content: "~ " / "";
}
.z-mode:hover .z-mode-name {
  color: var(--pink);
}
.z-mode-desc {
  color: var(--ink-muted);
  font-size: 15px;
  line-height: 1.55;
  max-width: 54ch;
  text-wrap: pretty;
}

/* ---- Forms / controls ----------------------------------------------------- */
.z-btn {
  font-family: var(--font-mono);
  font-size: 13px;
  text-transform: lowercase;
  color: var(--ink);
  background: none;
  border: 1px solid var(--hairline);
  padding: 7px 14px;
  cursor: pointer;
  transition:
    color 150ms ease,
    border-color 150ms ease;
}
.z-btn--primary {
  color: var(--green);
  border-color: var(--green);
  font-weight: 500;
}
.z-btn:hover:not(:disabled) {
  color: var(--pink);
  border-color: var(--pink);
}
.z-btn:disabled {
  color: var(--ink-muted);
  border-color: var(--hairline-soft);
  cursor: default;
}
.z-linkbtn {
  font-family: var(--font-mono);
  font-size: 13px;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--green);
  text-decoration: none;
  transition: color 150ms ease;
}
.z-linkbtn:hover {
  color: var(--pink);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.z-input,
.z-select,
.z-range-input {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--hairline);
  padding: 4px 8px;
}
.z-range-input {
  width: 4.2rem;
  text-align: right;
  /* ≥16px: keep iOS Safari from auto-zooming the page when a range field
     is tapped (it inherits the 13px .z-op-detail size otherwise). */
  font-size: 16px;
}
.z-input--code {
  width: 8ch;
  text-transform: uppercase;
  letter-spacing: 0.2ch;
}
.z-check input[type="checkbox"] {
  accent-color: var(--green);
  width: 1rem;
  height: 1rem;
  margin-right: 0.3rem;
}
.z-op {
  margin-bottom: 1rem;
}
.z-op-detail {
  margin-top: 0.35rem;
  padding-left: 1.8rem;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 13px;
}
.z-actions {
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  margin-top: 32px;
  flex-wrap: wrap;
}

/* ---- Game arena ------------------------------------------------------------ */
.z-game-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-muted);
}
.z-game-label {
  color: var(--ink);
  font-weight: 500;
}
.z-scorebox {
  margin-bottom: 40px;
  font-family: var(--font-mono);
  font-size: 13px;
}
.z-duel-bar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 40px;
  font-family: var(--font-mono);
  font-size: 13px;
}
.z-duel-player {
  white-space: nowrap;
}
.z-arena {
  position: relative;
  border-top: 1px solid var(--hairline-soft);
  border-bottom: 1px solid var(--hairline-soft);
  padding: 56px 0 64px;
  text-align: center;
}
.z-problem-row {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 0.6ch;
  flex-wrap: wrap;
}
.z-problem {
  font-family: var(--font-mono);
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  font-weight: 500;
  line-height: 1.2;
}
.z-answer {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  font-weight: 500;
  line-height: 1.2;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 2px solid var(--ink);
  width: 5ch;
  text-align: left;
  padding: 0 0.1ch;
}
.z-answer:focus-visible {
  outline: none; /* the green caret-line below replaces the box outline */
  border-bottom-color: var(--green);
}
.z-game-hint {
  margin-top: 40px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-muted);
}
.z-flash {
  position: absolute;
  top: 10px;
  left: 0;
  right: 0;
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
}

/* Overlay for countdown / pause / quit-confirm: sits over the arena. */
.z-overlay {
  position: absolute;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  text-align: center;
}
.z-overlay-text {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 500;
}
.z-overlay-sub {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-muted);
  max-width: 30rem;
}

/* ---- Results / recap ------------------------------------------------------- */
.z-result-score {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 500;
  margin-bottom: 10px;
}
.z-result-detail {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-muted);
}
.z-recap-line {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 8px 0;
  border-bottom: 1px solid var(--hairline-soft);
  font-size: 15px;
}
.z-recap-line:first-child {
  border-top: 1px solid var(--hairline);
}
.z-recap-what {
  font-weight: 600;
}
.z-recap-delta {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}
.z-recap-delta .up {
  color: var(--green);
  font-weight: 500;
}
.z-recap-totals {
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-muted);
}

/* ---- Practice dashboard ----------------------------------------------------- */
.z-dash-user {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-muted);
  margin-bottom: 1rem;
}
.z-dash-lifetime {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 2rem;
  margin-bottom: 2rem;
  font-family: var(--font-mono);
  font-size: 13px;
}
.z-life-stat b {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.z-stats-grid {
  display: grid;
  grid-template-columns: 6rem repeat(3, 1fr);
  gap: 1px;
  background: var(--hairline-soft);
  border: 1px solid var(--hairline);
  margin-bottom: 1rem;
  font-family: var(--font-mono);
  font-size: 13px;
}
.z-stat-cell {
  background: var(--bg);
  padding: 0.55rem 0.7rem;
}
.z-stat-cell--head {
  font-weight: 500;
}
.z-stat-acc {
  font-variant-numeric: tabular-nums;
}
.z-stat-ms {
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}
.z-stat-focus {
  color: var(--green);
  font-weight: 500;
}
.z-stat-trend {
  color: var(--ink-muted);
}
.z-facts-row {
  margin-bottom: 1rem;
  font-family: var(--font-mono);
  font-size: 13px;
}
.z-fact {
  display: inline-block;
  margin-right: 0.9ch;
  font-variant-numeric: tabular-nums;
}
.z-fact--solid {
  font-weight: 500;
}
.z-fact--weak {
  color: var(--green);
  font-weight: 500;
}
.z-bench-line {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-muted);
  margin-bottom: 1rem;
  font-variant-numeric: tabular-nums;
}

/* ---- Plan preview ----------------------------------------------------------- */
.z-plan-block {
  display: flex;
  gap: 1rem;
  padding: 8px 0;
  border-bottom: 1px solid var(--hairline-soft);
}
.z-plan-block:first-child {
  border-top: 1px solid var(--hairline);
}
.z-plan-kind {
  flex: 0 0 7.5rem;
  font-weight: 600;
}
.z-plan-desc {
  color: var(--ink-muted);
  font-size: 15px;
}
.z-plan-secs {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---- 1v1 -------------------------------------------------------------------- */
.z-duel-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  margin-top: 1.5rem;
}
@media (max-width: 600px) {
  .z-duel-columns {
    grid-template-columns: 1fr;
  }
}
.z-duel-custom {
  margin-bottom: 1rem;
}
.z-duel-custom summary {
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--green);
  margin-bottom: 0.75rem;
  transition: color 150ms ease;
}
.z-duel-custom summary:hover {
  color: var(--pink);
}
.z-roomcode {
  font-size: 32px;
  font-weight: 500;
  letter-spacing: 0.3ch;
  margin-bottom: 1rem;
}
.z-duel-final {
  margin-bottom: 1rem;
}
.z-duel-final-line {
  display: flex;
  justify-content: space-between;
  max-width: 20rem;
  gap: 2rem;
  padding: 0.35rem 0;
  font-family: var(--font-mono);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.z-duel-final-line .winner {
  font-weight: 600;
}
