:root {
  --paper: #fff7e8;
  --gold: #f0c978;
  --mint: #b8ffe8;
  --glass: rgba(255, 247, 232, 0.075);
  --line: rgba(255, 247, 232, 0.14);
  --ink: #050807;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--paper);
  font-family: "Noto Serif SC", "Microsoft YaHei", serif;
  background: #010202;
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

.seo-summary,
.noscript-seo {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  border: 0;
  clip: rect(0 0 0 0);
  overflow: hidden;
  white-space: nowrap;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px clamp(18px, 4vw, 52px);
  pointer-events: none;
}

.brand,
.top-actions {
  pointer-events: auto;
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(240, 201, 120, 0.4);
  border-radius: 50%;
  color: var(--gold);
  background: rgba(255, 247, 232, 0.045);
  box-shadow: 0 0 36px rgba(240, 201, 120, 0.18);
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.05;
}

.brand strong {
  font-family: "ZCOOL XiaoWei", "Noto Serif SC", serif;
  font-size: 1.35rem;
}

.brand small {
  margin-top: 5px;
  color: rgba(255, 247, 232, 0.5);
  font-size: 0.76rem;
}

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.ghost-button,
.icon-button,
.details-button,
.drawer-close,
.official-link,
.vote-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--paper);
  background: var(--glass);
  backdrop-filter: blur(16px);
  cursor: pointer;
  text-decoration: none;
}

.ghost-button,
.icon-button {
  min-height: 42px;
  padding: 0 16px;
}

.rank-limit {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: rgba(255, 247, 232, 0.72);
  background: var(--glass);
  backdrop-filter: blur(16px);
}

.rank-limit select {
  width: 70px;
  border: 0;
  color: var(--paper);
  background: transparent;
  outline: none;
}

.rank-limit option {
  color: var(--ink);
}

.icon-button {
  width: 42px;
  padding: 0;
}

main,
.rank-shell,
.rank-list {
  position: fixed;
  inset: 0;
  min-height: 100dvh;
}

.rank-list {
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 50%, rgba(184, 255, 232, 0.12), transparent 32%),
    radial-gradient(circle at 50% 50%, rgba(240, 201, 120, 0.06), transparent 54%),
    #010202;
}

.rank-list::after {
  position: absolute;
  inset: auto 0 0;
  height: 34%;
  content: "";
  background: linear-gradient(0deg, rgba(255, 247, 232, 0.08), transparent);
  pointer-events: none;
}

#rank-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

.hint {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 2;
  color: rgba(255, 247, 232, 0.42);
  font-size: 0.86rem;
  transform: translateX(-50%);
  pointer-events: none;
}

.traffic-widget {
  position: fixed;
  left: clamp(18px, 4vw, 52px);
  bottom: 26px;
  z-index: 9;
  display: flex;
  gap: 10px;
  align-items: center;
  max-width: calc(100vw - 36px);
  padding: 10px 14px;
  border: 1px solid rgba(184, 255, 232, 0.16);
  border-radius: 999px;
  color: rgba(255, 247, 232, 0.68);
  background: rgba(2, 6, 6, 0.48);
  box-shadow: 0 0 36px rgba(184, 255, 232, 0.08);
  backdrop-filter: blur(18px);
  font-size: 0.78rem;
  pointer-events: none;
}

.traffic-widget strong {
  color: var(--mint);
  font-variant-numeric: tabular-nums;
}

.traffic-source {
  color: rgba(240, 201, 120, 0.74);
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.loading-overlay.is-visible {
  opacity: 1;
}

.loading-overlay[hidden] {
  display: none;
}

.loading-card {
  display: grid;
  gap: 16px;
  min-width: 210px;
  place-items: center;
  padding: 28px 34px;
  border: 1px solid rgba(184, 255, 232, 0.22);
  border-radius: 28px;
  color: rgba(255, 247, 232, 0.9);
  background:
    radial-gradient(circle at 50% 15%, rgba(184, 255, 232, 0.16), transparent 58%),
    rgba(2, 6, 6, 0.58);
  box-shadow:
    0 0 90px rgba(184, 255, 232, 0.12),
    inset 0 0 34px rgba(255, 247, 232, 0.045);
  backdrop-filter: blur(22px);
  transform: translateY(8px) scale(0.96);
  transition: transform 220ms ease;
}

.loading-overlay.is-visible .loading-card {
  transform: translateY(0) scale(1);
}

.loading-card strong {
  font-size: 1rem;
  letter-spacing: 0.18em;
}

.loading-orbit {
  position: relative;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(240, 201, 120, 0.28);
  border-radius: 50%;
  box-shadow: 0 0 36px rgba(240, 201, 120, 0.16);
  animation: loadingSpin 1.35s linear infinite;
}

.loading-orbit::before,
.loading-orbit::after {
  position: absolute;
  content: "";
  border-radius: 50%;
}

.loading-orbit::before {
  inset: 17px;
  background: var(--gold);
  box-shadow: 0 0 28px rgba(240, 201, 120, 0.58);
}

.loading-orbit::after {
  top: 4px;
  left: 50%;
  width: 9px;
  height: 9px;
  background: var(--mint);
  box-shadow: 0 0 18px rgba(184, 255, 232, 0.76);
  transform: translateX(-50%);
}

@keyframes loadingSpin {
  to {
    transform: rotate(360deg);
  }
}

.model-panel,
.comments-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 20;
  width: min(430px, 100vw);
  height: 100vh;
  padding: 26px;
  border-left: 1px solid var(--line);
  color: var(--paper);
  background: rgba(2, 4, 4, 0.72);
  box-shadow: -24px 0 90px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(28px);
  transform: translateX(104%);
  transition: transform 260ms ease;
  overflow: auto;
  overscroll-behavior: contain;
}

.model-panel.is-open,
.comments-panel.is-open {
  transform: translateX(0);
}

.drawer-head,
.panel-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
}

.panel-head {
  grid-template-columns: auto minmax(0, 1fr);
  margin-top: 42px;
}

.drawer-head h2,
.panel-head h3 {
  margin: 0;
  font-size: 1.55rem;
  overflow-wrap: anywhere;
}

.panel-head p,
.summary,
.comment-item time {
  color: rgba(255, 247, 232, 0.58);
}

.summary {
  line-height: 1.8;
}

.panel-rank {
  display: grid;
  min-width: 54px;
  min-height: 54px;
  place-items: center;
  border: 1px solid rgba(240, 201, 120, 0.36);
  border-radius: 50%;
  color: var(--gold);
  background: rgba(240, 201, 120, 0.08);
  font-weight: 900;
}

.drawer-close {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  padding: 0;
  font-size: 1.2rem;
}

.model-close {
  position: absolute;
  top: 22px;
  right: 22px;
}

.price-panel,
.vote-panel,
.card-actions,
.comment-form {
  display: grid;
  gap: 10px;
}

.price-panel {
  grid-template-columns: repeat(3, 1fr);
  margin: 18px 0;
}

.price-panel span,
.comment-item,
.video-details {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: rgba(255, 247, 232, 0.055);
}

.price-panel strong {
  display: block;
  margin-bottom: 6px;
  color: rgba(255, 247, 232, 0.54);
  font-size: 0.76rem;
}

.card-actions,
.vote-panel {
  grid-template-columns: repeat(2, 1fr);
  margin: 14px 0;
}

.official-link,
.details-button,
.vote-button {
  min-height: 42px;
  padding: 10px 12px;
  text-align: center;
}

.vote-button {
  display: flex;
  justify-content: space-between;
}

.vote-button.is-voted {
  border-color: rgba(184, 255, 232, 0.48);
  color: var(--mint);
}

.video-details {
  margin-top: 14px;
}

.video-details summary {
  cursor: pointer;
  color: var(--gold);
}

.video-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.video-list a {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-align: center;
  text-decoration: none;
  background: rgba(255, 247, 232, 0.04);
}

.comment-form {
  margin: 22px 0;
}

.comment-form input,
.comment-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  color: var(--paper);
  background: rgba(255, 247, 232, 0.055);
  outline: none;
}

.comment-form textarea {
  min-height: 110px;
  resize: vertical;
}

.comment-list {
  display: grid;
  gap: 12px;
}

.comment-item strong,
.comment-item time,
.comment-item p {
  display: block;
  margin: 0;
}

.comment-item time {
  margin: 4px 0 10px;
  font-size: 0.78rem;
}

.empty-state {
  color: rgba(255, 247, 232, 0.52);
}

@media (max-width: 720px) {
  .topbar {
    gap: 10px;
    padding: max(12px, env(safe-area-inset-top)) 14px 12px;
  }

  .brand {
    gap: 8px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    font-size: 0.88rem;
  }

  .brand strong {
    font-size: 1.08rem;
  }

  .brand small {
    display: none;
  }

  .top-actions {
    gap: 8px;
  }

  .ghost-button,
  .icon-button,
  .rank-limit {
    min-height: 38px;
  }

  .ghost-button {
    padding: 0 12px;
  }

  .rank-limit {
    padding: 0 10px;
  }

  .rank-limit span {
    display: none;
  }

  .rank-limit select {
    width: 54px;
  }

  .hint {
    right: 18px;
    bottom: calc(58px + env(safe-area-inset-bottom));
    left: 18px;
    width: auto;
    text-align: center;
    transform: none;
  }

  .traffic-widget {
    right: 50%;
    bottom: calc(16px + env(safe-area-inset-bottom));
    left: auto;
    gap: 8px;
    padding: 9px 12px;
    transform: translateX(50%);
    white-space: nowrap;
  }

  .traffic-source {
    display: none;
  }

  .model-panel,
  .comments-panel {
    width: 100vw;
    padding: 20px;
  }

  .price-panel,
  .card-actions,
  .vote-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) and (orientation: portrait) {
  .model-panel,
  .comments-panel {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: min(78dvh, 720px);
    padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    border-left: 0;
    border-radius: 28px 28px 0 0;
    box-shadow: 0 -24px 90px rgba(0, 0, 0, 0.42);
    transform: translateY(104%);
  }

  .model-panel.is-open,
  .comments-panel.is-open {
    transform: translateY(0);
  }

  .panel-head {
    margin-top: 32px;
  }

  .drawer-head h2,
  .panel-head h3 {
    font-size: 1.32rem;
  }

  .loading-card {
    min-width: 188px;
    padding: 24px 28px;
  }
}

@media (max-width: 920px) and (orientation: landscape) {
  .topbar {
    padding: max(10px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 10px max(14px, env(safe-area-inset-left));
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .brand strong {
    font-size: 1.05rem;
  }

  .brand small {
    display: none;
  }

  .ghost-button,
  .icon-button,
  .rank-limit {
    min-height: 36px;
  }

  .model-panel,
  .comments-panel {
    width: min(390px, 48vw);
    padding: 18px;
  }

  .panel-head {
    margin-top: 30px;
  }

  .drawer-head h2,
  .panel-head h3 {
    font-size: 1.22rem;
  }

  .price-panel {
    grid-template-columns: 1fr;
  }

  .comment-form textarea {
    min-height: 78px;
  }

  .hint {
    bottom: calc(12px + env(safe-area-inset-bottom));
    font-size: 0.78rem;
  }

  .traffic-widget {
    left: max(14px, env(safe-area-inset-left));
    bottom: calc(12px + env(safe-area-inset-bottom));
    padding: 8px 11px;
  }
}

@media (min-width: 721px) and (max-width: 1100px) {
  .model-panel,
  .comments-panel {
    width: min(410px, 44vw);
  }
}

@media (min-width: 1440px) {
  .brand strong {
    font-size: 1.48rem;
  }

  .model-panel,
  .comments-panel {
    width: 460px;
  }
}
