:root {
  --space: #06131d;
  --space-soft: #102b34;
  --ink: #fff8e8;
  --muted: #b9ceca;
  --gold: #ffe09a;
  --gold-hot: #ffb85d;
  --coral: #ff8497;
  --red: #e95859;
  --jade: #6fd7bd;
  --line: rgba(255, 231, 177, .28);
  --panel: rgba(7, 26, 36, .88);
  --glow: 0 0 10px rgba(255, 241, 201, .34);
  color-scheme: dark;
}

* { box-sizing: border-box; letter-spacing: 0; }
html { min-width: 320px; background: var(--space); }
body {
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
body, button, input, code { text-shadow: var(--glow); }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
[hidden] { display: none !important; }

#starBg { position: fixed; inset: 0; z-index: -4; width: 100%; height: 100%; }
.sky-wash {
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  background:
    radial-gradient(circle at 24% 52%, rgba(255, 194, 101, .11), transparent 27%),
    radial-gradient(circle at 80% 22%, rgba(111, 215, 189, .08), transparent 24%),
    linear-gradient(180deg, rgba(6, 19, 29, .02), rgba(3, 11, 17, .72));
}

.experience { width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 28px 0 38px; }
.event-header { position: relative; z-index: 2; text-align: center; }
.event-kicker { display: inline-flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; font-weight: 700; }
.event-kicker i { width: 22px; height: 1px; background: var(--line); }
.event-kicker span:nth-of-type(1) { color: var(--coral); }
.event-kicker span:nth-of-type(2) { color: var(--gold); }
.event-kicker span:nth-of-type(3) { color: #ff746c; }
.opening-line { margin: 16px 0 2px; color: #fff0c7; font-family: "STKaiti", "KaiTi", serif; font-size: clamp(20px, 3vw, 30px); }
h1 { margin: 0; color: #fff9e8; font-family: "STKaiti", "KaiTi", serif; font-size: clamp(38px, 6vw, 62px); line-height: 1.12; text-shadow: 0 0 13px rgba(255, 228, 151, .72), 0 0 34px rgba(255, 132, 151, .2); }
.deadline { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 8px 12px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.deadline strong { color: var(--jade); font-size: 14px; font-variant-numeric: tabular-nums; }

.lottery-stage { display: grid; grid-template-columns: minmax(320px, .9fr) minmax(430px, 1.1fr); align-items: center; gap: clamp(24px, 6vw, 76px); min-height: 510px; margin-top: 8px; }
.moon-scene { position: relative; width: min(100%, 440px); aspect-ratio: 1; justify-self: center; }
.moon-orbit { position: absolute; inset: 5%; border: 1px solid rgba(255, 223, 151, .26); border-radius: 50%; box-shadow: 0 0 38px rgba(255, 203, 98, .15), inset 0 0 42px rgba(255, 199, 90, .08); animation: breathe 4s ease-in-out infinite; }
.festival-moon { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 0 16px rgba(255, 223, 137, .68)) drop-shadow(0 0 44px rgba(255, 154, 94, .2)); animation: moon-float 6s ease-in-out infinite; }
.moon-star { position: absolute; color: var(--gold); font-size: 22px; text-shadow: 0 0 11px currentColor; animation: twinkle 2.4s ease-in-out infinite; }
.star-one { top: 8%; right: 5%; }.star-two { bottom: 14%; left: 2%; color: var(--coral); animation-delay: -1.1s; }

.draw-console { position: relative; padding: clamp(22px, 4vw, 36px); border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: 0 20px 70px rgba(0, 0, 0, .3), inset 0 0 35px rgba(111, 215, 189, .035); backdrop-filter: blur(16px); }
.draw-console::before { content: "✦"; position: absolute; top: -12px; left: 25px; color: var(--gold); font-size: 21px; text-shadow: 0 0 12px currentColor; }
.console-heading { display: flex; align-items: start; justify-content: space-between; gap: 18px; margin-bottom: 25px; }
.eyebrow { color: var(--jade); font-size: 10px; font-weight: 800; }
.console-heading h2, dialog h2 { margin: 5px 0 0; color: #fff5da; font-family: "STKaiti", "KaiTi", serif; font-size: 25px; }
.text-button { min-height: 34px; padding: 0; border: 0; border-bottom: 1px solid rgba(111, 215, 189, .45); color: var(--jade); background: transparent; cursor: pointer; font-size: 12px; }
label { display: block; margin-bottom: 8px; color: #d5e3df; font-size: 12px; }
.key-field { display: grid; grid-template-columns: 1fr 44px; min-width: 0; border: 1px solid rgba(111, 215, 189, .3); border-radius: 5px; background: rgba(2, 13, 20, .72); transition: border-color .2s, box-shadow .2s; }
.key-field:focus-within { border-color: var(--jade); box-shadow: 0 0 20px rgba(111, 215, 189, .12); }
.key-field input { min-width: 0; height: 46px; padding: 0 13px; border: 0; outline: 0; color: #fff; background: transparent; text-overflow: ellipsis; }
.key-field input::placeholder { color: #69807f; }
.icon-button { display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 4px; color: var(--muted); background: transparent; cursor: pointer; font-size: 18px; }

.star-button { position: relative; isolation: isolate; width: 100%; min-height: 49px; margin-top: 16px; overflow: hidden; border: 1px solid rgba(255, 224, 154, .62); border-radius: 6px; color: #fff8e8; background: #254b58; box-shadow: inset 0 0 22px rgba(111, 215, 189, .13), 0 0 18px rgba(255, 210, 119, .09); cursor: pointer; font-weight: 800; }
.star-button::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(110deg, rgba(255, 132, 151, .17), transparent 36%, rgba(111, 215, 189, .22)); transform: translateX(-65%); transition: transform .35s ease; }
.star-button:hover::before { transform: translateX(0); }
.star-button:disabled { cursor: not-allowed; opacity: .45; }
.button-stars { position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-around; color: rgba(255, 233, 180, .32); font-size: 11px; pointer-events: none; }
.star-button span:last-child { position: relative; }

.eligibility { margin-top: 22px; padding-top: 21px; border-top: 1px solid rgba(255, 255, 255, .1); }
.token-identity { display: grid; grid-template-columns: 46px minmax(0, 1fr); align-items: center; gap: 11px; margin-bottom: 18px; }
.site-badge { display: grid; place-items: center; width: 46px; height: 34px; border: 1px solid rgba(111, 215, 189, .38); border-radius: 4px; color: var(--jade); background: rgba(111, 215, 189, .08); font-size: 11px; font-weight: 900; }
.site-badge[data-site="iai"] { border-color: rgba(255, 132, 151, .42); color: var(--coral); background: rgba(255, 132, 151, .08); }
.token-identity small { display: block; color: var(--muted); font-size: 10px; }
.token-identity strong { display: block; max-width: 100%; margin-top: 3px; overflow: hidden; color: #fff3d2; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.quota-row { display: flex; align-items: baseline; justify-content: space-between; color: var(--muted); font-size: 12px; }
.quota-row strong { color: var(--gold); }.quota-row b { font-size: 30px; font-variant-numeric: tabular-nums; }
.quota-track { height: 4px; margin: 10px 0; overflow: hidden; border-radius: 2px; background: rgba(255, 255, 255, .09); }
.quota-track i { display: block; width: 0; height: 100%; background: var(--jade); box-shadow: 0 0 12px var(--jade); transition: width .5s ease; }
.quota-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; color: #8fa9a5; font-size: 10px; }
.merge-notice { margin: 14px 0 0; padding: 10px 11px; border-left: 2px solid var(--coral); color: #ffd6d9; background: rgba(255, 132, 151, .08); font-size: 11px; line-height: 1.65; }
.secure-note { margin: 17px 0 0; color: #88a09d; text-align: center; font-size: 10px; }
.secure-note span { color: var(--coral); }

.meteor-reveal { position: fixed; inset: 0; z-index: 30; display: none; overflow: hidden; pointer-events: none; background: rgba(2, 8, 14, .34); }
.meteor-reveal.active { display: block; }
.meteor-core { position: absolute; top: -8vh; right: -8vw; width: 16px; height: 16px; border-radius: 50%; background: #fffce8; box-shadow: 0 0 14px #fff, 0 0 35px var(--gold-hot), 0 0 70px var(--coral); animation: meteor-flight 1.55s cubic-bezier(.12, .72, .28, 1) forwards; }
.meteor-tail { position: absolute; top: -8vh; right: -8vw; width: 42vw; max-width: 620px; height: 5px; transform: rotate(-34deg); transform-origin: right; background: linear-gradient(90deg, transparent, rgba(111, 215, 189, .34), #fff3bd); filter: blur(1px); animation: meteor-flight 1.55s cubic-bezier(.12, .72, .28, 1) forwards; }
.meteor-result { position: absolute; top: 48%; left: 50%; width: min(660px, calc(100% - 32px)); transform: translate(-50%, -50%) scale(.86); opacity: 0; color: #fff7dc; font-family: "STKaiti", "KaiTi", serif; font-size: clamp(19px, 4vw, 34px); text-align: center; text-shadow: 0 0 10px #fff, 0 0 28px var(--gold-hot), 0 0 55px var(--coral); animation: meteor-words 1.55s .5s ease both; }
.meteor-sparks i { position: absolute; top: 48%; left: 50%; width: 5px; height: 5px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 9px currentColor; animation: sparks 1.1s .65s ease-out both; }
.meteor-sparks i:nth-child(2) { --x: 96px; --y: -48px; color: var(--jade); }.meteor-sparks i:nth-child(3) { --x: -88px; --y: 44px; color: var(--coral); }.meteor-sparks i:nth-child(4) { --x: 44px; --y: 72px; }.meteor-sparks i:nth-child(5) { --x: -54px; --y: -75px; color: #fff; }

dialog { width: min(520px, calc(100% - 28px)); max-height: calc(100dvh - 30px); overflow: auto; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #0a222c; box-shadow: 0 28px 100px rgba(0, 0, 0, .62), inset 0 0 42px rgba(111, 215, 189, .04); }
dialog::backdrop { background: rgba(1, 7, 11, .78); backdrop-filter: blur(6px); }
.result-dialog { padding: 36px; text-align: center; }
.dialog-close { position: absolute; top: 8px; right: 8px; }
.result-mark { display: block; color: var(--gold); font-size: 34px; text-shadow: 0 0 18px currentColor; }
.result-overline { margin: 8px 0 0; color: var(--jade); font-size: 10px; font-weight: 800; }
.result-message { margin: 18px auto; color: #e4eeea; line-height: 1.8; }
.result-target { margin: 0; padding: 11px; border-left: 2px solid var(--jade); color: var(--jade); background: rgba(111, 215, 189, .07); font-size: 12px; text-align: left; overflow-wrap: anywhere; }
.draw-id { color: #78928e; font-size: 10px; }
.history-dialog { padding: 25px; }
.history-head { display: flex; align-items: start; justify-content: space-between; margin-bottom: 18px; }
.history-list { display: grid; gap: 1px; background: rgba(255, 255, 255, .1); }
.history-item { display: grid; grid-template-columns: 92px 1fr auto; align-items: center; gap: 12px; min-width: 0; padding: 13px; background: #0c2832; }
.history-item time { color: #819c98; font-size: 10px; }.history-item p { min-width: 0; margin: 0; overflow-wrap: anywhere; font-size: 12px; }.history-item strong { color: var(--gold); font-size: 10px; white-space: nowrap; }
.empty-state { margin: 0; padding: 42px 12px; color: var(--muted); background: #0c2832; text-align: center; font-size: 12px; }
.toast { position: fixed; bottom: max(24px, env(safe-area-inset-bottom)); left: 50%; z-index: 50; max-width: calc(100% - 28px); padding: 11px 17px; transform: translate(-50%, 20px); border: 1px solid rgba(255, 224, 154, .32); border-radius: 5px; opacity: 0; color: #fff4d2; background: #132d35; box-shadow: 0 10px 38px rgba(0, 0, 0, .4); pointer-events: none; text-align: center; font-size: 12px; transition: .22s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@keyframes breathe { 50% { transform: scale(1.025); opacity: .72; } }
@keyframes moon-float { 50% { transform: translateY(-7px); } }
@keyframes twinkle { 50% { transform: scale(.72); opacity: .35; } }
@keyframes meteor-flight { to { top: 78vh; right: 88vw; } }
@keyframes meteor-words { 35%, 72% { transform: translate(-50%, -50%) scale(1); opacity: 1; } 100% { transform: translate(-50%, -54%) scale(1.03); opacity: 0; } }
@keyframes sparks { from { transform: translate(0, 0) scale(.2); opacity: 0; } 30% { opacity: 1; } to { transform: translate(var(--x, 72px), var(--y, -62px)) scale(0); opacity: 0; } }

@media (max-width: 820px) {
  .experience { width: min(620px, calc(100% - 28px)); padding-top: 22px; }
  .lottery-stage { grid-template-columns: 1fr; gap: 4px; min-height: auto; margin-top: 16px; }
  .moon-scene { width: min(72vw, 330px); margin-bottom: -28px; }
  .draw-console { z-index: 2; }
}
@media (max-width: 520px) {
  .experience { width: calc(100% - 20px); padding: 18px 0 24px; }
  .opening-line { margin-top: 12px; }
  .deadline { margin-top: 8px; }
  .moon-scene { width: min(78vw, 300px); margin-bottom: -24px; }
  .draw-console { padding: 21px 16px; }
  .console-heading h2 { font-size: 22px; }
  .quota-meta { display: grid; }
  .result-dialog { padding: 34px 20px 24px; }
  .history-dialog { padding: 20px 13px; }
  .history-item { grid-template-columns: 1fr auto; }
  .history-item time { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
