:root {
  --paper: #f2f5f0;
  --ink: #11150f;
  --muted: #5b665c;
  --hairline: rgba(17, 21, 15, 0.15);
  --accent: #b33a31;
  --green: #1f6d4b;
  --blue: #275b78;
  --gold: #9a7429;
  --soft: rgba(17, 21, 15, 0.045);
  --panel: rgba(248, 250, 246, 0.9);
  --font-body: "IBM Plex Sans", "Aptos", "Helvetica Neue", sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  --page-pad: clamp(12px, 2.2vw, 28px);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(17, 21, 15, 0.055) 1px, transparent 1px) 0 0 / 84px 100%,
    linear-gradient(rgba(17, 21, 15, 0.055) 1px, transparent 1px) 0 0 / 100% 22px,
    linear-gradient(180deg, rgba(39, 91, 120, 0.08), transparent 190px),
    var(--paper);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.36;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 20;
  opacity: 0.08;
  background-image: repeating-linear-gradient(37deg, rgba(17, 21, 15, 0.13) 0 1px, transparent 1px 4px);
  mix-blend-mode: multiply;
  pointer-events: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  padding: 0 var(--page-pad);
  border-bottom: 1px solid var(--hairline);
  background: rgba(238, 240, 235, 0.88);
  backdrop-filter: blur(16px);
}

.wordmark {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.nav {
  display: flex;
  gap: 14px;
  align-items: center;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
}

.nav a {
  position: relative;
  padding: 12px 0;
}

.nav a::after {
  position: absolute;
  right: 0;
  bottom: 8px;
  left: 0;
  height: 1px;
  background: var(--accent);
  content: "";
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 180ms ease;
}

.nav a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.section {
  padding-right: var(--page-pad);
  padding-left: var(--page-pad);
}

#markets,
#watchlist,
#sports,
#ai {
  scroll-margin-top: 64px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 520px);
  gap: 18px;
  align-items: center;
  min-height: 112px;
  padding-top: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--hairline);
}

.hero-copy {
  min-width: 0;
}

.kicker,
.section-number,
.control-panel span,
.signal-item span,
.panel-heading span,
.quote-meta,
.quote-source,
.event-status,
.event-date,
.news-meta,
.footer,
.source-pill,
.date-tape button {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.25;
}

.kicker {
  margin: 0 0 6px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 38px;
  font-weight: 700;
  line-height: 1;
}

.control-panel {
  display: grid;
  grid-template-columns: minmax(132px, 0.86fr) minmax(0, 1fr) 92px;
  gap: 0;
  align-items: stretch;
  min-width: 0;
  border: 1px solid var(--ink);
  background: rgba(248, 250, 246, 0.78);
  box-shadow: 0 12px 28px rgba(17, 21, 15, 0.08);
}

.date-field,
.capture-line {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 9px 12px;
}

.date-field {
  border-right: 1px solid var(--hairline);
}

.date-field input {
  width: 100%;
  min-width: 0;
  height: 30px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  color: var(--ink);
  background: transparent;
  color-scheme: light;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.1;
}

.date-field:focus-within input {
  border-color: var(--accent);
  outline: 0;
}

.date-field input::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.68;
}

.icon-button {
  min-width: 92px;
  min-height: 100%;
  border: 0;
  border-left: 1px solid var(--ink);
  border-radius: 0;
  color: var(--ink);
  cursor: pointer;
  background: rgba(31, 109, 75, 0.08);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  text-transform: uppercase;
  transition:
    background 160ms ease,
    color 160ms ease;
}

.icon-button:hover {
  color: var(--paper);
  background: var(--green);
}

.icon-button[disabled] {
  cursor: wait;
  opacity: 0.55;
}

.capture-line {
  align-content: center;
}

.capture-line strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.15;
}

.signal-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  border-bottom: 1px solid var(--ink);
  background: var(--ink);
}

.signal-item {
  min-width: 0;
  min-height: 64px;
  padding: 9px 12px;
  background: var(--panel);
}

.signal-item strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.18;
}

.split-section {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 18px;
  padding-top: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--hairline);
}

.section-heading {
  position: sticky;
  top: 58px;
  align-self: start;
}

.section-number {
  margin-bottom: 6px;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.05;
}

.market-grid,
.watch-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.ledger-panel,
.source-board {
  min-width: 0;
  border-top: 1px solid var(--ink);
}

.panel-heading {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
  min-height: 38px;
  padding: 8px 0;
  border-bottom: 1px solid var(--hairline);
}

.panel-heading strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.15;
  text-align: right;
}

.quote-list,
.quote-table,
.asset-stack,
.news-list,
#source-list {
  display: grid;
}

.quote-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(126px, auto);
  gap: 12px;
  align-items: center;
  min-height: 44px;
  padding: 8px 0;
  border-bottom: 1px solid var(--hairline);
}

.quote-name {
  min-width: 0;
}

.quote-name strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.12;
}

.quote-meta {
  display: block;
  margin-top: 2px;
  text-transform: none;
}

.quote-price {
  min-width: 0;
  text-align: right;
}

.quote-price strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  line-height: 1.12;
}

.quote-change {
  display: inline-block;
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.quote-change.up {
  color: var(--green);
}

.quote-change.down {
  color: var(--accent);
}

.quote-table .quote-row {
  grid-template-columns: minmax(0, 1.05fr) minmax(90px, 0.8fr) 54px;
}

.quote-table .quote-price {
  text-align: left;
}

.quote-source {
  text-align: right;
  text-transform: none;
}

.asset-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(132px, auto);
  gap: 12px;
  align-items: center;
  min-height: 52px;
  padding: 8px 0;
  overflow: hidden;
  border-bottom: 1px solid var(--hairline);
}

.asset-card::before {
  display: none;
}

.asset-card strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.12;
}

.asset-card .quote-price strong {
  color: var(--gold);
  font-size: 17px;
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.team-card {
  min-width: 0;
  position: relative;
  min-height: 176px;
  padding: 12px;
  overflow: hidden;
  border: 1px solid rgba(17, 21, 15, 0.16);
  border-top: 3px solid var(--team-color);
  background:
    linear-gradient(145deg, rgba(248, 250, 246, 0.98), rgba(248, 250, 246, 0.89)),
    linear-gradient(120deg, color-mix(in srgb, var(--team-color) 16%, transparent), transparent 62%);
}

.team-card::before {
  position: absolute;
  right: -28px;
  bottom: -42px;
  width: 110px;
  height: 110px;
  border: 1px solid color-mix(in srgb, var(--team-color) 40%, transparent);
  content: "";
  transform: rotate(18deg);
}

.team-card.inactive,
.team-card.error {
  background:
    linear-gradient(145deg, rgba(248, 250, 246, 0.98), rgba(248, 250, 246, 0.92)),
    linear-gradient(120deg, color-mix(in srgb, var(--team-color) 10%, transparent), transparent 64%);
}

.team-top {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: start;
}

.team-top img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  filter: grayscale(0.18) contrast(1.06);
}

.team-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--team-color) 42%, var(--ink));
  color: var(--ink);
  background: color-mix(in srgb, var(--team-color) 12%, var(--panel));
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}

.team-top strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.1;
}

.team-record {
  margin: 4px 0 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.3;
}

.event-list {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0;
  margin-top: 12px;
  border-top: 1px solid rgba(17, 21, 15, 0.22);
}

.event-row {
  display: grid;
  gap: 4px;
  padding: 7px 0;
  border-bottom: 1px solid var(--hairline);
}

.event-main {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
}

.event-main strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.15;
}

.score {
  flex: 0 0 auto;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1;
}

.team-empty {
  display: grid;
  gap: 6px;
  min-height: 76px;
  align-content: center;
  padding: 12px 0 4px;
}

.team-empty strong {
  color: var(--team-color);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-transform: uppercase;
}

.team-empty span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.ai-layout {
  display: grid;
  grid-template-columns: minmax(190px, 240px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.source-pill {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--hairline);
  text-transform: none;
}

.source-pill::before {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  background: var(--accent);
  content: "";
}

.source-pill.ok::before {
  background: var(--green);
}

.date-tape {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.date-tape button {
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid var(--hairline);
  border-radius: 0;
  color: var(--muted);
  cursor: pointer;
  background: transparent;
  text-transform: none;
}

.date-tape button.active,
.date-tape button:hover {
  color: var(--paper);
  border-color: var(--ink);
  background: var(--ink);
}

.news-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 16px;
  gap: 12px;
  align-items: start;
  min-height: 54px;
  padding: 10px 0;
  border-top: 1px solid var(--hairline);
}

.news-card:first-child {
  border-top: 1px solid var(--ink);
}

.news-card h3 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.18;
}

.news-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.42;
}

.news-card::after {
  color: var(--accent);
  content: "+";
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 1;
  text-align: right;
  transition: transform 180ms ease;
}

.news-card:hover::after {
  transform: rotate(45deg);
}

.empty-state,
.error-state {
  padding: 10px 0;
  border-bottom: 1px solid var(--hairline);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.error-state {
  color: var(--accent);
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px var(--page-pad);
  border-top: 1px solid var(--hairline);
}

@media (prefers-reduced-motion: no-preference) {
  .hero-copy,
  .control-panel,
  .signal-strip,
  .split-section {
    animation: rise 420ms ease both;
  }

  .control-panel {
    animation-delay: 60ms;
  }

  .signal-strip {
    animation-delay: 90ms;
  }

  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(8px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

@media (max-width: 1080px) {
  .team-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ai-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .hero,
  .split-section,
  .market-grid,
  .watch-layout {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .section-heading {
    position: static;
  }

  .signal-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  body {
    font-size: 13px;
  }

  .site-header {
    flex-wrap: wrap;
    align-items: center;
    min-height: auto;
    gap: 6px 14px;
    padding-top: 9px;
    padding-bottom: 9px;
  }

  .nav {
    flex-wrap: wrap;
    gap: 4px 12px;
  }

  .nav a {
    padding: 4px 0;
  }

  h1 {
    font-size: 32px;
  }

  .control-panel {
    grid-template-columns: minmax(0, 0.86fr) minmax(0, 1fr) 82px;
  }

  .date-field {
    border-right: 1px solid var(--hairline);
    border-bottom: 0;
  }

  .capture-line {
    border-bottom: 0;
  }

  .icon-button {
    min-width: 82px;
    min-height: 100%;
    border-top: 0;
    border-left: 1px solid var(--ink);
  }

  .team-grid {
    grid-template-columns: 1fr;
  }

  .quote-row,
  .quote-table .quote-row,
  .asset-card,
  .news-card {
    grid-template-columns: 1fr;
  }

  .quote-price,
  .quote-source,
  .panel-heading strong {
    text-align: left;
  }

  .panel-heading {
    display: grid;
    justify-content: stretch;
  }

  .footer {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .control-panel {
    grid-template-columns: 1fr;
  }

  .date-field {
    border-right: 0;
    border-bottom: 1px solid var(--hairline);
  }

  .capture-line {
    border-bottom: 1px solid var(--hairline);
  }

  .icon-button {
    min-height: 38px;
    border-left: 0;
  }

  .signal-strip {
    grid-template-columns: 1fr;
  }
}
