:root {
  --bg: #f7f8fb;
  --panel: #ffffff;
  --ink: #12171c;
  --muted: #65707d;
  --line: #dfe5ec;
  --green: #0e7658;
  --green-soft: #e5f4ef;
  --gold: #9a6200;
  --gold-soft: #fff3d6;
  --teal: #116d96;
  --blue: #2757b8;
  --blue-soft: #e9efff;
  --coral: #b94735;
  --coral-soft: #ffe8e2;
  --red: #9d2f2f;
  --shadow: 0 18px 50px rgba(18, 23, 28, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(17, 109, 150, 0.1), transparent 360px),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

a {
  color: inherit;
}

html,
body {
  max-width: 100%;
}

.topbar {
  align-items: center;
  backdrop-filter: blur(20px);
  background: rgba(247, 248, 251, 0.88);
  border-bottom: 1px solid rgba(223, 229, 236, 0.9);
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(190px, 1fr) auto auto;
  left: 0;
  padding: 14px clamp(18px, 4vw, 48px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  align-items: center;
  display: inline-flex;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
}

.brand strong,
.brand small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.brand-mark {
  align-items: center;
  background: var(--ink);
  border-radius: 8px;
  color: #f8fafc;
  display: inline-flex;
  font-weight: 800;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: end;
}

.nav a {
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  padding: 8px 10px;
  text-decoration: none;
}

.nav a:hover {
  border-color: var(--line);
  color: var(--ink);
}

.icon-button,
.secondary-button {
  background: var(--ink);
  border: 0;
  border-radius: 8px;
  color: #f8fafc;
  cursor: pointer;
  font: inherit;
  min-height: 40px;
  padding: 0 14px;
}

.icon-button {
  font-size: 20px;
  min-width: 42px;
  padding: 0;
}

main {
  margin: 0 auto;
  max-width: 1280px;
  padding: clamp(18px, 4vw, 42px);
  width: 100%;
}

.workspace {
  align-items: stretch;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.05fr);
  min-height: 470px;
  min-width: 0;
  width: 100%;
}

.intro-panel,
.calculator-panel,
.comparison-strip,
.data-section,
.source-section {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.intro-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(24px, 4vw, 42px);
}

.eyebrow,
.section-heading p {
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: 0 0 10px;
  text-transform: uppercase;
}

h1,
h2 {
  letter-spacing: 0;
  margin: 0;
}

h1 {
  font-size: clamp(36px, 5vw, 68px);
  line-height: 0.96;
  max-width: 710px;
}

h1 span {
  display: block;
}

h2 {
  font-size: 24px;
  line-height: 1.1;
}

.lede {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
  margin: 22px 0 0;
  max-width: 620px;
}

.lede span {
  display: inline;
}

.metrics {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 38px;
}

.metrics div {
  border-left: 3px solid var(--green);
  padding-left: 12px;
}

.metrics span {
  display: block;
  font-size: 30px;
  font-weight: 800;
}

.metrics small {
  color: var(--muted);
}

.calculator-panel {
  padding: 24px;
}

.section-heading {
  align-items: end;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 22px;
}

.section-heading.compact {
  margin-bottom: 14px;
}

.calculator-grid,
.filters {
  display: grid;
  gap: 12px;
}

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

label span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 7px;
  text-transform: uppercase;
}

label {
  min-width: 0;
}

select,
input {
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  min-height: 44px;
  min-width: 0;
  max-width: 100%;
  padding: 10px 12px;
  width: 100%;
}

input[type="range"] {
  accent-color: var(--green);
  padding: 0;
}

.calculator-grid label:first-child {
  grid-column: 1 / -1;
}

.result-band {
  background: var(--ink);
  border-radius: 8px;
  color: #f8fafc;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 18px;
  padding: 18px;
  min-width: 0;
}

.result-band small,
.rank-list small {
  color: rgba(248, 250, 252, 0.7);
  display: block;
}

.result-band strong {
  display: block;
  font-size: clamp(20px, 3vw, 32px);
  margin-top: 4px;
}

.comparison-strip,
.data-section,
.source-section {
  margin-top: 18px;
  padding: 24px;
}

.rank-list {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.rank-card {
  background: var(--ink);
  border-radius: 8px;
  color: #f8fafc;
  min-height: 130px;
  min-width: 0;
  padding: 16px;
}

.rank-card strong {
  display: block;
  font-size: 24px;
  margin: 12px 0 6px;
}

.rank-card span {
  color: rgba(248, 250, 252, 0.74);
  display: block;
  font-size: 13px;
  line-height: 1.35;
}

.news-section,
.launch-section,
.revenue-section {
  margin-top: 28px;
  min-width: 0;
}

.language-panel {
  align-items: stretch;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(280px, auto) minmax(0, 1fr);
  margin-bottom: 16px;
}

.language-buttons {
  align-items: center;
  background: #e9edf3;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-flex;
  gap: 4px;
  min-height: 48px;
  padding: 4px;
}

.language-buttons button {
  background: transparent;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  min-height: 38px;
  min-width: 96px;
  padding: 0 12px;
}

.language-buttons button.active {
  background: var(--panel);
  box-shadow: 0 8px 20px rgba(18, 23, 28, 0.08);
  color: var(--ink);
}

.language-rationale {
  align-items: center;
  border-left: 3px solid var(--blue);
  display: grid;
  gap: 4px;
  padding: 4px 0 4px 14px;
}

.language-rationale strong {
  font-size: 14px;
}

.language-rationale span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

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

.news-card,
.decision-card,
.domain-grid article,
.revenue-grid article,
.empty-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(18, 23, 28, 0.05);
  min-width: 0;
}

.news-card {
  display: flex;
  flex-direction: column;
  min-height: 218px;
  padding: 18px;
}

.news-meta {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 12px;
  font-weight: 800;
  gap: 10px;
  justify-content: space-between;
  line-height: 1.25;
  text-transform: uppercase;
}

.news-card h3,
.decision-card h3,
.revenue-grid h3 {
  font-size: 18px;
  line-height: 1.25;
  margin: 14px 0 0;
}

.news-card h3 a {
  text-decoration: none;
}

.news-card h3 a:hover {
  color: var(--teal);
}

.news-card p,
.decision-card p,
.domain-grid p,
.revenue-grid p {
  color: var(--muted);
  line-height: 1.5;
  margin: 12px 0 0;
}

.recommendation-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1.2fr 1fr 1fr;
}

.decision-card {
  padding: 20px;
}

.primary-decision {
  background: linear-gradient(135deg, #ffffff 0%, #e9f7f2 100%);
  border-color: rgba(14, 118, 88, 0.3);
}

.decision-label {
  color: var(--green);
  display: block;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.decision-card small {
  color: var(--muted);
  display: block;
  line-height: 1.4;
  margin-top: 14px;
}

.domain-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-top: 14px;
}

.domain-grid article {
  padding: 14px;
}

.domain-grid strong {
  display: block;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.domain-grid span {
  background: var(--blue-soft);
  border-radius: 999px;
  color: var(--blue);
  display: inline-flex;
  font-size: 11px;
  font-weight: 900;
  margin-top: 9px;
  padding: 4px 7px;
  text-transform: uppercase;
}

.domain-grid p {
  font-size: 13px;
}

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

.revenue-grid article {
  min-height: 210px;
  padding: 18px;
}

.revenue-grid article > span {
  align-items: center;
  background: var(--coral-soft);
  border-radius: 8px;
  color: var(--coral);
  display: inline-flex;
  font-weight: 900;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.empty-card {
  color: var(--muted);
  grid-column: 1 / -1;
  padding: 18px;
}

.filters {
  align-items: end;
  grid-template-columns: minmax(220px, 1.6fr) minmax(160px, 1fr) minmax(160px, 1fr) auto;
  margin-bottom: 16px;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
}

table {
  border-collapse: collapse;
  min-width: 860px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 14px;
  text-align: left;
  vertical-align: middle;
}

th {
  background: #eef3f8;
  color: #3d4741;
  font-size: 12px;
  text-transform: uppercase;
}

td {
  background: rgba(255, 255, 255, 0.84);
}

tbody tr:hover td {
  background: #f7fbff;
}

.provider-pill,
.status-pill {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 8px;
}

.provider-pill {
  background: var(--green-soft);
  color: var(--green);
}

.status-extracted,
.status-ok {
  background: var(--green-soft);
  color: var(--green);
}

.status-seeded,
.status-partial {
  background: var(--gold-soft);
  color: var(--gold);
}

.status-review,
.status-error {
  background: #f9dddd;
  color: var(--red);
}

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

.source-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.source-card h3 {
  font-size: 16px;
  margin: 0 0 10px;
}

.source-card p {
  color: var(--muted);
  line-height: 1.45;
  margin: 10px 0 0;
}

.source-card a {
  color: var(--teal);
  display: inline-block;
  font-weight: 700;
  margin-top: 10px;
}

footer {
  align-items: center;
  color: var(--muted);
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin: 24px auto 0;
  max-width: 1280px;
  padding: 0 clamp(18px, 4vw, 42px) 32px;
}

footer a {
  color: var(--teal);
  font-weight: 700;
}

@media (max-width: 980px) {
  .workspace,
  .calculator-grid,
  .result-band,
  .rank-list,
  .source-grid,
  .news-grid,
  .recommendation-grid,
  .domain-grid,
  .revenue-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .workspace {
    min-height: auto;
  }

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

  .language-panel {
    grid-template-columns: minmax(0, 1fr);
  }

  .language-buttons {
    justify-content: stretch;
    width: 100%;
  }

  .language-buttons button {
    flex: 1 1 0;
    min-width: 0;
  }
}

@media (max-width: 640px) {
  body {
    width: 100vw;
  }

  .topbar {
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) 42px;
    max-width: 100%;
    overflow: hidden;
    width: 100%;
  }

  .nav {
    display: none;
  }

  .icon-button {
    justify-self: end;
  }

  main {
    max-width: 100vw;
    overflow: hidden;
    padding: 16px;
    width: 100vw;
  }

  h1 {
    font-size: 33px;
    line-height: 1.04;
    overflow-wrap: break-word;
  }

  .metrics,
  .filters {
    grid-template-columns: minmax(0, 1fr);
  }

  .intro-panel,
  .calculator-panel,
  .comparison-strip,
  .data-section,
  .source-section {
    max-width: 100%;
    overflow: hidden;
    padding: 24px;
    width: 100%;
  }

  .calculator-grid label,
  .filters label {
    max-width: 100%;
    min-width: 0;
  }

  select {
    text-overflow: ellipsis;
  }

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

  .language-buttons {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .lede {
    font-size: 16px;
    overflow-wrap: break-word;
  }

  .lede span {
    display: block;
  }
}
