:root {
  color-scheme: dark;
  --bg: #10110f;
  --panel: #171915;
  --panel-2: #1d201b;
  --line: #30342c;
  --line-soft: #262922;
  --text: #f0f2e9;
  --muted: #969d8d;
  --acid: #d5ff52;
  --acid-dim: #65782e;
  --openai: #65d6a3;
  --anthropic: #eaa373;
  --minimax: #8eb8ff;
  --alibaba: #bb9cff;
  --moonshot: #ff8fbd;
  --source: #a6b7ff;
  --danger: #ff7f6f;
  --sidebar: 430px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { overflow: hidden; }
button, select, a { font: inherit; }
button, select { color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  grid-template-rows: 68px calc(100vh - 68px);
  min-height: 100vh;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  min-width: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 17, 15, .96);
  padding: 0 18px;
}

.brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.brand-home { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.brand-home strong { font-size: 15px; font-weight: 700; letter-spacing: .17em; white-space: nowrap; }
.brand-byline { display: flex; align-items: center; gap: 9px; padding-left: 16px; border-left: 1px solid var(--line); color: var(--muted); font-size: 11px; white-space: nowrap; }
.brand-byline a { color: var(--text); text-underline-offset: 3px; }
.brand-mark { display: grid; grid-template-columns: repeat(3, 5px); grid-template-rows: repeat(3, 5px); gap: 2px; transform: rotate(45deg); }
.brand-mark i { display: block; background: var(--acid); }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(4), .brand-mark i:nth-child(6), .brand-mark i:nth-child(8) { opacity: .32; }
.reference-toggle { margin-left: 12px; border: 1px solid var(--line); border-radius: 7px; background: #181a16; color: var(--muted); padding: 8px 11px; font-size: 10px; }
.reference-toggle:hover, .reference-toggle.active { border-color: #51594a; color: var(--text); }

.sidebar { grid-column: 1; grid-row: 2; display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--line); background: #121410; }
.catalog-header { position: relative; z-index: 3; display: grid; grid-template-columns: minmax(0, 1fr) 42px 58px 44px 46px; align-items: end; gap: 5px; padding: 10px 18px 4px; color: var(--muted); }
.catalog-sort-caption { visibility: hidden; }
.catalog-sort { position: relative; min-width: 0; border: 0; background: transparent; color: var(--muted); padding: 0; text-align: center; font: 700 9px/1.12 ui-monospace, monospace; letter-spacing: .03em; }
.sort-short { display: none; }
.catalog-sort::after { content: "↕"; margin-left: 2px; opacity: .35; }
.catalog-sort:hover { color: var(--text); }
.catalog-sort.active { color: var(--acid); }
.catalog-sort[data-direction="asc"]::after { content: "↑"; opacity: 1; }
.catalog-sort[data-direction="desc"]::after { content: "↓"; opacity: 1; }
.catalog-sort[data-tooltip]::before { position: absolute; top: calc(100% + 9px); left: 50%; width: 210px; transform: translateX(-50%) translateY(-2px); border: 1px solid #454b3f; border-radius: 7px; background: #20231d; color: var(--text); padding: 9px 10px; box-shadow: 0 10px 28px rgba(0, 0, 0, .42); content: attr(data-tooltip); font: 10px/1.45 Inter, ui-sans-serif, sans-serif; letter-spacing: 0; opacity: 0; pointer-events: none; text-align: left; transition: opacity .12s ease, transform .12s ease; }
.catalog-sort[data-tooltip]:hover::before, .catalog-sort[data-tooltip]:focus-visible::before { transform: translateX(-50%) translateY(0); opacity: 1; }

.catalog { flex: 1; min-height: 0; overflow: auto; padding: 9px 9px 68px; }
.mobile-picker { display: none; }
.about-arena-button { grid-column: 1; grid-row: 2; align-self: end; z-index: 4; display: flex; flex-direction: column; gap: 4px; width: calc(100% - 18px); margin: 0 9px 9px; border: 1px solid #3e4632; border-radius: 9px; background: #1c2019; color: var(--text); padding: 12px 10px; text-align: left; }
.about-arena-button:hover { border-color: #59644a; background: #22261d; }
.about-arena-button strong { font-size: 12px; }
.run-card {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px 58px 44px 46px;
  gap: 5px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  padding: 11px 9px;
  text-align: left;
}
.run-card:hover { background: var(--panel); border-color: var(--line-soft); }
.run-card.selected { background: #22261d; border-color: #3e4632; }
.run-copy { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.run-copy strong { overflow: hidden; color: var(--text); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.run-copy small { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.score-cell, .price-cell { display: grid; place-self: stretch; place-items: center; }
.score-cell > small, .price-cell > small { display: none; }
.score-dot { display: block; width: 9px; height: 9px; border-radius: 50%; background: #555b50; }
.score-dot.pass { background: #7fcf83; }
.score-dot.warn { background: #d5ad55; }
.score-dot.fail { background: #d16f69; }
.score-dot.unrated { border: 1px solid #555b50; background: transparent; }
.price-tag { color: #c8cdc0; font: 600 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; }

.about-dialog { width: min(920px, calc(100% - 32px)); max-width: none; height: min(88vh, 900px); max-height: none; margin: auto; border: 1px solid #464c40; border-radius: 14px; outline: 0; background: #11130f; color: var(--text); padding: 0; box-shadow: 0 28px 90px rgba(0, 0, 0, .72); }
.about-dialog::backdrop { background: rgba(5, 6, 5, .78); backdrop-filter: blur(4px) grayscale(.45); }
.about-dialog-card { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100%; }
.about-dialog-header { position: relative; border-bottom: 1px solid var(--line); padding: 28px 70px 24px; background: #171915; text-align: center; }
.about-dialog-header h1 { margin: 0; font-size: clamp(24px, 4vw, 38px); font-weight: 600; line-height: 1.1; letter-spacing: -.035em; }
.about-dialog-header p { margin: 12px 0 0; color: var(--muted); font: 16px/1.4 ui-monospace, monospace; }
.about-dialog-close { position: absolute; top: 22px; right: 24px; border: 1px solid var(--line); border-radius: 7px; background: #20231d; color: var(--muted); padding: 8px 10px; font-size: 10px; }
.about-dialog-close:hover { border-color: #596050; color: var(--text); }
.about-dialog-content { overflow: auto; padding: 28px 26px 44px; }
.about-dialog .landing-prompt { width: min(720px, 100%); margin: 0 auto; }
.about-section-title { width: 100%; margin: 0; color: var(--text); font-size: 28px; font-weight: 600; line-height: 1.15; letter-spacing: -.025em; }
.prompt-section-title { margin-bottom: 18px; }
.runner-notes { width: 100%; margin-top: 42px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.runner-notes .about-section-title, .pricing-notes .about-section-title, .judging-notes .about-section-title, .evaluation-notes .about-section-title { padding: 18px 0; border-bottom: 1px solid var(--line); }
.runner-notes p { display: grid; grid-template-columns: minmax(150px, .8fr) 1fr; gap: 16px; margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.runner-notes strong { color: var(--text); font-weight: 600; }
.pricing-notes { width: 100%; margin-top: 42px; border-top: 1px solid var(--line); }
.pricing-notes p { margin: 16px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.pricing-notes a { color: var(--text); text-underline-offset: 3px; }
.judging-notes { width: 100%; margin-top: 42px; border-top: 1px solid var(--line); }
.judging-notes > div { padding: 20px 0; border-bottom: 1px solid var(--line); }
.judging-notes h3 { margin: 0; color: var(--text); font-size: 15px; font-weight: 650; }
.judging-notes .judge-overview { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.judging-notes code { color: var(--acid); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.judge-ratings { display: grid; gap: 8px; margin: 15px 0 0; padding: 0; list-style: none; }
.judge-ratings li { position: relative; padding-left: 17px; color: var(--text); font-size: 12px; line-height: 1.5; }
.judge-ratings li::before { position: absolute; top: .48em; left: 0; width: 7px; height: 7px; border-radius: 50%; content: ""; }
.judge-ratings li.pass::before { background: #7fcf83; }
.judge-ratings li.warn::before { background: #d5ad55; }
.judge-ratings li.fail::before { background: #d16f69; }

.workspace { grid-column: 2; grid-row: 2; display: grid; grid-template-rows: minmax(0, 1fr); min-width: 0; min-height: 0; }

.comparison { display: grid; min-width: 0; min-height: 0; gap: 1px; background: var(--line); }
.comparison.split { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.comparison.solo { grid-template-columns: minmax(0, 1fr); }
.comparison.solo .preview-panel[data-side="b"] { display: none; }
.preview-panel { display: grid; grid-template-rows: minmax(0, 1fr); min-width: 0; min-height: 0; background: #0b0c0a; }
.preview-panel.reference-preview .viewport { background-color: #11181a; background-image: linear-gradient(#1d292c 1px, transparent 1px), linear-gradient(90deg, #1d292c 1px, transparent 1px); }
.viewport { position: relative; min-width: 0; min-height: 0; overflow: hidden; background-color: #11120f; background-image: linear-gradient(#1a1c17 1px, transparent 1px), linear-gradient(90deg, #1a1c17 1px, transparent 1px); background-size: 20px 20px; }
.canvas { position: absolute; inset: 0; overflow: auto; }
.canvas iframe { display: block; border: 0; background: #eee; }
.comparison.fit .canvas { overflow: hidden; }
.comparison.fit .canvas iframe { position: absolute; inset: 0 auto auto 0; width: 1454px; transform: scale(var(--preview-scale, .5)); transform-origin: top left; }
.loading-card { position: absolute; left: 50%; top: 50%; display: none; align-items: center; gap: 8px; transform: translate(-50%, -50%); border: 1px solid var(--line); border-radius: 8px; background: rgba(20,22,18,.95); color: var(--muted); padding: 10px 13px; font-size: 10px; }
.loading-card span { display: block; width: 7px; height: 7px; border-radius: 50%; background: #f6c85f; animation: pulse 1.3s infinite; }
.preview-panel.waiting .loading-card { display: flex; }

@keyframes pulse { 50% { opacity: .3; } }

.landing-page {
  min-height: 100vh;
  overflow: auto;
  background-color: var(--bg);
  background-image: linear-gradient(rgba(213, 255, 82, .025) 1px, transparent 1px), linear-gradient(90deg, rgba(213, 255, 82, .025) 1px, transparent 1px);
  background-size: 32px 32px;
}
.landing-header { display: flex; align-items: center; gap: 16px; width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 30px 0; border-bottom: 1px solid var(--line); }
.landing-main { width: min(920px, calc(100% - 48px)); margin: 0 auto; padding: clamp(64px, 10vh, 118px) 0 80px; }
.landing-main h1 { margin: 0 auto; text-align: center; font-size: min(46px, 6vw); font-weight: 600; line-height: 1.1; letter-spacing: -.035em; white-space: nowrap; }
.landing-lede { max-width: 760px; margin: 28px auto 0; color: #bec4b7; text-align: center; font-size: clamp(15px, 1.5vw, 18px); line-height: 1.55; }
.landing-actions { display: flex; align-items: flex-start; flex-direction: column; gap: 18px; margin-top: 44px; }
.enter-arena { display: flex; align-items: center; justify-content: space-between; width: min(360px, 100%); border: 1px solid var(--acid); background: var(--acid); color: #10110f; padding: 18px 20px; text-decoration: none; font-size: 14px; font-weight: 750; letter-spacing: .04em; }
.enter-arena b { font-size: 22px; line-height: 1; transition: transform .15s ease; }
.enter-arena:hover b { transform: translateX(5px); }
.method-link { color: var(--muted); font-size: 12px; text-underline-offset: 4px; }
.method-link:hover { color: var(--text); }
.landing-prompt { display: flex; align-items: flex-start; flex-direction: column; width: min(560px, 100%); margin: 42px auto 0; }
.landing-prompt video { display: block; width: 100%; border: 1px solid var(--line); background: #000; }
.landing-prompt-copy { width: 100%; margin-top: 16px; border: 1px solid var(--line); background: rgba(23, 25, 21, .94); padding: 22px 24px 24px; }
.landing-prompt-copy h2 { margin: 0; color: var(--acid); font: 700 10px/1 ui-monospace, monospace; letter-spacing: .16em; text-transform: uppercase; }
.landing-prompt-copy p { margin: 14px 0 0; color: var(--text); font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; }
.landing-prompt-copy code { color: var(--acid); }
.prompt-note { margin: 14px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.prompt-note a { color: var(--text); text-underline-offset: 3px; }
.evaluation-notes { width: 100%; margin-top: 42px; border-top: 1px solid var(--line); }
.evaluation-item { padding: 20px 0; border-bottom: 1px solid var(--line); }
.evaluation-item h3 { margin: 0; color: var(--text); font-size: 15px; font-weight: 650; }
.evaluation-item p { margin: 9px 0 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.evaluation-item code { color: var(--acid); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.landing-prompt .landing-actions { align-items: flex-end; width: 100%; margin-top: 32px; }
.landing-prompt .method-link { margin-top: 18px; }

@media (max-width: 900px) {
  :root { --sidebar: 340px; }
  .comparison.split { grid-template-columns: 1fr; grid-template-rows: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  html, body { width: 100%; height: 100%; overflow: hidden; }
  .app-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: 58px 56px minmax(0, 1fr) 52px; width: 100%; max-width: 100vw; height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
  .topbar { grid-column: 1; z-index: 10; padding-right: max(12px, env(safe-area-inset-right)); padding-left: max(12px, env(safe-area-inset-left)); }
  .topbar .brand-byline { display: none; }
  .landing-header .brand-byline { display: none; }
  .topbar .reference-toggle { display: none; }
  .brand { gap: 8px; }
  .brand-home { gap: 8px; }
  .brand-home strong { font-size: 11px; letter-spacing: .12em; }
  .brand-byline { display: flex; align-items: center; gap: 6px; padding-left: 8px; font-size: 9px; white-space: nowrap; }
  .sidebar { display: none; }
  .mobile-picker { grid-column: 1; grid-row: 2; display: flex; min-width: 0; padding: 6px 9px; border-bottom: 1px solid var(--line); background: #121410; }
  .mobile-model-trigger { display: grid; grid-template-columns: minmax(0, 1fr) auto 22px; align-items: center; gap: 10px; width: 100%; min-width: 0; border: 1px solid #3e4632; border-radius: 9px; background: #20241c; color: var(--text); padding: 7px 10px; text-align: left; }
  .mobile-model-trigger:hover, .mobile-model-trigger[aria-expanded="true"] { border-color: #657050; background: #262b21; }
  .mobile-model-trigger > span:first-child { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
  .mobile-model-trigger small { flex: none; color: var(--muted); font: 700 8px/1 ui-monospace, monospace; letter-spacing: .1em; text-transform: uppercase; }
  .mobile-model-trigger strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-model-effort { color: var(--muted); font: 10px/1 ui-monospace, monospace; }
  .mobile-model-chevron { color: var(--acid); font-size: 18px; line-height: 1; text-align: center; transform: translateY(-2px); }
  .mobile-model-dialog { width: min(520px, calc(100% - 16px)); max-width: none; height: min(78dvh, 720px); max-height: none; margin: auto; overflow: hidden; border: 1px solid #4a5142; border-radius: 13px; outline: 0; background: #121410; color: var(--text); padding: 0; box-shadow: 0 28px 90px rgba(0, 0, 0, .75); }
  .mobile-model-dialog::backdrop { background: rgba(4, 5, 4, .8); backdrop-filter: blur(4px) grayscale(.5); }
  .mobile-model-dialog[open] { display: grid; grid-template-rows: 52px auto minmax(0, 1fr); }
  .mobile-model-dialog > header { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 0 12px 0 16px; background: #1b1e19; }
  .mobile-model-dialog > header strong { font-size: 14px; }
  .mobile-model-dialog > header button { border: 1px solid var(--line); border-radius: 7px; background: #242820; color: var(--muted); padding: 7px 9px; font-size: 10px; }
  .mobile-catalog-header { display: grid; grid-template-columns: minmax(0, 1fr) 42px 58px 44px 46px; align-items: center; gap: 5px; padding: 9px 12px 7px; border-bottom: 1px solid var(--line-soft); }
  .catalog-sort-caption { visibility: visible; margin-right: auto; color: #737a6d; font: 700 8px/1 ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; }
  .catalog-sort { flex: none; border: 1px solid transparent; border-radius: 6px; padding: 5px 6px; font: 700 9px/1 ui-monospace, monospace; letter-spacing: 0; }
  .catalog-sort:hover, .catalog-sort.active { border-color: var(--line); background: #1b1e19; }
  .catalog-sort[data-tooltip]::before { display: none; }
  .sort-long { display: none; }
  .sort-short { display: inline; }
  .mobile-catalog { min-height: 0; overflow: auto; padding: 8px; overscroll-behavior: contain; }
  .mobile-catalog .run-card { grid-template-columns: minmax(0, 1fr) 42px 58px 44px 46px; gap: 5px; padding: 11px 9px; }
  .run-copy { gap: 3px; }
  .run-copy strong { font-size: 12px; }
  .run-copy small { font-size: 9px; }
  .about-arena-button { grid-column: 1; grid-row: 4; align-self: stretch; justify-content: center; width: auto; min-width: 0; margin: 6px 9px; padding: 8px 10px; text-align: center; }
  .about-arena-button strong { font-size: 11px; }
  .workspace { grid-column: 1; grid-row: 3; min-height: 0; }
  .comparison, .preview-panel, .viewport { min-height: 0; }
  .comparison.fit .canvas { overflow: hidden; }
  .comparison.fit .canvas iframe { max-width: none; }
  .landing-header { width: min(100% - 32px, 1180px); padding: 22px 0; }
  .landing-header { gap: 8px; }
  .landing-main { width: min(100% - 32px, 920px); padding: 58px 0 54px; }
  .landing-lede { margin-top: 24px; font-size: 15px; }
  .landing-actions { align-items: flex-start; flex-direction: column; gap: 20px; margin-top: 36px; }
  .landing-prompt { margin-top: 32px; }
  .landing-prompt-copy { padding: 18px; }
  .about-dialog { width: calc(100% - 16px); height: calc(100dvh - 16px); border-radius: 12px; }
  .about-dialog-header { padding: 54px 18px 20px; }
  .about-dialog-header h1 { font-size: clamp(22px, 7vw, 30px); }
  .about-dialog-header p { margin-top: 10px; font-size: 13px; }
  .about-dialog-close { top: 16px; right: 16px; }
  .about-dialog-content { padding: 20px 18px 36px; }
  .about-section-title { font-size: 24px; }
  .runner-notes p { grid-template-columns: 1fr; gap: 2px; }
}

@media (max-width: 340px) {
  .brand { gap: 5px; }
  .brand-home { gap: 6px; }
  .brand-home strong { font-size: 8px; }
  .brand-byline { gap: 4px; padding-left: 5px; font-size: 8px; }
  .mobile-catalog-header { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .mobile-catalog-header .catalog-sort-caption { display: none; }
  .mobile-catalog .run-card { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: auto auto; row-gap: 8px; }
  .mobile-catalog .run-copy { grid-column: 1 / -1; }
  .mobile-model-trigger > span:first-child { gap: 6px; }
}

@media (max-width: 820px) and (max-height: 500px) and (orientation: landscape) {
  .app-shell { grid-template-rows: 48px 46px minmax(0, 1fr) 44px; }
  .topbar { min-height: 48px; }
  .mobile-picker { padding-block: 4px; }
  .mobile-model-trigger { padding-block: 5px; }
  .mobile-model-dialog { width: min(600px, calc(100% - 16px)); height: calc(100dvh - 16px); }
  .about-arena-button { margin-block: 4px; padding-block: 6px; }
}
