:root {
  color-scheme: dark;
  --bg: #07111f;
  --bg-top: #0f1d35;
  --panel: rgba(10, 18, 33, 0.84);
  --panel-strong: rgba(13, 24, 43, 0.96);
  --panel-soft: rgba(16, 29, 51, 0.78);
  --panel-border: rgba(150, 180, 220, 0.12);
  --panel-border-strong: rgba(150, 190, 235, 0.22);
  --text: #f5f8fc;
  --muted: #9caec9;
  --muted-strong: #c7d3e6;
  --accent: #82d9ff;
  --accent-strong: #3cc3ff;
  --accent-soft: rgba(60, 195, 255, 0.16);
  --good: #92efba;
  --warn: #f9e287;
  --soft: #c4b5fd;
  --danger: #f6a3ae;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.42);
  --shadow-soft: 0 14px 36px rgba(0, 0, 0, 0.22);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

#summary,
#beliefs,
#results,
#detail,
#presets {
  scroll-margin-top: 88px;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 0%, rgba(60, 195, 255, 0.16), transparent 26%),
    radial-gradient(circle at 90% 8%, rgba(140, 122, 255, 0.12), transparent 24%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 32%, #050c18 100%);
  color: var(--text);
}

button,
select {
  font: inherit;
}

button:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(130, 217, 255, 0.82);
  outline-offset: 2px;
}

.shell {
  max-width: 1580px;
  margin: 0 auto;
  padding: 32px 28px 36px;
}

.topbar,
.intro-card,
.panel,
.preset-strip {
  background: linear-gradient(180deg, rgba(16, 27, 49, 0.94), rgba(8, 15, 28, 0.9));
  border: 1px solid var(--panel-border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.95fr);
  gap: 28px;
  align-items: stretch;
  padding: 28px;
  position: relative;
  overflow: hidden;
}

.topbar::before,
.intro-card::before,
.preset-strip::before,
.panel-results::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(130, 217, 255, 0.08), transparent 38%, transparent 100%);
  pointer-events: none;
}

.topbar > * {
  position: relative;
  z-index: 1;
}

.eyebrow,
.section-label {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent);
}

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

h1 {
  margin-bottom: 14px;
  font-size: clamp(2.6rem, 4.6vw, 4.9rem);
  line-height: 0.94;
  letter-spacing: -0.05em;
  max-width: 9ch;
}

h2 {
  margin-bottom: 10px;
  font-size: 1.16rem;
  line-height: 1.2;
}

h3 {
  margin-bottom: 0;
  font-size: 1.02rem;
  line-height: 1.2;
}

.subhead,
.panel-copy,
.summary-state p,
.summary-state-copy,
.signal-help,
.card-description,
.card-why,
.detail-copy,
.detail-list,
.rank-note,
.meta-text,
.preset-status,
.outlook-text,
.snapshot-label,
.snapshot-empty,
.build-info-text,
.highlight-copy,
.highlight-meta,
.preset-description,
.preset-summary,
.preset-empty {
  color: var(--muted);
}

.subhead {
  max-width: 56ch;
  margin-bottom: 0;
  font-size: 1.04rem;
  line-height: 1.45;
}

.topbar-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-content: start;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(150, 190, 235, 0.12);
  background: rgba(8, 16, 31, 0.64);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.domain-picker {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  color: var(--muted-strong);
}

select,
.button {
  min-height: 48px;
  border-radius: 16px;
  border: 1px solid rgba(150, 190, 235, 0.16);
  background: rgba(9, 16, 29, 0.92);
  color: var(--text);
  padding: 12px 14px;
}

select {
  width: 100%;
}

.button {
  cursor: pointer;
  font-weight: 600;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.button:hover,
select:hover {
  border-color: rgba(130, 217, 255, 0.42);
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.button:active {
  transform: translateY(0);
}

.button.primary {
  background: linear-gradient(180deg, rgba(60, 195, 255, 0.26), rgba(60, 195, 255, 0.16));
  border-color: rgba(130, 217, 255, 0.46);
}

.intro-card {
  position: relative;
  margin-top: 22px;
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(270px, 0.55fr);
  gap: 22px;
  align-items: start;
}

.intro-main,
.summary-state {
  position: relative;
  z-index: 1;
}

.intro-main {
  display: grid;
  gap: 18px;
}

.intro-heading {
  max-width: 72ch;
}

#summary-title {
  font-size: clamp(1.55rem, 2.1vw, 2rem);
  margin-bottom: 8px;
}

#summary-text {
  margin-bottom: 0;
  color: var(--muted-strong);
  font-size: 1.03rem;
  line-height: 1.45;
}

.outlook-text {
  margin: 14px 0 0;
  color: var(--text);
  font-size: 1.01rem;
  line-height: 1.45;
}

.preset-status {
  margin: 12px 0 0;
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(150, 190, 235, 0.12);
  background: rgba(11, 21, 39, 0.7);
}

.summary-highlights {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr;
  gap: 14px;
}

.highlight-card,
.insight-panel,
.summary-state-card,
.preset-card,
.signal-card,
.world-card,
.detail-section {
  border-radius: 22px;
  border: 1px solid rgba(150, 190, 235, 0.1);
  background: linear-gradient(180deg, rgba(14, 24, 44, 0.82), rgba(9, 16, 30, 0.9));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.highlight-card {
  padding: 18px;
  display: grid;
  gap: 10px;
  min-height: 170px;
}

.highlight-card-leader {
  background:
    radial-gradient(circle at top left, rgba(130, 217, 255, 0.1), transparent 46%),
    linear-gradient(180deg, rgba(16, 31, 56, 0.92), rgba(9, 16, 30, 0.94));
  border-color: rgba(130, 217, 255, 0.2);
}

.highlight-card h3 {
  font-size: 1.26rem;
  letter-spacing: -0.03em;
}

.highlight-copy {
  margin-bottom: 0;
  line-height: 1.45;
}

.highlight-meta {
  margin: auto 0 0;
  color: var(--text);
  font-size: 0.92rem;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.insight-panel {
  padding: 18px;
  display: grid;
  gap: 12px;
}

.summary-state-card {
  padding: 18px;
  position: sticky;
  top: 22px;
}

#share-state {
  display: block;
  margin-top: 8px;
  padding: 13px 14px;
  border-radius: 16px;
  border: 1px solid rgba(130, 217, 255, 0.16);
  background: rgba(8, 16, 30, 0.84);
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#share-feedback {
  min-height: 20px;
  margin: 14px 0 0;
}

.mobile-jumpbar {
  display: none;
}

.jump-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(130, 217, 255, 0.14);
  background: rgba(9, 16, 29, 0.82);
  color: var(--muted-strong);
  text-decoration: none;
  white-space: nowrap;
  font-size: 0.86rem;
  font-weight: 700;
}

.jump-chip:hover {
  border-color: rgba(130, 217, 255, 0.3);
  color: var(--text);
}

.jump-chip:focus-visible {
  outline: 2px solid rgba(130, 217, 255, 0.82);
  outline-offset: 2px;
}

.preset-strip {
  position: relative;
  margin-top: 22px;
  padding: 24px;
}

.preset-strip-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
}

.preset-strip-head h2,
.panel-head h2 {
  font-size: 1.34rem;
  letter-spacing: -0.03em;
}

.preset-list {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.preset-card {
  text-align: left;
  padding: 18px;
  cursor: pointer;
  display: grid;
  gap: 10px;
  transition: border-color 140ms ease, transform 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.preset-card:hover {
  transform: translateY(-2px);
  border-color: rgba(130, 217, 255, 0.28);
  box-shadow: var(--shadow-soft);
}

.preset-card.active {
  border-color: rgba(130, 217, 255, 0.42);
  background:
    radial-gradient(circle at top left, rgba(130, 217, 255, 0.08), transparent 44%),
    linear-gradient(180deg, rgba(18, 33, 58, 0.94), rgba(10, 18, 33, 0.96));
}

.preset-name {
  font-weight: 700;
  font-size: 1rem;
}

.preset-summary {
  font-size: 0.92rem;
  line-height: 1.4;
}

.scenario-snapshot,
.rank-shifts,
.leader-drivers {
  display: grid;
  gap: 12px;
}

.snapshot-group {
  display: grid;
  gap: 10px;
}

.leader-group {
  padding: 0;
  border: 0;
  background: transparent;
}

.snapshot-label {
  margin: 0;
  font-size: 0.92rem;
}

.snapshot-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.snapshot-chip,
.rank-badge,
.status-chip,
.movement-chip,
.tag,
.fit-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.snapshot-chip {
  border: 1px solid transparent;
}

.snapshot-likely {
  background: rgba(130, 217, 255, 0.1);
  color: var(--accent);
  border-color: rgba(130, 217, 255, 0.18);
}

.snapshot-unlikely {
  background: rgba(246, 163, 174, 0.1);
  color: var(--danger);
  border-color: rgba(246, 163, 174, 0.14);
}

.snapshot-up {
  background: rgba(146, 239, 186, 0.12);
  color: var(--good);
  border-color: rgba(146, 239, 186, 0.16);
}

.snapshot-down {
  background: rgba(246, 163, 174, 0.1);
  color: var(--danger);
  border-color: rgba(246, 163, 174, 0.14);
}

.snapshot-empty {
  font-size: 0.92rem;
  line-height: 1.45;
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(480px, 1fr) minmax(300px, 380px);
  gap: 20px;
  margin-top: 22px;
  align-items: start;
}

.panel {
  position: relative;
  min-height: 72vh;
  padding: 22px;
}

.panel-inputs,
.panel-detail {
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
  overflow: auto;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(150, 190, 235, 0.1);
}

.panel-copy {
  max-width: 22ch;
  margin-bottom: 0;
  line-height: 1.4;
}

.signals-list,
.results-list,
.detail-panel {
  margin-top: 18px;
}

.signals-list {
  display: grid;
  gap: 14px;
}

.signal-card {
  padding: 16px;
}

.signal-card label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
}

.signal-help {
  font-size: 0.92rem;
  line-height: 1.4;
  margin-bottom: 12px;
}

.signal-card select {
  width: 100%;
}

.results-list {
  display: grid;
  gap: 14px;
}

.world-card {
  padding: 18px;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.world-card:hover {
  transform: translateY(-2px);
  border-color: rgba(130, 217, 255, 0.24);
  box-shadow: var(--shadow-soft);
}

.world-card.active {
  border-color: rgba(130, 217, 255, 0.42);
  background:
    radial-gradient(circle at top left, rgba(130, 217, 255, 0.08), transparent 44%),
    linear-gradient(180deg, rgba(18, 33, 58, 0.94), rgba(10, 18, 33, 0.96));
}

.world-card-featured {
  border-color: rgba(130, 217, 255, 0.26);
  background:
    radial-gradient(circle at top left, rgba(130, 217, 255, 0.12), transparent 46%),
    linear-gradient(180deg, rgba(17, 31, 54, 0.96), rgba(10, 18, 33, 0.96));
}

.card-topline,
.detail-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.card-badges,
.detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.rank-badge {
  background: rgba(150, 190, 235, 0.1);
  color: var(--muted-strong);
}

.fit-chip,
.movement-chip {
  background: rgba(150, 190, 235, 0.08);
  color: var(--muted-strong);
}

.movement-up {
  background: rgba(146, 239, 186, 0.12);
  color: var(--good);
}

.movement-down {
  background: rgba(246, 163, 174, 0.12);
  color: var(--danger);
}

.movement-flat {
  background: rgba(150, 190, 235, 0.08);
  color: var(--muted-strong);
}

.status-dominant { background: rgba(146, 239, 186, 0.14); color: var(--good); }
.status-rising { background: rgba(130, 217, 255, 0.14); color: var(--accent); }
.status-plausible { background: rgba(196, 181, 253, 0.14); color: var(--soft); }
.status-fragile { background: rgba(249, 226, 135, 0.15); color: var(--warn); }
.status-fading { background: rgba(246, 163, 174, 0.14); color: var(--danger); }

.card-heading-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  margin-bottom: 10px;
}

.card-heading-row h3 {
  font-size: 1.18rem;
  letter-spacing: -0.03em;
}

.card-description,
.card-why,
.detail-copy,
.detail-list li {
  line-height: 1.45;
}

.card-description {
  margin-bottom: 10px;
}

.card-why {
  margin-bottom: 14px;
  color: var(--muted-strong);
}

.strength-meter {
  height: 8px;
  border-radius: 999px;
  background: rgba(150, 190, 235, 0.08);
  overflow: hidden;
  margin-bottom: 14px;
}

.strength-meter-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(130, 217, 255, 0.42), rgba(130, 217, 255, 0.95));
}

.card-tags,
.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  background: rgba(150, 190, 235, 0.08);
  color: var(--muted);
}

.detail-panel {
  display: grid;
  gap: 16px;
}

.detail-section {
  padding: 16px;
}

.detail-list {
  padding-left: 18px;
  margin: 12px 0 0;
  display: block;
}

.detail-list li {
  margin-bottom: 8px;
  color: var(--muted);
}

.build-footer {
  margin-top: 18px;
  padding: 0 6px;
}

.build-info-text {
  margin: 0;
  font-size: 0.9rem;
}

.build-info-text strong {
  color: var(--text);
}

.build-info-text code {
  color: var(--accent);
}

.build-info-text.is-warning {
  color: var(--warn);
}

.build-info-text.is-error {
  color: var(--danger);
}

.build-info-text.is-ok {
  color: var(--good);
}

@media (max-width: 1380px) {
  .summary-highlights,
  .insight-grid,
  .preset-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .layout {
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  }

  .panel-detail {
    grid-column: 1 / -1;
    position: static;
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 960px) {
  .topbar,
  .intro-card {
    grid-template-columns: 1fr;
  }

  .summary-state-card,
  .panel-inputs {
    position: static;
    max-height: none;
    overflow: visible;
  }

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

@media (max-width: 760px) {
  .shell {
    padding: 14px 12px 24px;
  }

  .topbar,
  .intro-card,
  .preset-strip,
  .panel {
    border-radius: 22px;
    padding: 16px;
  }

  .topbar-actions,
  .insight-grid {
    grid-template-columns: 1fr;
  }

  .summary-highlights,
  .preset-list {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 2px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .summary-highlights::-webkit-scrollbar,
  .preset-list::-webkit-scrollbar {
    display: none;
  }

  .summary-highlights > *,
  .preset-list > * {
    flex: 0 0 84%;
    scroll-snap-align: start;
  }

  .mobile-jumpbar {
    position: sticky;
    top: 10px;
    z-index: 20;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 2px 2px;
    margin-top: 10px;
    scrollbar-width: none;
  }

  .mobile-jumpbar::-webkit-scrollbar {
    display: none;
  }

  .topbar-actions {
    padding: 12px;
  }

  .summary-state-card {
    position: static;
  }

  .card-heading-row,
  .panel-head,
  .preset-strip-head,
  .topbar {
    gap: 12px;
  }

  .panel-head,
  .preset-strip-head,
  .topbar-actions,
  .card-heading-row {
    align-items: stretch;
  }

  .panel-head {
    padding-bottom: 14px;
  }

  .card-heading-row {
    flex-direction: column;
  }

  .topbar-actions > * {
    width: 100%;
  }

  .layout {
    gap: 16px;
  }

  .panel-inputs {
    order: 1;
  }

  .panel-results {
    order: 2;
  }

  .panel-detail {
    order: 3;
  }

  .signals-list,
  .results-list,
  .detail-panel {
    margin-top: 14px;
  }

  .signals-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .signal-card,
  .world-card,
  .detail-section,
  .highlight-card,
  .insight-panel,
  .preset-card,
  .summary-state-card {
    border-radius: 18px;
  }

  .signal-card {
    padding: 14px;
  }

  .signal-card label {
    margin-bottom: 8px;
    font-size: 0.89rem;
    line-height: 1.28;
  }

  .signal-help {
    display: none;
  }

  .signal-card select {
    min-height: 42px;
    padding: 10px 12px;
    font-size: 0.9rem;
  }

  .card-description,
  .card-why,
  .detail-copy,
  .detail-list li,
  #summary-text,
  .outlook-text,
  .highlight-copy {
    font-size: 0.94rem;
  }

  .rank-badge,
  .status-chip,
  .movement-chip,
  .tag,
  .fit-chip,
  .snapshot-chip,
  .jump-chip {
    font-size: 0.74rem;
  }

  .card-topline,
  .detail-topline {
    align-items: flex-start;
  }

  h1 {
    max-width: none;
    font-size: clamp(2.15rem, 11vw, 3rem);
  }

  h2 {
    font-size: 1.05rem;
  }

  .highlight-card h3,
  .card-heading-row h3 {
    font-size: 1.08rem;
  }

  #share-state {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .build-footer {
    padding: 0;
  }
}
