/* =========================================================
   星动超新星 · 一起踩雪ing
   Ranking poster — assembled from the supplied image parts.
   The list, rank numbers and pills are rendered in code.
   ========================================================= */

:root {
  --poster-w: 1280;
  --poster-h: 2275;
  --ink: #0f4f8b;
  --ink-deep: #0a3b6a;
  --blue: #1d7fe4;
  --white-ring: rgba(255, 255, 255, .95);
  --pill-face: linear-gradient(180deg, #cbeaff 0%, #b8e0fa 52%, #a8d5f6 100%);
  --pill-face-hover: linear-gradient(180deg, #e7f7ff 0%, #c7ebff 55%, #b2ddfa 100%);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: #04182b;
  color: #eaf7ff;
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button {
  font: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.noscript {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 20;
  margin: 0;
  padding: 10px 18px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(8, 34, 56, .9);
  color: #dff4ff;
  font-size: 14px;
}

/* ---------- page atmosphere ---------- */

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 70% 48% at 50% 26%, rgba(96, 190, 255, .26), transparent 66%),
    radial-gradient(ellipse 80% 60% at 50% 102%, rgba(34, 112, 168, .30), transparent 70%),
    linear-gradient(160deg, #071e34 0%, #041526 46%, #020a14 100%);
}

.ambient-shade {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 55% 42% at 50% 38%, rgba(116, 203, 255, .20), transparent 68%),
    radial-gradient(ellipse 90% 60% at 50% 110%, rgba(38, 120, 180, .16), transparent 70%),
    linear-gradient(180deg, rgba(2, 14, 28, .50), rgba(1, 8, 18, .86));
}

/* Snow inside the poster, clipped to the rounded poster and sitting
   above the list (z5) but behind the banner, clouds and characters. */
.poster-snow {
  position: absolute;
  inset: 0;
  z-index: 5;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

.poster-flake {
  position: absolute;
  top: -24px;
  left: var(--x);
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffffff 0%, #e9f9ff 55%, #a9dcff 100%);
  box-shadow:
    0 0 4px rgba(255, 255, 255, .65),
    0 1px 2px rgba(45, 110, 160, .55);
  opacity: var(--o);
  animation: poster-fall var(--d) linear infinite;
  animation-delay: var(--delay);
}

@keyframes poster-fall {
  from { transform: translate3d(0, -30px, 0); }
  to   { transform: translate3d(var(--drift), 2320px, 0); }
}

/* ---------- stage / poster ---------- */

.viewport {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
}

.stage {
  position: relative;
  flex: 0 0 auto;
  width: 1280px;
  height: 2275px;
  animation: stage-in 1s cubic-bezier(.16, .84, .3, 1) both;
}

@keyframes stage-in {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}

.poster {
  position: relative;
  width: 1280px;
  height: 2275px;
  overflow: hidden;
  border-radius: 24px;
  background: #d9f0ff;
  transform: scale(var(--scale, .4));
  transform-origin: top left;
  box-shadow:
    0 60px 130px -40px rgba(0, 7, 18, .92),
    0 20px 40px -20px rgba(0, 10, 25, .75),
    0 0 0 1px rgba(214, 243, 255, .35),
    0 0 90px rgba(76, 178, 255, .16);
}

.layer {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.l-bg { z-index: 0; }

/* Cropped layers keep their artwork-only pixel size, which is much
   lighter for iOS WebKit than four full 1280×2275 transparent images. */
.crop-layer {
  position: absolute;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.l-title {
  z-index: 1;
  left: 7.2215%;
  top: 1.0603%;
  width: 86.8054%;
  height: 30.7491%;
}

.l-frame {
  z-index: 2;
  left: 10.6487%;
  top: 35.7340%;
  width: 76.9890%;
  height: 53.6629%;
}

.l-banner {
  z-index: 6;
  left: 11.9951%;
  top: 30.9832%;
  width: 74.1738%;
  height: 11.9664%;
}

.l-cloud {
  z-index: 7;
  left: 13.3415%;
  top: 82.9248%;
  width: 71.9461%;
  height: 6.0452%;
}

.char-wrap {
  position: absolute;
  z-index: 8;
  pointer-events: none;
}

.char-img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  transform-origin: 50% 78%;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* Percentages are the original artwork bounding boxes. The bottom two
   include the small lowering offset that used to live in a transform. */
.wrap-tl { left: 1.1016%;  top: 32.5943%; width: 26.2668%; height: 15.6293%; }
.wrap-tr { left: 77.5520%; top: 32.9248%; width: 21.9584%; height: 15.2988%; }
.wrap-bl { left: -0.2536%; top: 83.8095%; width: 26.0710%; height: 14.2936%; }
.wrap-br { left: 78.9682%; top: 80.9426%; width: 21.1261%; height: 15.5605%; }

.char-tl   { animation: sway 8.4s ease-in-out -0.6s infinite; }
.char-tr   { animation: sway 9.2s ease-in-out -2.4s infinite; }
.char-bl   { animation: sway 10.2s ease-in-out -1.4s infinite; }
.char-br   { animation: sway 9.6s ease-in-out -3.2s infinite; }

@keyframes sway {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%      { transform: translateY(-12px) rotate(2deg); }
}

.poster-legal {
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: 9;
  margin: 0;
  padding: 5px 16px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(255, 255, 255, .46);
  color: rgba(7, 58, 102, .78);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: .5px;
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .72);
  pointer-events: none;
}

/* ---------- table header ---------- */

.table-head {
  position: absolute;
  left: 158px;
  top: 981px;
  z-index: 3;
  width: 934px;
  height: 55px;
  opacity: 0;
  background:
    linear-gradient(180deg, rgba(171, 223, 255, .58) 0%, rgba(192, 233, 255, .94) 30%, rgba(184, 228, 252, .94) 100%);
  border-top: 1px solid rgba(255, 255, 255, .55);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, .40),
    0 1px 0 rgba(118, 188, 232, .22);
}

body.play .table-head {
  animation: head-wipe .8s cubic-bezier(.2, .8, .2, 1) .14s both;
}

@keyframes head-wipe {
  from { opacity: .35; clip-path: inset(0 47% 0 47%); }
  to   { opacity: 1; clip-path: inset(0 0 0 0); }
}

.th {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #1b78d8;
  font-size: 33px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 5px;
  white-space: nowrap;
  text-shadow:
    0 2px 0 rgba(255, 255, 255, .50),
    0 0 7px rgba(255, 255, 255, .38);
}

.th-rank { left: 147px; }
.th-name { left: 438px; }
.th-heat { left: 759px; }

/* ---------- rows ---------- */

.rows {
  position: absolute;
  left: 0;
  top: 1081px;
  z-index: 4;
  width: 100%;
  height: 801px;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* 15 singers fill the frame; 16+ switch to a scrollable list with the
   very light custom rail on the right. */
.rows.is-scroll {
  overflow-y: auto;
  justify-content: flex-start;
  gap: 8px;
  padding: 18px 0 8px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.rows.is-scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* Auto-refreshed rows appear in place, without replaying the entrance. */
.rows.is-static .row {
  opacity: 1;
  transform: none;
  animation: none !important;
}

.rows.is-static .rank-badge {
  opacity: 1;
  transform: translate(-50%, -50%);
  animation: none !important;
}

.rows-scroll {
  position: absolute;
  left: 1058px;
  top: 1092px;
  z-index: 5;
  width: 10px;
  height: 778px;
  border-radius: 5px;
  background: rgba(115, 175, 218, .16);
  opacity: 0;
  pointer-events: none;
}

.rows-scroll.is-visible {
  opacity: 1;
}

.rows-thumb {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 120px;
  border-radius: 5px;
  background: linear-gradient(180deg, #a5ddff 0%, #5aaee8 100%);
  box-shadow: 0 0 4px rgba(70, 150, 210, .35);
  transform: translateY(0);
}

.row {
  position: relative;
  flex: 0 0 46px;
  height: 46px;
  margin: 0;
  opacity: 0;
  transform: translateY(13px);
}

body.play .row {
  animation: row-in .62s cubic-bezier(.18, .84, .32, 1) both;
  animation-delay: calc(.46s + var(--i) * 55ms);
}

@keyframes row-in {
  from { opacity: 0; transform: translateY(13px) scale(.992); }
  to   { opacity: 1; transform: none; }
}

/* glassy blue pill, drawn entirely in CSS */
.pill {
  position: absolute;
  top: 50%;
  height: 45px;
  transform: translateY(-50%);
  border: 3px solid var(--white-ring);
  border-radius: 23px;
  background: var(--pill-face);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, .46),
    inset 0 -4px 0 rgba(115, 178, 221, .15),
    0 2px 3px rgba(55, 117, 166, .13);
  transition: background .25s ease, box-shadow .25s ease, transform .25s ease;
}

.name-pill {
  left: 406px;
  width: 381px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
}

.heat-pill {
  left: 795px;
  width: 246px;
}

.singer-name {
  max-width: 100%;
  overflow: hidden;
  color: var(--ink);
  font-size: 27px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: .4px;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .68);
  transition: color .25s ease;
}

/* Long anchor names (including notes) shrink instead of clipping. */
.singer-name.is-long {
  font-size: 22px;
  letter-spacing: .2px;
}

.singer-name.is-xlong {
  font-size: 17px;
  letter-spacing: 0;
}

.heat-value {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  color: #0d4c88;
  font-family: "Arial Rounded MT Bold", "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  letter-spacing: .2px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .55);
}

/* hover: the row lifts a little */
.row:hover .pill {
  background: var(--pill-face-hover);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, .65),
    inset 0 -4px 0 rgba(115, 178, 221, .10),
    0 0 0 2px rgba(255, 255, 255, .45),
    0 6px 14px rgba(25, 96, 155, .16);
}

.row:hover .name-pill { transform: translateY(-50%) translateX(3px); }
.row:hover .heat-pill { transform: translateY(-50%) translateX(-2px); }
.row:hover .singer-name { color: #093f73; }

/* ---------- rank: top 3 comes from the badge artwork ---------- */

.rank-badge {
  position: absolute;
  left: 308px;
  top: 50%;
  z-index: 2;
  width: 82px;
  height: 68px;
  transform: translate(-50%, -50%);
}

body.play .rank-badge {
  animation: badge-pop .58s cubic-bezier(.34, 1.4, .64, 1) both;
  animation-delay: calc(.52s + var(--i) * 55ms);
}

@keyframes badge-pop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(.42); }
  70%  { opacity: 1; transform: translate(-50%, -50%) scale(1.09); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.rank-badge img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 3px 4px rgba(30, 82, 132, .30));
  transition: transform .28s cubic-bezier(.34, 1.4, .64, 1);
}

.row:hover .rank-badge img { transform: scale(1.07) rotate(-2deg); }

.badge-num {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: "Arial Rounded MT Bold", "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.5px;
  pointer-events: none;
  -webkit-text-stroke: 1px transparent;
  paint-order: stroke fill;
}

.rank-badge.gold .badge-num {
  top: 47%;
  color: #7b4a00;
  -webkit-text-stroke-color: rgba(255, 246, 195, .95);
  text-shadow: 0 2px 2px rgba(122, 66, 0, .28);
}

.rank-badge.silver .badge-num {
  top: 43.5%;
  color: #1768c6;
  -webkit-text-stroke-color: rgba(247, 252, 255, .98);
  text-shadow: 0 2px 2px rgba(20, 74, 140, .22);
}

.rank-badge.bronze .badge-num {
  top: 43.5%;
  color: #8b4b16;
  -webkit-text-stroke-color: rgba(255, 245, 227, .98);
  text-shadow: 0 2px 2px rgba(120, 62, 12, .24);
}

/* a slow golden breath behind the champion badge */
.rank-badge.gold::before {
  content: "";
  position: absolute;
  inset: 12% 6%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 214, 84, .55) 0%, rgba(255, 196, 56, .20) 48%, transparent 72%);
  filter: blur(7px);
  animation: gold-pulse 3.4s ease-in-out infinite;
}

@keyframes gold-pulse {
  0%, 100% { opacity: .55; transform: scale(.94); }
  50%      { opacity: 1; transform: scale(1.08); }
}

/* ---------- rank: 4th and below are drawn in code ---------- */

.rank-pill {
  position: absolute;
  left: 221px;
  top: 50%;
  width: 174px;
  height: 45px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  border: 3px solid var(--white-ring);
  border-radius: 23px;
  background: var(--pill-face);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, .46),
    inset 0 -4px 0 rgba(115, 178, 221, .15),
    0 2px 3px rgba(55, 117, 166, .13);
  color: var(--blue);
  font-family: "Arial Rounded MT Bold", "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 1.5px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .68);
  transition: background .25s ease, box-shadow .25s ease, transform .25s ease;
}

.row:hover .rank-pill {
  background: var(--pill-face-hover);
  transform: translateY(-50%) translateX(2px);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, .65),
    0 0 0 2px rgba(255, 255, 255, .42),
    0 6px 14px rgba(25, 96, 155, .16);
}

/* ---------- page controls ---------- */

.tools {
  position: fixed;
  left: 22px;
  bottom: 22px;
  z-index: 10;
  display: flex;
  gap: 8px;
  padding: 6px;
  border: 1px solid rgba(166, 224, 255, .22);
  border-radius: 999px;
  background: rgba(7, 31, 52, .82);
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .7);
  opacity: .82;
  transition: opacity .3s ease;
}

.tools:hover,
.tools:focus-within {
  opacity: 1;
}

.tool {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #dcf3ff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .06em;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}

.tool svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool:hover {
  background: rgba(166, 226, 255, .14);
  color: #fff;
}

.tool:active {
  background: rgba(166, 226, 255, .22);
}

.tool.is-on {
  background: rgba(166, 226, 255, .24);
  color: #ffffff;
  box-shadow:
    inset 0 0 0 1px rgba(166, 226, 255, .30),
    0 8px 20px -12px rgba(0, 0, 0, .65);
}

.tool.is-on svg {
  color: #a9e7ff;
}

.tool:disabled {
  opacity: .5;
  cursor: wait;
}

.tool:focus-visible {
  outline: 2px solid rgba(166, 226, 255, .85);
  outline-offset: 2px;
}

/* ---------- responsive ---------- */

@media (max-width: 700px) {
  /* Keep iOS WebKit's compositing load low: no blurred badge glow or
     drop-shadow filters. The snow and character sway are cheap CSS
     transforms and stay enabled. */
  .rank-badge.gold::before { display: none; }
  .rank-badge img { filter: none; }
  .poster {
    box-shadow:
      0 16px 40px -22px rgba(0, 7, 18, .9),
      0 0 0 1px rgba(214, 243, 255, .30);
  }
}

@media (max-width: 640px) {
  .viewport { padding: 6px; }
  .poster { border-radius: 14px; }
  .tools {
    left: 50%;
    bottom: max(12px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    gap: 2px;
    padding: 4px;
  }
  .tool {
    height: 32px;
    padding: 0 11px;
    font-size: 12px;
  }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .stage,
  .char-tl, .char-tr, .char-bl, .char-br,
  .rank-badge.gold::before {
    animation: none !important;
  }

  .poster-snow { display: none; }

  .table-head,
  .row {
    opacity: 1;
    transform: none;
    animation: none !important;
    clip-path: none;
  }

  .rank-badge {
    opacity: 1;
    transform: translate(-50%, -50%);
    animation: none !important;
  }

  .pill,
  .rank-pill,
  .rank-badge img,
  .singer-name {
    transition: none;
  }
}
