:root {
  --canvas: #efece5;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --ink: #1a292b;
  --muted: #66716f;
  --line: #d8d1c5;
  --brand: #4b2c1f;
  --brand-2: #9a542c;
  --brand-blue: #637aa5;
  --brand-teal: #4c9992;
  --accent: #b9562f;
  --accent-soft: #f2dbcd;
  --positive: #1f7459;
  --negative: #aa4740;
  --steady: #68706e;
  --shadow: 0 3px 12px rgba(30, 42, 42, .05);
  --font-ui: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  --font-editorial: Georgia, "Noto Serif SC", serif;
  --text-xs: .8125rem;
  --text-sm: .875rem;
  --text-base: 1rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.5625rem;
  --leading-tight: 1.25;
  --leading-body: 1.55;
  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --radius-sm: 4px;
  --radius-md: 7px;
  --radius-lg: 10px;
  --radius-pill: 999px;
  --target-min: 24px;
  --focus-on-light: #0f6b66;
  --focus-on-dark: #d7fff8;
  --focus-color: var(--focus-on-light);
  --focus-ring: 0 0 0 3px rgba(15, 107, 102, .28);
  --control-height: 36px;
  --content-max: 1320px;
  /* Compatibility aliases retained while individual Phase 8 views migrate. */
  --panel: var(--surface);
  --brand-soft: #efe4dc;
  --warning: #7a4d00;
  --warning-bg: #fff3dc;
  --green: var(--positive);
  --yellow: #d2ac42;
  --red: var(--negative);
  font-family: var(--font-ui);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--canvas); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
body { min-width: 0; margin: 0; overflow-x: hidden; color: var(--ink); background: var(--canvas); font-size: var(--text-base); line-height: var(--leading-body); }
h1, h2, h3, h4, p { margin-top: 0; }
button, select, a { font: inherit; }
button { cursor: pointer; }
a { color: var(--brand-2); text-underline-offset: 2px; }
:where(button, a, input, select, [tabindex]):focus-visible { outline: 2px solid var(--focus-on-light); outline-offset: 2px; box-shadow: var(--focus-ring); }
.app-header :where(button, a, select, [tabindex]):focus-visible { outline-color: var(--focus-on-dark); box-shadow: 0 0 0 3px rgba(215, 255, 248, .32); }
.app-header {
  position: relative;
  overflow: hidden;
  border-bottom: 3px solid var(--brand-blue);
  background:
    radial-gradient(circle at 70% 45%, rgba(213, 151, 73, .2), transparent 32%),
    linear-gradient(112deg, #281b17 0%, #694020 19%, #8f4827 49%, #7c4827 77%, #2b201a 100%);
  color: #fff;
}
.header-main {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) auto;
  align-items: center;
  gap: 26px;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 18px 24px 14px;
}
.brand h1 { margin: 0; font: 700 var(--text-xl)/1.1 var(--font-editorial); }
.brand-home { color: inherit; text-decoration: none; }
.brand-home:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
html[lang="en"] .brand h1 { font-size: 1.375rem; }
.cat-brand-watermark {
  position: absolute;
  z-index: 0;
  top: 0;
  right: max(70px, calc((100vw - var(--content-max)) / 2 + 70px));
  width: 230px;
  height: 114px;
  overflow: hidden;
  opacity: .2;
  pointer-events: none;
}
.cat-brand-watermark img {
  position: absolute;
  top: -13px;
  left: 50%;
  width: 82%;
  max-width: none;
  transform: translateX(-50%);
  filter: sepia(.18) saturate(.78) contrast(1.08);
}
.prototype-mark { margin: 0; color: var(--muted); font-size: 12px; }
.lang-switch { display: flex; align-self: start; justify-self: end; gap: 3px; margin-top: -3px; }
.lang-switch button {
  min-width: var(--target-min);
  min-height: 24px;
  padding: 2px 4px;
  border: 0;
  background: transparent;
  color: #f2e8da;
  font-size: 12px;
  letter-spacing: .03em;
  opacity: 1;
}
.lang-switch button:hover { color: #fff; opacity: 1; }
.lang-switch button.active {
  color: #fff;
  font-weight: 750;
  opacity: 1;
  text-decoration: underline;
  text-decoration-color: var(--focus-on-dark);
  text-underline-offset: 4px;
}
.range-buttons button,
.secondary-button,
.scope-tabs button,
.subview-tabs button {
  min-height: var(--control-height);
  border: 1px solid #bfb8ad;
  background: var(--surface-strong);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: #43504e;
}
.range-buttons button.active,
.scope-tabs button.active,
.subview-tabs button.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.format-tabs { display: flex; min-width: 0; gap: 6px; }
.format-tabs button {
  min-height: var(--control-height);
  flex: 0 0 auto;
  padding: 7px 12px;
  border: 1px solid rgba(189, 198, 220, .58);
  border-radius: var(--radius-pill);
  background: transparent;
  color: #f2e8da;
}
.format-tabs button.active { border-color: #8da4cf; background: rgba(76, 48, 34, .72); color: #fff; font-weight: 750; }
.format-tabs button.unavailable { border-color: rgba(216, 208, 194, .28); color: rgba(242, 232, 218, .5); cursor: not-allowed; }
.product-tabs {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 28px;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 24px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  background: rgba(34, 23, 18, .32);
  scrollbar-width: none;
}
.product-tabs::-webkit-scrollbar { display: none; }
.product-tabs button {
  flex: 0 0 auto;
  padding: 12px 0 11px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #eadfce;
  font-size: 14px;
}
.product-tabs button.active { border-color: #57a9a0; color: #fff; font-weight: 750; }
.product-tabs button.unavailable { color: rgba(234, 223, 206, .48); cursor: not-allowed; }
.section-tabs {
  display: flex;
  gap: 6px;
  padding: 6px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.section-tabs :where(button, a) {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 5px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--brand-2);
  text-decoration: none;
}
.section-tabs :where(button, a).active { background: var(--accent-soft); color: var(--brand); font-weight: 700; }
.density-editorial, [data-density="editorial"] { --density-block: var(--space-5); --density-inline: var(--space-5); }
.density-standard, [data-density="standard"] { --density-block: var(--space-4); --density-inline: var(--space-4); }
.density-compact, [data-density="compact"] { --density-block: var(--space-2); --density-inline: var(--space-3); }
.page-shell { max-width: var(--content-max); min-height: 54vh; margin: 0 auto; padding: 20px 24px 60px; }
.availability-message { padding: 9px 12px; margin: 0 0 12px; border: 1px solid #d7b66f; border-radius: var(--radius-md); background: var(--warning-bg); color: var(--warning); font-size: var(--text-sm); box-shadow: var(--shadow); }
.source-note, .panel, .event-summary {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}
.source-note { padding: 12px 14px; margin-bottom: 12px; color: var(--muted); font-size: var(--text-xs); }
.source-note a { display: inline-flex; align-items: center; min-height: var(--target-min); }
.source-note p { margin-bottom: 6px; }
.source-note p:last-child { margin-bottom: 0; }
.freshness-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  align-items: center;
  margin: 0 0 12px;
  padding: 10px 15px;
  border: 1px solid var(--line);
  background: #f9f8f4;
  color: var(--muted);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
}
.freshness-title { margin-right: auto; color: var(--ink); font-size: var(--text-sm); }
.freshness-note { flex-basis: 100%; margin: 0; line-height: 1.6; overflow-wrap: anywhere; }
.freshness-facts { display: flex; flex: 0 1 auto; flex-wrap: nowrap; gap: 8px 22px; align-items: center; min-width: 0; }
.freshness-fact { display: inline-flex; gap: 5px; align-items: baseline; }
.freshness-fact small { color: var(--muted); font-size: inherit; }
.freshness-fact b { color: var(--brand-2); font-size: var(--text-sm); white-space: nowrap; }
.freshness-fact.freshness-unknown b { color: var(--muted); }
.freshness-strip.freshness-stacked .freshness-title { flex: 1 0 100%; margin-right: 0; }
.freshness-strip.freshness-stacked .freshness-facts { flex: 1 0 100%; flex-wrap: wrap; }
.range-buttons { display: flex; gap: 6px; margin-bottom: 12px; }
.period-info { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; color: var(--muted); font-size: var(--text-sm); }
.period-info strong { color: var(--brand-2); }
.panel { padding: var(--space-4); margin-bottom: var(--space-4); }
.panel-toolbar, .event-header, .event-title-row, .tabletop-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.panel-toolbar { margin-bottom: 10px; }
.panel-toolbar h2, .event-header h2 { margin: 0; font: 700 var(--text-md)/var(--leading-tight) var(--font-editorial); }
.secondary-button { color: var(--brand-2); border-color: #b9a592; font-size: var(--text-xs); }
.secondary-button:hover { background: #faf3ea; }
.chart-panel { min-height: 230px; }
.chart-legend { display: flex; justify-content: flex-end; gap: 16px; color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.chart-legend i { display: inline-block; width: 14px; height: 9px; margin-right: 5px; }
.chart-legend i.hs, .chart-bar.hs { background: #aebbd2; }
.chart-legend i.top8, .chart-bar.top8 { background: var(--brand-blue); }
.chart-row { display: grid; grid-template-columns: 190px 1fr; gap: 12px; align-items: center; margin: 9px 0; font-size: 13px; }
.chart-bars { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.chart-bar { min-height: 15px; border-radius: 2px; padding: 0 5px; color: #1f3448; font-size: 10px; white-space: nowrap; }
.chart-bar.top8 { color: #fff; }
.table-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
table { width: 100%; border-collapse: collapse; background: var(--surface-strong); font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
th, td { padding: 7px 10px; border-bottom: 1px solid #e7e1d7; text-align: left; white-space: nowrap; }
th { background: #f6f1e9; color: #4e5a58; font-weight: 650; }
td.number, th.number { text-align: right; }
.metric-columns :is(th.number, td.number) { padding-right: 40px; }
.metric-columns th.number { position: relative; }
tbody tr:hover { background: #fbf7f0; }
.subtype-row td, .subtype-head { background: var(--brand-soft); color: var(--brand-2); }
.data-table { table-layout: fixed; }
.data-table .identity-column { width: 260px; }
.data-table .metric-column { width: 120px; }
.data-table tbody tr:not(.deck-detail-row) > td:first-child { padding-left: 36px; }
.subtype-row td:first-child { padding-left: 50px !important; }
.name-button, .text-button {
  display: inline-flex;
  align-items: center;
  min-height: var(--target-min);
  border: 0;
  background: none;
  color: var(--brand-2);
  padding: 0;
  font-weight: 650;
  text-align: left;
}
.name-button:hover, .text-button:hover { text-decoration: underline; }
.hierarchy-toggle { position: relative; display: inline-flex; align-items: center; }
.hierarchy-toggle .round-toggle { position: absolute; right: calc(100% + 6px); }
.round-toggle, .axis-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--target-min);
  height: var(--target-min);
  border: 1px solid #b9a592;
  border-radius: 50%;
  background: var(--surface-strong);
  color: var(--brand-2);
  font-weight: 700;
  line-height: 1;
}
.round-toggle {
  width: 18px;
  height: 18px;
  font-size: 13px;
}
.tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--target-min);
  width: var(--target-min);
  height: var(--target-min);
  margin-left: 4px;
  border-radius: 0;
  background: transparent;
  color: transparent;
  font-size: 0;
  cursor: help;
  position: relative;
}
.tip::before {
  content: "i";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #455b5d;
  color: #fff;
  font: 700 10px/1 var(--font-ui);
}
.tip:hover::after, .tip:focus::after {
  content: attr(data-tip);
  position: absolute;
  z-index: 10;
  top: calc(100% + 2px);
  right: 0;
  width: 250px;
  padding: 8px 10px;
  border: 1px solid #d0d3d6;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
  color: #444;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  text-align: left;
  white-space: normal;
}
.sort-button {
  display: inline-flex;
  align-items: center;
  min-height: var(--target-min);
  border: 0;
  background: none;
  padding: 0;
  color: inherit;
  font-weight: inherit;
}
.sort-indicator { font-size: 10px; }
.metric-columns th.number .sort-button {
  width: 100%;
  justify-content: flex-end;
  text-align: right;
}
.metric-columns th.number .sort-accessories {
  position: absolute;
  top: 50%;
  left: calc(100% - 36px);
  display: inline-flex;
  align-items: center;
  gap: 2px;
  transform: translateY(-50%);
}
.metric-columns th.number .sort-accessories .sort-indicator { pointer-events: none; }
.metric-columns th.number .sort-accessories .tip { margin-left: 0; }
.deck-detail { position: relative; margin-top: 15px; padding: 15px; border-top: 2px solid var(--accent-soft); background: #fcf9f4; }
.deck-detail-row > td { padding: 0; white-space: normal; }
.deck-detail-row .deck-detail { margin-top: 0; }
.deck-detail h3 { margin: 0 36px 10px 0; font-size: 16px; }
.deck-close { position: absolute; top: 12px; right: 12px; border: 0; border-radius: 4px; background: #e8eaed; color: #666; padding: 3px 9px; }
.deck-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.deck-column h4 { margin: 10px 0 4px; font-size: 13px; color: var(--brand-2); }
.deck-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 6px;
  color: #888;
  font-size: 12px;
}
.deck-meta-item {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.deck-meta-item + .deck-meta-item::before {
  content: "·";
  margin: 0 5px;
}
.card-list { list-style: none; padding: 0; margin: 0; columns: 2; font-size: 13px; }
.card-list li { padding: 1px 0; break-inside: avoid; }
.card-list .qty { display: inline-block; width: 32px; margin-right: 6px; color: #999; text-align: right; }
.card-link { display: inline-flex; align-items: center; min-height: var(--target-min); color: var(--ink); text-decoration: none; }
.card-link:hover { color: var(--brand-2); text-decoration: underline; }
.deviation-box, .change-box { margin: 6px 0 10px; padding: 8px 10px; border-radius: 6px; font-size: 12px; }
.deviation-box { background: #f0f4f8; }
.change-box { background: #f7f4ef; }
.deviation-box strong { color: var(--brand); font-size: 15px; }
.change-box strong { color: #9a6a00; font-size: 14px; }
.deviation-box p, .change-box p {
  min-width: 0;
  max-width: 100%;
  margin: 2px 0;
  overflow-wrap: anywhere;
  color: #888;
  white-space: normal;
}
.difference-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 7px; }
.difference-grid b { font-size: 12px; color: #555; }
.difference-grid p { margin: 2px 0; }
.deck-mode { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.deck-mode button { min-height: var(--target-min); border: 1px solid #ccc; background: #fff; padding: 4px 9px; border-radius: 4px; font-size: 12px; }
.deck-mode button.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.deck-mode span { color: #999; font-size: 11px; }
.group-title.core { color: #2c6e49; }
.group-title.flex { color: #9a6a00; }
.refresh-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin: 0 0 var(--space-3);
  padding: 10px 12px;
  border: 1px solid #c8b79f;
  border-radius: var(--radius-md);
  background: #fff8e9;
  color: #5d451f;
}
.refresh-status[data-kind="error"] { border-color: #c87870; background: #fff3f1; color: #7f2e28; }
.loading-skeleton { padding: 20px 0; }
.skeleton-line,
.skeleton-block {
  display: block;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, #e6e0d6 25%, #f6f1e9 50%, #e6e0d6 75%);
  background-size: 200% 100%;
  animation: skeleton-shift 1.4s linear infinite;
}
.skeleton-title { width: min(320px, 68%); height: 28px; margin-bottom: 18px; }
.skeleton-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.skeleton-block { height: 64px; }
.skeleton-rows { display: grid; gap: 10px; }
.skeleton-rows .skeleton-line { height: 42px; }
@keyframes skeleton-shift { to { background-position: -200% 0; } }
.inline-error-state {
  margin: 10px 0;
  padding: 12px;
  border: 1px solid #c87870;
  border-radius: var(--radius-md);
  background: #fff3f1;
  color: #7f2e28;
}
.inline-error-state p,
.error-state p { margin: 4px 0 10px; }
.card-image-frame {
  position: relative;
  aspect-ratio: 63 / 88;
  overflow: hidden;
  border: 1px solid #cbbfae;
  border-radius: 12px;
  background: #eee8dd;
}
.card-image-frame img { display: block; width: 100%; height: 100%; object-fit: contain; }
.card-image-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  color: #5f6664;
  text-align: center;
}
.card-image-frame.is-loaded .card-image-placeholder { display: none; }
.card-image-frame:not(.is-loaded) img { visibility: hidden; }
.card-image-frame.is-loading .card-image-placeholder::before {
  width: 38px;
  height: 38px;
  border: 3px solid #c8bcaa;
  border-top-color: var(--brand-teal);
  border-radius: 50%;
  content: "";
  animation: card-image-spin .8s linear infinite;
}
@keyframes card-image-spin { to { transform: rotate(360deg); } }
.card-preview-popover {
  position: fixed;
  z-index: 9999;
  width: 240px;
  pointer-events: none;
  filter: drop-shadow(0 5px 12px rgba(0, 0, 0, .38));
}
.card-preview-modal {
  position: fixed;
  z-index: 10000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(14, 17, 17, .88);
}
.card-preview-dialog {
  position: relative;
  display: grid;
  justify-items: center;
  width: min(100%, 430px);
  max-height: calc(100dvh - 40px);
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: var(--radius-lg);
  background: #201c19;
  color: #fff;
  box-shadow: 0 16px 50px rgba(0, 0, 0, .55);
}
.card-preview-dialog h2 { width: 100%; margin: 0 42px 12px 0; font-size: var(--text-lg); }
.card-preview-dialog .card-image-frame {
  width: min(78vw, calc((100dvh - 190px) * 63 / 88), 360px);
  max-width: 100%;
}
.card-preview-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 50%;
  background: rgba(0, 0, 0, .38);
  color: #fff;
  font-size: 24px;
  line-height: 1;
}
.card-preview-dialog .primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 14px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: #f4e6d2;
  color: #3b2319;
  font-weight: 700;
  text-decoration: none;
}
body.card-modal-open { position: fixed; width: 100%; overflow: hidden; }
.matchup-legend { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; color: #666; font-size: 12px; }
.legend-bar { width: 180px; height: 12px; border-radius: 3px; background: linear-gradient(to right, var(--red), var(--yellow), var(--green)); }
.legend-values { display: flex; justify-content: space-between; width: 180px; color: #888; font-size: 11px; }
.na-chip { display: inline-block; width: 14px; height: 14px; margin-right: 4px; vertical-align: middle; border: 1px solid #d0d3d6; border-radius: 3px; background: #e6e8ea; }
.low-chip { display: inline-block; width: 0; height: 0; margin-right: 4px; vertical-align: middle; border-top: 7px solid rgba(0, 0, 0, .4); border-left: 7px solid transparent; }
.matchup-table { width: max-content; font-size: var(--text-xs); }
.matchup-table th, .matchup-table td { border: 1px solid #e3e6ea; }
.matchup-table .corner, .matchup-table .row-head { width: 230px; min-width: 230px; max-width: 230px; }
.matrix-sticky-table { width: max-content; font-size: var(--text-xs); }
.matrix-sticky-table th { border: 1px solid #e3e6ea; }
.matrix-sticky-table .corner { width: 230px; min-width: 230px; max-width: 230px; }
.column-head { position: relative; height: 150px; vertical-align: bottom; font-weight: 400; }
.column-head > div { position: relative; height: 136px; }
.column-head > div > span { position: absolute; bottom: 0; left: 50%; writing-mode: vertical-rl; transform: translateX(-50%); }
.column-head.overall { height: auto; vertical-align: bottom; font-weight: 700; }
.row-head { position: sticky; left: 0; z-index: 1; padding-left: 34px; background: #f0f2f5; font-weight: 400; }
.row-head.subtype-head { padding-left: 46px; }
.row-head > span { display: block; white-space: normal; }
.axis-toggle { padding: 0; vertical-align: middle; font-size: 14px; }
.row-head .axis-toggle { position: absolute; top: 50%; left: 7px; margin: 0; transform: translateY(-50%); }
.column-head .column-toggle { position: absolute; bottom: 0; left: 2px; margin: 0; transform: none; }
.matrix-cell { position: relative; min-width: 64px; width: 64px; height: 46px; padding: 3px; text-align: center; }
.matrix-cell strong { display: block; font-size: 13px; }
.matrix-cell small { display: block; opacity: 1; font-size: 12px; }
.matrix-cell.good { background: #3c915c; color: #fff; }
.matrix-cell.even { background: #e8c84a; color: #333; }
.matrix-cell.bad { background: #c85c50; color: #fff; }
.matrix-cell.na { background: #e6e8ea; color: #596164; }
.matrix-cell.low-sample::after { content: ""; position: absolute; top: 2px; right: 2px; border-top: 6px solid rgba(0, 0, 0, .28); border-left: 6px solid transparent; }
.matrix-record { width: max-content; max-width: 100%; margin-top: 8px; padding: 6px 9px; border-radius: 5px; background: #2b2f33; color: #fff; font-size: 12px; }
.select-row { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
select { min-height: var(--control-height); border: 1px solid #bfb8ad; border-radius: var(--radius-sm); background: var(--surface-strong); padding: 5px 9px; color: var(--ink); }
.event-panel { padding: 0; overflow: hidden; }
.event-header { padding: 13px 16px; background: #f0f2f5; }
.event-header p { margin: 3px 0 0; color: #777; font-size: 12px; }
.event-header > span { color: #777; font-size: 12px; }
.top8-table th:first-child, .top8-table td:first-child { width: 70px; text-align: center; }
.top8-week-table { min-width: 760px; }
.top8-week-table th:not(:first-child) { min-width: 210px; }
.top8-week-table th strong, .top8-week-table th small { display: block; }
.top8-week-table th small { margin-top: 2px; color: #5f676f; font-size: var(--text-xs); font-weight: 400; }
.event-summary { padding: 16px; margin-bottom: 12px; }
.event-summary > p { margin: 8px 0; color: #6c7580; font-size: 13px; }
.event-title-row a { display: inline-flex; align-items: center; min-height: var(--target-min); color: var(--brand-2); font-size: 13px; text-decoration: none; }
.event-title-row > span { color: var(--muted); font-size: 12px; }
.prototype-badge { padding: 3px 8px; border-radius: 999px; background: #eee9f6; color: #6b4b87 !important; font-weight: 700; }
.quality-notice, .selection-warning { display: flex; gap: 8px; padding: 9px 11px; margin-top: 8px; border-radius: 6px; font-size: 12px; }
.quality-notice { border: 1px solid #ead39f; background: var(--warning-bg); color: #704000; }
.quality-notice strong { white-space: nowrap; }
.selection-warning { border: 1px solid #c7d8ea; background: #eef5fb; color: #315f8d; }
.tabletop-controls { margin-bottom: 12px; }
.scope-tabs, .subview-tabs { display: flex; gap: 5px; flex-wrap: wrap; }
.tabletop-view-tabs { margin-bottom: 10px; }
.tabletop-event-select { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.tabletop-event-select select { min-width: min(100%, 430px); }
.event-checkbox-pane { max-height: 148px; overflow-y: auto; margin-bottom: 10px; padding: 5px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.event-checkbox-pane label { display: flex; align-items: flex-start; gap: 8px; padding: 7px 8px; border-radius: 5px; cursor: pointer; }
.event-checkbox-pane label:hover { background: #f5f8fb; }
.event-checkbox-pane input { margin-top: 4px; }
.event-checkbox-pane span, .event-checkbox-pane strong, .event-checkbox-pane small { display: block; }
.event-checkbox-pane small { color: var(--muted); font-size: 11px; font-weight: 400; }
.scope-tabs { margin-bottom: 0; }
.scope-tabs button:disabled { cursor: not-allowed; background: #eceef1; color: #9aa0a8; }
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-bottom: 12px; }
.summary-grid > div { padding: 11px 13px; border-radius: 7px; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .06); }
.summary-grid span { display: block; color: #777; font-size: 11px; }
.summary-grid strong { display: block; font-size: 18px; }
.overall-row td { background: #edf1f5; font-weight: 700; }
.record-cell strong, .record-cell small { display: block; }
.record-cell small { color: var(--muted); font-weight: 400; }
.panel-subtitle { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.site-footer { max-width: var(--content-max); margin: 22px auto 0; padding: 18px 24px 16px; border-top: 1px solid var(--line); color: var(--muted); text-align: center; font-size: var(--text-xs); line-height: 1.55; }
.site-footer p { margin: 0; }
.site-footer .site-authorship { margin-top: 7px; }
.site-footer a { display: inline-flex; align-items: center; min-height: var(--target-min); color: var(--brand-2); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.return-to-top {
  position: fixed;
  z-index: 28;
  right: calc(16px + env(safe-area-inset-right, 0px));
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 4px 14px rgba(30, 24, 20, .28);
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
}
.return-to-top:hover { background: var(--brand-2); }
.return-to-top:focus-visible {
  outline-color: var(--focus-on-dark);
  box-shadow: 0 0 0 3px rgba(215, 255, 248, .42), 0 4px 14px rgba(30, 24, 20, .28);
}
.return-to-top:active { transform: translateY(1px); }

@media (max-width: 780px) {
  .header-main {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    padding: 14px 13px 11px;
  }
  .brand { grid-column: 1; grid-row: 1; min-width: 0; }
  .brand h1 { font-size: 23px; }
  html[lang="en"] .brand h1 { font-size: 20px; }
  .format-tabs {
    grid-column: 1 / -1;
    grid-row: 2;
    gap: 7px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }
  .format-tabs::-webkit-scrollbar { display: none; }
  .format-tabs button { min-height: 33px; padding: 5px 10px; font-size: 13px; }
  .lang-switch { grid-column: 2; grid-row: 1; align-self: start; margin-top: -4px; }
  .lang-switch button { min-width: var(--target-min); min-height: var(--target-min); padding: 1px 3px; font-size: 12px; }
  .cat-brand-watermark { top: 0; right: 68px; width: 84px; height: 64px; opacity: .16; }
  .cat-brand-watermark img { top: -4px; width: 94%; }
  .product-tabs { gap: 22px; padding: 0 13px; }
  .product-tabs button { padding: 10px 0 9px; font-size: 13px; }
  .page-shell { padding: 12px 10px 42px; }
  .site-footer {
    padding-right: calc(72px + env(safe-area-inset-right, 0px));
    padding-left: 13px;
  }
  .return-to-top {
    right: calc(10px + env(safe-area-inset-right, 0px));
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    width: 44px;
    height: 44px;
  }
  .freshness-strip { gap: 7px 14px; padding: 11px 13px; }
  .freshness-strip.freshness-stacked .freshness-facts { gap: 7px 14px; }
  .freshness-strip.freshness-stacked .freshness-fact {
    display: grid;
    flex: 1 1 calc(50% - 14px);
    gap: 2px;
    align-content: start;
    min-width: 0;
    line-height: 1.35;
  }
  .freshness-strip.freshness-stacked .freshness-fact[data-freshness-key="period"],
  .freshness-strip.freshness-stacked .freshness-fact[data-freshness-key="week"],
  .freshness-strip.freshness-stacked .freshness-fact[data-freshness-key="event-date"] { flex-basis: 100%; }
  .freshness-strip.freshness-stacked .freshness-fact small,
  .freshness-strip.freshness-stacked .freshness-fact b { display: block; }
  .deck-columns { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 520px) {
  .panel-toolbar, .event-title-row { align-items: flex-start; }
  .chart-row { grid-template-columns: 1fr; gap: 3px; }
  .chart-bar { max-width: calc(100vw - 70px); }
  .period-info { flex-direction: column; }
  .card-list { columns: 1; }
  .difference-grid { grid-template-columns: 1fr; gap: 6px; }
  .quality-notice { flex-direction: column; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
}

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