:root {
  --ink: #fff7ea;
  --muted: rgba(255, 247, 234, 0.66);
  --gold: #f7d67a;
  --gold-strong: #ffcb4d;
  --line: rgba(247, 214, 122, 0.22);
  --panel: linear-gradient(160deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03));
  --shadow: 0 18px 40px rgba(20, 0, 4, 0.38);
  color-scheme: dark;
}

* { box-sizing: border-box; }

/* Author display rules below would otherwise beat the UA [hidden] rule, keeping
   the prize overlay and boot placeholder painted after `hidden = true`. */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(120% 70% at 12% -10%, #8e1728 0%, #5a0d17 42%, #2c0509 100%),
    linear-gradient(180deg, #2c0509, #1b0306);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

.boot {
  min-height: 60vh;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.04em;
}

.boot:not([hidden]) {
  display: grid;
  place-items: center;
}

.app {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 14px 48px;
  flex-direction: column;
  gap: 14px;
}

.app:not([hidden]) { display: flex; }

.hero {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(145deg, #b3162a, #780c19 65%, #5c0712);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero__glow {
  position: absolute;
  inset: -40% -20% auto auto;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 203, 77, 0.34), transparent 68%);
  pointer-events: none;
}

.hero__mark {
  font-size: 34px;
  line-height: 1;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.35));
}

.hero__title {
  margin: 0;
  font-size: 21px;
  letter-spacing: 0.06em;
  background: linear-gradient(180deg, #fff4cf, var(--gold-strong));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__sub {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.badge {
  margin-left: auto;
  padding: 5px 10px;
  font-size: 11px;
  border-radius: 999px;
  color: var(--gold);
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
  white-space: nowrap;
}

.identity {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  padding: 0 4px;
}

.notice {
  width: calc(100% - 28px);
  max-width: 560px;
  margin: 24px auto 0;
  padding: 26px 22px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.notice:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.notice__mark { font-size: 34px; line-height: 1; }

.notice__title {
  margin: 0;
  font-size: 19px;
  letter-spacing: 0.04em;
  color: var(--gold);
}

.notice__lead {
  margin: 0;
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
}

.notice__steps {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
  line-height: 1.95;
  color: var(--ink);
}

.notice__reason {
  margin: 2px 0 0;
  font-size: 12px;
  line-height: 1.7;
  color: rgba(255, 247, 234, 0.46);
  word-break: break-word;
}

.identity__verified {
  margin-left: auto;
  padding: 3px 9px;
  font-size: 11px;
  border-radius: 999px;
  color: var(--gold);
  border: 1px solid var(--line);
}

.identity__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.16);
}

.identity strong { color: var(--ink); font-weight: 600; }

.card {
  padding: 16px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 10px 26px rgba(20, 0, 4, 0.22);
}

.card__title {
  margin: 0 0 12px;
  font-size: 15px;
  letter-spacing: 0.05em;
  color: var(--gold);
}

.compose form { display: flex; flex-direction: column; gap: 12px; }

.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; }

.field__label { font-size: 12px; color: var(--muted); letter-spacing: 0.04em; }

input[type="number"], input[type="text"], select {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  color: var(--ink);
  border-radius: 12px;
  border: 1px solid rgba(247, 214, 122, 0.26);
  background: rgba(0, 0, 0, 0.26);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
  font-family: inherit;
}

input::placeholder { color: rgba(255, 247, 234, 0.34); }

input:focus-visible, select:focus-visible {
  border-color: var(--gold-strong);
  box-shadow: 0 0 0 3px rgba(255, 203, 77, 0.18);
}

.chips { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
  flex: 1 1 0;
  min-width: 56px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--gold);
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
  cursor: pointer;
  font-family: inherit;
}

.chip:hover { border-color: var(--gold-strong); background: rgba(255, 203, 77, 0.12); }

.segmented { display: flex; gap: 8px; }

.segmented label {
  flex: 1;
  position: relative;
  cursor: pointer;
}

.segmented input { position: absolute; opacity: 0; inset: 0; }

.segmented span {
  display: block;
  text-align: center;
  padding: 10px;
  font-size: 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
  color: var(--muted);
}

.segmented input:checked + span {
  color: #4a0a12;
  font-weight: 600;
  border-color: transparent;
  background: linear-gradient(180deg, #ffe19a, var(--gold-strong));
}

.segmented input:focus-visible + span { box-shadow: 0 0 0 3px rgba(255, 203, 77, 0.25); }

.hint { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.6; }

.primary {
  margin-top: 2px;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  color: #4a0a12;
  background: linear-gradient(180deg, #ffe19a, #f4ac1d);
  box-shadow: 0 10px 22px rgba(244, 172, 29, 0.28);
  font-family: inherit;
}

.primary:hover { filter: brightness(1.04); }
.primary:disabled { opacity: 0.55; cursor: progress; box-shadow: none; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat {
  padding: 12px 10px;
  text-align: center;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
}

.stat__value { display: block; font-size: 18px; font-weight: 700; color: var(--gold); }
.stat__label { display: block; margin-top: 3px; font-size: 11px; color: var(--muted); }

.list__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.list__head .card__title { margin: 0; }

.link {
  border: 0;
  background: none;
  color: var(--gold);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 2px;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.packets { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }

.packet {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(247, 214, 122, 0.3);
  background: linear-gradient(150deg, #a8121f, #6d0a17 78%);
  box-shadow: 0 10px 22px rgba(20, 0, 4, 0.3);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.packet[data-status="finished"], .packet[data-status="expired"] {
  background: linear-gradient(150deg, #6f2a33, #471c23 80%);
  border-color: rgba(255, 255, 255, 0.12);
}

.packet__blessing { font-size: 15px; font-weight: 600; letter-spacing: 0.02em; }

.packet__meta { margin-top: 4px; font-size: 11px; color: rgba(255, 247, 234, 0.62); }

.packet__amounts { display: flex; gap: 20px; align-items: flex-end; }

.packet__big { font-size: 20px; font-weight: 700; color: var(--gold-strong); letter-spacing: 0.02em; }

.packet__label { display: block; font-size: 11px; color: rgba(255, 247, 234, 0.6); margin-top: 2px; }

.packet__bar {
  width: 100%;
  height: 6px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.32);
  appearance: none;
}

.packet__bar::-webkit-progress-bar { background: rgba(0, 0, 0, 0.32); border-radius: 999px; }
.packet__bar::-webkit-progress-value { background: linear-gradient(90deg, #ffdf94, var(--gold-strong)); border-radius: 999px; }
.packet__bar::-moz-progress-bar { background: var(--gold-strong); border-radius: 999px; }

.packet__actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.grab {
  padding: 10px 22px;
  font-size: 15px;
  font-weight: 700;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  color: #4a0a12;
  background: linear-gradient(180deg, #ffe6a8, var(--gold-strong));
  font-family: inherit;
}

.grab:disabled { opacity: 0.6; cursor: progress; }

.state {
  font-size: 13px;
  color: rgba(255, 247, 234, 0.78);
}

.state--won { color: var(--gold-strong); font-weight: 600; }

.records summary {
  font-size: 12px;
  color: rgba(255, 247, 234, 0.72);
  cursor: pointer;
  list-style: none;
}

.records summary::-webkit-details-marker { display: none; }

.records ul { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }

.records li {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: rgba(255, 247, 234, 0.76);
  padding-bottom: 5px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
}

.empty { margin: 4px 0 0; font-size: 13px; color: var(--muted); text-align: center; padding: 14px 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: min(90vw, 420px);
  padding: 11px 16px;
  font-size: 13px;
  border-radius: 12px;
  color: var(--ink);
  background: rgba(30, 4, 9, 0.94);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  z-index: 40;
}

.prize {
  position: fixed;
  inset: 0;
  z-index: 50;
  padding: 24px;
  background: rgba(16, 2, 5, 0.72);
  backdrop-filter: blur(4px);
}

.prize:not([hidden]) {
  display: grid;
  place-items: center;
}

.prize__card {
  width: min(340px, 100%);
  padding: 26px 22px 20px;
  text-align: center;
  border-radius: 22px;
  border: 1px solid rgba(247, 214, 122, 0.4);
  background: radial-gradient(120% 90% at 50% 0%, #c0192c, #7a0c19 72%, #560812);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  animation: rise 0.28s ease-out;
}

@keyframes rise {
  from { transform: translateY(14px) scale(0.96); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.prize__hint { margin: 0; font-size: 13px; color: rgba(255, 247, 234, 0.78); }

.prize__amount {
  margin: 8px 0 4px;
  font-size: 40px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--gold-strong);
  text-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.prize__from { margin: 0 0 18px; font-size: 12px; color: rgba(255, 247, 234, 0.66); }

.ghost {
  padding: 11px 30px;
  font-size: 14px;
  border-radius: 12px;
  cursor: pointer;
  color: var(--gold);
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.24);
  font-family: inherit;
}

@media (max-width: 420px) {
  .app { padding: 12px 10px 40px; }
  .card { padding: 14px; }
  .packet__big { font-size: 18px; }
  .prize__amount { font-size: 34px; }
}

@media (min-width: 720px) {
  .app { padding-top: 24px; }
}
