:root {
  --bg: #111111;
  --panel: #181818;
  --panel-2: #202020;
  --ink: #f2f0e9;
  --muted: #a6a39b;
  --line: #393939;
  --accent: #d6c47e;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.topbar { min-height: 58px; padding: 0 clamp(18px, 4vw, 64px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 10px; align-items: center; color: var(--ink); text-decoration: none; text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 800; }
.brand em { color: var(--muted); font-style: normal; font-weight: 500; }
.brand-mark { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--accent); color: var(--accent); font-family: inherit; font-size: 17px; }
.event-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.workspace { width: min(1600px, 100%); margin: 0 auto; padding: 38px clamp(16px, 4vw, 64px) 72px; }
.workspace-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .18em; }
h1, h2 { margin: 0; font-family: inherit; font-weight: 500; letter-spacing: -.035em; }
h1 { font-size: clamp(36px, 5vw, 58px); line-height: 1; }
h2 { font-size: clamp(28px, 3vw, 42px); }
.intro { margin: 10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.source-status { min-width: 238px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); padding: 10px 12px; }
.status-dot { width: 7px; height: 7px; flex: 0 0 auto; background: var(--accent); }
.status-dot.loading { animation: blink 1s infinite alternate; }
.status-dot.offline { background: var(--muted); }
@keyframes blink { to { opacity: .25; } }
.source-status strong, .source-status small { display: block; }
.source-status strong { font-size: 11px; }
.source-status small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; border: 1px solid var(--line); background: var(--panel); }
.view-tabs { flex: 1; display: grid; grid-template-columns: repeat(2, minmax(130px, 1fr)); }
.tab { min-height: 46px; border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--muted); padding: 0 18px; cursor: pointer; font-weight: 750; font-size: 12px; text-align: center; }
.tab.active { background: var(--ink); color: var(--bg); }
.search { display: flex; align-items: center; gap: 8px; width: min(330px, 40vw); padding: 0 16px; color: var(--muted); }
.search input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); padding: 12px 0; }
.search input::placeholder { color: #77756f; }
.filter-rail { display: grid; grid-template-columns: repeat(var(--filter-count), minmax(72px, 1fr)); margin-top: 16px; overflow-x: auto; border: 1px solid var(--line); scrollbar-width: none; }
.filter-chip { min-width: 0; min-height: 48px; display: grid; place-items: center; border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--muted); padding: 7px 8px; font-size: 11px; text-align: center; cursor: pointer; }
.filter-chip:last-child { border-right: 0; }
.filter-chip:hover { color: var(--ink); background: var(--panel-2); }
.filter-chip.active { color: var(--bg); background: var(--ink); }
.filter-chip:focus-visible { position: relative; z-index: 1; outline: 2px solid var(--accent); outline-offset: -3px; }
.filter-label { min-width: 0; display: flex; flex-direction: column; gap: 2px; font-weight: 750; }
.filter-chip b { color: var(--muted); font-size: 9px; font-weight: 500; }
.filter-chip.active b { color: #595959; }
.domain-tab-icon { width: 19px; height: 19px; margin: 0 auto 2px; object-fit: contain; }
.group-identity { min-height: 72px; display: flex; align-items: center; gap: 14px; border: 1px solid var(--line); border-top: 0; background: var(--panel); padding: 7px; }
.group-identity[hidden] { display: none; }
.identity-art { width: 58px; height: 58px; flex: 0 0 auto; overflow: hidden; border-right: 1px solid var(--line); background: var(--panel-2); }
.identity-art img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: center 17%; filter: saturate(.8); }
.identity-copy { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.identity-copy span { color: var(--muted); font-size: 9px; font-weight: 750; text-transform: uppercase; letter-spacing: .1em; }
.identity-copy strong { overflow: hidden; color: var(--ink); font-family: inherit; font-size: 19px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.result-summary { min-height: 32px; padding: 10px 1px 13px; display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 11px; }
.result-summary strong { color: var(--ink); }
.sort-control { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.sort-control select { border: 1px solid var(--line); border-radius: 0; background: var(--panel); color: var(--ink); padding: 5px 24px 5px 7px; font: inherit; text-transform: none; cursor: pointer; }
.sort-control select:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card-tile { min-width: 0; }
.card-open { --category-border: var(--line); --category-banner: #5b5b5b; --category-ink: var(--ink); --category-glow: 91, 91, 91; --glow-low: .1; --glow-high: .22; --glow-radius: 10px; position: relative; width: 100%; height: 100%; display: grid; grid-template-rows: auto 1fr; border: 1px solid var(--category-border); background: var(--panel); color: inherit; padding: 0; text-align: left; cursor: pointer; overflow: hidden; }
.card-open:hover, .card-open:focus-visible { border-color: var(--category-banner); outline: 0; z-index: 1; box-shadow: 0 0 0 1px rgba(var(--category-glow), var(--glow-low)), 0 0 8px rgba(var(--category-glow), var(--glow-low)); animation: category-glow 1.25s ease-in-out infinite alternate; }
.card-open.category-core, .card-open.category-must-include { --category-border: #786e49; --category-banner: var(--accent); --category-ink: #17140b; --category-glow: 214, 196, 126; --glow-low: .3; --glow-high: .78; --glow-radius: 26px; }
.card-open.category-a-tier { --category-border: #65705f; --category-banner: #95a58c; --category-ink: #11150f; --category-glow: 149, 165, 140; --glow-low: .22; --glow-high: .55; --glow-radius: 20px; }
.card-open.category-b-tier, .card-open.category-maybe { --category-border: #565656; --category-banner: #777772; --category-glow: 119, 119, 114; --glow-low: .14; --glow-high: .34; --glow-radius: 14px; }
.card-open.category-cut, .card-open.category-dont-include { --category-border: #704e4d; --category-banner: #946460; --category-glow: 148, 100, 96; --glow-low: .08; --glow-high: .2; --glow-radius: 9px; }

@keyframes category-glow {
  from { box-shadow: 0 0 0 1px rgba(var(--category-glow), var(--glow-low)), 0 0 8px rgba(var(--category-glow), var(--glow-low)); }
  to { box-shadow: 0 0 0 1px rgba(var(--category-glow), var(--glow-high)), 0 0 var(--glow-radius) rgba(var(--category-glow), var(--glow-high)); }
}
.art-wrap { position: relative; aspect-ratio: 744 / 680; overflow: hidden; background: #222; border-bottom: 1px solid var(--line); }
.card-art { position: relative; z-index: 1; width: 100%; height: 100%; display: block; object-fit: cover; object-position: top; }
.card-art[hidden] { display: none; }
.art-placeholder { position: absolute; inset: 0; display: grid; place-items: center; background: #202020; color: #555; font-family: inherit; font-size: 38px; letter-spacing: .18em; }
.card-info { position: relative; min-height: 230px; display: flex; flex-direction: column; padding: 12px 14px 52px; overflow: hidden; }
.card-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-info h3 { margin: 9px 0 0; font-size: 16px; line-height: 1.25; letter-spacing: -.01em; }
.card-title-row .cost { margin-top: 8px; }
.cost { min-width: 24px; display: flex; flex-direction: row; align-items: flex-start; gap: 4px; color: var(--accent); font-family: inherit; font-size: 18px; line-height: 1; }
.energy-cost { display: block; }
.power-cost { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.power-unit { display: flex; align-items: center; gap: 1px; }
.power-unit img { width: 14px; height: 14px; display: block; object-fit: contain; }
.wild-power { width: 13px; height: 13px; display: block; border: 1px solid #d7d7d7; background: conic-gradient(#d46c67, #d6c47e, #79a987, #7398bc, #937db2, #d46c67); }
.power-unit i { color: var(--muted); font-size: 8px; font-style: normal; }
.subtitle { min-height: 14px; margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.subtitle:empty { display: none; }
.rules { height: 54px; margin: 12px 0; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; color: #c3c0b9; font-size: 11px; line-height: 1.55; }
.rules.no-data { color: var(--muted); font-style: italic; }
.recommendation { position: absolute; right: -20px; bottom: 15px; width: 145px; transform: rotate(-6deg); transform-origin: center; background: var(--category-banner); color: var(--category-ink); clip-path: polygon(13% 0, 100% 0, 100% 100%, 0 100%); }
.rank-badge { display: block; padding: 7px 24px 7px 18px; color: inherit; font-size: 9px; font-weight: 900; letter-spacing: .1em; text-align: center; text-transform: uppercase; }
.specific-badge { position: absolute; left: 14px; bottom: 15px; border: 1px solid #5b5b5b; padding: 4px 6px; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.cross-rank { margin-top: auto; padding-top: 8px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.meta { display: flex; gap: 5px; flex-wrap: wrap; }
.meta span { color: var(--muted); font-size: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.meta span:empty { display: none; }
.meta span + span:not(:empty)::before { content: "/"; margin-right: 6px; color: #666; }
.empty { padding: 90px 20px; color: var(--muted); text-align: center; }
.empty strong, .empty span { display: block; }
.empty strong { margin-bottom: 8px; color: var(--ink); }
.legend-section { padding: 48px clamp(18px, 4vw, 64px); display: grid; grid-template-columns: .8fr 1.2fr; align-items: end; gap: 24px 8vw; border-top: 1px solid var(--line); background: #171717; }
.legend-section > p { max-width: 650px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.key { grid-column: 1 / -1; padding-top: 18px; display: flex; flex-wrap: wrap; gap: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; font-weight: 700; }
.swatch { display: inline-block; width: 7px; height: 7px; margin-right: 7px; background: #8d8d8d; }
.swatch.core { background: var(--accent); }
footer { padding: 30px clamp(18px, 4vw, 64px); display: flex; justify-content: space-between; gap: 36px; color: var(--muted); font-size: 10px; line-height: 1.6; }
footer strong, footer span { display: block; }
footer strong { color: var(--ink); }
footer p { max-width: 540px; margin: 0; text-align: right; }
dialog { width: min(880px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0; overflow: auto; border: 1px solid #555; background: var(--panel); color: var(--ink); box-shadow: 0 24px 80px #000; }
dialog::backdrop { background: rgba(0, 0, 0, .82); }
.dialog-close { position: fixed; z-index: 4; margin: 12px 0 0 min(832px, calc(100vw - 60px)); width: 34px; height: 34px; border: 1px solid #666; background: var(--bg); color: var(--ink); font-size: 21px; cursor: pointer; }
.dialog-layout { display: grid; grid-template-columns: minmax(270px, .8fr) 1.2fr; }
.dialog-art { min-height: 540px; display: flex; align-items: center; background: var(--bg); border-right: 1px solid var(--line); }
.dialog-art img { width: 100%; display: block; }
.dialog-copy { padding: 44px 38px; }
.dialog-copy h2 { font-size: 42px; line-height: 1; }
.dialog-subtitle { margin: 7px 0 24px; color: var(--muted); font-family: inherit; font-size: 17px; }
.dialog-subtitle:empty { display: none; }
.dialog-rules { color: #d2cfc8; font-size: 15px; line-height: 1.65; white-space: pre-line; }
.dialog-stats { margin: 26px 0; display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); }
.dialog-stats div { padding: 12px; border-right: 1px solid var(--line); }
.dialog-stats div:last-child { border: 0; }
.dialog-stats small, .dialog-stats strong { display: block; }
.dialog-stats small { color: var(--muted); font-size: 8px; text-transform: uppercase; letter-spacing: .12em; }
.dialog-stats strong { margin-top: 5px; font-size: 13px; }
.dialog-power .power-cost { align-items: flex-start; }
.dialog-power .power-unit { display: inline-flex; margin-right: 2px; }
.dialog-power .power-unit img { width: 17px; height: 17px; }
.dialog-power .wild-power { width: 16px; height: 16px; }
.dialog-rankings { padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.7; }
.dialog-rankings strong { color: var(--ink); }
.dialog-link { display: inline-block; margin-top: 20px; color: var(--accent); font-size: 11px; }
.card-flight-layer { position: fixed; inset: 0; width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; overflow: visible; border: 0; background: transparent; pointer-events: none; }
.card-flight-layer::backdrop { background: transparent; }
.card-flight-image { position: fixed; display: block; max-width: none; max-height: none; margin: 0; object-fit: cover; pointer-events: none; will-change: left, top, width, height, object-position; }
.card-flight-text { position: fixed; display: block !important; min-height: 0 !important; max-width: none; max-height: none; margin: 0 !important; padding: 0; overflow: hidden; border: 0; background: transparent; pointer-events: none; white-space: pre-line; -webkit-box-orient: initial; -webkit-line-clamp: unset; will-change: left, top, width, height, font-size, line-height; }
@media (max-width: 800px) {
  .workspace-head { align-items: flex-start; flex-direction: column; }
  .source-status { width: 100%; }
  .legend-section { grid-template-columns: 1fr; }
  .dialog-layout { grid-template-columns: 1fr; }
  .dialog-art { min-height: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .dialog-art img { max-height: 64vh; object-fit: contain; }
  .dialog-copy { padding: 30px 22px; }
  .dialog-stats { grid-template-columns: repeat(2, 1fr); }
  .dialog-stats div:nth-child(2) { border-right: 0; }
  .dialog-stats div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 620px) {
  .topbar { padding: 0 14px; }
  .brand em { display: none; }
  .event-label { font-size: 9px; }
  .workspace { padding-top: 28px; }
  .toolbar { align-items: stretch; flex-direction: column; gap: 0; }
  .view-tabs { border-bottom: 1px solid var(--line); }
  .tab { flex: 1; }
  .search { width: 100%; }
  .filter-rail { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(106px, 42%); overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: var(--muted) var(--panel); overscroll-behavior-inline: contain; touch-action: pan-x; }
  .filter-rail::-webkit-scrollbar { height: 4px; }
  .filter-rail::-webkit-scrollbar-track { background: var(--panel); }
  .filter-rail::-webkit-scrollbar-thumb { background: var(--muted); }
  .filter-chip { scroll-snap-align: center; }
  .card-grid { grid-template-columns: 1fr; gap: 10px; }
  .card-open { grid-template-columns: minmax(120px, 38%) minmax(0, 1fr); grid-template-rows: minmax(220px, auto); }
  .art-wrap { width: 100%; height: 100%; min-height: 220px; aspect-ratio: auto; border-right: 1px solid var(--line); border-bottom: 0; }
  .card-info { min-height: 220px; padding: 11px 12px 50px; }
  .card-info h3 { font-size: 15px; }
  .rules { height: 38px; margin: 10px 0; display: -webkit-box; -webkit-line-clamp: 2; }
  .recommendation { right: -18px; bottom: 12px; width: 126px; }
  .rank-badge { padding: 6px 20px 6px 15px; }
  .specific-badge { left: 11px; bottom: 12px; }
  .meta { line-height: 1.5; }
  .result-summary span:last-child { display: none; }
  .sort-control > span { display: none; }
  .sort-control select { max-width: 132px; }
  dialog { width: calc(100vw - 12px); max-height: calc(100dvh - 12px); }
  .dialog-close { position: sticky; top: 8px; display: block; margin: 8px 8px -42px auto; }
  .dialog-art { justify-content: center; padding: 8px; }
  .dialog-art img { width: auto; height: min(40vh, 360px); height: min(40svh, 360px); max-width: 100%; max-height: none; object-fit: contain; }
  .dialog-copy { padding: 24px 18px 30px; }
  .dialog-copy h2 { padding-right: 30px; font-size: clamp(22px, 7vw, 30px); }
  .dialog-subtitle { margin-bottom: 18px; font-size: 14px; }
  .dialog-subtitle.matched-note { display: none; }
  .dialog-rules { font-size: 13px; line-height: 1.6; }
  .dialog-stats { margin: 16px 0; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .dialog-stats div { min-width: 0; padding: 9px 6px; border-right: 1px solid var(--line); }
  .dialog-stats div:nth-child(2) { border-right: 1px solid var(--line); }
  .dialog-stats div:nth-child(-n+2) { border-bottom: 0; }
  .dialog-stats div:last-child { border-right: 0; }
  .dialog-stats strong { overflow-wrap: anywhere; font-size: 10px; }
  footer { flex-direction: column; }
  footer p { text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
