:root {
  color-scheme: light;
  --paper: #f4f6f8;
  --white: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #d9dee7;
  --red: #ef3d2f;
  --blue: #1557ff;
  --yellow: #e8ff45;
  --green: #15855b;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-strong: #eef2f7;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-md: 0 12px 28px rgba(15, 23, 42, .08);
  --display: "Microsoft YaHei", "Microsoft YaHei UI", "Segoe UI Variable Display", "Segoe UI", "Noto Sans SC", sans-serif;
  --body: "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI Variable Text", "Segoe UI", "Noto Sans SC", sans-serif;
  --mono: "Consolas", "Cascadia Mono", "SFMono-Regular", "Liberation Mono", monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0f1219;
  --white: #171b24;
  --ink: #eef1f8;
  --muted: #a9afbd;
  --line: #2a3040;
  --red: #ff7a8d;
  --blue: #8b7cff;
  --yellow: rgba(139, 124, 255, .16);
  --green: #5be0ae;
  --surface: #171b24;
  --surface-soft: #1e2330;
  --surface-strong: #272d3a;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .26);
  --shadow-md: 0 18px 42px rgba(0, 0, 0, .34);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--paper); font-synthesis: none; text-rendering: auto; -webkit-font-smoothing: auto; -moz-osx-font-smoothing: auto; }
body { min-width: 320px; margin: 0; color: var(--ink); background: var(--paper); font-family: var(--body); font-synthesis: none; text-rendering: auto; -webkit-font-smoothing: auto; -moz-osx-font-smoothing: auto; }
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background-image: linear-gradient(rgba(15,23,42,.024) 1px, transparent 1px), linear-gradient(90deg, rgba(15,23,42,.024) 1px, transparent 1px); background-size: 56px 56px; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
button:disabled { cursor: wait; opacity: .55; }
h1, h2, p, figure { margin: 0; }

.topbar { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 24px; border-bottom: 1px solid rgba(15,23,42,.12); background: rgba(255,255,255,.98); position: sticky; top: 0; z-index: 20; font-family: var(--mono); font-size: 12px; font-weight: 700; box-shadow: 0 1px 0 rgba(15,23,42,.03); }
.wordmark { display: inline-flex; align-items: center; gap: 12px; }
.mark { min-width: 42px; height: 30px; display: grid; place-items: center; background: var(--ink); color: var(--white); font-size: 12px; }
.top-meta { display: flex; align-items: center; gap: 18px; }
.view-tabs, .admin-tabs { display: flex; align-items: center; gap: 0; border: 1px solid rgba(15,23,42,.14); background: var(--white); box-shadow: var(--shadow-sm); }
.view-tabs button, .admin-tabs button { min-height: 34px; padding: 0 13px; border: 0; border-right: 1px solid rgba(15,23,42,.14); background: transparent; font-family: var(--mono); font-size: 12px; font-weight: 700; }
.view-tabs button:last-child, .admin-tabs button:last-child { border-right: 0; }
.view-tabs button[aria-selected="true"], .admin-tabs button[aria-selected="true"] { background: var(--ink); color: var(--white); }
.phase { padding: 5px 8px; border: 1px solid rgba(15,23,42,.14); background: var(--yellow); color: var(--ink); box-shadow: var(--shadow-sm); }
.phase.ended { background: var(--red); color: #fff; }
.phase.upcoming { background: var(--blue); color: #fff; }

main { width: min(1240px, calc(100% - 48px)); margin: 0 auto; }
.contest-hero { min-height: 300px; display: grid; grid-template-columns: 76px 1fr 220px; align-items: stretch; border-left: 1px solid var(--ink); border-right: 1px solid var(--ink); }
.contest-index { padding: 22px 14px; border-right: 1px solid var(--ink); font-family: var(--mono); font-size: 12px; writing-mode: vertical-rl; }
.hero-copy { min-width: 0; display: flex; flex-direction: column; justify-content: center; padding: 34px 42px; }
.kicker, .section-label { font-family: var(--mono); font-size: 12px; font-weight: 700; }
.hero-copy h1 { max-width: 760px; margin-top: 16px; font-family: var(--display); font-size: 48px; line-height: 1.02; font-weight: 950; overflow-wrap: anywhere; }
.contest-clock { display: flex; align-items: baseline; gap: 12px; margin-top: 24px; }
.contest-clock span { font-family: var(--mono); font-size: 19px; font-weight: 700; }
.contest-clock small { color: var(--muted); font-size: 12px; }
.prize-block { display: flex; flex-direction: column; justify-content: space-between; padding: 24px; border-left: 1px solid var(--ink); background: var(--yellow); }
.prize-block small { font-family: var(--mono); font-size: 12px; font-weight: 700; }
.prize-block strong { font-family: var(--display); font-size: 23px; line-height: 1.15; overflow-wrap: anywhere; }

.prompt-band { display: grid; grid-template-columns: 150px 1fr 64px; align-items: start; min-height: 112px; padding: 22px 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.prompt-band .section-label { padding: 3px 20px 0 0; }
.prompt-band p { max-width: 960px; font-size: 15px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.icon-button { min-width: 44px; height: 40px; border: 1px solid var(--ink); border-radius: 0; background: transparent; font-family: var(--mono); font-size: 12px; font-weight: 700; }
.icon-button:hover { background: var(--ink); color: #fff; }

.workbench { display: grid; grid-template-columns: minmax(380px, .8fr) minmax(440px, 1.2fr); border-left: 1px solid var(--ink); border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); background: var(--white); }
.entry-panel, .result-panel { min-width: 0; padding: 34px; }
.entry-panel { border-right: 1px solid var(--ink); }
.panel-heading { display: flex; align-items: baseline; gap: 14px; margin-bottom: 30px; }
.panel-heading > span { color: var(--red); font-family: var(--mono); font-size: 12px; font-weight: 700; }
.panel-heading h1, .panel-heading h2 { font-family: var(--display); font-size: 28px; line-height: 1; }
.field { display: grid; gap: 8px; margin-bottom: 18px; }
.field > span { font-size: 12px; font-weight: 700; }
.field > span small { float: right; color: var(--muted); font-family: var(--mono); font-size: 12px; font-weight: 700; }
.field > small { margin-top: -2px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.field input, .field textarea, .field select { width: 100%; min-height: 48px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 0; background: #fff; color: var(--ink); }
.field textarea { resize: vertical; line-height: 1.6; }
.field input:hover, .field textarea:hover, .field select:hover { border-color: var(--ink); }
.prompt-adjustment-field { margin: 4px 0 24px; padding: 14px; border: 1px solid var(--ink); background: #f4f7ff; }
.prompt-adjustment-field textarea { min-height: 104px; border-color: var(--ink); }
.provider-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 22px; padding: 0; border: 0; }
.provider-switch legend { margin-bottom: 9px; font-size: 12px; font-weight: 700; }
.provider-switch label { min-width: 0; min-height: 64px; display: grid; grid-template-columns: 1fr auto; align-content: center; gap: 5px 10px; padding: 10px 12px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.provider-switch input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.provider-switch span { font-size: 12px; font-weight: 700; }
.provider-switch small { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.provider-switch label:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--yellow); }
.provider-switch label:has(input:focus-visible) { outline: 3px solid var(--blue); outline-offset: 2px; }
.key-loader { display: grid; grid-template-columns: minmax(0, 1fr) 92px; }
.key-loader input { min-width: 0; }
.key-loader button { border: 1px solid var(--ink); border-left: 0; background: var(--ink); color: #fff; font-family: var(--mono); font-size: 12px; font-weight: 700; }
.key-loader button:hover { background: var(--blue); }
.key-loader button:disabled { opacity: .55; }
.judge-divider { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 28px 0 18px; padding-top: 16px; border-top: 1px solid var(--ink); }
.judge-divider span { color: var(--blue); font-family: var(--mono); font-size: 12px; font-weight: 700; }
.judge-divider p { color: var(--muted); font-size: 12px; text-align: right; }
.save-warning { margin: 26px 0 18px; padding: 18px; border: 2px solid var(--red); background: #fff4f1; }
.save-warning strong { font-size: 15px; }
.save-warning p { margin-top: 8px; color: #5d342f; font-size: 12px; line-height: 1.7; }
.checkline { display: flex; align-items: flex-start; gap: 10px; margin-top: 14px; font-size: 12px; line-height: 1.55; cursor: pointer; }
.checkline input { width: 17px; height: 17px; flex: 0 0 auto; accent-color: var(--blue); }
.admin-toggle { margin: 4px 0 20px; padding: 15px; border: 1px solid var(--ink); background: #f8ffbd; }
.admin-toggle span { display: grid; gap: 4px; }
.admin-toggle small { color: var(--muted); font-size: 12px; }
.primary-command { width: 100%; min-height: 54px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; border: 1px solid var(--ink); border-radius: 0; background: var(--ink); color: #fff; font-weight: 700; }
.primary-command b { color: var(--yellow); font-family: var(--mono); font-size: 12px; }
.primary-command:hover { background: var(--blue); border-color: var(--blue); }
.key-note { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 13px; color: var(--muted); font-family: var(--mono); font-size: 12px; line-height: 1.6; }
.key-note button { flex: 0 0 auto; padding: 4px 0; border: 0; border-bottom: 1px solid var(--ink); background: transparent; color: var(--ink); font-family: var(--mono); font-size: 12px; font-weight: 700; }

.result-panel { min-height: 640px; position: relative; background: #ebeae2; }
.result-panel.is-empty { background: var(--blue); color: #fff; }
.result-empty { min-height: 490px; display: grid; place-content: center; gap: 8px; text-align: center; }
.result-empty b { font-family: var(--display); font-size: 44px; }
.result-empty span { color: rgba(255,255,255,.7); font-size: 12px; }
.generated-frame { width: 100%; min-height: 360px; display: grid; place-items: center; border: 1px solid var(--ink); background: #191917; overflow: hidden; }
.generated-frame img { display: block; width: 100%; max-height: 620px; object-fit: contain; }
.result-actions { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 14px; }
.download-command { min-height: 42px; display: inline-flex; align-items: center; padding: 0 14px; background: var(--yellow); border: 1px solid var(--ink); font-family: var(--mono); font-size: 12px; font-weight: 700; cursor: pointer; }
.result-actions span { color: var(--muted); font-size: 12px; }
.score-result { display: grid; grid-template-columns: repeat(5, 1fr); margin-top: 24px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.score-pending { grid-column: 1 / -1; min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px; background: var(--yellow); }
.score-pending strong { font-family: var(--display); font-size: 22px; }
.score-pending span { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.score-item { min-width: 0; padding: 14px 10px; border-right: 1px solid var(--line); }
.score-item:last-child { border-right: 0; }
.score-item small { display: block; min-height: 30px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.score-item strong { display: block; margin-top: 6px; font-family: var(--display); font-size: 26px; }
.score-total { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding: 16px; border-top: 1px solid var(--ink); background: var(--ink); color: #fff; }
.score-total strong { color: var(--yellow); font-family: var(--display); font-size: 38px; }
.judge-comment { grid-column: 1 / -1; padding: 16px; border-top: 1px solid var(--line); font-size: 12px; line-height: 1.7; }
.retry-form { display: grid; gap: 12px; margin-top: 20px; padding: 16px; border: 1px solid var(--red); background: #fff; }
.retry-heading { display: grid; gap: 4px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.retry-heading span, .retry-form label > span, .retry-form label > small { color: var(--muted); font-size: 12px; line-height: 1.5; }
.retry-form label { display: grid; gap: 6px; }
.retry-form input, .retry-form select, .retry-form button, .review-form input, .review-form button { min-height: 44px; padding: 10px; border: 1px solid var(--ink); background: #fff; }
.retry-form .key-loader input, .retry-form .key-loader button { min-width: 0; }
.retry-form button, .review-form button { background: var(--ink); color: #fff; font-weight: 700; }
.submission-quota { margin-top: 10px; color: var(--muted); font-family: var(--mono); font-size: 12px; line-height: 1.6; }
.submission-quota.exhausted { color: var(--red); font-weight: 700; }

.request-status { min-height: 124px; display: grid; grid-template-columns: 180px minmax(0, 1fr) minmax(280px, .6fr); align-items: stretch; border: 1px solid var(--ink); border-top: 0; background: var(--white); }
.request-status-label, .request-status-copy, .request-status-meta { min-width: 0; padding: 22px 24px; }
.request-status-label { display: flex; flex-direction: column; justify-content: space-between; border-right: 1px solid var(--ink); font-family: var(--mono); font-size: 12px; }
.request-status-label strong { width: fit-content; padding: 5px 8px; border: 1px solid var(--ink); font-size: 12px; }
.request-status-copy { align-self: center; }
.request-status-copy h2 { font-family: var(--display); font-size: 25px; }
.request-status-copy p { margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.request-status-meta { display: grid; align-content: center; gap: 12px; border-left: 1px solid var(--ink); }
.request-status-meta div { display: grid; grid-template-columns: 68px minmax(0, 1fr); gap: 10px; }
.request-status-meta dt { color: var(--muted); font-size: 12px; }
.request-status-meta dd { margin: 0; font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.request-status.running .request-status-label strong { background: var(--yellow); }
.request-status.success .request-status-label strong { background: #dff7e9; color: var(--green); }
.request-status.error { border-color: var(--red); background: #fff4f1; }
.request-status.error .request-status-label { border-color: var(--red); }
.request-status.error .request-status-label strong { border-color: var(--red); background: var(--red); color: #fff; }

.review-band { display: grid; grid-template-columns: 150px 1fr minmax(330px, .8fr); gap: 0; border: 1px solid var(--ink); border-top: 0; background: var(--yellow); }
.review-rank { display: grid; place-content: center; text-align: center; border-right: 1px solid var(--ink); }
.review-rank span { font-family: var(--mono); font-size: 12px; }
.review-rank strong { font-family: var(--display); font-size: 64px; }
.review-copy { align-self: center; padding: 30px; }
.review-copy small { font-family: var(--mono); font-size: 12px; }
.review-copy h2 { margin-top: 10px; font-family: var(--display); font-size: 28px; }
.review-copy p { margin-top: 8px; font-size: 12px; }
.review-form { display: grid; align-content: center; gap: 10px; padding: 24px; border-left: 1px solid var(--ink); background: var(--white); }

.leaderboard-section { min-height: calc(100vh - 66px); padding: 54px 0 90px; }
.leaderboard-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.leaderboard-head h2 { margin-top: 10px; font-family: var(--display); font-size: 48px; }
.leaderboard-head p { margin-top: 8px; color: var(--muted); font-family: var(--mono); font-size: 12px; }
.review-head-actions { display: flex; align-items: center; gap: 12px; }
.review-head-actions > span { font-size: 13px; font-weight: 700; }
.icon-button .refresh-icon { width: 20px; height: 20px; display: inline-grid; place-items: center; font-size: 18px; line-height: 1; }
.icon-button.is-loading:disabled { background: var(--yellow); color: var(--ink); cursor: wait; opacity: 1; }
.icon-button.is-loading .refresh-icon { animation: refresh-spin 700ms linear infinite; }
@keyframes refresh-spin { to { transform: rotate(360deg); } }
.ranking-rules { margin-bottom: 16px; border: 1px solid var(--ink); background: var(--white); }
.ranking-rules summary { min-height: 44px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; list-style: none; cursor: pointer; font-size: 12px; font-weight: 700; }
.ranking-rules summary::-webkit-details-marker { display: none; }
.ranking-rules summary::after { content: "+"; font-family: var(--mono); font-size: 18px; }
.ranking-rules[open] summary::after { content: "-"; }
.ranking-rules div { display: grid; gap: 7px; padding: 14px; border-top: 1px solid var(--ink); }
.ranking-rules p { color: var(--muted); font-size: 12px; line-height: 1.7; }
.podium { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--ink); background: var(--white); }
.podium-entry { min-width: 0; min-height: 280px; display: flex; flex-direction: column; padding: 24px; border-right: 1px solid var(--ink); position: relative; }
.podium-entry:last-child { border-right: 0; }
.podium-entry:first-child { background: var(--yellow); }
.podium-rank { font-family: var(--display); font-size: 72px; line-height: .8; }
.podium-entry h3 { margin: auto 0 0; font-size: 18px; overflow-wrap: anywhere; }
.podium-entry code { margin-top: 6px; color: var(--muted); font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.podium-score { margin-top: 18px; font-family: var(--display); font-size: 42px; }
.podium-image { width: 100%; aspect-ratio: 1; margin-bottom: 18px; object-fit: cover; border: 1px solid var(--ink); }
.ranking-list { border-top: 1px solid var(--ink); }
.ranking-head, .ranking-row { display: grid; grid-template-columns: 70px minmax(180px, 1fr) minmax(220px, .7fr) 90px; align-items: center; gap: 18px; }
.ranking-head { min-height: 38px; padding: 0 14px; border: 1px solid var(--ink); border-bottom: 0; background: var(--ink); color: #fff; font-family: var(--mono); font-size: 12px; }
.ranking-head span:last-child { text-align: right; }
.ranking-row { min-height: 52px; padding: 0 14px; border-bottom: 1px solid var(--line); background: var(--white); }
.ranking-row.top-rank { background: #f8ffbd; }
.ranking-row.top-rank:first-child { background: var(--yellow); }
.ranking-row .rank { font-family: var(--mono); font-size: 12px; }
.ranking-row .name { font-weight: 700; }
.ranking-row code { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.ranking-row .points { font-family: var(--display); font-size: 28px; text-align: right; }
.ranking-row .points.is-hidden { color: var(--muted); font-family: var(--mono); font-size: 12px; font-weight: 700; }
.ranking-row .points:not(:is(:empty)) { overflow-wrap: anywhere; }
.ranking-prompt-details { grid-column: 1 / -1; width: 100%; margin: -2px 0 10px; border-top: 1px dashed var(--line); }
.ranking-prompt-details summary { width: fit-content; padding: 8px 0 0; color: var(--blue); font-family: var(--mono); font-size: 12px; font-weight: 700; cursor: pointer; }
.ranking-prompt-details > div { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 10px 0 2px; }
.ranking-prompt-details p { color: var(--muted); font-size: 12px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.ranking-prompt-details b, .local-prompts b { display: block; margin-bottom: 4px; color: var(--ink); font-size: 12px; }
.board-empty { padding: 58px 0; border-top: 1px solid var(--ink); color: var(--muted); font-family: var(--mono); font-size: 12px; }
.local-history-note { max-width: 760px; margin: -12px 0 28px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.local-submission-list { border-top: 1px solid var(--ink); }
.local-submission-card { display: grid; grid-template-columns: minmax(220px, 320px) minmax(0, 1fr); gap: 0; border-bottom: 1px solid var(--ink); background: var(--white); }
.local-submission-card > img { display: block; width: 100%; height: 100%; min-height: 280px; aspect-ratio: 1; border-right: 1px solid var(--ink); object-fit: cover; }
.local-submission-detail { min-width: 0; display: flex; flex-direction: column; padding: 24px; }
.local-submission-detail > small { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.local-submission-detail h3 { margin-top: 8px; font-family: var(--display); font-size: 28px; }
.local-prompts { display: grid; gap: 8px; margin-top: 10px; }
.local-prompts p { color: var(--muted); font-size: 12px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.local-model { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 18px; }
.local-model code, .local-submission-id code { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.local-submission-id { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 10px; margin-top: 8px; color: var(--muted); font-size: 12px; }
.local-score { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 18px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 12px; }
.local-score strong { color: var(--red); font-family: var(--display); font-size: 28px; }
.local-score-pending { color: var(--red); font-weight: 700; }
.local-submission-detail blockquote { margin: 14px 0 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.local-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 20px; }
.local-submission-detail .download-command { width: fit-content; padding: 0 14px; }
.share-command { min-height: 42px; padding: 0 14px; border: 1px solid var(--ink); background: var(--ink); color: #fff; font-family: var(--mono); font-size: 12px; font-weight: 700; cursor: pointer; }
.share-command:hover:not(:disabled) { background: var(--red); border-color: var(--red); }
.share-command:disabled { opacity: .35; cursor: not-allowed; }
.retry-command { min-height: 42px; padding: 0 14px; border: 1px solid var(--red); background: #fff4f1; color: var(--red); font-family: var(--mono); font-size: 12px; font-weight: 700; cursor: pointer; }
.retry-command:hover { background: var(--red); color: #fff; }
.share-card-dialog { width: min(980px, calc(100% - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--ink); background: var(--paper); color: var(--ink); }
.share-card-dialog::backdrop { background: rgba(17,17,15,.82); }
.share-card-dialog[open] { display: grid; grid-template-columns: minmax(300px, 540px) minmax(280px, 1fr); }
.share-card-preview { min-height: 0; display: grid; place-items: center; padding: 20px; border-right: 1px solid var(--ink); background: #1a1a18; }
.share-card-preview img { display: block; width: auto; max-width: 100%; max-height: calc(100vh - 74px); aspect-ratio: 4 / 5; object-fit: contain; }
.share-card-controls { align-self: center; padding: 30px; }
.share-card-controls h2 { margin-top: 10px; font-family: var(--display); font-size: 30px; line-height: 1.15; }
.share-card-controls p { margin-top: 14px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.share-card-controls > div { display: grid; gap: 8px; margin-top: 26px; }
.share-card-controls button { min-height: 44px; padding: 0 14px; border: 1px solid var(--ink); background: var(--white); font-size: 12px; font-weight: 700; cursor: pointer; }
.share-card-controls button:first-child { background: var(--yellow); }
.share-card-controls button:nth-child(2) { background: var(--ink); color: #fff; }

.archive-section { min-height: calc(100vh - 66px); padding: 54px 0 120px; }
.award-lookup { display: grid; grid-template-columns: minmax(280px, .75fr) minmax(360px, 1fr); gap: 32px 56px; margin-bottom: 64px; padding: 28px; border: 1px solid var(--ink); background: var(--white); }
.award-lookup h2 { margin-top: 8px; font-family: var(--display); font-size: 32px; }
.award-lookup p { margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.award-lookup form { display: flex; align-items: center; justify-content: flex-end; align-self: center; justify-self: end; gap: 0; }
.award-lookup input, .award-lookup button { width: auto; min-height: 42px; padding: 0 14px; border: 1px solid var(--ink); background: #fff; }
.award-lookup button { width: auto; border-left: 0; background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; white-space: nowrap; }
.award-results { grid-column: 1 / -1; display: grid; gap: 8px; padding-top: 20px; border-top: 1px solid var(--ink); }
.award-record { min-height: 76px; display: grid; grid-template-columns: minmax(220px, 1fr) 70px 120px; align-items: center; gap: 20px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.award-record:last-child { border-bottom: 0; }
.award-record h3 { margin: 4px 0 0; font-size: 14px; }
.award-record p, .award-record small { color: var(--muted); font-size: 12px; }
.award-record > strong { font-family: var(--display); font-size: 34px; }
.award-record > div:nth-child(3) { display: grid; gap: 5px; text-align: right; }
.award-record > div:nth-child(3) span { font-family: var(--mono); font-size: 12px; font-weight: 700; }
.award-record .award-reward { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(170px, .55fr) minmax(280px, 1fr); align-items: center; gap: 12px 24px; margin-top: 10px; padding: 16px; border: 1px solid var(--ink); background: #f8ffbd; text-align: left; }
.award-reward > div:first-child { display: grid; gap: 4px; }
.award-reward > div:first-child span { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.award-reward > div:first-child strong { font-size: 12px; }
.award-reward.locked { grid-template-columns: 1fr; background: var(--paper); color: var(--muted); }
.award-reward.locked p { margin: 4px 0 0; }
.award-reward.used, .award-reward.expired, .award-reward.missing { background: #fff0ed; }
.award-code { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.award-code code, .award-code button { min-height: 42px; display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--ink); background: #fff; }
.award-code code { overflow-x: auto; font-family: var(--mono); font-size: 12px; font-weight: 700; white-space: nowrap; }
.award-code button { border-left: 0; background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; cursor: pointer; }
.award-reward > p { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.award-empty { padding: 18px 0; color: var(--muted); font-size: 12px; }
.archive-heading { display: grid; grid-template-columns: 160px 1fr; align-items: end; margin-bottom: 34px; }
.archive-heading h2 { font-family: var(--display); font-size: 48px; }
.archive-list { display: grid; gap: 56px; }
.archive-edition { border-top: 1px solid var(--ink); }
.archive-edition > header { min-height: 98px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.archive-edition > header small, .archive-edition > header > span { font-family: var(--mono); font-size: 12px; }
.archive-edition > header h3 { margin: 6px 0 0; font-family: var(--display); font-size: 28px; }
.archive-winners { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.archive-work { min-width: 0; background: var(--white); border: 1px solid var(--ink); }
.archive-work img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.archive-work figcaption { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border-top: 1px solid var(--ink); }
.archive-work figcaption strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.archive-work figcaption span { flex: 0 0 auto; font-family: var(--mono); font-size: 12px; }
.pagination { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.pagination button, .pagination input { min-height: 36px; border: 1px solid var(--ink); background: var(--white); font-family: var(--mono); font-size: 12px; }
.pagination button { padding: 0 12px; cursor: pointer; }
.pagination button:hover:not(:disabled) { background: var(--ink); color: #fff; }
.pagination button:disabled { opacity: .35; cursor: not-allowed; }
.pagination span, .pagination label { font-family: var(--mono); font-size: 12px; }
.pagination input { width: 58px; margin-left: 5px; padding: 0 7px; }
.pagination.compact { margin-top: 18px; }

.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  z-index: 120;
  width: max-content;
  max-width: min(440px, calc(100% - 40px));
  padding: 14px 18px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, calc(-50% + 10px));
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, -50%); }
.toast.error { background: var(--red); }

/* Admin */
.admin-main { padding: 42px 0 100px; }
.admin-auth { max-width: 520px; display: grid; grid-template-columns: 1fr 190px; gap: 10px; align-items: end; margin-bottom: 44px; }
.admin-auth .field { margin: 0; }
.admin-tabs { width: fit-content; margin-bottom: 22px; }
.admin-tabs button { min-height: 42px; padding: 0 20px; }
.dashboard-admin { min-height: 620px; padding-top: 18px; }
.ranking-admin { min-height: 620px; padding-top: 18px; }
.dashboard-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 420px) 48px; align-items: end; gap: 12px; margin-bottom: 22px; }
.dashboard-toolbar h2 { margin-top: 8px; font-family: var(--display); font-size: 42px; }
.dashboard-toolbar p { margin-top: 6px; color: var(--muted); font-size: 12px; }
.ranking-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--ink); border-bottom: 0; background: var(--yellow); }
.ranking-summary > span { min-height: 82px; display: flex; flex-direction: column; justify-content: center; padding: 14px 18px; border-right: 1px solid var(--ink); }
.ranking-summary > span:last-child { border-right: 0; }
.ranking-summary small { font-family: var(--mono); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.ranking-summary strong { margin-top: 5px; font-family: var(--display); font-size: 30px; line-height: 1; }
.ranking-table-wrap { overflow-x: auto; border: 1px solid var(--ink); background: var(--white); }
.ranking-table { width: 100%; min-width: 1180px; border-collapse: collapse; table-layout: fixed; }
.ranking-table th { height: 42px; padding: 0 12px; background: var(--ink); color: #fff; font-family: var(--mono); font-size: 12px; text-align: left; }
.ranking-table th:nth-child(1) { width: 70px; }
.ranking-table th:nth-child(2) { width: 210px; }
.ranking-table th:nth-child(3) { width: 90px; }
.ranking-table th:nth-child(4) { width: 260px; }
.ranking-table th:nth-child(5) { width: 190px; }
.ranking-table th:nth-child(6) { width: 150px; }
.ranking-table th:nth-child(7) { width: 170px; }
.ranking-table th:nth-child(8) { width: 90px; }
.ranking-table td { min-height: 78px; padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 12px; overflow-wrap: anywhere; }
.ranking-table tr:last-child td { border-bottom: 0; }
.ranking-table td > strong, .ranking-table td > small, .ranking-table td > code { display: block; }
.ranking-table td > small { margin-top: 5px; color: var(--muted); font-family: var(--mono); font-size: 12px; }
.ranking-table td > code { margin-top: 5px; font-size: 12px; }
.ranking-winner { background: #fff9d8; }
.rank-number { font-family: var(--display); font-size: 24px; font-weight: 700; }
.ranking-score { font-family: var(--display); font-size: 28px; line-height: 1; }
.score-detail { display: block; font-family: var(--mono); font-size: 12px; font-weight: 700; }
.winner-mark, .ranking-normal { display: inline-flex; min-height: 25px; align-items: center; padding: 0 7px; border: 1px solid var(--ink); font-family: var(--mono); font-size: 12px; font-weight: 700; }
.winner-mark { background: var(--yellow); }
.ranking-normal { border-color: var(--line); color: var(--muted); }
.dashboard-toolbar label { display: grid; gap: 7px; }
.dashboard-toolbar label span { font-size: 12px; font-weight: 700; }
.dashboard-toolbar select { width: 100%; min-height: 48px; padding: 0 12px; border: 1px solid var(--ink); background: var(--white); }
.dashboard-toolbar .icon-button { min-height: 48px; }
.dashboard-content { min-width: 0; display: grid; gap: 22px; }
.dashboard-kpis { display: grid; grid-template-columns: repeat(5, 1fr); border: 1px solid var(--ink); background: var(--white); }
.dashboard-kpis article { min-width: 0; min-height: 154px; display: flex; flex-direction: column; padding: 18px; border-right: 1px solid var(--ink); }
.dashboard-kpis article:last-child { border-right: 0; }
.dashboard-kpis small { font-size: 12px; font-weight: 700; }
.dashboard-kpis strong { margin-top: auto; font-family: var(--display); font-size: 48px; line-height: 1; }
.dashboard-kpis span { margin-top: 8px; color: var(--muted); font-family: var(--mono); font-size: 12px; }
.provider-dashboard, .model-dashboard { min-width: 0; border: 1px solid var(--ink); background: var(--white); }
.model-dashboard { overflow: hidden; }
.provider-dashboard > header, .model-dashboard > header { min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 20px; border-bottom: 1px solid var(--ink); }
.provider-dashboard h3, .model-dashboard h3 { margin-top: 5px; font-family: var(--display); font-size: 28px; }
.provider-dashboard > header > span, .model-dashboard > header > span { font-family: var(--mono); font-size: 12px; }
.provider-rows { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.provider-rows > div { min-height: 112px; display: grid; grid-template-columns: minmax(0, 1fr) 42px; align-content: center; gap: 12px 14px; padding: 16px 20px; border-right: 1px solid var(--line); }
.provider-rows > div:last-child { border-right: 0; }
.provider-rows header { grid-column: 1 / -1; display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.provider-rows i { width: 10px; height: 10px; }
.provider-rows i.openai { background: var(--ink); }
.provider-rows i.gemini { background: var(--green); }
.provider-rows i.other { background: var(--yellow); }
.provider-rows strong { font-size: 12px; }
.provider-rows span { color: var(--muted); font-family: var(--mono); font-size: 12px; text-align: right; }
.provider-rows b { font-family: var(--display); font-size: 22px; text-align: right; }
.provider-rows progress, .model-usage-track { width: 100%; height: 12px; border: 1px solid var(--ink); border-radius: 0; background: var(--paper); appearance: none; }
.provider-rows progress::-webkit-progress-bar, .model-usage-track::-webkit-progress-bar { background: var(--paper); }
.provider-rows progress::-webkit-progress-value, .model-usage-track::-webkit-progress-value { background: var(--yellow); }
.provider-rows progress::-moz-progress-bar, .model-usage-track::-moz-progress-bar { background: var(--yellow); }
.provider-rows progress.openai::-webkit-progress-value, .model-usage-track.openai::-webkit-progress-value { background: var(--ink); }
.provider-rows progress.openai::-moz-progress-bar, .model-usage-track.openai::-moz-progress-bar { background: var(--ink); }
.provider-rows progress.gemini::-webkit-progress-value, .model-usage-track.gemini::-webkit-progress-value { background: var(--green); }
.provider-rows progress.gemini::-moz-progress-bar, .model-usage-track.gemini::-moz-progress-bar { background: var(--green); }
.model-usage-head, .model-usage-row { min-width: 960px; display: grid; grid-template-columns: 54px minmax(240px, 1.2fr) minmax(220px, 1fr) 86px 86px 86px; align-items: center; gap: 16px; padding: 0 18px; }
.model-usage-table { width: 100%; max-width: 100%; overflow-x: auto; }
.model-usage-head { min-height: 38px; background: var(--ink); color: #fff; font-family: var(--mono); font-size: 12px; }
.model-usage-row { min-height: 72px; border-bottom: 1px solid var(--line); }
.model-usage-row:last-child { border-bottom: 0; }
.model-usage-row > strong { font-family: var(--display); font-size: 24px; }
.model-usage-row > div:first-of-type { min-width: 0; display: grid; gap: 4px; }
.model-usage-row small { color: var(--muted); font-size: 12px; }
.model-usage-row code { overflow: hidden; font-size: 12px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.model-usage-row > span { font-family: var(--mono); font-size: 12px; }
.model-usage-row > b { font-family: var(--display); font-size: 26px; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, .65fr); border: 1px solid var(--ink); background: var(--white); }
.contest-editor, .contest-history { padding: 30px; }
.contest-editor { border-right: 1px solid var(--ink); }
.contest-form-heading { grid-template-columns: auto 1fr auto; }
.contest-form-heading button { min-height: 34px; padding: 0 12px; border: 1px solid var(--ink); background: transparent; font-size: 12px; font-weight: 700; cursor: pointer; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.reward-config { margin: 24px 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.reward-config > header { display: grid; grid-template-columns: minmax(180px, .55fr) minmax(260px, 1fr); align-items: end; gap: 24px; padding: 18px 0; }
.reward-config h2 { margin-top: 5px; font-family: var(--display); font-size: 22px; }
.reward-config header p { color: var(--muted); font-size: 12px; line-height: 1.6; }
.reward-config-tools { display: grid; gap: 10px; }
.reward-config-tools > div { display: flex; align-items: center; gap: 8px; }
.reward-config-tools button { width: 34px; height: 30px; border: 1px solid var(--ink); background: var(--white); font-family: var(--mono); font-size: 18px; font-weight: 700; }
.reward-config-tools button:hover:not(:disabled) { background: var(--ink); color: var(--white); }
.reward-config-tools button:disabled { cursor: not-allowed; }
.reward-config-tools span { min-width: 48px; font-family: var(--mono); font-size: 12px; font-weight: 700; text-align: center; }
.reward-fields { border-top: 1px solid var(--line); }
.reward-field-row { display: grid; grid-template-columns: 74px minmax(220px, 1fr) minmax(190px, .8fr); align-items: center; gap: 14px; min-height: 94px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.reward-field-row:last-child { border-bottom: 0; }
.reward-rank { display: grid; gap: 2px; }
.reward-rank strong { font-family: var(--display); font-size: 27px; }
.reward-rank span, .reward-field-row label > span { color: var(--muted); font-size: 12px; }
.reward-field-row label { display: grid; gap: 6px; }
.reward-field-row input { width: 100%; min-height: 42px; padding: 0 10px; border: 1px solid var(--ink); background: #fff; font-family: var(--mono); font-size: 12px; }
.reward-status { min-width: 0; display: grid; gap: 6px; justify-items: start; }
.reward-status small { color: var(--muted); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.reward-state { display: inline-flex; min-height: 25px; align-items: center; padding: 0 7px; border: 1px solid var(--line); font-family: var(--mono); font-size: 12px; font-weight: 700; }
.reward-state.unused { border-color: var(--green); background: #dff7e9; color: var(--green); }
.reward-state.used, .reward-state.expired, .reward-state.missing { border-color: var(--red); background: #fff0ed; color: var(--red); }
.prompt-details { margin-top: 8px; }
.prompt-details summary { color: var(--blue); font-size: 12px; font-weight: 700; cursor: pointer; }
.prompt-details b { display: block; margin-top: 7px; font-size: 12px; }
.prompt-details p { max-width: 340px; margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.contest-history-item { padding: 16px 8px; border-bottom: 1px solid var(--line); cursor: pointer; }
.contest-history-item:hover, .contest-history-item:focus-visible { background: var(--paper); outline: 1px solid var(--ink); outline-offset: -1px; }
.contest-history-item strong { display: block; }
.contest-history-item small { display: block; margin-top: 6px; color: var(--muted); font-family: var(--mono); font-size: 12px; }
.history-actions { display: flex; gap: 8px; margin-top: 12px; }
.history-actions button, .submission-actions button { min-height: 34px; padding: 0 10px; border: 1px solid var(--ink); background: transparent; font-size: 12px; font-weight: 700; }
.history-actions button:hover, .submission-actions button:hover { background: var(--ink); color: #fff; }
.history-actions .danger-command { border-color: var(--red); color: var(--red); }
.history-actions .danger-command:hover { background: var(--red); color: #fff; }
.review-public-toggle { min-height: 34px; display: inline-flex; align-items: center; gap: 6px; padding: 0 8px; border: 1px solid var(--ink); background: #fff; font-size: 12px; font-weight: 700; cursor: pointer; }
.review-public-toggle input { width: 14px; height: 14px; margin: 0; accent-color: var(--green); }
.submission-admin { min-height: 620px; margin-top: 0; padding-top: 18px; }
.allowance-form { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(220px, .8fr) 90px 110px; align-items: center; gap: 10px; padding: 16px; border: 1px solid var(--ink); background: var(--white); }
.allowance-form > div { display: grid; gap: 4px; }
.allowance-form small { color: var(--muted); font-size: 12px; }
.allowance-form input, .allowance-form button { min-height: 42px; padding: 0 11px; border: 1px solid var(--ink); background: #fff; }
.allowance-form button { background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; cursor: pointer; }
.allowance-list { border: 1px solid var(--ink); border-top: 0; }
.allowance-empty { padding: 14px 16px; color: var(--muted); font-size: 12px; }
.allowance-row { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.allowance-row:last-child { border-bottom: 0; }
.allowance-row div { min-width: 0; }
.allowance-row strong, .allowance-row small { display: block; overflow-wrap: anywhere; }
.allowance-row small { margin-top: 4px; color: var(--muted); font-family: var(--mono); font-size: 12px; }
.allowance-row > span { flex: 0 0 auto; font-family: var(--display); font-size: 24px; }
.admin-submissions-wrap { overflow-x: auto; margin-top: 18px; border: 1px solid var(--ink); background: var(--white); }
.admin-submission-head, .admin-submission { min-width: 1480px; display: grid; grid-template-columns: 72px minmax(190px, 1fr) minmax(160px, .85fr) minmax(150px, .8fr) 164px 76px 108px 126px minmax(270px, 1.35fr); align-items: center; gap: 16px; padding: 0 16px; }
.admin-submission-head { min-height: 42px; border-bottom: 1px solid var(--ink); background: var(--ink); color: #fff; font-family: var(--mono); font-size: 12px; }
.admin-submission-head button { width: fit-content; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; font-weight: 700; cursor: pointer; }
.admin-submission-head button:hover { color: var(--yellow); }
.admin-submission { min-height: 86px; border-bottom: 1px solid var(--line); }
.admin-submission:last-child { border-bottom: 0; }
.admin-submission code { font-size: 12px; overflow-wrap: anywhere; }
.admin-submission time { color: var(--muted); font-family: var(--mono); font-size: 12px; line-height: 1.5; }
.attempt-number { font-family: var(--mono); font-size: 12px; font-weight: 700; }
.status-tag { display: inline-flex; width: fit-content; padding: 4px 7px; border: 1px solid var(--line); font-family: var(--mono); font-size: 12px; }
.status-tag.pending { background: var(--yellow); border-color: var(--ink); }
.status-tag.approved { background: #dff7e9; color: var(--green); }
.status-tag.waived { background: #eef2ff; color: #4f46e5; }
.submission-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.audit-admin { min-height: 620px; margin-top: 0; padding-top: 18px; }
.audit-filters { display: grid; grid-template-columns: 180px 160px minmax(260px, 1fr) 70px; gap: 10px; align-items: end; padding: 18px; border: 1px solid var(--ink); background: var(--white); }
.audit-filters label { display: grid; gap: 7px; }
.audit-filters label > span { font-size: 12px; font-weight: 700; }
.audit-filters input, .audit-filters select { width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); background: #fff; }
.audit-table-wrap { overflow-x: auto; border: 1px solid var(--ink); border-top: 0; background: var(--white); }
.audit-table { width: 100%; min-width: 1120px; border-collapse: collapse; table-layout: fixed; }
.audit-table th { padding: 11px 12px; border-bottom: 1px solid var(--ink); background: var(--ink); color: #fff; font-family: var(--mono); font-size: 12px; text-align: left; }
.audit-table td { padding: 13px 12px; border-bottom: 1px solid var(--line); font-size: 12px; line-height: 1.55; vertical-align: top; overflow-wrap: anywhere; }
.audit-table tr:last-child td { border-bottom: 0; }
.audit-table th:nth-child(1) { width: 145px; }
.audit-table th:nth-child(2) { width: 190px; }
.audit-table th:nth-child(3) { width: 205px; }
.audit-table th:nth-child(4) { width: 205px; }
.audit-table th:nth-child(5) { width: 210px; }
.audit-table code, .audit-table small { display: block; font-family: var(--mono); font-size: 12px; }
.audit-table small { margin-top: 4px; color: var(--muted); }
.audit-status { display: inline-flex; margin-top: 5px; padding: 3px 6px; border: 1px solid var(--line); font-family: var(--mono); font-size: 12px; }
.audit-status.success { background: #dff7e9; color: var(--green); }
.audit-status.failed, .audit-status.rejected { background: #fff0ed; color: var(--red); }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: rgba(17,17,15,.92);
  color: #fff;
}
.lightbox[hidden],
dialog.lightbox:not([open]) { display: none; }
dialog.lightbox[open],
.lightbox:not(dialog):not([hidden]) { display: block; }
.lightbox::backdrop { background: rgba(15, 23, 42, .72); }
.lightbox.is-loading::before {
  content: "正在加载原图…";
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 0;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  white-space: nowrap;
  transform: translate(-50%, -50%);
}
.lightbox.is-loading img { opacity: 0; }
.lightbox img { position: absolute; top: 50%; left: 50%; display: block; width: auto; height: auto; max-width: calc(100vw - 64px); max-height: calc(100vh - 104px); max-height: calc(100dvh - 104px); object-fit: contain; transform: translate(-50%, -50%); }
.lightbox button { position: absolute; top: max(18px, env(safe-area-inset-top)); right: max(18px, env(safe-area-inset-right)); z-index: 1; width: 44px; height: 44px; border: 1px solid #fff; background: transparent; color: #fff; font-size: 28px; cursor: pointer; }
.confirm-dialog { width: min(480px, calc(100% - 32px)); padding: 0; border: 1px solid var(--ink); background: var(--white); color: var(--ink); }
.confirm-dialog::backdrop { background: rgba(17,17,15,.7); }
.confirm-dialog form { padding: 28px; }
.confirm-dialog h2 { margin: 12px 0 0; font-family: var(--display); font-size: 30px; }
.confirm-dialog p { margin: 14px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 26px; }
.confirm-actions button { min-height: 40px; padding: 0 16px; border: 1px solid var(--ink); background: var(--white); font-weight: 700; cursor: pointer; }
.confirm-actions #confirmActionButton { background: var(--ink); color: #fff; }
.confirm-actions #confirmActionButton.danger { border-color: var(--red); background: var(--red); }

@media (max-width: 900px) {
	.lightbox img { max-width: calc(100vw - 28px); max-height: calc(100vh - 88px); max-height: calc(100dvh - 88px); }
  main { width: min(100% - 28px, 1240px); }
  .contest-hero { min-height: 280px; grid-template-columns: 50px 1fr; }
  .prize-block { grid-column: 1 / -1; min-height: 82px; display: grid; grid-template-columns: 1fr auto; align-items: center; border-top: 1px solid var(--ink); border-left: 0; }
  .hero-copy { padding: 30px 26px; }
  .hero-copy h1 { font-size: 42px; }
  .workbench { grid-template-columns: 1fr; }
  .entry-panel { border-right: 0; border-bottom: 1px solid var(--ink); }
  .review-band { grid-template-columns: 100px 1fr; }
	.request-status { grid-template-columns: 150px 1fr; }
	.request-status-meta { grid-column: 1 / -1; border-top: 1px solid var(--ink); border-left: 0; }
  .review-form { grid-column: 1 / -1; border-top: 1px solid var(--ink); border-left: 0; }
  .admin-grid { grid-template-columns: 1fr; }
	.dashboard-kpis { grid-template-columns: repeat(3, 1fr); }
	.dashboard-kpis article:nth-child(3) { border-right: 0; }
	.dashboard-kpis article:nth-child(-n+3) { border-bottom: 1px solid var(--ink); }
	.provider-rows { grid-template-columns: 1fr; }
	.provider-rows > div { border-right: 0; border-bottom: 1px solid var(--line); }
	.provider-rows > div:last-child { border-bottom: 0; }
  .contest-editor { border-right: 0; border-bottom: 1px solid var(--ink); }
	.admin-submissions-wrap { margin-left: -1px; margin-right: -1px; }
	.allowance-form { grid-template-columns: 1fr 90px 110px; }
	.allowance-form > div { grid-column: 1 / -1; }
	.audit-filters { grid-template-columns: 1fr 1fr 70px; }
	.audit-query { grid-column: 1 / -1; }
	.award-lookup { grid-template-columns: 1fr; }
	.award-results { grid-column: auto; }
}

@media (max-width: 620px) {
  .topbar { min-height: 58px; padding: 0 14px; }
	.topbar { align-items: flex-start; flex-direction: column; padding-top: 10px; padding-bottom: 10px; }
	.top-meta { width: 100%; }
  .top-meta .phase { display: none; }
	.view-tabs { width: 100%; }
	.view-tabs button { flex: 1; padding: 0 6px; }
  .contest-hero { grid-template-columns: 42px 1fr; }
  .contest-index { padding: 20px 12px; }
  .hero-copy { padding: 28px 18px; }
  .hero-copy h1 { font-size: 38px; }
  .prompt-band { grid-template-columns: 1fr 48px; }
  .prompt-band .section-label { grid-column: 1 / -1; padding: 0 0 16px; }
  .prompt-band p { font-size: 14px; }
  .entry-panel, .result-panel { padding: 22px 18px; }
  .result-panel { min-height: 520px; }
  .result-empty b { font-size: 32px; }
  .score-result { grid-template-columns: repeat(2, 1fr); }
  .score-item:nth-child(even) { border-right: 0; }
  .result-actions { align-items: flex-start; flex-direction: column; }
  .leaderboard-section { padding: 68px 0; }
  .leaderboard-head h2 { font-size: 36px; }
  .review-head-actions { align-items: flex-end; flex-direction: column; }
  .podium { grid-template-columns: 1fr; }
  .podium-entry { min-height: 190px; border-right: 0; border-bottom: 1px solid var(--ink); }
  .podium-entry:last-child { border-bottom: 0; }
	.ranking-head, .ranking-row { grid-template-columns: 42px 1fr 60px; gap: 10px; }
	.ranking-head span:nth-child(3), .ranking-row code { display: none; }
	.ranking-prompt-details > div { grid-template-columns: 1fr; gap: 8px; }
  .review-band { grid-template-columns: 76px 1fr; }
	.request-status { grid-template-columns: 1fr; }
	.request-status-label { min-height: 78px; border-right: 0; border-bottom: 1px solid var(--ink); }
	.request-status-meta { grid-column: auto; }
  .archive-heading { grid-template-columns: 1fr; gap: 12px; }
  .archive-heading h2 { font-size: 36px; }
  .archive-winners { grid-template-columns: 1fr; }
	.award-lookup { gap: 22px; padding: 20px; }
	.award-lookup form { width: 100%; justify-content: stretch; }
	.award-lookup button { width: 100%; border-top: 0; border-left: 1px solid var(--ink); }
	.award-record .award-reward { grid-template-columns: 1fr; }
	.award-reward > p { grid-column: 1; }
	.reward-config > header, .reward-field-row { grid-template-columns: 1fr; gap: 10px; }
	.reward-field-row { padding: 16px 0; }
	.award-record { grid-template-columns: 1fr 52px 90px; gap: 10px; }
  .review-copy { padding: 22px 16px; }
  .review-rank strong { font-size: 48px; }
  .admin-auth { grid-template-columns: 1fr; }
	.admin-tabs { width: 100%; }
	.admin-tabs { overflow-x: auto; }
	.admin-tabs button { flex: 1 0 auto; padding: 0 12px; }
	.dashboard-toolbar { grid-template-columns: minmax(0, 1fr) 44px; }
	.dashboard-toolbar > div { grid-column: 1 / -1; }
	.dashboard-toolbar h2 { font-size: 34px; }
	.ranking-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.ranking-summary > span:nth-child(2) { border-right: 0; }
	.ranking-summary > span:nth-child(-n+2) { border-bottom: 1px solid var(--ink); }
	.dashboard-kpis { grid-template-columns: repeat(2, 1fr); }
	.dashboard-kpis article, .dashboard-kpis article:nth-child(3) { border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
	.dashboard-kpis article:nth-child(even) { border-right: 0; }
	.dashboard-kpis article:last-child { border-bottom: 0; }
  .field-pair { grid-template-columns: 1fr; gap: 0; }
  .provider-switch { grid-template-columns: 1fr; }
  .key-loader { grid-template-columns: minmax(0, 1fr) 82px; }
	.audit-filters { grid-template-columns: 1fr; }
	.audit-query { grid-column: auto; }
	.local-submission-card { grid-template-columns: 1fr; }
	.local-submission-card > img { min-height: 0; border-right: 0; border-bottom: 1px solid var(--ink); }
	.local-submission-detail { padding: 20px 16px; }
	.share-card-dialog[open] { grid-template-columns: 1fr; overflow-y: auto; }
	.share-card-preview { border-right: 0; border-bottom: 1px solid var(--ink); }
	.share-card-preview img { max-height: 60vh; }
	.share-card-controls { padding: 22px 18px; }
  .allowance-form { grid-template-columns: 1fr 72px; }
	.allowance-form button { grid-column: 1 / -1; }
}

:root[data-theme="dark"] body::before {
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
}
:root[data-theme="dark"] .topbar,
:root[data-theme="dark"] .view-tabs,
:root[data-theme="dark"] .admin-tabs,
:root[data-theme="dark"] .workbench,
:root[data-theme="dark"] .retry-form,
:root[data-theme="dark"] .review-form,
:root[data-theme="dark"] .request-status,
:root[data-theme="dark"] .review-form,
:root[data-theme="dark"] .ranking-rules,
:root[data-theme="dark"] .podium,
:root[data-theme="dark"] .ranking-table-wrap,
:root[data-theme="dark"] .archive-work,
:root[data-theme="dark"] .admin-grid,
:root[data-theme="dark"] .allowance-form,
:root[data-theme="dark"] .provider-dashboard,
:root[data-theme="dark"] .model-dashboard,
:root[data-theme="dark"] .dashboard-kpis,
:root[data-theme="dark"] .award-lookup,
:root[data-theme="dark"] .share-card-dialog {
  border-color: var(--line);
  background: var(--white);
}
:root[data-theme="dark"] .field input,
:root[data-theme="dark"] .field textarea,
:root[data-theme="dark"] .field select,
:root[data-theme="dark"] .provider-switch label,
:root[data-theme="dark"] .retry-form input,
:root[data-theme="dark"] .retry-form select,
:root[data-theme="dark"] .review-form input,
:root[data-theme="dark"] .award-lookup input,
:root[data-theme="dark"] .pagination button,
:root[data-theme="dark"] .pagination input,
:root[data-theme="dark"] .dashboard-toolbar select,
:root[data-theme="dark"] .reward-field-row input,
:root[data-theme="dark"] .allowance-form input {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--ink);
}
:root[data-theme="dark"] .prompt-adjustment-field,
:root[data-theme="dark"] .provider-switch label:has(input:checked),
:root[data-theme="dark"] .admin-toggle,
:root[data-theme="dark"] .ranking-row.top-rank,
:root[data-theme="dark"] .award-record .award-reward,
:root[data-theme="dark"] .request-status.running .request-status-label strong {
  background: rgba(139, 124, 255, .16);
  color: var(--ink);
}
:root[data-theme="dark"] .save-warning,
:root[data-theme="dark"] .request-status.error,
:root[data-theme="dark"] .retry-command,
:root[data-theme="dark"] .award-reward.used,
:root[data-theme="dark"] .award-reward.expired,
:root[data-theme="dark"] .award-reward.missing,
:root[data-theme="dark"] .reward-state.used,
:root[data-theme="dark"] .reward-state.expired,
:root[data-theme="dark"] .reward-state.missing {
  background: rgba(255, 122, 141, .14);
}
:root[data-theme="dark"] .score-total,
:root[data-theme="dark"] .ranking-head,
:root[data-theme="dark"] .model-usage-head,
:root[data-theme="dark"] .admin-submission-head,
:root[data-theme="dark"] .mark {
  background: #0c0f15;
  color: #fff;
}
:root[data-theme="dark"] .toast {
  border-color: rgba(58, 66, 84, .92);
  background: rgba(23, 27, 36, .96);
  box-shadow: 0 12px 28px rgba(0, 0, 0, .36);
  color: var(--ink);
}
:root[data-theme="dark"] .share-card-dialog::backdrop {
  background: rgba(2, 4, 9, .72);
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition-duration: .01ms !important; }
  .icon-button.is-loading .refresh-icon { animation: none; transform: rotate(180deg); }
}
