:root {
  color-scheme: light;
  --ink: #101820;
  --muted: #65717a;
  --line: rgba(16, 24, 32, 0.12);
  --paper: #f5f7f4;
  --panel: rgba(255, 255, 255, 0.88);
  --blue: #175cd3;
  --blue-dark: #123f91;
  --teal: #1d4ed8;
  --amber: #c88719;
  --red: #b42318;
  --shadow: 0 24px 70px rgba(16, 24, 32, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(7, 18, 34, 0.52), rgba(11, 34, 52, 0.18) 42%, rgba(242, 247, 248, 0.82) 100%),
    url("assets/iqrank-background.png") center top / cover fixed;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

h1 {
  font-size: 1.25rem;
}

h2 {
  max-width: 48rem;
  margin-top: 0.35rem;
  font-size: clamp(2.25rem, 5vw, 4.8rem);
  line-height: 0.96;
}

h3 {
  font-size: 1.15rem;
}

.app-shell {
  min-height: 100vh;
}

.hero-panel {
  position: relative;
  min-height: 6rem;
  padding: 1.1rem clamp(1rem, 3vw, 2.2rem) 2rem;
}

.top-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  max-width: 78rem;
  margin: 0 auto;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(24px);
  box-shadow: 0 10px 35px rgba(16, 24, 32, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 8px;
  background: #101820;
  color: #fff;
  font-weight: 900;
}

.brand p,
.eyebrow,
.panel p,
.status-panel span,
.score-chip span,
.metric-grid span,
.soft-note {
  color: var(--muted);
}

.nav-tabs,
.segmented,
.plan-toggle {
  display: flex;
  gap: 0.35rem;
  padding: 0.3rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(240, 244, 247, 0.86);
}

.plan-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.95rem;
}

.plan-card {
  position: relative;
  display: grid;
  grid-template-rows: auto auto auto auto 1fr auto;
  gap: 0.48rem;
  min-height: 13.5rem;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 8px;
  border-color: rgba(255, 255, 255, 0.58);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(241, 249, 250, 0.9));
  box-shadow: 0 14px 34px rgba(3, 12, 29, 0.08);
  text-align: left;
  overflow: hidden;
  cursor: pointer;
}

.plan-card:focus-visible {
  outline: 3px solid rgba(29, 78, 216, 0.42);
  outline-offset: 3px;
}

.plan-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 0.35rem;
  background: linear-gradient(90deg, var(--blue), var(--teal));
}

.plan-card .plan-label {
  font-weight: 900;
  color: #071522;
}

.plan-card strong {
  color: var(--blue-dark);
  font-size: 1.7rem;
}

.plan-card small {
  color: var(--muted);
  font-weight: 800;
}

.plan-card em {
  width: fit-content;
  padding: 0.26rem 0.52rem;
  border-radius: 999px;
  background: rgba(36, 87, 255, 0.1);
  color: var(--blue-dark);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
}

.plan-detail {
  color: #31465b;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.35;
}

.plan-card.featured {
  border-color: rgba(36, 87, 255, 0.36);
  background:
    linear-gradient(145deg, rgba(238, 244, 255, 0.98), rgba(255, 255, 255, 0.9)),
    linear-gradient(135deg, rgba(36, 87, 255, 0.14), transparent);
}

.plan-card.premium {
  border-color: rgba(213, 167, 46, 0.48);
  background:
    linear-gradient(145deg, rgba(255, 248, 220, 0.98), rgba(255, 255, 255, 0.9)),
    linear-gradient(135deg, rgba(213, 167, 46, 0.18), transparent);
}

.plan-card.active {
  border-color: var(--blue);
  transform: translateY(-2px);
  box-shadow: 0 0 0 3px rgba(36, 87, 255, 0.14), 0 22px 52px rgba(3, 12, 29, 0.18);
}

.plan-card.active::after {
  content: "Selected";
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  background: #071522;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  pointer-events: none;
}

.plan-pay-button {
  width: 100%;
  min-height: 3.05rem;
  margin-top: 0.35rem;
  align-self: end;
  font-size: 0.95rem;
}

.payment-error {
  color: #9f1d1d;
  font-weight: 900;
}

.nav-tab,
.segment,
.ghost,
.primary {
  min-height: 2.55rem;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 800;
}

.nav-tab,
.segment {
  padding: 0 0.8rem;
  color: var(--muted);
  background: transparent;
}

.nav-tab.active,
.segment.active {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
  box-shadow: 0 8px 22px rgba(16, 24, 32, 0.08);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(19rem, 0.75fr);
  gap: clamp(1rem, 4vw, 3rem);
  align-items: end;
  max-width: 78rem;
  min-height: 36rem;
  margin: 0 auto;
  padding-top: clamp(3rem, 8vw, 8rem);
}

.hero-copy {
  display: grid;
  gap: 1rem;
  align-content: end;
}

.hero-copy > p:not(.eyebrow) {
  max-width: 42rem;
  color: #34434d;
  font-size: 1.08rem;
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.large-action {
  min-height: 5rem;
  padding: 0 2.2rem;
  font-size: 1.18rem;
  box-shadow: 0 18px 46px rgba(37, 99, 235, 0.34);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.entry-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.entry-card {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.workspace {
  max-width: 78rem;
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 2.2rem) 3rem;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.panel {
  padding: 1.05rem;
}

.leaderboard-panel {
  padding: clamp(1rem, 2.4vw, 1.4rem);
}

.leaderboard-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.74rem;
  font-weight: 900;
}

.score-chip {
  display: grid;
  gap: 0.1rem;
  min-width: 7rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: right;
}

.score-chip strong {
  font-size: 1.55rem;
}

label {
  display: grid;
  gap: 0.38rem;
  color: #2e3a42;
  font-size: 0.88rem;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0 0.78rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(23, 92, 211, 0.22);
  outline-offset: 2px;
}

.search-select {
  position: relative;
  width: 100%;
}

.search-select-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2.75rem;
}

.search-select-input {
  border-radius: 8px 0 0 8px;
}

.search-select-toggle {
  min-height: 2.75rem;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  font-weight: 900;
}

.search-select-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  display: none;
  max-height: 15rem;
  overflow-y: auto;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 44px rgba(7, 21, 34, 0.16);
}

.search-select.open .search-select-menu {
  display: grid;
  gap: 0.2rem;
}

.search-select-menu button,
.search-select-menu span {
  display: block;
  width: 100%;
  padding: 0.62rem 0.7rem;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-weight: 800;
}

.search-select-menu button:hover {
  background: rgba(37, 99, 235, 0.1);
}

.search-select.disabled {
  opacity: 0.68;
}

.primary {
  padding: 0 1rem;
  color: #fff;
  background: var(--blue);
}

.primary:hover {
  background: var(--blue-dark);
}

.primary:disabled,
.ghost:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.ghost {
  padding: 0 1rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--line);
}

.plan-upsell {
  padding: 0.75rem;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 8px;
  background: rgba(236, 253, 245, 0.82);
  color: #14564f;
  font-weight: 800;
}

.test-spec,
.metric-grid,
.domain-grid,
.rank-summary-grid,
.average-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.test-spec span,
.metric-grid div,
.domain-card,
.rank-card,
.average-card {
  display: grid;
  gap: 0.22rem;
  min-height: 3rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.test-spec span {
  place-items: center;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 900;
}

.status-panel {
  display: grid;
  gap: 0.25rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.status-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 900;
}

.quick-entry,
.filter-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.65fr 0.9fr 1fr auto;
  gap: 0.75rem;
  align-items: end;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.filter-grid {
  grid-template-columns: 1.2fr 1.05fr 0.95fr 0.85fr 1fr;
}

.board-tabs {
  width: fit-content;
  margin-top: 1rem;
}

.leaderboard-context {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.9rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.leaderboard-context span {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

.distribution-card {
  display: grid;
  gap: 0.85rem;
  margin-top: 1rem;
}

.board-distribution {
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.distribution-row {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
}

.distribution-label {
  display: grid;
  gap: 0.15rem;
}

.distribution-label span,
.domain-card span,
.rank-card span,
.average-card span,
.average-card small {
  color: var(--muted);
  font-size: 0.86rem;
}

.histogram {
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0.24rem;
  align-items: end;
  height: 7.5rem;
  padding-top: 1.65rem;
  border-bottom: 1px solid var(--line);
}

.histogram-bar {
  position: relative;
  min-height: 0.25rem;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, #69a7ff, #0f766e);
}

.histogram-bar b {
  position: absolute;
  top: -1.15rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 0.7rem;
}

.mean-marker,
.score-marker {
  position: absolute;
  z-index: 2;
  top: 0.25rem;
  bottom: 0;
  width: 2px;
  background: var(--ink);
}

.mean-marker b,
.score-marker b {
  position: absolute;
  top: 0;
  left: 0.25rem;
  width: max-content;
  font-size: 0.7rem;
}

.score-marker {
  background: var(--blue);
}

.score-marker b {
  top: 1rem;
  color: var(--blue);
}

.histogram-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.72rem;
}

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

.rank-row {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: center;
  padding: 0.82rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
}

.my-rank {
  border-color: rgba(23, 92, 211, 0.65);
  box-shadow: 0 0 0 3px rgba(23, 92, 211, 0.12);
}

.rank {
  color: var(--blue);
  font-weight: 900;
}

.rank-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 900;
}

.rank-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.rank-score {
  font-size: 1.35rem;
  font-weight: 950;
}

.insight-panel {
  margin-top: 1rem;
}

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

.average-card strong {
  font-size: 0.95rem;
}

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

.wide-rank {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
}

.test-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 1rem;
  align-items: center;
}

.timer {
  min-width: 6rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 1.25rem;
  font-weight: 900;
  text-align: center;
}

.question-stack {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.question {
  display: grid;
  gap: 1rem;
}

.question-title {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.question-title > div {
  display: grid;
  gap: 0.45rem;
}

.domain-pill {
  width: fit-content;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  background: #e7f4ee;
  color: var(--teal);
  font-size: 0.76rem;
  font-weight: 900;
}

.difficulty {
  color: var(--amber);
  font-size: 0.84rem;
  font-weight: 900;
}

.matrix {
  display: grid;
  grid-template-columns: repeat(3, minmax(4rem, 1fr));
  gap: 0.45rem;
  max-width: 28rem;
}

.matrix-cell,
.option-shape {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(145deg, #fff, #eef3f7);
}

.missing {
  color: var(--muted);
  font-size: 2rem;
  font-weight: 900;
}

.shape {
  display: grid;
  place-items: center;
  width: 62%;
  height: 62%;
  color: #fff;
  font-weight: 900;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.22), 0 8px 18px rgba(7, 21, 34, 0.14);
}

.shape.circle {
  border-radius: 50%;
}

.shape.square {
  border-radius: 7px;
}

.shape.diamond {
  transform: rotate(45deg);
  border-radius: 6px;
}

.shape.diamond span {
  transform: rotate(-45deg);
}

.shape.triangle {
  width: 0;
  height: 0;
  border-left: clamp(1rem, 22%, 1.65rem) solid transparent;
  border-right: clamp(1rem, 22%, 1.65rem) solid transparent;
  border-bottom: clamp(1.7rem, 38%, 2.85rem) solid currentColor;
  background: transparent !important;
}

.shape.triangle span {
  display: none;
}

.shape.hexagon {
  clip-path: polygon(25% 4%, 75% 4%, 100% 50%, 75% 96%, 25% 96%, 0 50%);
}

.shape.pill {
  width: 82%;
  height: 46%;
  border-radius: 999px;
}

.options {
  display: grid;
  grid-template-columns: repeat(4, minmax(4.8rem, 1fr));
  gap: 0.65rem;
}

.option {
  display: grid;
  gap: 0.45rem;
  color: var(--ink);
  font-weight: 900;
}

.option input {
  position: absolute;
  opacity: 0;
}

.option span:last-child {
  text-align: center;
}

.option input:checked + .option-shape {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(23, 92, 211, 0.18);
}

.text-options {
  grid-template-columns: repeat(2, minmax(8rem, 1fr));
}

.text-option .option-shape {
  aspect-ratio: auto;
  min-height: 4.2rem;
  padding: 0.8rem;
  text-align: center;
}

.text-question-prompt {
  align-self: stretch;
  width: 100%;
  max-width: 58rem;
  overflow: auto;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(145deg, #fff, #f7fbfd);
  color: var(--ink);
  font-size: clamp(1rem, 1.45vw, 1.3rem);
  font-weight: 850;
  line-height: 1.34;
}

.text-question .question-title h3 {
  font-size: 1.25rem;
}

.text-question .option-shape {
  display: flex;
  justify-content: flex-start;
  gap: 0.75rem;
  text-align: left;
}

.text-question .option-shape b {
  flex: 0 0 auto;
  color: var(--blue);
}

.spatial-stage {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.spatial-card {
  display: grid;
  place-items: center;
  width: 7rem;
  height: 7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.arrow {
  display: inline-block;
  color: var(--blue);
  font-size: 3rem;
  font-weight: 900;
  line-height: 1;
}

.turn-label {
  color: var(--muted);
  font-weight: 900;
}

.diagram-svg {
  display: block;
  width: min(8rem, 100%);
  height: auto;
  max-height: 8rem;
}

.diagram-equation {
  display: grid;
  gap: 0.65rem;
  width: min(34rem, 100%);
}

.diagram-matrix {
  display: grid;
  grid-template-columns: repeat(3, minmax(4.6rem, 1fr));
  gap: 0.55rem;
  width: min(24rem, 100%);
}

.diagram-matrix-cell {
  display: grid;
  place-items: center;
  min-width: 0;
}

.equation-row {
  display: grid;
  grid-template-columns: minmax(4.6rem, 1fr) auto minmax(4.6rem, 1fr) auto minmax(4.6rem, 1fr);
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  font-size: 1.5rem;
  font-weight: 900;
}

.equation-row .diagram-svg,
.diagram-matrix .diagram-svg,
.diagram-placeholder {
  width: 100%;
  max-height: 5.7rem;
  padding: 0.1rem;
}

.diagram-placeholder {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 2rem;
}

.option-shape .diagram-svg {
  width: min(6.5rem, 92%);
  max-height: 6.5rem;
}

.submit-row {
  display: flex;
  justify-content: flex-end;
}

.result-panel {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.result-panel h3 {
  margin: 0.25rem 0;
  font-size: 1.65rem;
}

.result-ring {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 9rem;
  height: 9rem;
  border: 0.8rem solid #b7dbc9;
  border-right-color: var(--blue);
  border-radius: 50%;
  background: #fff;
}

.result-ring span {
  font-size: 2.1rem;
  font-weight: 950;
}

.domain-card strong,
.rank-card strong,
.metric-grid strong {
  font-size: 1.35rem;
}

.domain-card small,
.rank-card small {
  color: var(--teal);
  font-weight: 900;
}

.notice {
  padding: 0.8rem;
  border: 1px solid #f2c6c2;
  border-radius: 8px;
  background: #fff4f2;
  color: var(--red);
  font-weight: 800;
}

.leaderboard-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  border-color: rgba(37, 99, 235, 0.18);
  background: rgba(239, 246, 255, 0.92);
  color: var(--ink);
}

.pagination-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
}

.pagination-controls .ghost {
  min-height: 2.15rem;
  padding: 0 0.7rem;
}

.pagination-controls .active-page {
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  border-color: transparent;
}

.page-ellipsis {
  display: grid;
  place-items: center;
  min-width: 1.5rem;
  color: var(--muted);
  font-weight: 900;
}

@media (max-width: 900px) {
  .top-nav,
  .hero-grid,
  .leaderboard-head,
  .result-panel,
  .test-header,
  .distribution-row {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .hero-panel {
    min-height: 0;
  }

  .workspace {
    margin-top: 0;
  }

  .quick-entry,
  .filter-grid,
  .test-spec,
  .plan-cards,
  .metric-grid,
  .domain-grid,
  .rank-summary-grid,
  .average-grid {
    grid-template-columns: 1fr;
  }

  .nav-tabs {
    width: 100%;
  }

  .nav-tab {
    flex: 1;
  }
}

@media (max-width: 560px) {
  .hero-panel,
  .workspace {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }

  .hero-actions,
  .board-tabs,
  .plan-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .matrix {
    max-width: none;
  }

  .question-runner {
    min-height: 58rem;
    height: 58rem;
  }

  .question-runner .question {
    grid-template-rows: 8rem 18rem 18rem;
  }

  .question-runner .options {
    grid-template-columns: 1fr 1fr;
    min-height: 18rem;
  }

  .question-runner .option-shape,
  .text-option .option-shape {
    min-height: 7rem;
    max-height: 7rem;
  }

  .question-runner .submit-row {
    grid-template-columns: 1fr 1fr;
  }

  .question-runner .submit-row button {
    width: 100%;
  }
}

/* Final phone layout overrides */
@media (max-width: 760px) {
  body {
    background-attachment: scroll;
  }

  .hero-panel {
    padding: 0.75rem 0.75rem 1.1rem;
  }

  .top-nav {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.8rem;
    padding: 0.65rem;
  }

  .brand {
    min-width: 0;
  }

  .brand-mark {
    width: 2.65rem;
    height: 2.65rem;
  }

  .brand h1 {
    font-size: 1.02rem;
  }

  .brand p {
    font-size: 0.82rem;
  }

  .nav-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .nav-tab {
    min-height: 2.55rem;
    padding: 0.35rem 0.45rem;
    font-size: 0.84rem;
  }

  .workspace {
    padding: 0 0.75rem 2rem;
  }

  .leaderboard-stage {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.85rem;
    margin-bottom: 0.85rem;
  }

  .stage-copy h2 {
    font-size: 2.15rem;
    line-height: 1;
  }

  .large-action {
    width: 100%;
    min-height: 3.6rem;
    padding: 0.7rem 1rem;
    font-size: 0.92rem;
    letter-spacing: 0.02em;
    white-space: normal;
  }

  .panel,
  .entry-card {
    padding: 0.85rem;
  }

  .leaderboard-head,
  .directory-actions,
  .result-actions,
  .share-reward-card,
  .reveal-free-retake,
  .share-copy-panel {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

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

  .score-chip {
    width: 100%;
  }

  .filter-grid {
    grid-template-columns: 1fr;
    gap: 0.7rem;
  }

  input,
  select,
  .search-select-control {
    min-height: 2.85rem;
  }

  .leaderboard-context {
    gap: 0.45rem;
  }

  .leaderboard-context span {
    width: 100%;
    border-radius: 8px;
  }

  .leaderboard-scroll {
    max-height: 62svh;
    padding-right: 0;
  }

  .rank-row {
    grid-template-columns: 2.45rem minmax(0, 1fr) 3.35rem;
    gap: 0.5rem;
    min-height: 4rem;
    padding: 0.65rem;
  }

  .rank {
    font-size: 0.9rem;
  }

  .rank-name {
    white-space: normal;
    line-height: 1.2;
  }

  .rank-meta {
    font-size: 0.74rem;
    line-height: 1.28;
  }

  .rank-score {
    font-size: 1rem;
  }

  .leaderboard-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .pagination-controls {
    justify-content: flex-start;
  }

  .pagination-controls .ghost {
    min-width: 2.45rem;
  }

  .leaderboard-hub {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .leaderboard-route,
  .leaderboard-route:first-child {
    grid-column: auto;
    grid-template-columns: 1fr;
    grid-template-rows: 9rem auto auto auto;
    min-height: 17rem;
    padding: 0.75rem;
  }

  .leaderboard-route:first-child .route-visual,
  .leaderboard-route:first-child span,
  .leaderboard-route:first-child strong,
  .leaderboard-route:first-child small {
    grid-column: auto;
    grid-row: auto;
  }

  .route-visual,
  .leaderboard-route:first-child .route-visual {
    min-height: 9rem;
  }

  .leaderboard-route strong {
    font-size: 1.2rem;
  }

  .directory-back {
    width: 100%;
    min-height: 3rem;
  }

  .directory-controls {
    display: grid;
    grid-template-columns: 1fr;
  }

  .directory-controls label {
    min-width: 0;
  }

  .plan-cards {
    grid-template-columns: 1fr;
  }

  .plan-card {
    min-height: 0;
    padding: 0.95rem;
  }

  .plan-card.active::after {
    top: 0.75rem;
    right: 0.75rem;
  }

  .feature-compare {
    overflow-x: auto;
    padding-bottom: 0.8rem;
  }

  .feature-compare div {
    min-width: 38rem;
  }

  .test-spec,
  .metric-grid,
  .domain-grid,
  .rank-summary-grid,
  .average-grid {
    grid-template-columns: 1fr;
  }

  .test-header {
    grid-template-columns: 1fr;
  }

  .timer,
  .test-header .primary {
    width: 100%;
  }

  .question-runner {
    width: 100%;
    min-height: auto;
    height: auto;
    padding-bottom: 0.25rem;
  }

  .question-runner .question,
  .question-runner .text-question {
    grid-template-rows: auto minmax(14rem, auto) auto;
    overflow: visible;
  }

  .question-title {
    display: grid;
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .question-visual {
    min-height: 14rem;
  }

  .matrix,
  .spatial-stage {
    width: min(17rem, 100%);
    min-height: 14rem;
    max-height: none;
  }

  .diagram-matrix {
    width: min(18rem, 100%);
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .diagram-equation {
    width: 100%;
  }

  .equation-row {
    grid-template-columns: minmax(3.25rem, 1fr) auto minmax(3.25rem, 1fr) auto minmax(3.25rem, 1fr);
    gap: 0.3rem;
    font-size: 1rem;
  }

  .equation-row .diagram-svg,
  .diagram-matrix .diagram-svg,
  .diagram-placeholder {
    max-height: 4.6rem;
  }

  .question-runner .options,
  .question-runner .text-options {
    grid-template-columns: 1fr 1fr;
    min-height: 0;
  }

  .question-runner .option-shape,
  .text-option .option-shape {
    min-height: 5.8rem;
    max-height: none;
  }

  .text-question-prompt {
    max-height: none;
    font-size: 1rem;
  }

  .question-runner .submit-row {
    grid-template-columns: 1fr 1fr;
  }

  .question-runner .submit-row button {
    width: 100%;
  }

  .analytics-hero {
    grid-template-columns: 1fr;
  }

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

  .analytics-snapshot {
    grid-template-columns: 1fr;
    min-width: 0;
  }

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

  .earn-teaser,
  .earn-actions {
    align-items: stretch;
  }

  .earn-teaser {
    display: grid;
  }

  .earn-hero,
  .referral-panel,
  .referral-link-row {
    grid-template-columns: 1fr;
  }

  .earn-hero {
    min-height: auto;
  }

  .earn-hero h2 {
    max-width: 100%;
    font-size: clamp(2.3rem, 13vw, 4.2rem);
  }

  .earn-hero-card {
    min-height: 12rem;
  }

  .earn-steps,
  .earn-grid,
  .referral-stats {
    grid-template-columns: 1fr;
  }

  .earn-actions button,
  .referral-link-row button {
    width: 100%;
  }

  .wide-analytic,
  .analytics-grid .wide-rank,
  .analytics-grid .featured-rank-card {
    grid-column: auto;
  }

  .distribution-row {
    grid-template-columns: 1fr;
  }

  .histogram {
    height: 6.6rem;
  }

  .result-panel,
  .certificate-style-result {
    display: grid;
    grid-template-columns: 1fr;
    text-align: left;
  }

  .result-ring {
    width: 7.5rem;
    height: 7.5rem;
    border-width: 0.65rem;
  }

  .insight-hero-result.certificate-style-result .result-ring {
    width: min(12rem, 78vw);
    height: min(12rem, 78vw);
    justify-self: start;
  }

  .result-reveal-card {
    width: min(38rem, 100%);
  }

  .reveal-score-stage {
    width: min(15rem, 78vw);
    height: min(15rem, 78vw);
  }

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

  .reveal-referral {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .result-reveal-card .result-actions button {
    flex: 1 1 11rem;
  }

  .result-reveal-card > strong {
    font-size: 4rem;
  }

  .certificate-preview-card {
    max-height: calc(100svh - 2rem);
    overflow: auto;
  }
}

/* v2 pilot assessment layout: stable question and answer dimensions after plan cleanup. */
.test-entry-grid {
  align-items: start;
}

.plan-cards {
  grid-template-columns: repeat(2, minmax(16rem, 1fr));
}

.question-runner {
  width: min(58rem, 100%);
  min-height: 0;
  height: min(48rem, calc(100svh - 8rem));
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.question-runner .question,
.question-runner .text-question {
  grid-template-rows: minmax(5.4rem, auto) minmax(12rem, 18rem) minmax(12rem, 1fr);
  overflow: hidden;
}

.question-title {
  min-height: 0;
}

.question-title h3 {
  font-size: clamp(1rem, 1.8vw, 1.35rem);
  line-height: 1.15;
}

.question-visual {
  min-height: 12rem;
  max-height: 18rem;
  overflow: auto;
}

.question-runner .options,
.question-runner .text-options {
  min-height: 0;
  max-height: 100%;
  overflow: auto;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
}

.question-runner .option {
  min-width: 0;
}

.question-runner .option-shape,
.text-option .option-shape {
  min-height: 5.6rem;
  max-height: 8.5rem;
  overflow: auto;
}

.cognitive-matrix {
  display: grid;
  gap: 0.45rem;
  width: min(17rem, 100%);
}

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

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

.cognitive-matrix > div,
.memory-task,
.symbol-task,
.symbol-code-task,
.pair-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
}

.diagram-svg.cognitive-symbol,
.diagram-svg.polygon-stimulus {
  width: min(7.8rem, 100%);
  height: auto;
  max-height: 7.8rem;
}

.cube-net {
  width: min(15rem, 100%);
  max-height: 15rem;
}

.symbol-task,
.symbol-code-task,
.memory-task {
  display: grid;
  gap: 0.8rem;
  width: 100%;
  padding: 1rem;
}

.target-symbol {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
}

.target-symbol strong {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 8px;
  background: var(--blue-dark);
  color: #fff;
  font-size: 1.5rem;
}

.symbol-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem;
}

.symbol-row b,
.symbol-query b,
.symbol-key span,
.pair-list span {
  border: 1px solid rgba(7, 26, 53, 0.12);
  border-radius: 6px;
  background: #fff;
}

.symbol-row b {
  display: grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
}

.pair-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  width: 100%;
  max-height: 16rem;
  overflow: auto;
  padding: 0.8rem;
}

.pair-list span {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
  padding: 0.35rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
}

.symbol-key,
.symbol-query {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
}

.symbol-key span,
.symbol-query b {
  padding: 0.35rem 0.5rem;
  font-size: 0.82rem;
}

.symbol-key b {
  margin-left: 0.35rem;
  color: var(--blue);
}

.memory-task {
  place-items: center;
  text-align: center;
}

.memory-task strong {
  color: var(--blue-dark);
  font-size: 1.4rem;
}

.memory-task small {
  max-width: 36rem;
  color: var(--muted);
  font-weight: 750;
}

@media (max-width: 760px) {
  .plan-cards {
    grid-template-columns: 1fr;
  }

  .question-runner {
    height: min(42rem, calc(100svh - 5rem));
    padding: 0.85rem;
  }

  .question-runner .question,
  .question-runner .text-question {
    grid-template-rows: minmax(5.8rem, auto) minmax(10rem, 14rem) minmax(12rem, 1fr);
  }

  .question-visual {
    min-height: 10rem;
    max-height: 14rem;
  }

  .question-runner .options,
  .question-runner .text-options {
    grid-template-columns: 1fr;
  }

  .question-runner .option-shape,
  .text-option .option-shape {
    min-height: 4.8rem;
    max-height: 6.8rem;
  }

  .pair-list {
    grid-template-columns: 1fr;
  }
}

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

  .nav-tab:last-child {
    grid-column: auto;
  }

  .stage-copy h2 {
    font-size: 1.85rem;
  }

  .share-platform-grid {
    grid-template-columns: 1fr;
  }

  .rank-row {
    grid-template-columns: 2.25rem minmax(0, 1fr);
  }

  .rank-score {
    grid-column: 2;
    text-align: left;
  }

  .question-runner .options,
  .question-runner .text-options {
    grid-template-columns: 1fr;
  }
}

/* Absolute final palette override */
:root {
  --ink: #071a35;
  --muted: #586272;
  --line: rgba(7, 26, 53, 0.14);
  --blue: #173f8a;
  --blue-dark: #071a35;
  --teal: #1d4ed8;
  --gold: #b98b2d;
  --accent-ink: #071a35;
  --accent-forest: #173f8a;
  --accent-forest-soft: rgba(23, 63, 138, 0.1);
  --shadow: 0 24px 72px rgba(7, 26, 53, 0.15);
}

body {
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(246, 249, 255, 0.82), rgba(234, 241, 252, 0.72) 44%, rgba(248, 251, 255, 0.84)),
    url("assets/iqrank-background.png") center top / cover fixed;
}

.brand-mark,
.primary,
.test-header .primary,
.nav-tab.active,
.segment.active {
  color: #fff;
  background: linear-gradient(135deg, #071a35 0%, #173f8a 58%, #1d4ed8 100%);
}

.top-nav,
.panel,
.leaderboard-panel,
.analytics-hero,
.entry-card,
.quick-entry-card,
.test-panel,
.leaderboard-detail {
  border-color: var(--line);
  background: linear-gradient(180deg, rgba(248, 251, 255, 0.94), rgba(242, 247, 255, 0.88));
  box-shadow: var(--shadow);
}

.top-nav {
  border-top: 4px solid rgba(7, 26, 53, 0.72);
}

.brand h1,
.brand p,
.top-nav .brand h1,
.top-nav .brand p,
.top-nav .nav-tab,
.leaderboard-route strong,
.rank-name,
.score-chip strong,
.plan-card .plan-label,
.plan-card strong {
  color: var(--accent-ink);
}

.nav-tabs,
.segmented,
.plan-toggle {
  border-color: rgba(15, 23, 42, 0.1);
  background: rgba(232, 239, 251, 0.88);
}

.primary:hover {
  background: linear-gradient(135deg, #06142a 0%, #12336f 58%, #173f8a 100%);
}

.plan-upsell,
.share-reward-card,
.reveal-free-retake,
.earn-hero-card {
  border-color: rgba(211, 154, 22, 0.34);
  border-left-color: var(--gold);
  background: linear-gradient(135deg, rgba(255, 250, 235, 0.98), rgba(255, 255, 255, 0.94) 54%, rgba(15, 118, 110, 0.08));
}

.leaderboard-route {
  border-color: rgba(15, 23, 42, 0.1);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.92));
}

.leaderboard-route span,
.plan-card em {
  color: #173f8a;
  background: rgba(23, 63, 138, 0.1);
}

.leaderboard-route small {
  color: #506174;
}

.leaderboard-route:hover,
.leaderboard-route.active,
.plan-card.active {
  border-color: rgba(29, 78, 216, 0.38);
  box-shadow: 0 20px 52px rgba(29, 78, 216, 0.13);
}

.rank-score,
.insight-mini strong,
.domain-card strong,
.rank-card strong,
.average-card strong,
.analytics-snapshot b {
  color: var(--teal);
}

.progress-track span,
.histogram-bar,
.referral-progress span,
.reveal-curve-fill {
  background: linear-gradient(90deg, #071a35, #173f8a, #1d4ed8);
}

.analytics-hero,
.primary-insight-panel,
.celebrity-leaderboard-panel,
.earn-hero,
.leaderboard-detail {
  border-left-color: #173f8a;
  border-top-color: rgba(29, 78, 216, 0.18);
}

.result-reveal-card,
.insight-hero-result.certificate-style-result {
  background:
    radial-gradient(circle at 88% 12%, rgba(211, 154, 22, 0.16), transparent 28%),
    linear-gradient(135deg, #ffffff, #f8faf7 58%, #ecf7f5);
}

.result-reveal {
  background:
    linear-gradient(135deg, rgba(11, 18, 32, 0.52), rgba(15, 118, 110, 0.22)),
    rgba(11, 18, 32, 0.36);
}

.reveal-score-stage,
.insight-hero-result.certificate-style-result .result-ring {
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.98) 0 58%, transparent 59%),
    conic-gradient(from -90deg, #1d4ed8 0 var(--reveal-progress, var(--iq-progress, 0deg)), rgba(15, 23, 42, 0.12) var(--reveal-progress, var(--iq-progress, 0deg)) 360deg);
}

/* Final test-runner repair: content-driven questions, no clipped answer wells. */
.test-panel {
  max-width: min(74rem, calc(100vw - 2rem));
  margin-inline: auto;
}

.test-header {
  align-items: center;
}

.question-runner {
  display: grid;
  gap: 1rem;
  width: min(64rem, 100%);
  height: auto !important;
  min-height: 0 !important;
  margin-inline: auto;
  overflow: visible !important;
}

.question-runner .question {
  display: grid;
  grid-template-rows: auto auto auto auto;
  gap: clamp(1rem, 2vw, 1.35rem);
  min-height: 0 !important;
  height: auto !important;
  overflow: visible !important;
  padding: clamp(1rem, 2.4vw, 1.45rem);
  border-radius: 14px;
  box-shadow: none;
}

.question-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  min-height: 0 !important;
  align-items: start;
}

.question-title h3 {
  max-width: 62rem;
  font-size: clamp(1.2rem, 2vw, 1.65rem);
  line-height: 1.08;
  text-wrap: balance;
}

.question-title .difficulty {
  min-width: 4.5rem;
  text-align: right;
}

.question-visual,
.empty-visual {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 0 !important;
  height: auto !important;
  overflow: visible !important;
  padding: clamp(0.4rem, 1.8vw, 1rem) 0;
}

.question-runner .options,
.question-runner .text-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  min-height: 0 !important;
  height: auto !important;
  overflow: visible !important;
  align-items: stretch;
}

.question-runner .option {
  display: grid;
  grid-template-rows: minmax(6rem, auto) auto;
  gap: 0.45rem;
  min-width: 0;
  min-height: 7.5rem;
  cursor: pointer;
}

.question-runner .text-option {
  grid-template-rows: minmax(5.75rem, auto);
}

.question-runner .option-shape,
.question-runner .text-option .option-shape,
.text-option .option-shape {
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  min-height: clamp(6.5rem, 13vw, 9rem) !important;
  max-height: none !important;
  height: auto !important;
  overflow: visible !important;
  padding: 0.75rem;
  text-align: center;
  word-break: normal;
  overflow-wrap: anywhere;
}

.question-runner .text-option .option-shape {
  justify-items: center;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.75rem;
  text-align: left;
}

.question-runner input[type="radio"]:focus-visible + .option-shape,
.question-runner .option:focus-within .option-shape {
  outline: 3px solid rgba(23, 63, 138, 0.38);
  outline-offset: 3px;
}

.matrix,
.spatial-stage,
.cognitive-matrix,
.diagram-matrix {
  width: min(19rem, 100%) !important;
  min-height: 0 !important;
  max-height: none !important;
  height: auto !important;
  overflow: visible !important;
}

.cognitive-matrix,
.diagram-matrix {
  margin-inline: auto;
}

.diagram-svg,
.option-shape svg {
  display: block;
  max-width: min(100%, 9.5rem);
  height: auto;
  object-fit: contain;
  overflow: visible;
}

.question-visual .diagram-svg,
.question-visual .cognitive-symbol {
  max-width: min(100%, 15rem);
}

.memory-task {
  display: grid;
  gap: 1rem;
  width: min(34rem, 100%);
  margin-inline: auto;
  padding: clamp(1rem, 2vw, 1.35rem);
  border: 1px solid rgba(7, 26, 53, 0.14);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 248, 253, 0.96));
  text-align: center;
}

.memory-task-copy {
  display: grid;
  gap: 0.3rem;
}

.memory-task-copy strong {
  color: var(--ink);
  font-size: clamp(1.25rem, 2.2vw, 1.7rem);
}

.memory-task-copy span,
.memory-task-copy small,
.memory-option-note {
  color: var(--muted);
  font-weight: 800;
}

.memory-stage {
  display: grid;
  place-items: center;
  min-height: clamp(8rem, 20vw, 12rem);
}

.memory-digit {
  display: grid;
  place-items: center;
  width: clamp(6rem, 18vw, 8rem);
  aspect-ratio: 1;
  border: 1px solid rgba(7, 26, 53, 0.16);
  border-radius: 18px;
  background: #fff;
  color: var(--blue-dark);
  font-size: clamp(2.8rem, 8vw, 4.5rem);
  font-weight: 950;
  box-shadow: 0 18px 44px rgba(7, 26, 53, 0.12);
}

.memory-grid {
  display: grid;
  gap: 0.55rem;
  width: min(18rem, 92vw);
}

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

.memory-grid-9 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.memory-cell {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid rgba(7, 26, 53, 0.16);
  border-radius: 12px;
  background: #fff;
  color: var(--muted);
  font-weight: 950;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.memory-cell.active {
  background: var(--blue);
  color: #fff;
  transform: scale(1.04);
  box-shadow: 0 14px 32px rgba(23, 63, 138, 0.22);
}

.memory-options-locked {
  display: none !important;
}

.memory-option-note {
  margin: 0;
  padding: 0.7rem 0.85rem;
  border: 1px dashed rgba(7, 26, 53, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.62);
  text-align: center;
}

.question-runner .submit-row {
  position: static;
  display: grid;
  grid-template-columns: minmax(8rem, 11rem) minmax(9rem, 12rem);
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  padding-top: 0.25rem;
}

.question-runner .submit-row button {
  width: 100%;
  min-height: 3.25rem;
}

.result-reveal {
  padding: 1rem;
  overflow: auto;
}

.result-reveal-card {
  width: min(34rem, calc(100vw - 2rem));
  max-height: calc(100vh - 32px);
  overflow: auto;
  gap: 0.8rem;
  padding: clamp(1rem, 2.4vw, 1.5rem);
  border-radius: 16px;
  text-align: left;
}

.result-reveal-card .eyebrow,
.result-reveal-card h3,
.result-reveal-card p {
  text-align: left;
}

.reveal-score-stage {
  width: min(11rem, 52vw);
  height: min(11rem, 52vw);
  margin-inline: 0;
}

.reveal-score-stage strong {
  font-size: clamp(2.2rem, 8vw, 3.4rem);
}

.reveal-rank-grid {
  grid-template-columns: 1fr;
}

.locked-result-list {
  display: grid;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 1px solid rgba(7, 26, 53, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.locked-result-list span {
  position: relative;
  padding-left: 1.45rem;
  color: var(--ink);
  font-weight: 850;
}

.locked-result-list span::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.48em;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: var(--gold);
}

.result-reveal-card .result-actions {
  justify-content: stretch;
}

.result-reveal-card .result-actions button {
  flex: 1 1 12rem;
}

@media (max-width: 760px) {
  .test-header {
    grid-template-columns: 1fr;
  }

  .question-title {
    grid-template-columns: 1fr;
  }

  .question-title .difficulty {
    text-align: left;
  }

  .question-runner .options,
  .question-runner .text-options {
    grid-template-columns: 1fr;
  }

  .question-runner .submit-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .question-runner .question {
    padding: 0.85rem;
  }

  .domain-pill {
    max-width: 100%;
    white-space: normal;
  }

  .question-title h3 {
    font-size: 1.12rem;
  }
}

/* IQ World Rank ultimate final design layer. Keep this at EOF. */
:root {
  --canvas: #f4f1eb;
  --canvas-2: #ebe7df;
  --surface: #fffdfa;
  --surface-2: #f8f5ee;
  --ink: #101722;
  --muted: #667085;
  --line: rgba(16, 23, 34, 0.12);
  --line-strong: rgba(16, 23, 34, 0.22);
  --navy: #09213f;
  --navy-2: #123761;
  --gold: #b58a35;
  --sage: #617568;
  --shadow-soft: 0 1px 1px rgba(16, 23, 34, 0.04), 0 14px 35px rgba(16, 23, 34, 0.07);
  --shadow-premium: 0 22px 65px rgba(16, 23, 34, 0.13);
}

html,
body {
  min-width: 0;
  color: var(--ink) !important;
  background:
    radial-gradient(circle at 10% 0%, rgba(181, 138, 53, 0.12), transparent 28rem),
    linear-gradient(180deg, #faf8f3 0%, var(--canvas) 48%, var(--canvas-2) 100%) !important;
  background-attachment: fixed;
}

body::before,
body::after {
  display: none !important;
  content: none !important;
}

.app-shell {
  width: min(100%, 100vw);
  overflow-x: clip;
}

.hero-panel {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 0.75rem clamp(0.75rem, 2vw, 1.5rem) !important;
  background: rgba(250, 248, 243, 0.9) !important;
  border-bottom: 1px solid rgba(16, 23, 34, 0.08);
  backdrop-filter: blur(18px);
}

.top-nav {
  display: grid !important;
  grid-template-columns: minmax(13rem, 1fr) auto !important;
  align-items: center !important;
  gap: 1rem !important;
  width: min(1180px, 100%) !important;
  margin: 0 auto !important;
  padding: 0.55rem !important;
  border: 1px solid rgba(16, 23, 34, 0.1) !important;
  border-radius: 18px !important;
  background: rgba(255, 253, 250, 0.92) !important;
  box-shadow: 0 10px 30px rgba(16, 23, 34, 0.08) !important;
}

.brand {
  display: flex !important;
  align-items: center !important;
  gap: 0.75rem !important;
  min-width: 0;
}

.brand-mark {
  width: 2.5rem !important;
  height: 2.5rem !important;
  border-radius: 12px !important;
  color: #fff !important;
  background: linear-gradient(145deg, var(--navy), #173d70) !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.16) !important;
}

.brand h1,
.top-nav .brand h1 {
  color: var(--ink) !important;
  font-size: 1.1rem !important;
  line-height: 1 !important;
  letter-spacing: -0.01em !important;
}

.brand p,
.top-nav .brand p {
  margin-top: 0.18rem !important;
  color: var(--muted) !important;
  font-size: 0.82rem !important;
}

.nav-tabs {
  display: flex !important;
  grid-template-columns: none !important;
  gap: 0.25rem !important;
  width: auto !important;
  max-width: 100% !important;
  min-width: 0 !important;
  padding: 0.25rem !important;
  overflow-x: auto !important;
  border: 1px solid rgba(16, 23, 34, 0.1) !important;
  border-radius: 14px !important;
  background: #ece8df !important;
  box-shadow: inset 0 1px 2px rgba(16, 23, 34, 0.06) !important;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.nav-tab,
.top-nav .nav-tab {
  flex: 0 0 auto !important;
  grid-column: auto !important;
  min-width: 6.8rem !important;
  min-height: 2.35rem !important;
  padding: 0.45rem 0.9rem !important;
  color: #344054 !important;
  border: 1px solid transparent !important;
  border-radius: 10px !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 0.9rem !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

.nav-tab.active,
.nav-tab[aria-selected="true"],
.segment.active {
  color: #fff !important;
  border-color: rgba(9, 33, 63, 0.88) !important;
  background: var(--navy) !important;
  box-shadow: 0 6px 16px rgba(9, 33, 63, 0.16) !important;
}

.workspace {
  width: min(1180px, calc(100% - clamp(1.25rem, 5vw, 4rem))) !important;
  margin: 0 auto !important;
  padding: clamp(1.25rem, 3vw, 2.5rem) 0 4rem !important;
}

.panel,
.leaderboard-panel,
.leaderboard-detail,
.celebrity-leaderboard-panel,
.analytics-hero,
.entry-card,
.quick-entry-card,
.test-panel,
.plan-card,
.result-panel,
.certificate-style-result,
.insight-mini,
.insight-panel,
.rank-card,
.average-card,
.domain-card {
  color: var(--ink) !important;
  border: 1px solid var(--line) !important;
  border-radius: 18px !important;
  background: rgba(255, 253, 250, 0.94) !important;
  box-shadow: var(--shadow-soft) !important;
  backdrop-filter: none !important;
}

.leaderboard-stage {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: end !important;
  gap: 1rem !important;
  margin-bottom: 1.25rem !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.leaderboard-stage::before {
  display: none !important;
}

.eyebrow {
  color: var(--gold) !important;
  font-size: 0.74rem !important;
  font-weight: 900 !important;
  letter-spacing: 0.12em !important;
}

.stage-copy h2,
#viewTitle {
  max-width: 12ch;
  color: var(--ink) !important;
  font-size: clamp(2.45rem, 6vw, 5rem) !important;
  line-height: 0.92 !important;
  letter-spacing: -0.055em !important;
}

.primary,
.test-header .primary,
.large-action {
  color: #fff !important;
  border: 1px solid var(--navy) !important;
  border-radius: 12px !important;
  background: var(--navy) !important;
  box-shadow: 0 12px 28px rgba(9, 33, 63, 0.18) !important;
}

.leaderboard-hub {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 1rem !important;
  margin: 1.1rem 0 !important;
}

.leaderboard-route,
.leaderboard-route:first-child {
  position: relative !important;
  display: grid !important;
  grid-column: auto !important;
  grid-template-columns: 9.5rem minmax(0, 1fr) !important;
  grid-template-rows: auto auto 1fr !important;
  align-items: start !important;
  gap: 0.5rem 1rem !important;
  min-height: 12.25rem !important;
  padding: 1rem !important;
  overflow: hidden !important;
  color: var(--ink) !important;
  text-align: left !important;
  border: 1px solid rgba(16, 23, 34, 0.1) !important;
  border-radius: 20px !important;
  background: linear-gradient(180deg, rgba(255, 253, 250, 0.96), rgba(248, 245, 238, 0.96)) !important;
  box-shadow: var(--shadow-soft) !important;
}

.leaderboard-route::after {
  position: absolute;
  right: -2.4rem;
  bottom: -2.4rem;
  width: 9rem;
  height: 9rem;
  border: 1px solid rgba(181, 138, 53, 0.16);
  border-radius: 999px;
  content: "";
}

.leaderboard-route:hover,
.leaderboard-route.active {
  transform: translateY(-2px) !important;
  border-color: rgba(181, 138, 53, 0.5) !important;
  background: #fffaf1 !important;
  box-shadow: var(--shadow-premium) !important;
}

.route-visual,
.leaderboard-route:first-child .route-visual {
  grid-column: 1 !important;
  grid-row: 1 / 4 !important;
  width: 100% !important;
  min-height: 10rem !important;
  overflow: hidden !important;
  border: 1px solid rgba(16, 23, 34, 0.08) !important;
  border-radius: 15px !important;
  background-color: #e7edf1 !important;
  background-size: auto, auto, auto !important;
  filter: none !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.38) !important;
}

.leaderboard-route span,
.leaderboard-route:first-child span {
  grid-column: 2 !important;
  grid-row: auto !important;
  align-self: start !important;
  width: fit-content !important;
  padding: 0.32rem 0.55rem !important;
  color: var(--navy) !important;
  border: 1px solid rgba(9, 33, 63, 0.16) !important;
  border-radius: 999px !important;
  background: #edf2f6 !important;
  font-size: 0.68rem !important;
  font-weight: 900 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
}

.leaderboard-route strong,
.leaderboard-route:first-child strong {
  grid-column: 2 !important;
  grid-row: auto !important;
  color: var(--ink) !important;
  font-size: clamp(1.25rem, 2.2vw, 1.65rem) !important;
  line-height: 1.02 !important;
  letter-spacing: -0.035em !important;
}

.leaderboard-route small,
.leaderboard-route:first-child small {
  grid-column: 2 !important;
  grid-row: auto !important;
  max-width: 22rem !important;
  color: var(--muted) !important;
  font-size: 0.96rem !important;
  font-weight: 700 !important;
  line-height: 1.35 !important;
}

.visual-world {
  background:
    radial-gradient(circle at 30% 28%, #d5a54a 0 0.5rem, transparent 0.55rem),
    radial-gradient(circle at 62% 46%, #6b7f72 0 0.55rem, transparent 0.6rem),
    radial-gradient(circle at 43% 68%, #09213f 0 0.6rem, transparent 0.65rem),
    linear-gradient(135deg, #eef2f4, #d7e0e7) !important;
}

.visual-country {
  background:
    linear-gradient(90deg, transparent 0 22%, rgba(9,33,63,0.13) 22% 23%, transparent 23% 48%, rgba(181,138,53,0.18) 48% 49%, transparent 49%),
    linear-gradient(0deg, transparent 0 28%, rgba(9,33,63,0.11) 28% 29%, transparent 29% 66%, rgba(181,138,53,0.16) 66% 67%, transparent 67%),
    linear-gradient(135deg, #f4efe5, #dce8ee) !important;
}

.visual-city {
  background:
    linear-gradient(0deg, #09213f 0 18%, transparent 18%),
    repeating-linear-gradient(90deg, rgba(9,33,63,0.72) 0 0.75rem, transparent 0.75rem 1.35rem),
    linear-gradient(135deg, #dde8ed, #f9f3e6) !important;
}

.visual-gender {
  background:
    radial-gradient(circle at 32% 42%, rgba(9,33,63,0.9) 0 1.25rem, transparent 1.3rem),
    radial-gradient(circle at 62% 42%, rgba(181,138,53,0.88) 0 1.25rem, transparent 1.3rem),
    linear-gradient(135deg, #f6efe3, #dfe8f0) !important;
}

.visual-age {
  background:
    repeating-linear-gradient(90deg, rgba(9,33,63,0.7) 0 0.45rem, transparent 0.45rem 1.5rem),
    linear-gradient(135deg, #f5efe4, #dfe8ec) !important;
}

.visual-matrix {
  background:
    linear-gradient(90deg, rgba(9,33,63,0.8) 0 1px, transparent 1px),
    linear-gradient(0deg, rgba(9,33,63,0.8) 0 1px, transparent 1px),
    radial-gradient(circle at 50% 50%, rgba(181,138,53,0.65), transparent 1.25rem),
    #e8edf0 !important;
  background-size: 2rem 2rem, 2rem 2rem, auto, auto !important;
}

.visual-verbal {
  background:
    repeating-linear-gradient(0deg, rgba(9,33,63,0.64) 0 0.2rem, transparent 0.2rem 1rem),
    linear-gradient(135deg, #f7f1e6, #dce7ee) !important;
}

.visual-comprehensive {
  background:
    conic-gradient(from 0.18turn at 50% 50%, rgba(9,33,63,0.9), rgba(181,138,53,0.8), rgba(97,117,104,0.85), rgba(9,33,63,0.9)) !important;
}

.leaderboard-columns,
.rank-row {
  grid-template-columns: 4.4rem minmax(0, 1fr) minmax(6rem, auto) !important;
  border-bottom: 1px solid rgba(16, 23, 34, 0.08) !important;
}

.leaderboard-columns {
  color: var(--muted) !important;
  background: #f4f0e7 !important;
}

.rank-score {
  color: var(--navy) !important;
}

@media (max-width: 980px) {
  .top-nav {
    grid-template-columns: 1fr !important;
    gap: 0.65rem !important;
  }

  .nav-tabs {
    width: 100% !important;
  }

  .leaderboard-stage {
    grid-template-columns: 1fr !important;
    align-items: start !important;
  }
}

@media (max-width: 760px) {
  html,
  body {
    background-attachment: scroll !important;
  }

  .hero-panel {
    padding: 0.5rem !important;
  }

  .brand-mark {
    width: 2.2rem !important;
    height: 2.2rem !important;
  }

  .brand h1,
  .top-nav .brand h1 {
    font-size: 1rem !important;
  }

  .brand p,
  .top-nav .brand p {
    font-size: 0.76rem !important;
  }

  .nav-tab,
  .top-nav .nav-tab {
    min-width: 5.4rem !important;
    min-height: 2.35rem !important;
    padding-inline: 0.75rem !important;
    font-size: 0.84rem !important;
  }

  .workspace {
    width: calc(100% - 1rem) !important;
    padding-top: 1rem !important;
  }

  .stage-copy h2,
  #viewTitle {
    max-width: 11ch !important;
    font-size: clamp(2.2rem, 14vw, 3.25rem) !important;
  }

  .large-action {
    width: 100% !important;
  }

  .leaderboard-head {
    grid-template-columns: 1fr !important;
  }

  .leaderboard-hub {
    grid-template-columns: 1fr !important;
  }

  .leaderboard-route,
  .leaderboard-route:first-child {
    grid-template-columns: 7rem minmax(0, 1fr) !important;
    min-height: 10.5rem !important;
    padding: 0.75rem !important;
  }

  .route-visual,
  .leaderboard-route:first-child .route-visual {
    min-height: 8.8rem !important;
  }
}

@media (max-width: 460px) {
  .leaderboard-route,
  .leaderboard-route:first-child {
    grid-template-columns: 1fr !important;
  }

  .route-visual,
  .leaderboard-route:first-child .route-visual {
    grid-column: auto !important;
    grid-row: auto !important;
    aspect-ratio: 2.5 / 1 !important;
    min-height: 0 !important;
  }

  .leaderboard-route span,
  .leaderboard-route strong,
  .leaderboard-route small,
  .leaderboard-route:first-child span,
  .leaderboard-route:first-child strong,
  .leaderboard-route:first-child small {
    grid-column: auto !important;
  }

  .leaderboard-columns,
  .rank-row {
    grid-template-columns: 3rem minmax(0, 1fr) minmax(4.5rem, auto) !important;
    padding: 0.75rem !important;
  }
}

/* Premium redesign layer: must remain the final CSS block. */
:root {
  --canvas: #f4f1eb;
  --canvas-2: #ebe7df;
  --surface: #fffdfa;
  --surface-2: #f8f5ee;
  --ink: #101722;
  --muted: #667085;
  --line: rgba(16, 23, 34, 0.12);
  --line-strong: rgba(16, 23, 34, 0.22);
  --navy: #09213f;
  --navy-2: #123761;
  --gold: #b58a35;
  --sage: #617568;
  --blue-soft: #dfe8f0;
  --shadow: 0 18px 55px rgba(16, 23, 34, 0.11);
  --shadow-soft: 0 1px 1px rgba(16, 23, 34, 0.04), 0 14px 35px rgba(16, 23, 34, 0.07);
}

html,
body {
  min-width: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(181, 138, 53, 0.12), transparent 28rem),
    linear-gradient(180deg, #faf8f3 0%, var(--canvas) 42%, var(--canvas-2) 100%);
  background-attachment: fixed;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before,
body::after {
  display: none !important;
  content: none !important;
}

.app-shell {
  width: min(100%, 100vw);
  overflow-x: clip;
}

.hero-panel {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 0.75rem clamp(0.75rem, 2vw, 1.5rem);
  background: rgba(250, 248, 243, 0.9);
  border-bottom: 1px solid rgba(16, 23, 34, 0.08);
  backdrop-filter: blur(18px);
}

.top-nav {
  display: grid;
  grid-template-columns: minmax(13rem, 1fr) auto;
  align-items: center;
  gap: 1rem;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 0.55rem;
  border: 1px solid rgba(16, 23, 34, 0.1);
  border-top: 1px solid rgba(16, 23, 34, 0.1);
  border-radius: 18px;
  background: rgba(255, 253, 250, 0.92);
  box-shadow: 0 10px 30px rgba(16, 23, 34, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.brand-mark {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(145deg, var(--navy), #173d70);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.16);
}

.brand h1,
.top-nav .brand h1 {
  color: var(--ink);
  font-size: 1.1rem;
  line-height: 1;
  letter-spacing: -0.01em;
}

.brand p,
.top-nav .brand p {
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.nav-tabs {
  display: flex;
  gap: 0.25rem;
  width: auto;
  max-width: 100%;
  min-width: 0;
  padding: 0.25rem;
  overflow-x: auto;
  border: 1px solid rgba(16, 23, 34, 0.1);
  border-radius: 14px;
  background: #ece8df;
  box-shadow: inset 0 1px 2px rgba(16, 23, 34, 0.06);
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.nav-tab,
.top-nav .nav-tab {
  flex: 0 0 auto;
  min-width: 6.8rem;
  min-height: 2.35rem;
  padding: 0.45rem 0.9rem;
  color: #344054;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.nav-tab.active,
.nav-tab[aria-selected="true"],
.segment.active {
  color: #fff;
  border-color: rgba(9, 33, 63, 0.88);
  background: var(--navy);
  box-shadow: 0 6px 16px rgba(9, 33, 63, 0.16);
}

.nav-tab:not(.active):hover {
  color: var(--ink);
  background: rgba(255, 253, 250, 0.72);
}

.workspace {
  width: min(1180px, calc(100% - clamp(1.25rem, 5vw, 4rem)));
  margin: 0 auto;
  padding: clamp(1.25rem, 3vw, 2.5rem) 0 4rem;
}

.panel,
.leaderboard-panel,
.leaderboard-detail,
.celebrity-leaderboard-panel,
.analytics-hero,
.entry-card,
.quick-entry-card,
.test-panel,
.plan-card,
.result-panel,
.certificate-style-result,
.insight-mini,
.insight-panel,
.rank-card,
.average-card,
.domain-card {
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 253, 250, 0.94);
  box-shadow: var(--shadow-soft);
  backdrop-filter: none;
}

.leaderboard-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.leaderboard-stage::before {
  display: none;
}

.eyebrow {
  color: var(--gold);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.stage-copy h2,
#viewTitle {
  max-width: 12ch;
  color: var(--ink);
  font-size: clamp(2.45rem, 6vw, 5rem);
  line-height: 0.92;
  letter-spacing: -0.055em;
}

.primary,
.test-header .primary,
.large-action {
  color: #fff;
  border: 1px solid var(--navy);
  border-radius: 12px;
  background: var(--navy);
  box-shadow: 0 12px 28px rgba(9, 33, 63, 0.18);
}

.primary:hover,
.large-action:hover {
  background: var(--navy-2);
}

.large-action {
  min-height: 3rem;
  padding: 0.85rem 1.25rem;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.leaderboard-panel {
  overflow: hidden;
}

.leaderboard-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
}

.leaderboard-head h3,
.celebrity-leaderboard-copy h3,
.analytics-hero h3 {
  color: var(--ink);
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  line-height: 1.08;
  letter-spacing: -0.025em;
}

.leaderboard-description,
.soft-note,
.directory-help {
  max-width: 56rem;
  color: var(--muted);
  line-height: 1.45;
}

.score-chip,
.leaderboard-context span,
.leaderboard-meta-pill,
.analytics-snapshot span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7f3ea;
  color: var(--muted);
  box-shadow: none;
}

.score-chip strong,
.rank-score,
.insight-mini strong,
.domain-card strong,
.rank-card strong,
.average-card strong,
.analytics-snapshot b {
  color: var(--navy);
}

input,
select,
textarea,
.search-select-toggle {
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdfa;
  box-shadow: none;
}

input:focus,
select:focus,
textarea:focus,
.search-select-toggle:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 4px rgba(9, 33, 63, 0.1);
}

.leaderboard-scroll,
.directory-scroll,
.celebrity-leaderboard-scroll {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fffdfa;
}

.leaderboard-columns,
.rank-row {
  display: grid;
  grid-template-columns: 4.4rem minmax(0, 1fr) minmax(6rem, auto);
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(16, 23, 34, 0.08);
}

.leaderboard-columns {
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--muted);
  background: #f4f0e7;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.rank-row:hover {
  background: #faf6ee;
}

.rank-name {
  color: var(--ink);
}

.rank-meta {
  color: var(--muted);
}

.leaderboard-hub {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.1rem 0;
}

.leaderboard-route,
.leaderboard-route:first-child {
  position: relative;
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  grid-template-rows: auto auto 1fr;
  align-items: start;
  gap: 0.5rem 1rem;
  min-height: 12.25rem;
  padding: 1rem;
  overflow: hidden;
  color: var(--ink);
  text-align: left;
  border: 1px solid rgba(16, 23, 34, 0.1);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 253, 250, 0.96), rgba(248, 245, 238, 0.96));
  box-shadow: var(--shadow-soft);
}

.leaderboard-route:first-child {
  grid-column: auto;
}

.leaderboard-route::after {
  position: absolute;
  right: -2.4rem;
  bottom: -2.4rem;
  width: 9rem;
  height: 9rem;
  border: 1px solid rgba(181, 138, 53, 0.16);
  border-radius: 999px;
  content: "";
}

.leaderboard-route:hover,
.leaderboard-route.active {
  transform: translateY(-2px);
  border-color: rgba(181, 138, 53, 0.5);
  background: #fffaf1;
  box-shadow: var(--shadow);
}

.route-visual,
.leaderboard-route:first-child .route-visual {
  grid-row: 1 / 4;
  width: 100%;
  min-height: 10rem;
  overflow: hidden;
  border: 1px solid rgba(16, 23, 34, 0.08);
  border-radius: 15px;
  background-color: #e7edf1;
  background-size: auto, auto, auto;
  filter: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.38);
}

.leaderboard-route span,
.leaderboard-route:first-child span {
  grid-column: 2;
  align-self: start;
  width: fit-content;
  padding: 0.32rem 0.55rem;
  color: var(--navy);
  border: 1px solid rgba(9, 33, 63, 0.16);
  border-radius: 999px;
  background: #edf2f6;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.leaderboard-route strong,
.leaderboard-route:first-child strong {
  grid-column: 2;
  color: var(--ink);
  font-size: clamp(1.25rem, 2.2vw, 1.65rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
}

.leaderboard-route small,
.leaderboard-route:first-child small {
  grid-column: 2;
  max-width: 22rem;
  color: var(--muted);
  font-size: 0.96rem;
  font-weight: 700;
  line-height: 1.35;
}

.visual-world {
  background:
    radial-gradient(circle at 30% 28%, #d5a54a 0 0.5rem, transparent 0.55rem),
    radial-gradient(circle at 62% 46%, #6b7f72 0 0.55rem, transparent 0.6rem),
    radial-gradient(circle at 43% 68%, #09213f 0 0.6rem, transparent 0.65rem),
    linear-gradient(135deg, #eef2f4, #d7e0e7);
}

.visual-country {
  background:
    linear-gradient(90deg, transparent 0 22%, rgba(9,33,63,0.13) 22% 23%, transparent 23% 48%, rgba(181,138,53,0.18) 48% 49%, transparent 49%),
    linear-gradient(0deg, transparent 0 28%, rgba(9,33,63,0.11) 28% 29%, transparent 29% 66%, rgba(181,138,53,0.16) 66% 67%, transparent 67%),
    linear-gradient(135deg, #f4efe5, #dce8ee);
}

.visual-city {
  background:
    linear-gradient(0deg, #09213f 0 18%, transparent 18%),
    repeating-linear-gradient(90deg, rgba(9,33,63,0.72) 0 0.75rem, transparent 0.75rem 1.35rem),
    linear-gradient(135deg, #dde8ed, #f9f3e6);
}

.visual-gender {
  background:
    radial-gradient(circle at 32% 42%, rgba(9,33,63,0.9) 0 1.25rem, transparent 1.3rem),
    radial-gradient(circle at 62% 42%, rgba(181,138,53,0.88) 0 1.25rem, transparent 1.3rem),
    linear-gradient(135deg, #f6efe3, #dfe8f0);
}

.visual-age {
  background:
    repeating-linear-gradient(90deg, rgba(9,33,63,0.7) 0 0.45rem, transparent 0.45rem 1.5rem),
    linear-gradient(135deg, #f5efe4, #dfe8ec);
}

.visual-matrix {
  background:
    linear-gradient(90deg, rgba(9,33,63,0.8) 0 1px, transparent 1px),
    linear-gradient(0deg, rgba(9,33,63,0.8) 0 1px, transparent 1px),
    radial-gradient(circle at 50% 50%, rgba(181,138,53,0.65), transparent 1.25rem),
    #e8edf0;
  background-size: 2rem 2rem, 2rem 2rem, auto, auto;
}

.visual-verbal {
  background:
    repeating-linear-gradient(0deg, rgba(9,33,63,0.64) 0 0.2rem, transparent 0.2rem 1rem),
    linear-gradient(135deg, #f7f1e6, #dce7ee);
}

.visual-comprehensive {
  background:
    conic-gradient(from 0.18turn at 50% 50%, rgba(9,33,63,0.9), rgba(181,138,53,0.8), rgba(97,117,104,0.85), rgba(9,33,63,0.9));
}

.analytics-hero,
.result-reveal-card,
.insight-hero-result.certificate-style-result,
.result-panel,
.certificate-style-result {
  background: rgba(255, 253, 250, 0.96);
}

.progress-track span,
.histogram-bar,
.referral-progress span,
.reveal-curve-fill {
  background: var(--navy);
}

footer,
.site-footer,
.site-footer a,
.privacy-link,
.terms-link {
  color: var(--muted);
}

@media (max-width: 980px) {
  .top-nav {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .nav-tabs {
    width: 100%;
  }

  .leaderboard-stage {
    grid-template-columns: 1fr;
    align-items: start;
  }
}

@media (max-width: 760px) {
  html,
  body {
    background-attachment: scroll;
  }

  .hero-panel {
    padding: 0.5rem;
  }

  .top-nav {
    border-radius: 15px;
  }

  .brand-mark {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 10px;
  }

  .brand h1,
  .top-nav .brand h1 {
    font-size: 1rem;
  }

  .brand p,
  .top-nav .brand p {
    font-size: 0.76rem;
  }

  .nav-tabs {
    display: flex;
    grid-template-columns: none;
  }

  .nav-tab,
  .top-nav .nav-tab {
    min-width: 5.4rem;
    min-height: 2.35rem;
    padding-inline: 0.75rem;
    font-size: 0.84rem;
  }

  .workspace {
    width: calc(100% - 1rem);
    padding-top: 1rem;
  }

  .stage-copy h2,
  #viewTitle {
    max-width: 11ch;
    font-size: clamp(2.2rem, 14vw, 3.25rem);
  }

  .large-action {
    width: 100%;
  }

  .leaderboard-head {
    grid-template-columns: 1fr;
  }

  .leaderboard-hub {
    grid-template-columns: 1fr;
  }

  .leaderboard-route,
  .leaderboard-route:first-child {
    grid-template-columns: 7rem minmax(0, 1fr);
    min-height: 10.5rem;
    padding: 0.75rem;
  }

  .route-visual,
  .leaderboard-route:first-child .route-visual {
    min-height: 8.8rem;
  }

  .leaderboard-route strong,
  .leaderboard-route:first-child strong {
    font-size: 1.25rem;
  }
}

@media (max-width: 460px) {
  .top-nav {
    padding: 0.45rem;
  }

  .nav-tab:last-child {
    grid-column: auto;
  }

  .leaderboard-route,
  .leaderboard-route:first-child {
    grid-template-columns: 1fr;
  }

  .route-visual,
  .leaderboard-route:first-child .route-visual {
    grid-row: auto;
    aspect-ratio: 2.5 / 1;
    min-height: 0;
  }

  .leaderboard-route span,
  .leaderboard-route strong,
  .leaderboard-route small,
  .leaderboard-route:first-child span,
  .leaderboard-route:first-child strong,
  .leaderboard-route:first-child small {
    grid-column: auto;
  }

  .leaderboard-columns,
  .rank-row {
    grid-template-columns: 3rem minmax(0, 1fr) minmax(4.5rem, auto);
    padding: 0.75rem;
  }
}

/* Design System v2: restrained, labelled, responsive interface */
:root {
  --canvas: #f6f5f1;
  --subtle: #eceff3;
  --surface: #fffdf8;
  --surface-elevated: #ffffff;
  --text: #111827;
  --muted: #5f6673;
  --faint: #858c98;
  --border: rgba(17, 24, 39, 0.12);
  --border-strong: rgba(17, 24, 39, 0.22);
  --accent: #0f2f56;
  --accent-hover: #0a2445;
  --accent-soft: #e8eef5;
  --secondary: #8a6428;
  --success: #26734d;
  --warning: #a16207;
  --danger: #b42318;
  --info: #2563a8;
  --focus: #2b6cb0;
  --chart-1: #0f2f56;
  --chart-2: #8a6428;
  --chart-3: #2f6f73;
  --chart-4: #6a5f8f;
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --shadow-soft: 0 1px 2px rgba(17, 24, 39, 0.06), 0 12px 32px rgba(17, 24, 39, 0.08);
  --shadow-raised: 0 16px 40px rgba(17, 24, 39, 0.1);
}

html {
  background: var(--canvas);
}

body {
  min-width: 0;
  color: var(--text);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

:focus-visible {
  outline: 3px solid rgba(43, 108, 176, 0.4);
  outline-offset: 3px;
}

.app-shell {
  width: min(100%, 100vw);
  overflow-x: clip;
}

.hero-panel {
  padding: clamp(0.75rem, 2vw, 1.25rem);
  background: linear-gradient(180deg, #fbfaf6 0%, var(--canvas) 100%);
}

.workspace {
  width: min(1180px, calc(100% - clamp(1rem, 4vw, 3rem)));
  margin-inline: auto;
  padding-block: clamp(1rem, 2vw, 1.75rem) 3rem;
}

.top-nav,
.panel,
.leaderboard-panel,
.leaderboard-detail,
.celebrity-leaderboard-panel,
.analytics-hero,
.entry-card,
.quick-entry-card,
.test-panel,
.plan-card,
.result-panel,
.certificate-style-result,
.insight-mini,
.insight-panel,
.rank-card,
.average-card,
.domain-card {
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: none;
}

.top-nav {
  display: grid;
  grid-template-columns: minmax(15rem, 1fr) minmax(0, auto);
  align-items: center;
  gap: 1rem;
  width: min(1180px, calc(100% - clamp(1rem, 4vw, 3rem)));
  margin-inline: auto;
  padding: 0.75rem;
  border-top: 0;
}

.brand {
  min-width: 0;
}

.brand-mark {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-md);
  color: #fff;
  background: var(--accent);
  box-shadow: none;
}

.brand h1,
.brand p,
.top-nav .brand h1,
.top-nav .brand p {
  color: var(--text);
}

.brand h1 {
  font-size: clamp(1rem, 2vw, 1.15rem);
  line-height: 1.1;
}

.brand p {
  margin-top: 0.15rem;
  color: var(--muted);
}

.nav-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.25rem;
  min-width: 0;
  max-width: 100%;
  padding: 0.25rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--subtle);
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.top-nav .nav-tab,
.nav-tab {
  flex: 0 0 auto;
  min-height: 2.75rem;
  min-width: 5.25rem;
  padding: 0 0.9rem;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: calc(var(--radius-md) - 0.125rem);
  background: transparent;
  box-shadow: none;
  white-space: nowrap;
}

.nav-tab.active,
.nav-tab[aria-selected="true"],
.segment.active,
.primary,
.test-header .primary {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: none;
}

.nav-tab:hover,
.ghost:hover,
.compact-action:hover {
  border-color: var(--border-strong);
  background: #fff;
}

.primary:hover {
  color: #fff;
  background: var(--accent-hover);
}

.ghost,
.secondary,
.compact-action {
  color: var(--accent);
  border: 1px solid var(--border);
  background: var(--surface-elevated);
}

.leaderboard-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

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

.stage-copy h2,
#viewTitle {
  color: var(--text);
  font-size: clamp(1.85rem, 4vw, 3rem);
  line-height: 1;
  letter-spacing: 0;
}

.eyebrow {
  color: var(--secondary);
  letter-spacing: 0.08em;
}

.large-action {
  min-height: 3rem;
  white-space: nowrap;
}

.leaderboard-panel,
.leaderboard-detail,
.celebrity-leaderboard-panel,
.analytics-hero,
.primary-insight-panel {
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
}

.leaderboard-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
}

.leaderboard-head h3,
.celebrity-leaderboard-copy h3,
.analytics-hero h3 {
  color: var(--text);
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  line-height: 1.15;
  letter-spacing: 0;
}

.leaderboard-description,
.soft-note,
.directory-help {
  max-width: 54rem;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.45;
}

.score-chip,
.analytics-snapshot span,
.leaderboard-meta-pill {
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  box-shadow: none;
}

.score-chip strong,
.rank-score,
.insight-mini strong,
.domain-card strong,
.rank-card strong,
.average-card strong,
.analytics-snapshot b {
  color: var(--accent);
}

.filter-grid,
.directory-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.75rem;
  align-items: end;
}

.filter-grid label,
.directory-controls label,
.entry-form label,
.payment-panel label {
  color: var(--muted);
}

input,
select,
textarea,
.search-select-toggle {
  min-height: 2.75rem;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  box-shadow: none;
}

input:focus,
select:focus,
textarea:focus,
.search-select-toggle:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.16);
}

.leaderboard-context {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
  padding: 0;
  background: transparent;
  border: 0;
}

.leaderboard-context span,
.leaderboard-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.25rem;
  padding: 0.45rem 0.65rem;
  font-size: 0.86rem;
  line-height: 1.2;
}

.leaderboard-context b,
.leaderboard-meta-pill b {
  color: var(--text);
  font-weight: 800;
}

.leaderboard-scroll,
.directory-scroll,
.celebrity-leaderboard-scroll {
  width: 100%;
  max-width: 100%;
  max-height: min(68vh, 46rem);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-elevated);
}

.celebrity-leaderboard-scroll {
  max-height: 24rem;
}

.leaderboard-scroll .leaderboard,
.celebrity-leaderboard-scroll .leaderboard {
  display: grid;
  gap: 0;
  padding: 0;
}

.leaderboard-columns,
.rank-row {
  display: grid;
  grid-template-columns: 4.75rem minmax(0, 1fr) minmax(6.5rem, auto);
  gap: 0.75rem;
  align-items: center;
  min-width: 0;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  background: transparent;
}

.leaderboard-columns {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 2.7rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: #f7f7f3;
}

.rank-row:last-child {
  border-bottom: 0;
}

.rank-row:hover {
  background: #faf8f2;
}

.rank,
.rank-name,
.rank-meta,
.rank-score {
  min-width: 0;
}

.rank {
  color: var(--muted);
  font-weight: 800;
}

.rank-name {
  overflow: hidden;
  color: var(--text);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-meta {
  margin-top: 0.2rem;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-score {
  justify-self: end;
  font-size: 1rem;
  font-weight: 900;
  white-space: nowrap;
}

.my-rank {
  background: #f4efe2;
}

.leaderboard-pagination {
  border-top: 1px solid var(--border);
  background: #f7f7f3;
}

.leaderboard-hub {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.leaderboard-route,
.leaderboard-route:first-child {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  grid-auto-rows: auto;
  gap: 0.35rem 1rem;
  min-height: 10rem;
  padding: 1rem;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.leaderboard-route:first-child {
  grid-column: auto;
}

.leaderboard-route:hover,
.leaderboard-route.active {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: #fffaf0;
  box-shadow: var(--shadow-raised);
}

.route-visual,
.leaderboard-route:first-child .route-visual {
  grid-row: span 3;
  width: 100%;
  min-height: 7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  filter: saturate(0.85) contrast(0.95);
  box-shadow: none;
}

.leaderboard-route span,
.leaderboard-route:first-child span {
  align-self: end;
  width: fit-content;
  color: var(--secondary);
  border: 1px solid rgba(138, 100, 40, 0.2);
  border-radius: var(--radius-sm);
  background: #fbf2dc;
}

.leaderboard-route strong,
.leaderboard-route:first-child strong {
  color: var(--text);
  font-size: 1.15rem;
  line-height: 1.1;
}

.leaderboard-route small,
.leaderboard-route:first-child small {
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.35;
}

#leaderboardsView.directory-focused .leaderboard-hub,
#leaderboardsView.directory-focused .celebrity-leaderboard-panel {
  display: none;
}

#leaderboardsView:not(.directory-focused) .leaderboard-detail {
  display: none;
}

.directory-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.directory-back {
  min-height: 2.75rem;
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 800;
}

.analytics-hero,
.result-reveal-card,
.insight-hero-result.certificate-style-result,
.result-panel,
.certificate-style-result {
  background: var(--surface);
}

.analytics-snapshot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.result-ring,
.insight-hero-result.certificate-style-result .result-ring,
.reveal-score-stage {
  background:
    radial-gradient(circle, var(--surface-elevated) 0 58%, transparent 59%),
    conic-gradient(from -90deg, var(--accent) 0 var(--reveal-progress, var(--iq-progress, 0deg)), rgba(17, 24, 39, 0.12) var(--reveal-progress, var(--iq-progress, 0deg)) 360deg);
}

.progress-track span,
.histogram-bar,
.referral-progress span,
.reveal-curve-fill {
  background: var(--accent);
}

.plan-upsell,
.share-reward-card,
.reveal-free-retake,
.earn-hero-card {
  border-left: 3px solid var(--secondary);
  border-color: rgba(138, 100, 40, 0.26);
  background: #fff8e8;
}

.visual-world,
.visual-country,
.visual-city,
.visual-gender,
.visual-age,
.visual-matrix,
.visual-verbal,
.visual-comprehensive {
  background-color: var(--accent-soft);
}

footer,
.site-footer,
.privacy-link,
.terms-link {
  color: var(--muted);
}

@media (max-width: 1040px) {
  .top-nav {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .nav-tabs {
    width: 100%;
  }

  .leaderboard-stage {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .large-action {
    width: fit-content;
  }
}

@media (max-width: 760px) {
  .workspace,
  .top-nav {
    width: min(100% - 1rem, 1180px);
  }

  .hero-panel {
    padding: 0.5rem;
  }

  .top-nav {
    padding: 0.6rem;
  }

  .brand-mark {
    width: 2.4rem;
    height: 2.4rem;
  }

  .nav-tabs {
    margin: 0;
  }

  .nav-tab,
  .top-nav .nav-tab {
    min-width: 4.8rem;
    padding-inline: 0.75rem;
  }

  .leaderboard-head {
    grid-template-columns: 1fr;
  }

  .score-chip,
  .directory-actions {
    justify-self: start;
  }

  .filter-grid,
  .directory-controls {
    grid-template-columns: 1fr;
  }

  .leaderboard-hub {
    grid-template-columns: 1fr;
  }

  .leaderboard-route,
  .leaderboard-route:first-child {
    grid-template-columns: 6rem minmax(0, 1fr);
    min-height: 8.5rem;
  }

  .route-visual,
  .leaderboard-route:first-child .route-visual {
    min-height: 6rem;
  }
}

@media (max-width: 520px) {
  .stage-copy h2,
  #viewTitle {
    font-size: 1.75rem;
  }

  .large-action {
    width: 100%;
  }

  .nav-tab:last-child {
    grid-column: auto;
  }

  .leaderboard-columns,
  .rank-row {
    grid-template-columns: 3.25rem minmax(0, 1fr) minmax(4.7rem, auto);
    gap: 0.5rem;
    padding: 0.75rem;
  }

  .leaderboard-columns {
    font-size: 0.64rem;
  }

  .rank-meta {
    white-space: normal;
  }

  .leaderboard-route,
  .leaderboard-route:first-child {
    grid-template-columns: 1fr;
  }

  .route-visual,
  .leaderboard-route:first-child .route-visual {
    grid-row: auto;
    aspect-ratio: 2.7 / 1;
  }

  .leaderboard-context span,
  .leaderboard-meta-pill {
    width: 100%;
    justify-content: space-between;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}

/* Final v2 sizing override. Keep the runner stable after all theme overrides. */
.question-runner {
  width: min(58rem, 100%) !important;
  min-height: 0 !important;
  height: min(48rem, calc(100svh - 8rem)) !important;
  overflow: hidden !important;
}

.question-runner .question,
.question-runner .text-question {
  grid-template-rows: minmax(5.4rem, auto) minmax(12rem, 18rem) minmax(12rem, 1fr) !important;
  overflow: hidden !important;
}

.question-visual {
  min-height: 12rem !important;
  max-height: 18rem !important;
  overflow: auto !important;
}

.question-runner .options,
.question-runner .text-options {
  min-height: 0 !important;
  max-height: 100% !important;
  overflow: auto !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  align-content: start !important;
}

.question-runner .option-shape,
.text-option .option-shape {
  min-height: 5.6rem !important;
  max-height: 8.5rem !important;
  overflow: auto !important;
}

@media (max-width: 760px) {
  .question-runner {
    height: min(42rem, calc(100svh - 5rem)) !important;
    padding: 0.85rem !important;
  }

  .question-runner .question,
  .question-runner .text-question {
    grid-template-rows: minmax(5.8rem, auto) minmax(10rem, 14rem) minmax(12rem, 1fr) !important;
  }

  .question-visual {
    min-height: 10rem !important;
    max-height: 14rem !important;
  }

  .question-runner .options,
  .question-runner .text-options {
    grid-template-columns: 1fr !important;
  }

  .question-runner .option-shape,
  .text-option .option-shape {
    min-height: 4.8rem !important;
    max-height: 6.8rem !important;
  }
}

.nav-tabs {
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
  flex: 1 1 22rem;
}

.brand {
  flex: 0 0 auto;
}

.account-status-pill {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.55rem;
  align-items: center;
  justify-self: end;
  min-width: min(16rem, 100%);
  flex: 0 1 17rem;
  padding: 0.62rem 0.78rem;
  border: 1px solid rgba(7, 26, 53, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  color: #071a35;
  text-align: left;
  box-shadow: 0 12px 30px rgba(7, 26, 53, 0.1);
  cursor: pointer;
}

.account-status-pill strong,
.account-status-pill small {
  display: block;
  max-width: 13rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-status-pill strong {
  font-size: 0.84rem;
  font-weight: 950;
}

.account-status-pill small {
  margin-top: 0.08rem;
  color: #526477;
  font-weight: 800;
}

.account-status-dot {
  width: 0.68rem;
  height: 0.68rem;
  border-radius: 999px;
  background: #9ca3af;
  box-shadow: 0 0 0 4px rgba(156, 163, 175, 0.18);
}

.account-status-pill.signed-in .account-status-dot {
  background: #0f766e;
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.16);
}

.account-status-pill.profile-needed .account-status-dot {
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(211, 154, 22, 0.18);
}

.account-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.4rem;
  align-items: end;
  width: min(78rem, calc(100vw - 2rem));
  margin-inline: auto;
  border-left: 7px solid #173f8a;
  background:
    radial-gradient(circle at 88% 18%, rgba(211, 154, 22, 0.14), transparent 30%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(239, 245, 255, 0.9));
}

.account-hero h2 {
  max-width: 44rem;
  color: #071a35;
  font-size: clamp(2rem, 4vw, 4.2rem);
}

.account-hero p:not(.eyebrow) {
  max-width: 42rem;
  margin-top: 0.7rem;
  color: #44566c;
  font-weight: 800;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 21rem), 1fr));
  gap: 1rem;
  width: min(78rem, calc(100vw - 2rem));
  margin: 1rem auto 0;
}

.account-form,
.account-auth-card,
.account-dashboard {
  display: grid;
  gap: 0.95rem;
  align-content: start;
}

.account-form label,
.account-auth-card label {
  display: grid;
  gap: 0.38rem;
  color: #071a35;
  font-weight: 900;
}

.account-form input,
.account-form select,
.account-auth-card input,
.account-referral-link-row input {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  color: #071a35;
  font-weight: 850;
}

.account-form input.locked-field,
.account-auth-card input.locked-field {
  color: #536273;
  background:
    linear-gradient(135deg, rgba(241, 245, 249, 0.98), rgba(255, 255, 255, 0.92));
  border-style: dashed;
  cursor: not-allowed;
}

.social-login-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.social-login-row button {
  min-height: 3rem;
  width: 100%;
}

.account-auth-card {
  border-color: rgba(23, 63, 138, 0.16);
  background:
    radial-gradient(circle at 88% 16%, rgba(211, 154, 22, 0.1), transparent 30%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(244, 248, 255, 0.92));
}

.account-auth-card h3,
.account-form h3 {
  color: #071a35;
  font-size: 1.35rem;
}

.account-dashboard {
  border-color: rgba(23, 63, 138, 0.2);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(244, 248, 255, 0.92)),
    linear-gradient(90deg, rgba(23, 63, 138, 0.1), transparent);
}

.account-dashboard h3 {
  color: #071a35;
  font-size: 1.45rem;
}

.account-dashboard p {
  color: #526477;
  font-weight: 800;
}

.account-code-card {
  display: grid;
  gap: 0.35rem;
  padding: 1.05rem;
  border: 1px solid rgba(211, 154, 22, 0.34);
  border-left: 7px solid var(--gold);
  border-radius: 8px;
  background:
    radial-gradient(circle at 92% 18%, rgba(211, 154, 22, 0.18), transparent 34%),
    linear-gradient(135deg, rgba(255, 251, 235, 0.98), rgba(255, 255, 255, 0.95));
}

.account-code-card span,
.account-code-card small {
  color: #5f6672;
  font-weight: 850;
}

.account-code-card strong {
  color: #071a35;
  font-size: clamp(1.6rem, 3vw, 2.6rem);
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.account-referral-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.6rem;
  align-items: center;
}

.account-form-signed-in {
  border-color: rgba(23, 63, 138, 0.18);
}

@media (max-width: 860px) {
  .account-hero,
  .account-grid {
    grid-template-columns: 1fr;
  }

  .account-hero {
    align-items: start;
  }

  .account-status-pill {
    width: 100%;
    justify-self: stretch;
  }
}

@media (max-width: 560px) {
  .social-login-row,
  .referral-ledger {
    grid-template-columns: 1fr;
  }

  .account-hero,
  .account-grid {
    width: min(100% - 1rem, 78rem);
  }

  .account-referral-link-row {
    grid-template-columns: 1fr;
  }
}

/* Final responsive overlap guardrails */
html,
body {
  max-width: 100%;
  overflow-x: clip;
}

@media (max-width: 1180px) {
  .top-nav {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 0.85rem !important;
  }

  .nav-tabs {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    width: 100% !important;
  }

  .leaderboard-hub {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .leaderboard-route:first-child {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: auto auto auto auto !important;
    min-height: 0 !important;
  }

  .leaderboard-route:first-child .route-visual,
  .leaderboard-route:first-child span,
  .leaderboard-route:first-child strong,
  .leaderboard-route:first-child small {
    grid-column: auto !important;
    grid-row: auto !important;
  }

  .celebrity-leaderboard-panel,
  .analytics-hero,
  .earn-hero {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

@media (max-width: 980px) {
  .leaderboard-stage {
    display: grid !important;
    grid-template-columns: 1fr !important;
    align-items: stretch !important;
  }

  .leaderboard-hub,
  .plan-cards,
  .test-entry-grid,
  .analytics-grid,
  .earn-grid,
  .earn-steps,
  .metric-grid,
  .domain-grid,
  .rank-summary-grid,
  .average-grid {
    grid-template-columns: 1fr !important;
  }

  .leaderboard-route,
  .leaderboard-route:first-child {
    grid-column: auto !important;
    grid-template-columns: 1fr !important;
    grid-template-rows: auto auto auto auto !important;
    min-height: 0 !important;
  }

  .large-action {
    width: 100% !important;
  }
}

img,
svg,
canvas {
  max-width: 100%;
}

.app-shell,
.hero-panel,
.top-nav,
.workspace,
.view,
.panel,
.leaderboard-stage,
.leaderboard-panel,
.leaderboard-detail,
.leaderboard-hub,
.leaderboard-route,
.route-visual,
.analytics-hero,
.earn-hero,
.celebrity-leaderboard-panel,
.test-panel,
.entry-card,
.plan-card {
  min-width: 0;
}

.route-visual {
  aspect-ratio: 16 / 9;
  min-height: clamp(8.5rem, 18vw, 12rem);
}

.leaderboard-route:first-child .route-visual {
  min-height: clamp(9.5rem, 20vw, 15rem);
}

.leaderboard-route strong,
.stage-copy h2,
.analytics-hero h3,
.earn-hero h2 {
  overflow-wrap: anywhere;
}

@media (max-width: 1180px) {
  .top-nav {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .nav-tabs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    width: 100%;
  }

  .nav-tab {
    min-width: 0;
    white-space: normal;
  }

  .leaderboard-stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(12rem, auto);
    align-items: end;
  }

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

  .leaderboard-route:first-child {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
    align-items: stretch;
    min-height: 0;
  }

  .leaderboard-route:first-child .route-visual,
  .leaderboard-route:first-child span,
  .leaderboard-route:first-child strong,
  .leaderboard-route:first-child small {
    grid-column: auto;
    grid-row: auto;
  }

  .celebrity-leaderboard-panel,
  .analytics-hero,
  .earn-hero {
    grid-template-columns: minmax(0, 1fr);
  }

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

@media (max-width: 980px) {
  .leaderboard-stage {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .large-action {
    width: 100%;
  }

  .leaderboard-hub,
  .plan-cards,
  .test-entry-grid,
  .analytics-grid,
  .earn-grid,
  .earn-steps,
  .metric-grid,
  .domain-grid,
  .rank-summary-grid,
  .average-grid {
    grid-template-columns: 1fr;
  }

  .leaderboard-route,
  .leaderboard-route:first-child {
    grid-column: auto;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
    min-height: 0;
  }

  .leaderboard-route {
    padding: 0.85rem;
  }

  .route-visual,
  .leaderboard-route:first-child .route-visual {
    min-height: clamp(8.5rem, 30vw, 13rem);
  }

  .feature-compare,
  .leaderboard-scroll,
  .celebrity-leaderboard-scroll {
    max-width: 100%;
  }
}

@media (max-width: 700px) {
  .hero-panel {
    padding-inline: 0.75rem;
  }

  .workspace {
    padding-inline: 0.75rem;
  }

  .nav-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .filter-grid,
  .directory-controls {
    grid-template-columns: 1fr;
  }

  .leaderboard-route {
    gap: 0.55rem;
  }

  .route-visual,
  .leaderboard-route:first-child .route-visual {
    min-height: 8.5rem;
  }

  .leaderboard-detail,
  .analytics-hero,
  .earn-hero,
  .celebrity-leaderboard-panel {
    padding: 1rem;
  }
}

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

  .nav-tab:last-child {
    grid-column: auto;
  }

  .rank-row {
    grid-template-columns: 2.35rem minmax(0, 1fr) 3.2rem;
  }

  .share-copy-panel,
  .reveal-free-retake {
    grid-template-columns: 1fr;
  }
}

/* Responsive overlap guardrails */
html,
body {
  max-width: 100%;
  overflow-x: clip;
}

img,
svg,
canvas {
  max-width: 100%;
}

.app-shell,
.hero-panel,
.top-nav,
.workspace,
.view,
.panel,
.leaderboard-stage,
.leaderboard-panel,
.leaderboard-detail,
.leaderboard-hub,
.leaderboard-route,
.route-visual,
.analytics-hero,
.earn-hero,
.celebrity-leaderboard-panel,
.test-panel,
.entry-card,
.plan-card {
  min-width: 0;
}

.route-visual {
  aspect-ratio: 16 / 9;
  min-height: clamp(8.5rem, 18vw, 12rem);
}

.leaderboard-route:first-child .route-visual {
  min-height: clamp(9.5rem, 20vw, 15rem);
}

.leaderboard-route strong,
.stage-copy h2,
.analytics-hero h3,
.earn-hero h2 {
  overflow-wrap: anywhere;
}

@media (max-width: 1180px) {
  .top-nav {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .nav-tabs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    width: 100%;
  }

  .nav-tab {
    min-width: 0;
    white-space: normal;
  }

  .leaderboard-stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(12rem, auto);
    align-items: end;
  }

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

  .leaderboard-route:first-child {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
    align-items: stretch;
    min-height: 0;
  }

  .leaderboard-route:first-child .route-visual,
  .leaderboard-route:first-child span,
  .leaderboard-route:first-child strong,
  .leaderboard-route:first-child small {
    grid-column: auto;
    grid-row: auto;
  }

  .celebrity-leaderboard-panel,
  .analytics-hero,
  .earn-hero {
    grid-template-columns: minmax(0, 1fr);
  }

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

@media (max-width: 980px) {
  .leaderboard-stage {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .large-action {
    width: 100%;
  }

  .leaderboard-hub,
  .plan-cards,
  .test-entry-grid,
  .analytics-grid,
  .earn-grid,
  .earn-steps,
  .metric-grid,
  .domain-grid,
  .rank-summary-grid,
  .average-grid {
    grid-template-columns: 1fr;
  }

  .leaderboard-route,
  .leaderboard-route:first-child {
    grid-column: auto;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
    min-height: 0;
  }

  .leaderboard-route {
    padding: 0.85rem;
  }

  .route-visual,
  .leaderboard-route:first-child .route-visual {
    min-height: clamp(8.5rem, 30vw, 13rem);
  }

  .feature-compare,
  .leaderboard-scroll,
  .celebrity-leaderboard-scroll {
    max-width: 100%;
  }
}

@media (max-width: 700px) {
  .hero-panel {
    padding-inline: 0.75rem;
  }

  .workspace {
    padding-inline: 0.75rem;
  }

  .nav-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .filter-grid,
  .directory-controls {
    grid-template-columns: 1fr;
  }

  .leaderboard-route {
    gap: 0.55rem;
  }

  .route-visual,
  .leaderboard-route:first-child .route-visual {
    min-height: 8.5rem;
  }

  .leaderboard-detail,
  .analytics-hero,
  .earn-hero,
  .celebrity-leaderboard-panel {
    padding: 1rem;
  }
}

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

  .nav-tab:last-child {
    grid-column: auto;
  }

  .rank-row {
    grid-template-columns: 2.35rem minmax(0, 1fr) 3.2rem;
  }

  .share-copy-panel,
  .reveal-free-retake {
    grid-template-columns: 1fr;
  }
}

/* Navy porcelain dominant image pass */
:root {
  --ink: #071a35;
  --muted: #566579;
  --line: rgba(7, 26, 53, 0.14);
  --paper: #f6f9ff;
  --panel: rgba(248, 251, 255, 0.91);
  --blue: #173f8a;
  --blue-dark: #071a35;
  --teal: #1d4ed8;
  --gold: #b98b2d;
  --accent-ink: #071a35;
  --accent-forest: #173f8a;
  --accent-forest-soft: rgba(23, 63, 138, 0.1);
  --shadow: 0 24px 72px rgba(7, 26, 53, 0.15);
}

body {
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(246, 249, 255, 0.82), rgba(234, 241, 252, 0.72) 44%, rgba(248, 251, 255, 0.84)),
    url("assets/iqrank-background.png") center top / cover fixed;
}

.top-nav,
.panel,
.leaderboard-panel,
.analytics-hero,
.entry-card,
.quick-entry-card,
.test-panel,
.leaderboard-detail {
  border-color: var(--line);
  background:
    linear-gradient(180deg, rgba(248, 251, 255, 0.94), rgba(242, 247, 255, 0.88));
  box-shadow: var(--shadow);
}

.top-nav {
  border-top-color: rgba(7, 26, 53, 0.72);
}

.brand-mark,
.primary,
.test-header .primary,
.nav-tab.active,
.segment.active {
  color: #fff;
  background: linear-gradient(135deg, #071a35 0%, #173f8a 58%, #1d4ed8 100%);
}

.primary:hover {
  background: linear-gradient(135deg, #06142a 0%, #12336f 58%, #173f8a 100%);
}

.brand h1,
.brand p,
.top-nav .brand h1,
.top-nav .brand p,
.top-nav .nav-tab,
.leaderboard-route strong,
.rank-name,
.score-chip strong,
.plan-card .plan-label,
.plan-card strong {
  color: var(--accent-ink);
}

.nav-tabs,
.segmented,
.plan-toggle {
  border-color: rgba(7, 26, 53, 0.12);
  background: rgba(232, 239, 251, 0.88);
}

.plan-upsell,
.share-reward-card,
.reveal-free-retake,
.earn-hero-card {
  border-color: rgba(23, 63, 138, 0.22);
  border-left-color: #173f8a;
  background:
    linear-gradient(135deg, rgba(248, 251, 255, 0.96), rgba(255, 255, 255, 0.9) 52%, rgba(218, 228, 246, 0.8));
}

.leaderboard-route {
  border-color: rgba(7, 26, 53, 0.12);
  background: linear-gradient(180deg, rgba(248, 251, 255, 0.96), rgba(241, 246, 255, 0.9));
}

.leaderboard-route span,
.plan-card em {
  color: #173f8a;
  background: rgba(23, 63, 138, 0.1);
}

.leaderboard-route small {
  color: #506174;
}

.leaderboard-route:hover,
.leaderboard-route.active,
.plan-card.active {
  border-color: rgba(23, 63, 138, 0.42);
  box-shadow: 0 20px 52px rgba(7, 26, 53, 0.14);
}

.rank-score,
.insight-mini strong,
.domain-card strong,
.rank-card strong,
.average-card strong,
.analytics-snapshot b {
  color: #173f8a;
}

.progress-track span,
.histogram-bar,
.referral-progress span,
.reveal-curve-fill {
  background: linear-gradient(90deg, #071a35, #173f8a, #1d4ed8);
}

.analytics-hero,
.primary-insight-panel,
.celebrity-leaderboard-panel,
.earn-hero,
.leaderboard-detail {
  border-left-color: #173f8a;
  border-top-color: rgba(7, 26, 53, 0.16);
}

.result-reveal-card,
.insight-hero-result.certificate-style-result {
  background:
    radial-gradient(circle at 88% 12%, rgba(29, 78, 216, 0.12), transparent 28%),
    linear-gradient(135deg, #ffffff, #f6f9ff 56%, #eaf1fc);
}

.result-reveal {
  background:
    linear-gradient(135deg, rgba(7, 26, 53, 0.58), rgba(23, 63, 138, 0.28)),
    rgba(7, 26, 53, 0.36);
}

.reveal-score-stage,
.insight-hero-result.certificate-style-result .result-ring {
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.98) 0 58%, transparent 59%),
    conic-gradient(from -90deg, #173f8a 0 var(--reveal-progress, var(--iq-progress, 0deg)), rgba(7, 26, 53, 0.12) var(--reveal-progress, var(--iq-progress, 0deg)) 360deg);
}

/* Navy porcelain final pass */
:root {
  --ink: #071a35;
  --muted: #566579;
  --line: rgba(7, 26, 53, 0.14);
  --paper: #f6f9ff;
  --panel: rgba(248, 251, 255, 0.91);
  --blue: #173f8a;
  --blue-dark: #071a35;
  --teal: #1d4ed8;
  --gold: #b98b2d;
  --accent-ink: #071a35;
  --accent-forest: #173f8a;
  --accent-forest-soft: rgba(23, 63, 138, 0.1);
  --shadow: 0 24px 72px rgba(7, 26, 53, 0.15);
}

body {
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(246, 249, 255, 0.82), rgba(234, 241, 252, 0.72) 44%, rgba(248, 251, 255, 0.84)),
    url("assets/iqrank-background.png") center top / cover fixed;
}

.top-nav,
.panel,
.leaderboard-panel,
.analytics-hero,
.entry-card,
.quick-entry-card,
.test-panel,
.leaderboard-detail {
  border-color: var(--line);
  background:
    linear-gradient(180deg, rgba(248, 251, 255, 0.94), rgba(242, 247, 255, 0.88));
  box-shadow: var(--shadow);
}

.top-nav {
  border-top-color: rgba(7, 26, 53, 0.72);
}

.brand-mark,
.primary,
.test-header .primary,
.nav-tab.active,
.segment.active {
  color: #fff;
  background: linear-gradient(135deg, #071a35 0%, #173f8a 58%, #1d4ed8 100%);
}

.primary:hover {
  background: linear-gradient(135deg, #06142a 0%, #12336f 58%, #173f8a 100%);
}

.brand h1,
.brand p,
.top-nav .brand h1,
.top-nav .brand p,
.top-nav .nav-tab,
.leaderboard-route strong,
.rank-name,
.score-chip strong,
.plan-card .plan-label,
.plan-card strong {
  color: var(--accent-ink);
}

.nav-tabs,
.segmented,
.plan-toggle {
  border-color: rgba(7, 26, 53, 0.12);
  background: rgba(232, 239, 251, 0.88);
}

.plan-upsell,
.share-reward-card,
.reveal-free-retake,
.earn-hero-card {
  border-color: rgba(23, 63, 138, 0.22);
  border-left-color: #173f8a;
  background:
    linear-gradient(135deg, rgba(248, 251, 255, 0.96), rgba(255, 255, 255, 0.9) 52%, rgba(218, 228, 246, 0.8));
}

.leaderboard-route {
  border-color: rgba(7, 26, 53, 0.12);
  background: linear-gradient(180deg, rgba(248, 251, 255, 0.96), rgba(241, 246, 255, 0.9));
}

.leaderboard-route span,
.plan-card em {
  color: #173f8a;
  background: rgba(23, 63, 138, 0.1);
}

.leaderboard-route small {
  color: #506174;
}

.leaderboard-route:hover,
.leaderboard-route.active,
.plan-card.active {
  border-color: rgba(23, 63, 138, 0.42);
  box-shadow: 0 20px 52px rgba(7, 26, 53, 0.14);
}

.rank-score,
.insight-mini strong,
.domain-card strong,
.rank-card strong,
.average-card strong,
.analytics-snapshot b {
  color: #173f8a;
}

.progress-track span,
.histogram-bar,
.referral-progress span,
.reveal-curve-fill {
  background: linear-gradient(90deg, #071a35, #173f8a, #1d4ed8);
}

.analytics-hero,
.primary-insight-panel,
.celebrity-leaderboard-panel,
.earn-hero,
.leaderboard-detail {
  border-left-color: #173f8a;
  border-top-color: rgba(7, 26, 53, 0.16);
}

.result-reveal-card,
.insight-hero-result.certificate-style-result {
  background:
    radial-gradient(circle at 88% 12%, rgba(29, 78, 216, 0.12), transparent 28%),
    linear-gradient(135deg, #ffffff, #f6f9ff 56%, #eaf1fc);
}

.result-reveal {
  background:
    linear-gradient(135deg, rgba(7, 26, 53, 0.58), rgba(23, 63, 138, 0.28)),
    rgba(7, 26, 53, 0.36);
}

.reveal-score-stage,
.insight-hero-result.certificate-style-result .result-ring {
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.98) 0 58%, transparent 59%),
    conic-gradient(from -90deg, #173f8a 0 var(--reveal-progress, var(--iq-progress, 0deg)), rgba(7, 26, 53, 0.12) var(--reveal-progress, var(--iq-progress, 0deg)) 360deg);
}

/* Absolute final palette override */
:root {
  --ink: #071a35;
  --muted: #586272;
  --line: rgba(7, 26, 53, 0.14);
  --blue: #173f8a;
  --blue-dark: #071a35;
  --teal: #1d4ed8;
  --gold: #b98b2d;
  --accent-ink: #071a35;
  --accent-forest: #173f8a;
  --accent-forest-soft: rgba(23, 63, 138, 0.1);
  --shadow: 0 24px 72px rgba(7, 26, 53, 0.15);
}

body {
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(246, 249, 255, 0.82), rgba(234, 241, 252, 0.72) 44%, rgba(248, 251, 255, 0.84)),
    url("assets/iqrank-background.png") center top / cover fixed;
}

.top-nav,
.panel,
.leaderboard-panel,
.analytics-hero,
.entry-card,
.quick-entry-card,
.test-panel,
.leaderboard-detail {
  border-color: var(--line);
  background: linear-gradient(180deg, rgba(248, 251, 255, 0.94), rgba(242, 247, 255, 0.88));
  box-shadow: var(--shadow);
}

.top-nav {
  border-top: 4px solid rgba(7, 26, 53, 0.72);
}

.brand-mark,
.primary,
.test-header .primary,
.nav-tab.active,
.segment.active {
  color: #fff;
  background: linear-gradient(135deg, #071a35 0%, #173f8a 58%, #1d4ed8 100%);
}

.brand h1,
.brand p,
.top-nav .brand h1,
.top-nav .brand p,
.top-nav .nav-tab,
.leaderboard-route strong,
.rank-name,
.score-chip strong,
.plan-card .plan-label,
.plan-card strong {
  color: var(--accent-ink);
}

.nav-tabs,
.segmented,
.plan-toggle {
  border-color: rgba(15, 23, 42, 0.1);
  background: rgba(232, 239, 251, 0.88);
}

.primary:hover {
  background: linear-gradient(135deg, #06142a 0%, #12336f 58%, #173f8a 100%);
}

.plan-upsell,
.share-reward-card,
.reveal-free-retake,
.earn-hero-card {
  border-color: rgba(211, 154, 22, 0.34);
  border-left-color: var(--gold);
  background: linear-gradient(135deg, rgba(255, 250, 235, 0.98), rgba(255, 255, 255, 0.94) 54%, rgba(15, 118, 110, 0.08));
}

.leaderboard-route {
  border-color: rgba(15, 23, 42, 0.1);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.92));
}

.leaderboard-route span,
.plan-card em {
  color: #173f8a;
  background: rgba(23, 63, 138, 0.1);
}

.leaderboard-route small {
  color: #506174;
}

.leaderboard-route:hover,
.leaderboard-route.active,
.plan-card.active {
  border-color: rgba(29, 78, 216, 0.38);
  box-shadow: 0 20px 52px rgba(29, 78, 216, 0.13);
}

.rank-score,
.insight-mini strong,
.domain-card strong,
.rank-card strong,
.average-card strong,
.analytics-snapshot b {
  color: var(--teal);
}

.progress-track span,
.histogram-bar,
.referral-progress span,
.reveal-curve-fill {
  background: linear-gradient(90deg, #071a35, #173f8a, #1d4ed8);
}

.analytics-hero,
.primary-insight-panel,
.celebrity-leaderboard-panel,
.earn-hero,
.leaderboard-detail {
  border-left-color: #173f8a;
  border-top-color: rgba(29, 78, 216, 0.18);
}

.result-reveal-card,
.insight-hero-result.certificate-style-result {
  background:
    radial-gradient(circle at 88% 12%, rgba(211, 154, 22, 0.16), transparent 28%),
    linear-gradient(135deg, #ffffff, #f8faf7 58%, #ecf7f5);
}

.result-reveal {
  background:
    linear-gradient(135deg, rgba(11, 18, 32, 0.52), rgba(15, 118, 110, 0.22)),
    rgba(11, 18, 32, 0.36);
}

.reveal-score-stage,
.insight-hero-result.certificate-style-result .result-ring {
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.98) 0 58%, transparent 59%),
    conic-gradient(from -90deg, #1d4ed8 0 var(--reveal-progress, var(--iq-progress, 0deg)), rgba(15, 23, 42, 0.12) var(--reveal-progress, var(--iq-progress, 0deg)) 360deg);
}

/* Final launch palette override */
:root {
  --ink: #071a35;
  --muted: #586272;
  --line: rgba(7, 26, 53, 0.14);
  --paper: #f8faf7;
  --panel: rgba(255, 255, 255, 0.94);
  --blue: #173f8a;
  --blue-dark: #071a35;
  --teal: #1d4ed8;
  --amber: #d39a16;
  --gold: #b98b2d;
  --accent-ink: #071a35;
  --accent-forest: #173f8a;
  --accent-forest-soft: rgba(23, 63, 138, 0.1);
  --shadow: 0 24px 72px rgba(7, 26, 53, 0.15);
}

body {
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(246, 249, 255, 0.82), rgba(234, 241, 252, 0.72) 44%, rgba(248, 251, 255, 0.84)),
    url("assets/iqrank-background.png") center top / cover fixed;
}

.top-nav,
.panel,
.leaderboard-panel,
.analytics-hero,
.entry-card,
.quick-entry-card,
.test-panel,
.leaderboard-detail {
  border-color: var(--line);
  background: linear-gradient(180deg, rgba(248, 251, 255, 0.94), rgba(242, 247, 255, 0.88));
  box-shadow: var(--shadow);
}

.top-nav {
  border-top: 4px solid rgba(7, 26, 53, 0.72);
}

.brand-mark {
  color: #fff;
  background: linear-gradient(135deg, #102a56, #1d4ed8 52%, #0f766e);
  box-shadow: 0 14px 30px rgba(29, 78, 216, 0.2);
}

.brand h1,
.brand p,
.top-nav .brand h1,
.top-nav .brand p,
.top-nav .nav-tab {
  color: var(--accent-ink);
}

.nav-tabs,
.segmented,
.plan-toggle {
  border-color: rgba(15, 23, 42, 0.1);
  background: rgba(232, 239, 251, 0.88);
}

.nav-tab.active,
.segment.active {
  color: #fff;
  background: linear-gradient(135deg, #102a56, #1d4ed8);
  border-color: rgba(29, 78, 216, 0.28);
  box-shadow: 0 12px 28px rgba(29, 78, 216, 0.18);
}

.primary,
.test-header .primary {
  color: #fff;
  background: linear-gradient(135deg, #102a56 0%, #1d4ed8 50%, #0f766e 100%);
  box-shadow: 0 16px 38px rgba(29, 78, 216, 0.24);
}

.primary:hover {
  background: linear-gradient(135deg, #071833 0%, #1742b0 50%, #0b615b 100%);
}

.plan-upsell,
.share-reward-card,
.reveal-free-retake,
.earn-hero-card {
  border-color: rgba(211, 154, 22, 0.34);
  border-left-color: var(--gold);
  background: linear-gradient(135deg, rgba(255, 250, 235, 0.98), rgba(255, 255, 255, 0.94) 54%, rgba(15, 118, 110, 0.08));
}

.leaderboard-route {
  border-color: rgba(15, 23, 42, 0.1);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.92));
}

.leaderboard-route span,
.plan-card em {
  color: #173f8a;
  background: rgba(23, 63, 138, 0.1);
}

.leaderboard-route strong,
.rank-name,
.score-chip strong,
.plan-card .plan-label,
.plan-card strong {
  color: var(--accent-ink);
}

.leaderboard-route small {
  color: #506174;
}

.leaderboard-route:hover,
.leaderboard-route.active,
.plan-card.active {
  border-color: rgba(29, 78, 216, 0.38);
  box-shadow: 0 20px 52px rgba(29, 78, 216, 0.13);
}

.route-visual {
  filter: saturate(0.96) contrast(1.04);
}

.rank-score,
.insight-mini strong,
.domain-card strong,
.rank-card strong,
.average-card strong,
.analytics-snapshot b {
  color: var(--teal);
}

.progress-track span,
.histogram-bar,
.referral-progress span,
.reveal-curve-fill {
  background: linear-gradient(90deg, #071a35, #173f8a, #1d4ed8);
}

.analytics-hero,
.primary-insight-panel,
.celebrity-leaderboard-panel,
.earn-hero,
.leaderboard-detail {
  border-left-color: #173f8a;
  border-top-color: rgba(29, 78, 216, 0.18);
}

.insight-hero-result.certificate-style-result,
.result-reveal-card {
  background:
    radial-gradient(circle at 88% 12%, rgba(211, 154, 22, 0.16), transparent 28%),
    linear-gradient(135deg, #ffffff, #f8faf7 58%, #ecf7f5);
}

.result-reveal {
  background:
    linear-gradient(135deg, rgba(11, 18, 32, 0.52), rgba(15, 118, 110, 0.22)),
    rgba(11, 18, 32, 0.36);
}

.reveal-score-stage,
.insight-hero-result.certificate-style-result .result-ring {
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.98) 0 58%, transparent 59%),
    conic-gradient(from -90deg, #1d4ed8 0 var(--reveal-progress, var(--iq-progress, 0deg)), rgba(15, 23, 42, 0.12) var(--reveal-progress, var(--iq-progress, 0deg)) 360deg);
  box-shadow: 0 24px 70px rgba(29, 78, 216, 0.16), 0 0 0 1px rgba(15, 23, 42, 0.1);
}

.site-footer,
.site-footer a {
  color: var(--accent-ink);
}

/* Launch theme: trustworthy navy, readable ivory, focused gold, clear teal */
:root {
  --ink: #071a35;
  --muted: #586272;
  --line: rgba(7, 26, 53, 0.14);
  --paper: #f8faf7;
  --panel: rgba(255, 255, 255, 0.94);
  --blue: #173f8a;
  --blue-dark: #071a35;
  --teal: #1d4ed8;
  --amber: #d39a16;
  --gold: #b98b2d;
  --accent-ink: #071a35;
  --accent-forest: #173f8a;
  --accent-forest-soft: rgba(23, 63, 138, 0.1);
  --shadow: 0 24px 72px rgba(7, 26, 53, 0.15);
}

body {
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(246, 249, 255, 0.82), rgba(234, 241, 252, 0.72) 44%, rgba(248, 251, 255, 0.84)),
    url("assets/iqrank-background.png") center top / cover fixed;
}

.top-nav,
.panel,
.leaderboard-panel,
.analytics-hero,
.entry-card,
.quick-entry-card,
.test-panel,
.leaderboard-detail {
  border-color: var(--line);
  background:
    linear-gradient(180deg, rgba(248, 251, 255, 0.94), rgba(242, 247, 255, 0.88));
  box-shadow: var(--shadow);
}

.top-nav {
  border-top: 4px solid rgba(7, 26, 53, 0.72);
}

.brand-mark {
  color: #fff;
  background: linear-gradient(135deg, #102a56, #1d4ed8 52%, #0f766e);
  box-shadow: 0 14px 30px rgba(29, 78, 216, 0.2);
}

.brand h1,
.brand p,
.top-nav .brand h1,
.top-nav .brand p,
.top-nav .nav-tab {
  color: var(--accent-ink);
}

.nav-tabs,
.segmented,
.plan-toggle {
  border-color: rgba(15, 23, 42, 0.1);
  background: rgba(232, 239, 251, 0.88);
}

.nav-tab.active,
.segment.active {
  color: #fff;
  background: linear-gradient(135deg, #102a56, #1d4ed8);
  border-color: rgba(29, 78, 216, 0.28);
  box-shadow: 0 12px 28px rgba(29, 78, 216, 0.18);
}

.primary,
.test-header .primary {
  color: #fff;
  background: linear-gradient(135deg, #102a56 0%, #1d4ed8 50%, #0f766e 100%);
  box-shadow: 0 16px 38px rgba(29, 78, 216, 0.24);
}

.primary:hover {
  background: linear-gradient(135deg, #071833 0%, #1742b0 50%, #0b615b 100%);
}

.plan-upsell,
.share-reward-card,
.reveal-free-retake,
.earn-hero-card {
  border-color: rgba(211, 154, 22, 0.34);
  border-left-color: var(--gold);
  background:
    linear-gradient(135deg, rgba(255, 250, 235, 0.98), rgba(255, 255, 255, 0.94) 54%, rgba(15, 118, 110, 0.08));
}

.leaderboard-route {
  border-color: rgba(15, 23, 42, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.92));
}

.leaderboard-route span,
.plan-card em {
  color: #173f8a;
  background: rgba(23, 63, 138, 0.1);
}

.leaderboard-route strong,
.rank-name,
.score-chip strong,
.plan-card .plan-label,
.plan-card strong {
  color: var(--accent-ink);
}

.leaderboard-route small {
  color: #506174;
}

.leaderboard-route:hover,
.leaderboard-route.active,
.plan-card.active {
  border-color: rgba(29, 78, 216, 0.38);
  box-shadow: 0 20px 52px rgba(29, 78, 216, 0.13);
}

.route-visual {
  filter: saturate(0.96) contrast(1.04);
}

.rank-score,
.insight-mini strong,
.domain-card strong,
.rank-card strong,
.average-card strong,
.analytics-snapshot b {
  color: var(--teal);
}

.progress-track span,
.histogram-bar,
.referral-progress span,
.reveal-curve-fill {
  background: linear-gradient(90deg, #071a35, #173f8a, #1d4ed8);
}

.analytics-hero,
.primary-insight-panel,
.celebrity-leaderboard-panel,
.earn-hero,
.leaderboard-detail {
  border-left-color: #173f8a;
  border-top-color: rgba(29, 78, 216, 0.18);
}

.insight-hero-result.certificate-style-result,
.result-reveal-card {
  background:
    radial-gradient(circle at 88% 12%, rgba(211, 154, 22, 0.16), transparent 28%),
    linear-gradient(135deg, #ffffff, #f8faf7 58%, #ecf7f5);
}

.result-reveal {
  background:
    linear-gradient(135deg, rgba(11, 18, 32, 0.52), rgba(15, 118, 110, 0.22)),
    rgba(11, 18, 32, 0.36);
}

.reveal-score-stage,
.insight-hero-result.certificate-style-result .result-ring {
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.98) 0 58%, transparent 59%),
    conic-gradient(from -90deg, #1d4ed8 0 var(--reveal-progress, var(--iq-progress, 0deg)), rgba(15, 23, 42, 0.12) var(--reveal-progress, var(--iq-progress, 0deg)) 360deg);
  box-shadow: 0 24px 70px rgba(29, 78, 216, 0.16), 0 0 0 1px rgba(15, 23, 42, 0.1);
}

.site-footer,
.site-footer a {
  color: var(--accent-ink);
}

@media (max-width: 760px) {
  body {
    background-attachment: scroll;
  }

  .hero-panel {
    padding: 0.75rem 0.75rem 1.1rem;
  }

  .top-nav {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.8rem;
    padding: 0.65rem;
  }

  .brand {
    min-width: 0;
  }

  .brand-mark {
    width: 2.65rem;
    height: 2.65rem;
  }

  .brand h1 {
    font-size: 1.02rem;
  }

  .brand p {
    font-size: 0.82rem;
  }

  .nav-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .nav-tab {
    min-height: 2.55rem;
    padding: 0.35rem 0.45rem;
    font-size: 0.84rem;
  }

  .workspace {
    padding: 0 0.75rem 2rem;
  }

  .leaderboard-stage {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.85rem;
    margin-bottom: 0.85rem;
  }

  .stage-copy h2 {
    font-size: 2.15rem;
    line-height: 1;
  }

  .large-action {
    width: 100%;
    min-height: 3.6rem;
    padding: 0.7rem 1rem;
    font-size: 0.92rem;
    letter-spacing: 0.02em;
    white-space: normal;
  }

  .panel,
  .entry-card {
    padding: 0.85rem;
  }

  .leaderboard-head,
  .directory-actions,
  .result-actions {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .score-chip {
    width: 100%;
  }

  .filter-grid {
    grid-template-columns: 1fr;
    gap: 0.7rem;
  }

  input,
  select,
  .search-select-control {
    min-height: 2.85rem;
  }

  .leaderboard-context {
    gap: 0.45rem;
  }

  .leaderboard-context span {
    width: 100%;
    border-radius: 8px;
  }

  .leaderboard-scroll {
    max-height: 62svh;
    padding-right: 0;
  }

  .rank-row {
    grid-template-columns: 2.45rem minmax(0, 1fr) 3.35rem;
    gap: 0.5rem;
    min-height: 4rem;
    padding: 0.65rem;
  }

  .rank {
    font-size: 0.9rem;
  }

  .rank-name {
    white-space: normal;
    line-height: 1.2;
  }

  .rank-meta {
    font-size: 0.74rem;
    line-height: 1.28;
  }

  .rank-score {
    font-size: 1rem;
  }

  .leaderboard-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .pagination-controls {
    justify-content: flex-start;
  }

  .pagination-controls .ghost {
    min-width: 2.45rem;
  }

  .leaderboard-hub {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .leaderboard-route,
  .leaderboard-route:first-child {
    grid-column: auto;
    grid-template-columns: 1fr;
    grid-template-rows: 9rem auto auto auto;
    min-height: 17rem;
    padding: 0.75rem;
  }

  .leaderboard-route:first-child .route-visual,
  .leaderboard-route:first-child span,
  .leaderboard-route:first-child strong,
  .leaderboard-route:first-child small {
    grid-column: auto;
    grid-row: auto;
  }

  .route-visual,
  .leaderboard-route:first-child .route-visual {
    min-height: 9rem;
  }

  .leaderboard-route strong {
    font-size: 1.2rem;
  }

  .directory-back {
    width: 100%;
    min-height: 3rem;
  }

  .directory-controls {
    display: grid;
    grid-template-columns: 1fr;
  }

  .directory-controls label {
    min-width: 0;
  }

  .plan-cards {
    grid-template-columns: 1fr;
  }

  .plan-card {
    min-height: 0;
    padding: 0.95rem;
  }

  .plan-card.active::after {
    top: 0.75rem;
    right: 0.75rem;
  }

  .feature-compare {
    overflow-x: auto;
    padding-bottom: 0.8rem;
  }

  .feature-compare div {
    min-width: 38rem;
  }

  .test-spec,
  .metric-grid,
  .domain-grid,
  .rank-summary-grid,
  .average-grid {
    grid-template-columns: 1fr;
  }

  .test-header {
    grid-template-columns: 1fr;
  }

  .timer,
  .test-header .primary {
    width: 100%;
  }

  .question-runner {
    width: 100%;
    min-height: auto;
    height: auto;
    padding-bottom: 0.25rem;
  }

  .question-runner .question,
  .question-runner .text-question {
    grid-template-rows: auto minmax(14rem, auto) auto;
    overflow: visible;
  }

  .question-title {
    display: grid;
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .question-visual {
    min-height: 14rem;
  }

  .matrix,
  .spatial-stage {
    width: min(17rem, 100%);
    min-height: 14rem;
    max-height: none;
  }

  .diagram-matrix {
    width: min(18rem, 100%);
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .diagram-equation {
    width: 100%;
  }

  .equation-row {
    grid-template-columns: minmax(3.25rem, 1fr) auto minmax(3.25rem, 1fr) auto minmax(3.25rem, 1fr);
    gap: 0.3rem;
    font-size: 1rem;
  }

  .equation-row .diagram-svg,
  .diagram-matrix .diagram-svg,
  .diagram-placeholder {
    max-height: 4.6rem;
  }

  .question-runner .options,
  .question-runner .text-options {
    grid-template-columns: 1fr 1fr;
    min-height: 0;
  }

  .question-runner .option-shape,
  .text-option .option-shape {
    min-height: 5.8rem;
    max-height: none;
  }

  .text-question-prompt {
    max-height: none;
    font-size: 1rem;
  }

  .question-runner .submit-row {
    grid-template-columns: 1fr 1fr;
  }

  .question-runner .submit-row button {
    width: 100%;
  }

  .analytics-hero {
    grid-template-columns: 1fr;
  }

  .analytics-snapshot {
    grid-template-columns: 1fr;
    min-width: 0;
  }

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

  .wide-analytic,
  .analytics-grid .wide-rank,
  .analytics-grid .featured-rank-card {
    grid-column: auto;
  }

  .distribution-row {
    grid-template-columns: 1fr;
  }

  .histogram {
    height: 6.6rem;
  }

  .result-panel,
  .certificate-style-result {
    display: grid;
    grid-template-columns: 1fr;
    text-align: left;
  }

  .result-ring {
    width: 7.5rem;
    height: 7.5rem;
    border-width: 0.65rem;
  }

  .result-reveal-card > strong {
    font-size: 4rem;
  }

  .certificate-preview-card {
    max-height: calc(100svh - 2rem);
    overflow: auto;
  }
}

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

  .nav-tab:last-child {
    grid-column: span 2;
  }

  .stage-copy h2 {
    font-size: 1.85rem;
  }

  .rank-row {
    grid-template-columns: 2.25rem minmax(0, 1fr);
  }

  .rank-score {
    grid-column: 2;
    text-align: left;
  }

  .question-runner .options,
  .question-runner .text-options {
    grid-template-columns: 1fr;
  }
}

/* Refined leaderboard-first layout */
:root {
  --ink: #08111f;
  --muted: #667789;
  --line: rgba(131, 158, 184, 0.24);
  --paper: #eef4f8;
  --panel: rgba(255, 255, 255, 0.9);
  --blue: #2457ff;
  --blue-dark: #1231a7;
  --teal: #00a68a;
  --gold: #d5a72e;
  --coral: #f06f4f;
  --violet: #6d5dfc;
  --shadow: 0 28px 90px rgba(3, 12, 29, 0.24);
}

body {
  color: var(--ink);
  background:
    linear-gradient(115deg, rgba(4, 13, 31, 0.92) 0%, rgba(9, 30, 58, 0.72) 34%, rgba(15, 83, 91, 0.38) 60%, rgba(239, 246, 248, 0.9) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(238, 244, 248, 0.96) 64%),
    url("https://images.unsplash.com/photo-1451187580459-43490279c0fa?auto=format&fit=crop&w=2200&q=82") center top / cover fixed;
}

body::before {
  content: "";
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9), transparent 78%);
}

.top-nav {
  padding: 0.78rem;
  border-color: rgba(255, 255, 255, 0.2);
  background:
    linear-gradient(135deg, rgba(7, 18, 38, 0.78), rgba(11, 38, 57, 0.58)),
    rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 70px rgba(3, 12, 29, 0.28);
}

.brand-mark {
  background:
    linear-gradient(135deg, #ffffff 0%, #dff9ff 12%, #2457ff 43%, #00a68a 78%, #d5a72e 100%);
  color: #06111f;
  box-shadow: inset 0 0 18px rgba(255, 255, 255, 0.32), 0 16px 34px rgba(0, 166, 138, 0.22);
}

.brand h1,
.brand p {
  color: #fff;
}

.brand h1 {
  font-size: 1.18rem;
}

.brand p {
  color: rgba(224, 241, 247, 0.72);
}

.nav-tabs,
.segmented,
.plan-toggle {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(4, 13, 31, 0.28);
}

.nav-tab,
.segment {
  color: rgba(224, 241, 247, 0.74);
}

.nav-tab.active,
.segment.active {
  color: #06111f;
  background: linear-gradient(135deg, #ffffff, #e9fbf8);
  border-color: rgba(255, 255, 255, 0.44);
  box-shadow: 0 10px 26px rgba(0, 166, 138, 0.18);
}

.primary {
  background: linear-gradient(135deg, var(--blue) 0%, #009bce 48%, var(--teal) 100%);
  box-shadow: 0 16px 38px rgba(36, 87, 255, 0.28);
}

.primary:hover {
  background: linear-gradient(135deg, var(--blue-dark) 0%, #087ba7 48%, #00806f 100%);
}

.ghost {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(131, 158, 184, 0.24);
}

.large-action {
  box-shadow: 0 18px 48px rgba(0, 166, 138, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.28) inset;
}

.leaderboard-stage {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  max-width: 78rem;
  margin: 0 auto 1rem;
  padding: clamp(0.4rem, 2vw, 1rem) 0 0.35rem;
  color: #fff;
}

.stage-copy {
  display: grid;
  gap: 0.35rem;
}

.stage-copy .eyebrow {
  color: rgba(195, 255, 242, 0.88);
}

.stage-copy h2 {
  max-width: 42rem;
  color: #fff;
  text-shadow: 0 16px 44px rgba(0, 0, 0, 0.34);
}

.leaderboard-only {
  min-height: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(245, 251, 250, 0.9)),
    linear-gradient(135deg, rgba(36, 87, 255, 0.12), rgba(0, 166, 138, 0.16), rgba(213, 167, 46, 0.1));
  border-color: rgba(255, 255, 255, 0.54);
}

.panel,
.entry-card {
  border-color: rgba(255, 255, 255, 0.56);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 252, 252, 0.86));
  box-shadow: var(--shadow);
}

.leaderboard-head h3,
.analytic-card h3,
.result-panel h3 {
  color: #071522;
}

.leaderboard-only .leaderboard-head {
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--line);
}

.filter-grid {
  grid-template-columns: minmax(12rem, 1.25fr) minmax(10rem, 1fr) minmax(8rem, 0.85fr) minmax(8rem, 0.85fr) minmax(10rem, 1fr);
}

.board-tabs {
  margin-top: 0.9rem;
  background: rgba(7, 18, 38, 0.08);
  border-color: rgba(36, 87, 255, 0.12);
}

.leaderboard-context {
  margin-top: 0.75rem;
}

.leaderboard-scroll {
  max-height: min(58vh, 37rem);
  margin-top: 0.9rem;
  overflow-y: auto;
  padding-right: 0.3rem;
  scrollbar-color: rgba(36, 87, 255, 0.58) rgba(226, 239, 244, 0.9);
}

.leaderboard-scroll .leaderboard {
  margin-top: 0;
}

.leaderboard-scroll::-webkit-scrollbar {
  width: 0.65rem;
}

.leaderboard-scroll::-webkit-scrollbar-track {
  background: rgba(226, 239, 244, 0.9);
  border-radius: 999px;
}

.leaderboard-scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--blue), var(--teal), var(--gold));
  border-radius: 999px;
}

.leaderboard-hub {
  display: grid;
  grid-template-columns: repeat(2, minmax(18rem, 1fr));
  gap: 1.15rem;
  max-width: 78rem;
  margin: 1rem auto 0;
}

.celebrity-leaderboard-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(22rem, 1.2fr);
  gap: 1rem;
  align-items: stretch;
  max-width: 78rem;
  margin: 0 auto;
  border-color: rgba(31, 93, 77, 0.24);
  border-left: 6px solid var(--accent-forest);
  background:
    radial-gradient(circle at 94% 10%, rgba(213, 167, 46, 0.2), transparent 24%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(255, 247, 216, 0.93) 52%, rgba(31, 93, 77, 0.08));
  box-shadow: 0 20px 52px rgba(31, 93, 77, 0.1);
}

.celebrity-leaderboard-copy {
  display: grid;
  align-content: center;
  gap: 0.45rem;
}

.celebrity-leaderboard-copy h3 {
  color: var(--accent-ink);
  font-size: clamp(1.55rem, 2.8vw, 2.35rem);
}

.celebrity-leaderboard-scroll {
  max-height: 19rem;
  overflow-y: auto;
  padding-right: 0.3rem;
}

.celebrity-leaderboard-scroll .leaderboard {
  margin-top: 0;
}

.celebrity-leaderboard-scroll::-webkit-scrollbar {
  width: 0.55rem;
}

.celebrity-leaderboard-scroll::-webkit-scrollbar-track {
  border-radius: 999px;
  background: rgba(255, 240, 184, 0.72);
}

.celebrity-leaderboard-scroll::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent-forest), #d5a72e);
}

.celebrity-row {
  min-height: 3.8rem;
}

.leaderboard-route {
  display: grid;
  grid-template-rows: 12rem auto auto auto;
  gap: 0.7rem;
  min-height: 22rem;
  padding: 0.95rem;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(241, 249, 250, 0.88)),
    linear-gradient(135deg, rgba(36, 87, 255, 0.14), rgba(0, 166, 138, 0.14), rgba(213, 167, 46, 0.1));
  box-shadow: 0 16px 40px rgba(3, 12, 29, 0.1);
}

.leaderboard-route:first-child {
  grid-column: span 2;
  grid-template-columns: minmax(0, 1.3fr) minmax(18rem, 0.7fr);
  grid-template-rows: auto auto 1fr;
  min-height: 17rem;
  align-items: end;
}

.leaderboard-route:first-child .route-visual {
  grid-row: 1 / 4;
  min-height: 15rem;
}

.leaderboard-route:first-child span,
.leaderboard-route:first-child strong,
.leaderboard-route:first-child small {
  grid-column: 2;
}

.route-visual {
  position: relative;
  overflow: hidden;
  min-height: 12rem;
  border-radius: 8px;
  background: linear-gradient(135deg, #0a2540, #2f80ed);
}

.visual-world {
  background:
    linear-gradient(180deg, rgba(7, 21, 34, 0.05), rgba(7, 21, 34, 0.46)),
    url("https://images.unsplash.com/photo-1446776811953-b23d57bd21aa?auto=format&fit=crop&w=900&q=75") center / cover,
    linear-gradient(135deg, #071522, #174ea6 58%, #0f9f9a);
}

.visual-country {
  background:
    linear-gradient(180deg, rgba(7, 21, 34, 0.04), rgba(7, 21, 34, 0.22)),
    url("https://commons.wikimedia.org/wiki/Special:FilePath/Flag-map_of_the_world.svg") center / cover,
    linear-gradient(135deg, #2563eb, #0f9f9a);
}

.visual-city {
  background:
    linear-gradient(180deg, rgba(7, 21, 34, 0.02), rgba(7, 21, 34, 0.48)),
    url("https://images.unsplash.com/photo-1477959858617-67f85cf4f1df?auto=format&fit=crop&w=900&q=75") center / cover,
    linear-gradient(145deg, #102a43, #486581);
}

.visual-gender {
  background:
    linear-gradient(180deg, rgba(7, 21, 34, 0.02), rgba(7, 21, 34, 0.42)),
    url("https://images.unsplash.com/photo-1529156069898-49953e39b3ac?auto=format&fit=crop&w=900&q=75") center / cover,
    linear-gradient(135deg, #7c3aed, #0f9f9a);
}

.visual-age {
  background:
    linear-gradient(180deg, rgba(7, 21, 34, 0.02), rgba(7, 21, 34, 0.42)),
    url("https://images.unsplash.com/photo-1543269865-cbf427effbad?auto=format&fit=crop&w=900&q=75") center / cover,
    linear-gradient(135deg, #071522, #c99a2e);
}

.visual-matrix {
  background:
    linear-gradient(180deg, rgba(238, 247, 251, 0.26), rgba(7, 21, 34, 0.2)),
    url("https://images.unsplash.com/photo-1509228627152-72ae9ae6848d?auto=format&fit=crop&w=900&q=75") center / cover,
    linear-gradient(135deg, #eef7fb, #175cd3);
}

.visual-verbal {
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.16), rgba(7, 21, 34, 0.48)),
    url("https://images.unsplash.com/photo-1495020689067-958852a7765e?auto=format&fit=crop&w=900&q=75") center / cover,
    linear-gradient(135deg, #f8fafc, #0f172a);
}

.visual-comprehensive {
  background:
    linear-gradient(180deg, rgba(7, 21, 34, 0.02), rgba(7, 21, 34, 0.48)),
    url("https://images.unsplash.com/photo-1454165804606-c3d57bc86b40?auto=format&fit=crop&w=900&q=75") center / cover,
    linear-gradient(135deg, #071522, #2563eb 54%, #c99a2e);
}

.leaderboard-route span {
  width: fit-content;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  background: rgba(36, 87, 255, 0.1);
  color: var(--blue-dark);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.leaderboard-route strong {
  color: #071522;
  font-size: 1.45rem;
}

.leaderboard-route small {
  color: var(--muted);
  font-weight: 800;
  line-height: 1.42;
  font-size: 0.94rem;
}

.leaderboard-route:hover {
  border-color: rgba(0, 166, 138, 0.45);
  box-shadow: 0 22px 54px rgba(3, 12, 29, 0.18);
  transform: translateY(-2px);
}

.leaderboard-route.active {
  border-color: rgba(36, 87, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(36, 87, 255, 0.12), 0 22px 54px rgba(3, 12, 29, 0.18);
}

.leaderboard-detail {
  max-width: 78rem;
  margin: 1rem auto 0;
}

#leaderboardsView:not(.directory-focused) .leaderboard-detail {
  display: none;
}

#leaderboardsView.directory-focused .leaderboard-hub {
  display: none;
}

#leaderboardsView.directory-focused .celebrity-leaderboard-panel {
  display: none;
}

#leaderboardsView.directory-focused .leaderboard-detail {
  margin-top: 0;
}

.directory-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.directory-back {
  min-height: 3.15rem;
  padding: 0 1.05rem;
  border-color: transparent;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  color: #fff;
  box-shadow: 0 14px 32px rgba(36, 87, 255, 0.24);
}

.directory-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: end;
  margin-top: 0.9rem;
}

.directory-controls label {
  min-width: min(22rem, 100%);
}

.directory-help {
  color: var(--muted);
  font-weight: 800;
}

.directory-scroll {
  max-height: 30rem;
}

.rank-row {
  grid-template-columns: 3.4rem minmax(0, 1fr) 4.5rem;
  min-height: 4.2rem;
  border-color: rgba(131, 158, 184, 0.18);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(245, 251, 250, 0.9));
  box-shadow: 0 10px 30px rgba(3, 12, 29, 0.07);
}

.rank-row:nth-child(1) {
  background:
    linear-gradient(135deg, rgba(255, 249, 218, 0.98), rgba(255, 255, 255, 0.94)),
    linear-gradient(90deg, rgba(213, 167, 46, 0.22), transparent);
  border-color: rgba(213, 167, 46, 0.42);
}

.rank {
  color: #b67805;
}

.rank-score {
  color: var(--blue-dark);
  text-align: right;
}

.rank-name {
  color: #071522;
}

.filter-grid label,
.quick-entry label,
.directory-controls label,
.profileForm label {
  color: #17324d;
}

input,
select {
  border-color: rgba(131, 158, 184, 0.28);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 22px rgba(3, 12, 29, 0.045);
}

input:focus,
select:focus {
  outline: 2px solid rgba(0, 166, 138, 0.28);
  border-color: rgba(0, 166, 138, 0.56);
}

.board-tabs .segment,
.plan-toggle .segment {
  color: var(--muted);
}

.board-tabs .segment.active,
.plan-toggle .segment.active {
  color: var(--ink);
}

.analytics-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
  overflow: hidden;
  border-color: rgba(37, 99, 235, 0.18);
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.96), rgba(236, 250, 246, 0.9)),
    url("https://images.unsplash.com/photo-1516321318423-f06f85e504b3?auto=format&fit=crop&w=1200&q=75") center / cover;
}

.analytics-hero h3 {
  margin: 0.2rem 0;
  color: #071522;
  font-size: clamp(1.7rem, 3vw, 2.6rem);
}

.analytics-snapshot {
  display: grid;
  grid-template-columns: repeat(3, minmax(5.5rem, 1fr));
  gap: 0.5rem;
  min-width: min(24rem, 100%);
}

.analytics-snapshot span {
  display: grid;
  gap: 0.1rem;
  min-height: 4.2rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(105, 139, 163, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.analytics-snapshot b {
  color: #0b2f63;
  font-size: 1.25rem;
}

.analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(22rem, 0.9fr);
  gap: 1rem;
}

.insight-hero-result {
  margin-bottom: 1rem;
  padding: clamp(1rem, 2.4vw, 1.35rem);
  border-color: rgba(213, 167, 46, 0.5);
  background:
    linear-gradient(135deg, rgba(7, 21, 34, 0.96), rgba(18, 49, 167, 0.9) 48%, rgba(0, 166, 138, 0.86)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent);
  color: #fff;
}

.insight-hero-result .eyebrow,
.insight-hero-result p,
.insight-hero-result small {
  color: rgba(240, 248, 255, 0.8);
}

.insight-hero-result h3 {
  color: #fff;
  font-size: clamp(1.55rem, 3vw, 2.45rem);
}

.insight-hero-result .result-ring {
  background: rgba(255, 255, 255, 0.96);
  color: #071522;
}

.insight-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.insight-mini {
  display: grid;
  gap: 0.18rem;
  min-height: 5.4rem;
  align-content: center;
  border-color: rgba(255, 255, 255, 0.58);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(236, 250, 246, 0.88));
}

.insight-mini span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
}

.insight-mini strong {
  color: var(--blue-dark);
  font-size: 1.55rem;
}

.primary-insight-panel {
  margin-bottom: 1rem;
  border-color: rgba(36, 87, 255, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 251, 250, 0.9)),
    linear-gradient(135deg, rgba(36, 87, 255, 0.1), rgba(0, 166, 138, 0.08));
}

.earn-teaser {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
  border-color: rgba(213, 167, 46, 0.34);
  background:
    linear-gradient(135deg, rgba(255, 240, 184, 0.92), rgba(255, 255, 255, 0.92) 54%, rgba(232, 249, 245, 0.9));
}

.earn-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(18rem, 0.75fr);
  gap: clamp(1rem, 3vw, 2rem);
  align-items: center;
  min-height: 24rem;
  margin-bottom: 1rem;
  overflow: hidden;
  border-color: rgba(255, 255, 255, 0.2);
  background:
    linear-gradient(135deg, rgba(7, 21, 34, 0.96), rgba(14, 57, 148, 0.92) 46%, rgba(0, 166, 138, 0.88)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent);
  color: #fff;
}

.earn-hero-copy {
  display: grid;
  gap: 0.9rem;
}

.earn-hero .eyebrow,
.earn-hero p,
.earn-hero small {
  color: rgba(240, 248, 255, 0.82);
}

.earn-hero h2 {
  max-width: 11ch;
  color: #fff;
  font-size: clamp(2.6rem, 7vw, 5.8rem);
  line-height: 0.9;
}

.earn-hero-copy > p:not(.eyebrow) {
  max-width: 44rem;
  font-size: clamp(1.02rem, 1.6vw, 1.28rem);
  font-weight: 750;
}

.earn-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.entry-actions,
.test-ready-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.entry-actions .primary {
  flex: 1 1 13rem;
}

.test-ready-actions {
  justify-content: end;
}

.test-ready-actions .primary {
  min-width: 9rem;
}

.earn-hero-card {
  display: grid;
  gap: 0.45rem;
  align-content: center;
  min-height: 17rem;
  padding: clamp(1rem, 2.6vw, 1.45rem);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 240, 184, 0.92));
  color: #071522;
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.22);
}

.earn-hero-card span {
  color: #6d4a10;
  font-size: 0.8rem;
  font-weight: 950;
  text-transform: uppercase;
}

.earn-hero-card strong {
  color: #071522;
  font-size: clamp(3rem, 6vw, 5.2rem);
  line-height: 0.9;
}

.earn-hero-card small {
  color: #425466;
  font-size: 1rem;
  font-weight: 850;
}

.earn-steps,
.earn-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.earn-step,
.earn-card {
  display: grid;
  gap: 0.5rem;
  align-content: start;
  min-height: 10.5rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 251, 251, 0.9));
}

.earn-step span {
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 999px;
  background: #071522;
  color: #fff;
  font-weight: 950;
}

.earn-step strong,
.earn-card strong {
  color: #071522;
  font-size: 1.45rem;
}

.earn-step p,
.earn-card span {
  color: var(--muted);
  font-weight: 750;
}

.referral-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(18rem, 1.1fr);
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
  border-color: rgba(213, 167, 46, 0.44);
  background-color: #fff0b8;
  background-image:
    linear-gradient(135deg, rgba(255, 246, 207, 0.98), rgba(255, 255, 255, 0.94) 46%, rgba(232, 249, 245, 0.92)),
    linear-gradient(135deg, rgba(213, 167, 46, 0.22), rgba(36, 87, 255, 0.1));
  box-shadow: 0 18px 48px rgba(113, 78, 12, 0.13);
}

.earn-referral-panel {
  margin-bottom: 1rem;
}

.referral-copy {
  display: grid;
  gap: 0.35rem;
}

.referral-copy h3 {
  font-size: clamp(1.35rem, 2.6vw, 2.1rem);
}

.referral-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.referral-stats div {
  display: grid;
  gap: 0.12rem;
  min-height: 5.4rem;
  align-content: center;
  padding: 0.8rem;
  border: 1px solid rgba(213, 167, 46, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
}

.referral-stats span {
  color: #6d4a10;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.referral-stats strong {
  color: #071522;
  font-size: clamp(1.25rem, 2.4vw, 1.85rem);
  overflow-wrap: anywhere;
}

.referral-link-row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.65rem;
  align-items: center;
}

.referral-link-row input {
  font-weight: 800;
  color: #0d2335;
  background: rgba(255, 255, 255, 0.92);
}

.affiliate-auth-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
  gap: 1rem;
}

.affiliate-form,
.affiliate-withdraw {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid rgba(18, 37, 71, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.affiliate-form strong {
  color: var(--ink);
  font-size: 1rem;
}

.affiliate-form label,
.affiliate-withdraw label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.affiliate-form input,
.affiliate-withdraw input {
  width: 100%;
  border: 1px solid rgba(18, 37, 71, 0.14);
  border-radius: 12px;
  padding: 0.78rem 0.9rem;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.affiliate-terms {
  grid-template-columns: auto 1fr;
  align-items: start;
}

.affiliate-terms input {
  width: auto;
  margin-top: 0.2rem;
}

.affiliate-withdraw {
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  margin-top: 0.5rem;
}

.text-button {
  grid-column: 1 / -1;
  justify-self: start;
  border: 0;
  background: transparent;
  color: var(--navy);
  font-weight: 900;
  cursor: pointer;
}

@media (max-width: 760px) {
  .affiliate-auth-grid,
  .affiliate-withdraw,
  .affiliate-dashboard,
  .affiliate-metrics {
    grid-template-columns: 1fr;
  }

  .affiliate-sales-chart {
    min-height: 10rem;
    gap: 0.35rem;
  }

  .affiliate-sale-row {
    grid-template-columns: 1fr auto;
  }

  .affiliate-sale-row em {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

.referral-progress {
  grid-column: 1 / -1;
  height: 0.72rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(105, 139, 163, 0.18);
}

.referral-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d5a72e, #2457ff, #00a68a);
  transition: width 220ms ease;
}

.affiliate-dashboard {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(20rem, 0.9fr);
  gap: 1rem;
}

.affiliate-metrics {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.affiliate-metrics div,
.affiliate-chart-card,
.affiliate-sales-card {
  border: 1px solid rgba(12, 31, 58, 0.12);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(249, 251, 255, 0.86)),
    rgba(255, 255, 255, 0.9);
  box-shadow: 0 14px 34px rgba(12, 31, 58, 0.08);
}

.affiliate-metrics div {
  display: grid;
  gap: 0.22rem;
  min-height: 7.2rem;
  align-content: center;
  padding: 1rem;
}

.affiliate-metrics span,
.affiliate-card-head span,
.affiliate-empty-sales span,
.affiliate-sale-row span {
  color: #5a6b7c;
  font-size: 0.78rem;
  font-weight: 850;
}

.affiliate-metrics span {
  text-transform: uppercase;
}

.affiliate-metrics strong {
  color: #061b33;
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  letter-spacing: 0;
}

.affiliate-metrics small {
  color: #836011;
  font-weight: 850;
}

.affiliate-chart-card,
.affiliate-sales-card {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.affiliate-card-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.affiliate-card-head strong {
  color: #061b33;
  font-size: 1rem;
}

.affiliate-sales-chart {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0.55rem;
  align-items: end;
  min-height: 13rem;
  padding: 0.75rem;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(10, 28, 56, 0.06) 1px, transparent 1px) 0 0 / 100% 25%,
    linear-gradient(135deg, rgba(7, 33, 67, 0.045), rgba(213, 167, 46, 0.08));
}

.affiliate-chart-bar {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 0.45rem;
  height: 100%;
  min-width: 0;
}

.affiliate-chart-bar span {
  align-self: end;
  display: block;
  min-height: 0.5rem;
  border-radius: 999px 999px 6px 6px;
  background: linear-gradient(180deg, #f0c23b, #173a67);
  box-shadow: 0 10px 18px rgba(23, 58, 103, 0.18);
}

.affiliate-chart-bar small {
  color: #5a6b7c;
  font-size: 0.72rem;
  font-weight: 900;
  text-align: center;
}

.affiliate-sales-table {
  display: grid;
  gap: 0.55rem;
}

.affiliate-sale-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid rgba(12, 31, 58, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
}

.affiliate-sale-row div {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
}

.affiliate-sale-row strong,
.affiliate-sale-row b {
  color: #061b33;
}

.affiliate-sale-row em {
  justify-self: end;
  border-radius: 999px;
  padding: 0.32rem 0.58rem;
  background: rgba(23, 58, 103, 0.1);
  color: #173a67;
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 950;
}

.affiliate-sale-row .status-approved,
.affiliate-sale-row .status-paid {
  background: rgba(0, 150, 111, 0.12);
  color: #00795c;
}

.affiliate-sale-row .status-reversed,
.affiliate-sale-row .status-rejected {
  background: rgba(180, 48, 48, 0.12);
  color: #992525;
}

.affiliate-empty-sales {
  display: grid;
  gap: 0.25rem;
  min-height: 9rem;
  place-content: center;
  text-align: center;
  border: 1px dashed rgba(12, 31, 58, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.56);
}

.affiliate-empty-sales strong {
  color: #061b33;
  font-size: 1.1rem;
}

.referral-panel .soft-note {
  grid-column: 1 / -1;
  margin: 0;
}

.referral-ledger {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.earn-referral-panel .referral-ledger {
  display: none;
}

.referral-ledger div {
  display: grid;
  gap: 0.16rem;
  min-height: 4.8rem;
  padding: 0.75rem;
  border: 1px solid rgba(7, 21, 34, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.referral-ledger span,
.referral-ledger small {
  color: #526477;
  font-size: 0.78rem;
  font-weight: 850;
}

.referral-ledger strong {
  color: #071522;
  font-size: 1.25rem;
}

.earn-card {
  min-height: 9rem;
  border-color: rgba(105, 139, 163, 0.16);
}

.earn-card strong {
  font-size: clamp(2rem, 4vw, 3rem);
}

.earn-card.featured {
  border-color: rgba(213, 167, 46, 0.46);
  background:
    linear-gradient(135deg, rgba(255, 240, 184, 0.96), rgba(255, 255, 255, 0.94) 52%, rgba(232, 249, 245, 0.94));
  box-shadow: 0 16px 38px rgba(213, 167, 46, 0.18);
}

.earn-card.featured strong {
  color: #7a5100;
}

.analytic-card {
  display: grid;
  gap: 0.9rem;
  align-content: start;
  border-color: rgba(105, 139, 163, 0.16);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 251, 251, 0.9)),
    linear-gradient(135deg, rgba(36, 87, 255, 0.09), rgba(0, 166, 138, 0.08), rgba(213, 167, 46, 0.08));
  box-shadow: 0 18px 48px rgba(3, 12, 29, 0.1);
}

.analytic-card-head {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: start;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid rgba(105, 139, 163, 0.14);
}

.analytic-card-head h3 {
  margin-top: 0.1rem;
}

.wide-analytic {
  grid-column: span 2;
}

.analytics-grid .average-grid,
.analytics-grid .rank-summary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 0;
}

.associated-ranks {
  margin-top: 0.8rem;
}

.analytics-grid .board-distribution {
  margin-top: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 250, 252, 0.94));
}

.average-card,
.rank-card,
.metric-grid div,
.domain-card {
  border-color: rgba(105, 139, 163, 0.16);
  background:
    linear-gradient(180deg, #fff, #f8fbfc);
  box-shadow: 0 10px 28px rgba(7, 21, 34, 0.055);
}

.analytics-grid .rank-card,
.analytics-grid .average-card {
  min-height: 5.4rem;
  border-color: rgba(37, 99, 235, 0.13);
}

.analytics-grid .wide-rank,
.analytics-grid .featured-rank-card {
  grid-column: span 2;
}

.featured-rank-card {
  background:
    linear-gradient(135deg, rgba(7, 21, 34, 0.96), rgba(11, 47, 99, 0.92) 58%, rgba(15, 159, 154, 0.9));
  color: #fff;
  border-color: rgba(255, 255, 255, 0.16);
}

.featured-rank-card span,
.featured-rank-card small,
.featured-rank-card strong {
  color: #fff;
}

.histogram {
  height: 8.4rem;
}

.histogram-bar {
  background: linear-gradient(180deg, #2457ff, #009bce 52%, #00a68a);
}

.mean-marker {
  background: #061423;
}

.score-marker {
  background: var(--gold);
}

.score-marker b {
  color: #7a5310;
}

.test-entry-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  width: min(58rem, 100%);
  margin-inline: auto;
  margin-bottom: 1rem;
}

.quick-entry-card {
  display: grid;
  gap: 0.9rem;
  align-content: start;
}

.field-grid {
  display: grid;
  grid-template-columns: 0.6fr 1fr;
  gap: 0.75rem;
}

.entry-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(246, 251, 250, 0.9)),
    linear-gradient(135deg, rgba(36, 87, 255, 0.14), rgba(0, 166, 138, 0.1), rgba(213, 167, 46, 0.1));
}

.payment-note {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.referral-discount-panel {
  display: grid;
  gap: 0.7rem;
  padding: 1rem;
  border: 2px solid rgba(185, 139, 45, 0.55);
  border-left: 7px solid var(--gold);
  border-radius: 8px;
  background:
    radial-gradient(circle at 95% 10%, rgba(185, 139, 45, 0.22), transparent 30%),
    linear-gradient(135deg, rgba(255, 252, 242, 0.98), rgba(236, 243, 255, 0.9));
  box-shadow: 0 18px 42px rgba(7, 26, 53, 0.1);
}

.discount-callout {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.discount-callout span {
  padding: 0.32rem 0.62rem;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, #071a35, #173f8a);
  font-size: 0.82rem;
  font-weight: 950;
  text-transform: uppercase;
}

.discount-callout strong {
  color: var(--ink);
  font-size: 1.08rem;
}

.referral-discount-panel label {
  display: grid;
  gap: 0.4rem;
  color: var(--ink);
  font-weight: 900;
}

.referral-discount-panel input {
  text-transform: uppercase;
  border-color: rgba(185, 139, 45, 0.46);
  background: rgba(255, 255, 255, 0.96);
  font-size: 1.02rem;
  font-weight: 900;
}

.referral-discount-panel p {
  color: #173f8a;
  font-size: 0.88rem;
  font-weight: 900;
}

.feature-compare {
  display: grid;
  gap: 0.35rem;
  padding: 0.75rem;
  border: 1px solid rgba(105, 139, 163, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.feature-compare div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 5.2rem 7.4rem 6.2rem;
  gap: 0.5rem;
  align-items: center;
  min-height: 2.1rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid rgba(105, 139, 163, 0.12);
}

.feature-compare div:last-child {
  border-bottom: 0;
}

.feature-compare span {
  color: var(--ink);
  font-weight: 800;
}

.feature-compare b {
  text-align: center;
  font-size: 0.88rem;
}

.feature-compare .yes {
  color: var(--teal);
}

.feature-compare .no {
  color: var(--red);
}

.locked-entry {
  opacity: 0.62;
  filter: grayscale(0.25);
}

.locked-entry input,
.locked-entry select,
.locked-entry button {
  cursor: not-allowed;
}

[data-test-stage][hidden] {
  display: none !important;
}

.question-runner {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 1rem;
  width: min(56rem, 100%);
  max-width: 56rem;
  min-height: 52rem;
  height: max(52rem, calc(100vh - 7rem));
  margin: 0 auto;
  align-content: stretch;
}

.test-progress {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-weight: 900;
}

.progress-track {
  height: 0.55rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(105, 139, 163, 0.18);
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--teal), var(--gold));
}

.question-runner .question {
  display: grid;
  grid-template-rows: 7rem 18rem 20rem;
  gap: 1rem;
  box-shadow: none;
  min-height: 0;
  overflow: auto;
  align-content: stretch;
}

.question-runner .text-question {
  grid-template-rows: 5rem 20rem 16rem;
}

.question-visual {
  display: grid;
  place-items: center;
  min-height: 18rem;
  overflow: hidden;
}

.empty-visual {
  min-height: 18rem;
}

.question-runner .options {
  grid-template-columns: repeat(3, minmax(8rem, 1fr));
  min-height: 20rem;
  align-content: stretch;
  overflow: hidden;
}

.question-runner .option-shape {
  width: 100%;
  min-height: 7.2rem;
  max-height: 7.2rem;
}

.question-runner .text-options {
  grid-template-columns: repeat(2, minmax(10rem, 1fr));
  min-height: 16rem;
  overflow: visible;
}

.question-title {
  min-height: 7rem;
}

.matrix,
.spatial-stage {
  width: min(17rem, 100%);
  min-height: 17rem;
  max-height: 17rem;
}

.text-option .option-shape {
  min-height: 5.2rem;
  max-height: none;
}

.question-runner .submit-row {
  display: grid;
  grid-template-columns: 9.5rem 9.5rem;
  justify-content: space-between;
  gap: 0.75rem;
}

.question-runner .submit-row button {
  width: 9.5rem;
  min-height: 3rem;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.result-reveal {
  position: fixed;
  z-index: 40;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background:
    linear-gradient(135deg, rgba(4, 13, 31, 0.84), rgba(0, 92, 105, 0.62)),
    rgba(7, 21, 34, 0.72);
  backdrop-filter: blur(14px);
}

.result-reveal[hidden] {
  display: none;
}

.result-reveal-card {
  display: grid;
  gap: 1rem;
  width: min(62rem, 100%);
  max-height: calc(100svh - 2rem);
  overflow: auto;
  padding: clamp(1rem, 2.6vw, 1.65rem);
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 8px;
  background:
    radial-gradient(circle at 84% 8%, rgba(255, 240, 184, 0.25), transparent 26%),
    linear-gradient(135deg, rgba(7, 21, 34, 0.98), rgba(14, 57, 148, 0.96) 52%, rgba(0, 166, 138, 0.92));
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.34);
  text-align: center;
  color: #fff;
}

.result-reveal-card .eyebrow,
.result-reveal-card p {
  color: rgba(240, 248, 255, 0.84);
}

.result-reveal-card > strong {
  color: var(--blue-dark);
  font-size: 6rem;
  line-height: 0.95;
}

.reveal-score-stage {
  display: grid;
  place-items: center;
  gap: 0.15rem;
  width: min(18rem, 82vw);
  height: min(18rem, 82vw);
  margin-inline: auto;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.98) 0 58%, transparent 59%),
    conic-gradient(from -90deg, #d5a72e 0 var(--reveal-progress, 0deg), rgba(255, 255, 255, 0.2) var(--reveal-progress, 0deg) 360deg);
  color: #071522;
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.32),
    0 0 0 1px rgba(255, 255, 255, 0.24);
}

.reveal-score-stage strong {
  font-size: clamp(4rem, 10vw, 7.2rem);
  line-height: 0.86;
}

.reveal-score-stage span {
  color: #425466;
  font-size: 0.75rem;
  font-weight: 950;
  text-transform: uppercase;
}

.reveal-score-stage em {
  padding: 0.36rem 0.68rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #fff0b8, #d5a72e);
  color: #4d3509;
  font-size: 0.86rem;
  font-style: normal;
  font-weight: 950;
}

.result-reveal-card h3 {
  color: #fff;
  font-size: clamp(1.6rem, 3vw, 2.55rem);
}

.reveal-rank-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.6rem;
}

.reveal-rank-card {
  display: grid;
  gap: 0.1rem;
  min-height: 5.2rem;
  align-content: center;
  padding: 0.72rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
}

.reveal-rank-card span,
.reveal-rank-card small {
  color: rgba(240, 248, 255, 0.76);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.reveal-rank-card strong {
  color: #fff;
  font-size: clamp(1.25rem, 2.8vw, 2rem);
}

.reveal-graph {
  display: grid;
  gap: 0.5rem;
  padding: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
}

.reveal-graph-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: rgba(240, 248, 255, 0.76);
  font-weight: 900;
  text-transform: uppercase;
}

.reveal-graph-head strong {
  color: #fff0b8;
}

.reveal-curve {
  position: relative;
  height: 1rem;
  overflow: visible;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.reveal-curve-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2457ff, #00a68a, #d5a72e);
  transition: width 240ms ease;
}

.reveal-curve b {
  position: absolute;
  top: 50%;
  left: 0;
  width: 1.35rem;
  height: 1.35rem;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #d5a72e;
  transform: translate(-50%, -50%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.reveal-referral {
  display: grid;
  grid-template-columns: minmax(10rem, 0.45fr) minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem;
  border: 1px solid rgba(213, 167, 46, 0.38);
  border-radius: 8px;
  background: rgba(255, 240, 184, 0.12);
  text-align: left;
}

.reveal-referral span {
  color: rgba(240, 248, 255, 0.78);
  font-size: 0.75rem;
  font-weight: 950;
  text-transform: uppercase;
}

.reveal-referral strong {
  display: block;
  color: #fff0b8;
  font-size: 1.15rem;
  overflow-wrap: anywhere;
}

.reveal-referral input {
  color: #071522;
  font-weight: 850;
  background: rgba(255, 255, 255, 0.94);
}

.result-reveal-card .result-actions {
  justify-content: center;
}

.certificate-style-result {
  border: 1px solid rgba(213, 167, 46, 0.42);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(241, 250, 249, 0.94)),
    linear-gradient(135deg, rgba(36, 87, 255, 0.14), rgba(0, 166, 138, 0.1), rgba(213, 167, 46, 0.16));
}

.certificate-style-result .result-ring {
  border-color: rgba(213, 167, 46, 0.45);
  border-right-color: var(--blue);
  box-shadow: inset 0 0 0 1px rgba(7, 21, 34, 0.08);
}

.insight-hero-result.certificate-style-result {
  border-color: rgba(213, 167, 46, 0.5);
  background:
    radial-gradient(circle at 88% 18%, rgba(255, 240, 184, 0.22), transparent 28%),
    linear-gradient(135deg, rgba(7, 21, 34, 0.98), rgba(18, 49, 167, 0.94) 48%, rgba(0, 166, 138, 0.9));
  color: #fff;
}

.insight-hero-result.certificate-style-result .eyebrow,
.insight-hero-result.certificate-style-result p,
.insight-hero-result.certificate-style-result small {
  color: rgba(240, 248, 255, 0.86);
}

.insight-hero-result.certificate-style-result h3 {
  color: #fff;
}

.insight-hero-result.certificate-style-result .result-ring {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(10.5rem, 20vw, 14rem);
  height: clamp(10.5rem, 20vw, 14rem);
  padding: 1.1rem;
  border: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.98) 0 58%, transparent 59%),
    conic-gradient(from -90deg, #d5a72e var(--iq-progress, 0deg), rgba(255, 255, 255, 0.22) 0 360deg);
  color: #071522;
  box-shadow:
    0 22px 58px rgba(0, 0, 0, 0.28),
    0 0 0 1px rgba(255, 255, 255, 0.18);
}

.insight-hero-result.certificate-style-result .result-ring span {
  font-size: clamp(2.6rem, 5vw, 4rem);
  line-height: 0.95;
}

.insight-hero-result.certificate-style-result .result-ring small {
  margin-top: -0.2rem;
  color: #4b5b6b;
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.insight-hero-result.certificate-style-result .result-ring em {
  max-width: 8.6rem;
  margin-top: 0.2rem;
  padding: 0.32rem 0.55rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #fff0b8, #d5a72e);
  color: #4d3509;
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 950;
  line-height: 1.15;
  text-align: center;
}

.certificate-preview-card {
  display: grid;
  gap: 0.9rem;
  width: min(62rem, 100%);
  padding: 1rem;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(241, 250, 249, 0.94));
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.34);
}

.certificate-preview-card canvas {
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.certificate-preview-card .result-actions {
  justify-content: flex-end;
}

.share-modal-card {
  display: grid;
  gap: 1rem;
  width: min(54rem, calc(100vw - 2rem));
  max-height: min(48rem, calc(100svh - 2rem));
  overflow: auto;
  padding: clamp(1rem, 3vw, 1.5rem);
  border: 1px solid rgba(213, 167, 46, 0.34);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 253, 247, 0.96)),
    radial-gradient(circle at 94% 4%, rgba(213, 167, 46, 0.24), transparent 30%);
  box-shadow: 0 30px 90px rgba(16, 24, 32, 0.32);
}

.share-modal-card h3 {
  color: #1b170f;
  font-size: clamp(1.65rem, 3.2vw, 2.5rem);
}

.share-modal-card > p:not(.eyebrow) {
  color: #415047;
  font-weight: 750;
}

.share-platform-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.share-platform-button {
  display: grid;
  gap: 0.2rem;
  min-height: 5.25rem;
  align-content: center;
  padding: 0.85rem;
  border: 1px solid rgba(31, 93, 77, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 248, 226, 0.84));
  color: #1b170f;
  text-align: left;
  box-shadow: 0 12px 28px rgba(31, 93, 77, 0.08);
}

.share-platform-button:hover,
.share-platform-button:focus-visible {
  border-color: rgba(213, 167, 46, 0.6);
  outline: none;
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(31, 93, 77, 0.12);
}

.share-platform-button strong {
  font-size: 1rem;
  font-weight: 950;
}

.share-platform-button span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.share-copy-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
  padding: 0.65rem;
  border: 1px solid rgba(31, 93, 77, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
}

.share-copy-panel input {
  width: 100%;
  border-color: rgba(31, 93, 77, 0.18);
  color: #1b170f;
  font-weight: 850;
}

.plan-upsell {
  display: grid;
  gap: 0.18rem;
  padding: 1.05rem 1.1rem;
  border: 2px solid rgba(213, 167, 46, 0.8);
  border-left-width: 7px;
  background-color: #ffe58f;
  background-image:
    linear-gradient(135deg, rgba(255, 245, 199, 0.98), rgba(255, 255, 255, 0.9) 52%, rgba(236, 250, 246, 0.9));
  color: #6d4a10;
  box-shadow: 0 16px 38px rgba(213, 167, 46, 0.26);
}

.plan-upsell strong {
  color: #7a5100;
  font-size: 1.1rem;
}

.plan-upsell span {
  color: #5f4a1b;
  font-weight: 850;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem 1.1rem;
  padding: 1.4rem 1rem 2rem;
  color: rgba(240, 248, 255, 0.76);
  font-size: 0.88rem;
  text-align: center;
}

.site-footer a {
  color: #cfe8ff;
  font-weight: 700;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.legal-page {
  width: min(54rem, calc(100% - 2rem));
  margin: 2rem auto;
  padding: 2rem;
}

.legal-page h1,
.legal-page h2 {
  color: var(--ink);
}

.legal-page h1 {
  margin-top: 0;
}

.legal-page h2 {
  margin-top: 1.4rem;
}

.legal-page p {
  color: var(--muted);
  line-height: 1.65;
}

@media (max-width: 900px) {
  .leaderboard-stage,
  .analytics-hero {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .analytics-grid,
  .test-entry-grid,
  .leaderboard-hub {
    grid-template-columns: 1fr;
  }

  .leaderboard-route:first-child {
    grid-column: auto;
    grid-template-columns: 1fr;
    grid-template-rows: 12rem auto auto auto;
    min-height: 22rem;
  }

  .leaderboard-route:first-child .route-visual,
  .leaderboard-route:first-child span,
  .leaderboard-route:first-child strong,
  .leaderboard-route:first-child small {
    grid-column: auto;
    grid-row: auto;
  }

  .wide-analytic,
  .analytics-grid .wide-rank,
  .analytics-grid .featured-rank-card {
    grid-column: auto;
  }

  .analytics-snapshot,
  .analytics-grid .average-grid,
  .analytics-grid .rank-summary-grid {
    grid-template-columns: 1fr;
  }

  .leaderboard-scroll {
    max-height: 34rem;
  }
}

@media (max-width: 560px) {
  .leaderboard-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .pagination-controls {
    justify-content: flex-start;
  }

  .leaderboard-hub {
    gap: 0.75rem;
  }

  .question-runner {
    min-height: 60rem;
    height: 60rem;
  }

  .question-runner .question {
    grid-template-rows: 8rem 16rem 24rem;
  }

  .question-visual {
    min-height: 16rem;
  }

  .question-runner .options,
  .question-runner .text-options {
    grid-template-columns: 1fr 1fr;
    min-height: 24rem;
  }

  .question-runner .option-shape,
  .text-option .option-shape {
    min-height: 6.8rem;
    max-height: 6.8rem;
  }

  .question-runner .text-question {
    grid-template-rows: 6rem 20rem 20rem;
  }

  .question-runner .text-options {
    min-height: 20rem;
  }

  .question-runner .text-option .option-shape {
    min-height: 4.8rem;
    max-height: none;
  }

  .question-runner .submit-row {
    grid-template-columns: 1fr 1fr;
  }

  .question-runner .submit-row button {
    width: 100%;
  }
}

/* White/gold theme pass */
:root {
  --ink: #1b170f;
  --muted: #756b5b;
  --line: rgba(129, 104, 45, 0.18);
  --paper: #fffdf7;
  --panel: rgba(255, 255, 255, 0.92);
  --blue: #c99a2e;
  --blue-dark: #8a6111;
  --teal: #b88a24;
  --amber: #d5a72e;
  --gold: #d5a72e;
  --accent-ink: #14352d;
  --accent-forest: #1f5d4d;
  --accent-forest-soft: rgba(31, 93, 77, 0.12);
  --shadow: 0 24px 70px rgba(84, 62, 18, 0.13);
}

body {
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255, 253, 247, 0.96), rgba(255, 246, 217, 0.88) 52%, rgba(255, 255, 255, 0.96)),
    url("assets/iqrank-background.png") center top / cover fixed;
}

.top-nav,
.panel,
.leaderboard-panel,
.analytics-hero,
.entry-card,
.quick-entry-card,
.test-panel,
.leaderboard-detail {
  border-color: rgba(129, 104, 45, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 252, 244, 0.92));
  box-shadow: 0 18px 48px rgba(84, 62, 18, 0.09);
}

.brand-mark {
  background: linear-gradient(135deg, #fff7d8, #d5a72e);
  color: var(--accent-ink);
  box-shadow: inset 0 0 0 1px rgba(20, 53, 45, 0.18), 0 12px 28px rgba(31, 93, 77, 0.14);
}

.brand h1,
.brand p {
  color: var(--ink);
}

.brand p,
.soft-note,
.panel p,
.rank-meta,
.score-chip span {
  color: var(--muted);
}

.nav-tabs,
.segmented,
.plan-toggle {
  border-color: rgba(129, 104, 45, 0.18);
  background: rgba(255, 250, 235, 0.82);
}

.nav-tab,
.segment {
  color: #6f5b2a;
}

.nav-tab.active,
.segment.active {
  color: var(--accent-ink);
  background: linear-gradient(135deg, #fff, #fff2bf);
  border-color: rgba(213, 167, 46, 0.55);
  box-shadow: 0 10px 28px rgba(31, 93, 77, 0.12);
}

.primary,
.test-header .primary {
  color: #211704;
  background: linear-gradient(135deg, #fff7d8, #d5a72e 54%, #b88419);
  box-shadow: 0 16px 38px rgba(213, 167, 46, 0.26);
}

.primary:hover {
  background: linear-gradient(135deg, #fff0b8, #c99a2e 54%, #926611);
}

.ghost {
  color: #2d2110;
  background: rgba(255, 255, 255, 0.86);
  border-color: rgba(129, 104, 45, 0.2);
}

.large-action {
  box-shadow: 0 18px 42px rgba(213, 167, 46, 0.22), 0 0 0 1px rgba(255, 255, 255, 0.32) inset;
}

.leaderboard-stage h2,
.stage-copy h2,
.analytics-hero h3,
.earn-hero h2 {
  color: var(--accent-ink);
}

.leaderboard-route {
  border-color: rgba(129, 104, 45, 0.16);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 251, 240, 0.92));
  box-shadow: 0 16px 40px rgba(84, 62, 18, 0.09);
}

.leaderboard-route span,
.plan-card em {
  color: var(--accent-ink);
  background: linear-gradient(135deg, rgba(255, 240, 184, 0.82), var(--accent-forest-soft));
}

.leaderboard-route strong,
.rank-name,
.score-chip strong,
.plan-card .plan-label,
.plan-card strong {
  color: #1b170f;
}

.optional-field {
  margin-left: 0.35rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.field-hint {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.rank-affiliation {
  margin-top: 0.22rem;
  overflow: hidden;
  color: var(--accent-ink);
  font-size: 0.76rem;
  font-weight: 750;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.university-standing-row {
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.university-standing-row:hover,
.university-standing-row:focus-visible {
  border-color: rgba(213, 167, 46, 0.58);
  box-shadow: 0 14px 34px rgba(31, 93, 77, 0.12);
  outline: none;
  transform: translateY(-1px);
}

.university-all-button {
  align-self: end;
  min-height: 3rem;
}

.leaderboard-route.active,
.plan-card.active {
  border-color: rgba(213, 167, 46, 0.62);
  box-shadow: 0 18px 46px rgba(31, 93, 77, 0.13);
}

.route-visual {
  background-color: #fff2bf;
  filter: saturate(0.82) sepia(0.12) brightness(1.04);
}

.rank-row,
.average-card,
.rank-card,
.domain-card,
.metric-grid div,
.feature-compare,
.insight-mini,
.analytic-card,
.earn-step,
.earn-card {
  border-color: rgba(129, 104, 45, 0.14);
  background: linear-gradient(180deg, #fff, #fffdf7);
  box-shadow: 0 10px 28px rgba(84, 62, 18, 0.06);
}

.rank-row:nth-child(1),
.featured-rank-card,
.earn-card.featured {
  background: linear-gradient(135deg, #fff7d8, #fff, #fffaf0);
  color: #1b170f;
  border-left: 4px solid var(--accent-forest);
}

.rank-score,
.insight-mini strong,
.domain-card strong,
.rank-card strong,
.average-card strong {
  color: #8a6111;
}

.progress-track span,
.histogram-bar,
.referral-progress span,
.reveal-curve-fill {
  background: linear-gradient(90deg, #fff0b8, #d5a72e, var(--accent-forest));
}

.mean-marker {
  background: #1b170f;
}

.score-marker {
  background: var(--accent-forest);
}

.directory-controls {
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
}

.directory-search-label {
  min-width: min(22rem, 100%);
}

.analytics-hero {
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.95), rgba(255, 246, 217, 0.9)),
    url("https://images.unsplash.com/photo-1516321318423-f06f85e504b3?auto=format&fit=crop&w=1200&q=75") center / cover;
}

.insight-hero-result.certificate-style-result {
  border-color: rgba(213, 167, 46, 0.42);
  background:
    radial-gradient(circle at 88% 18%, rgba(213, 167, 46, 0.2), transparent 28%),
    linear-gradient(135deg, #ffffff, #fff7d8 54%, #fffdf7);
  color: #1b170f;
}

.insight-hero-result.certificate-style-result .eyebrow,
.insight-hero-result.certificate-style-result p,
.insight-hero-result.certificate-style-result small,
.insight-hero-result.certificate-style-result h3 {
  color: #1b170f;
}

.insight-hero-result.certificate-style-result .result-ring {
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.98) 0 58%, transparent 59%),
    conic-gradient(from -90deg, #d5a72e var(--iq-progress, 0deg), rgba(129, 104, 45, 0.16) 0 360deg);
  box-shadow: 0 22px 58px rgba(213, 167, 46, 0.18), 0 0 0 1px rgba(129, 104, 45, 0.12);
}

.earn-teaser,
.referral-panel {
  border-color: rgba(213, 167, 46, 0.28);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(255, 248, 226, 0.94) 58%, rgba(255, 255, 255, 0.94));
}

.earn-hero {
  min-height: 21rem;
  border-color: rgba(31, 93, 77, 0.2);
  background:
    radial-gradient(circle at 88% 14%, rgba(31, 93, 77, 0.14), transparent 28%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(255, 246, 217, 0.94) 52%, rgba(255, 255, 255, 0.96));
  color: #1b170f;
}

.earn-hero .eyebrow,
.earn-hero p,
.earn-hero small {
  color: var(--muted);
}

.earn-hero h2 {
  max-width: 13ch;
  color: #1b170f;
  font-size: clamp(2.4rem, 6vw, 5rem);
}

.earn-hero-card {
  border-color: rgba(31, 93, 77, 0.26);
  border-left: 5px solid var(--accent-forest);
  background: linear-gradient(180deg, #fff, #fff5cf 62%, rgba(31, 93, 77, 0.08));
  box-shadow: 0 20px 48px rgba(31, 93, 77, 0.12);
}

.earn-step span {
  color: #211704;
  background: linear-gradient(135deg, #fff7d8, #d5a72e);
}

.result-reveal {
  background:
    linear-gradient(135deg, rgba(255, 253, 247, 0.82), rgba(213, 167, 46, 0.18)),
    rgba(27, 23, 15, 0.26);
}

.result-reveal-card {
  color: #1b170f;
  background:
    radial-gradient(circle at 84% 8%, rgba(213, 167, 46, 0.2), transparent 26%),
    linear-gradient(135deg, #ffffff, #fff7d8 58%, #fffdf7);
  box-shadow: 0 30px 90px rgba(84, 62, 18, 0.2);
}

.result-reveal-card .eyebrow,
.result-reveal-card p,
.reveal-rank-card span,
.reveal-rank-card small,
.reveal-graph-head,
.reveal-referral span {
  color: var(--muted);
}

.result-reveal-card h3,
.reveal-rank-card strong,
.reveal-graph-head strong,
.reveal-referral strong {
  color: #1b170f;
}

.reveal-score-stage {
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.98) 0 58%, transparent 59%),
    conic-gradient(from -90deg, #d5a72e 0 var(--reveal-progress, 0deg), rgba(129, 104, 45, 0.14) var(--reveal-progress, 0deg) 360deg);
  box-shadow: 0 24px 70px rgba(213, 167, 46, 0.2), 0 0 0 1px rgba(129, 104, 45, 0.16);
}

.reveal-rank-card,
.reveal-graph,
.reveal-referral {
  border-color: rgba(129, 104, 45, 0.16);
  background: rgba(255, 255, 255, 0.68);
}

.leaderboard-stage,
.analytics-hero,
.earn-hero,
.leaderboard-detail {
  border-top: 3px solid rgba(31, 93, 77, 0.2);
}

.reveal-referral {
  border-color: rgba(31, 93, 77, 0.24);
  border-left: 6px solid var(--accent-forest);
  background:
    linear-gradient(135deg, rgba(255, 248, 226, 0.96), rgba(255, 255, 255, 0.86) 54%, rgba(31, 93, 77, 0.1));
  box-shadow: 0 16px 36px rgba(31, 93, 77, 0.1);
}

.reveal-referral input,
.referral-link-row input {
  border-color: rgba(31, 93, 77, 0.22);
  box-shadow: inset 0 0 0 1px rgba(31, 93, 77, 0.08);
}

#revealReferralButton,
#shareReferralButton,
#earnCopyHeroButton {
  color: #fff;
  border-color: rgba(20, 53, 45, 0.32);
  background: linear-gradient(135deg, var(--accent-ink), var(--accent-forest));
  box-shadow: 0 14px 32px rgba(31, 93, 77, 0.18);
}

.top-nav {
  color: var(--accent-ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 250, 235, 0.94));
  border-color: rgba(31, 93, 77, 0.18);
}

.top-nav .brand h1,
.top-nav .brand p,
.top-nav .nav-tab {
  color: var(--accent-ink);
}

.top-nav .brand p {
  opacity: 0.78;
}

.site-footer {
  color: #4f493d;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 253, 247, 0.76));
  text-shadow: none;
}

.site-footer a {
  color: var(--accent-ink);
  font-weight: 900;
  text-decoration-color: rgba(213, 167, 46, 0.5);
  text-underline-offset: 0.2rem;
}

.site-footer a:hover {
  color: #8a6111;
}

.analytics-hero {
  border-color: rgba(31, 93, 77, 0.28);
  border-left: 6px solid var(--accent-forest);
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.98), rgba(255, 246, 217, 0.94) 45%, rgba(31, 93, 77, 0.12)),
    url("https://images.unsplash.com/photo-1516321318423-f06f85e504b3?auto=format&fit=crop&w=1200&q=75") center / cover;
  box-shadow: 0 22px 58px rgba(31, 93, 77, 0.12);
}

.analytics-hero .eyebrow {
  color: #8a6111;
}

.analytics-snapshot span {
  border-color: rgba(31, 93, 77, 0.2);
  background: linear-gradient(180deg, #ffffff, rgba(255, 248, 226, 0.9));
  box-shadow: inset 0 -3px 0 rgba(31, 93, 77, 0.12);
}

.analytics-snapshot b {
  color: var(--accent-forest);
}

.insight-strip {
  gap: 1rem;
}

.insight-mini {
  border-top: 4px solid rgba(31, 93, 77, 0.28);
}

.insight-mini:nth-child(2) {
  border-top-color: rgba(213, 167, 46, 0.62);
}

.insight-mini:nth-child(3) {
  border-top-color: rgba(20, 53, 45, 0.44);
}

.insight-mini strong {
  color: var(--accent-forest);
}

.primary-insight-panel {
  border-color: rgba(31, 93, 77, 0.22);
  border-left: 6px solid var(--accent-forest);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 253, 247, 0.94)),
    linear-gradient(135deg, rgba(31, 93, 77, 0.12), rgba(213, 167, 46, 0.14));
}

.share-reward-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  margin: 0.95rem 0 1rem;
  padding: 1rem;
  border: 1px solid rgba(31, 93, 77, 0.2);
  border-left: 6px solid var(--accent-forest);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 248, 226, 0.98), rgba(255, 255, 255, 0.94) 50%, rgba(31, 93, 77, 0.11)),
    radial-gradient(circle at 96% 12%, rgba(213, 167, 46, 0.22), transparent 34%);
  box-shadow: 0 18px 48px rgba(31, 93, 77, 0.1);
}

.share-reward-card h3 {
  margin: 0.15rem 0 0.25rem;
  color: #1b170f;
  font-size: clamp(1.15rem, 2vw, 1.55rem);
}

.share-reward-card p:not(.eyebrow) {
  max-width: 46rem;
  color: #415047;
  font-weight: 750;
}

.share-reward-card.reward-claimed {
  border-left-color: #d5a72e;
  background:
    linear-gradient(135deg, rgba(255, 240, 184, 0.98), rgba(255, 255, 255, 0.94) 52%, rgba(213, 167, 46, 0.14));
}

.share-reward-card.reward-used {
  border-left-color: rgba(101, 113, 122, 0.55);
  background: rgba(255, 255, 255, 0.8);
}

.reveal-free-retake {
  grid-template-columns: minmax(0, 1fr) auto;
  border-color: rgba(213, 167, 46, 0.28);
  border-left-color: #d5a72e;
  background:
    linear-gradient(135deg, rgba(255, 240, 184, 0.97), rgba(255, 255, 255, 0.88) 56%, rgba(31, 93, 77, 0.1));
}

.analytic-card {
  position: relative;
  overflow: hidden;
  border-color: rgba(31, 93, 77, 0.2);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 253, 247, 0.94));
  box-shadow: 0 18px 46px rgba(31, 93, 77, 0.08);
}

.analytic-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 0.28rem;
  background: linear-gradient(90deg, var(--accent-forest), #d5a72e);
}

.analytic-card:nth-child(even)::before {
  background: linear-gradient(90deg, #d5a72e, var(--accent-forest));
}

.analytic-card-head {
  position: relative;
  border-bottom-color: rgba(31, 93, 77, 0.16);
}

.analytic-card-head .eyebrow,
.analytic-card > .eyebrow {
  color: #8a6111;
}

.analytics-grid .board-distribution,
.distribution-card {
  border-color: rgba(31, 93, 77, 0.16);
  background:
    linear-gradient(180deg, #ffffff, #fffdf7),
    linear-gradient(135deg, rgba(31, 93, 77, 0.08), rgba(213, 167, 46, 0.1));
}

.analytics-grid .rank-card,
.analytics-grid .average-card,
.domain-card,
.metric-grid div {
  border-color: rgba(31, 93, 77, 0.16);
  background:
    linear-gradient(180deg, #ffffff, rgba(255, 248, 226, 0.48));
}

.analytics-grid .rank-card strong,
.analytics-grid .average-card strong,
.domain-card strong,
.metric-grid strong {
  color: var(--accent-forest);
}

.celebrity-leaderboard-panel {
  border-color: rgba(31, 93, 77, 0.24);
  border-left: 6px solid var(--accent-forest);
  background:
    radial-gradient(circle at 94% 10%, rgba(213, 167, 46, 0.2), transparent 24%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(255, 247, 216, 0.93) 52%, rgba(31, 93, 77, 0.08));
  box-shadow: 0 20px 52px rgba(31, 93, 77, 0.1);
}

.celebrity-leaderboard-panel .eyebrow {
  color: #8a6111;
}

.celebrity-leaderboard-panel .rank-row:nth-child(1) {
  border-color: rgba(31, 93, 77, 0.28);
  background:
    linear-gradient(135deg, rgba(255, 247, 216, 0.98), rgba(255, 255, 255, 0.94)),
    linear-gradient(90deg, rgba(31, 93, 77, 0.14), transparent);
}

/* Phone layout final pass */
@media (max-width: 760px) {
  body {
    background-attachment: scroll;
  }

  .hero-panel {
    padding: 0.75rem 0.75rem 1.1rem;
  }

  .top-nav {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.8rem;
    padding: 0.65rem;
  }

  .brand {
    min-width: 0;
  }

  .brand-mark {
    width: 2.65rem;
    height: 2.65rem;
  }

  .brand h1 {
    font-size: 1.02rem;
  }

  .brand p {
    font-size: 0.82rem;
  }

  .nav-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .nav-tab {
    min-height: 2.55rem;
    padding: 0.35rem 0.45rem;
    font-size: 0.84rem;
  }

  .workspace {
    padding: 0 0.75rem 2rem;
  }

  .leaderboard-stage {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.85rem;
    margin-bottom: 0.85rem;
  }

  .stage-copy h2 {
    font-size: 2.15rem;
    line-height: 1;
  }

  .large-action {
    width: 100%;
    min-height: 3.6rem;
    padding: 0.7rem 1rem;
    font-size: 0.92rem;
    letter-spacing: 0.02em;
    white-space: normal;
  }

  .panel,
  .entry-card {
    padding: 0.85rem;
  }

  .leaderboard-head,
  .directory-actions,
  .result-actions {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .score-chip {
    width: 100%;
  }

  .filter-grid {
    grid-template-columns: 1fr;
    gap: 0.7rem;
  }

  input,
  select,
  .search-select-control {
    min-height: 2.85rem;
  }

  .leaderboard-context {
    gap: 0.45rem;
  }

  .leaderboard-context span {
    width: 100%;
    border-radius: 8px;
  }

  .leaderboard-scroll {
    max-height: 62svh;
    padding-right: 0;
  }

  .rank-row {
    grid-template-columns: 2.45rem minmax(0, 1fr) 3.35rem;
    gap: 0.5rem;
    min-height: 4rem;
    padding: 0.65rem;
  }

  .rank {
    font-size: 0.9rem;
  }

  .rank-name {
    white-space: normal;
    line-height: 1.2;
  }

  .rank-meta {
    font-size: 0.74rem;
    line-height: 1.28;
  }

  .rank-affiliation {
    font-size: 0.7rem;
    white-space: normal;
  }

  .rank-score {
    font-size: 1rem;
  }

  .leaderboard-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .pagination-controls {
    justify-content: flex-start;
  }

  .pagination-controls .ghost {
    min-width: 2.45rem;
  }

  .leaderboard-hub {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .leaderboard-route,
  .leaderboard-route:first-child {
    grid-column: auto;
    grid-template-columns: 1fr;
    grid-template-rows: 9rem auto auto auto;
    min-height: 17rem;
    padding: 0.75rem;
  }

  .leaderboard-route:first-child .route-visual,
  .leaderboard-route:first-child span,
  .leaderboard-route:first-child strong,
  .leaderboard-route:first-child small {
    grid-column: auto;
    grid-row: auto;
  }

  .route-visual,
  .leaderboard-route:first-child .route-visual {
    min-height: 9rem;
  }

  .leaderboard-route strong {
    font-size: 1.2rem;
  }

  .directory-back {
    width: 100%;
    min-height: 3rem;
  }

  .directory-controls {
    display: grid;
    grid-template-columns: 1fr;
  }

  .directory-controls label {
    min-width: 0;
  }

  .plan-cards {
    grid-template-columns: 1fr;
  }

  .plan-card {
    min-height: 0;
    padding: 0.95rem;
  }

  .plan-card.active::after {
    top: 0.75rem;
    right: 0.75rem;
  }

  .feature-compare {
    overflow-x: auto;
    padding-bottom: 0.8rem;
  }

  .feature-compare div {
    min-width: 38rem;
  }

  .test-spec,
  .metric-grid,
  .domain-grid,
  .rank-summary-grid,
  .average-grid {
    grid-template-columns: 1fr;
  }

  .test-header {
    grid-template-columns: 1fr;
  }

  .timer,
  .test-header .primary {
    width: 100%;
  }

  .question-runner {
    width: 100%;
    min-height: auto;
    height: auto;
    padding-bottom: 0.25rem;
  }

  .question-runner .question,
  .question-runner .text-question {
    grid-template-rows: auto minmax(14rem, auto) auto;
    overflow: visible;
  }

  .question-title {
    display: grid;
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .question-visual {
    min-height: 14rem;
  }

  .matrix,
  .spatial-stage {
    width: min(17rem, 100%);
    min-height: 14rem;
    max-height: none;
  }

  .diagram-matrix {
    width: min(18rem, 100%);
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .diagram-equation {
    width: 100%;
  }

  .equation-row {
    grid-template-columns: minmax(3.25rem, 1fr) auto minmax(3.25rem, 1fr) auto minmax(3.25rem, 1fr);
    gap: 0.3rem;
    font-size: 1rem;
  }

  .equation-row .diagram-svg,
  .diagram-matrix .diagram-svg,
  .diagram-placeholder {
    max-height: 4.6rem;
  }

  .question-runner .options,
  .question-runner .text-options {
    grid-template-columns: 1fr 1fr;
    min-height: 0;
  }

  .question-runner .option-shape,
  .text-option .option-shape {
    min-height: 5.8rem;
    max-height: none;
  }

  .text-question-prompt {
    max-height: none;
    font-size: 1rem;
  }

  .question-runner .submit-row {
    grid-template-columns: 1fr 1fr;
  }

  .question-runner .submit-row button {
    width: 100%;
  }

  .analytics-hero {
    grid-template-columns: 1fr;
  }

  .analytics-snapshot {
    grid-template-columns: 1fr;
    min-width: 0;
  }

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

  .wide-analytic,
  .analytics-grid .wide-rank,
  .analytics-grid .featured-rank-card {
    grid-column: auto;
  }

  .distribution-row {
    grid-template-columns: 1fr;
  }

  .histogram {
    height: 6.6rem;
  }

  .result-panel,
  .certificate-style-result {
    display: grid;
    grid-template-columns: 1fr;
    text-align: left;
  }

  .result-ring {
    width: 7.5rem;
    height: 7.5rem;
    border-width: 0.65rem;
  }

  .result-reveal-card > strong {
    font-size: 4rem;
  }

  .certificate-preview-card {
    max-height: calc(100svh - 2rem);
    overflow: auto;
  }
}

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

  .nav-tab:last-child {
    grid-column: span 2;
  }

  .stage-copy h2 {
    font-size: 1.85rem;
  }

  .rank-row {
    grid-template-columns: 2.25rem minmax(0, 1fr);
  }

  .rank-score {
    grid-column: 2;
    text-align: left;
  }

  .question-runner .options,
  .question-runner .text-options {
    grid-template-columns: 1fr;
  }
}

/* Absolute final palette override */
:root {
  --ink: #071a35;
  --muted: #586272;
  --line: rgba(7, 26, 53, 0.14);
  --blue: #173f8a;
  --blue-dark: #071a35;
  --teal: #1d4ed8;
  --gold: #b98b2d;
  --accent-ink: #071a35;
  --accent-forest: #173f8a;
  --accent-forest-soft: rgba(23, 63, 138, 0.1);
  --shadow: 0 24px 72px rgba(7, 26, 53, 0.15);
}

body {
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(246, 249, 255, 0.82), rgba(234, 241, 252, 0.72) 44%, rgba(248, 251, 255, 0.84)),
    url("assets/iqrank-background.png") center top / cover fixed;
}

.brand-mark,
.primary,
.test-header .primary,
.nav-tab.active,
.segment.active {
  color: #fff;
  background: linear-gradient(135deg, #071a35 0%, #173f8a 58%, #1d4ed8 100%);
}

.top-nav,
.panel,
.leaderboard-panel,
.analytics-hero,
.entry-card,
.quick-entry-card,
.test-panel,
.leaderboard-detail {
  border-color: var(--line);
  background: linear-gradient(180deg, rgba(248, 251, 255, 0.94), rgba(242, 247, 255, 0.88));
  box-shadow: var(--shadow);
}

.top-nav {
  border-top: 4px solid rgba(7, 26, 53, 0.72);
}

.brand h1,
.brand p,
.top-nav .brand h1,
.top-nav .brand p,
.top-nav .nav-tab,
.leaderboard-route strong,
.rank-name,
.score-chip strong,
.plan-card .plan-label,
.plan-card strong {
  color: var(--accent-ink);
}

.nav-tabs,
.segmented,
.plan-toggle {
  border-color: rgba(15, 23, 42, 0.1);
  background: rgba(232, 239, 251, 0.88);
}

.primary:hover {
  background: linear-gradient(135deg, #06142a 0%, #12336f 58%, #173f8a 100%);
}

.plan-upsell,
.share-reward-card,
.reveal-free-retake,
.earn-hero-card {
  border-color: rgba(211, 154, 22, 0.34);
  border-left-color: var(--gold);
  background: linear-gradient(135deg, rgba(255, 250, 235, 0.98), rgba(255, 255, 255, 0.94) 54%, rgba(15, 118, 110, 0.08));
}

.leaderboard-route {
  border-color: rgba(15, 23, 42, 0.1);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.92));
}

.leaderboard-route span,
.plan-card em {
  color: #173f8a;
  background: rgba(23, 63, 138, 0.1);
}

.leaderboard-route small {
  color: #506174;
}

.leaderboard-route:hover,
.leaderboard-route.active,
.plan-card.active {
  border-color: rgba(29, 78, 216, 0.38);
  box-shadow: 0 20px 52px rgba(29, 78, 216, 0.13);
}

.rank-score,
.insight-mini strong,
.domain-card strong,
.rank-card strong,
.average-card strong,
.analytics-snapshot b {
  color: var(--teal);
}

.progress-track span,
.histogram-bar,
.referral-progress span,
.reveal-curve-fill {
  background: linear-gradient(90deg, #071a35, #173f8a, #1d4ed8);
}

.analytics-hero,
.primary-insight-panel,
.celebrity-leaderboard-panel,
.earn-hero,
.leaderboard-detail {
  border-left-color: #173f8a;
  border-top-color: rgba(29, 78, 216, 0.18);
}

.result-reveal-card,
.insight-hero-result.certificate-style-result {
  background:
    radial-gradient(circle at 88% 12%, rgba(211, 154, 22, 0.16), transparent 28%),
    linear-gradient(135deg, #ffffff, #f8faf7 58%, #ecf7f5);
}

.result-reveal {
  background:
    linear-gradient(135deg, rgba(11, 18, 32, 0.52), rgba(15, 118, 110, 0.22)),
    rgba(11, 18, 32, 0.36);
}

.reveal-score-stage,
.insight-hero-result.certificate-style-result .result-ring {
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.98) 0 58%, transparent 59%),
    conic-gradient(from -90deg, #1d4ed8 0 var(--reveal-progress, var(--iq-progress, 0deg)), rgba(15, 23, 42, 0.12) var(--reveal-progress, var(--iq-progress, 0deg)) 360deg);
}
