/* Veyra on the web.
 *
 * Every value here is transcribed from the iOS source rather than eyeballed, because a build that
 * is four pixels off everywhere reads as a different product. Colours come from Theme.swift's
 * adaptive(light:dark:) tuples with each 0-1 channel multiplied by 255 and rounded; component
 * geometry comes from the SwiftUI modifiers themselves. iOS points map 1:1 to CSS pixels at 1x.
 *
 * The palette is stated for both appearances because Theme.swift is adaptive, and the page follows
 * the reader's system setting the way the app follows the phone's. */

:root {
  color-scheme: light dark;

  /* Theme.background: light (0.957,0.961,0.969) dark (0.05,0.055,0.07) */
  --bg: #f4f5f7;
  /* Theme.card: light (1,1,1) dark (0.09,0.10,0.12) */
  --card: #ffffff;
  /* Theme.field: light (0.925,0.933,0.949) dark (0.13,0.14,0.17) */
  --field: #eceef2;
  /* Hairlines invert: black on light, white on dark. */
  --border: rgba(0, 0, 0, 0.1);
  --divider: rgba(0, 0, 0, 0.08);
  --ink: #16181d;        /* primaryText   light (0.086,0.094,0.114) */
  --ink-2: #5a6068;      /* secondaryText light (0.353,0.376,0.408) */
  --ink-3: #8a9099;      /* tertiaryText  light (0.541,0.565,0.600) */
  --positive: #168b51;   /* light (0.086,0.545,0.318) */
  --negative: #cb2d2d;   /* light (0.796,0.176,0.176) */
  --accent: #1471c9;     /* light (0.078,0.443,0.788) */
  --caution: #b37a0d;    /* light (0.70,0.48,0.05), the 178.5 tie rounded half up */
  --on-accent: #ffffff;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0e12;
    --card: #171a1f;
    --field: #21242b;
    --border: rgba(255, 255, 255, 0.1);
    --divider: rgba(255, 255, 255, 0.08);
    --ink: #f2f2f2;
    --ink-2: #9e9e9e;
    --ink-3: #737373;
    --positive: #4dd18c;
    --negative: #f26161;
    --accent: #5cb3f5;
    --caution: #d99e26;
    --on-accent: #000000;
  }
}

* { box-sizing: border-box; }

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

/* The screen shell, identical on every tab in the app:
   ScrollView { VStack(spacing: 14) }.padding(.horizontal, 16).padding(.bottom, 28) */
.shell.wide { max-width: 1140px; }
.shell {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Standard site chrome: a sticky top bar with the brand on the left and the section nav beside
   it, the way the venues' own sites are laid out. The app's palette carries over; the bottom tab
   bar does not, because it is an iOS convention and this is a website. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--divider);
  margin-bottom: 18px;
}
.topbar-inner {
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 16px;
}
.brand {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
}
.topnav { display: flex; gap: 4px; flex: 1; }
.topnav button {
  border: 0;
  background: none;
  padding: 7px 12px;
  border-radius: 8px;
  color: var(--ink-2);
  font: 500 14px/1.2 var(--sans);
  cursor: pointer;
}
.topnav button:hover { color: var(--ink); }
.topnav button[aria-pressed='true'] {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.help { color: var(--ink-2); text-decoration: none; font-size: 14px; }
.help:hover { color: var(--ink); }

.sitefoot { border-top: 1px solid var(--divider); margin-top: 40px; }
.sitefoot-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 18px 16px 26px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-3);
}
.sitefoot nav { display: flex; gap: 16px; }
.sitefoot a { color: var(--ink-2); text-decoration: none; }
.sitefoot a:hover { color: var(--ink); }

/* Card: VStack(spacing:10).padding(14).background(card, radius 12).overlay(strokeBorder(border)) */
.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
}
/* Card title: 11pt semibold, kerning 0.6, uppercased, tertiary. Not monospaced. */
.card > h2 {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--ink-3);
}
/* Card footnote and every explanatory sub-line: 11pt regular tertiary, never truncated. */
.note { margin: 0; font-size: 11px; color: var(--ink-3); }
.note.caution { color: var(--caution); }
.note.negative { color: var(--negative); }
.body { margin: 0; font-size: 12px; color: var(--ink-2); }
.lead { margin: 0; font-size: 13px; font-weight: 600; color: var(--ink); }
.lead.caution { color: var(--caution); }

hr.divider { border: 0; border-top: 1px solid var(--divider); margin: 0; }

/* StatRow: label 13 regular secondary, value 14 regular monospaced (emphasis 19 semibold). */
.stat { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat > span:first-child { font-size: 13px; color: var(--ink-2); }
.stat > span:last-child {
  font-family: var(--mono);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.stat.emphasis > span:last-child { font-size: 19px; font-weight: 600; }
.stat.positive > span:last-child { color: var(--positive); }
.stat.negative > span:last-child { color: var(--negative); }
.stat.muted > span:last-child { color: var(--ink-3); }

/* Chip: 12/500, padding 8x6, radius 7, equal width across the row. Border present in BOTH states
   at the same width, so selecting one cannot shift the layout. */
.chiprow { display: flex; gap: 6px; }
.chiprow.scroll { overflow-x: auto; padding: 1px; scrollbar-width: none; }
.chiprow.scroll::-webkit-scrollbar { display: none; }
.chip {
  flex: 1 1 0;
  min-width: 0;
  padding: 6px 8px;
  border-radius: 7px;
  background: var(--field);
  border: 1px solid transparent;
  color: var(--ink-2);
  font: 500 12px/1.2 var(--sans);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.chip[aria-pressed='true'] {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  color: var(--accent);
}
.chip:disabled { color: color-mix(in srgb, var(--ink-3) 40%, transparent); cursor: default; }
.chiprow.scroll .chip { flex: 0 0 auto; }

/* Segmented control, the app's Picker(.segmented). */
.segmented {
  display: flex;
  gap: 2px;
  padding: 2px;
  border-radius: 9px;
  background: var(--field);
}
.segmented button {
  flex: 1;
  padding: 7px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-2);
  font: 500 13px/1.2 var(--sans);
  cursor: pointer;
}
.segmented button[aria-pressed='true'] {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.16);
}

/* Text fields. The app right-aligns every numeric entry and renders it monospaced. */
.field-row { display: flex; align-items: center; gap: 8px; }
.field-row > label { font-size: 13px; color: var(--ink-2); }
.field-row .grow { flex: 1; min-width: 0; }
input[type='text'] {
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 400 14px/1.3 var(--sans);
  padding: 2px 0;
  min-width: 0;
}
input.num {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 15px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
input:focus { outline: none; }
input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.unit { font-size: 13px; color: var(--ink-3); }

/* Field widths, as classes rather than style attributes. The app's CSP is style-src 'self' with
   no 'unsafe-inline', and a hash cannot authorise a style attribute, so an inline width would be
   blocked. Transcribed from the .frame(width:) modifiers in PickEmView.swift. */
.w-ladder { width: 80px; }
.w-pct    { width: 62px; }
.w-price  { width: 74px; }
.w-fair   { width: 58px; }
.w-boost  { width: 56px; }
.w-quote  { width: 110px; }

.body.medium { font-weight: 500; }
.body.positive { color: var(--positive); }

.leg { display: flex; flex-direction: column; gap: 6px; padding: 4px 0; }
.leg .index {
  font: 600 11px/1 var(--mono);
  color: var(--ink-3);
  width: 14px;
  flex: 0 0 auto;
}

/* Toggle, the app's Toggle(.tint(accent)). */
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.toggle span { font-size: 13px; }
.toggle input { appearance: none; margin: 0; cursor: pointer; }
.toggle input {
  width: 51px;
  height: 31px;
  border-radius: 999px;
  background: var(--field);
  position: relative;
  transition: background 0.15s;
}
.toggle input::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s;
}
.toggle input:checked { background: var(--accent); }
.toggle input:checked::after { transform: translateX(20px); }

/* Slider, the app's Slider(.tint(accent)). */
input[type='range'] { width: 100%; accent-color: var(--accent); }

.linkbtn {
  align-self: flex-start;
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent);
  font: 500 13px/1.2 var(--sans);
  cursor: pointer;
}
.linkbtn:disabled { color: var(--ink-3); cursor: default; }
.btnrow { display: flex; gap: 14px; align-items: center; }

/* The gap list under an operator: a middle dot and a wrapping line. */
.gaps { display: flex; flex-direction: column; gap: 3px; margin: 0; padding: 0; list-style: none; }
.gaps li {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  font-size: 11px;
  color: var(--ink-2);
}
.gaps li::before { content: '\00b7'; color: var(--ink-3); }

.blocker { display: flex; flex-direction: column; gap: 3px; }
.blocker .subjects { font-size: 13px; font-weight: 500; color: var(--ink); }

.footnote { font-size: 11px; color: var(--ink-3); margin: 4px 0 0; }

@media (max-width: 380px) {
  .segmented button { font-size: 12px; }
}

/* The search field: Theme.field ground, radius 10, 15pt, matching ScannerView's searchField. */
.search {
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: 10px;
  background: var(--field);
  color: var(--ink);
  font: 400 15px/1.3 var(--sans);
}
.search::placeholder { color: var(--ink-3); }


/* The Markets page, in Kalshi's page anatomy with Veyra's palette and type. */

/* The category strip: text links, active in ink with an underline, exactly the treatment the
   venue uses, minus its colours. */
.catnav {
  display: flex;
  gap: 22px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--divider);
  padding-bottom: 0;
}
.catnav::-webkit-scrollbar { display: none; }
.catnav button {
  border: 0;
  background: none;
  padding: 4px 0 10px;
  color: var(--ink-2);
  font: 500 15px/1.2 var(--sans);
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.catnav button:hover { color: var(--ink); }
.catnav button[aria-pressed='true'] {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

/* The page title row: a big bold section name with the count beside it, search to the right. */
.board-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.board-title h2 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
.board-count { font-size: 15px; font-weight: 500; color: var(--ink-3); font-family: var(--mono); }
.board-side { display: flex; align-items: center; gap: 12px; flex: 1; justify-content: flex-end; }
.board-side .search { max-width: 300px; }

/* Event cards. One column on a phone, two on a desktop, the venue's own density. */
.mktlist { display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 760px) {
  .mktlist {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 12px;
    align-items: start;
  }
}

.evt {
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  overflow: hidden;
}
.evt-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.evt-head { display: flex; align-items: center; gap: 8px; }
.evt-art {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  object-fit: cover;
  background: var(--field);
  flex: 0 0 auto;
}
.evt-art.glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--ink-2);
}
.evt-cat {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--ink-3);
}
.evt-when { margin-left: auto; font-size: 11px; color: var(--ink-3); }
.evt-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}

/* An outcome row: the side, what a dollar pays if it hits, and the price in an outlined capsule,
   which is the venue's own three-column reading order. */
.evt-outcome {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 2px;
}
.evt-side { font-size: 14px; font-weight: 500; color: var(--ink); flex: 1; }
.evt-pays {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.evt-odds {
  min-width: 66px;
  text-align: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1.5px solid color-mix(in srgb, var(--accent) 55%, transparent);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.evt-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 4px;
  font-size: 11px;
  color: var(--ink-3);
}

/* The hidden attribute maps to display:none at UA level, which ANY author display declaration
   beats. Without this rule every expanded panel renders pre-opened. */
.mkt-details[hidden] { display: none; }
.mkt-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--divider);
}

/* Grade pill: 9pt bold uppercase in a tinted capsule, from ScannerView's grade pill. */
.grade {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 2px 6px;
  border-radius: 999px;
}
.grade.ink-2 { color: var(--ink-2); background: color-mix(in srgb, var(--ink-2) 16%, transparent); }
.grade.ink-3 { color: var(--ink-3); background: color-mix(in srgb, var(--ink-3) 16%, transparent); }
.grade.caution { color: var(--caution); background: color-mix(in srgb, var(--caution) 16%, transparent); }
.grade.negative { color: var(--negative); background: color-mix(in srgb, var(--negative) 16%, transparent); }
