/* OUTFOX — nocturnal, sly, premium.
   Night-ink ground, fox orange as the only hot accent, moonlight cream text.
   No green, no red: success and failure speak in orange intensity. */

/* ---------------------------------------------------------------- fonts */

@font-face {
  font-family: "Fraunces";
  src: url("../assets/fonts/fraunces-var.woff2") format("woff2");
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #0a0f1e;
  --ink-2: #0e1526;
  --panel: #121a30;
  --line: #1e2a46;
  --line-soft: #182238;
  --fox: #f97316;
  --fox-bright: #ff8a3d;
  --fox-dim: rgba(249, 115, 22, 0.14);
  --cream: #fff4e4;
  --cream-dim: rgba(255, 244, 228, 0.62);
  --slate: #8b96b5;
  --slate-dim: #57628a;
  --bar-crowd: #3a4568;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------------------------------------------------------------- base */

* { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

html { color-scheme: dark; }

body {
  background: var(--ink);
  color: var(--cream);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.display { font-family: var(--display); font-weight: 600; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--fox);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--fox);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 0 0 8px 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* ---------------------------------------------------------------- header */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 10px;
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
}

.brand { display: flex; align-items: center; gap: 10px; }

.foxmark { color: var(--fox); flex: none; }

.wordmark {
  font-family: var(--display);
  font-weight: 700;
  font-size: 21px;
  letter-spacing: 0.14em;
  color: var(--cream);
}

.day-chip {
  font-size: 12px;
  color: var(--slate);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 9px;
  margin-left: 2px;
}

.header-nav { display: flex; gap: 4px; }

.icon-btn {
  color: var(--slate);
  padding: 9px;
  border-radius: 10px;
  display: inline-flex;
  transition: color 0.15s ease, background 0.15s ease;
}
.icon-btn:hover { color: var(--cream); background: var(--panel); }

/* ---------------------------------------------------------------- layout */

.wrap {
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
  padding: 8px 18px 40px;
  flex: 1;
}

.site-footer {
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
  padding: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--slate-dim);
  font-size: 13px;
  border-top: 1px solid var(--line-soft);
}

.link-btn {
  color: var(--slate);
  font-size: 13px;
  text-decoration: underline;
  text-decoration-color: var(--slate-dim);
  text-underline-offset: 3px;
  padding: 4px;
}
.link-btn:hover { color: var(--cream); }

/* ---------------------------------------------------------------- type */

.kicker {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fox);
  margin: 18px 0 10px;
}

.question {
  font-size: clamp(28px, 7.4vw, 40px);
  line-height: 1.14;
  letter-spacing: -0.01em;
  color: var(--cream);
  margin-bottom: 12px;
}

.headline {
  font-size: clamp(26px, 6.6vw, 36px);
  line-height: 1.15;
  margin: 6px 0 10px;
}

.subline { color: var(--slate); font-size: 15px; max-width: 46ch; }

.footnote { color: var(--slate-dim); font-size: 13px; margin-top: 18px; }

/* ---------------------------------------------------------------- banner */

.reveal-banner {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 16px;
  margin-top: 10px;
  color: var(--cream);
  font-size: 14.5px;
  transition: border-color 0.15s ease;
}
.reveal-banner:hover { border-color: var(--fox); }

.reveal-banner-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fox);
  flex: none;
  animation: pulse 2.4s ease-in-out infinite;
}

.reveal-banner-arrow { margin-left: auto; color: var(--fox); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ---------------------------------------------------------------- inputs */

#pick-ui { margin: 26px 0 8px; }

/* number grid (1–20) */
.num-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.num-btn {
  font-family: var(--mono);
  font-size: 19px;
  color: var(--cream);
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 0;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.num-btn:hover { border-color: var(--slate-dim); }
.num-btn[aria-pressed="true"] {
  border-color: var(--fox);
  background: var(--fox-dim);
  color: var(--fox-bright);
  font-weight: 700;
}

/* option cards */
.option-list { display: flex; flex-direction: column; gap: 10px; }

.option-card {
  text-align: left;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 15px 16px;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.option-card:hover { border-color: var(--slate-dim); }
.option-card[aria-pressed="true"] {
  border-color: var(--fox);
  background: var(--fox-dim);
}
.option-name {
  font-family: var(--display);
  font-weight: 600;
  font-size: 18px;
  color: var(--cream);
  display: block;
}
.option-card[aria-pressed="true"] .option-name { color: var(--fox-bright); }
.option-blurb { color: var(--slate); font-size: 13.5px; display: block; margin-top: 2px; }

/* two-thirds slider + keypad */
.guess-box { display: flex; flex-direction: column; gap: 18px; align-items: center; }

.guess-readout-row { display: flex; align-items: center; gap: 18px; }

.step-btn {
  font-family: var(--mono);
  font-size: 22px;
  color: var(--slate);
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.step-btn:hover { color: var(--cream); border-color: var(--slate-dim); }

.guess-readout {
  font-family: var(--mono);
  font-size: 56px;
  font-weight: 600;
  width: 130px;
  text-align: center;
  color: var(--fox-bright);
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--line);
  padding: 2px 0 6px;
  -moz-appearance: textfield;
  appearance: textfield;
}
.guess-readout::-webkit-outer-spin-button,
.guess-readout::-webkit-inner-spin-button { -webkit-appearance: none; }
.guess-readout::placeholder { color: var(--slate-dim); }
.guess-readout:focus { outline: none; border-bottom-color: var(--fox); }

.guess-slider { width: 100%; accent-color: var(--fox); height: 32px; }

.guess-scale {
  width: 100%;
  display: flex;
  justify-content: space-between;
  color: var(--slate-dim);
  font-size: 12px;
  margin-top: -10px;
}

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

.btn-primary {
  display: block;
  width: 100%;
  margin-top: 22px;
  background: var(--fox);
  color: #1a0e02;
  font-weight: 700;
  font-size: 17px;
  border-radius: 13px;
  padding: 15px 20px;
  transition: background 0.15s ease, transform 0.1s ease;
}
.btn-primary:hover:not(:disabled) { background: var(--fox-bright); }
.btn-primary:active:not(:disabled) { transform: scale(0.985); }
.btn-primary:disabled { background: var(--line); color: var(--slate-dim); cursor: default; }

.btn-ghost {
  display: block;
  width: 100%;
  margin-top: 10px;
  color: var(--slate);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 13px 20px;
  font-size: 15px;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.btn-ghost:hover { color: var(--cream); border-color: var(--slate-dim); }

.action-row { margin-top: 26px; }

.back-link {
  color: var(--slate);
  font-size: 14px;
  padding: 6px 2px;
  margin-top: 10px;
}
.back-link:hover { color: var(--cream); }

/* ---------------------------------------------------------------- result */

.status-chip {
  display: inline-block;
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  color: var(--slate);
  border-radius: 999px;
  padding: 3px 11px;
  margin-bottom: 8px;
}
.status-chip.final { border-color: var(--fox); color: var(--fox); }

.beat-line {
  font-family: var(--mono);
  color: var(--cream);
  font-size: 17px;
  margin: 20px 0 10px;
}
.beat-line strong { color: var(--fox-bright); font-weight: 600; }

.blocks { display: flex; gap: 5px; margin-bottom: 26px; }
.block {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: var(--line-soft);
}
.block.on { background: var(--fox); }

.editorial {
  font-style: italic;
  font-size: 19px;
  color: var(--cream-dim);
  border-left: 3px solid var(--fox);
  padding: 4px 0 4px 16px;
  margin: 26px 0 4px;
}

/* ---------------------------------------------------------------- histogram
   The hero. Bars rise with a stagger; your bar burns orange; annotations
   are chalk marks on the night. */

.hist {
  background: var(--ink-2);
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  padding: 22px 16px 14px;
  margin-top: 8px;
}

.hist-title {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--slate-dim);
  margin-bottom: 16px;
}

.hist-plot { position: relative; height: 170px; }

.hist-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 100%;
}

.hbar { flex: 1; height: 100%; position: relative; display: flex; align-items: flex-end; }

.hbar-fill {
  width: 100%;
  background: var(--bar-crowd);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  transform-origin: bottom;
}
.hbar.you .hbar-fill {
  background: var(--fox);
  box-shadow: 0 0 14px rgba(249, 115, 22, 0.45);
}

@keyframes bar-rise {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}
.hist.animate .hbar-fill {
  animation: bar-rise 0.5s cubic-bezier(0.2, 0.7, 0.3, 1) both;
  animation-delay: var(--d, 0s);
}

.hbar-topnum {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--slate);
  white-space: nowrap;
}
.hbar.you .hbar-topnum { color: var(--fox-bright); font-weight: 700; }

.hist-labels { display: flex; gap: 3px; margin-top: 7px; }
.hist-label {
  flex: 1;
  text-align: center;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--slate-dim);
  overflow: hidden;
}
.hist-label.you { color: var(--fox-bright); font-weight: 700; }

.hist-optlabels { display: flex; gap: 3px; margin-top: 8px; }
.hist-optlabel {
  flex: 1;
  text-align: center;
  font-size: 12px;
  line-height: 1.25;
  color: var(--slate);
}
.hist-optlabel.you { color: var(--fox-bright); }

/* chalk annotations */
.chalk-vline {
  position: absolute;
  top: -4px;
  bottom: 0;
  width: 0;
  border-left: 2px dashed var(--cream-dim);
  pointer-events: none;
}
.chalk-hline {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 2px dashed var(--cream-dim);
  pointer-events: none;
}
.chalk-tag {
  position: absolute;
  font-family: var(--display);
  font-style: italic;
  font-size: 12.5px;
  color: var(--cream-dim);
  transform: rotate(-2deg);
  white-space: nowrap;
  pointer-events: none;
  background: rgba(14, 21, 38, 0.85);
  padding: 0 5px;
  border-radius: 4px;
}

.hist-footnote {
  font-size: 12px;
  color: var(--slate-dim);
  margin-top: 12px;
}

/* ---------------------------------------------------------------- history */

.stat-row {
  display: flex;
  gap: 10px;
  margin: 20px 0 24px;
}
.stat {
  flex: 1;
  background: var(--ink-2);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 14px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-num { font-size: 26px; color: var(--fox-bright); font-weight: 600; }
.stat-label { font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--slate-dim); }

.history-list { list-style: none; display: flex; flex-direction: column; gap: 9px; }

.history-item {
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--ink-2);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 13px 15px;
  transition: border-color 0.12s ease;
}
.history-item:hover { border-color: var(--slate-dim); }

.history-day { font-family: var(--mono); color: var(--slate-dim); font-size: 12.5px; width: 40px; flex: none; }
.history-main { flex: 1; min-width: 0; }
.history-format { font-family: var(--display); font-weight: 600; font-size: 15.5px; color: var(--cream); }
.history-outcome { font-size: 12.5px; color: var(--slate); }
.history-pct { font-family: var(--mono); color: var(--fox-bright); font-size: 15px; flex: none; }
.history-blocks { display: flex; gap: 2px; flex: none; }
.history-blocks .block { width: 7px; height: 7px; border-radius: 2px; }

/* ---------------------------------------------------------------- seal */

.seal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 30, 0.94);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 50;
}

.seal-stamp {
  width: 118px;
  height: 118px;
  border: 2.5px solid var(--fox);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fox);
  animation: stamp 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
  box-shadow: 0 0 40px rgba(249, 115, 22, 0.25);
}

.seal-text {
  color: var(--cream);
  font-size: 22px;
  animation: seal-fade 0.3s ease 0.3s both;
}

@keyframes stamp {
  from { transform: scale(1.9) rotate(-14deg); opacity: 0; }
  to { transform: scale(1) rotate(0deg); opacity: 1; }
}
@keyframes seal-fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------------------------------------------------------- modal */

.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 560px) { .modal { align-items: center; } }

.modal-backdrop { position: absolute; inset: 0; background: rgba(4, 7, 15, 0.7); }

.modal-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px 20px 0 0;
  padding: 26px 22px 30px;
  max-width: 560px;
  width: 100%;
  max-height: 86dvh;
  overflow-y: auto;
  animation: modal-up 0.25s ease both;
}
@media (min-width: 560px) { .modal-card { border-radius: 20px; } }

@keyframes modal-up {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-card h2 { font-size: 24px; margin-bottom: 14px; padding-right: 36px; }
.modal-card h3 { font-size: 18px; margin: 20px 0 8px; }
.modal-card p { color: var(--slate); font-size: 15px; margin-bottom: 12px; }
.modal-card p strong { color: var(--cream); }
.modal-card p em { color: var(--cream-dim); }

.modal-close { position: absolute; top: 14px; right: 14px; }

/* ---------------------------------------------------------------- toast */

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--cream);
  color: var(--ink);
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 999px;
  z-index: 70;
  animation: toast-in 0.2s ease both;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------------------------------------------------------------- motion */

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