:root {
  /* 晴天游乐园：奶油纸、糖果色、粗描边贴纸风 */
  --ink: #33325c;
  --ink-soft: rgba(51, 50, 92, 0.14);
  --paper: #fffdf7;
  --muted: #6b6a8c;
  --orange: #ff8c42;
  --orange-deep: #f27a24;
  --yellow: #ffd23f;
  --sky: #4cc9f0;
  --sky-soft: #cfeeff;
  --mint: #3fd2a7;
  --mint-soft: #d3f7ea;
  --pink: #ff6b9d;
  --pink-soft: #ffe3ee;
  --red: #e5484d;
  --radius: 22px;
  --font-display: "ZCOOL KuaiLe", "Noto Sans SC", sans-serif;
  --font-body: "Noto Sans SC", system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  background: #eaf7ff;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.bg-ride {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(640px 380px at 8% -6%, rgba(76, 201, 240, 0.35), transparent 60%),
    radial-gradient(560px 360px at 96% 6%, rgba(255, 107, 157, 0.22), transparent 55%),
    radial-gradient(760px 460px at 50% 108%, rgba(255, 210, 63, 0.3), transparent 55%),
    linear-gradient(180deg, #d9f1ff 0%, #eaf7ff 40%, #fff6e6 100%);
}

.bg-ride::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.5;
  background-image: radial-gradient(rgba(51, 50, 92, 0.07) 1.6px, transparent 1.6px);
  background-size: 26px 26px;
}

/* —— 顶部 RSS 气泡（inline，随页面自然滚动） —— */
.top-bar {
  display: flex;
  justify-content: flex-end;
  padding: 0.7rem 1rem 0;
}

.rss-link {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  min-height: 44px;
  padding: 0.55rem 1rem;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--ink);
  text-decoration: none;
  background: var(--yellow);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.rss-link:hover {
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 var(--ink);
}

.rss-link:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

.rss-link:focus-visible {
  outline: 3px solid var(--sky);
  outline-offset: 3px;
}

.wrap {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.25rem 0 3.5rem;
}

/* —— Hero —— */
.hero {
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem 2.5rem;
  text-align: center;
}

.hero-text {
  max-width: 46rem;
  min-width: 0;
}

.eyebrow {
  margin: 0 0 0.55rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--orange-deep);
}

.hero h1 {
  margin: 0 0 0.65rem;
  font-family: var(--font-display);
  font-size: clamp(2.3rem, 5.6vw, 3.6rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-shadow: 3px 3px 0 var(--yellow);
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 1.02rem;
  max-width: 40rem;
}

.subtitle strong {
  color: var(--ink);
  font-weight: 700;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}

.pill-row li {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 0.28rem 0.78rem;
  box-shadow: 3px 3px 0 var(--sky-soft);
}

.pill-row li:nth-child(2) {
  box-shadow: 3px 3px 0 var(--mint-soft);
}

.pill-row li:nth-child(3) {
  box-shadow: 3px 3px 0 var(--pink-soft);
}

/* —— 吉祥物：腮红小鹈鹕 —— */
.mascot {
  width: min(230px, 42vw);
  flex-shrink: 0;
}

.mascot .wheel {
  animation: wheel-spin 2.8s linear infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.mascot .mascot-bird {
  animation: mascot-bob 2.2s ease-in-out infinite;
}

@keyframes wheel-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes mascot-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

/* —— Layout —— */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 1.15rem;
  align-items: start;
}

.main-col,
.side-col {
  min-width: 0;
}

.side-col {
  position: sticky;
  top: 1rem;
}

.card {
  position: relative;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: var(--radius);
  padding: 1.2rem 1.3rem 1.35rem;
  margin-top: 1rem;
  box-shadow: 6px 6px 0 var(--ink-soft);
}

.main-col > .card:first-child,
.side-col > .card:first-child {
  margin-top: 0;
}

.card-kicker {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--orange-deep);
  margin-bottom: 0.35rem;
}

.card h2 {
  margin: 0 0 0.55rem;
  font-family: var(--font-display);
  font-size: 1.42rem;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.muted,
.hint {
  color: var(--muted);
}

.hint {
  margin: 0 0 0.65rem;
  font-size: 0.9rem;
}

.history-hint,
.board-hint {
  margin-top: -0.15rem;
  margin-bottom: 0.75rem;
}

/* —— Prompt —— */
.prompt-box {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  background: var(--sky-soft);
  border-radius: 14px;
  padding: 0.85rem 0.95rem;
  border: 2px solid var(--ink);
}

.prompt-box code {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--ink);
  word-break: break-word;
}

.copy-btn {
  flex-shrink: 0;
}

.copy-btn.copied {
  color: #0b6b4f !important;
  border-color: #0b6b4f !important;
  background: var(--mint-soft) !important;
  box-shadow: 3px 3px 0 rgba(11, 107, 79, 0.35) !important;
}

/* —— Drop zone —— */
.drop-surface {
  border: 2.5px dashed rgba(51, 50, 92, 0.4);
  border-radius: 16px;
  padding: 1.75rem 1.1rem 1.4rem;
  text-align: center;
  background: rgba(207, 238, 255, 0.45);
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
  cursor: pointer;
}

.drop-surface:hover,
.drop-surface:focus-visible {
  border-color: var(--ink);
  outline: none;
  box-shadow: 0 0 0 4px var(--sky-soft);
}

#drop.drag .drop-surface {
  border-color: var(--orange-deep);
  border-style: solid;
  background: #fff3d6;
  transform: translateY(-2px) scale(1.01);
}

.drop-wheel {
  width: 52px;
  height: 52px;
  margin: 0 auto 0.75rem;
  border-radius: 50%;
  border: 3.5px solid var(--ink);
  background: var(--yellow);
  position: relative;
  display: grid;
  place-items: center;
}

#drop.drag .drop-wheel {
  animation: wheel-spin 0.9s linear infinite;
}

.drop-wheel::before,
.drop-wheel::after {
  content: "";
  position: absolute;
  background: rgba(51, 50, 92, 0.55);
}

.drop-wheel::before {
  width: 2.5px;
  height: 100%;
}

.drop-wheel::after {
  width: 100%;
  height: 2.5px;
}

.drop-wheel .hub {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--orange);
  border: 2px solid var(--ink);
  z-index: 1;
}

.drop-title {
  margin: 0 0 0.3rem;
  font-weight: 700;
  font-size: 1.08rem;
  color: var(--ink);
}

.drop-actions {
  justify-content: center;
  margin-top: 0.95rem;
}

.file-name {
  margin: 0.8rem 0 0;
  font-size: 0.86rem;
  word-break: break-all;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-top: 0.85rem;
}

/* —— Buttons —— */
button,
.file-btn {
  appearance: none;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  padding: 0.68rem 1.2rem;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  background: var(--yellow);
  color: var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

button.btn-ghost,
.btn-ghost {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  font-weight: 700;
  padding: 0.5rem 0.95rem;
  font-size: 0.85rem;
}

button:hover,
.file-btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 var(--ink);
}

button:active,
.file-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

button:focus-visible,
.file-btn:focus-visible,
.drop-surface:focus-visible {
  outline: 3px solid var(--sky);
  outline-offset: 3px;
}

.file-btn input {
  display: none;
}

#status {
  min-height: 1.4em;
  margin: 0.85rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

#status.error {
  color: var(--red);
  font-weight: 600;
}

#result[hidden],
#upload-panel[hidden] {
  display: none !important;
}

/* —— Score —— */
.result-card {
  border-color: var(--orange-deep);
  box-shadow: 6px 6px 0 rgba(242, 122, 36, 0.28);
}

.score-stage {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 1.75rem;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0 0.25rem;
}

.score-ring {
  position: relative;
  width: min(200px, 70vw);
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  align-content: center;
  background: radial-gradient(circle at 50% 42%, #fff3c8, #ffe9a8);
  border: 4px solid var(--ink);
}

.score-ring::after {
  content: "";
  position: absolute;
  inset: -15px;
  border-radius: 50%;
  border: 3px dashed rgba(51, 50, 92, 0.3);
  animation: wheel-spin 26s linear infinite;
}

.score-num {
  font-family: var(--font-display);
  font-size: clamp(2.7rem, 8vw, 3.7rem);
  font-weight: 400;
  line-height: 1;
  color: var(--orange-deep);
  font-variant-numeric: tabular-nums;
}

.score-label {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 700;
}

.score-meta {
  text-align: center;
  min-width: 10rem;
}

.tier {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
  margin-bottom: 0.45rem;
}

.badge {
  display: inline-block;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.88rem;
  border: 2px solid var(--ink);
}

.badge.good {
  color: #0b6b4f;
  background: var(--mint-soft);
  border-color: #0b6b4f;
}

.badge.bad {
  color: #c2244f;
  background: var(--pink-soft);
  border-color: #c2244f;
}

.baseline-line {
  margin-top: 0.65rem;
  max-width: 16rem;
}

.features {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1rem;
  justify-content: center;
}

.chip {
  font-size: 0.8rem;
  background: var(--sky-soft);
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  padding: 0.28rem 0.72rem;
}

.chip b {
  color: var(--orange-deep);
  margin-right: 0.28rem;
  font-weight: 700;
}

.hits {
  margin-top: 1rem;
  text-align: left;
  background: #fff;
  border-radius: 14px;
  padding: 0.9rem 1rem;
  border: 2px dashed rgba(51, 50, 92, 0.3);
  font-size: 0.92rem;
}

.hits ul {
  margin: 0.4rem 0 0;
  padding-left: 1.15rem;
}

.hits li {
  margin: 0.2rem 0;
}

.preview-wrap {
  margin-top: 1rem;
}

.preview-label {
  margin: 0 0 0.4rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.preview-box {
  width: 100%;
  aspect-ratio: 800 / 500;
  overflow: hidden;
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  background: #fff;
}

#preview {
  width: 800px;
  height: 500px;
  border: 0;
  transform-origin: top left;
  display: block;
  overflow: hidden;
}

/* —— Rank form —— */
.rank-row {
  margin-top: 0.5rem;
}

#nickname {
  flex: 1;
  min-width: 160px;
  border-radius: 999px;
  border: 2.5px solid var(--ink);
  background: #fff;
  color: var(--ink);
  padding: 0.68rem 1.05rem;
  font-family: inherit;
  font-size: 0.95rem;
}

#nickname::placeholder {
  color: rgba(107, 106, 140, 0.7);
}

#nickname:focus {
  outline: none;
  box-shadow: 0 0 0 4px var(--sky-soft);
}

/* —— History —— */
.history {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.65rem;
}

.history-item {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  text-align: left;
  border-radius: 14px;
  background: #fff;
  border: 2px solid var(--ink);
  color: var(--ink);
  padding: 0.7rem 0.85rem;
  box-shadow: 3px 3px 0 var(--ink-soft);
  font-weight: 500;
}

.history-item:hover {
  filter: none;
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--ink-soft);
}

.h-score {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--orange-deep);
  min-width: 2.3rem;
  font-variant-numeric: tabular-nums;
}

.h-meta {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.h-meta strong {
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.h-meta small {
  color: var(--muted);
  font-size: 0.75rem;
}

/* —— 领奖台：前三名沙盒缩略图 —— */
.podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 0.5rem 0 0.85rem;
}

.podium-card {
  position: relative;
  margin: 0;
  background: #fff;
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  padding: 0.7rem 0.35rem 0.5rem;
  box-shadow: 4px 4px 0 var(--ink-soft);
  text-align: center;
}

.podium-card.medal-1 {
  border-color: #e0a800;
  box-shadow: 4px 4px 0 rgba(224, 168, 0, 0.35);
}

.podium-card.medal-2 {
  border-color: #9aa0a6;
}

.podium-card.medal-3 {
  border-color: #c0763a;
}

.medal {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2.5px solid var(--ink);
  font-family: var(--font-display);
  font-size: 0.95rem;
  line-height: 1;
  display: grid;
  place-items: center;
  color: var(--ink);
}

.medal-1 .medal {
  background: var(--yellow);
}

.medal-2 .medal {
  background: #d3d1c7;
}

.medal-3 .medal {
  background: #e0a96d;
}

.podium-thumb {
  width: 100%;
  aspect-ratio: 800 / 500;
  overflow: hidden;
  border-radius: 6px;
  border: 1.5px solid rgba(51, 50, 92, 0.25);
  background: #fff;
}

.podium-thumb iframe {
  width: 800px;
  height: 500px;
  border: 0;
  transform-origin: top left;
  pointer-events: none;
}

.podium-card figcaption {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  margin-top: 0.4rem;
}

.podium-card figcaption strong {
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.podium-score {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--orange-deep);
}

.podium-card figcaption small {
  color: var(--muted);
  font-size: 0.68rem;
}

/* —— Leaderboard —— */
.leaderboard-card {
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  background: var(--paper);
}

.board-head {
  justify-content: space-between;
  margin-top: 0;
  margin-bottom: 0.15rem;
  align-items: flex-start;
}

.board-head h2 {
  margin: 0;
}

.leaderboard-card .leaderboard {
  overflow: auto;
  flex: 1;
  min-height: 12rem;
  padding-right: 0.2rem;
  margin-top: 0.15rem;
}

.leaderboard .entry {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr) 3.2rem 2.5rem;
  gap: 0.35rem;
  padding: 0.55rem 0.35rem;
  border-bottom: 2px dashed rgba(51, 50, 92, 0.12);
  align-items: center;
  font-size: 0.88rem;
  border-radius: 8px;
  transition: background 0.12s ease;
}

.leaderboard .entry:hover {
  background: #fff6da;
}

.leaderboard .entry:first-child .rank {
  color: var(--orange-deep);
  text-shadow: 2px 2px 0 rgba(255, 210, 63, 0.6);
}

.leaderboard .rank {
  color: var(--sky);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.leaderboard .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard .pts {
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.leaderboard .flag {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: right;
}

/* —— Gallery：抽象展厅（顶部横排，手机端也保持三列） —— */
.gallery {
  margin: 0.25rem 0 1.75rem;
}

.gallery-head {
  text-align: center;
}

.gallery-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.1rem;
  margin-top: 0.85rem;
}

.specimen {
  margin: 0;
  background: #fff;
  border: 2.5px solid var(--ink);
  border-radius: 10px;
  padding: 0.55rem 0.55rem 0.2rem;
  box-shadow: 6px 6px 0 var(--ink-soft);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.specimen.tilt-l {
  transform: rotate(-1.6deg);
}

.specimen.tilt-r {
  transform: rotate(1.4deg);
}

.specimen:hover {
  transform: rotate(0deg) translateY(-4px);
  box-shadow: 8px 8px 0 var(--ink-soft);
  z-index: 1;
  position: relative;
}

/* 展品原作按 800×500 视口排版，再按容器宽 scale，避免内部 reflow 偏移 */
.specimen-frame {
  width: 100%;
  aspect-ratio: 800 / 500;
  overflow: hidden;
  border-radius: 4px;
  border: 1.5px solid rgba(51, 50, 92, 0.25);
  background: #fff;
  position: relative;
}

.specimen-frame iframe {
  width: 800px;
  height: 500px;
  border: 0;
  transform-origin: top left;
  pointer-events: none;
  /* 初始 scale 由 JS fitThumb 写入；先给一个合理兜底避免闪一下 */
  transform: scale(0.25);
}

.specimen figcaption {
  padding: 0.55rem 0.35rem 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
}

.site-foot {
  margin-top: 2rem;
  text-align: center;
  color: rgba(107, 106, 140, 0.85);
  font-size: 0.8rem;
}

.site-foot #visits {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--orange-deep);
}

.site-foot p {
  margin: 0;
}

.foot-heart {
  color: var(--pink);
  margin: 0 0.15rem;
}

/* —— Mobile —— */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .top-bar {
    padding: 0.5rem 0.7rem 0;
  }

  .rss-link {
    padding: 0.5rem 0.85rem;
    font-size: 0.82rem;
  }

  .specimen.tilt-l {
    transform: rotate(-1deg);
  }

  .specimen.tilt-r {
    transform: rotate(0.9deg);
  }

  .side-col {
    position: static;
  }

  .leaderboard-card {
    max-height: none;
  }

  .leaderboard-card .leaderboard {
    max-height: 420px;
  }

  .hero {
    margin-bottom: 1rem;
    flex-direction: column;
    align-items: center;
  }

  .gallery-grid {
    gap: 0.55rem;
  }

  .mascot {
    width: min(190px, 60vw);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .mascot .wheel,
  .mascot .mascot-bird,
  .score-ring::after,
  #drop.drag .drop-wheel {
    animation: none;
  }

  button,
  .file-btn,
  .drop-surface,
  .history-item,
  .specimen,
  .leaderboard .entry {
    transition: none;
  }
}
