:root {
  color-scheme: light;
  --bg: #f4f2ee;
  --panel: #fffefa;
  --raised: #e9e6e0;
  --ink: #161514;
  --muted: #65615d;
  --line: #d5d0c8;
  --orange-dim: rgba(220, 61, 35, 0.1);
  --violet: #7650a4;
  --grid-line: rgba(16, 16, 16, 0.04);
  --glow: rgba(255, 80, 51, 0.08);
  --control: #fffefa;
  --control-hover: #eeeae3;
  --inset: #ebe8e2;
  --quiet: #77716b;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101010;
  --panel: #161616;
  --raised: #262625;
  --ink: #faf8f7;
  --muted: #aaa7a5;
  --line: #343432;
  --orange-dim: rgba(255, 80, 51, 0.12);
  --violet: #cca5ff;
  --grid-line: rgba(255, 255, 255, 0.025);
  --control: #111;
  --control-hover: #171717;
  --inset: #080808;
  --quiet: #777;
}

body {
  background:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
    var(--bg);
}

body::before {
  background: var(--glow);
}

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

.theme-toggle {
  display: inline-flex;
  gap: 7px;
  min-height: 34px;
  align-items: center;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--control);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.theme-toggle:hover {
  border-color: var(--orange);
  color: var(--orange);
}

.theme-icon {
  font-size: 15px;
  line-height: 1;
}

.brand-mark,
.button,
.notification-controls input {
  border-color: var(--line);
}

.button,
.notification-controls input {
  color: var(--ink);
  background: var(--control);
}

.button:hover {
  border-color: var(--muted);
  background: var(--control-hover);
}

.button-primary,
.button-primary:hover {
  color: #101010;
  background: var(--orange);
}

.forecast-card,
.signal-grid article {
  background: var(--panel);
}

.summary,
.score-history-detail,
.pattern-lede {
  color: var(--muted);
}

.notification-form {
  background: var(--inset);
}

.updated,
footer {
  color: var(--quiet);
}

.forward-future-link {
  filter: grayscale(1);
}

:root[data-theme="dark"] .forward-future-link {
  filter: grayscale(1) invert(1);
}

.analytics-settings {
  margin: 0;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-transform: inherit;
}

.analytics-settings:hover {
  color: var(--orange);
}

.analytics-consent {
  position: fixed;
  z-index: 10;
  right: 20px;
  bottom: 20px;
  display: flex;
  width: min(calc(100% - 40px), 760px);
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  padding: 18px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
}

.analytics-consent strong {
  font-size: 19px;
}

.analytics-consent p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.analytics-consent-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

@media (max-width: 720px) {
  .theme-toggle {
    width: 34px;
    padding: 0;
    justify-content: center;
  }

  #theme-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .analytics-consent {
    right: 14px;
    bottom: 14px;
    width: calc(100% - 28px);
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .analytics-consent-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}
