/* v9 palette: lagoon teal + sunset gold over a deep-sea ink base. Panels are
   translucent rgba so the tropical video backdrop (.bg) reads through the
   backdrop-filter glass; --panel-solid exists for surfaces that must stay
   opaque (sticky table header). */
:root {
  --bg: #050d13;
  --panel: rgba(13, 27, 36, .62);
  --panel-2: rgba(21, 40, 52, .68);
  --panel-3: rgba(30, 56, 72, .74);
  --panel-solid: #0c1922;
  --text: #eaf4f2;
  --muted: #9ab3b8;
  --accent: #3fd8c2;
  --accent-2: #f5c069;
  --pos: #4ade80;
  --neg: #fb7185;
  --stale: #fbbf24;
  --border: rgba(140, 190, 195, .26);
  --shadow-1: 0 4px 14px rgba(2, 8, 12, .35);
  --shadow-2: 0 18px 44px rgba(2, 8, 12, .55);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --hairline: rgba(255, 255, 255, .09);
  --glass-blur: saturate(150%) blur(18px);
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
}
/* Header is a transparent hero over the video: slim utility topbar, then big
   display type. The old solid-bar styling lives on in the glass panels. */
header { background: transparent; }
.topbar {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: 10px 20px; padding: 18px 28px;
}
.wordmark {
  font-family: var(--font-display); font-size: 20px; font-weight: 600;
  color: var(--text); text-decoration: none; letter-spacing: .01em;
}
.wordmark span { color: var(--accent-2); }
.hero-body {
  max-width: 1400px; margin: 0 auto;
  padding: clamp(44px, 10vh, 118px) 28px clamp(38px, 7vh, 84px);
}
.hero-kicker {
  margin: 0 0 16px; font-size: 11.5px; font-weight: 600;
  letter-spacing: .34em; text-transform: uppercase; color: var(--accent);
  text-shadow: 0 1px 12px rgba(2, 8, 12, .8);
}
h1 {
  font-family: var(--font-display); font-size: clamp(42px, 6.2vw, 84px);
  margin: 0; font-weight: 350; letter-spacing: 0; line-height: 1.04;
  filter: drop-shadow(0 4px 26px rgba(2, 8, 12, .55));
}
h1 em {
  font-style: italic; font-weight: 330;
  background: linear-gradient(105deg, var(--accent) 5%, var(--accent-2) 92%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
h2 {
  display: flex; align-items: baseline; gap: 12px;
  font-family: var(--font-display); font-size: 22px; font-weight: 420;
  color: var(--text); letter-spacing: .01em;
  text-shadow: 0 1px 14px rgba(2, 8, 12, .6);
}
h2::before {
  content: ""; flex: 0 0 26px; height: 2px; border-radius: 2px;
  align-self: center;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
/* Inline annotations inside serif headings stay in the UI sans. */
h2 .muted { font-family: -apple-system, "Segoe UI", Roboto, sans-serif; letter-spacing: 0; }
.cadence {
  color: var(--muted); margin: 18px 0 0; font-size: 13px; max-width: 660px;
  text-shadow: 0 1px 10px rgba(2, 8, 12, .75);
}
.header-right { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); font-size: 12px; }
@media (max-width: 640px) {
  .topbar { padding: 14px 18px; }
  .hero-body { padding-left: 18px; padding-right: 18px; }
  #generated-at { display: none; } /* keeps the topbar to one tidy row */
}
button, .btn {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 14px; cursor: pointer;
  text-decoration: none; font-size: 13px;
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.btn:hover, button:hover {
  border-color: var(--accent); background: var(--panel-3);
  box-shadow: 0 0 0 1px rgba(63, 216, 194, .25), var(--shadow-1);
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: rgba(63, 216, 194, .32); }
main { padding: 16px 24px 40px; max-width: 1400px; margin: 0 auto; }

.error-banner {
  background: #3b1f24; border: 1px solid var(--neg); color: #fecaca;
  padding: 10px 14px; border-radius: 8px; margin-bottom: 16px;
}

/* Spotlight: TH/VN pinned first, larger, accent border */
.spotlight-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
/* Spotlight cards wear a gold-foil gradient ring (mask-composite border)
   instead of the old flat 2px accent border. */
.card-large { position: relative; border-color: transparent !important; padding: 20px !important; }
.card-large::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px;
  background: linear-gradient(140deg,
    rgba(63, 216, 194, .95), rgba(63, 216, 194, .12) 32%,
    rgba(245, 192, 105, .14) 62%, rgba(245, 192, 105, .9));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none;
}
.card-large h3 { font-size: 20px; }
.card-large .score { font-size: 30px; }

.sea-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }

.card {
  background: var(--panel); border: 1px solid var(--hairline);
  border-radius: var(--radius-md); padding: 14px; box-shadow: var(--shadow-1);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
@media (hover: hover) {
  .card.clickable:hover {
    transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--accent);
  }
}
.card-head { display: flex; justify-content: space-between; align-items: baseline; }
.card h3 { margin: 0 0 8px; font-size: 16px; }
.card-note { color: var(--stale); font-size: 12.5px; margin: 4px 0 8px; }
.card dl { margin: 8px 0; }
.card dl > div { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; border-bottom: 1px solid var(--hairline); }
.card dt { color: var(--muted); }
.card dd { margin: 0; text-align: right; }
.iso { color: var(--muted); font-size: 11px; font-weight: normal; }

.val.pos { color: var(--pos); }
.val.neg { color: var(--neg); }
.score {
  font-family: var(--font-display); font-size: 21px; font-weight: 560;
  letter-spacing: .01em;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.badge {
  display: inline-block; font-size: 10.5px; color: var(--muted);
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0 5px; margin-left: 5px; vertical-align: middle;
  cursor: help;
}
.badge.stale { color: var(--stale); border-color: var(--stale); }
.chip-unavailable {
  display: inline-block; font-size: 11px; color: var(--muted);
  background: #232a3b; border-radius: var(--radius-sm); padding: 1px 7px; cursor: help;
}
.chip-partial {
  display: inline-block; font-size: 10.5px; color: var(--stale);
  border: 1px solid var(--stale); border-radius: var(--radius-sm); padding: 0 5px; cursor: help;
}
.attribution { font-size: 10.5px; color: var(--muted); margin-left: 4px; }

.portals { margin-top: 8px; }
.portal {
  color: var(--accent); text-decoration: none; font-size: 12.5px; margin-right: 10px;
}
.portal:hover { text-decoration: underline; }

.table-wrap {
  overflow-x: auto; background: var(--panel); border: 1px solid var(--hairline);
  border-radius: var(--radius-md); box-shadow: var(--shadow-1);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}
table { border-collapse: collapse; width: 100%; min-width: 1000px; }
th, td { padding: 8px 10px; text-align: left; white-space: nowrap; }
/* Sticky header must stay opaque: translucent glass over scrolling rows
   would let row text ghost through it. */
thead th {
  color: var(--muted); font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .07em;
  border-bottom: 1px solid var(--hairline); position: sticky; top: 0;
  background: var(--panel-solid); cursor: pointer; user-select: none;
}
tbody tr { border-bottom: 1px solid var(--hairline); }
tbody tr:last-child { border-bottom: none; }
.row-spotlight { background: rgba(63, 216, 194, 0.07); }
.row-sea { background: rgba(63, 216, 194, 0.03); }
.spark { vertical-align: middle; }

dialog {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--hairline);
  border-radius: var(--radius-lg); max-width: 640px; padding: 24px;
  box-shadow: var(--shadow-2);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}
@keyframes dialog-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: none; }
}
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }
dialog[open] { animation: dialog-in .18s ease-out; }
dialog::backdrop {
  background: rgba(2, 7, 10, 0.66); animation: backdrop-in .18s ease-out;
  -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px);
}
dialog table { min-width: 0; margin: 12px 0; }
dialog td, dialog th { border-bottom: 1px solid var(--hairline); }
code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }

footer {
  /* extra bottom padding keeps the fixed .scene-chip off the credits line */
  padding: 18px 24px 56px; border-top: 1px solid var(--hairline);
  color: var(--muted); font-size: 12.5px;
  background: rgba(4, 11, 15, .55);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}
footer p { margin: 0 0 6px; }
footer .credits { margin: 0; font-size: 11px; opacity: .85; }
footer .credits a { color: var(--muted); }
footer .credits a:hover { color: var(--accent); }

/* v2: region grouping, sub-scores, detail drill-down */
.region-row td {
  color: var(--accent); font-size: 11.5px; text-transform: uppercase;
  letter-spacing: 0.08em; background: var(--panel-2); padding: 5px 10px;
}
.clickable { cursor: pointer; }
tbody tr.clickable {
  transition: background-color .15s ease, box-shadow .15s ease;
}
/* No translateY here (unlike .card): a vertical shift on a <tr> breaks
   table row alignment with its siblings. box-shadow + border-color give
   the same "lifted" hover feedback without that layout side effect. */
@media (hover: hover) {
  tbody tr.clickable:hover {
    background: rgba(63, 216, 194, 0.12);
    box-shadow: inset 0 0 0 1px var(--accent);
  }
}
.nowrap { white-space: nowrap; }
.sub-row { margin: 2px 0 6px; }
.sub-chip {
  display: inline-block; font-size: 10.5px; color: var(--muted);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 5px;
}
.sub-chip.sub-hi { color: var(--pos); border-color: var(--pos); }
.sub-chip.sub-lo { color: var(--neg); border-color: var(--neg); }
.sub-chip.sub-na { opacity: 0.6; }

#detail {
  width: min(96vw, 1280px); max-width: 1280px; max-height: 92vh;
  overflow: auto; padding: clamp(18px, 2.6vw, 32px);
}
.detail-head {
  position: sticky; top: calc(clamp(18px, 2.6vw, 32px) * -1); z-index: 5;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 18px;
  margin: 0 0 20px; padding: clamp(18px, 2.6vw, 32px) 0 16px;
  background: linear-gradient(180deg, rgba(9, 21, 29, .98) 78%, rgba(9, 21, 29, 0));
}
.detail-head h2 { margin: 0; flex-wrap: wrap; }
.detail-head button { flex: 0 0 auto; }
.analysis-intro { max-width: 760px; margin: 4px 0 20px; }
.analysis-eyebrow {
  margin: 0 0 5px; color: var(--accent); font-size: 10.5px; font-weight: 700;
  letter-spacing: .18em; text-transform: uppercase;
}
.analysis-intro h3 {
  margin: 0; font-family: var(--font-display); font-size: clamp(28px, 3vw, 42px);
  font-weight: 400; line-height: 1.08;
}
.analysis-intro > p:last-child { margin: 8px 0 0; color: var(--muted); max-width: 680px; }
#detail .rec-detail {
  display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 4px 14px;
  margin: 0 0 24px; padding: 16px 18px; border: 1px solid var(--hairline);
  background: rgba(21, 40, 52, .48);
}
#detail .rec-detail .rec-summary,
#detail .rec-detail .rec-group-label,
#detail .rec-detail .rec-list,
#detail .rec-detail .tier-disclaimer { grid-column: 2; }
#detail .rec-detail .rec-summary { margin-top: 1px; }
.analysis-section { padding: 26px 0 30px; border-top: 1px solid var(--hairline); }
.analysis-section-head {
  display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 14px;
  align-items: start; margin-bottom: 16px;
}
.analysis-section-index {
  color: var(--accent-2); font-family: var(--font-display); font-size: 18px;
  font-style: italic; letter-spacing: .05em;
}
.analysis-section-head h3 {
  margin: 0; font-family: var(--font-display); font-size: 24px; font-weight: 420;
}
.analysis-section-head p { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }
.analysis-chart-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px;
}
.analysis-chart-grid > :last-child:nth-child(odd),
.analysis-chart-tall { grid-column: 1 / -1; }
.analysis-chart-card {
  min-width: 0; margin: 0; padding: 18px;
  background: linear-gradient(145deg, rgba(21, 40, 52, .62), rgba(10, 24, 32, .52));
  border: 1px solid var(--hairline); border-radius: var(--radius-md);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .055);
}
.analysis-chart-card figcaption h4 {
  margin: 0; color: var(--text); font-family: var(--font-display);
  font-size: 19px; font-weight: 430;
}
.analysis-chart-card figcaption p {
  min-height: 36px; margin: 3px 0 12px; color: var(--muted); font-size: 12px;
}
.analysis-stat-strip {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 12px; border-block: 1px solid var(--hairline);
}
.analysis-stat { min-width: 0; padding: 9px 8px; }
.analysis-stat + .analysis-stat { border-left: 1px solid var(--hairline); }
.analysis-stat small {
  display: block; overflow: hidden; color: var(--muted); font-size: 9.5px;
  letter-spacing: .08em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap;
}
.analysis-stat strong {
  display: block; overflow: hidden; margin-top: 2px; color: var(--text);
  font-family: var(--font-display); font-size: 18px; font-weight: 520;
  text-overflow: ellipsis; white-space: nowrap;
}
.analysis-stat.analysis-positive strong,
.analysis-positive { color: var(--pos); }
.analysis-stat.analysis-negative strong,
.analysis-negative { color: var(--neg); }
.analysis-chart-frame { min-width: 0; height: 270px; }
.analysis-chart-tall .analysis-chart-frame { height: clamp(330px, 42vw, 430px); }
.analysis-chart-frame canvas { display: block; width: 100% !important; height: 100% !important; }
.analysis-source {
  min-height: 18px; margin: 10px 0 0; color: var(--muted); font-size: 10.5px;
}
.analysis-source a { color: var(--accent); text-decoration: none; }
.analysis-source a:hover { text-decoration: underline; }
.analysis-factor-details,
.analysis-ledger {
  margin-top: 16px; border: 1px solid var(--hairline); border-radius: var(--radius-md);
  background: rgba(13, 27, 36, .42);
}
.analysis-factor-details summary,
.analysis-ledger summary {
  padding: 12px 14px; color: var(--accent); cursor: pointer; font-weight: 600;
}
.analysis-table-wrap { overflow-x: auto; border-top: 1px solid var(--hairline); }
.analysis-factor-table { min-width: 620px; margin: 0; }
.analysis-factor-table th,
.analysis-factor-table td { padding: 8px 12px; text-align: right; }
.analysis-factor-table th:first-child { text-align: left; }
.analysis-factor-table tbody th { color: var(--text); font-weight: 500; }
.analysis-factor-table td { color: var(--muted); }
.analysis-factor-table td.analysis-positive { color: var(--pos); }
.analysis-factor-table td.analysis-negative { color: var(--neg); }
.analysis-missing {
  margin: 0 0 20px; padding: 12px 14px; color: var(--muted);
  border-left: 2px solid var(--stale); background: rgba(251, 191, 36, .055);
}
.analysis-ledger { margin: 0 0 26px; }
.analysis-ledger .detail-metrics {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 24px; margin: 0; padding: 0 16px 16px;
}
.detail-metrics > div {
  display: flex; justify-content: space-between; align-items: start; gap: 10px;
  padding: 7px 0; border-bottom: 1px solid var(--hairline);
}
.detail-metrics dt { color: var(--muted); }
.detail-metrics dd { margin: 0; text-align: right; }
.metric-gap-reason {
  display: block; max-width: 280px; margin-top: 4px;
  color: var(--muted); font-size: 10.5px; line-height: 1.35;
}
a.metric-gap-reason { color: var(--accent); text-decoration: none; }
a.metric-gap-reason:hover { text-decoration: underline; }
.detail-listings { padding-bottom: 8px; }
.analysis-empty { color: var(--muted); padding: 18px 0; }

@media (max-width: 900px) {
  .analysis-chart-grid { grid-template-columns: 1fr; }
  .analysis-chart-grid > *, .analysis-chart-tall { grid-column: auto; }
  .analysis-ledger .detail-metrics { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  #detail { width: calc(100vw - 14px); max-height: calc(100vh - 14px); padding: 16px; }
  .detail-head { top: -16px; padding-top: 16px; }
  .detail-head h2 { font-size: 18px; }
  #detail .detail-head .sub-row,
  #detail .detail-head .tier-row { display: none; }
  #detail .rec-detail { display: block; }
  #detail .rec-detail > * { margin-bottom: 6px; }
  .analysis-section-head { grid-template-columns: 32px minmax(0, 1fr); gap: 8px; }
  .analysis-chart-card { padding: 13px; }
  .analysis-chart-card figcaption p { min-height: 0; }
  .analysis-stat { padding-inline: 5px; }
  .analysis-stat small {
    min-height: 22px; overflow: visible; font-size: 8.5px; line-height: 1.2;
    text-overflow: clip; white-space: normal;
  }
  .analysis-stat strong { font-size: 15px; }
  .analysis-chart-frame { height: 235px; }
  .analysis-chart-tall .analysis-chart-frame { height: 390px; }
}

/* v3: investment tiers */
.tier-row { margin: 4px 0 8px; }
.tier-badge {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  padding: 2px 9px; border-radius: var(--radius-sm); cursor: help; text-transform: uppercase;
}
.tier-badge.tier-buy { background: rgba(74, 222, 128, 0.18); color: var(--pos); border: 1px solid var(--pos); }
.tier-badge.tier-watch { background: rgba(251, 191, 36, 0.18); color: var(--stale); border: 1px solid var(--stale); }
.tier-badge.tier-avoid { background: rgba(248, 113, 113, 0.18); color: var(--neg); border: 1px solid var(--neg); }
.tier-badge.tier-notrated { background: var(--panel-2); color: var(--muted); border: 1px solid var(--border); }
/* Score-limited margin chip: e.g. "+4.7 to BUY" — never shown alongside a
   downgrade-limited tier, where the constraint is a flag, not the score. */
.tier-margin {
  display: inline-block; margin-left: 6px; font-size: 10.5px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
/* Per-badge disclaimer: deliberately MORE visible than the page footer note. */
.tier-disclaimer {
  display: inline-block; margin-top: 2px; font-size: 10px; color: var(--muted);
  font-style: italic;
}
.rec-summary { margin: 4px 0 0; font-size: 12.5px; color: var(--text); }
.rec-detail { margin-bottom: 14px; padding: 10px 12px; background: var(--panel-2); border-radius: var(--radius-md); }
.rec-group-label { margin: 8px 0 2px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.rec-list { margin: 0 0 4px; padding-left: 18px; font-size: 12.5px; }
.rec-list li { margin: 2px 0; }

/* v4: real-listing-photo showcase + visual polish */
.showcase-badge {
  display: inline-block; margin-left: 6px; font-size: 10.5px; color: var(--accent-2);
  border: 1px solid var(--accent-2); border-radius: 999px; padding: 1px 8px;
}
.showcase {
  position: relative; overflow: hidden; border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  margin-top: 10px;
}
.showcase-track { display: flex; transition: transform .4s cubic-bezier(.65, 0, .35, 1); }
.showcase-slide {
  flex: 0 0 100%; height: 420px; display: flex; flex-direction: column;
  box-sizing: border-box;
}
.showcase-slide-iframe iframe { flex: 1; width: 100%; border: 0; }
.showcase-disclosure {
  margin: 0; padding: 8px 12px; font-size: 11.5px; color: var(--muted);
  background: var(--panel-3); border-bottom: 1px solid var(--border);
}
.showcase-slide-iframe .showcase-cta {
  margin: 8px 12px; align-self: flex-start;
}
.browser-chrome {
  display: flex; align-items: center; gap: 6px; padding: 8px 12px;
  background: var(--panel-3); border-bottom: 1px solid var(--border);
}
.chrome-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--border); }
.chrome-url {
  margin-left: 8px; font-size: 11.5px; color: var(--muted);
  background: var(--panel); border-radius: 999px; padding: 2px 10px;
}
.showcase-linkout-body {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 16px; text-align: center;
}
.showcase-linkout-body .portal-icon { color: var(--muted); }
.showcase-linkout-body h4 { margin: 4px 0 0; font-size: 15px; }
.showcase-linkout-body p { margin: 0; font-size: 12px; color: var(--muted); max-width: 320px; }
.showcase-cta {
  display: inline-block; margin-top: 8px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #04211c; font-weight: 700; font-size: 13px;
  padding: 10px 26px; border-radius: 999px; text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
}
.showcase-cta:hover { transform: scale(1.03); box-shadow: var(--shadow-2); }
.showcase-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(0, 0, 0, .45); color: #fff; border: none;
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 16px;
  z-index: 2;
}
.showcase-nav.prev { left: 8px; }
.showcase-nav.next { right: 8px; }
.showcase-dots {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px; z-index: 2;
}
.showcase-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--border);
  cursor: pointer; transition: all .2s ease;
}
.showcase-dot.active { background: var(--accent); width: 16px; border-radius: 3px; }
@media (max-width: 640px) {
  .showcase-slide { height: 260px; }
  .showcase-nav { width: 26px; height: 26px; }
}

/* v5: prominent Featured showcase + flag glyphs + visual polish */
.name-flag { margin-right: 4px; font-size: 1.05em; }

#featured-section { margin-bottom: 24px; }
#featured-section .muted { margin: 2px 0 12px; }
.featured-intro {
  max-width: 880px; font-size: 12.5px; line-height: 1.65;
  text-shadow: 0 1px 10px rgba(2, 8, 12, .72);
}
/* Exactly 2 cards (TH/VN) now, not a variable 3-8 — an explicit 2-column
   layout is more intentional than continuing to rely on auto-fit's
   empty-track-collapse quirk now that the count is permanently fixed. */
.featured-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px;
}
@media (max-width: 760px) {
  .featured-grid { grid-template-columns: 1fr; }
}
.featured-card {
  background: var(--panel); border: 1px solid var(--hairline);
  border-radius: var(--radius-md); box-shadow: var(--shadow-1);
  overflow: hidden; display: flex; flex-direction: column;
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  transition: box-shadow .18s ease, border-color .18s ease;
}
@media (hover: hover) {
  .featured-card:hover { box-shadow: var(--shadow-2); border-color: var(--accent); }
}
.featured-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--hairline);
}
.featured-head h3 { margin: 0; font-size: 15px; }
.featured-flag { font-size: 1.3em; margin-right: 6px; }
.featured-portal { font-size: 11.5px; color: var(--muted); }
.featured-body { flex: 1; padding: 0; min-height: 0; display: block; }
.featured-card iframe {
  display: block; width: 100%; height: 380px; border: 0;
}
.featured-card .showcase-disclosure { margin: 0; }
.featured-card .showcase-cta { margin: 8px 12px; display: inline-block; }
.featured-linkout { display: flex; flex-direction: column; height: 380px; }
@media (max-width: 640px) {
  .featured-card iframe, .featured-linkout { height: 260px; }
}

/* v6: scraped-and-self-hosted photo slideshow — a parallel class set to
   .showcase-*, kept separate so the detail-modal portal carousel
   (showcaseHtml/showcaseSlideHtml) is never at regression risk from this. */
.ss-slideshow {
  position: relative; overflow: hidden; border-radius: var(--radius-md);
  background: var(--panel-2);
}
.ss-track { display: flex; transition: transform .4s cubic-bezier(.65, 0, .35, 1); }
.ss-slide { position: relative; flex: 0 0 100%; height: 340px; cursor: zoom-in; }
@media (max-width: 640px) {
  .ss-slide { height: 260px; }
}
.ss-slide img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.ss-caption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 8px 12px 6px; font-size: 11.5px; color: var(--text);
  background: linear-gradient(to top, rgba(0, 0, 0, .75), transparent);
  pointer-events: none;
}
.ss-caption .ss-price {
  display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 6px;
  font-family: var(--font-display); font-size: 16px; font-weight: 600;
  color: var(--accent-2); letter-spacing: .01em; margin-right: 6px;
}
.ss-caption .ss-price-eur {
  font-family: var(--font-sans); font-size: 11px; font-weight: 600;
  color: var(--text); letter-spacing: 0; opacity: .88; white-space: nowrap;
}
.ss-caption .ss-location { color: var(--muted); }
.ss-attribution {
  display: block; margin-top: 2px; font-size: 10px; color: var(--muted);
  text-decoration: none; pointer-events: auto;
}
.ss-attribution:hover { color: var(--accent); }
.ss-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(0, 0, 0, .45); color: #fff; border: none;
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 15px;
  z-index: 2;
}
.ss-nav.prev { left: 6px; }
.ss-nav.next { right: 6px; }
.ss-dots {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 5px; z-index: 2;
}
.ss-dot {
  width: 5px; height: 5px; border-radius: 50%; background: rgba(255, 255, 255, .5);
  cursor: pointer; transition: all .2s ease;
}
.ss-dot.active { background: #fff; width: 14px; border-radius: 3px; }
.ss-counter {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  z-index: 2; font-size: 10.5px; color: #fff;
  background: rgba(0, 0, 0, .45); border-radius: 999px; padding: 2px 9px;
}
.ss-stale-badge {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  display: inline-block; font-size: 10px; color: var(--stale);
  background: rgba(23, 30, 46, .85); border: 1px solid var(--stale);
  border-radius: var(--radius-sm); padding: 1px 7px; cursor: help;
}
.ss-catalog-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 48px; padding: 8px 12px;
  color: var(--muted); font-size: 10.5px;
  background: linear-gradient(90deg, rgba(7, 22, 30, .98), rgba(10, 29, 38, .94));
  border-top: 1px solid var(--hairline);
}
.ss-catalog-nav strong { color: var(--text); font-variant-numeric: tabular-nums; }
.ss-catalog-nav > div { display: flex; gap: 6px; }
.ss-catalog-page {
  min-height: 30px; padding: 5px 10px; border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); background: rgba(255, 255, 255, .035);
  font-size: 10px; -webkit-backdrop-filter: none; backdrop-filter: none;
}
.ss-catalog-page:hover:not(:disabled) {
  color: var(--accent); border-color: rgba(63, 216, 194, .48);
  background: rgba(63, 216, 194, .07); box-shadow: none;
}
.ss-catalog-page:disabled { opacity: .34; cursor: default; }
@media (max-width: 480px) {
  .ss-catalog-nav { align-items: flex-start; flex-direction: column; }
  .ss-catalog-nav > div { width: 100%; }
  .ss-catalog-page { flex: 1; }
}
.ss-lightbox {
  border: none; background: transparent; padding: 0; max-width: 92vw; max-height: 92vh;
}
.ss-lightbox::backdrop { background: rgba(0, 0, 0, .8); }
.ss-lightbox img { display: block; max-width: 92vw; max-height: 92vh; object-fit: contain; }
.featured-card.has-photos .featured-body { padding: 0; min-height: 0; display: block; }

/* v11: a deliberate preference panel rather than a dense toolbar. The
   controls still use ss-filter-* classes so the existing delegated handlers
   remain isolated from the ranked-table filters below. */
.ss-filter-panel {
  position: relative; padding: 0; overflow: hidden;
  background:
    radial-gradient(circle at 100% 0, rgba(63, 216, 194, .08), transparent 36%),
    linear-gradient(145deg, rgba(8, 23, 31, .95), rgba(12, 31, 40, .86));
  border-bottom: 1px solid var(--hairline);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .055);
}
.ss-filter-panel::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(63, 216, 194, .55), rgba(245, 192, 105, .35), transparent);
  pointer-events: none;
}
.ss-filter-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin: 0; padding: 9px 12px;
}
.ss-filter-body { padding: 9px 12px 10px; }
.ss-filter-open, .market-preferences-open {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex: 1 1 auto; min-width: 0; padding: 2px 4px; color: inherit;
  background: transparent; border: 0; border-radius: 7px; text-align: left;
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
.ss-filter-open:hover, .market-preferences-open:hover {
  background: rgba(63, 216, 194, .045); border-color: transparent; box-shadow: none;
}
.ss-filter-title-wrap { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.ss-filter-kicker {
  color: var(--accent); font-size: 8px; font-weight: 700;
  letter-spacing: .16em; line-height: 1.3; text-transform: uppercase;
}
.ss-filter-title {
  color: var(--text); font-family: var(--font-display); font-size: 14px;
  font-weight: 450; letter-spacing: .01em; line-height: 1.25;
}
.ss-filter-actions {
  display: flex; align-items: center; justify-content: flex-end; gap: 4px;
}
.ss-filter-count {
  color: var(--muted); font-size: 9.5px; white-space: nowrap;
  border: 1px solid var(--hairline); border-radius: 999px;
  background: rgba(255, 255, 255, .03); padding: 3px 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}
.ss-filter-count strong { color: var(--text); font-size: 10.5px; font-weight: 650; }
.ss-filter-count span { color: rgba(154, 179, 184, .72); }
.ss-filters-clear {
  color: var(--accent); background: transparent; border-color: transparent;
  border-radius: 7px; padding: 3px 5px; font-size: 9.5px; white-space: nowrap;
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
.ss-filters-clear span { display: inline-block; margin-right: 2px; transition: transform .18s ease; }
.ss-filters-clear:hover { background: rgba(63, 216, 194, .09); box-shadow: none; }
.ss-filters-clear:hover span { transform: rotate(-35deg); }
.ss-filter-story { display: block; }
.ss-filter-chapter {
  display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: 26px;
  padding: 25px 0; border-bottom: 1px solid rgba(255, 255, 255, .065);
}
.ss-filter-chapter:first-child { padding-top: 4px; }
.ss-filter-chapter-copy h4 {
  margin: 0 0 5px; color: #f0e9dc; font-family: var(--font-display);
  font-size: 21px; font-weight: 390; letter-spacing: -.015em;
}
.ss-filter-chapter-copy p {
  margin: 0; color: rgba(154, 179, 184, .72); font-family: var(--font-display);
  font-size: 11px; font-style: italic; line-height: 1.45;
}
.ss-filter-grid { display: grid; gap: 20px 18px; min-width: 0; }
.ss-filter-grid-price { grid-template-columns: 1fr; }
.ss-filter-grid-home { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ss-filter-field { min-width: 0; padding: 0; background: transparent; border: 0; box-shadow: none; }
.ss-filter-field-wide { grid-column: 1 / -1; }
.ss-filter-field-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; margin: 0 0 9px;
}
.ss-filter-label {
  color: #c9d6d6; font-family: var(--font-display); font-size: 13px;
  font-weight: 430; letter-spacing: 0; line-height: 1.25; text-transform: none;
}
.ss-filter-support {
  color: rgba(154, 179, 184, .64); font-family: var(--font-display);
  font-size: 9.5px; font-style: italic;
}
.ss-filter-controls { min-width: 0; }
.ss-segmented {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  overflow: visible; border: 0; border-radius: 0; background: transparent;
}
.ss-segmented-wide { flex-wrap: nowrap; }
.ss-filter-chip {
  min-height: 34px; color: var(--muted); background: rgba(255, 255, 255, .025);
  border: 1px solid transparent; border-radius: 999px;
  padding: 6px 12px; font-size: 10.5px; cursor: pointer;
  -webkit-backdrop-filter: none; backdrop-filter: none;
  transition: color .16s ease, background-color .16s ease, border-color .16s ease;
}
.ss-segmented-wide .ss-filter-chip { flex: 1 1 0; }
.ss-segmented-numeric .ss-filter-chip {
  flex: 0 0 35px; width: 35px; min-width: 35px; padding: 0;
  border-color: rgba(140, 190, 195, .15); background: transparent;
}
.ss-filter-chip:hover {
  color: var(--text); border-color: rgba(63, 216, 194, .28);
  background: rgba(63, 216, 194, .045); box-shadow: none;
}
.ss-filter-chip.active {
  color: #f5d7a3; font-weight: 630; border-color: rgba(245, 192, 105, .34);
  background: rgba(245, 192, 105, .095); box-shadow: none;
}
.ss-range-controls { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ss-range-divider {
  color: rgba(154, 179, 184, .58); font-family: var(--font-display);
  font-size: 10px; font-style: italic; text-transform: none;
}
.ss-select-shell { position: relative; display: block; flex: 1 1 0; min-width: 0; }
.ss-select-shell::after {
  content: "⌄"; position: absolute; top: 50%; right: 2px; transform: translateY(-56%);
  color: var(--accent); font-size: 12px; line-height: 1; pointer-events: none;
}
.ss-filter-select {
  width: 100%; min-width: 0; min-height: 36px; appearance: none;
  color: var(--text); background: transparent;
  border: 0; border-bottom: 1px solid rgba(140, 190, 195, .26); border-radius: 0;
  padding: 7px 22px 7px 1px; font-size: 11px; font-variant-numeric: tabular-nums;
  transition: border-color .16s ease, color .16s ease;
}
.ss-filter-select:hover { border-color: rgba(245, 192, 105, .5); background: transparent; }
.ss-sort-toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  flex: 0 0 auto; min-height: 35px; color: #d7e1df;
  background: transparent; border: 0; border-bottom: 1px solid rgba(140, 190, 195, .26);
  border-radius: 0; padding: 6px 2px; font-size: 10.5px;
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
.ss-sort-toggle:hover { color: #f5d7a3; background: transparent; border-color: rgba(245, 192, 105, .5); box-shadow: none; }
.ss-sort-icon { color: var(--accent); font-size: 13px; }
.ss-amenities-panel {
  margin: 0; background: transparent;
  border: 0; border-bottom: 1px solid rgba(255, 255, 255, .065); border-radius: 0;
}
.ss-amenities-panel summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 58px; padding: 0; cursor: pointer; list-style: none;
}
.ss-amenities-panel summary::-webkit-details-marker { display: none; }
.ss-amenities-panel summary > span:first-child { display: flex; align-items: baseline; gap: 9px; }
.ss-amenities-summary {
  color: rgba(154, 179, 184, .76); font-family: var(--font-display);
  font-size: 10px; font-style: italic; white-space: nowrap;
}
.ss-amenities-summary span { display: inline-block; color: var(--accent); margin-left: 6px; transition: transform .16s ease; }
.ss-amenities-panel[open] .ss-amenities-summary span { transform: rotate(180deg); }
.ss-amenity-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 6px;
  padding: 5px 0 16px;
}
.ss-amenity-grid .ss-filter-chip {
  border-color: rgba(140, 190, 195, .14); border-radius: 999px;
  text-align: center; background: transparent;
}
.ss-amenity-grid .ss-filter-chip:hover { border-color: rgba(63, 216, 194, .4); }
.ss-amenity-grid .ss-filter-chip.active {
  color: #f5d7a3; border-color: rgba(245, 192, 105, .34);
  background: rgba(245, 192, 105, .095);
}
.ss-filter-footer {
  display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap;
  gap: 5px 14px; margin-top: 14px;
  color: rgba(154, 179, 184, .6); font-size: 9.5px; line-height: 1.45;
}
.ss-filter-footer strong { color: #c5d2d1; font-weight: 540; }
.ss-source-coverage strong { color: var(--accent); font-variant-numeric: tabular-nums; }
.ss-source-gap { display: inline-flex; align-items: center; gap: 6px; }
.ss-source-gap-icon {
  display: inline-grid; place-items: center; width: 15px; height: 15px;
  color: var(--accent-2); border: 1px solid rgba(245, 192, 105, .42);
  border-radius: 50%; font-family: var(--font-display); font-size: 10px; font-style: italic;
}
@media (max-width: 720px) {
  .ss-filter-chapter { grid-template-columns: 1fr; gap: 14px; }
  .ss-filter-chapter-copy p { max-width: 280px; }
}
@media (max-width: 520px) {
  .ss-filter-header { align-items: center; padding: 8px 10px; }
  .ss-filter-actions { align-items: center; flex-direction: row; gap: 3px; }
  .ss-filter-count span { display: none; }
  .ss-filter-open .preference-focus-prompt { font-size: 0; gap: 0; }
  .ss-filter-chapter { padding: 18px 0; }
  .ss-filter-chapter:first-child { padding-top: 2px; }
  .ss-filter-grid-home { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ss-filter-area, .ss-filter-location { grid-column: 1 / -1; }
  .ss-segmented-wide { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ss-range-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
  .ss-sort-toggle { grid-column: 1 / -1; }
  .ss-filter-footer { align-items: flex-start; flex-direction: column; }
  .ss-amenities-panel summary > span:first-child { align-items: flex-start; flex-direction: column; gap: 1px; }
}
.ss-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 9px; min-height: 170px; padding: 20px; text-align: center; color: var(--muted);
}
.ss-empty p { display: flex; flex-direction: column; gap: 3px; margin: 0; }
.ss-empty p strong { color: var(--text); font-family: var(--font-display); font-size: 15px; font-weight: 450; }
.ss-empty p span { font-size: 11px; }
.ss-caption .ss-facts { margin-right: 6px; opacity: .92; }

/* Market preferences: the ranked-table filters use the same calm, editorial
   language as the Featured listing controls while retaining separate state. */
.filter-bar.market-preferences {
  position: relative; isolation: isolate; display: block; overflow: hidden;
  margin: 9px 0 14px; padding: 0;
  background:
    radial-gradient(circle at 100% 0, rgba(63, 216, 194, .08), transparent 34%),
    linear-gradient(145deg, rgba(8, 23, 31, .88), rgba(15, 35, 45, .73));
  border: 1px solid rgba(140, 190, 195, .2); border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .075), var(--shadow-1);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}
.market-preferences::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 1px;
  background: linear-gradient(90deg, transparent 4%, rgba(63, 216, 194, .62), rgba(245, 192, 105, .42), transparent 94%);
  pointer-events: none;
}
.market-preferences::after {
  content: none;
}
.market-preferences.has-selection { border-color: rgba(63, 216, 194, .3); }
.market-preferences-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 11px 14px 9px;
}
.market-preferences-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 9px; min-width: 0; }
.market-preferences-kicker {
  display: flex; align-items: center; gap: 6px; color: var(--accent);
  font-size: 8px; font-weight: 700; letter-spacing: .17em; text-transform: uppercase;
}
.market-preferences-kicker > span {
  width: 12px; height: 1px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 8px rgba(63, 216, 194, .38);
}
.market-preferences-title {
  color: var(--text); font-family: var(--font-display); font-size: 16px;
  font-weight: 430; line-height: 1.2; letter-spacing: .005em;
}
.market-preferences-scope {
  color: rgba(154, 179, 184, .62); font-family: var(--font-display);
  font-size: 8.5px; font-style: italic; line-height: 1.4;
}
.market-preferences-actions {
  display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap;
  gap: 8px; flex: 0 0 auto;
}
.filter-count {
  display: inline-flex; align-items: baseline; gap: 3px; min-height: 28px;
  color: var(--muted); background: rgba(255, 255, 255, .035);
  border: 1px solid var(--hairline); border-radius: 999px; padding: 4px 9px;
  font-size: 9.5px; white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .045);
}
.filter-count::before {
  content: ""; width: 5px; height: 5px; margin-right: 3px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 8px rgba(63, 216, 194, .62);
}
.filter-count strong { color: var(--text); font-size: 11px; font-weight: 680; }
.filter-count[hidden] { display: none; }
#filters-clear, .market-filters-reset {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-height: 28px; padding: 4px 9px; color: var(--accent);
  background: rgba(63, 216, 194, .055); border-color: rgba(63, 216, 194, .18);
  border-radius: 9px; font-size: 10.5px; font-weight: 620;
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
#filters-clear:not(:disabled):hover, .market-filters-reset:not(:disabled):hover {
  color: var(--text); background: rgba(63, 216, 194, .11);
  border-color: rgba(63, 216, 194, .42); box-shadow: none;
}
#filters-clear:disabled, .market-filters-reset:disabled {
  display: none;
}
.filter-reset-icon { display: inline-block; font-size: 13px; transition: transform .18s ease; }
#filters-clear:not(:disabled):hover .filter-reset-icon,
.market-filters-reset:not(:disabled):hover .filter-reset-icon { transform: rotate(-35deg); }
.preference-focus-prompt {
  position: relative; display: inline-grid; place-items: center; flex: 0 0 28px;
  width: 28px; height: 28px; color: var(--muted);
  border: 1px solid rgba(140, 190, 195, .16); border-radius: 50%;
  background: rgba(255, 255, 255, .018);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .045);
  transition: color .18s ease, border-color .18s ease, background-color .18s ease,
    box-shadow .18s ease, transform .18s ease;
}
.preference-focus-icon {
  position: relative; display: inline-block; width: 11px; height: 11px;
  border: 1px solid rgba(234, 244, 242, .74); border-radius: 50%;
  transition: border-color .18s ease, transform .18s ease;
}
.preference-focus-icon::after {
  content: ""; position: absolute; right: -4px; bottom: -2px;
  width: 5px; height: 1px; background: rgba(234, 244, 242, .74); transform: rotate(45deg);
  transform-origin: left center;
}
.ss-filter-open:hover .preference-focus-prompt,
.market-preferences-open:hover .preference-focus-prompt {
  color: var(--accent); border-color: rgba(63, 216, 194, .5);
  background: rgba(63, 216, 194, .065);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 0 18px rgba(63, 216, 194, .12);
  transform: translateY(-1px);
}
.ss-filter-open:hover .preference-focus-icon,
.market-preferences-open:hover .preference-focus-icon { transform: scale(1.08); }
.market-preferences.has-selection .preference-focus-prompt {
  color: var(--accent-2); border-color: rgba(245, 192, 105, .3);
  background: rgba(245, 192, 105, .055);
}

.preference-focus-dialog {
  width: min(760px, calc(100vw - 32px)); max-width: 760px;
  max-height: min(86vh, 780px); margin: auto; padding: 0; overflow: auto;
  overscroll-behavior: contain; scrollbar-color: rgba(140, 190, 195, .28) transparent;
  color: var(--text);
  background:
    radial-gradient(circle at 12% -12%, rgba(245, 192, 105, .075), transparent 32%),
    radial-gradient(circle at 102% 18%, rgba(63, 216, 194, .055), transparent 30%),
    linear-gradient(150deg, #0c2029, #081820 76%);
  border: 1px solid rgba(180, 205, 201, .18); border-radius: 26px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .065), 0 34px 110px rgba(1, 7, 10, .82);
  animation: none;
}
.preference-focus-dialog::backdrop {
  background:
    radial-gradient(circle at 50% 44%, rgba(19, 49, 57, .28), transparent 38%),
    rgba(2, 7, 10, .84);
  -webkit-backdrop-filter: blur(12px) saturate(80%); backdrop-filter: blur(12px) saturate(80%);
}
.preference-focus-header {
  position: sticky; top: 0; z-index: 3;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 24px 28px 21px; border-bottom: 1px solid rgba(255, 255, 255, .06);
  background: linear-gradient(180deg, rgba(12, 32, 41, .985), rgba(10, 28, 36, .965));
  box-shadow: 0 8px 24px rgba(2, 8, 12, .12);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}
.preference-focus-header > div:first-child { min-width: 0; }
.preference-focus-header h3 {
  margin: 2px 0 0; color: #f1eadf; font-family: var(--font-display);
  font-size: 30px; font-weight: 370; letter-spacing: -.025em; line-height: 1.08;
}
.preference-focus-deck {
  margin: 7px 0 0; color: rgba(154, 179, 184, .72); font-family: var(--font-display);
  font-size: 11px; font-style: italic; line-height: 1.4;
}
.preference-focus-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.preference-focus-close {
  display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0;
  color: var(--muted); background: rgba(255, 255, 255, .035);
  border: 1px solid rgba(255, 255, 255, .09); border-radius: 50%; font-size: 18px; line-height: 1;
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
.preference-focus-close:hover { color: var(--text); background: rgba(63, 216, 194, .08); box-shadow: none; }
.preference-focus-dialog .market-preferences-grid { padding: 8px 28px 24px; }
#market-preferences-dialog { max-width: 700px; }
#market-preferences-dialog .market-preferences-grid { grid-template-columns: 1fr; gap: 0; }
#market-preferences-dialog .preference-field {
  display: grid; grid-template-columns: 116px minmax(0, 1fr); align-items: start;
  gap: 22px; padding: 22px 0; border: 0; background: transparent;
}
#market-preferences-dialog .preference-field + .preference-field {
  border-top: 1px solid rgba(255, 255, 255, .065); border-left: 0;
}
#market-preferences-dialog .filter-label {
  display: block; margin: 0; color: #f0e9dc; font-family: var(--font-display);
  font-size: 18px; font-weight: 400; letter-spacing: -.01em; text-transform: none;
}
#market-preferences-dialog .preference-field-note {
  display: block; margin-top: 4px; color: rgba(154, 179, 184, .63);
  font-family: var(--font-display); font-size: 10px; font-style: italic;
}
#market-preferences-dialog .filter-group { gap: 7px; padding-top: 1px; }
#market-preferences-dialog .filter-chip { min-height: 34px; padding: 6px 13px; font-size: 10.5px; }
.ss-filter-dialog { max-width: 760px; }
.ss-filter-dialog .ss-filter-body { padding: 20px 28px 22px; }
.preference-focus-header .ss-filter-count {
  border-color: transparent; background: transparent; box-shadow: none; padding-left: 0; padding-right: 0;
}
.preference-focus-count { display: flex; align-items: baseline; gap: 5px; }
.preference-focus-count strong {
  color: #f5d7a3; font-family: var(--font-display); font-size: 18px; font-weight: 450;
}
.preference-focus-count span { font-family: var(--font-display); font-size: 9.5px; font-style: italic; }
@keyframes preference-focus-in {
  from { opacity: 0; transform: scale(.965) translateY(8px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .preference-focus-dialog[open] { animation: preference-focus-in .2s cubic-bezier(.2, .72, .3, 1); }
}
@media (max-width: 600px) {
  .preference-focus-dialog { width: calc(100vw - 18px); max-height: 90vh; border-radius: 20px; }
  .preference-focus-header { align-items: flex-start; padding: 17px 13px 15px; }
  .preference-focus-header h3 { font-size: 23px; }
  .preference-focus-deck { display: none; }
  .preference-focus-actions { flex-wrap: wrap; }
  .preference-focus-dialog .market-preferences-grid,
  .ss-filter-dialog .ss-filter-body { padding: 14px 13px 16px; }
  #market-preferences-dialog .preference-field {
    grid-template-columns: 1fr; gap: 10px; padding: 18px 0;
  }
}
.market-preferences-grid {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 18px;
  padding: 9px 14px 11px;
}
.preference-field {
  display: flex; align-items: flex-start; gap: 10px; min-width: 0; padding: 0;
  background: transparent; border: 0; border-radius: 0; box-shadow: none;
}
.preference-field + .preference-field {
  padding-left: 18px; border-left: 1px solid rgba(255, 255, 255, .07);
}
.filter-label {
  flex: 0 0 auto; margin-top: 7px; color: var(--muted); font-size: 8px;
  font-weight: 700; line-height: 1.35; letter-spacing: .11em; text-transform: uppercase;
}
.filter-group { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; min-width: 0; }
.filter-chip {
  position: relative; min-height: 28px; padding: 4px 10px;
  color: var(--muted); background: transparent;
  border: 1px solid rgba(140, 190, 195, .17); border-radius: 999px;
  font-size: 9.5px; font-weight: 570; cursor: pointer;
  -webkit-backdrop-filter: none; backdrop-filter: none;
  transition: border-color .16s ease, color .16s ease, background-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.filter-chip:hover {
  color: var(--text); border-color: rgba(63, 216, 194, .52);
  background: rgba(63, 216, 194, .055); box-shadow: none;
}
.filter-chip.active {
  color: #f5d7a3; border-color: rgba(245, 192, 105, .36);
  background: rgba(245, 192, 105, .09); box-shadow: none;
}
#filter-tier-group .filter-chip { display: inline-flex; align-items: center; gap: 5px; }
#filter-tier-group .filter-chip::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: var(--muted); box-shadow: 0 0 0 3px rgba(154, 179, 184, .07);
}
#filter-tier-group .filter-chip[data-tier="BUY"]::before { background: var(--pos); }
#filter-tier-group .filter-chip[data-tier="WATCH"]::before { background: var(--stale); }
#filter-tier-group .filter-chip[data-tier="AVOID"]::before { background: var(--neg); }
#filter-tier-group .filter-chip[data-tier="NOT_RATED"]::before { background: var(--muted); }
#filter-tier-group .filter-chip[data-tier="BUY"].active { color: #91e9b0; border-color: rgba(74, 222, 128, .34); background: rgba(74, 222, 128, .075); }
#filter-tier-group .filter-chip[data-tier="WATCH"].active { color: #f5cf82; border-color: rgba(251, 191, 36, .34); background: rgba(251, 191, 36, .075); }
#filter-tier-group .filter-chip[data-tier="AVOID"].active { color: #f7a0ae; border-color: rgba(251, 113, 133, .34); background: rgba(251, 113, 133, .075); }
#filter-tier-group .filter-chip[data-tier="NOT_RATED"].active { color: #c3d4d5; border-color: rgba(154, 179, 184, .34); background: rgba(154, 179, 184, .075); }
#filter-tier-group .filter-chip.active::before { background: currentColor; box-shadow: none; }
.filter-empty td { text-align: center; padding: 30px 10px; color: var(--muted); }
.filter-empty strong { display: block; margin-bottom: 2px; color: var(--text); font-family: var(--font-display); font-size: 16px; font-weight: 430; }
@media (max-width: 1000px) {
  .market-preferences-header { padding: 10px 12px; }
  .market-preferences-grid { grid-template-columns: 1fr; gap: 8px; padding: 9px 12px 11px; }
  .preference-field + .preference-field {
    padding: 8px 0 0; border-top: 1px solid rgba(255, 255, 255, .07); border-left: 0;
  }
}
@media (max-width: 440px) {
  .market-preferences-header { gap: 8px; }
  .market-preferences-kicker, .market-preferences-scope { display: none; }
  #market-preferences-dialog .market-preferences-kicker { display: flex; }
  .market-preferences-title { font-size: 14px; }
  .market-preferences-actions { flex-wrap: nowrap; gap: 4px; }
  .filter-count span { display: none; }
  .market-preferences-heading { align-items: center; }
  .preference-field { align-items: flex-start; flex-direction: column; gap: 5px; }
  .filter-label { margin-top: 0; }
  .filter-chip { flex: 1 1 auto; justify-content: center; }
}

/* v9: tropical Thailand video backdrop + glass redesign.
   .bg sits fixed behind everything; bg.js crossfades the two stacked videos
   (self-hosted Commons transcodes — attribution in footer + .scene-chip).
   The poster frame doubles as the static fallback whenever playback is
   skipped (reduced motion, Data Saver, no VP9) or a clip errors. */
.bg {
  position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background: var(--bg) url("/media/bg/poster-enhanced.jpg") center / cover no-repeat;
}
.bg-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0; transition: opacity 2s ease;
  filter: saturate(1.12) brightness(.94);
}
.bg-video.on { opacity: 1; }
/* Film grain masks the 480p upscale; SVG turbulence, no asset request. */
.bg-grain {
  position: absolute; inset: 0; opacity: .07; mix-blend-mode: overlay;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 240px 240px;
}
/* Dark scrim keeps the data legible: light at the hero, heavier down-page. */
.bg-scrim {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(3, 9, 13, .12), rgba(3, 9, 13, .6) 82%),
    linear-gradient(to bottom,
      rgba(3, 9, 13, .68) 0%, rgba(3, 9, 13, .38) 22%,
      rgba(4, 11, 15, .60) 55%, rgba(3, 9, 13, .93) 100%);
}

/* Live footage credit, bottom-left: location + author + license of the
   scene currently playing. Doubles as the on-screen CC attribution. */
.scene-chip {
  position: fixed; left: 16px; bottom: 14px; z-index: 5;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--muted); text-decoration: none;
  background: rgba(5, 13, 19, .6); border: 1px solid var(--hairline);
  border-radius: 999px; padding: 5px 12px 5px 10px;
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  transition: color .15s ease, border-color .15s ease;
}
.scene-chip::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 8px var(--accent);
}
.scene-chip:hover { color: var(--text); border-color: var(--accent); }
@media (max-width: 640px) {
  .scene-chip { display: none; } /* footer credits still carry attribution */
}

/* Fallbacks & performance */
@media (prefers-reduced-motion: reduce) {
  .bg-video { display: none; } /* bg.js also skips playback; poster remains */
}
@media (max-width: 640px) {
  :root { --glass-blur: saturate(140%) blur(12px); }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  /* No glass support: solid panels so text never sits on raw video. */
  :root {
    --panel: #0d1b24;
    --panel-2: #152834;
    --panel-3: #1e3848;
  }
}

/* v10: motion & lighting polish.
   Every animation lives behind prefers-reduced-motion: no-preference; the
   .reveal class is only ever added by fx.js, so content can't get stuck
   hidden without JS. */

/* Live hero stats (populated by render() from the real payload) */
.hero-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.hero-stat {
  font-size: 12.5px; color: var(--muted);
  background: rgba(5, 13, 19, .52); border: 1px solid var(--hairline);
  border-radius: 999px; padding: 6px 15px;
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}
.hero-stat strong {
  color: var(--accent); font-weight: 700; margin-right: 5px;
  font-variant-numeric: tabular-nums;
}

/* Glass catch-light: a 1px top highlight, like light grazing the pane.
   Component hover rules are more specific and still win, as intended. */
.card, .featured-card, .table-wrap, .filter-bar, dialog {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), var(--shadow-1);
}

@media (hover: hover) {
  .card.clickable:hover, .featured-card:hover {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07),
                0 0 0 1px rgba(63, 216, 194, .30),
                0 10px 44px rgba(63, 216, 194, .10),
                var(--shadow-2);
  }
}

/* Slim lagoon scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgba(63, 216, 194, .35) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(63, 216, 194, .28); border-radius: 999px;
  border: 2px solid transparent; background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background-color: rgba(63, 216, 194, .5); }

@media (prefers-reduced-motion: no-preference) {
  /* Hero entrance: kicker → title → cadence/stats rise in sequence */
  @keyframes rise {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: none; }
  }
  .hero-kicker { animation: rise .8s cubic-bezier(.2, .7, .3, 1) both; }
  h1 { animation: rise .9s .12s cubic-bezier(.2, .7, .3, 1) both; }
  .hero-body .cadence, .hero-stats { animation: rise .9s .26s cubic-bezier(.2, .7, .3, 1) both; }

  /* Slow molten drift across the gradient words */
  h1 em { background-size: 220% 100%; animation: gradient-drift 9s ease-in-out infinite alternate; }
  @keyframes gradient-drift {
    from { background-position: 0% 0; }
    to { background-position: 100% 0; }
  }

  /* Scroll reveal (class added by fx.js only) */
  .reveal { opacity: 0; transform: translateY(22px); }
  .reveal.in {
    opacity: 1; transform: none;
    transition: opacity .7s ease, transform .7s cubic-bezier(.2, .7, .3, 1);
  }
}

/* v11: luxury pass — cinematic grade, gold foil, serif numerals, shine. */

/* One color grade unifies all three clips: teal lifted in the shadows,
   gold in the highlights, like a single film stock. */
.bg-grade {
  position: absolute; inset: 0; mix-blend-mode: soft-light; pointer-events: none;
  background: linear-gradient(155deg,
    rgba(20, 180, 160, .55), rgba(10, 30, 40, 0) 45%, rgba(245, 182, 95, .5));
}

/* Gold serif rank numerals in the ranked table (data cells only — the
   region divider rows and the empty-filter row keep their own styling). */
#markets-table tbody tr:not(.region-row):not(.filter-empty) td:first-child {
  font-family: var(--font-display); font-size: 16px; color: var(--accent-2);
}

#detail-title .score { font-size: 26px; }

/* Sources chip: the denominator sits outside the counted <strong>. */
.hero-stat strong:has(+ .hero-stat-denom) { margin-right: 0; }
.hero-stat-denom { color: var(--accent); font-weight: 700; margin-right: 5px; }

/* Shine sweep across the CTA pill on hover */
.showcase-cta { position: relative; overflow: hidden; }
.showcase-cta::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -80%; width: 55%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, .55), transparent);
  transform: skewX(-20deg);
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .showcase-cta::after { transition: left .55s ease; }
  .showcase-cta:hover::after { left: 130%; }
}

/* Shimmer skeletons while the payload is loading (grids start empty) */
.featured-grid:empty, .spotlight-grid:empty, .sea-grid:empty {
  display: block; min-height: 200px;
  background-color: var(--panel);
  border: 1px solid var(--hairline); border-radius: var(--radius-md);
}
@media (prefers-reduced-motion: no-preference) {
  .featured-grid:empty, .spotlight-grid:empty, .sea-grid:empty {
    background-image: linear-gradient(100deg,
      transparent 42%, rgba(255, 255, 255, .07) 50%, transparent 58%);
    background-size: 220% 100%; background-repeat: no-repeat;
    animation: shimmer 1.5s linear infinite;
  }
  @keyframes shimmer {
    from { background-position: 120% 0; }
    to { background-position: -120% 0; }
  }
}
