:root {
  --ink: #0b2a3a;
  --ink-soft: #16384a;
  --sea: #1f6f7a;
  --jade: #2a9d8f;
  --jade-deep: #1f7a6f;
  --sand: #e8f0ef;
  --paper: rgba(255, 255, 255, 0.92);
  --line: rgba(11, 42, 58, 0.08);
  --gold: #c9a227;
  --silver: #8a97a5;
  --bronze: #b87333;
  --text: #102a36;
  --muted: #5a7280;
  --shadow: 0 12px 28px rgba(11, 42, 58, 0.12);
  --radius: 18px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Noto Sans SC", sans-serif;
  color: var(--text);
  background: #0b2a3a;
  min-height: 100dvh;
  line-height: 1.5;
  padding-bottom: calc(28px + var(--safe-bottom));
  overflow-x: hidden;
}

.bg-atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 90% 55% at 15% -10%, rgba(42, 157, 143, 0.45), transparent 55%),
    radial-gradient(ellipse 70% 45% at 95% 8%, rgba(201, 162, 39, 0.22), transparent 50%),
    linear-gradient(165deg, #0b2a3a 0%, #124556 42%, #0f3a48 100%);
}

.bg-atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, black 0%, transparent 70%);
}

.site-header {
  padding: 28px 20px 12px;
  color: #f4fbfa;
  animation: rise 0.7s ease both;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  font-family: "ZCOOL XiaoWei", serif;
  font-size: clamp(1.05rem, 4.4vw, 1.55rem);
  letter-spacing: 0.02em;
  line-height: 1.25;
  font-weight: 400;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  margin: 0;
}

.rank-entry {
  flex: 0 0 auto;
  border: 1px solid rgba(244, 251, 250, 0.28);
  background: rgba(255, 255, 255, 0.1);
  color: #f4fbfa;
  border-radius: 12px;
  padding: 8px 12px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.rank-entry:active {
  transform: scale(0.97);
  background: rgba(255, 255, 255, 0.18);
}

.headline {
  margin-top: 8px;
  font-size: 1.05rem;
  font-weight: 500;
  color: rgba(244, 251, 250, 0.88);
}

.subhead {
  margin-top: 6px;
  font-size: 0.88rem;
  color: rgba(232, 240, 239, 0.7);
  max-width: 26ch;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 0 4px;
}

.section-head h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #f4fbfa;
}

.section-head p {
  font-size: 0.78rem;
  color: rgba(232, 240, 239, 0.65);
}

.gallery {
  padding: 8px 16px 22px;
  animation: rise 0.75s ease 0.1s both;
}

.rank-panel {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.rank-panel[hidden] {
  display: none;
}

.rank-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(5, 18, 24, 0.72);
  cursor: pointer;
}

.rank-sheet {
  position: relative;
  z-index: 1;
  width: min(100%, 480px);
  max-height: min(88dvh, 640px);
  padding: 18px 16px calc(22px + var(--safe-bottom));
  border-radius: 22px 22px 0 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(42, 157, 143, 0.28), transparent 60%),
    linear-gradient(180deg, #124556 0%, #0b2a3a 100%);
  box-shadow: 0 -16px 40px rgba(0, 0, 0, 0.28);
  animation: sheet-up 0.32s ease both;
  overflow: auto;
}

.rank-sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.rank-sheet-head h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #f4fbfa;
}

.rank-sheet-head p {
  margin-top: 4px;
  font-size: 0.78rem;
  color: rgba(232, 240, 239, 0.65);
}

.rank-close {
  flex: 0 0 auto;
  border: 0;
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
  background: #f4fbfa;
  cursor: pointer;
}

.podium {
  display: grid;
  grid-template-columns: 1fr 1.08fr 1fr;
  gap: 10px;
  align-items: end;
  min-height: 210px;
}

.podium-card {
  position: relative;
  background: var(--paper);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  text-align: center;
  transform-origin: bottom center;
}

.podium-card.rank-1 {
  order: 2;
  animation: pop 0.6s ease 0.25s both;
}

.podium-card.rank-2 {
  order: 1;
  animation: pop 0.6s ease 0.35s both;
}

.podium-card.rank-3 {
  order: 3;
  animation: pop 0.6s ease 0.45s both;
}

.podium-card .medal {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 900;
  color: #fff;
}

.rank-1 .medal { background: var(--gold); }
.rank-2 .medal { background: var(--silver); }
.rank-3 .medal { background: var(--bronze); }

.podium-card .thumb {
  aspect-ratio: 1 / 1.05;
  width: 100%;
  object-fit: cover;
  display: block;
  background: #d7e4e2;
}

.rank-1 .thumb {
  aspect-ratio: 1 / 1.15;
}

.podium-card .meta {
  padding: 8px 6px 10px;
}

.podium-card .name {
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.podium-card .votes {
  margin-top: 2px;
  font-size: 0.72rem;
  color: var(--sea);
  font-weight: 700;
}

.podium-empty {
  grid-column: 1 / -1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px dashed rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  padding: 48px 16px;
  text-align: center;
  color: rgba(244, 251, 250, 0.75);
  font-size: 0.9rem;
}

@keyframes sheet-up {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.category-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 14px;
  margin: 0 -4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.category-bar::-webkit-scrollbar {
  display: none;
}

.cat-btn {
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  color: rgba(244, 251, 250, 0.85);
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.cat-btn:active {
  transform: scale(0.97);
}

.cat-btn.active {
  background: #f4fbfa;
  color: var(--ink);
  font-weight: 700;
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.vote-card {
  background: var(--paper);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  animation: rise 0.45s ease both;
}

.vote-card .cover {
  position: relative;
  aspect-ratio: 1.54 / 1;
  background: #d7e4e2;
  overflow: hidden;
  border: 0;
  padding: 0;
  width: 100%;
  cursor: zoom-in;
  display: block;
}

.vote-card .cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.vote-card .cover:active img {
  transform: scale(1.03);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(5, 18, 24, 0.82);
  cursor: pointer;
}

.lightbox-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  max-height: min(88dvh, 720px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: pop 0.28s ease both;
}

.lightbox-panel img {
  width: 100%;
  max-height: 72dvh;
  object-fit: contain;
  border-radius: 14px;
  background: #102a36;
}

.lightbox-panel figcaption {
  color: #f4fbfa;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
}

.lightbox-close {
  align-self: center;
  border: 0;
  border-radius: 12px;
  padding: 10px 22px;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink);
  background: #f4fbfa;
  cursor: pointer;
}

.vote-card .body {
  padding: 10px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.vote-card .title {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vote-card .vote-count {
  font-size: 0.78rem;
  color: var(--muted);
}

.vote-card .vote-count strong {
  color: var(--jade-deep);
  font-size: 0.95rem;
}

.vote-btn {
  margin-top: auto;
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 10px 8px;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--jade) 0%, var(--jade-deep) 100%);
  cursor: pointer;
  transition: filter 0.2s ease, transform 0.15s ease;
}

.vote-btn:active {
  transform: scale(0.98);
  filter: brightness(0.95);
}

.vote-btn.voted {
  background: linear-gradient(135deg, #5f7d88 0%, #46616c 100%);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-bottom));
  transform: translateX(-50%) translateY(20px);
  background: rgba(11, 42, 58, 0.94);
  color: #f4fbfa;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 0.86rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 50;
  max-width: calc(100vw - 40px);
  text-align: center;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (min-width: 720px) {
  body {
    max-width: 480px;
    margin: 0 auto;
  }

  .bg-atmosphere {
    left: 50%;
    width: 480px;
    transform: translateX(-50%);
  }
}
