/* Feiyue reference: frontend/src/styles/tokens.css and layout/MegaMenu.tsx. */
:root {
  color-scheme: light;
  --bg: #fff;
  --bg-subtle: #f7f6f3;
  --bg-hover: #f1f1ef;
  --ink: #37352f;
  --muted: #787774;
  --faint: #9b9a97;
  --line: #edece9;
  --line-strong: #dcdad4;
  --link: #2383e2;
  --orange: #d9730d;
  --teal: #0f7b6c;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-card: 0 1px 2px rgb(0 0 0 / 4%);
  --transition: 150ms ease;
  --font-sans: "Inter Tight", "PingFang SC", -apple-system, BlinkMacSystemFont, "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --font-serif: "Source Serif 4", "Noto Serif SC", "Noto Serif CJK SC", "Songti SC", SimSun, Georgia, serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { scrollbar-gutter: stable; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font-sans); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; }
.icon { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.shell { width: min(1240px, calc(100% - 64px)); margin: auto; }
.top { position: sticky; top: 0; z-index: 4; height: 56px; background: rgb(255 255 255 / 96%); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); }
.top-inner { height: 100%; display: flex; align-items: center; gap: 24px; padding: 0 28px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font: 600 17px/1 var(--font-serif); white-space: nowrap; }
.brand .icon { width: 20px; height: 20px; }
.brand:hover { text-decoration: none; }
.nav-location { padding: 6px 10px; border-radius: var(--radius-sm); background: var(--bg-subtle); color: var(--teal); font-size: 13px; font-weight: 500; letter-spacing: .02em; }
.source-link { display: inline-flex; align-items: center; gap: 7px; margin-left: auto; padding: 6px 9px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--muted); font-size: 12px; transition: background var(--transition), color var(--transition); }
.source-link:hover { background: var(--bg-subtle); color: var(--ink); text-decoration: none; }
.source-link .icon { width: 14px; height: 14px; }
.hero { display: flex; align-items: center; justify-content: space-between; gap: 32px; padding: 48px 0 36px; }
.eyebrow { color: var(--faint); font-size: 11px; font-weight: 600; letter-spacing: .14em; }
h1 { margin: 11px 0 14px; font: 600 clamp(29px, 3.5vw, 40px)/1.35 var(--font-serif); letter-spacing: -.025em; }
.intro { margin: 0; color: var(--muted); font-size: 14px; }
.hero-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin-top: 23px; color: var(--faint); font-size: 12px; }
.hero-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.hero-meta .icon { width: 13px; height: 13px; }
.hero-meta b { font-weight: 400; }
.soft-label { padding: 3px 7px; border-radius: 4px; background: var(--bg-subtle); color: var(--muted); }
.counts { display: flex; flex: none; gap: 12px; }
.count-card { display: flex; align-items: center; gap: 12px; min-width: 144px; padding: 17px; border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-card); }
.count-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm); }
.count-icon.drawing { background: rgb(217 115 13 / 10%); color: var(--orange); }
.count-icon.game { background: rgb(15 123 108 / 10%); color: var(--teal); }
.counts strong { display: block; font: 600 26px/1.15 var(--font-serif); }
.counts .count-label { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.filters { display: flex; align-self: stretch; align-items: center; gap: 4px; }
.filters button { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 10px 12px; border: 0; border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: transparent; color: var(--muted); white-space: nowrap; font-size: 13px; transition: color var(--transition); }
.filters button:hover { color: var(--ink); font-weight: 500; }
.filters button[aria-pressed="true"] { color: var(--ink); font-weight: 600; }
.filters button[aria-pressed="true"]::after { position: absolute; content: ""; height: 2px; bottom: -1px; left: 10px; right: 10px; background: var(--ink); border-radius: 1px; }
.filters .icon { width: 15px; height: 15px; }
.model-label { margin-left: -3px; font-size: 10px; font-weight: 400; color: var(--faint); }
.search { position: relative; display: block; margin-bottom: 7px; }
.search > .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--faint); pointer-events: none; }
.search input { width: 218px; height: 33px; padding: 6px 12px 6px 32px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); color: var(--ink); font-size: 12px; transition: border-color var(--transition), background var(--transition); }
.search input::placeholder { color: var(--faint); }
.search input:hover { border-color: var(--line-strong); }
.search input:focus { border-color: var(--line-strong); outline: 2px solid rgb(35 131 226 / 18%); outline-offset: 1px; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg); box-shadow: var(--shadow-card); transition: background var(--transition), border-color var(--transition); }
.card:hover { border-color: var(--line-strong); background: var(--bg-subtle); }
.preview { display: block; width: 100%; aspect-ratio: 4/3; padding: 0; overflow: hidden; border: 0; border-bottom: 1px solid var(--line); background: var(--bg-subtle); }
.preview:focus-visible { outline-offset: -3px; }
.preview img { display: block; width: 100%; height: 100%; object-fit: contain; }
.preview[data-mode="game"], .preview.missing-cover { aspect-ratio: 16/10; }
.missing-cover { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; color: var(--faint); font-size: 12px; }
.missing-cover .icon { width: 26px; height: 26px; stroke-width: 1.25; }
.card-body { padding: 16px; }
.card-author { display: flex; align-items: center; gap: 10px; min-width: 0; margin-bottom: 15px; }
.card-author > img { width: 30px; height: 30px; flex: none; object-fit: cover; border-radius: 50%; background: var(--bg-subtle); }
.card-author > div { min-width: 0; }
.card h2 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 500; }
.card .student-id { display: block; margin-top: 3px; color: var(--faint); font: 11px/1.5 var(--font-mono); }
.actions { display: flex; gap: 8px; }
.actions button { display: inline-flex; flex: 1; align-items: center; justify-content: center; gap: 6px; min-height: 33px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--bg); color: var(--muted); font-size: 12px; transition: background var(--transition), color var(--transition), border-color var(--transition); }
.actions .icon { width: 14px; height: 14px; }
.actions button:hover { background: var(--bg-hover); color: var(--ink); }
.actions .play { background: var(--ink); border-color: var(--ink); color: white; }
.actions .play:hover { background: #504d46; border-color: #504d46; color: white; }
.actions button:disabled { cursor: default; background: var(--bg-subtle); border-color: var(--line); color: var(--faint); }
.ranking-info { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 17px; color: var(--muted); font-size: 11px; }
.ranking-info p { margin: 0; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg); scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
table { width: 100%; min-width: 1200px; border-collapse: separate; border-spacing: 0; text-align: center; font-variant-numeric: tabular-nums; }
th { padding: 15px 8px; background: var(--bg-subtle); color: var(--muted); font-size: 11px; font-weight: 400; white-space: nowrap; }
th[data-reason] { cursor: help; }
th[data-reason]:focus-visible { outline: 2px solid var(--teal); outline-offset: -3px; }
.group-start, tbody td:nth-child(8), tbody td:nth-child(9), tbody td:nth-child(10) { border-left: 1px solid var(--line); }
td { padding: 11px 8px; border-top: 1px solid var(--line); font-size: 13px; }
tbody tr { --row-bg: var(--bg); background: var(--row-bg); transition: background var(--transition); }
tbody tr:hover { --row-bg: var(--bg-subtle); }
.rank { width: 48px; color: var(--faint); font: 12px/1.5 var(--font-mono); }
.rank.top-rank { color: var(--ink); font-weight: 600; }
.student { width: 128px; text-align: left; font: 12px/1.5 var(--font-mono); }
.student-name { text-align: left; white-space: nowrap; }
.score { min-width: 38px; padding: 5px 6px; border: 0; border-radius: 4px; background: transparent; color: var(--ink); font-size: 13px; cursor: help; transition: background var(--transition); }
.score:hover, .score:focus-visible { background: var(--bg-hover); }
.score.total { background: var(--bg-subtle); font-weight: 650; }
.score.deducted { color: var(--orange); }
.row-actions { min-width: 180px; justify-content: flex-end; gap: 6px; }
.row-actions button { flex: none; min-height: 29px; padding: 4px 8px; font-size: 11px; }
.row-actions .icon { width: 12px; height: 12px; }
.score-tooltip { position: fixed; z-index: 10; width: max-content; max-width: min(520px, calc(100vw - 24px)); padding: 12px 15px; border-radius: var(--radius-sm); background: var(--ink); color: white; box-shadow: 0 4px 18px rgb(0 0 0 / 12%); font-size: 12px; line-height: 1.75; white-space: pre-line; overflow-wrap: anywhere; pointer-events: auto; animation: tooltip-in 150ms ease; }
@keyframes tooltip-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
.empty { grid-column: 1/-1; padding: 64px 20px; text-align: center; color: var(--muted); }
footer { display: flex; justify-content: space-between; gap: 20px; margin-top: 34px; padding: 24px 0 30px; border-top: 1px solid var(--line); color: var(--faint); font-size: 11px; }
footer a { color: var(--muted); }
dialog { width: min(1200px, calc(100% - 32px)); max-height: 94dvh; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--bg); color: var(--ink); box-shadow: 0 16px 70px rgb(0 0 0 / 16%); }
dialog::backdrop { background: rgb(15 15 15 / 45%); }
.modal-head { display: flex; align-items: center; gap: 18px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.modal-head h2 { flex: 1; margin: 0; font-size: 14px; font-weight: 500; }
.modal-head a { color: var(--muted); font-size: 12px; }
.close { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); font-size: 24px; line-height: 1; transition: background var(--transition), color var(--transition); }
.close:hover { background: var(--bg-hover); color: var(--ink); }
.modal-stage { position: relative; }
.author-watermark { position: absolute; z-index: 1; top: 12px; right: 14px; display: flex; align-items: center; gap: 9px; padding: 5px 6px 5px 11px; border: 1px solid rgb(255 255 255 / 65%); border-radius: 24px; background: rgb(255 255 255 / 88%); box-shadow: var(--shadow-card); pointer-events: none; }
.author-watermark span { color: rgb(55 53 47 / 65%); font: 500 12px/1 var(--font-mono); }
.author-watermark img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; background: var(--bg-subtle); }
.modal-content { display: flex; align-items: center; justify-content: center; min-height: 240px; }
.modal-content img { max-width: 100%; max-height: 78dvh; object-fit: contain; }
.modal-content iframe { width: 100%; height: 76dvh; border: 0; background: var(--bg); }
.modal-hint { margin: 0; padding: 10px 16px; color: var(--muted); font-size: 11px; }
[hidden] { display: none !important; }
@media (max-width: 1000px) {
  .shell { width: calc(100% - 48px); }
  .hero { align-items: flex-start; flex-direction: column; gap: 24px; padding-top: 34px; }
  .counts { width: 100%; }
  .count-card { flex: 1; min-width: 0; padding: 13px 16px; }
  .toolbar { align-items: stretch; flex-direction: column-reverse; gap: 12px; }
  .search input { width: 100%; }
  .search { margin: 0; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 580px) {
  .shell { width: calc(100% - 32px); }
  .top-inner { gap: 12px; padding: 0 16px; }
  .brand { font-size: 16px; }
  .nav-location { padding: 5px 7px; font-size: 11px; }
  .source-link { padding: 6px; font-size: 11px; }
  .source-link .icon { display: none; }
  .hero { padding: 28px 0; gap: 23px; }
  .hero-meta { margin-top: 18px; }
  .count-card { gap: 10px; padding: 12px; }
  .counts strong { font-size: 23px; }
  .count-icon { width: 32px; height: 32px; }
  .filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 6px; padding-bottom: 5px; }
  .filters button { justify-content: flex-start; min-height: 38px; padding: 8px 10px; border-radius: var(--radius-sm); font-size: 12px; }
  .model-label { margin-left: -4px; font-size: 9px; }
  .grid { grid-template-columns: 1fr; gap: 17px; }
  .student { position: sticky; left: 0; z-index: 1; background: var(--row-bg, var(--bg-subtle)); box-shadow: 2px 0 3px rgb(0 0 0 / 3%); }
  footer { flex-direction: column; gap: 7px; }
  .modal-head { gap: 10px; padding: 10px 12px; }
  .modal-head h2 { font-size: 13px; }
  .author-watermark { top: 9px; right: 9px; gap: 7px; }
  .author-watermark span { font-size: 11px; }
  .author-watermark img { width: 27px; height: 27px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
