:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-strong: #eef3f0;
  --text: #111817;
  --muted: #65716d;
  --line: #d8e0dc;
  --primary: #0f766e;
  --primary-strong: #115e59;
  --accent: #b91c1c;
  --gold: #b7791f;
  --shadow: 0 18px 48px rgb(17 24 23 / 10%);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101413;
  --surface: #171d1b;
  --surface-strong: #202926;
  --text: #edf4f1;
  --muted: #a9b8b3;
  --line: #33413d;
  --primary: #5eead4;
  --primary-strong: #99f6e4;
  --accent: #f87171;
  --gold: #f8c35b;
  --shadow: 0 18px 48px rgb(0 0 0 / 30%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #101413;
    --surface: #171d1b;
    --surface-strong: #202926;
    --text: #edf4f1;
    --muted: #a9b8b3;
    --line: #33413d;
    --primary: #5eead4;
    --primary-strong: #99f6e4;
    --accent: #f87171;
    --gold: #f8c35b;
    --shadow: 0 18px 48px rgb(0 0 0 / 30%);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgb(15 118 110 / 10%), transparent 280px),
    var(--bg);
}

body,
button,
input,
select {
  font: inherit;
}

button,
input,
select {
  color: inherit;
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 10;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--surface);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1rem 0 3rem;
}

.topbar,
.section-heading,
.hero,
.hero-actions,
.insight-strip,
.control-grid,
.settings-row,
.stock-card__header {
  display: flex;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 74px;
  padding: 0.8rem 0;
  background: color-mix(in srgb, var(--bg), transparent 7%);
  backdrop-filter: blur(18px);
}

.topbar h1,
.hero h2,
.workspace h2,
.panel h2,
.stock-card h3 {
  margin: 0;
  line-height: 1.05;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(1.35rem, 4vw, 1.8rem);
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  gap: 0.35rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface), transparent 18%);
}

.nav a {
  min-width: 5.8rem;
  padding: 0.55rem 0.75rem;
  border-radius: calc(var(--radius) - 2px);
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 750;
  text-align: center;
  text-decoration: none;
}

.nav a:hover,
.nav a:focus-visible,
.nav a[aria-current="page"] {
  background: var(--surface);
  color: var(--text);
  outline: none;
}

main {
  display: grid;
  gap: 1rem;
}

.hero {
  align-items: stretch;
  justify-content: space-between;
  gap: 1rem;
  min-height: 330px;
  padding: clamp(1.25rem, 4vw, 3rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgb(15 118 110 / 14%), transparent 58%),
    var(--surface);
  box-shadow: var(--shadow);
}

.hero-copy {
  align-self: center;
  max-width: 720px;
}

.hero h2 {
  max-width: 12ch;
  font-size: clamp(2.35rem, 8vw, 5.5rem);
}

.hero p:not(.eyebrow) {
  max-width: 61ch;
  margin: 1.25rem 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.15rem);
  line-height: 1.6;
}

.hero-actions {
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.5rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.7rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.button.primary,
.button[aria-pressed="true"] {
  background: var(--primary);
  color: #ffffff;
}

.button.primary:hover,
.button.primary:focus-visible,
.button[aria-pressed="true"]:hover {
  background: var(--primary-strong);
}

.button.secondary {
  border-color: var(--line);
  background: var(--surface);
}

.button.secondary:hover,
.button.secondary:focus-visible {
  border-color: var(--primary);
}

.pick-panel {
  display: grid;
  align-content: end;
  gap: 1rem;
  width: min(100%, 310px);
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.pick-panel .label,
.pick-panel span,
.insight-strip span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
}

.pick-panel strong {
  overflow-wrap: anywhere;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
}

.pick-panel div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.pick-panel b {
  color: var(--primary);
  font-size: 3rem;
  line-height: 1;
}

.insight-strip {
  gap: 1rem;
}

.insight-strip div,
.workspace,
.panel,
.settings-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.insight-strip div {
  flex: 1;
  display: grid;
  gap: 0.3rem;
  min-width: 0;
  padding: 1rem;
}

.insight-strip strong {
  overflow-wrap: anywhere;
  font-size: clamp(1.25rem, 3vw, 1.8rem);
}

.workspace,
.panel,
.settings-row {
  padding: clamp(1rem, 3vw, 1.5rem);
}

.section-heading {
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.workspace h2,
.panel h2 {
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.save-state,
.select-field span,
.slider-field span,
.stock-card p,
.settings-row p {
  color: var(--muted);
}

.save-state,
.select-field span,
.slider-field span {
  font-size: 0.9rem;
  font-weight: 800;
}

.stock-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 0.8rem;
}

.stock-card {
  display: grid;
  gap: 0.9rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.stock-card__header {
  justify-content: space-between;
  gap: 1rem;
}

.rank {
  color: var(--gold);
  font-size: 0.85rem;
  font-weight: 900;
}

.stock-card h3 {
  margin-top: 0.2rem;
  font-size: 1.7rem;
}

.stock-card p {
  margin: 0.2rem 0 0;
  line-height: 1.45;
}

.score {
  color: var(--primary);
  font-size: 2rem;
  line-height: 1;
}

.thesis {
  min-height: 3.9rem;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.metric-grid span {
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) - 2px);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
  text-transform: capitalize;
}

.control-grid {
  align-items: stretch;
  gap: 1rem;
}

.control-grid > .panel:first-child {
  flex: 1 1 700px;
}

.control-grid > .panel:last-child {
  flex: 0 1 340px;
}

.select-field,
.slider-field {
  display: grid;
  gap: 0.45rem;
}

select {
  min-height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  padding: 0.65rem 0.75rem;
}

.slider-grid {
  display: grid;
  gap: 0.8rem;
}

.slider-field span {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
}

button:focus-visible,
a:focus-visible,
select:focus,
input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary), transparent 62%);
  outline-offset: 2px;
}

.watchlist {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.watchlist li,
.empty-state {
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.watchlist li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.watchlist strong {
  color: var(--primary);
}

.empty-state {
  margin: 0;
  color: var(--muted);
}

.settings-row {
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.settings-row .select-field {
  min-width: 180px;
}

.settings-row p {
  max-width: 680px;
  margin: 0;
  line-height: 1.5;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.site-footer a {
  color: var(--primary);
}

@media (max-width: 820px) {
  .topbar,
  .hero,
  .insight-strip,
  .control-grid,
  .settings-row {
    flex-direction: column;
  }

  .topbar {
    align-items: stretch;
    position: static;
  }

  .nav {
    overflow-x: auto;
  }

  .nav a {
    flex: 1;
  }

  .hero h2 {
    max-width: 9ch;
  }

  .pick-panel {
    width: 100%;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}
