.hero {
  padding: 38px 0 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 32px;
}

.hero h1 { margin: 0; font: 760 32px/1.2 var(--display); }
.hero p { max-width: 760px; margin: 9px 0 0; color: var(--text-2); font-size: 13px; line-height: 1.65; }
.hero-side { min-width: 310px; display: grid; justify-items: end; gap: 13px; }
.hero-meta { display: grid; justify-items: end; gap: 4px; color: var(--text-3); font-size: 10px; }
.hero-meta strong { color: var(--text-2); font-size: 12px; }
.header-actions { display: flex; align-items: center; gap: 7px; }

.export-menu { position: relative; }
.export-menu summary { list-style: none; }
.export-menu summary::-webkit-details-marker { display: none; }
.export-menu[open] summary { border-color: var(--line-strong); background: var(--surface-2); color: var(--text); }
.export-popover {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 35;
  width: 150px;
  padding: 6px;
  display: grid;
  gap: 4px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.export-popover .btn { width: 100%; justify-content: flex-start; text-align: left; }

.filter-shell {
  position: sticky;
  top: 68px;
  z-index: 25;
  padding: 10px 0;
  border-block: 1px solid var(--line);
  background: var(--surface);
}
.quick-filter { display: flex; align-items: center; gap: 9px; overflow-x: auto; scrollbar-width: none; }
.mobile-scope { display: inline-grid; }
.filter-spacer { margin-left: auto; }
.filter-panel {
  margin-top: 10px;
  padding: 17px;
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.filter-panel .wide { grid-column: span 2; }

.metrics-grid { margin: 14px 0 18px; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); border-block: 1px solid var(--line); }
.metric-card { min-height: 88px; padding: 14px 15px; border-right: 1px solid var(--line); background: var(--surface); }
.metric-card:last-child { border-right: 0; }
.metric-label { color: var(--text-3); font-size: 11px; }
.metric-value { margin-top: 9px; color: var(--text); font: 760 26px/1 var(--display); font-variant-numeric: tabular-nums; }
.metric-note { margin-top: 7px; overflow: hidden; color: var(--text-3); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.metric-supporting { background: var(--surface-2); }
.metric-supporting .metric-label { font-size: 10px; }
.metric-supporting .metric-value { color: var(--text-2); font-size: 21px; }

.latest-release-shell { margin: 18px 0 26px; border-top: 1px solid var(--line-strong); background: var(--surface); }
.latest-release-head { min-height: 64px; padding: 13px 16px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.latest-release-head h2 { margin: 0; font: 740 18px/1.25 var(--display); }
.latest-release-head p { margin: 5px 0 0; color: var(--text-3); font-size: 10px; }
.latest-release-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.latest-release-item {
  min-width: 0;
  min-height: 72px;
  padding: 10px 13px;
  display: grid;
  grid-template-columns: 22px 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.latest-release-item:nth-child(3n) { border-right: 0; }
.latest-release-item:hover, .latest-release-item:focus-visible { background: var(--surface-2); }
.latest-release-rank { color: var(--tap-cyan-strong); font: 720 11px/1 var(--display); text-align: center; }
.latest-release-item .game-icon, .latest-release-item .game-icon-fallback { width: 42px; height: 42px; border-radius: var(--radius-sm); }
.latest-release-main { min-width: 0; }
.latest-release-main strong, .latest-release-main small, .latest-release-time strong, .latest-release-time small { display: block; }
.latest-release-title { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.latest-release-main small { margin-top: 5px; overflow: hidden; color: var(--text-3); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.latest-release-time { min-width: 72px; text-align: right; font-variant-numeric: tabular-nums; }
.latest-release-time strong { color: var(--text-2); font-size: 10px; }
.latest-release-time small { margin-top: 5px; color: var(--text-3); font-size: 9px; }
.latest-release-empty { grid-column: 1 / -1; padding: 24px 16px; border-bottom: 1px solid var(--line); color: var(--text-3); font-size: 11px; text-align: center; }

.opportunity-shell { margin: 18px 0 26px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.opportunity-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.opportunity-head h2 { margin: 0; font: 750 20px/1.25 var(--display); }
.opportunity-head p { margin: 5px 0 0; color: var(--text-3); font-size: 11px; }
.opportunity-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.opportunity-row {
  min-width: 0;
  padding: 14px 17px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: start;
  gap: 8px 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.opportunity-row:nth-child(3n) { border-right: 0; }
.opportunity-row:nth-last-child(-n+3) { border-bottom: 0; }
.opportunity-rank { color: var(--text-3); font: 700 12px/1.3 var(--display); }
.opportunity-main { min-width: 0; }
.opportunity-main h3 { margin: 0; font: 700 15px/1.25 var(--display); }
.opportunity-main p { margin: 5px 0; color: var(--text-2); font-size: 11px; line-height: 1.5; }
.opportunity-main small { display: block; color: var(--text-3); font-size: 10px; line-height: 1.45; }
.opportunity-signal { min-width: 58px; text-align: right; }
.opportunity-signal span { display: block; color: var(--text-3); font-size: 9px; }
.opportunity-signal strong { display: block; margin-top: 4px; color: var(--tap-cyan-strong); font: 760 20px/1 var(--display); }
.signal-games { grid-column: 2 / -1; min-width: 0; display: flex; align-items: center; gap: 6px; overflow: hidden; }
.signal-games > span { flex: 0 0 auto; color: var(--text-3); font-size: 9px; }
.signal-game {
  min-width: 0;
  min-height: 32px;
  max-width: 42%;
  padding: 6px 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  font-size: 10px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.signal-game:hover, .signal-game:focus-visible { border-color: var(--tap-cyan); color: var(--tap-cyan-strong); }
.formula-note { padding: 11px 20px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 10px; line-height: 1.55; }
.formula-note strong { color: var(--text-2); }

.chart-grid { margin-bottom: 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.panel { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.panel-head { padding: 18px 20px 0; display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.panel-head h2, .panel-head h3 { margin: 0; font: 720 17px/1.3 var(--display); }
.panel-head p { margin: 5px 0 0; color: var(--text-3); font-size: 10px; }
.chart { height: 310px; padding: 18px 20px 16px; }
.native-histogram { height: 100%; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: end; gap: 5px; border-bottom: 1px solid var(--line-strong); }
.histogram-column { height: 100%; min-width: 0; display: grid; grid-template-rows: 18px minmax(0, 1fr) 22px; align-items: end; justify-items: stretch; }
.histogram-column i { display: block; min-height: 2px; border-radius: var(--radius-xs) var(--radius-xs) 0 0; background: var(--tap-cyan); }
.histogram-count { color: var(--text-3); font-size: 9px; text-align: center; }
.histogram-column small { min-width: 0; padding-top: 6px; overflow: hidden; color: var(--text-3); font-size: 8px; text-align: center; text-overflow: ellipsis; }
.chart svg { width: 100%; height: 270px; overflow: visible; }
.scatter-grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.scatter-median { stroke: var(--tap-orange); stroke-width: 1.5; stroke-dasharray: 6 5; vector-effect: non-scaling-stroke; }
.scatter-point { fill: var(--tap-cyan); fill-opacity: .68; stroke: var(--tap-cyan-strong); stroke-width: .8; vector-effect: non-scaling-stroke; }
.scatter-label { fill: var(--text-3); font: 9px var(--font); }
.scatter-axis-note { margin-top: -2px; color: var(--text-3); font-size: 9px; text-align: center; }

.section-kicker { margin: 46px 0 17px; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.section-kicker h2 { margin: 0; font: 750 24px/1.25 var(--display); }
.section-kicker p { margin: 7px 0 0; color: var(--text-3); font-size: 12px; }
.boards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.board { --board-color: var(--tap-cyan); overflow: hidden; break-inside: avoid; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.board[data-tone="orange"] { --board-color: var(--tap-orange); }
.board[data-tone="blue"] { --board-color: var(--tap-blue); }
.board[data-tone="red"] { --board-color: var(--tap-red); }
.board[data-tone="violet"] { --board-color: var(--tap-violet); }
.board-head { padding: 16px 17px 13px; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; border-top: 3px solid var(--board-color); }
.board-head h3 { margin: 0; font: 720 16px/1.3 var(--display); }
.board-head p { margin: 5px 0 0; color: var(--text-3); font-size: 10px; }
.game-row {
  width: 100%;
  min-height: 68px;
  padding: 9px 15px;
  display: grid;
  grid-template-columns: 30px 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.game-row:hover { background: var(--surface-2); }
.rank { color: var(--text-3); font: 760 15px/1 var(--display); text-align: center; }
.rank.top { color: var(--board-color); }
.game-icon, .game-icon-fallback { width: 46px; height: 46px; display: grid; place-items: center; border-radius: var(--radius-md); background: var(--surface-3); color: var(--tap-cyan-strong); object-fit: cover; font-weight: 750; }
.game-main { min-width: 0; }
.game-title { overflow: hidden; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.game-meta { margin-top: 4px; overflow: hidden; color: var(--text-3); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.game-value { color: var(--board-color); font-weight: 720; text-align: right; font-variant-numeric: tabular-nums; }
.game-value small { display: block; margin-top: 3px; color: var(--text-3); font-size: 9px; font-weight: 400; }
.type-list { padding: 10px 18px 18px; }
.type-row { padding: 8px 0; display: grid; grid-template-columns: 110px minmax(80px, 1fr) 90px; align-items: center; gap: 10px; }
.type-bar { height: 7px; overflow: hidden; border-radius: var(--radius-xs); background: var(--surface-3); }
.type-bar i { display: block; height: 100%; background: var(--tap-cyan); }

.drawer-bg { position: fixed; inset: 0; z-index: 60; width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: 0; overflow: hidden; border: 0; background: transparent; color: var(--text); }
.drawer-bg:not([open]) { display: none; }
.drawer-bg[open] { display: block; }
.drawer-bg::backdrop { background: rgba(19, 29, 31, .34); }
.drawer { position: absolute; inset: 0 0 0 auto; width: min(500px, 100%); padding: 22px; overflow: auto; border-left: 1px solid var(--line); background: var(--surface); transform: translateX(100%); transition: transform var(--motion-base) ease; }
.drawer-bg.show .drawer { transform: translateX(0); }
.detail-head { margin: 22px 0; display: flex; align-items: center; gap: 15px; }
.detail-head .game-icon, .detail-head .game-icon-fallback { width: 72px; height: 72px; border-radius: var(--radius-md); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.detail-stat { padding: 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.detail-stat span { display: block; color: var(--text-3); font-size: 10px; }
.detail-stat strong { display: block; margin-top: 6px; font-size: 16px; }
.appearance-list { margin-top: 20px; }
.appearance-item { padding: 11px 0; display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.footer { margin-top: 58px; padding: 26px 0 38px; display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 10px; }

body.report-mode .filter-shell, body.report-mode .drawer-bg { display: none; }
body.report-mode .header-actions > :not(#reportBtn) { display: none; }
body.report-mode .boards { grid-template-columns: 1fr; }
body.report-mode .board { break-inside: avoid; }

@media (max-width: 1150px) {
  .metrics-grid { grid-template-columns: repeat(4, 1fr); }
  .metric-card:nth-child(4) { border-right: 0; }
  .metric-card:nth-child(-n+4) { border-bottom: 1px solid var(--line); }
  .opportunity-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .opportunity-row:nth-child(3n) { border-right: 1px solid var(--line); }
  .opportunity-row:nth-child(2n) { border-right: 0; }
  .opportunity-row:nth-last-child(-n+3) { border-bottom: 1px solid var(--line); }
  .opportunity-row:nth-last-child(-n+2) { border-bottom: 0; }
  .filter-panel { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 18px; }
  .hero-side { min-width: 0; justify-items: start; }
  .hero-meta { justify-items: start; }
  .quick-filter { flex-wrap: wrap; overflow: visible; }
  .quick-filter #query { flex: 1 1 260px; }
  .filter-spacer { display: none; }
  .chart-grid, .boards { grid-template-columns: 1fr; }
  .latest-release-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .latest-release-item:nth-child(3n) { border-right: 1px solid var(--line); }
  .latest-release-item:nth-child(2n) { border-right: 0; }
  .filter-panel { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .latest-release-list { grid-template-columns: 1fr; }
  .latest-release-item, .latest-release-item:nth-child(2n), .latest-release-item:nth-child(3n) { border-right: 0; border-bottom: 1px solid var(--line); }
  .opportunity-list { grid-template-columns: 1fr; }
  .opportunity-row, .opportunity-row:nth-child(2n), .opportunity-row:nth-child(3n), .opportunity-row:nth-last-child(-n+2), .opportunity-row:nth-last-child(-n+3) { border-right: 0; border-bottom: 1px solid var(--line); }
  .opportunity-row:last-child { border-bottom: 0; }
}

@media (max-width: 520px) {
  .hero { padding: 27px 0 20px; }
  .hero h1 { font-size: 28px; }
  .analysis-actions { width: 100%; }
  .analysis-actions .btn { min-height: 40px; }
  .filter-shell { top: 62px; }
  .quick-filter > .mobile-scope { flex: 1 1 100%; }
  .quick-filter > .pill-group { width: 100%; }
  .quick-filter #released, .quick-filter #query { flex: 1 1 100%; }
  .quick-filter #advancedBtn { margin-left: auto; }
  .filter-panel { grid-template-columns: 1fr; }
  .filter-panel .wide { grid-column: auto; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .metric-card, .metric-card:nth-child(4) { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .metric-card:nth-child(2n) { border-right: 0; }
  .metric-card:nth-last-child(-n+2) { border-bottom: 0; }
  .latest-release-head { align-items: flex-start; }
  .latest-release-item { grid-template-columns: 22px 42px minmax(0, 1fr); }
  .latest-release-time { grid-column: 3; min-width: 0; display: flex; align-items: baseline; gap: 8px; text-align: left; }
  .latest-release-time small { margin-top: 0; }
  .section-kicker { align-items: flex-start; flex-direction: column; }
  .game-row { grid-template-columns: 26px 42px minmax(0, 1fr); }
  .game-row .game-value { grid-column: 3; text-align: left; }
  .game-icon, .game-icon-fallback { width: 42px; height: 42px; }
  .type-list { padding: 10px 14px 18px; }
  .type-row { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 8px; }
  .type-row > strong { min-width: 0; overflow-wrap: anywhere; }
  .type-row .type-bar { grid-column: 1 / -1; grid-row: 2; }
  .type-row .muted { min-width: 0; font-size: 10px; text-align: right; white-space: normal; }
  .drawer { width: 100%; padding: 16px; border-left: 0; }
  .footer { align-items: flex-start; flex-direction: column; gap: 7px; }
}

@media (max-width: 700px) { #imageBtn { display: none; } }
