:root {
  color-scheme: light;
  --paper: #F7F5FB;
  --panel: #FDFBFF;
  --text: #231638;
  --quiet: #53455E;
  --accent: #552CC4;
  --rule: #DBD2E9;
  --wood: #3BB273;
  --fire: #FF5A5F;
  --earth: #F2B134;
  --metal: #C9CED6;
  --water: #3D5AFE;
  --display: Unbounded, system-ui, sans-serif;
  --body: "DM Sans", system-ui, sans-serif;
  --radius: 28px;
  --on-accent: #FFF;
  --han: "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
}

[data-element="Wood"] { --element: var(--wood); }
[data-element="Fire"] { --element: var(--fire); }
[data-element="Earth"] { --element: var(--earth); }
[data-element="Metal"] { --element: var(--metal); }
[data-element="Water"] { --element: var(--water); }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  position: relative;
  isolation: isolate;
  background: var(--paper);
  color: var(--text);
  font: 16px/1.55 var(--body);
}

h1, h2, h3, h4, p, dl, dd { margin: 0; }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.06; }
h1 { font-size: clamp(2.4rem, 5.2vw, 4.95rem); letter-spacing: -.062em; }
h2 { font-size: clamp(1.65rem, 3.65vw, 3.25rem); letter-spacing: -.045em; }
h3 { font-size: clamp(1.24rem, 2.5vw, 1.85rem); letter-spacing: -.032em; }
h4 { font-size: clamp(1.02rem, 1.55vw, 1.3rem); letter-spacing: -.026em; }
h5 { margin: 0; font-size: .96rem; line-height: 1.35; }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
[tabindex="-1"]:focus { outline-offset: 3px; }
input { accent-color: var(--accent); }

.page { width: min(calc(100% - 72px), 1240px); margin-inline: auto; }
.masthead { min-height: 80px; display: flex; align-items: center; }
.wordmark { font: 700 clamp(1rem, 2.5vw, 1.55rem)/1.1 var(--display); letter-spacing: -.06em; text-decoration: none; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: .65em 1.15em;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 600;
  line-height: 1.23;
  text-align: center;
}
.button.primary { background: var(--accent); color: var(--on-accent); }
.button.primary:hover { filter: brightness(.93); }
.button.quiet { background: rgb(255 255 255 / 40%); border-color: var(--rule); color: var(--text); }
.button.quiet:hover { border-color: var(--accent); }

.ledger, .results { margin-top: clamp(48px, 7vw, 88px); scroll-margin-top: 20px; }
.ledger {
  max-width: 850px;
  margin-inline: auto;
  padding: clamp(20px, 5vw, 58px);
}
.steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0;
  margin: 1.5rem 0 1.9rem;
  border-block: 1px solid var(--rule);
  list-style: none;
}
.steps li { padding: .65em .3em .65em .65em; color: var(--quiet); font-size: .875rem; }
.steps li + li { border-inline-start: 1px solid var(--rule); }
.steps li span { margin-inline-end: .35em; font-size: .85em; font-weight: 700; }
.steps [aria-current] { color: var(--text); box-shadow: inset 0 -3px var(--accent); }
.steps .complete { color: var(--accent); }
.form-step h3 { margin-bottom: 1.15rem; }
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.5rem;
}
.field { display: grid; align-content: start; gap: .35em; min-width: 0; }
.field input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: .5em .65em;
  background: var(--paper);
  color: var(--text);
  border: 1px solid var(--rule);
  border-radius: min(12px, var(--radius));
}
.field input::placeholder { color: var(--quiet); }
.field input:disabled { opacity: .6; }
.field small, .secondary { color: var(--quiet); font-size: .875rem; }
.combobox { position: relative; }
.suggestions {
  position: absolute;
  z-index: 5;
  inset: 100% 0 auto;
  max-height: 230px;
  overflow: auto;
  list-style: none;
  padding: .25rem;
  margin: 0;
  border: 1px solid var(--rule);
  background: var(--panel);
  box-shadow: 0 12px 25px rgb(16 20 24 / 15%);
}
.suggestions li { display: grid; cursor: pointer; padding: .45em .6em; }
.suggestions li:hover, .suggestions [aria-selected="true"] { background: var(--paper); color: var(--accent); }
.accuracy { display: grid; gap: .3rem; margin-top: .8rem; }
.accuracy label { display: inline-flex; align-items: start; gap: .5em; cursor: pointer; }
input[type="checkbox"], input[type="radio"] { margin: .35em 0 0; }
fieldset { min-width: 0; margin: 0; border: 1px solid var(--rule); }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .65rem; margin-top: 1.6rem; }
.form-error { margin-top: .75rem; color: var(--accent); font-weight: bold; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.glass {
  background: rgb(255 255 255 / 58%);
  border: 1px solid rgb(255 255 255 / 92%);
  border-radius: var(--radius);
  box-shadow: 0 12px 34px rgb(58 37 101 / 11%);
  -webkit-backdrop-filter: blur(15px);
  backdrop-filter: blur(15px);
}

.aura-field { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.aura-orb {
  position: absolute;
  aspect-ratio: 1;
  width: clamp(200px, var(--orb-size), 900px);
  border-radius: 50%;
  background: radial-gradient(circle, var(--element) 3%, transparent 69%);
  opacity: var(--orb-strength);
  filter: blur(clamp(12px, 2.6vw, 48px));
  animation: drift 19s ease-in-out infinite alternate;
  transition: width .9s, opacity .9s;
}
.aura-orb:nth-child(1) { left: -17%; top: 10%; }
.aura-orb:nth-child(2) { right: -2%; top: 14%; animation-delay: -12s; }
.aura-orb:nth-child(3) { right: 11%; bottom: -24%; animation-delay: -6s; }
.aura-orb:nth-child(4) { left: 14%; bottom: -21%; animation-delay: -15s; }
.aura-orb:nth-child(5) { right: 12%; top: -20%; animation-delay: -9s; }
@keyframes drift { to { transform: translate(11%, 13%) scale(1.12); } }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  min-height: clamp(410px, 43vw, 575px);
  align-items: center;
  gap: clamp(10px, 2.4vw, 34px);
  padding: clamp(26px, 4vw, 58px);
  border: 1px solid #fff;
  border-radius: 42px;
  box-shadow: 0 18px 50px #3a25651b;
  background: radial-gradient(ellipse at 78% 42%, #e7dcff82 3%, #ffffffa8 74%);
  isolation: isolate;
  overflow: hidden;
}
.hero-copy { position: relative; z-index: 2; }
.hero p { max-width: 35ch; margin-block: 1.2em 1.5em; color: var(--quiet); font-size: clamp(1rem, 1.65vw, 1.2rem); }
.hero p.payment-status { margin-block: 0 .85rem; color: var(--accent); font-size: .9rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .5rem .65rem; }
#saved-results { font-size: .86rem; }
.hero-pair { position: relative; min-width: 0; aspect-ratio: 1.25; }
.hero-wheel, .hero-element-orb { position: absolute; transition: transform .42s cubic-bezier(.2,.75,.25,1); }
.hero-wheel {
  inset: 7% auto auto 0;
  width: 73%;
  z-index: 1;
  transform: translate(var(--pointer-x, 0px), var(--pointer-y, 0px));
}
.hero-wheel .wheel { animation: orbit-float 12s ease-in-out infinite alternate; }
.hero-wheel .wheel-svg { filter: drop-shadow(0 12px 15px #5237a12e); }
.hero-element-orb {
  inset: 17% 3% auto auto;
  width: 60%;
  transform: translate(calc(var(--pointer-x, 0px) * -1), calc(var(--pointer-y, 0px) * -1));
}
.aura-orbit {
  position: relative;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgb(255 255 255 / 90%);
  background:
    radial-gradient(circle at 25% 69%, rgb(59 178 115 / 76%), transparent 46%),
    radial-gradient(circle at 70% 36%, rgb(255 90 95 / 78%), transparent 48%),
    radial-gradient(circle at 25% 25%, rgb(61 90 254 / 72%), transparent 50%),
    radial-gradient(circle at 72% 76%, rgb(242 177 52 / 80%), #e6e2fc);
  box-shadow: inset 0 0 32px #ffffffad, 0 24px 48px #4929a345;
  animation: orbit-float 14s -3s ease-in-out infinite alternate-reverse;
}
.aura-orbit::before, .aura-orbit::after {
  position: absolute;
  content: "";
  inset: 22% -10%;
  border: 1px solid #fffe;
  border-radius: 50%;
  transform: rotate(-37deg);
}
.aura-orbit::after { transform: rotate(31deg); }
.aura-orbit i {
  position: absolute;
  z-index: 1;
  display: grid;
  width: 14%;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid #fff;
  border-radius: 50%;
  color: #2b1640;
  background: color-mix(in srgb, var(--element) 42%, white);
  box-shadow: 0 3px 12px #361b5440;
  font: 700 clamp(.65rem, 1.8vw, 1.1rem)/1 var(--han);
}
.aura-orbit i:nth-child(1) { left: 19%; top: 9%; }
.aura-orbit i:nth-child(2) { right: 7%; top: 16%; }
.aura-orbit i:nth-child(3) { right: 2%; bottom: 21%; }
.aura-orbit i:nth-child(4) { right: 29%; bottom: 8%; }
.aura-orbit i:nth-child(5) { left: 19%; bottom: 25%; }
@keyframes orbit-float { to { transform: translateY(4%) rotate(4deg); } }

.results-header, .report-heading { display: flex; align-items: end; justify-content: space-between; gap: .8em 1.2em; }
.report-heading p { margin-top: .4em; color: var(--quiet); }
.chart, .rankings, .full-report { margin-top: clamp(30px, 5vw, 60px); }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(13px, 2vw, 24px); }
.chart > h3, .rankings > h3 { margin-bottom: .75em; }
.chart-panel { min-width: 0; padding: clamp(19px, 2.8vw, 34px); }
.stars-panel {
  --panel-accent: #7446d5;
  background: radial-gradient(ellipse at 50% 53%, #eee4fbe6 0, #ffffffad 73%);
}
.elements-panel {
  --panel-accent: #157a60;
  background: radial-gradient(ellipse at 51% 54%, #e3f4e1b0 0, #ffffffad 75%);
}
.chart-panel h4 { display: flex; align-items: center; gap: .55em; }
.chart-panel h4::before {
  content: "★";
  color: var(--panel-accent);
  font: 1.15em/1 system-ui, sans-serif;
}
.elements-panel h4::before { content: "☯"; }
.chart-panel > .secondary { margin-top: .7rem; }

.wheel { min-width: 0; }
.wheel-svg { display: block; width: min(100%, 322px); margin-inline: auto; overflow: visible; }
.hero-wheel .wheel-svg { width: 100%; }
.wheel-rim { fill: #fff9; stroke: #6e43b9; stroke-width: 1.1; }
.wheel-divider { fill: none; stroke: #805bb9; stroke-width: .75; }
.wheel-inner { fill: #ede3fd90; stroke: #9973ca; stroke-width: 1; stroke-dasharray: 1.5 4.8; }
.wheel-tick { stroke: #987bb6; stroke-width: 1; }
.wheel-ascendant { stroke: #552cc4; stroke-width: 2.5; }
.wheel-sign, .wheel-center, .planet-glyph {
  text-anchor: middle;
  dominant-baseline: central;
  font-family: "Apple Symbols", "Segoe UI Symbol", "Noto Sans Symbols 2", system-ui, sans-serif;
}
.wheel-sign { font-size: 23px; fill: #46268c; }
.sign-tone-1 { fill: #11634d; }
.sign-tone-2 { fill: #5329be; }
.sign-tone-3 { fill: #913357; }
.wheel-center { font-size: 39px; fill: #8761c7; }
.planet-stem { stroke: #7d62bd; stroke-width: .8; }
.planet-dot { fill: #6d41bc; }
.planet-hit { fill: #f9f5ff; stroke: #a48bd6; stroke-width: .8; }
.planet-glyph { font-size: 20px; fill: #362072; pointer-events: none; }
.wheel-planet[role="button"] { cursor: pointer; }
.wheel-planet:focus { outline: none; }
.wheel-planet[role="button"]:is(:hover, :focus-visible, [aria-pressed="true"]) .planet-hit {
  fill: #e0d1ff;
  stroke: #552cc4;
  stroke-width: 2;
}
.planet-tooltip {
  min-height: 2.8em;
  color: var(--quiet);
  font-size: .8rem;
  line-height: 1.4;
  text-align: center;
}
.planet-tooltip strong { color: var(--text); }

.big-three {
  list-style: none;
  margin: .5rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .4rem;
}
.big-three-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0 .38rem;
  align-items: center;
  padding: .48rem .55rem;
  border-radius: 12px;
  background: #f1e8ff;
}
.big-three-icon { grid-row: span 2; font: 1.25rem/1 system-ui, sans-serif; color: var(--accent); }
.big-three-label { color: var(--quiet); font-size: .74rem; }
.big-three-item strong { font-size: .88rem; overflow-wrap: anywhere; }

.elements-content { display: grid; gap: .8rem; }
.chart-panel .elements-content { margin-top: clamp(22px, 3vw, 34px); }
.pillars { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .45rem; }
.pillars div { min-width: 0; border-top: 1px solid var(--rule); padding-top: .45rem; }
.pillars dt { color: var(--quiet); font-size: .8rem; }
.pillars dd { display: grid; row-gap: .2rem; }
.han { font-family: var(--han); }
.pillar-han { font-size: clamp(1.35rem, 3.2vw, 2.45rem); line-height: 1.35; }
.pinyin { font-size: .78rem; overflow-wrap: anywhere; }
.day-master { font-size: .92rem; }
.balance-bars { display: grid; gap: .2rem; margin: 0; padding: 0; list-style: none; }
.balance-row {
  display: grid;
  grid-template-columns: 3.35rem minmax(0, 1fr) 2.6rem;
  width: 100%;
  min-height: 2.05rem;
  align-items: center;
  gap: .4rem;
  padding: .1rem .45rem;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: .87rem;
}
button.balance-row:hover, button.balance-row[aria-pressed="true"] {
  background: #fff9;
  border-color: color-mix(in srgb, var(--element) 60%, white);
}
.element-track { border-radius: 99px; overflow: hidden; background: #32205017; height: .55rem; }
.element-fill { display: block; height: 100%; background: var(--element); border-radius: 99px; }
.balance-percent { text-align: right; font-variant-numeric: tabular-nums; }
.element-text { color: var(--text); color: color-mix(in srgb, var(--element) 32%, #231638); }
.needs, .element-tags { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .4rem; }
.needs { gap: .5rem .7rem; }
.element-tag {
  display: inline-flex;
  align-items: center;
  gap: .27rem;
  padding: .18em .54em;
  color: var(--text);
  border-radius: 99px;
  border: 1px solid color-mix(in srgb, var(--element) 50%, white);
  background: color-mix(in srgb, var(--element) 18%, #fff);
  font-size: .76rem;
  line-height: 1.35;
  white-space: nowrap;
}
.tag-percent { color: var(--quiet); font-size: .9em; }

.ranking-controls {
  min-width: 0;
  padding: 0;
  border: 0;
  margin: 0 0 .65rem;
}
.segments {
  display: inline-flex;
  max-width: 100%;
  gap: .15rem;
  padding: .2rem;
  border: 1px solid var(--rule);
  border-radius: 16px;
  background: #fff9;
  overflow-x: auto;
}
.segments label { display: grid; position: relative; flex: 0 0 auto; cursor: pointer; }
.segments input { position: absolute; opacity: 0; }
.segments span {
  display: grid;
  min-height: 44px;
  padding: .36em .78em;
  place-items: center;
  border-radius: 12px;
  color: var(--quiet);
  font-size: .9rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
}
.segments input:checked + span { background: #ece2ff; box-shadow: inset 0 0 0 1px #a17cdd; color: #47239a; }
.segments input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -3px; }
.rankings { scroll-margin-top: 16px; }
#ranking-list:not(:empty), #ranking-status:not(:empty) { margin-top: .75rem; }

.city-list {
  --rank-gap: .65rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--rank-gap);
  margin: 0;
  padding: 0;
  isolation: isolate;
  list-style: none;
}
.match-item { grid-column: 1; min-width: 0; }
.city-card, .locked-card { padding: clamp(14px, 2vw, 23px); }
.city-card {
  cursor: pointer;
  transform: perspective(1050px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
  transition: transform .22s ease-out, box-shadow .22s, border-color .22s;
}
.element-match .city-card {
  border-color: color-mix(in srgb, var(--highlight) 70%, #231638);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--highlight) 52%, #fff), 0 12px 30px #37215a25;
}
.card-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .65rem; }
.city-rank {
  width: fit-content;
  padding: .25em .62em;
  border-radius: 99px;
  color: #4d259c;
  background: #ece3fc;
  font-size: .82rem;
  font-weight: 700;
  white-space: nowrap;
}
.city-score { display: flex; align-items: baseline; gap: .4rem; white-space: nowrap; }
.score-number { font-variant-numeric: tabular-nums; }
.city-score .score-number { font: 600 clamp(1.26rem, 2.5vw, 1.72rem)/1 var(--display); min-width: 2ch; text-align: right; }
.score-label { color: var(--quiet); font-size: .76rem; }
.city-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: .62rem clamp(.85rem, 2vw, 1.7rem);
}
.city-thumbnail {
  position: relative;
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  overflow: hidden;
  border-radius: 15px;
  background: linear-gradient(140deg, var(--tile-start), var(--tile-end));
  color: #25163d;
  font: 700 1.9rem/1 var(--display);
}
.city-thumbnail > span { padding: .24em .29em; border-radius: 25%; background: #ffffffe6; }
.city-thumbnail img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.city-info { display: grid; gap: .4rem; min-width: 0; }
.city-identity h4 { overflow-wrap: anywhere; }
.city-country { margin-top: .14em; color: var(--quiet); font-size: .81rem; }
.sub-scores { display: flex; flex-wrap: wrap; gap: .3rem; }
.sub-score {
  display: inline-flex;
  align-items: center;
  gap: .32em;
  padding: .24em .55em;
  border-radius: 7px;
  font-size: .78rem;
  line-height: 1.3;
  white-space: nowrap;
}
.sub-score .score-number { min-width: 2ch; text-align: right; }
.stars-score { color: #442289; background: #eee4ff; }
.elements-score { color: #185542; background: #e0f2e9; }
.city-highlights { grid-column: 1 / -1; }
.highlights-strip, .highlights-label {
  display: flex;
  align-items: center;
  gap: .35rem;
}
.highlights-strip { flex-wrap: wrap; }
.highlights-label { color: var(--quiet); font-size: .76rem; font-weight: 700; }
.highlights-info {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--accent);
  font-size: .95rem;
}
.highlights-info:is(:hover, [aria-expanded="true"]) { background: #eee4ff; }
.highlights-strip .area-scores { margin: 0; gap: .28rem; }
.highlights-strip .area-scores > div { font-size: .76rem; }
.highlights-help {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: .2em .65em;
  padding: .5rem .65rem;
  margin-top: .32rem;
  border-radius: 8px;
  background: #f0ebff;
  color: var(--quiet);
  font-size: .76rem;
  cursor: auto;
}
.highlights-help dt { font-weight: 700; }
.card-reasons { grid-area: 1 / 3; display: grid; gap: .35rem; }
.card-reason {
  display: grid;
  grid-template-columns: 1.13em minmax(0, 1fr);
  align-items: start;
  gap: .36em;
  color: var(--quiet);
  font-size: .85rem;
}
.system-icon { color: var(--accent); }
.elements-reason .system-icon { color: #15765d; }
.card-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  min-height: 38px;
  padding: .26rem 0 0;
  margin-top: .55rem;
  border: 0;
  border-top: 1px solid var(--rule);
  background: transparent;
  color: var(--accent);
  font-size: .79rem;
  font-weight: 700;
  text-align: left;
}
.card-toggle::after {
  content: "";
  display: block;
  width: .45rem;
  height: .45rem;
  margin-right: .25rem;
  border-right: 1.5px solid;
  border-bottom: 1.5px solid;
  transform: rotate(45deg);
  transition: transform .2s;
}
.card-toggle[aria-expanded="true"]::after { transform: rotate(225deg); }
.city-details { display: grid; gap: .75rem; padding: .35rem .05rem 0; font-size: .84rem; cursor: auto; }
.line-list { padding-inline-start: 1.2em; margin: .4em 0 0; }
.line-list li + li { margin-top: .27em; }
.profile-bar { display: flex; height: .6rem; overflow: hidden; border-radius: 99px; margin: .35rem 0; }
.profile-bar span { flex: 0 0 auto; background: var(--element); }
.locked-card {
  border: 1px solid #ffffffa0;
  border-radius: var(--radius);
  background: linear-gradient(110deg, #f2e9fc, #ede7fb);
}
.locked-item { position: relative; }
.locked-item :is(.card-top, .teaser) { position: relative; z-index: 2; }
.fake-city {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
  max-width: 420px;
  filter: blur(6px);
  user-select: none;
}
.fake-thumbnail { --tile-start: #8a68d4; --tile-end: #afc1ff; }
.fake-thumbnail.city-thumbnail { width: 54px; height: 54px; }
.fake-lines { display: grid; gap: .46rem; }
.fake-lines span { width: 67%; height: .57rem; border-radius: 99px; background: #bda8e4; }
.fake-lines span:nth-child(2) { width: 42%; background: #b9c3e8; }
.fake-lines span:nth-child(3) { width: 81%; background: #c9b9e5; }
.city-list[data-frost="5"] { --locked-count: 5; }
.city-list[data-frost="10"] { --locked-count: 10; }
.city-list[data-frost]::before, .report-preview::before {
  content: "";
  z-index: 1;
  pointer-events: none;
  border: 1px solid #ffffffd9;
  border-radius: var(--radius);
  background: linear-gradient(133deg, #ffffff66, #efe8ff66 53%, #ffffffa0);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
/* Badges and hints sit above the one layer spanning the locked ranks. */
.city-list[data-frost]::before {
  grid-column: 1;
  grid-row: 1 / span var(--locked-count);
}
.button.reveal-button {
  position: absolute;
  inset-block-start: 50%;
  inset-inline-start: 50%;
  z-index: 3;
  transform: translate(-50%, -50%);
  width: max-content;
  max-width: calc(100% - 2rem);
  border-color: #c8b6ee;
  background: #fcf9fff2;
  color: var(--accent);
  box-shadow: 0 6px 18px #37215a20;
  font-size: .875rem;
}
.button.reveal-button:hover { border-color: var(--accent); background: #fff; }
/* Ten locked rows put the midpoint in the gap after the fifth row. */
.city-list[data-frost="10"] .ranking-reveal { inset-block-start: calc(100% + var(--rank-gap) / 2); }
.teaser { padding-top: .65rem; color: var(--quiet); font-size: .82rem; }
.city-list.melting::before {
  animation: frost-melt 560ms ease-in-out both;
}
@keyframes frost-melt {
  from { opacity: 1; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
  to { opacity: 0; -webkit-backdrop-filter: blur(0); backdrop-filter: blur(0); }
}

.full-report { padding: clamp(18px, 4vw, 52px); scroll-margin-top: 16px; }
.report-teaser { background: linear-gradient(125deg, #eee5f9, #ffffffb5); }
.report-preview { position: relative; isolation: isolate; margin-top: .9rem; }
.report-preview::before { position: absolute; inset: 0; }
.report-preview ul { margin: 0; padding: 0; list-style: none; filter: blur(3px); user-select: none; }
.report-teaser li {
  display: grid;
  grid-template-columns: minmax(0, 13rem) minmax(0, 1fr);
  align-items: center;
  gap: .55rem;
  padding-block: .6rem;
  border-top: 1px solid var(--rule);
  color: var(--quiet);
  font-weight: 600;
}
.report-teaser li::after {
  content: "";
  width: 75%;
  height: .65rem;
  border-radius: 99px;
  background: linear-gradient(100deg, #bca9d9 42%, #ddcce9 83%, transparent);
}
.report-teaser li:nth-child(even)::after { width: 54%; }
.report-heading { padding-bottom: 1.2rem; }
.report-section { padding-block: clamp(15px, 3vw, 32px); border-top: 1px solid var(--rule); }
.report-section > h4 { margin-bottom: .75em; }
.report-section > h5 { margin: 1rem 0 .4rem; }
.report-section > p + p { margin-top: .6rem; }
.report-cosmic { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); align-items: center; gap: 1rem 2rem; }
.big-three-detailed { grid-template-columns: minmax(0, 1fr); gap: .5rem; }
.big-three-detailed .big-three-item { padding: .65rem .85rem; }
.big-three-detailed .big-three-item p { grid-column: 1 / -1; margin-top: .35rem; font-size: .88rem; color: var(--quiet); }
.report-section .elements-content { max-width: 720px; }
.report-city { margin-top: .85rem; padding: clamp(12px, 2.7vw, 28px); border: 1px solid var(--rule); border-radius: 18px; background: #ffffff80; }
.report-city-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: .85rem; }
.report-city .city-identity { display: grid; justify-items: start; gap: .32rem; min-width: 0; }
.report-ratings { display: grid; justify-items: end; gap: .4rem; }
.best-for { display: inline-block; padding: .2em .65em; border-radius: 99px; background: #e7f3df; color: #295139; font-size: .76rem; font-weight: 700; }
.deep-dive { margin-top: .5rem; }
.report-city .deep-dive { padding-inline: 0; font-size: inherit; }
.area-scores { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .3rem; }
.area-scores > div { display: flex; align-items: baseline; gap: .35em; padding: .2em .55em; border-radius: 7px; background: #f0ebff; font-size: .84rem; }
.area-scores dd { font-variant-numeric: tabular-nums; font-weight: 700; }
.profile-comparison-row { margin-top: .35rem; }
.profile-comparison-row > span:first-child { font-size: .85rem; font-weight: 600; }
.profile-values { display: flex; flex-wrap: wrap; gap: .2rem .75rem; font-size: .75rem; }
.practical-notes { color: var(--quiet); font-size: .86rem; }
.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .4rem 1rem; padding-block: 24px; color: var(--quiet); font-size: .82rem; }
.footer small { font-size: inherit; }

#payment-dialog {
  width: min(500px, calc(100% - 28px));
  max-width: none;
  max-height: calc(100% - 28px);
  overflow: auto;
  padding: clamp(18px, 5vw, 32px);
  background: radial-gradient(ellipse at 95% 0%, #dfccffd9, transparent 64%), #fdfbffeb;
  color: var(--text);
  box-shadow: 0 16px 48px #21104449, inset 0 1px 0 #fff;
}
#payment-dialog h2 { max-width: 16ch; font-size: clamp(1.32rem, 4vw, 1.9rem); }
#payment-dialog::backdrop { background: #25163f5e; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.offer-benefits { margin: 1.1rem 0 0; padding: 0; list-style: none; }
.offer-benefits li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: .65rem;
  padding: .62rem .15rem;
  border-bottom: 1px solid var(--rule);
  font-size: .92rem;
  line-height: 1.35;
}
.offer-icon {
  display: grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  background: #e6d8fd;
  color: #4d259c;
  font: 700 1rem/1 system-ui, sans-serif;
}
.offer-benefits li:nth-child(2) .offer-icon { background: #e1e6ff; color: #3941a1; }
.offer-benefits li:nth-child(3) .offer-icon { background: #dff3eb; color: #185542; }
.offer-benefits li:nth-child(4) .offer-icon { background: #faebc9; color: #70460d; }
.offer-price { margin: 1rem 0 .65rem; color: var(--quiet); text-align: center; font-size: .92rem; }
.checkout-note, .checkout-terms { text-align: center; color: var(--quiet); line-height: 1.4; }
.checkout-note { margin-bottom: .35rem; font-size: .85rem; }
.checkout-terms { margin-bottom: .8rem; font-size: .78rem; }
.checkout-terms a { text-underline-offset: .15em; }
.dialog-actions { display: grid; justify-items: center; }
.dialog-actions .primary { width: 100%; }
#pay-button:disabled { opacity: .8; cursor: wait; }
.dialog-close {
  min-height: 44px;
  padding: .25rem .55rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--quiet);
  font-size: .85rem;
  text-decoration: underline;
  text-underline-offset: .15em;
}
.dialog-close:hover { color: var(--accent); }

@media (max-width: 830px) {
  .page { width: calc(100% - 44px); }
  .hero { padding: clamp(20px, 4vw, 40px); }
  .chart-panel { padding: 19px; }
}
@media (max-width: 720px) {
  .page { width: calc(100% - 28px); }
  .masthead { min-height: 65px; }
  .hero { min-height: auto; grid-template-columns: minmax(0, 1fr); gap: .2rem; border-radius: 26px; }
  .hero h1 { max-width: 12ch; font-size: clamp(2.08rem, 8vw, 3.9rem); }
  .hero p { margin-block: .85em 1.1em; }
  .hero-pair { width: min(100%, 440px); margin-inline: auto; }
  .hero-wheel { inset-block-start: 4%; }
  .hero-element-orb { inset-block-start: 14%; }
  .results-header, .report-heading { align-items: start; flex-direction: column; }
  .chart-grid, .report-cosmic { grid-template-columns: minmax(0, 1fr); }
  .city-thumbnail { width: 72px; height: 72px; border-radius: 12px; font-size: 1.45rem; }
  .city-body { grid-template-columns: auto minmax(0, 1fr); gap: .5rem .65rem; }
  .card-reasons { grid-area: auto / 1 / auto / -1; }
  .report-city-head { grid-template-columns: auto minmax(0, 1fr); }
  .report-ratings { grid-column: 1 / -1; justify-items: start; }
}
@media (max-width: 500px) {
  .field-grid { grid-template-columns: minmax(0, 1fr); }
  .segments span { padding-inline: .46em; font-size: .85rem; }
  .report-teaser li { grid-template-columns: minmax(0, 1fr) minmax(0, .5fr); }
}
@media (max-width: 360px) {
  .chart-panel { padding: 14px; }
  .big-three { gap: .23rem; }
  .big-three-item { padding-inline: .35rem; }
  .big-three-icon { font-size: .94rem; }
  .big-three-label { font-size: .64rem; }
  .big-three-item strong { font-size: .76rem; }
  .city-body { column-gap: .48rem; }
  .sub-score { font-size: .72rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .hero-wheel, .hero-element-orb, .city-card { transform: none; }
  .city-list.melting::before { display: none; }
}
@page { margin: 15mm; }
@media print {
  :root { --text: #16131c; --quiet: #423c48; --rule: #cdc9d3; }
  body { background: #fff; font-size: 10pt; }
  .page { width: 100%; margin: 0; }
  .aura-field, .masthead, .footer, .hero, .ledger, dialog, .results > :not(#full-report),
  #print-report, .planet-tooltip { display: none !important; }
  .results, .full-report { margin: 0; }
  .full-report {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: white;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  .report-heading { padding-bottom: .7rem; }
  .report-heading h3 { font-size: 23pt; }
  .report-section { padding-block: .8rem; }
  .report-section > h4 { font-size: 15pt; }
  .report-section :is(h4, h5) { break-after: avoid; }
  .report-cosmic { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: .6rem; break-inside: avoid; }
  .report-cosmic .wheel-svg { max-width: 195px; }
  .big-three-detailed .big-three-item { background: #f7f2fb; }
  .report-city {
    background: #fff; box-shadow: none; border: 1px solid var(--rule); break-inside: avoid; padding: .6rem;
  }
  .report-city-head { grid-template-columns: auto minmax(0, 1fr) auto; }
  .report-ratings { grid-column: auto; justify-items: end; }
  .report-city .city-thumbnail { width: 54px; height: 54px; }
  .line-list li { break-inside: avoid; }
}
