:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-solid: #ffffff;
  --surface-muted: #fafafc;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #8e8e93;
  --hairline: rgba(60, 60, 67, 0.14);
  --hairline-strong: rgba(60, 60, 67, 0.22);
  --blue: #0071e3;
  --blue-soft: #e9f3ff;
  --teal: #00a6a6;
  --violet: #6e5ae6;
  --orange: #ff9f0a;
  --red: #d70015;
  --green: #1f9d67;
  --sidebar-width: 240px;
  --topbar-height: 76px;
  --page-max: 1640px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow-soft: 0 12px 38px rgba(0, 0, 0, 0.055);
  --shadow-float: 0 20px 60px rgba(0, 0, 0, 0.09);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "PingFang TC", "Noto Sans TC", "Helvetica Neue", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 88% -8%, rgba(0, 113, 227, 0.09), transparent 31rem),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
select,
input {
  font: inherit;
}

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

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(0, 113, 227, 0.35);
  outline-offset: 2px;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 24px 16px 18px;
  overflow-y: auto;
  background: rgba(251, 251, 253, 0.82);
  border-right: 1px solid var(--hairline);
  backdrop-filter: saturate(180%) blur(28px);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 10px 18px;
}

.sidebar-brand > span:last-child strong,
.sidebar-brand > span:last-child small {
  display: block;
}

.sidebar-brand > span:last-child strong {
  font-size: 14px;
  letter-spacing: -0.01em;
}

.sidebar-brand > span:last-child small {
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 11px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  color: white;
  background: linear-gradient(145deg, #1687ef, #5b57e8);
  border-radius: 12px;
  box-shadow: 0 9px 20px rgba(0, 113, 227, 0.22);
}

.brand-copy strong,
.brand-copy span {
  display: block;
}

.brand-copy strong {
  font-size: 14px;
  letter-spacing: -0.01em;
}

.brand-copy span {
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 11px;
}

.sidebar-nav,
#sidebar-nav {
  display: grid;
  gap: 4px;
}

.nav-link,
#sidebar-nav a,
#sidebar-nav button {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
  color: var(--text-secondary);
  text-align: left;
  text-decoration: none;
  background: transparent;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  transition: color 180ms ease, background 180ms ease, transform 180ms ease;
}

.nav-link:hover,
#sidebar-nav a:hover,
#sidebar-nav button:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.035);
}

.nav-link[aria-current="page"],
.nav-link.active,
#sidebar-nav [aria-current="page"],
#sidebar-nav .active {
  color: var(--blue);
  font-weight: 620;
  background: var(--blue-soft);
}

.nav-icon {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  place-items: center;
  font-size: 17px;
}

.sidebar-meta {
  margin-top: auto;
  padding: 18px 10px 4px;
  color: var(--text-tertiary);
  font-size: 11px;
  line-height: 1.55;
  border-top: 1px solid var(--hairline);
}

.app-main {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 24;
  display: flex;
  min-height: var(--topbar-height);
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 32px;
  background: rgba(245, 245, 247, 0.78);
  border-bottom: 1px solid rgba(60, 60, 67, 0.08);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
}

.topbar-heading {
  display: flex;
  min-width: 205px;
  align-items: center;
  gap: 18px;
}

.topbar-heading .eyebrow {
  margin: 0 0 3px;
  color: var(--blue);
  font-size: 10px;
  font-weight: 720;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-heading h1 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.data-freshness {
  max-width: 200px;
  margin: 0;
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.45;
}

.global-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-control,
.global-filters label {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  color: var(--text-secondary);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--hairline);
  border-radius: 10px;
}

.filter-control select,
.filter-control input,
.global-filters select,
.global-filters input {
  max-width: 145px;
  min-height: 38px;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
}

.segmented-control {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  background: rgba(118, 118, 128, 0.12);
  border-radius: 10px;
}

.segmented-control button {
  min-height: 38px;
  padding: 0 12px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 550;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.segmented-control button[aria-pressed="true"],
.segmented-control button.active {
  color: var(--text);
  background: white;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.09);
}

.ghost-button,
.table-button,
.reset-button,
#reset-all {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 620;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  cursor: pointer;
  transition: background 180ms ease, transform 180ms ease;
}

.ghost-button:hover,
.table-button:hover,
.reset-button:hover,
#reset-all:hover {
  background: white;
  transform: translateY(-1px);
}

#filter-summary,
.filter-summary {
  color: var(--text-secondary);
  font-size: 12px;
}

#page-root {
  width: 100%;
}

.app-status {
  width: min(520px, calc(100% - 36px));
  margin: 14vh auto 0;
  padding: 24px;
  text-align: center;
  background: white;
  border: 1px solid var(--hairline);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
}

.app-status[hidden] {
  display: none;
}

.app-status strong,
.app-status span,
.app-status small {
  display: block;
}

.app-status span,
.app-status small {
  margin-top: 7px;
  color: var(--text-secondary);
}

.app-status.is-error strong {
  color: var(--red);
}

.app-footer {
  width: min(100%, var(--page-max));
  margin: 0 auto;
  padding: 0 32px 28px;
  color: var(--text-tertiary);
  font-size: 10px;
  line-height: 1.55;
}

.page {
  width: min(100%, var(--page-max));
  margin: 0 auto;
  padding: 34px 32px 64px;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.page-eyebrow,
.story-eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 720;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.page-title {
  margin: 0;
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 690;
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.page-description {
  max-width: 780px;
  margin: 10px 0 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

.page-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.scope-note {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 18px;
  padding: 10px 13px;
  color: #405167;
  font-size: 12px;
  line-height: 1.45;
  background: rgba(233, 243, 255, 0.72);
  border: 1px solid rgba(0, 113, 227, 0.12);
  border-radius: 12px;
}

.scope-note::before {
  content: "i";
  display: grid;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  place-items: center;
  color: white;
  font-size: 11px;
  font-weight: 700;
  background: var(--blue);
  border-radius: 50%;
}

.quality-note {
  display: flex;
  gap: 10px;
  margin: -8px 0 18px;
  padding: 10px 13px;
  color: #724600;
  font-size: 11px;
  line-height: 1.45;
  background: rgba(255, 159, 10, 0.09);
  border: 1px solid rgba(255, 159, 10, 0.2);
  border-radius: 12px;
}

.quality-note.quality-pass {
  color: #176442;
  background: rgba(31, 157, 103, 0.08);
  border-color: rgba(31, 157, 103, 0.16);
}

.quality-note strong {
  flex: 0 0 auto;
}

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

.kpi-card {
  position: relative;
  min-height: 146px;
  padding: 18px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid rgba(60, 60, 67, 0.1);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.035);
}

.kpi-card-large {
  min-height: 188px;
  padding-bottom: 46px;
}

.kpi-label {
  display: block;
  min-height: 34px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.35;
}

.kpi-value {
  display: block;
  margin-top: 5px;
  font-size: clamp(22px, 2.2vw, 31px);
  font-weight: 690;
  line-height: 1.05;
  letter-spacing: -0.035em;
  white-space: nowrap;
}

.kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  color: var(--text-secondary);
  font-size: 11px;
}

.kpi-delta.positive {
  color: var(--green);
}

.kpi-delta.negative {
  color: #a85d00;
}

.kpi-spark {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 32px;
  opacity: 0.8;
}

.kpi-secondary {
  display: flex;
  gap: 14px;
  margin-top: 12px;
}

.kpi-secondary > span {
  min-width: 0;
}

.kpi-secondary small,
.kpi-secondary strong {
  display: block;
}

.kpi-secondary small {
  color: var(--text-tertiary);
  font-size: 10px;
  line-height: 1.3;
}

.kpi-secondary strong {
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.25;
  white-space: nowrap;
}

.section-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.span-12 { grid-column: span 12; }
.span-9 { grid-column: span 9; }
.span-8 { grid-column: span 8; }
.span-7 { grid-column: span 7; }
.span-6 { grid-column: span 6; }
.span-5 { grid-column: span 5; }
.span-4 { grid-column: span 4; }
.span-3 { grid-column: span 3; }

.chart-card,
.content-card {
  min-width: 0;
  padding: 20px;
  background: var(--surface);
  border: 1px solid rgba(60, 60, 67, 0.1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.chart-card.hero-card {
  padding: 24px;
  background:
    radial-gradient(circle at 95% 0%, rgba(0, 113, 227, 0.08), transparent 22rem),
    var(--surface-solid);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.card-header h2,
.card-header h3 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 660;
  line-height: 1.25;
  letter-spacing: -0.018em;
}

.card-header p,
.card-note {
  margin: 5px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
}

.card-tools {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
}

.select-control {
  min-height: 44px;
  padding: 0 30px 0 10px;
  color: var(--text);
  font-size: 12px;
  background: white;
  border: 1px solid var(--hairline);
  border-radius: 9px;
}

.chart-host {
  width: 100%;
  height: 360px;
}

.chart-host.tall {
  height: 460px;
}

.chart-host.compact {
  height: 285px;
}

.chart-host.story-chart {
  height: min(68vh, 640px);
  min-height: 430px;
}

.empty-state {
  display: grid;
  min-height: 260px;
  place-items: center;
  color: var(--text-secondary);
  font-size: 13px;
  text-align: center;
}

.signal-list {
  display: grid;
  gap: 10px;
}

.signal-item {
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 13px 12px;
  color: inherit;
  text-align: left;
  background: var(--surface-muted);
  border: 0;
  border-radius: 13px;
  cursor: pointer;
}

.signal-item::before {
  content: "";
  width: 4px;
  height: 100%;
  min-height: 34px;
  background: var(--blue);
  border-radius: 4px;
}

.signal-item[data-tone="warning"]::before,
.signal-item[data-tone="watch"]::before {
  background: var(--orange);
}

.signal-item[data-tone="risk"]::before {
  background: var(--red);
}

.signal-item strong,
.signal-item span {
  display: block;
}

.signal-item strong {
  font-size: 13px;
  line-height: 1.35;
}

.signal-item span {
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.45;
}

.signal-arrow {
  color: var(--text-tertiary);
  font-size: 18px;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.metric-strip-item {
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--hairline);
  border-radius: 14px;
}

.metric-strip-item span,
.metric-strip-item strong {
  display: block;
}

.metric-strip-item span {
  color: var(--text-secondary);
  font-size: 12px;
}

.metric-strip-item strong {
  margin-top: 5px;
  font-size: 25px;
  letter-spacing: -0.025em;
}

.gender-lens {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 0.8fr) minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  min-height: 350px;
  padding: 20px;
  overflow: hidden;
  background:
    radial-gradient(circle at 17% 22%, rgba(110, 90, 230, 0.14), transparent 16rem),
    radial-gradient(circle at 83% 78%, rgba(0, 166, 166, 0.13), transparent 16rem),
    linear-gradient(145deg, #ffffff, #f8fbff);
  border: 1px solid rgba(60, 60, 67, 0.1);
  border-radius: 24px;
}

.gender-orb {
  position: relative;
  display: grid;
  width: min(190px, 100%);
  aspect-ratio: 1;
  place-items: center;
  justify-self: center;
  color: var(--text);
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--hairline), 0 24px 60px rgba(70, 80, 140, 0.12);
  cursor: pointer;
  transition: transform 220ms ease, box-shadow 220ms ease, opacity 220ms ease;
}

.gender-orb::before {
  content: "";
  position: absolute;
  inset: 9px;
  background: conic-gradient(var(--orb-color) calc(var(--share, 50) * 1%), rgba(118, 118, 128, 0.1) 0);
  border-radius: inherit;
  mask: radial-gradient(circle, transparent 62%, #000 63%);
  -webkit-mask: radial-gradient(circle, transparent 62%, #000 63%);
}

.gender-orb:hover,
.gender-orb[aria-pressed="true"] {
  transform: translateY(-4px) scale(1.015);
  box-shadow: inset 0 0 0 1px var(--hairline), 0 28px 70px rgba(70, 80, 140, 0.2);
}

.gender-orb.dimmed {
  opacity: 0.42;
}

.gender-orb-content {
  position: relative;
  z-index: 1;
  text-align: center;
}

.gender-glyph {
  display: grid;
  width: 38px;
  height: 38px;
  margin: 0 auto 8px;
  place-items: center;
  color: white;
  font-size: 19px;
  background: var(--orb-color);
  border-radius: 50%;
}

.gender-orb strong,
.gender-orb span {
  display: block;
}

.gender-orb strong {
  font-size: 26px;
  letter-spacing: -0.035em;
}

.gender-orb span {
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 11px;
}

.gender-center {
  display: grid;
  gap: 12px;
}

.gender-center-title {
  text-align: center;
}

.gender-center-title strong,
.gender-center-title span {
  display: block;
}

.gender-center-title strong {
  font-size: 16px;
}

.gender-center-title span {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 11px;
}

.gender-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.gender-detail-card {
  display: block;
  padding: 20px;
  text-align: left;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(246, 249, 255, 0.82));
  border: 1px solid var(--hairline);
  border-radius: 18px;
  box-shadow: 0 12px 32px rgba(48, 62, 100, 0.06);
  cursor: pointer;
  transition: transform 200ms ease, opacity 200ms ease, border-color 200ms ease;
}

.gender-detail-card:hover,
.gender-detail-card[aria-pressed="true"] {
  transform: translateY(-2px);
  border-color: rgba(0, 113, 227, 0.34);
}

.gender-detail-card.dimmed {
  opacity: 0.25;
}

.gender-detail-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gender-detail-head em {
  margin-left: auto;
  color: var(--text-secondary);
  font-size: 11px;
  font-style: normal;
}

.gender-dot {
  width: 10px;
  height: 10px;
  background: var(--dot);
  border-radius: 50%;
}

.gender-detail-values {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.gender-detail-values small,
.gender-detail-values strong,
.inline-metrics small,
.inline-metrics strong {
  display: block;
}

.gender-detail-values small,
.inline-metrics small {
  min-height: 28px;
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.35;
}

.gender-detail-values strong,
.inline-metrics strong {
  margin-top: 4px;
  font-size: 16px;
}

.gender-detail-foot {
  display: block;
  margin-top: 16px;
  padding-top: 12px;
  color: var(--text-tertiary);
  font-size: 10px;
  line-height: 1.45;
  border-top: 1px solid var(--hairline);
}

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

.inline-metrics > span {
  padding: 16px;
  background: var(--surface-muted);
  border-radius: 14px;
}

.compare-mode-card .card-header {
  margin-bottom: 14px;
}

.mirror-row {
  display: grid;
  grid-template-columns: 1fr 76px 1fr;
  align-items: center;
  gap: 7px;
}

.mirror-track {
  display: flex;
  height: 7px;
  align-items: center;
  overflow: hidden;
  background: rgba(118, 118, 128, 0.09);
  border-radius: 7px;
}

.mirror-track.left {
  justify-content: flex-end;
}

.mirror-fill {
  height: 100%;
  background: var(--bar-color);
  border-radius: inherit;
}

.mirror-label {
  color: var(--text-secondary);
  font-size: 10px;
  text-align: center;
}

.mirror-values {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  margin-top: -5px;
  color: var(--text-secondary);
  font-size: 10px;
}

.dimension-note {
  margin-top: 14px;
  color: var(--text-tertiary);
  font-size: 11px;
  line-height: 1.55;
  text-align: center;
}

.compare-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.compare-toolbar label {
  color: var(--text-secondary);
  font-size: 11px;
}

.story-page {
  padding-bottom: 0;
}

.story-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(330px, 0.75fr);
  align-items: start;
  gap: 28px;
}

.story-visual {
  position: sticky;
  top: calc(var(--topbar-height) + 20px);
  min-height: calc(100vh - var(--topbar-height) - 40px);
  padding: 24px;
  background:
    radial-gradient(circle at 90% 4%, rgba(0, 113, 227, 0.12), transparent 22rem),
    white;
  border: 1px solid rgba(60, 60, 67, 0.1);
  border-radius: 26px;
  box-shadow: var(--shadow-float);
}

.story-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--text-secondary);
  font-size: 11px;
}

.story-progress-track {
  height: 3px;
  flex: 1;
  overflow: hidden;
  background: rgba(118, 118, 128, 0.14);
  border-radius: 4px;
}

.story-progress-fill {
  width: var(--story-progress, 16.666%);
  height: 100%;
  background: var(--blue);
  border-radius: inherit;
  transition: width 320ms ease;
}

.story-active-title {
  margin: 18px 0 0;
  font-size: clamp(23px, 2.4vw, 34px);
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.story-copy {
  display: grid;
  gap: 24vh;
  padding: 10vh 0 38vh;
}

.story-act {
  min-height: 46vh;
  padding: 25px;
  opacity: 0.48;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--hairline);
  border-radius: 22px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.035);
  transition: opacity 240ms ease, transform 240ms ease, box-shadow 240ms ease;
}

.story-act.active {
  opacity: 1;
  transform: translateY(-3px);
  box-shadow: var(--shadow-soft);
}

.story-act h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.18;
  letter-spacing: -0.028em;
}

.story-block {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--hairline);
}

.story-block strong,
.story-block p {
  display: block;
  margin: 0;
}

.story-block strong {
  color: var(--text-secondary);
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.story-block p {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.65;
}

.story-caveat {
  margin: 18px 0 0;
  padding: 13px;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.55;
  background: var(--surface-muted);
  border-radius: 12px;
}

.story-strategy {
  margin-top: 72px;
  padding: 34px;
  background: linear-gradient(145deg, #152238, #1d3555);
  border-radius: 28px;
  box-shadow: 0 28px 70px rgba(18, 39, 70, 0.18);
}

.story-strategy > header {
  max-width: 760px;
  color: white;
}

.story-strategy > header h2 {
  margin: 8px 0 0;
  font-size: clamp(26px, 3vw, 40px);
  letter-spacing: -0.035em;
}

.story-strategy > header > p:last-child {
  color: rgba(255, 255, 255, 0.66);
  line-height: 1.6;
}

.strategy-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.strategy-card {
  padding: 22px;
  color: white;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.strategy-card h3 {
  margin: 0 0 18px;
  font-size: 20px;
}

.strategy-card > div {
  margin-top: 13px;
  padding-top: 13px;
  border-top: 1px solid rgba(255, 255, 255, 0.11);
}

.strategy-card strong,
.strategy-card p {
  display: block;
  margin: 0;
}

.strategy-card strong {
  color: #82c4ff;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.strategy-card p {
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  line-height: 1.55;
}

.data-table-modal,
.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  padding: 24px;
  place-items: center;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.data-table-modal[hidden],
.modal[hidden] {
  display: none;
}

dialog.modal:not([open]) {
  display: none;
}

.modal-dialog {
  width: min(1120px, 100%);
  max-height: calc(100vh - 48px);
  padding: 22px;
  overflow: auto;
  background: white;
  border-radius: 22px;
  box-shadow: var(--shadow-float);
}

.modal table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.modal th,
.modal td {
  padding: 10px 12px;
  text-align: right;
  border-bottom: 1px solid var(--hairline);
}

.modal th:first-child,
.modal td:first-child {
  position: sticky;
  left: 0;
  text-align: left;
  background: white;
}

.mobile-nav,
#mobile-nav {
  display: none;
}

.mobile-menu-toggle {
  display: none;
}

.competition-source-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: -6px 0 14px;
  color: var(--text-secondary);
  font-size: 12px;
}

.competition-source-row strong {
  color: var(--text);
  font-weight: 680;
}

.competition-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin: 16px 0;
  padding: 14px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.03);
}

.competition-mode {
  flex: 0 0 auto;
}

.competition-control-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(112px, 1fr));
  flex: 1;
  gap: 10px;
}

.competition-control-grid label {
  display: grid;
  gap: 5px;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.competition-control-grid .select-control {
  width: 100%;
  min-width: 0;
  min-height: 40px;
}

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

.competition-kpi {
  min-width: 0;
  min-height: 124px;
  padding: 17px;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 255, 0.92));
  border: 1px solid rgba(60, 60, 67, 0.1);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.035);
}

.competition-kpi > span,
.competition-kpi > strong,
.competition-kpi > small {
  display: block;
}

.competition-kpi > span {
  min-height: 31px;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.4;
}

.competition-kpi > strong {
  margin-top: 5px;
  overflow: hidden;
  font-size: clamp(21px, 2vw, 29px);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.035em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.competition-kpi > small {
  margin-top: 9px;
  color: var(--text-tertiary);
  font-size: 10px;
  line-height: 1.35;
}

.race-card {
  overflow: hidden;
}

.race-playback {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr);
  align-items: center;
  gap: 16px;
  margin: 2px 0 8px;
  padding: 9px 11px;
  background: rgba(118, 118, 128, 0.08);
  border-radius: 13px;
}

.race-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-button,
.play-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  color: var(--blue);
  font-size: 12px;
  font-weight: 650;
  background: white;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  cursor: pointer;
}

.icon-button {
  width: 38px;
  padding: 0;
  font-size: 17px;
}

.play-button {
  min-width: 92px;
  gap: 7px;
  padding: 0 13px;
}

.play-button:disabled,
.competition-control-grid select:disabled {
  color: var(--text-tertiary);
  cursor: not-allowed;
  opacity: 0.62;
}

.race-slider {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.race-slider input {
  width: 100%;
  accent-color: var(--blue);
}

.issuer-lens {
  background:
    radial-gradient(circle at 100% 0%, rgba(110, 90, 230, 0.09), transparent 16rem),
    var(--surface);
}

.issuer-lens-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0 16px;
  border-bottom: 1px solid var(--hairline);
}

.issuer-lens-head h3 {
  margin: 5px 0 0;
  font-size: clamp(22px, 2vw, 30px);
  font-weight: 710;
  letter-spacing: -0.035em;
}

.source-stamp {
  margin: 0;
  color: var(--blue);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.lens-default {
  max-width: 112px;
  color: var(--text-tertiary);
  font-size: 10px;
  line-height: 1.4;
  text-align: right;
}

.issuer-lens-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 15px -8px 0;
  overflow: hidden;
  background: var(--hairline);
  border-radius: 12px;
}

.issuer-lens-grid > span {
  min-width: 0;
  padding: 12px;
  background: rgba(255, 255, 255, 0.96);
}

.issuer-lens-grid small,
.issuer-lens-grid strong {
  display: block;
}

.issuer-lens-grid small {
  min-height: 28px;
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.35;
}

.issuer-lens-grid strong {
  margin-top: 3px;
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.risk-disclosure {
  margin-top: 15px;
  padding: 11px 12px;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.55;
  background: rgba(118, 118, 128, 0.07);
  border-radius: 11px;
}

.risk-disclosure summary {
  color: var(--text);
  font-weight: 650;
  cursor: pointer;
}

.risk-disclosure p {
  margin: 9px 0 5px;
}

.risk-disclosure small {
  color: var(--text-tertiary);
}

.text-link {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 6px;
  padding: 0;
  color: var(--blue);
  font-size: 12px;
  font-weight: 650;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.competition-overview-facts {
  background:
    radial-gradient(circle at 96% 4%, rgba(0, 166, 166, 0.1), transparent 15rem),
    var(--surface);
}

.competition-facts {
  display: grid;
  gap: 2px;
}

.competition-facts > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--hairline);
}

.competition-facts > div span {
  color: var(--text-secondary);
  font-size: 11px;
}

.competition-facts > div strong {
  max-width: 60%;
  font-size: 15px;
  line-height: 1.35;
  text-align: right;
}

.competition-insight {
  margin: 14px 0 2px;
  padding: 12px;
  color: #154d4d;
  font-size: 12px;
  line-height: 1.55;
  background: rgba(0, 166, 166, 0.08);
  border-radius: 11px;
}

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

  .kpi-card {
    min-height: 132px;
  }
}

@media (max-width: 1160px) {
  :root {
    --sidebar-width: 84px;
  }

  .sidebar {
    padding-inline: 12px;
  }

  .brand-copy,
  .sidebar-brand > span:last-child,
  .nav-label,
  #sidebar-nav a > span:last-child,
  #sidebar-nav button > span:last-child,
  .sidebar-meta {
    display: none;
  }

  .sidebar-brand,
  .nav-link,
  #sidebar-nav a,
  #sidebar-nav button {
    justify-content: center;
    padding-inline: 0;
  }

  .span-9,
  .span-8,
  .span-7,
  .span-6,
  .span-5,
  .span-4,
  .span-3 {
    grid-column: span 6;
  }

  .gender-lens {
    grid-template-columns: 1fr 1fr;
  }

  .gender-center {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .story-shell {
    grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  }
}

@media (max-width: 860px) {
  :root {
    --sidebar-width: 0px;
    --topbar-height: auto;
  }

  .sidebar {
    display: none;
  }

  .app-main {
    margin-left: 0;
    padding-bottom: 68px;
  }

  .topbar {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: flex-start;
    padding: 14px 18px;
  }

  .topbar-heading,
  .global-filters {
    width: 100%;
  }

  .mobile-menu-toggle {
    display: inline-flex;
    min-width: 78px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-left: auto;
    color: var(--blue);
    font-size: 12px;
    font-weight: 650;
    background: white;
    border: 1px solid var(--hairline);
    border-radius: 12px;
    cursor: pointer;
  }

  .global-filters {
    flex-wrap: nowrap;
    padding-bottom: 2px;
    overflow-x: auto;
  }

  .global-filters > * {
    flex: 0 0 auto;
  }

  .page {
    padding: 26px 18px 52px;
  }

  .page-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-actions {
    width: 100%;
  }

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

  .gender-detail-grid,
  .strategy-grid {
    grid-template-columns: 1fr;
  }

  .span-12,
  .span-9,
  .span-8,
  .span-7,
  .span-6,
  .span-5,
  .span-4,
  .span-3 {
    grid-column: 1 / -1;
  }

  .chart-host,
  .chart-host.tall {
    height: 360px;
  }

  .gender-lens {
    grid-template-columns: 1fr 1fr;
  }

  .story-shell {
    display: block;
  }

  .story-visual {
    position: relative;
    top: auto;
    min-height: auto;
  }

  .story-copy {
    gap: 24px;
    padding: 24px 0 0;
  }

  .story-act {
    min-height: 0;
    opacity: 1;
  }

  .mobile-nav,
  #mobile-nav {
    position: fixed;
    top: 12px;
    bottom: 12px;
    left: 12px;
    z-index: 70;
    display: flex;
    width: min(320px, calc(100vw - 24px));
    align-items: stretch;
    justify-content: flex-start;
    flex-direction: column;
    gap: 4px;
    padding: 20px 12px;
    overflow-y: auto;
    opacity: 0;
    background: rgba(250, 250, 252, 0.96);
    border: 1px solid var(--hairline);
    border-radius: 22px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    pointer-events: none;
    transform: translateX(calc(-100% - 28px));
    transition: transform 220ms ease, opacity 180ms ease;
  }

  #mobile-nav[data-open="true"],
  .mobile-nav[data-open="true"] {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
  }

  #mobile-nav a,
  #mobile-nav button,
  .mobile-nav a,
  .mobile-nav button {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    width: 100%;
    min-height: 48px;
    align-items: center;
    padding: 0 12px;
    text-align: left;
    color: var(--text-secondary);
    background: transparent;
    border: 0;
    border-radius: 13px;
    text-decoration: none;
  }

  #mobile-nav a > span:first-child,
  .mobile-nav a > span:first-child {
    text-align: center;
  }

  #mobile-nav [aria-current="page"],
  .mobile-nav [aria-current="page"] {
    color: var(--blue);
    background: var(--blue-soft);
  }
}

@media (max-width: 560px) {
  .global-filters {
    width: 100%;
    flex-wrap: wrap;
    overflow-x: visible;
  }

  .filter-control,
  .global-filters label {
    flex: 1 1 44%;
  }

  .kpi-grid,
  .metric-strip {
    grid-template-columns: 1fr;
  }

  .kpi-card {
    min-height: 122px;
  }

  .kpi-card-large {
    min-height: 180px;
  }

  .quality-note,
  .gender-detail-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .gender-detail-head em {
    margin-left: 0;
  }

  .gender-detail-values,
  .inline-metrics {
    grid-template-columns: 1fr;
  }

  .story-strategy {
    padding: 22px;
  }

  .card-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .card-tools,
  .compare-toolbar {
    width: 100%;
  }

  .select-control {
    min-width: 0;
    flex: 1;
  }

  .gender-lens {
    grid-template-columns: 1fr;
  }

  .gender-center {
    grid-column: auto;
    grid-row: auto;
  }

  .gender-orb {
    width: 154px;
  }

  .chart-host,
  .chart-host.tall,
  .chart-host.story-chart {
    height: 330px;
    min-height: 0;
  }

  .story-visual {
    padding: 18px;
  }
}

@media (max-width: 1160px) {
  .competition-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

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

@media (max-width: 860px) {
  .competition-control-grid,
  .competition-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .competition-mode {
    align-self: flex-start;
  }
}

@media (max-width: 560px) {
  .competition-source-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .competition-source-row .table-button {
    width: 100%;
  }

  .competition-control-grid,
  .competition-kpi-grid {
    grid-template-columns: 1fr;
  }

  .competition-toolbar {
    padding: 11px;
  }

  .competition-mode {
    width: 100%;
  }

  .competition-mode button {
    flex: 1;
  }

  .race-playback {
    grid-template-columns: 1fr;
  }

  .race-buttons {
    justify-content: center;
  }

  .race-slider {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .issuer-lens-grid {
    grid-template-columns: 1fr;
  }

  .competition-facts > div {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .competition-facts > div strong {
    max-width: none;
    text-align: left;
  }
}

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

@media print {
  .sidebar,
  .topbar,
  .mobile-nav,
  #mobile-nav,
  .page-actions,
  .card-tools {
    display: none !important;
  }

  .app-main {
    margin-left: 0;
  }

  .page {
    max-width: none;
    padding: 0;
  }

  .chart-card,
  .content-card,
  .kpi-card {
    break-inside: avoid;
    box-shadow: none;
  }
}
