/* Only the lottery surface changes color when the cabinet finish is switched. */
.lottery-page {
  --lottery-canvas: #f4f4f6;
  --lottery-paper: #fff;
  --lottery-ink: #232328;
  --lottery-muted: #5c5763;
  --lottery-line: #dddce3;
  --lottery-accent: #8e2827;
  --lottery-soft: #f7e8ec;
  --lottery-shadow: #28243910;
  width: min(calc(100% - 36px), 1120px);
  color: var(--lottery-ink);
  margin: 18px auto 38px;
  font-family: "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
}
.lottery-page[data-theme="wuxia"] {
  --lottery-canvas: #eeeee6;
  --lottery-paper: #fcfaf0;
  --lottery-ink: #252f28;
  --lottery-muted: #515c49;
  --lottery-line: #c6bda4;
  --lottery-accent: #344a35;
  --lottery-soft: #ebead9;
  --lottery-shadow: #213a231a;
}
.lottery-page *, .lottery-page *::before, .lottery-page *::after { box-sizing: border-box; }
.lottery-page [hidden] { display: none !important; }
.lottery-page :focus-visible { outline: 2px solid var(--lottery-accent); outline-offset: 3px; }
.lottery-toolbar, .lottery-modes { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.lottery-toolbar { justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.lottery-toolbar .lottery-modes { justify-content: start; min-width: 0; }
.lottery-modes a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-size: .88rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--lottery-muted);
  background: transparent;
}
.lottery-modes a[aria-current="page"], .lottery-modes a:hover { color: var(--lottery-accent); background: var(--lottery-soft); }
.lottery-heading { margin-bottom: 13px; }
.lottery-heading h1, .lottery-inbox h1 { margin: 0; color: var(--lottery-ink); font-size: clamp(27px, 3.1vw, 42px); font-weight: 830; line-height: 1.2; }
.lottery-heading p { margin: 3px 0 0; color: var(--lottery-muted); overflow-wrap: anywhere; }
.lottery-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 28%); align-items: start; }
.lottery-machine, #cabinet-root, .lottery-rail { min-width: 0; }
.lottery-rail {
  display: flex;
  flex-direction: column;
  gap: 9px;
  background: var(--lottery-paper);
  border: 1px solid var(--lottery-line);
  border-radius: 16px;
  box-shadow: 0 2px 12px var(--lottery-shadow);
  padding: 15px;
}
.lottery-rail-heading { display: flex; gap: 11px; align-items: center; }
.lottery-rail-heading h2 { font-size: 18px; margin: 0; color: var(--lottery-ink); }
.lottery-rail-heading p, .lottery-draw-time { margin: 0; color: var(--lottery-muted); font-size: .8rem; }
.lottery-draw-time strong { display: block; color: var(--lottery-ink); }
.lottery-ticket { width: 30px; height: 22px; flex: 0 0 30px; border: 1px solid var(--lottery-accent); border-radius: 4px; color: var(--lottery-accent); background: var(--lottery-soft); position: relative; transform: rotate(-10deg); }
.lottery-ticket::before { position: absolute; inset: 2px auto 2px 8px; border-left: 1px dashed; content: ""; }
.lottery-ticket::after { position: absolute; inset: 8px 5px auto 13px; border-top: 1px solid; content: ""; }
.lottery-notice, .lottery-last, .lottery-form-error { margin: 0; padding: 8px 10px; border-radius: 7px; font-size: .82rem; line-height: 1.5; overflow-wrap: anywhere; }
.lottery-notice, .lottery-last { color: var(--lottery-accent); background: var(--lottery-soft); }
.lottery-form-error { color: #7b2526; background: #fce9e8; list-style: none; }
.lottery-prize-pool, .lottery-awards, .lottery-mail-list { margin: 0; padding: 0; list-style: none; }
.lottery-prize { display: grid; grid-template-columns: 47px minmax(0, 1fr); align-items: center; gap: 10px; min-height: 61px; border-bottom: 1px solid var(--lottery-line); padding: 6px 0; }
.lottery-prize:last-child { border-bottom: 0; }
.lottery-prize-thumb { display: grid; place-items: center; width: 47px; height: 47px; overflow: hidden; border-radius: 7px; background: var(--lottery-soft); color: var(--lottery-accent); }
.lottery-prize-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
.lottery-prize h3, .lottery-prize p { margin: 0; overflow-wrap: anywhere; }
.lottery-prize h3 { color: var(--lottery-ink); font-size: .9rem; line-height: 1.3; }
.lottery-prize p, .lottery-muted { color: var(--lottery-muted); font-size: .8rem; }
.lottery-muted { padding: 9px 0; }
.lottery-link { color: var(--lottery-accent); text-decoration: underline; text-underline-offset: .18em; }
.lottery-rail-action { margin: 0; align-self: start; }
.lottery-action {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 42px;
  padding: 7px 15px;
  border: 1px solid var(--lottery-accent);
  border-radius: 8px;
  background: var(--lottery-accent);
  color: #fff;
  text-decoration: none;
  font: inherit;
  font-size: .88rem;
  font-weight: 730;
  cursor: pointer;
}
.lottery-action:hover { filter: brightness(1.15); color: #fff; }
.lottery-redeem-control {
  min-height: 44px;
  padding-inline: clamp(6px, 1vw, 10px);
  font-size: clamp(12px, 1.2vw, 14px);
  white-space: nowrap;
}
.lottery-play:fullscreen { padding: 16px clamp(14px, 4vw, 45px); overflow: auto; background: var(--lottery-canvas); }
.lottery-play:fullscreen .lottery-grid { width: min(100%, calc((100svh - 145px) * 1.18 + 250px), 1400px); margin-inline: auto; }

/* Desk and prize rail meet at the same height on desktops. Long lists scroll within the rail. */
@media (min-width: 821px) {
  .lottery-grid .claw-cabinet { border-start-end-radius: 0; border-end-end-radius: 0; }
  .lottery-rail { align-self: stretch; contain: size; min-height: 0; border-inline-start: 0; border-start-start-radius: 0; border-end-start-radius: 0; }
  .lottery-rail > :not(.lottery-prize-pool) { flex-shrink: 0; }
  .lottery-prize-pool { flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
}

.lottery-panel { margin-top: 24px; border: 1px solid var(--lottery-line); border-radius: 14px; padding: 19px; background: var(--lottery-paper); box-shadow: 0 4px 15px var(--lottery-shadow); scroll-margin-top: 16px; }
.lottery-panel-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 7px 14px; flex-wrap: wrap; }
.lottery-panel-heading h2 { color: var(--lottery-ink); margin: 0; font-size: 1.18rem; }
.lottery-panel > .lottery-notice, .lottery-form-error { margin-top: 12px; }
.lottery-redeem-page { max-width: 660px; }
.lottery-redeem-card { margin-top: 0; }
.lottery-redeem-card h2 { margin: 0; color: var(--lottery-ink); font-size: 1.24rem; }
.lottery-redeem-help { margin: 5px 0 0; color: var(--lottery-muted); }
.lottery-redeem-prize { margin: 8px 0 0; color: var(--lottery-ink); font-weight: 650; overflow-wrap: anywhere; }
.lottery-award-status { display: inline-block; margin-inline-start: 6px; padding: 2px 7px; border-radius: 6px; background: var(--lottery-soft); color: var(--lottery-accent); font-size: .82rem; }
.lottery-redeem-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 13px; margin-top: 14px; }
.lottery-redeem-page[data-step="shipping"] .lottery-redeem-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lottery-field { display: grid; gap: 5px; min-width: 0; color: var(--lottery-ink); font-size: .86rem; font-weight: 650; }
.lottery-field input, .lottery-field textarea { display: block; width: 100%; min-height: 43px; padding: 7px 8px; border: 1px solid var(--lottery-line); border-radius: 7px; color: var(--lottery-ink); background: var(--lottery-paper); font: inherit; font-size: 16px; font-weight: 500; }
.lottery-field textarea { resize: vertical; }
.lottery-field-address, .lottery-redeem-actions { grid-column: 1 / -1; }
.lottery-redeem-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 15px; }
.lottery-redeem-card > .lottery-redeem-actions { margin-top: 12px; }
.lottery-awards li { display: flex; gap: 5px 15px; align-items: baseline; justify-content: space-between; flex-wrap: wrap; padding: 9px 0; border-bottom: 1px solid var(--lottery-line); overflow-wrap: anywhere; }
.lottery-awards li:last-child { border-bottom: 0; }
.lottery-awards span, .lottery-credit { color: var(--lottery-muted); font-size: .82rem; }
.lottery-credit { margin: 13px 0 0; }
.lottery-credit a { color: inherit; }
.lottery-inbox { max-width: 840px; }
.lottery-inbox-actions { margin: 12px 0 0; }
.lottery-mail-list { display: grid; gap: 9px; margin-top: 14px; }
.lottery-mail { padding: 14px; border: 1px solid var(--lottery-line); border-radius: 9px; background: var(--lottery-paper); }
.lottery-unread { border-radius: 5px; padding: 3px 7px; color: var(--lottery-accent); background: var(--lottery-soft); font-size: .77rem; }
.lottery-mail time { display: inline-block; color: var(--lottery-muted); margin-top: 5px; font-size: .77rem; }
.lottery-mail-body { margin: 9px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.lottery-pagination { display: flex; align-items: center; gap: 12px; padding: 14px 0 0; }

.lottery-page .draw-dialog { width: min(92vw, 470px); max-height: calc(100dvh - 24px); padding: 0; color: var(--lottery-ink); border: 1px solid var(--lottery-line); border-radius: 20px; background: var(--lottery-paper); box-shadow: 0 22px 70px #20161260; overscroll-behavior: contain; }
.lottery-page .draw-dialog::backdrop { background: #241918a8; }
.draw-dialog form { position: relative; padding: 27px 21px 18px; text-align: center; }
.draw-dialog[data-outcome="win"] { --result-accent: #f5d9a0; --result-muted: #d6cddd; border-color: #655969; color: #fbf6f1; background: radial-gradient(ellipse at 50% 30%, #3b3045 0%, #24202d 62%, #201c28 100%); }
.lottery-page[data-theme="wuxia"] .draw-dialog[data-outcome="win"] { --result-accent: #f3daa4; --result-muted: #d5d8c8; border-color: #656944; background: radial-gradient(ellipse at 50% 30%, #344333 0%, #222d24 62%, #1a241e 100%); }
.draw-dialog[data-outcome="win"] :focus-visible { outline-color: var(--result-accent); }
.draw-dialog[data-outcome="win"] .draw-kicker { display: block; margin-bottom: 10px; color: var(--result-accent); }
.dialog-close { position: absolute; inset: 10px 12px auto auto; width: 36px; height: 36px; border: 1px solid var(--lottery-line); border-radius: 50%; color: var(--lottery-ink); background: var(--lottery-paper); font-size: 21px; line-height: 1; cursor: pointer; }
.draw-dialog[data-outcome="win"] .dialog-close { color: #fff5e7; background: #ffffff10; border-color: #ffffff45; }
.draw-kicker { color: var(--lottery-accent); font-size: 13px; font-weight: 750; }
.draw-dialog #draw-empty-title { color: var(--lottery-ink); font-size: 29px; line-height: 1.2; margin: 9px 0 7px; }
.draw-description { margin: 9px 0 13px; color: var(--lottery-muted); white-space: pre-wrap; overflow-wrap: anywhere; font-size: .84rem; line-height: 1.55; }
.draw-dialog[data-outcome="win"] .draw-description { color: var(--result-muted); max-height: clamp(53px, 16dvh, 130px); overflow-y: auto; scrollbar-width: thin; }
.draw-dialog[data-outcome="win"] .dialog-done { padding-inline: 26px; color: #312719; border-color: #f5e1b2; background: linear-gradient(155deg, #fbebc8, #d0af6f); }

@media (max-width: 820px) {
  .lottery-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .lottery-prize-pool { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 175px), 1fr)); column-gap: 12px; }
  .lottery-prize { border: 0; }
}
@media (max-width: 560px) {
  .lottery-page { width: calc(100% - 20px); margin-top: 12px; }
  .lottery-modes a { padding-inline: 7px; }
  .lottery-redeem-page[data-step="shipping"] .lottery-redeem-form { grid-template-columns: minmax(0, 1fr); }
  .lottery-panel { padding: 14px; }
}
