:root {

  --bg: #ffffff; --ink: #000000;
  --rule: #ebebeb; --rule-2: #d6d6d6; --focus: #3b6fb6;

  --o-solved: #177f3b; --o-cost: #dfa04f; --o-budget: #8e98d8; --o-timeout: #cfcfcf;
  --o-gaveup: #555555;
  --ot-solved: #fff; --ot-cost: #000; --ot-budget: #000; --ot-timeout: #000; --ot-gaveup: #fff;
  --thumb-bg: #f2f2f2; --ghost-bg: #f7f7f7;
  --edge-img: rgba(0, 0, 0, .08); --edge-img-hover: rgba(0, 0, 0, .6);
  --font: system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --film: 1740 / 800;
  --page: 2200px; --pad: 24px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212; --ink: #ffffff;
    --rule: #262626; --rule-2: #383838; --focus: #7aa7e0;
    --o-solved: #1e7f43; --o-cost: #e0a95a; --o-budget: #7a84cf; --o-timeout: #3a3a3a;
    --o-gaveup: #efefef;
    --ot-solved: #fff; --ot-cost: #000; --ot-budget: #000; --ot-timeout: #fff; --ot-gaveup: #000;
    --thumb-bg: #1d1d1d; --ghost-bg: #181818;
    --edge-img: rgba(255, 255, 255, .07); --edge-img-hover: rgba(255, 255, 255, .6);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font);
       -webkit-font-smoothing: antialiased; }
body.locked { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.o-solved { --c: var(--o-solved); --t: var(--ot-solved); }
.o-cost-exhausted { --c: var(--o-cost); --t: var(--ot-cost); }
.o-budget-exhausted { --c: var(--o-budget); --t: var(--ot-budget); }
.o-timeout { --c: var(--o-timeout); --t: var(--ot-timeout); }
.o-gave-up { --c: var(--o-gaveup); --t: var(--ot-gaveup); }

.label { display: inline-block; flex-shrink: 0; padding: 2px 7px; border-radius: 2px;
         background: var(--c); color: var(--t); font-size: 11.5px; font-weight: 600;
         line-height: 1.35; white-space: nowrap; }

.top { max-width: var(--page); margin: 0 auto; padding: 52px var(--pad) 26px; text-align: center; }
.top h1 { margin: 0; font-size: 34px; font-weight: 600; line-height: 1.15; letter-spacing: -.02em; }
.intro { max-width: 680px; margin: 14px auto 0; font-size: 15px; line-height: 1.55;
         color: var(--ink); text-wrap: pretty; }
.intro p { margin: 0 0 8px; }
.key { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; margin-top: 22px;
       font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; }
.key > span { display: inline-flex; align-items: center; gap: 7px; }

.bar { position: sticky; top: 0; z-index: 10; background: var(--bg);
       border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.bar-inner { max-width: var(--page); margin: 0 auto; padding: 10px var(--pad);
             display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
             gap: 8px 20px; }
.bar label { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); }
.bar select { padding: 5px 8px; font-size: 13px; line-height: 1.3;
       color: var(--ink); background: var(--bg); border: 1px solid var(--rule-2); border-radius: 4px; }
.bar select:focus-visible, .reset:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 1px; }
.reset { padding: 0; border: 0; background: none; font-size: 13px; color: var(--ink);
         cursor: pointer; text-decoration: underline; text-decoration-color: var(--rule-2);
         text-underline-offset: 3px; }
.reset:hover { text-decoration-color: var(--ink); }

.matrix { --label-w: 180px; --gap: 14px; --min-col: 160px; max-width: var(--page);
          margin: 0 auto; padding: 0 var(--pad) 72px; }
.mhead, .mrow { display: grid; column-gap: var(--gap);
                grid-template-columns: var(--label-w) repeat(var(--models, 6), minmax(var(--min-col), 1fr));
                min-width: calc(var(--label-w) + var(--models, 6) * (var(--min-col) + var(--gap))); }
.mhead-wrap { position: sticky; top: var(--bar-h, 0px); z-index: 5; overflow-x: auto;
              overscroll-behavior-x: contain; background: var(--bg);
              border-bottom: 1px solid var(--rule-2); }
.mhead { align-items: end; padding: 16px 0 10px; }
.mbody { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
.mbody::-webkit-scrollbar { display: none; }
.mhead .corner, .glabel { position: sticky; left: 0; z-index: 2; align-self: stretch;
                          background: var(--bg); margin-right: calc(-1 * var(--gap));
                          padding-right: var(--gap); }
.mhead .corner { display: flex; align-items: flex-end; font-size: 12px; color: var(--ink); }
.mcol { min-width: 0; font-size: 13px; font-weight: 600; line-height: 1.3; white-space: nowrap;
        overflow: hidden; text-overflow: ellipsis; }
.mrow { align-items: start; padding: 16px 0 18px; border-bottom: 1px solid var(--rule); }
.glabel { min-width: 0; }
.glabel h2 { margin: 0; font-size: 14px; font-weight: 500; line-height: 1.3; }
.cell { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cell-model { display: none; }
.empty { padding: 72px 0; color: var(--ink); text-align: center; }

.card { display: block; min-width: 0; color: inherit; text-decoration: none; outline: none;
        scroll-margin-top: calc(var(--bar-h, 0px) + 90px);
        scroll-margin-left: calc(var(--label-w) + var(--gap)); }
.thumb { position: relative; display: block; aspect-ratio: var(--film); overflow: hidden;
         border-radius: 2px; background: var(--thumb-bg); }
.thumb img, .thumb video { position: absolute; inset: 0; display: block; width: 100%;
                           height: 100%; object-fit: cover; }
.thumb video { opacity: 0; transition: opacity .2s; }
.thumb video.on { opacity: 1; }
.thumb::after { content: ''; position: absolute; inset: 0; border-radius: inherit;
                box-shadow: inset 0 0 0 1px var(--edge-img); pointer-events: none;
                transition: box-shadow .12s; }
.card:hover .thumb::after { box-shadow: inset 0 0 0 1px var(--edge-img-hover); }
.card:focus-visible .thumb { outline: 2px solid var(--focus); outline-offset: 2px; }

.outcome { display: flex; align-items: center; justify-content: space-between; gap: 6px;
           height: 19px; margin-top: 3px; padding: 0 7px; overflow: hidden; border-radius: 2px;
           background: var(--c); color: var(--t); font-size: 11px; font-weight: 600;
           line-height: 1; white-space: nowrap; }
.outcome .d { font-weight: 400; font-variant-numeric: tabular-nums; }

.ghost .thumb { background: var(--ghost-bg); }
.ghost .thumb::after { box-shadow: none; }
.ghost .outcome { background: none; }

.player { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center;
          justify-content: center; padding: 20px; overflow-y: auto;
          background: rgba(10, 10, 10, .96); color: #fff; }
.p-panel { width: min(100%, 1680px, max(620px, calc((100vh - 280px) * 2.175))); margin: auto; }
.p-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px 20px;
          flex-wrap: wrap; margin-bottom: 12px; }
.p-titles { min-width: 0; }
.p-head h2 { margin: 0 0 4px; font-size: 17px; font-weight: 600; line-height: 1.3; color: #fff; }
.p-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 13px;
         color: #fff; font-variant-numeric: tabular-nums; }
.p-controls { display: flex; align-items: center; gap: 6px; }
.player button { padding: 7px 11px; border: 1px solid #3a3a3a; border-radius: 4px;
                 background: transparent; color: #fff; font-size: 13px; line-height: 1;
                 cursor: pointer; }
.player button:hover:not(:disabled) { border-color: #707070; }
.player button:disabled { visibility: hidden; }
.player button:focus-visible { outline: 2px solid #8fb4dc; outline-offset: 1px; }
.speed { display: inline-flex; margin-right: 8px; }
.speed button { border-radius: 0; margin-left: -1px; font-variant-numeric: tabular-nums; }
.speed button:first-child { border-radius: 4px 0 0 4px; margin-left: 0; }
.speed button:last-child { border-radius: 0 4px 4px 0; }
.speed button[aria-pressed=true] { position: relative; background: #fff; border-color: #fff;
                                   color: #000; }
#p-video { display: block; width: 100%; aspect-ratio: var(--film); background: #000;
           border-radius: 2px; }
.p-runs { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px 14px;
          margin-top: 14px; }
.p-model { min-width: 0; }
.p-model .mname { margin-bottom: 5px; font-size: 12px; color: #fff; white-space: nowrap;
                  overflow: hidden; text-overflow: ellipsis; }
.player .p-run { display: block; width: 100%; padding: 0; border: 0; border-radius: 0;
                 background: none; }
.p-run img { display: block; width: 100%; aspect-ratio: var(--film); object-fit: cover;
             border-radius: 2px; opacity: .6; transition: opacity .12s; }
.p-run:hover img, .p-run.current img { opacity: 1; }
.p-run.current img { outline: 1px solid #fff; outline-offset: 1px; }
.p-run .outcome { height: 3px; padding: 0; }
.p-keys { margin-top: 14px; font-size: 12px; color: #fff; text-align: center; }

@media (max-width: 1000px) { .p-runs { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

@media (max-width: 640px) {
  :root { --pad: 14px; }
  .top { padding-top: 32px; padding-bottom: 18px; }
  .top h1 { font-size: 26px; }
  .intro { font-size: 14px; }
  .bar-inner { padding: 8px var(--pad); gap: 8px 16px; }
  .matrix { padding-bottom: 50px; }
  .mhead-wrap { display: none; }
  .mbody { overflow: visible; }
  .mrow { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 8px; min-width: 0;
          padding: 0 0 22px; border-bottom: 0; }
  .glabel { grid-column: 1 / -1; position: sticky; top: var(--bar-h, 0px); z-index: 3;
            margin: 0; padding: 12px 0 8px; border-bottom: 1px solid var(--rule); }
  .glabel h2 { font-size: 15px; font-weight: 600; }
  .cell { gap: 4px; }
  .cell-model { display: block; font-size: 13px; font-weight: 500; }
  .cell.none { display: none; }
  .card { scroll-margin-left: 0; scroll-margin-top: calc(var(--bar-h, 0px) + 60px); }
  .player { padding: 10px; align-items: flex-start; }
  .p-runs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (hover: none) { .p-keys { display: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
