:root {
  --rose: #e23d6d;
  --gold: #f0c36b;
  --ink: #2a1220;
  --muted: rgba(255, 236, 244, .72);
  --card: rgba(42, 12, 28, .58);
  --line: rgba(240, 195, 107, .22);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; min-height: 100%;
  color: #fff8f4;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #16040f;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
[hidden] { display: none !important; }

.sky {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(1200px 520px at 80% -10%, rgba(226, 61, 109, .45), transparent 60%),
    radial-gradient(900px 480px at 0% 20%, rgba(108, 42, 122, .4), transparent 55%),
    linear-gradient(180deg, #2a0818 0%, #16040f 42%, #0c0308 100%);
}
.sky::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, rgba(255,255,255,.7), transparent),
    radial-gradient(1px 1px at 28% 42%, rgba(240,195,107,.8), transparent),
    radial-gradient(1.2px 1.2px at 72% 22%, rgba(255,255,255,.55), transparent),
    radial-gradient(1px 1px at 88% 48%, rgba(255,255,255,.45), transparent),
    radial-gradient(1.4px 1.4px at 46% 12%, rgba(240,195,107,.7), transparent);
}

.page { position: relative; z-index: 1; padding-bottom: calc(96px + var(--safe-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: calc(8px + var(--safe-top)) 12px 10px;
  background: rgba(22, 4, 15, .72);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.topbar .back, .topbar .side {
  width: 44px; height: 36px; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 600;
}
.topbar h1 { margin: 0; flex: 1; text-align: center; font-size: 17px; font-weight: 700; }
.main { padding: 14px 14px 8px; display: flex; flex-direction: column; gap: 12px; }

.hero {
  padding: 22px 18px 18px;
  border-radius: 20px;
  background:
    linear-gradient(160deg, rgba(226,61,109,.28), rgba(240,195,107,.08) 48%, rgba(42,8,24,.35)),
    rgba(255,255,255,.04);
  border: 1px solid var(--line);
  box-shadow: 0 12px 32px rgba(0,0,0,.18);
}
.hero-tag {
  display: inline-block;
  font-size: 11px; font-weight: 700; letter-spacing: .12em;
  color: var(--gold); text-transform: uppercase;
  background: rgba(240,195,107,.12);
  border: 1px solid rgba(240,195,107,.28);
  border-radius: 999px; padding: 4px 10px;
}
.hero h2 {
  margin: 12px 0 8px; font-size: 22px; line-height: 1.3; font-weight: 800;
  letter-spacing: .02em;
}
.hero-sub { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.deadline {
  margin-top: 16px; padding: 12px 14px; border-radius: 14px;
  background: rgba(0,0,0,.22); display: flex; flex-direction: column; gap: 4px;
}
.deadline.closed { background: rgba(0,0,0,.35); }
.dl-label { font-size: 11px; color: var(--gold); font-weight: 700; letter-spacing: .08em; }
.deadline strong { font-size: 16px; }
.deadline em { font-style: normal; font-size: 12px; color: var(--muted); }

.card {
  background: var(--card);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 16px;
  padding: 16px 16px 14px;
  backdrop-filter: blur(10px);
}
.card h3 { margin: 0 0 12px; font-size: 16px; font-weight: 700; }
.facts { list-style: none; margin: 0; padding: 0; }
.facts li {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px 0; border-top: 1px solid rgba(255,255,255,.06);
  font-size: 14px; line-height: 1.5;
}
.facts li:first-child { border-top: 0; padding-top: 0; }
.facts span { width: 42px; flex-shrink: 0; color: var(--gold); font-size: 12px; font-weight: 700; padding-top: 2px; }
.facts b { font-weight: 600; word-break: break-all; }
.facts a, .steps a {
  color: var(--gold); font-weight: 700; text-decoration: underline;
  text-underline-offset: 3px;
}

.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.steps li { display: flex; gap: 12px; }
.steps i {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--rose), #a31d4f);
  font-style: normal; font-size: 12px; font-weight: 800;
  box-shadow: 0 4px 10px rgba(226,61,109,.35);
}
.steps strong { display: block; font-size: 14px; margin-bottom: 4px; }
.steps p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.55; }
.steps em {
  font-style: normal; color: var(--gold); font-weight: 700;
}

.rank-hd { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.rank-hd h3 { margin: 0; }
.rank-hd a { font-size: 12px; color: var(--gold); font-weight: 650; }
.rank-list { display: flex; flex-direction: column; gap: 8px; color: var(--muted); font-size: 13px; }
.rank-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 12px; background: rgba(255,255,255,.04);
  color: inherit;
}
.rank-row .n {
  width: 22px; text-align: center; font-weight: 800; font-size: 13px; color: var(--gold);
}
.rank-row img.av, .rank-row img.cover {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: #3a1828; flex-shrink: 0;
}
.rank-row img.cover { border-radius: 8px; }
.rank-row .who { flex: 1; min-width: 0; }
.rank-row .who b { display: block; color: #fff; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-row .who span { font-size: 11px; color: var(--muted); }
.rank-row .score { font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; }
.rank-empty { padding: 18px 8px; text-align: center; line-height: 1.6; }

.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; gap: 10px;
  padding: 10px 14px calc(10px + var(--safe-bottom));
  background: linear-gradient(180deg, transparent, rgba(12,3,8,.92) 28%);
}
.btn {
  flex: 1; height: 46px; border-radius: 23px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700;
}
.btn.ghost {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
}
.btn.primary {
  background: linear-gradient(135deg, #f0c36b, #e23d6d);
  color: #2a1220; box-shadow: 0 8px 20px rgba(226,61,109,.35);
}
.btn.primary.is-off { opacity: .55; pointer-events: none; }
.toast {
  position: fixed; left: 50%; bottom: calc(88px + var(--safe-bottom));
  transform: translateX(-50%);
  background: rgba(0,0,0,.78); color: #fff; padding: 8px 14px; border-radius: 999px;
  font-size: 13px; z-index: 40;
}
