:root {
  --bg: #f6f7f8;
  --bg-card: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --accent: #087f5b;
  --danger: #dc2626;
  --track: #eef0f2;
  --bar-weak: #c5c9ce;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  height: 100dvh;
}

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font: 14px/1.4 Inter, "Segoe UI", Helvetica, Arial, sans-serif;
  font-feature-settings: "tnum" 1;
  letter-spacing: -0.011em;
  color: var(--text);
  background: var(--bg);
}

header {
  flex: 0 0 auto;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.bar {
  margin: 0;
  padding: 16px 20px 14px;
  display: grid;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text);
}

.tagline {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.rss-link {
  flex: 0 0 auto;
  margin-top: 2px;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
}

.rss-link:hover { text-decoration: underline; }

.controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

input[type="search"] {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text);
  outline: none;
  font: inherit;
}

input[type="search"]:focus {
  border-color: var(--accent);
}

button.reload {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--muted);
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
}

button.reload:hover {
  color: var(--text);
  border-color: #d1d5db;
}

main {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

main > :first-child {
  margin-left: auto;
}

main > :last-child {
  margin-right: auto;
}

main > .status,
main > .empty {
  flex: 1 1 auto;
  min-width: min(640px, calc(100vw - 40px));
}

.status, .empty {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  background: var(--bg-card);
}

.status.error { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  background: var(--track);
  padding: 1px 5px;
  border-radius: 3px;
}

article {
  flex: 0 0 min(400px, calc(100vw - 40px));
  width: min(400px, calc(100vw - 40px));
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px 16px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-x: auto;
  overscroll-behavior-y: contain;
  container-type: inline-size;
}

article h2 {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.25;
  color: var(--text);
}

.headline {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
  margin-top: -6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 400;
}

.outcomes {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.outcomes li {
  display: grid;
  gap: 3px;
}

.outcome-top {
  display: flex;
  align-items: baseline;
  gap: 10px 12px;
  min-width: 0;
}

.outcome-label {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.outcome-main {
  flex: 0 0 auto;
  font-size: 1rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1;
}

.outcome-main.is-last {
  color: var(--muted);
}

.outcome-main .tag {
  margin-left: 6px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: middle;
}

.prob-track {
  height: 8px;
  border-radius: 2px;
  background: var(--track);
  overflow: hidden;
}

.prob-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  min-width: 0;
}

.prob-fill.is-weak {
  background: repeating-linear-gradient(
    -45deg,
    var(--bar-weak),
    var(--bar-weak) 3px,
    color-mix(in srgb, var(--bar-weak) 70%, white) 3px,
    color-mix(in srgb, var(--bar-weak) 70%, white) 6px
  );
}

.prices {
  flex: 0 1 auto;
  margin-left: auto;
  color: var(--muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.metric b {
  font-weight: 600;
  color: var(--text);
}

.metric.bid b { color: var(--accent); }

@container (max-width: 420px) {
  .outcome-top {
    flex-wrap: wrap;
  }

  .prices {
    flex: 1 1 100%;
    margin-left: 0;
  }
}

.ticker-hint {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.7rem;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.15s ease;
  overflow-wrap: anywhere;
}

.outcomes li:hover .ticker-hint,
.outcomes li:focus-within .ticker-hint {
  opacity: 1;
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

details.more {
  color: var(--muted);
  font-size: 0.78rem;
}

details.more summary {
  cursor: pointer;
  user-select: none;
  list-style: none;
}

details.more summary::-webkit-details-marker { display: none; }

.more-body {
  margin-top: 8px;
  display: grid;
  gap: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.74rem;
}

a.market-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 600;
}

a.market-link:hover { text-decoration: underline; }

.outcomes-toggle {
  justify-self: start;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
}

.outcomes-toggle:hover { color: var(--text); }
