:root {
  --paper: #f7f3ec;
  --paper-deep: #eee7dc;
  --sheet: #fffdf8;
  --ink: #201c19;
  --navy: #263b4b;
  --muted: #716a63;
  --line: #ddd4c7;
  --gold: #a88943;
  --terracotta: #c96f51;
  --terracotta-dark: #a8543c;
  --rose-wash: #f5e8e1;
  --blue-wash: #e8eef1;
  --shadow: 0 24px 70px rgb(67 51 37 / 10%);
  --serif: "Noto Serif KR", "AppleMyungjo", "Batang", serif;
  --sans: "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 8% 12%, rgb(185 151 103 / 7%), transparent 27rem),
    linear-gradient(180deg, #faf7f1 0, var(--paper) 46rem);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: break-word;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

button {
  color: inherit;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  background: var(--ink);
  color: white;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: none;
}

:focus-visible {
  outline: 3px solid rgb(201 111 81 / 35%);
  outline-offset: 3px;
}

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid rgb(221 212 199 / 76%);
  background: rgb(250 247 241 / 88%);
  backdrop-filter: blur(16px);
}

.header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: min(1180px, calc(100% - 48px));
  min-height: 76px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  width: max-content;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  border: 1px solid var(--terracotta);
  border-radius: 50%;
  color: var(--terracotta);
  font-family: var(--serif);
  font-size: 18px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: var(--serif);
  font-size: 15px;
}

.brand small {
  margin-top: -2px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .08em;
}

.main-nav {
  display: flex;
  gap: 32px;
  font-size: 14px;
}

.main-nav a,
.header-app-link {
  text-decoration: none;
}

.main-nav a:hover {
  color: var(--terracotta);
}

.header-app-link {
  justify-self: end;
  padding: 9px 16px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.hero {
  display: grid;
  grid-template-columns: 1.07fr .93fr;
  gap: clamp(64px, 9vw, 138px);
  align-items: center;
  width: min(1080px, calc(100% - 48px));
  min-height: 680px;
  margin: 0 auto;
  padding: 86px 0 110px;
}

.eyebrow,
.section-number,
.results-kicker {
  margin: 0 0 22px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .15em;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 14px;
}

.eyebrow::before {
  width: 48px;
  height: 1px;
  background: var(--gold);
  content: "";
}

.hero h1 {
  margin: 0;
  color: var(--navy);
  font-family: var(--serif);
  font-size: clamp(46px, 5vw, 68px);
  font-weight: 600;
  letter-spacing: -.055em;
  line-height: 1.28;
}

.hero h1 em {
  color: var(--terracotta);
  font-style: normal;
}

.hero-description {
  max-width: 540px;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.9;
  word-break: keep-all;
}

.hero-actions {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-top: 38px;
}

.button {
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  padding: 0 22px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  transition: transform .18s ease, background .18s ease, color .18s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: var(--terracotta);
  color: white;
  box-shadow: 0 10px 24px rgb(201 111 81 / 18%);
}

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

.button-secondary {
  border: 1px solid var(--line);
  background: var(--sheet);
}

.button-text {
  background: transparent;
  color: var(--navy);
  box-shadow: none;
}

.hero-note {
  color: var(--muted);
  font-size: 12px;
}

.hero-note {
  margin: 15px 0 0;
}

.hero-sheet {
  position: relative;
  width: min(100%, 430px);
  min-height: 500px;
  justify-self: end;
  padding: 36px 42px;
  border: 1px solid #d7c9b5;
  background: var(--sheet);
  box-shadow: var(--shadow);
}

.hero-sheet::before {
  position: absolute;
  z-index: -1;
  inset: 13px -13px -13px 13px;
  border: 1px solid #ded4c8;
  background: #f2ede5;
  content: "";
}

.sheet-topline {
  display: flex;
  justify-content: space-between;
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: 10px;
  letter-spacing: .15em;
}

.sheet-name {
  display: flex;
  gap: 9px;
  justify-content: center;
  margin-top: 86px;
}

.sheet-name span {
  display: grid;
  width: 74px;
  height: 74px;
  place-items: center;
  border: 1px solid #cfbea4;
  color: var(--navy);
  font-family: var(--serif);
  font-size: 38px;
}

.sheet-name .surname {
  border-color: #d6cfc6;
  color: var(--muted);
}

.sheet-rule {
  width: 38px;
  height: 1px;
  margin: 46px auto 32px;
  background: var(--gold);
}

.sheet-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0;
}

.sheet-facts div {
  text-align: center;
}

.sheet-facts div + div {
  border-left: 1px solid var(--line);
}

.sheet-facts dt {
  color: var(--muted);
  font-size: 10px;
}

.sheet-facts dd {
  margin: 4px 0 0;
  color: var(--navy);
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 700;
}

.sheet-caption {
  margin-top: 42px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 12px;
  text-align: center;
}

.lab-stamp {
  display: grid;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 50%;
  color: var(--terracotta);
  font-family: var(--serif);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  transform: rotate(-8deg);
}

.lab-stamp {
  position: absolute;
  right: 35px;
  bottom: 30px;
  width: 62px;
  height: 62px;
}

.exploration-section {
  scroll-margin-top: 76px;
  padding: 72px 24px 125px;
  background: #eee7dd;
}

.exploration-heading {
  width: min(1080px, 100%);
  margin: 0 auto;
}

.exploration-heading h1 {
  margin: 0;
  color: var(--navy);
  font-family: var(--serif);
  font-size: clamp(42px, 5vw, 64px);
  font-weight: 600;
  letter-spacing: -.05em;
  line-height: 1.28;
}

.exploration-heading h1 strong {
  font-weight: 700;
}

.exploration-heading h1 em {
  color: var(--terracotta);
  font-style: normal;
}

.exploration-heading > p:last-child {
  max-width: 650px;
  margin: 16px 0 0;
  color: var(--muted);
}

.exploration-chooser {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  width: min(1080px, 100%);
  margin: 46px auto 0;
}

.exploration-choice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: center;
  min-height: 172px;
  padding: 26px 24px;
  border: 1px solid var(--line);
  background: var(--sheet);
  color: inherit;
  cursor: pointer;
  text-decoration: none;
  text-align: left;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.exploration-choice:hover,
.exploration-choice:focus-visible,
.exploration-choice.is-active {
  border-color: var(--terracotta);
  box-shadow: 0 16px 36px rgb(72 58 46 / 9%);
  transform: translateY(-3px);
}

.exploration-choice.is-active {
  background: #fffaf4;
}

.choice-number {
  align-self: start;
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: 11px;
  letter-spacing: .12em;
}

.exploration-choice strong,
.exploration-choice small {
  display: block;
}

.exploration-choice strong {
  color: var(--navy);
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1.45;
}

.exploration-choice small {
  margin-top: 12px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.75;
  word-break: keep-all;
}

.exploration-panel {
  width: min(1080px, 100%);
  margin: 48px auto 0;
  scroll-margin-top: 96px;
}

.js .exploration-panel {
  display: none;
}

.js .exploration-panel.is-active {
  display: block;
}

.exploration-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.exploration-mode-bar span {
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
}

.exploration-mode-bar h3 {
  margin: 5px 0 0;
  color: var(--navy);
  font-family: var(--serif);
  font-size: 26px;
}

.exploration-mode-bar button {
  padding: 9px 14px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}

.search-section {
  padding: 0;
}

.section-heading {
  width: min(1080px, 100%);
  margin: 0 auto 46px;
}

.section-heading h2,
.discovery-copy h2,
.final-paper h2 {
  margin: 0;
  color: var(--navy);
  font-family: var(--serif);
  font-size: clamp(34px, 4vw, 48px);
  font-weight: 600;
  letter-spacing: -.04em;
  line-height: 1.35;
}

.section-heading > p:last-child {
  max-width: 610px;
  margin: 16px 0 0;
  color: var(--muted);
}

.search-workspace {
  display: grid;
  grid-template-columns: 370px minmax(0, 1fr);
  gap: 20px;
  width: min(1080px, 100%);
  margin: 0 auto;
}

.search-panel,
.results-panel {
  border: 1px solid var(--line);
  background: var(--sheet);
  box-shadow: 0 12px 36px rgb(72 58 46 / 7%);
}

.search-panel {
  padding: 26px;
}

.form-intro,
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-intro {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.form-intro strong {
  font-family: var(--serif);
  font-size: 20px;
}

.reset-button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.reset-button {
  color: var(--muted);
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.field-group {
  min-width: 0;
  margin: 24px 0 0;
  padding: 0;
  border: 0;
}

.field-group legend,
.field > span:first-child {
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
}

.field small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
}

.app-filter-field small {
  margin-left: 4px;
  color: var(--terracotta-dark);
  font-size: 9px;
  letter-spacing: .1em;
}

.app-filter-options {
  display: grid;
  gap: 7px;
  margin-top: 11px;
}

.app-filter-options a {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 11px;
  align-items: center;
  width: 100%;
  padding: 12px;
  border: 1px solid #ded4c7;
  border-radius: 7px;
  background: linear-gradient(110deg, #fbf8f2, #f3e9df);
  color: var(--navy);
  cursor: pointer;
  text-align: left;
  text-decoration: none;
}

.app-filter-options a:hover,
.app-filter-options a:focus-visible {
  border-color: var(--terracotta);
  box-shadow: 0 8px 20px rgb(166 91 55 / 10%);
  transform: translateY(-1px);
}

.filter-lock {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid #d7c7b7;
  border-radius: 50%;
  color: var(--terracotta-dark);
  font-family: Georgia, serif;
}

.app-filter-options strong,
.app-filter-options small {
  display: block;
}

.app-filter-options strong {
  font-size: 12px;
}

.app-filter-options small {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0;
}

.app-filter-options em {
  color: var(--terracotta-dark);
  font-size: 9px;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-top: 10px;
  padding: 4px;
  border-radius: 8px;
  background: #f1ede6;
}

.segmented-control label {
  cursor: pointer;
}

.segmented-control input {
  position: absolute;
  opacity: 0;
}

.segmented-control span {
  display: grid;
  min-height: 40px;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
}

.segmented-control input:checked + span {
  background: var(--sheet);
  color: var(--terracotta);
  font-weight: 700;
  box-shadow: 0 2px 9px rgb(53 42 34 / 8%);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 22px;
}

.field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
}

.input-shell,
.select-shell {
  display: flex;
  min-height: 46px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
}

.input-shell:focus-within,
.select-shell:focus-within {
  border-color: var(--terracotta);
  box-shadow: 0 0 0 3px rgb(201 111 81 / 10%);
}

.input-shell input,
.select-shell select {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.short-input input {
  height: 46px;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
}

.short-input {
  min-height: 48px;
}

.field-help {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.rank-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
}

.rank-presets button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
}

.rank-presets button.is-active {
  border-color: var(--terracotta);
  background: var(--rose-wash);
  color: var(--terracotta-dark);
}

.rank-inputs {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  margin-top: 13px;
  color: var(--muted);
  font-size: 12px;
}

.rank-inputs label {
  flex: 1;
}

.rank-inputs label span {
  display: block;
  margin-bottom: 3px;
  font-size: 10px;
}

.rank-inputs input {
  width: 100%;
  height: 40px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.search-submit {
  width: 100%;
  margin-top: 28px;
}

.results-panel {
  padding: 30px;
}

.results-kicker {
  margin-bottom: 3px;
}

.results-header h2,
.results-header h3 {
  margin: 0;
  color: var(--navy);
  font-family: var(--serif);
  font-size: 21px;
}

.search-status,
.search-error {
  margin: 14px 0 0;
  font-size: 12px;
  line-height: 1.6;
}

.search-status {
  color: var(--muted);
}

.search-error {
  padding: 10px 12px;
  border-left: 3px solid var(--terracotta);
  background: var(--rose-wash);
  color: var(--terracotta-dark);
}

.search-error[hidden],
.pagination[hidden] {
  display: none;
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 20px 0;
}

.active-filters > span {
  display: inline-flex;
  min-height: 31px;
  gap: 7px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--rose-wash);
  color: var(--terracotta-dark);
  font-size: 11px;
}

.active-filters button {
  min-width: 22px;
  min-height: 22px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

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

.name-result-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 18px 16px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fffefa;
  color: inherit;
  text-decoration: none;
  transition: border-color 160ms ease, transform 160ms ease;
}

.name-result-card:hover,
.name-result-card:focus-visible {
  border-color: var(--terracotta);
  transform: translateY(-2px);
}

.result-main {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.result-name {
  display: flex;
  align-items: baseline;
  color: var(--navy);
  font-family: var(--serif);
}

.result-name small {
  margin-right: 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.result-name strong {
  font-size: 24px;
}

.result-tags {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.result-meta {
  margin-top: 16px;
  display: flex;
  color: var(--muted);
  font-size: 9px;
}

.pagination {
  display: flex;
  gap: 5px;
  justify-content: center;
  margin-top: 24px;
}

.pagination button {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  cursor: pointer;
  font-size: 11px;
}

.pagination button.current {
  border-color: var(--navy);
  background: var(--navy);
  color: white;
}

.pagination button:disabled {
  cursor: not-allowed;
  opacity: .35;
}

.search-submit:disabled,
#next-random-name:disabled {
  cursor: wait;
  opacity: .65;
}

.discovery-status {
  min-height: 20px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.results-app-note {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  margin-top: 22px;
  padding: 15px 16px;
  border: 1px solid #dec8bc;
  background: #faf0ea;
}

.mini-stamp {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--terracotta);
  border-radius: 50%;
  color: var(--terracotta);
  font-family: Georgia, serif;
  font-size: 9px;
}

.results-app-note strong {
  display: block;
  font-family: var(--serif);
  font-size: 13px;
}

.results-app-note p {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.results-app-note a {
  display: grid;
  min-height: 38px;
  place-items: center;
  padding: 0 12px;
  border: 0;
  border-radius: 5px;
  background: var(--terracotta);
  color: white;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  text-decoration: none;
}

.discovery-section {
  width: min(680px, 100%);
  margin: 0 auto;
  padding: 18px 0 0;
}

#name-discovery .exploration-mode-bar {
  width: min(680px, 100%);
  margin-right: auto;
  margin-left: auto;
}

.discovery-stage {
  position: relative;
}

.discovery-counter {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.exploration-mode-bar .discovery-counter span {
  color: var(--muted);
  font-family: var(--sans);
  font-weight: 500;
  letter-spacing: 0;
}

.discovery-counter strong {
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: 21px;
}

.discovery-card {
  position: relative;
  min-height: 500px;
  padding: 34px 42px 28px;
  border: 1px solid #d8cbb9;
  background: var(--sheet);
  box-shadow: var(--shadow);
  text-align: center;
}

.discovery-card::before,
.discovery-card::after {
  position: absolute;
  z-index: -1;
  border: 1px solid var(--line);
  background: #f1ebe2;
  content: "";
}

.discovery-card::before {
  inset: 9px -9px -9px 9px;
}

.discovery-card::after {
  inset: 17px -17px -17px 17px;
  background: #e9e2d8;
}

.card-label {
  margin: 0;
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: 10px;
  letter-spacing: .14em;
}

.discovery-name {
  display: flex;
  align-items: baseline;
  justify-content: center;
  margin-top: 68px;
  color: var(--navy);
  font-family: var(--serif);
  text-decoration: none;
}

.discovery-name:hover,
.discovery-name:focus-visible {
  color: var(--terracotta);
}

.discovery-name strong {
  font-size: 67px;
  font-weight: 600;
  letter-spacing: .09em;
}

.discovery-stats {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 22px;
}

.discovery-stats span {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
}

.discovery-actions {
  display: grid;
  gap: 9px;
  margin-top: 30px;
}

.discovery-actions .button {
  width: 100%;
}

#discovery-app-intro {
  gap: 10px;
}

#discovery-app-intro small {
  padding: 3px 6px;
  border: 1px solid rgb(255 255 255 / 55%);
  border-radius: 999px;
  font-size: 9px;
  letter-spacing: .04em;
}

.ranking-section {
  width: min(820px, 100%);
  margin: 0 auto;
}

.ranking-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: min(360px, 100%);
  margin: 0 auto 22px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgb(255 255 255 / 58%);
}

.ranking-tabs button {
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: 600 13px var(--sans);
  cursor: pointer;
}

.ranking-tabs button[aria-selected="true"] {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 5px 16px rgb(26 39 57 / 18%);
}

.ranking-tabs button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.ranking-trend-cta {
  gap: 9px;
  align-items: center;
  text-decoration: none;
}

.ranking-trend-cta small {
  color: var(--terracotta-dark);
  padding: 3px 7px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 8px;
  letter-spacing: .04em;
}

.ranking-table-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--sheet);
  box-shadow: 0 12px 36px rgb(72 58 46 / 7%);
}

.ranking-table {
  width: 100%;
  border-collapse: collapse;
}

.ranking-table tbody th a {
  color: var(--navy);
  font-family: var(--serif);
  text-decoration: none;
}

.ranking-table tbody th a:hover,
.ranking-table tbody th a:focus-visible {
  color: var(--terracotta);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.ranking-controls .data-source-note {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.7;
  text-align: center;
}

.ranking-table th,
.ranking-table td {
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.ranking-table thead th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.ranking-table tbody td:first-child {
  width: 100px;
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: 13px;
}

.ranking-table tbody th {
  color: var(--navy);
  font-family: var(--serif);
  font-size: 19px;
}

.ranking-table tbody td:last-child {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.ranking-table thead th:last-child {
  text-align: right;
}

.ranking-controls {
  display: grid;
  justify-items: center;
  gap: 14px;
  margin-top: 28px;
}

.ranking-controls .button {
  min-width: 220px;
}

.ranking-controls p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.ad-mount[hidden] {
  display: none !important;
}

.final-cta {
  padding: 30px 24px 120px;
}

.final-paper {
  position: relative;
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 78px 88px;
  overflow: hidden;
  border: 1px solid #d3c4ae;
  background: var(--sheet);
  box-shadow: var(--shadow);
  text-align: center;
}

.final-paper::before {
  position: absolute;
  inset: 14px;
  border: 1px solid #e2d5c2;
  pointer-events: none;
  content: "";
}

.final-paper > p:not(.section-number) {
  max-width: 630px;
  margin: 22px auto 0;
  color: var(--muted);
}

.final-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 34px;
}

.site-footer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  align-items: end;
  width: min(1080px, calc(100% - 48px));
  margin: 0 auto;
  padding: 38px 0 45px;
  border-top: 1px solid var(--line);
}

.site-footer strong {
  font-family: var(--serif);
}

.site-footer p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.footer-links {
  display: flex;
  gap: 22px;
  font-size: 11px;
}

.footer-links a {
  text-decoration: none;
}

.site-footer .copyright {
  grid-column: 1 / -1;
}

@media (max-width: 940px) {
  .header-inner {
    grid-template-columns: 1fr auto;
  }

  .main-nav {
    display: none;
  }

  .hero {
    gap: 50px;
  }

  .search-workspace {
    grid-template-columns: 1fr;
  }

  .exploration-chooser {
    grid-template-columns: repeat(2, 1fr);
  }

  .search-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 24px;
  }

  .form-intro,
  .app-filter-field,
  .search-submit {
    grid-column: 1 / -1;
  }

  .name-results {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 741px) and (max-width: 940px) {
  .surname-field {
    margin-top: 24px;
  }
}

@media (max-width: 740px) {
  .header-inner {
    width: calc(100% - 32px);
    min-height: 66px;
  }

  .brand small {
    display: none;
  }

  .header-app-link {
    padding: 8px 12px;
    font-size: 11px;
  }

  .hero {
    grid-template-columns: 1fr;
    width: calc(100% - 40px);
    min-height: 0;
    padding: 66px 0 85px;
  }

  .hero h1 {
    font-size: 43px;
  }

  .hero-description {
    font-size: 16px;
  }

  .hero-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-sheet {
    width: calc(100% - 15px);
    min-height: 440px;
    justify-self: start;
    padding: 30px 24px;
  }

  .sheet-name {
    margin-top: 68px;
  }

  .sheet-name span {
    width: 62px;
    height: 62px;
    font-size: 32px;
  }

  .exploration-section {
    padding: 82px 16px 95px;
  }

  .exploration-chooser {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 32px;
  }

  .exploration-choice {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    min-height: 84px;
    padding: 14px;
  }

  .exploration-choice .choice-number {
    align-self: center;
  }

  .exploration-choice strong {
    font-size: 17px;
  }

  .exploration-choice small {
    display: none;
  }

  .exploration-panel {
    margin-top: 36px;
  }

  .exploration-mode-bar {
    align-items: flex-start;
    gap: 16px;
  }

  .exploration-mode-bar h3 {
    font-size: 22px;
  }

  .exploration-mode-bar button {
    flex: 0 0 auto;
  }

  .section-heading {
    margin-bottom: 32px;
  }

  .search-panel {
    display: block;
    padding: 22px 18px;
  }

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

  .results-panel {
    padding: 22px 16px;
  }

  .name-results {
    grid-template-columns: 1fr;
  }

  .name-result-card {
    padding: 20px;
  }

  .results-app-note {
    grid-template-columns: auto 1fr;
  }

  .results-app-note a {
    grid-column: 1 / -1;
  }

  .discovery-section {
    width: 100%;
    padding: 8px 0 0;
  }

  .discovery-card {
    min-height: 470px;
    padding: 30px 20px 25px;
  }

  .discovery-name strong {
    font-size: 58px;
  }

  .discovery-actions {
    grid-template-columns: 1fr;
  }

  .ranking-table th,
  .ranking-table td {
    padding: 14px 12px;
  }

  .ranking-table tbody td:first-child {
    width: 64px;
  }

  .final-cta {
    padding: 10px 16px 90px;
  }

  .final-paper {
    padding: 64px 24px 100px;
  }

  .final-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .site-footer {
    grid-template-columns: 1fr;
    width: calc(100% - 40px);
  }

  .footer-links {
    flex-wrap: wrap;
    gap: 12px 20px;
  }

  .footer-links a {
    flex: 0 0 auto;
    white-space: nowrap;
  }

}

.home-guide,
.home-checklist,
.home-data-note {
  width: min(1080px, calc(100% - 48px));
  margin: 72px auto 0;
  padding-top: 56px;
  border-top: 1px solid var(--line);
}

.home-guide h2,
.home-checklist h2,
.home-data-note h2 {
  margin: 0;
  color: var(--navy);
  font-family: var(--serif);
  font-size: clamp(28px, 3.5vw, 40px);
  font-weight: 600;
}

.home-guide-intro p,
.home-checklist > div p,
.home-data-note p {
  max-width: 820px;
  color: var(--muted);
  line-height: 1.85;
}

.home-methods {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 30px;
}

.home-methods a,
.home-checklist li {
  padding: 22px;
  border: 1px solid var(--line);
  background: var(--sheet);
}

.home-methods a {
  color: var(--navy);
  text-decoration: none;
}

.home-methods p,
.home-checklist li p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.75;
}

.home-checklist {
  display: grid;
  grid-template-columns: .8fr 1.2fr;
  gap: 56px;
}

.home-checklist ol {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.home-data-note a {
  color: var(--terracotta-dark);
  font-weight: 700;
}

@media (max-width: 740px) {
  .home-guide,
  .home-checklist,
  .home-data-note {
    width: calc(100% - 32px);
    margin-top: 52px;
    padding-top: 44px;
  }

  .home-methods,
  .home-checklist,
  .home-checklist ol {
    grid-template-columns: 1fr;
  }

  .home-checklist {
    gap: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
