:root {
  --bg: #0b0820;
  --bg-2: #16103a;
  --line: rgba(170, 150, 255, .18);
  --text: #efeaff;
  --muted: #9a93b8;
  --pink: #ff4fd8;
  --cyan: #36e6ff;
  --gold: #f5c451;
  --red: #ff5a6a;
  --tabs-h: 64px;
  --radius: 18px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 85% 40%, rgba(255, 79, 216, .08), transparent 60%),
    radial-gradient(900px 600px at 0% 80%, rgba(54, 230, 255, .07), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 17px/1.75 "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom));
  overflow-x: hidden;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.35; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img { display: block; max-width: 100%; }
a { color: var(--cyan); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 6px; }

[hidden] { display: none !important; }

.vh {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap;
}

.due { color: var(--red); font-weight: 700; font-variant-numeric: tabular-nums; }
.tbd { font-size: .8em; color: var(--muted); }
.gold-text { color: var(--gold); font-weight: 700; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 78vh;
  min-height: 78svh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  isolation: isolate;
}
.hero__bg, .hero__bg img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: -3;
}
.hero__light {
  position: absolute; inset: -10% -20% 20%;
  background: url(img/kv/light.webp) center top / cover no-repeat;
  mix-blend-mode: screen;
  opacity: .75;
  z-index: -2;
  transform-origin: 50% 0;
  animation: sway 9s ease-in-out infinite alternate;
}
.hero__snow {
  position: absolute; inset: 0;
  background: url(img/kv/snow.png) center / 520px auto repeat;
  mix-blend-mode: screen;
  opacity: .55;
  z-index: -2;
  animation: drift 40s linear infinite;
}
.hero::after {
  content: "";
  position: absolute; inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(11, 8, 32, 0) 30%, rgba(11, 8, 32, .7) 65%, var(--bg) 100%),
    linear-gradient(90deg, rgba(11, 8, 32, .55), transparent 70%);
}
.hero__inner {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 20px 36px;
}
.hero h1 { display: flex; flex-direction: column; gap: 4px; }
.h1-pre {
  white-space: nowrap;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: .12em;
  color: var(--cyan);
  text-shadow: 0 0 12px rgba(54, 230, 255, .6);
}
.h1-main {
  font-size: clamp(1.25rem, 8.2vw, 4.5rem);
  white-space: nowrap;
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: .02em;
  background: linear-gradient(100deg, #fff 0%, #ffd6f6 30%, var(--pink) 60%, #b388ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 79, 216, .55));
  animation: flicker 7s linear infinite;
}
.countdown {
  margin-top: 18px;
  white-space: nowrap;
  max-width: 100%;
  line-height: 1.3;
  font-size: clamp(1.1rem, 6.6vw, 2.2rem);
}
.countdown-due {
  margin-top: 4px;
  white-space: nowrap;
  font-size: clamp(.8rem, 3.6vw, 1rem);
  opacity: .85;
}
.countdown-due[hidden] { display: none; }
.countdown__n {
  font-size: 1.3em;
  line-height: 1;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #fff;
  text-shadow: 0 0 8px var(--pink), 0 0 26px rgba(255, 79, 216, .8);
}
.countdown[hidden] { display: none; }
.countdown .due { text-shadow: 0 0 12px rgba(255, 90, 106, .55); }

/* ---------- Tabs ---------- */
.tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(14, 10, 40, .88);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tabs__list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: var(--tabs-h);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  text-decoration: none;
  font-size: .82rem;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
  transition: color .2s;
}
.tab svg {
  width: 24px; height: 24px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.tab[aria-selected="true"] {
  color: #fff;
}
.tab[aria-selected="true"] svg {
  stroke: var(--pink);
  filter: drop-shadow(0 0 6px var(--pink));
}

/* ---------- Layout ---------- */
.wrap { max-width: 760px; margin: 0 auto; padding: 32px 20px 56px; }
.wrap--wide { max-width: 1040px; }
.panel { outline: none; }
.js .panel:not([hidden]) { animation: rise .35s ease-out; }
.block + .block { margin-top: 56px; }

h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 20px;
  display: inline-block;
  padding-bottom: 6px;
  background: linear-gradient(90deg, var(--pink), var(--cyan)) left bottom / 100% 3px no-repeat;
}
h3 { font-size: 1.2rem; font-weight: 700; }

.card, .prop, .kv-grid > div, .steps li, .rows li, .callout, .tip, .src {
  background: linear-gradient(160deg, var(--bg-2), rgba(11, 8, 32, .9));
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.card { padding: 20px; }
.gold {
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 1px rgba(245, 196, 81, .2), 0 0 24px rgba(245, 196, 81, .22);
}

/* 重點 */
.lead { font-size: 1.12rem; margin-bottom: 28px; }
.props { display: grid; gap: 14px; }
.prop { padding: 18px 20px; }
.prop__k {
  display: block;
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--cyan);
  margin-bottom: 4px;
}
.prop.gold .prop__k { color: var(--gold); }
.prop__v { font-size: 1.06rem; }

.kv-grid { display: grid; gap: 12px; margin: 0; }
.kv-grid > div { padding: 16px 20px; }
.kv-grid dt { font-size: .85rem; font-weight: 700; color: var(--pink); letter-spacing: .08em; }
.kv-grid dd { margin: 2px 0 0; font-size: 1.06rem; }

.steps { counter-reset: step; display: grid; gap: 14px; }
.steps li {
  counter-increment: step;
  position: relative;
  padding: 20px 20px 20px 72px;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 18px; top: 18px;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 2px solid var(--pink);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 0 12px rgba(255, 79, 216, .6), inset 0 0 8px rgba(255, 79, 216, .5);
}
.steps h3 { margin-bottom: 6px; }

/* 每週任務 */
.todo { display: grid; gap: 12px; }
.todo__item h3 { font-size: 1.1rem; margin-bottom: 8px; }
.todo__item dl { margin: 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; }
.todo__item dd { margin: 0; }
.todo__reset dd { font-variant-numeric: tabular-nums; font-weight: 600; }
.tip {
  margin-top: 16px;
  padding: 18px 20px;
  border-style: dashed;
  border-color: rgba(54, 230, 255, .4);
}

.caption { color: var(--cyan); margin: -8px 0 20px; }
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 7px; top: 10px; bottom: 10px;
  width: 2px;
  background: linear-gradient(var(--cyan), var(--pink), var(--red));
  box-shadow: 0 0 8px rgba(54, 230, 255, .5);
}
.timeline li { position: relative; padding: 0 0 22px 8px; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -27px; top: 9px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}
.timeline time {
  display: block;
  font-weight: 800;
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
  color: var(--cyan);
}
.timeline time.due { color: var(--red); }
.timeline .is-gold::before { border-color: var(--gold); background: var(--gold); box-shadow: 0 0 12px var(--gold); }
.timeline .is-gold time { color: var(--gold); }
.timeline .is-end { padding-bottom: 0; }
.timeline .is-end::before {
  width: 20px; height: 20px;
  left: -30px; top: 10px;
  border-color: var(--red); background: var(--red);
  box-shadow: 0 0 16px var(--red);
}
.timeline .is-end time { font-size: 1.6rem; text-shadow: 0 0 14px rgba(255, 90, 106, .6); }
.note { margin-top: 24px; padding-left: 14px; border-left: 3px solid var(--line); }

/* 獎勵 */
.sub + .sub { margin-top: 48px; }
.sub > h3 {
  font-size: 1.25rem;
  margin-bottom: 16px;
  padding-left: 12px;
  border-left: 4px solid var(--pink);
}
.sub__text { margin-top: 16px; }
.banner {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  margin-bottom: 16px;
  filter: drop-shadow(0 0 22px rgba(255, 79, 216, .3));
}

.items, .buffs, .tiers { display: grid; gap: 14px; }
.item { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.thumb {
  aspect-ratio: 4 / 3;
  background: radial-gradient(circle at 50% 40%, #241a55, #0d0a26);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--line);
}
.thumb img { width: 100%; height: 100%; object-fit: contain; padding: 12px; }
#shop .thumb img { image-rendering: crisp-edges; image-rendering: pixelated; }
.thumb--cover img { object-fit: cover; padding: 0; }
.thumb--trio { gap: 6px; padding: 0 10px; }
.thumb--trio img { width: 33%; padding: 6px 0; }
/* 同比例縮放（海報 L/M/S）：shop_extract.py 在各 img 上寫入 --w / --h（輸出像素，同一倍數）。
   flex-grow 依 --w 分配寬度（basis 0），三張寬度比 = 輸出像素比，不論卡片多寬都維持 S < M < L；
   高度由 aspect-ratio 推得，底部對齊。 */
.thumb--trio.thumb--scale { gap: 6px; padding: 0 8px; align-items: flex-end; }
.thumb--trio.thumb--scale img {
  flex: var(--w) 1 0px;
  min-width: 0;
  width: auto;
  height: auto;
  aspect-ratio: var(--w) / var(--h);
  object-fit: contain;
  padding: 0;
  margin-bottom: 14%;
}
.thumb--duo { gap: 8px; padding: 0 12px; }
.thumb--duo img { width: 50%; padding: 10px 0; }
/* 爵士鼓＋吉他：同比例，寬度依 --w 分配，垂直置中。 */
.thumb--duo.thumb--scale { padding: 0 12px; }
.thumb--duo.thumb--scale img {
  flex: var(--w) 1 0px;
  min-width: 0;
  width: auto;
  height: auto;
  aspect-ratio: var(--w) / var(--h);
  object-fit: contain;
  padding: 0;
}
/* 舞蹈 6 格：兩列同一比例。每張寬 = 內容寬 × --w / 699（第一列輸出寬總和 138+255+306），
   第二列（162+162+159）用同一分母所以角色大小一致；-1px 避免第一列因次像素誤差換行。 */
.thumb--grid { flex-wrap: wrap; align-content: center; align-items: flex-end; gap: 4px 3px; padding: 6px 8px; }
.thumb--grid img {
  width: calc((100% - 6px - 1px) * var(--w) / 699);
  height: auto;
  aspect-ratio: var(--w) / var(--h);
  padding: 0;
}
.thumb--empty {
  background: rgba(255, 255, 255, .02);
  border-bottom: 1px solid var(--line);
  position: relative;
}
.thumb--empty::after {
  content: "";
  position: absolute; inset: 18px;
  border: 2px dashed rgba(170, 150, 255, .2);
  border-radius: 12px;
}
.item__body { padding: 16px 20px 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.item__name { font-size: 1.12rem; width: 100%; }
.item__desc { width: 100%; }
.item__desc + .chip, .chip + .item__desc { margin-top: 2px; }

.chip {
  display: inline-block;
  padding: 2px 12px;
  border-radius: 999px;
  border: 1px solid rgba(54, 230, 255, .45);
  color: var(--cyan);
  font-size: .9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.gold .chip { border-color: var(--gold); color: var(--gold); }
.chip--price {
  font-size: 1.1rem;
  border-color: var(--pink);
  color: #fff;
  background: rgba(255, 79, 216, .14);
}
.chip--sm { font-size: .82rem; color: var(--muted); border-color: var(--line); }

.buff h4 { font-size: 1.06rem; margin-bottom: 10px; }
.buff__meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.buff__cost { font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: .02em; }

.tier { display: flex; flex-direction: column; gap: 10px; }
.tier__badge {
  align-self: flex-start;
  padding: 4px 16px;
  border-radius: 10px;
  font-weight: 900;
  font-size: 1.1rem;
  letter-spacing: .08em;
  background: linear-gradient(90deg, rgba(255, 79, 216, .25), rgba(54, 230, 255, .2));
  border: 1px solid var(--line);
}
.tier.gold .tier__badge {
  background: linear-gradient(90deg, #f5c451, #ffe9a8);
  color: #2a1a00;
  border-color: var(--gold);
}

/* 注意事項 */
.callout {
  padding: 20px;
  border-left: 5px solid var(--red);
  background: linear-gradient(160deg, rgba(255, 90, 106, .12), rgba(11, 8, 32, .9));
  margin-bottom: 20px;
}
.callout__lead { font-size: 1.3rem; font-weight: 800; margin-bottom: 6px; }
.rows { display: grid; gap: 12px; }
.rows li { padding: 18px 20px; }
.rows h3 { font-size: 1.1rem; margin-bottom: 6px; }

.sources { display: grid; gap: 10px; }
.src {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 12px;
  padding: 16px 20px;
  text-decoration: none;
  transition: border-color .2s, box-shadow .2s;
}
.src:hover { border-color: var(--cyan); box-shadow: 0 0 16px rgba(54, 230, 255, .25); }
.src__title { width: 100%; color: var(--text); font-weight: 700; }
.src__site, .src__date { color: var(--muted); font-size: .9rem; }
.src__site { word-break: break-all; }

/* ---------- Wider screens ---------- */
@media (min-width: 600px) {
  .kv-grid { grid-template-columns: 1fr 1fr; }
  .items, .tiers { grid-template-columns: 1fr 1fr; }
  .tiers .tier.gold { grid-column: 1 / -1; }
}

@media (min-width: 900px) {
  body { font-size: 18px; padding-bottom: 0; }
  .hero { min-height: min(80vh, 720px); }
  .hero__inner { padding: 0 32px 56px; }
  .h1-pre { font-size: 1.3rem; }

  .tabs {
    position: sticky;
    top: 0; bottom: auto;
    padding: 12px 0;
    background: rgba(11, 8, 32, .78);
    border-top: 0;
    border-bottom: 1px solid var(--line);
  }
  .tabs__list {
    height: auto;
    max-width: 640px;
    margin: 0 auto;
    padding: 6px;
    gap: 6px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(22, 16, 58, .8);
  }
  .tab {
    flex-direction: row;
    gap: 8px;
    padding: 10px 0;
    border-radius: 999px;
    font-size: 1rem;
    transition: color .2s, background .2s, box-shadow .2s;
  }
  .tab svg { width: 20px; height: 20px; }
  .tab:hover { color: #fff; }
  .tab[aria-selected="true"] {
    background: linear-gradient(90deg, rgba(255, 79, 216, .35), rgba(179, 136, 255, .3));
    box-shadow: 0 0 18px rgba(255, 79, 216, .45), inset 0 0 0 1px rgba(255, 79, 216, .7);
  }
  .tab[aria-selected="true"] svg { stroke: #fff; }
  html { scroll-padding-top: 96px; }

  .wrap { padding: 56px 32px 80px; }
  .block + .block { margin-top: 80px; }
  .items { grid-template-columns: repeat(3, 1fr); }
  .buffs { grid-template-columns: 1fr 1fr; }
  .buffs .buff:last-child { grid-column: 1 / -1; }
  .sources { grid-template-columns: 1fr 1fr; }
}

/* ---------- Motion ---------- */
@keyframes sway { from { transform: rotate(-3deg); } to { transform: rotate(3deg); } }
@keyframes drift { from { background-position: 0 0; } to { background-position: 0 520px; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes flicker {
  0%, 18%, 20%, 22%, 62%, 64%, 100% { opacity: 1; }
  19%, 21%, 63% { opacity: .55; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.credit { padding: 8px 16px 20px; text-align: center; font-size: 12px; color: var(--muted); }

/* 非官方聲明橫條 */
.fan-notice {
  background: #0b0820;
  color: #e9e6ff;
  border-bottom: 1px solid rgba(255, 255, 255, .18);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  padding: 6px 8px;
}

/* 來源：普通文字連結，不做按鈕外觀 */
.src, .src:hover {
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 4px 0;
}
.src__title { text-decoration: underline; text-underline-offset: 3px; }
