/* ============ 基础 ============ */
*,
*::before,
*::after { box-sizing: border-box; }

:root {
  color-scheme: light dark;
  --paper: #f5efe3;
  --paper-2: #ece3d3;
  --card: #fffdf8;
  --ink: #241f18;
  --ink-2: #6d6355;
  --line: #e0d5c2;
  --gold: #b07c26;
  --gold-2: #d9a441;
  --gold-soft: #e9cf9d;
  --shadow: 0 14px 40px rgba(64, 48, 22, .10);
  --shadow-sm: 0 2px 10px rgba(64, 48, 22, .07);
  --btn-bg: #241f18;
  --btn-fg: #fbf7ee;
  --radius: 18px;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  --sans: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #151310;
    --paper-2: #221e18;
    --card: #1f1b15;
    --ink: #f1e9da;
    --ink-2: #b1a58f;
    --line: #352e24;
    --gold: #d9a94e;
    --gold-2: #e8c174;
    --gold-soft: #5a4620;
    --shadow: 0 16px 44px rgba(0, 0, 0, .45);
    --shadow-sm: 0 2px 12px rgba(0, 0, 0, .3);
    --btn-bg: #e8dcc6;
    --btn-fg: #1a1712;
  }
}

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--sans);
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(1100px 620px at 82% -8%, rgba(217, 164, 65, .16), transparent 62%),
    radial-gradient(900px 520px at -6% 8%, rgba(122, 86, 34, .10), transparent 58%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }

.skip {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 999;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  transform: translateY(-160%);
  transition: transform .2s;
}
.skip:focus { transform: none; }

/* ============ 顶栏 / 页脚 ============ */
.topbar {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px clamp(16px, 4vw, 44px) 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--gold);
  border-radius: 13px;
  color: var(--gold);
  font-family: var(--serif);
  font-size: 21px;
  background: rgba(176, 124, 38, .06);
}
.brand-copy { display: flex; flex-direction: column; line-height: 1.25; }
.brand-copy strong {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: .1em;
}
.brand-copy small {
  font-size: 10px;
  letter-spacing: .2em;
  color: var(--ink-2);
  margin-top: 3px;
}

.topnav { display: flex; gap: 4px; }
.topnav a {
  text-decoration: none;
  font-size: 13px;
  color: var(--ink-2);
  padding: 9px 15px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: color .2s, background .2s, border-color .2s;
}
.topnav a:hover { color: var(--ink); background: rgba(176, 124, 38, .08); }
.topnav a.active { color: var(--gold); border-color: var(--gold-soft); }
.topnav a[hidden] { display: none; }

.footer {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 40px clamp(16px, 4vw, 44px) calc(44px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--ink-2);
  font-size: 11px;
  letter-spacing: .12em;
}
.footer a { color: var(--ink-2); text-decoration: none; }
.footer a:hover { color: var(--gold); }

/* ============ 首屏 ============ */
main { outline: none; flex: 1 0 auto; width: 100%; }

.hero {
  max-width: 1320px;
  margin: 0 auto;
  padding: clamp(18px, 4vw, 44px) clamp(16px, 4vw, 44px) clamp(28px, 4vw, 44px);
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: end;
}

.eyebrow {
  margin: 0 0 20px;
  font-size: 11px;
  letter-spacing: .38em;
  color: var(--gold);
  text-transform: uppercase;
}

.hero h1 {
  margin: 0 0 22px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(58px, 8.5vw, 122px);
  line-height: .95;
  letter-spacing: .02em;
  text-wrap: balance;
}

.lede {
  margin: 0;
  max-width: 44ch;
  font-size: 15px;
  line-height: 1.95;
  color: var(--ink-2);
}

.meta {
  list-style: none;
  margin: 26px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}
.meta li {
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--ink-2);
  background: rgba(255, 253, 248, .35);
}

/* 评委卡片 */
.judge-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 26px;
  box-shadow: var(--shadow);
}
.judge-card h2 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 600;
}
.judge-card p {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--ink-2);
}
.judge-card label {
  display: block;
  font-size: 11px;
  letter-spacing: .18em;
  color: var(--ink-2);
  margin-bottom: 8px;
}
.judge-card input {
  width: 100%;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper);
  font-size: 16px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.judge-card input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(176, 124, 38, .12);
}
.judge-card .btn { margin-top: 14px; }
.fineprint {
  margin: 13px 0 0 !important;
  font-size: 11px !important;
  letter-spacing: .04em;
  color: var(--ink-2);
  opacity: .85;
}

.judge-status { text-align: left; }
.judge-status .status-line {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  color: var(--ink);
  margin: 0 0 6px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); flex: none; }
.judge-status .name {
  font-family: var(--serif);
  font-size: 26px;
  margin: 4px 0 18px;
  letter-spacing: .04em;
}
.status-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 13px;
  letter-spacing: .1em;
  cursor: pointer;
  text-decoration: none;
  transition: transform .18s, background .2s, color .2s, border-color .2s, opacity .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .42; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--btn-bg); color: var(--btn-fg); }
.btn.primary:hover { background: var(--gold); color: #1c1509; }
.btn.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}
.btn.ghost:hover { border-color: var(--gold); color: var(--gold); }
.btn.small { padding: 8px 15px; font-size: 12px; letter-spacing: .06em; }
.btn.wide { width: 100%; }

/* ============ 作品墙 ============ */
.gallery-wrap {
  max-width: 1320px;
  margin: 0 auto;
  padding: 8px clamp(16px, 4vw, 44px) 40px;
}

.toolbar {
  position: sticky;
  top: max(10px, env(safe-area-inset-top));
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 12px 10px 20px;
  margin: 0 0 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(245, 239, 227, .82);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  backdrop-filter: blur(16px) saturate(1.3);
  box-shadow: var(--shadow-sm);
}
@media (prefers-color-scheme: dark) {
  .toolbar { background: rgba(21, 19, 16, .82); }
}

.progress { flex: 1; min-width: 0; }
.progress-text {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--ink-2);
  margin-bottom: 6px;
  letter-spacing: .04em;
}
.progress-text b { color: var(--gold); font-weight: 600; }
.bar {
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
  transition: width .45s cubic-bezier(.22, .8, .3, 1);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: 8px;
  column-gap: 18px;
  align-items: start;
}

.card {
  display: block;
  width: 100%;
  margin: 0 0 18px;
  padding: 0;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .28s cubic-bezier(.22, .8, .3, 1), box-shadow .28s, border-color .28s;
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) {
  .card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: var(--gold-soft);
  }
  .card:hover .ph img { transform: scale(1.025); }
}
.card:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.card.is-scored { border-color: rgba(176, 124, 38, .45); }

.ph {
  position: relative;
  background-size: cover;
  background-position: center;
  background-color: var(--paper-2);
  overflow: hidden;
}
.ph img {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0;
  transition: opacity .5s ease, transform .6s cubic-bezier(.22, .8, .3, 1);
}
.ph img.loaded { opacity: 1; }

.badge {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 42px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
  color: #fff;
  background: rgba(18, 14, 9, .52);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
}
.badge small { font-size: 9px; opacity: .8; }
.badge.on {
  color: #1d1507;
  background: var(--gold-2);
  font-weight: 700;
}

.cap {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 11px 13px 13px;
}
.cap .num {
  font-family: var(--serif);
  font-size: 11px;
  color: var(--gold);
  letter-spacing: .06em;
  flex: none;
}
.cap strong {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cap .sub {
  margin-left: auto;
  flex: none;
  font-size: 10px;
  letter-spacing: .1em;
  color: var(--ink-2);
}

/* ============ 评分弹层 ============ */
dialog { color: var(--ink); }

.sheet {
  border: 0;
  padding: 0;
  margin: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  background: transparent;
  overflow: hidden;
}
.sheet[open] { display: flex; align-items: center; justify-content: center; }
.sheet::backdrop {
  background: rgba(16, 12, 8, .78);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.sheet-card {
  position: relative;
  width: min(1160px, 94vw);
  height: min(780px, 90vh);
  height: min(780px, 90dvh);
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(350px, .85fr);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 40px 110px rgba(0, 0, 0, .5);
  animation: sheet-in .32s cubic-bezier(.22, .8, .3, 1);
}
@keyframes sheet-in {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to { opacity: 1; transform: none; }
}

.sheet-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 6;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(15, 12, 8, .45);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: background .2s;
}
.sheet-close:hover { background: rgba(15, 12, 8, .72); }

.stage {
  position: relative;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d0b08;
  overflow: hidden;
}
.stage img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(15, 12, 8, .4);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: background .2s, opacity .2s;
}
.nav:hover { background: rgba(15, 12, 8, .7); }
.nav:disabled { opacity: .25; cursor: default; }
.nav.prev { left: 14px; }
.nav.next { right: 14px; }

.sheet-panel {
  padding: 28px 28px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sheet-head { display: flex; align-items: center; gap: 12px; }
.sheet-index {
  font-size: 11px;
  letter-spacing: .2em;
  color: var(--ink-2);
}
.tag {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid var(--gold-soft);
  border-radius: 999px;
  color: var(--gold);
  font-size: 10px;
  letter-spacing: .14em;
  white-space: nowrap;
}
.sheet-panel h2 {
  margin: 14px 0 6px;
  font-family: var(--serif);
  font-size: clamp(26px, 3vw, 34px);
  font-weight: 600;
  letter-spacing: .02em;
  line-height: 1.25;
}
.sheet-panel .subline {
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--ink-2);
}
.judge-note {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.8;
  color: var(--ink-2);
}

.score-box { margin-top: auto; padding-top: 18px; }
.score-read {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-height: 84px;
}
.score-read output {
  font-family: var(--serif);
  font-size: clamp(60px, 7vw, 82px);
  line-height: 1;
  color: var(--gold);
  letter-spacing: -.01em;
}
.score-read output.empty { color: var(--ink-2); opacity: .28; }
.score-read .unit { font-size: 13px; letter-spacing: .2em; color: var(--ink-2); }

.quick {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 6px 0 16px;
}
.quick button {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-size: 12px;
  cursor: pointer;
  transition: all .18s;
  -webkit-tap-highlight-color: transparent;
}
.quick button:hover { border-color: var(--gold); color: var(--gold); }
.quick button.active {
  background: var(--gold);
  border-color: var(--gold);
  color: #1d1507;
  font-weight: 600;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 30px;
  background: transparent;
  cursor: pointer;
  margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold) var(--pct, 80%), var(--line) var(--pct, 80%));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -8px;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid var(--gold);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .22);
}
input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold) var(--pct, 80%), var(--line) var(--pct, 80%));
}
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid var(--gold);
}

.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 2px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.score-row label { font-size: 11px; letter-spacing: .14em; color: var(--ink-2); }
.score-row input {
  width: 94px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--card);
  text-align: center;
  font-size: 16px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  -moz-appearance: textfield;
}
.score-row input::-webkit-outer-spin-button,
.score-row input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.score-row input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(176, 124, 38, .12); }

.sheet-panel .btn.wide { margin-top: 18px; flex: none; }
.sheet-panel .hint {
  margin: 12px 0 0;
  text-align: center;
  font-size: 10px;
  letter-spacing: .1em;
  color: var(--ink-2);
  opacity: .8;
}

/* ============ 结果页 ============ */
.results, .locked, .error-view {
  max-width: 1000px;
  margin: 0 auto;
  padding: clamp(20px, 4vw, 52px) clamp(16px, 4vw, 44px) 56px;
}
.page-head .eyebrow { margin-bottom: 16px; }
.page-head h1 {
  margin: 0 0 16px;
  font-family: var(--serif);
  font-size: clamp(42px, 6.5vw, 76px);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: .02em;
}
.page-head .lede { max-width: 52ch; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 30px 0 34px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
}
.stat span {
  display: block;
  font-size: 10px;
  letter-spacing: .18em;
  color: var(--ink-2);
  margin-bottom: 8px;
}
.stat b {
  font-family: var(--serif);
  font-size: clamp(26px, 3.4vw, 34px);
  font-weight: 600;
  color: var(--ink);
}
.stat b small { font-size: 12px; color: var(--ink-2); font-family: var(--sans); margin-left: 3px; }

.results-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
}

.ranking { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.rank-row {
  display: grid;
  grid-template-columns: 46px 58px minmax(0, 1fr) auto;
  grid-template-areas: "rank thumb main avg";
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  transition: border-color .2s, transform .2s;
}
.rank-row:hover { border-color: var(--gold-soft); }
.rank-row .rank {
  grid-area: rank;
  font-family: var(--serif);
  font-size: 27px;
  line-height: 1;
  text-align: center;
  color: var(--ink-2);
}
.rank-row.top-1 { border-color: rgba(217, 164, 65, .55); background: linear-gradient(100deg, rgba(217, 164, 65, .11), transparent 55%), var(--card); }
.rank-row.top-1 .rank { color: var(--gold); }
.rank-row.top-2 .rank { color: #8d939c; }
.rank-row.top-3 .rank { color: #a96f3d; }
.thumb {
  grid-area: thumb;
  width: 58px;
  height: 58px;
  object-fit: cover;
  border-radius: 11px;
  background: var(--paper-2);
  display: block;
}
.rank-main { grid-area: main; min-width: 0; }
.rank-title {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.rank-title strong {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rank-title .tag { font-size: 9px; padding: 3px 8px; }
.rank-bar {
  height: 5px;
  border-radius: 999px;
  background: var(--line);
  margin: 9px 0 7px;
  overflow: hidden;
}
.rank-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
}
.rank-meta {
  font-size: 10px;
  letter-spacing: .08em;
  color: var(--ink-2);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}
.mine { color: var(--gold); }
.avg {
  grid-area: avg;
  font-family: var(--serif);
  font-size: 30px;
  line-height: 1;
  text-align: right;
  white-space: nowrap;
}
.avg small { font-size: 10px; color: var(--ink-2); font-family: var(--sans); margin-left: 3px; }
.avg.none { font-size: 15px; color: var(--ink-2); font-family: var(--sans); }

.results-note {
  margin: 20px 0 0;
  font-size: 11px;
  line-height: 1.9;
  letter-spacing: .06em;
  color: var(--ink-2);
}

/* 锁定 / 错误 / 载入 */
.locked, .error-view { text-align: center; padding-top: 12vh; }
.locked h1, .error-view h1 {
  font-family: var(--serif);
  font-size: clamp(34px, 5vw, 54px);
  font-weight: 600;
  margin: 0 0 16px;
}
.locked p, .error-view p {
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.9;
  max-width: 36ch;
  margin: 0 auto 26px;
}
.boot {
  min-height: 52vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--ink-2);
  font-size: 12px;
  letter-spacing: .16em;
}
.spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--gold);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ 确认框 / 提示 ============ */
.confirm {
  border: 0;
  padding: 0;
  background: transparent;
}
.confirm::backdrop {
  background: rgba(16, 12, 8, .62);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}
.confirm-card {
  width: min(440px, 90vw);
  margin: auto;
  padding: 26px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .4);
}
.confirm-card h2 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
}
.confirm-card p {
  margin: 0;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.85;
}
.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(26px + env(safe-area-inset-bottom));
  z-index: 1000;
  transform: translate(-50%, 14px);
  padding: 11px 20px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 12px;
  letter-spacing: .06em;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  max-width: 88vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.noscript {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  background: var(--paper);
  color: var(--ink);
  padding: 24px;
  text-align: center;
}

/* ============ 管理端 ============ */
.admin-wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(20px, 4vw, 48px) clamp(16px, 4vw, 44px) 64px;
}
.admin-head h1 {
  font-family: var(--serif);
  font-size: clamp(34px, 5vw, 52px);
  font-weight: 600;
  margin: 0 0 10px;
}
.admin-head p { color: var(--ink-2); font-size: 13px; margin: 0 0 26px; }

.gate {
  max-width: 430px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 26px;
  box-shadow: var(--shadow);
}
.gate label { display: block; font-size: 11px; letter-spacing: .16em; color: var(--ink-2); margin-bottom: 8px; }
.gate input {
  width: 100%;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  font-size: 15px;
  outline: none;
}
.gate input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(176, 124, 38, .12); }
.gate .btn { margin-top: 14px; width: 100%; }
.gate-error { color: #b3462f; font-size: 12px; margin: 10px 0 0; min-height: 16px; }

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 26px;
}
.admin-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px 22px;
  margin-bottom: 18px;
}
.admin-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.admin-panel h2 {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}
.admin-panel .sub { font-size: 11px; color: var(--ink-2); }

.admin-ranking { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.admin-rank {
  display: grid;
  grid-template-columns: 30px 42px minmax(0, 1fr) 90px 70px;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 11px;
}
.admin-rank:nth-child(odd) { background: rgba(176, 124, 38, .045); }
.admin-rank img { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; }
.admin-rank .t { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-rank .n { font-size: 11px; color: var(--ink-2); text-align: right; }
.admin-rank .a { font-family: var(--serif); font-size: 18px; text-align: right; }

.judge-list { display: grid; gap: 6px; }
.judge-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px 70px 60px 150px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 12px;
}
.judge-row.pending { opacity: .62; }
.judge-row .jname { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.judge-row .jtime { color: var(--ink-2); font-size: 11px; }
.judge-row .jcount { color: var(--ink-2); text-align: right; }
.judge-row .javg { font-family: var(--serif); font-size: 16px; text-align: right; }
.judge-row .jactions { display: flex; gap: 6px; justify-content: flex-end; }
.judge-empty { color: var(--ink-2); font-size: 12px; padding: 12px 0; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 4px 0; }
.switch-row p { margin: 0; font-size: 12px; color: var(--ink-2); line-height: 1.7; max-width: 46ch; }
.switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex: none;
}
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }
.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--line);
  transition: background .2s;
}
.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .2s;
}
.switch input:checked + span { background: var(--gold); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }

.admin-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ============ 响应式 ============ */
@media (max-width: 1180px) {
  .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; align-items: start; gap: 34px; }
  .hero h1 { font-size: clamp(52px, 12vw, 88px); }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 14px; }
  .card { margin-bottom: 14px; }
  .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .judge-row { grid-template-columns: minmax(0, 1fr) 70px 60px 140px; }
  .judge-row .jtime { display: none; }
}
@media (max-width: 860px) {
  .sheet-card {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    border: 0;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .sheet-close { top: max(12px, env(safe-area-inset-top)); }
  .stage { min-height: 0; max-height: 58vh; max-height: 58dvh; }
  .stage img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 58vh;
    max-height: 58dvh;
    object-fit: contain;
  }
  .sheet-panel {
    max-height: none;
    padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
  }
  .sheet-panel h2 { margin: 10px 0 2px; font-size: 24px; }
  .score-box { margin-top: 14px; padding-top: 8px; }
  .score-read { min-height: 62px; }
  .score-read output { font-size: 56px; }
  .quick { margin: 2px 0 10px; }
  .sheet-panel .btn.wide { margin-top: 12px; }
  .sheet-panel .hint { display: none; }
  .nav { width: 38px; height: 38px; font-size: 22px; }
}
@media (max-width: 700px) {
  .topbar { padding-top: 14px; }
  .brand-copy small { display: none; }
  .brand-copy strong { font-size: 16px; }
  .mark { width: 38px; height: 38px; border-radius: 11px; font-size: 18px; }
  .footer { flex-direction: column; gap: 8px; }
  .toolbar { gap: 12px; padding: 9px 10px 9px 16px; }
  .toolbar .btn { padding: 10px 16px; font-size: 12px; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .stat { padding: 12px 12px; }
  .stat span { font-size: 9px; letter-spacing: .1em; margin-bottom: 6px; }
  .stat b { font-size: 24px; }
  .rank-row {
    grid-template-columns: 30px 46px minmax(0, 1fr);
    grid-template-areas:
      "rank thumb main"
      "rank thumb avg";
    row-gap: 7px;
    padding: 12px 14px;
    gap: 12px;
  }
  .rank-row .thumb { width: 46px; height: 46px; border-radius: 9px; }
  .avg { text-align: left; font-size: 20px; }
  .rank-bar { margin: 7px 0 5px; }
  .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .judge-row { grid-template-columns: minmax(0, 1fr) 60px 130px; }
  .judge-row .jcount { display: none; }
  .admin-rank { grid-template-columns: 24px 36px minmax(0, 1fr) 64px; }
  .admin-rank img { width: 36px; height: 36px; }
  .admin-rank .n { display: none; }
}
@media (max-width: 460px) {
  .hero h1 { font-size: clamp(48px, 15vw, 68px); }
  .gallery { column-gap: 10px; }
  .card { margin-bottom: 10px; border-radius: 13px; }
  .cap { padding: 9px 10px 10px; gap: 6px; }
  .cap strong { font-size: 12.5px; }
  .cap .sub { display: none; }
  .badge { top: 7px; right: 7px; padding: 4px 8px; font-size: 11px; }
  .meta li { font-size: 10px; padding: 6px 10px; }
  .toolbar .progress-text span:last-child { display: none; }
  .judge-card { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .topbar, .footer, .toolbar, .results-actions, .sheet, .confirm, .toast { display: none !important; }
  body { background: #fff; }
  .rank-row { break-inside: avoid; }
}
