/* Serral editorial system, lifted from Serral/app/.../Theme.kt so the two
   products read as one house. Palette and type scale are the exact values from
   that file; the light theme was retired there, so this is dark-only. */

@font-face {
  font-family: "Instrument Serif";
  src: url("/static/fonts/instrument_serif.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("/static/fonts/instrument_serif_italic.ttf") format("truetype");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  --ink: #141311;          /* page */
  --ink-card: #1c1a17;     /* boxed callouts */
  --paper: #f7f5ef;        /* primary text */
  /* Serral's ramp was tuned for a phone held close. On a desktop monitor at
     arm's length --muted/--faint fell below comfortable reading contrast, so
     both are lifted; hairlines come up with them to stay proportional. */
  --muted: #a8a49a;        /* secondary text */
  --faint: #837e74;        /* labels, timestamps */
  --rule: #3a3631;         /* hairlines */

  --bear: #c4674a;
  --bull: #5fa37a;
  --neutral: #9a958b;
  --amber: #cba35c;        /* happening now, not directional */

  --bear-wash: #241511;
  --bull-wash: #10201a;
  --neutral-wash: #1b1a17;

  --editorial: "Instrument Serif", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 22px;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 660px;
  margin: 0 auto;
  padding: 26px 22px 120px;
}

/* ---- primitives (Label / Rule / Section / Serif) ---- */

.label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--faint);
  line-height: 1.4;
}

.rule {
  height: 1px;
  background: var(--rule);
  border: 0;
  margin: 0;
}

.serif {
  font-family: var(--editorial);
  font-weight: 400;
  line-height: 1.24;
  letter-spacing: -0.005em;
}

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}
.masthead .wordmark {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--paper);
}

.masthead-right { display: flex; align-items: baseline; gap: 16px; }
.authlink { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--rule); }
.authlink:hover { color: var(--paper); border-bottom-color: var(--faint); }

/* ---- intro ---- */

.intro { padding: 40px 0 30px; }
.intro h1 {
  font-family: var(--editorial);
  font-weight: 400;
  font-size: 40px;
  line-height: 1.14;
  letter-spacing: -0.015em;
  margin: 14px 0 12px;
}
.intro p {
  color: var(--muted);
  margin: 0;
  max-width: 46ch;
}

/* ---- ask ---- */

.ask { margin-top: 8px; }

textarea {
  width: 100%;
  background: var(--ink-card);
  border: 1px solid var(--rule);
  border-radius: 2px;
  color: var(--paper);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 23px;
  padding: 16px;
  resize: vertical;
  outline: none;
}
textarea:focus { border-color: var(--faint); }
textarea::placeholder { color: var(--faint); }

.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}
.spacer { flex: 1; }

button, .file span {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 2px;
  color: var(--muted);
  padding: 11px 16px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
button:hover, .file span:hover { border-color: var(--faint); color: var(--paper); }

button.primary {
  background: var(--paper);
  border-color: var(--paper);
  color: var(--ink);
  font-weight: 600;
}
button.primary:hover { background: #fff; border-color: #fff; color: var(--ink); }
button.primary:disabled {
  background: transparent;
  border-color: var(--rule);
  color: var(--faint);
  cursor: default;
}

#preview {
  margin-top: 14px;
  max-width: 100%;
  max-height: 260px;
  border: 1px solid var(--rule);
  display: block;
}

/* ---- picks ---- */

.picks { margin-top: 42px; }
.picks-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 10px;
}
#picks { list-style: none; margin: 0; padding: 0; }
#picks li {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
}
#picks li:hover .pick-title { color: #fff; }
.pick-main { flex: 1; min-width: 0; }
.pick-title {
  color: var(--paper);
  font-size: 14.5px;
  line-height: 19px;
  transition: color 0.15s;
}
.pick-sub {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--faint);
  margin-top: 4px;
}
.pick-nums {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pick-prob {
  font-family: var(--editorial);
  font-size: 25px;
  line-height: 1;
  color: var(--paper);
}
.pick-edge {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.5px;
  width: 52px;
  text-align: right;
}
.pick-edge.up { color: var(--bull); }
.pick-edge.down { color: var(--bear); }
.pick-edge.flat { color: var(--faint); }

/* ---- progress ---- */

.progress { margin-top: 34px; }

.progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 10px;
}
.progress-head .status {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--amber);
}
.progress-head .status.done { color: var(--faint); }
.elapsed {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.4px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.steps {
  list-style: none;
  margin: 0;
  padding: 12px 0 0;
  max-height: 210px;
  overflow-y: auto;
}
.steps li {
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--faint);
  padding: 3px 0 3px 14px;
  border-left: 1px solid var(--rule);
  animation: fadein 0.25s ease;
}
.steps li.search { color: var(--muted); }
.steps li.search::before { content: "› "; color: var(--faint); }
@keyframes fadein { from { opacity: 0 } to { opacity: 1 } }

details { margin-top: 14px; }
summary {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--faint);
  cursor: pointer;
  list-style: none;
}
summary::-webkit-details-marker { display: none; }
summary::before { content: "+ "; }
details[open] summary::before { content: "− "; }

#thinking {
  white-space: pre-wrap;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 21px;
  color: var(--faint);
  max-height: 280px;
  overflow-y: auto;
  margin: 12px 0 0;
}

/* ---- the read ---- */

.result { margin-top: 40px; }

.read-band {
  padding: 26px 0 22px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin-bottom: 4px;
}
.read-band.bull { background: var(--bull-wash); }
.read-band.bear { background: var(--bear-wash); }
.read-band.neutral { background: var(--neutral-wash); }
.read-band > * { padding-left: 18px; padding-right: 18px; }

.verdict {
  font-family: var(--editorial);
  font-size: 46px;
  line-height: 1.05;
  letter-spacing: 0.02em;
  margin: 10px 0 6px;
  text-transform: uppercase;
}
.verdict.bull { color: var(--bull); }
.verdict.bear { color: var(--bear); }
.verdict.neutral { color: var(--neutral); }

.gauge { margin-top: 20px; }
.gauge-scale {
  display: flex;
  align-items: center;
  gap: 10px;
}
.gauge-scale .end {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--faint);
  white-space: nowrap;
}
.track {
  flex: 1;
  position: relative;
  height: 20px;
}
.track::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 9px;
  height: 1px;
  background: var(--rule);
}
.track .tick {
  position: absolute;
  top: 5px;
  width: 1px; height: 9px;
  background: var(--rule);
}
.track .marker {
  position: absolute;
  top: 1px;
  width: 2px; height: 18px;
  background: var(--paper);
  transform: translateX(-1px);
  transition: left 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.readout {
  display: flex;
  align-items: baseline;
  gap: 26px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}
.readout .cell { display: flex; align-items: baseline; gap: 9px; }
.readout .val {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--paper);
  font-variant-numeric: tabular-nums;
}
.pips { letter-spacing: 1.5px; color: var(--paper); font-size: 12px; }
.pips .off { color: var(--rule); }

/* ---- out-of-scope notice (replaces the read band) ---- */

.notice {
  padding: 24px 20px;
  border: 1px solid var(--rule);
  border-left: 2px solid var(--amber);
  background: var(--neutral-wash);
  border-radius: 2px;
}
.notice h2 {
  font-family: var(--editorial);
  font-weight: 400;
  font-size: 27px;
  line-height: 1.2;
  margin: 10px 0 0;
  color: var(--paper);
}

/* ---- sections ---- */

.card {
  background: var(--ink-card);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 22px 20px;
  margin-top: 18px;
}
.card > h2 {
  font-family: var(--editorial);
  font-weight: 400;
  font-size: 25px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 14px;
  color: var(--paper);
}
.card p { margin: 0 0 12px; color: var(--paper); }
.card p:last-child { margin-bottom: 0; }
.card ul { margin: 0; padding-left: 0; list-style: none; }
.card li {
  position: relative;
  padding: 0 0 0 18px;
  margin-bottom: 12px;
  color: var(--paper);
}
.card li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--faint);
}
.card li:last-child { margin-bottom: 0; }
.card a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}
.card a:hover { color: var(--paper); border-bottom-color: var(--faint); }
.card strong { font-weight: 600; }
.card em { font-family: var(--editorial); font-style: italic; font-size: 1.08em; }
.card code {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--amber);
}

/* ---- sources ---- */

.sources { margin-top: 22px; }
#sources { list-style: none; margin: 12px 0 0; padding: 0; }
#sources li {
  padding: 6px 0;
  border-top: 1px solid var(--rule);
  font-size: 13px;
  line-height: 19px;
}
#sources a { color: var(--muted); text-decoration: none; }
#sources a:hover { color: var(--paper); }
#sources .age {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--faint);
  margin-left: 8px;
}

/* ---- footer ---- */

.meter {
  margin-top: 26px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.disclaimer {
  margin-top: 30px;
  font-size: 11.5px;
  line-height: 17px;
  color: var(--faint);
}

.again { margin-top: 22px; width: 100%; }

.error button.retry {
  margin-top: 12px;
  border-color: var(--bear);
  color: var(--bear);
}
.error button.retry:hover { border-color: var(--paper); color: var(--paper); }

.error {
  margin-top: 26px;
  padding: 16px 18px;
  border: 1px solid var(--bear);
  background: var(--bear-wash);
  color: var(--bear);
  font-size: 13.5px;
}

[hidden] { display: none !important; }
