:root {
  --top-control-height: 38px;
  --page-bg: #050a0f;
  --ink: #fff7dc;
  --muted: rgba(255, 247, 220, 0.72);
  --panel: rgba(13, 17, 21, 0.78);
  --panel-strong: rgba(19, 16, 17, 0.94);
  --gold: #ffe187;
  --gold-2: #f2a92c;
  --red: #d71920;
  --red-deep: #771014;
  --blue: #0a68c6;
  --blue-deep: #082c64;
  --cyan: #00d6d0;
  --line: rgba(255, 216, 108, 0.35);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.44);
  --glow: 0 0 34px rgba(255, 195, 74, 0.22);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page-bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family:
    "PingFang SC",
    "Microsoft YaHei",
    "Noto Sans CJK SC",
    system-ui,
    sans-serif;
  background:
    radial-gradient(circle at 50% 0%, rgba(215, 25, 32, 0.18), transparent 34%),
    linear-gradient(180deg, rgba(5, 9, 14, 0.18), rgba(5, 9, 14, 0.92) 74%),
    url("./assets/market-bg_opt.webp") center / cover fixed;
  overflow-x: hidden;
}

button {
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:disabled,
button[aria-disabled="true"] {
  cursor: default;
}

.game-shell {
  position: relative;
  width: min(100%, 460px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.brand-hero {
  position: relative;
  min-height: 112px;
  padding: 12px 14px 12px 102px;
  border: 1px solid rgba(255, 225, 135, 0.48);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(166, 18, 26, 0.92), rgba(19, 24, 33, 0.76) 62%, rgba(9, 86, 167, 0.8)),
    url("./assets/market-bg_opt.webp") center / cover;
  box-shadow: var(--shadow), var(--glow);
}

.brand-hero::before,
.brand-hero::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.brand-hero::before {
  inset: 0;
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 225, 135, 0.24), transparent 22%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.18), transparent 58%);
}

.brand-hero::after {
  right: 12px;
  bottom: 10px;
  width: 86px;
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(0, 214, 208, 0.72), rgba(255, 225, 135, 0.9));
  opacity: 0.78;
}

.brand-mark {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 78px;
  height: 78px;
  object-fit: contain;
  transform: translateY(-50%);
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.38));
}

.brand-copy {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.brand-copy h1 {
  margin: 2px 0 3px;
  color: #ffe9a7;
  font-size: clamp(2.35rem, 13vw, 3.55rem);
  line-height: 0.96;
  letter-spacing: 0;
  text-shadow:
    0 3px 0 rgba(111, 10, 14, 0.72),
    0 0 22px rgba(255, 225, 135, 0.34);
}

.brand-copy p {
  margin: 0;
  color: rgba(255, 247, 220, 0.76);
  font-size: 0.84rem;
  line-height: 1.45;
}

.brand-copy .brand-kicker {
  width: fit-content;
  padding: 3px 8px;
  border: 1px solid rgba(255, 225, 135, 0.42);
  border-radius: 999px;
  color: rgba(255, 239, 184, 0.92);
  background: rgba(4, 9, 14, 0.42);
  font-size: 0.7rem;
  font-weight: 900;
}

.scratch-main {
  display: contents;
}

.top-entry-buttons {
  min-height: var(--top-control-height);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.top-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
  min-height: var(--top-control-height);
  min-width: 0;
}

.top-wallet {
  height: var(--top-control-height);
  padding: 4px 8px 4px 10px;
  border: 1px solid rgba(255, 225, 135, 0.48);
  border-radius: 999px;
  color: rgba(255, 246, 214, 0.84);
  background: linear-gradient(180deg, rgba(19, 22, 25, 0.86), rgba(8, 12, 17, 0.74));
  display: inline-flex;
  align-items: center;
  justify-self: start;
  align-self: start;
  gap: 7px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
}

.top-wallet span {
  font-size: 0.76rem;
  font-weight: 900;
}

.top-wallet strong {
  color: var(--gold);
  font-size: 1.2rem;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(91, 42, 0, 0.45);
}

.entry-button {
  height: var(--top-control-height);
  padding: 5px 10px;
  border: 1px solid rgba(255, 225, 135, 0.48);
  border-radius: 999px;
  color: rgba(255, 246, 214, 0.92);
  background: linear-gradient(180deg, rgba(19, 22, 25, 0.86), rgba(8, 12, 17, 0.74));
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
}

.entry-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toast-message {
  position: fixed;
  left: max(12px, calc(50vw - 218px));
  right: max(12px, calc(50vw - 218px));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 40;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: rgba(255, 246, 214, 0.86);
  background: rgba(12, 15, 18, 0.84);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.36);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.98);
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    border-color 180ms ease;
}

.toast-message.is-visible {
  border-color: rgba(255, 216, 108, 0.32);
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast-message[data-tone="success"] {
  color: #fff2c0;
  border-color: rgba(255, 216, 108, 0.56);
}

.toast-message[data-tone="warn"] {
  color: #ffe1a3;
  border-color: rgba(255, 170, 80, 0.52);
}

.status-panel {
  display: grid;
  gap: 10px;
}

.pool-panel {
  grid-template-columns: 1fr 1fr;
}

.progress-card,
.play-progress-card {
  grid-column: 1 / -1;
}

.panel-block {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(39, 29, 24, 0.86), rgba(10, 14, 18, 0.9)),
    radial-gradient(circle at 50% 0%, rgba(255, 225, 135, 0.14), transparent 42%);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.26);
}

.result-card {
  min-height: 84px;
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.panel-label,
.progress-heading span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.result-card strong {
  display: block;
  margin-top: 4px;
  color: var(--gold);
  font-size: 1.65rem;
  line-height: 1.05;
  text-shadow: 0 2px 0 rgba(91, 42, 0, 0.45);
}

.claim-button {
  width: fit-content;
  min-height: 28px;
  margin-top: 0;
  padding: 4px 9px;
  border: 1px solid rgba(255, 216, 108, 0.72);
  border-radius: 999px;
  color: #4b1800;
  background: linear-gradient(180deg, #fff0a9, #f0a629);
  font-size: 0.78rem;
  font-weight: 900;
}

.claim-button:disabled {
  display: none;
}

.result-card p {
  margin: 6px 0 0;
  color: rgba(255, 246, 214, 0.78);
  font-size: 0.78rem;
  line-height: 1.4;
}

.progress-card {
  padding: 12px 14px 10px;
}

.play-progress-card {
  width: 100%;
  max-width: 436px;
  margin: 0 auto 10px;
}

.progress-heading,
.progress-scale {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.progress-heading strong {
  color: var(--gold);
  font-size: 1.1rem;
}

.progress-track {
  position: relative;
  height: 16px;
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 216, 108, 0.62);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.48);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.35);
}

.progress-track span {
  position: absolute;
  inset: 2px auto 2px 2px;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #00d6d0, #ffe075 48%, #f6ae2f);
  box-shadow: 0 0 18px rgba(255, 216, 108, 0.52);
  transition: width 160ms ease;
}

.progress-slider {
  width: 100%;
  height: 28px;
  margin: -22px 0 0;
  display: block;
  position: relative;
  z-index: 2;
  background: transparent;
  cursor: grab;
  -webkit-appearance: none;
  appearance: none;
  touch-action: pan-y;
}

.progress-slider:active {
  cursor: grabbing;
}

.progress-slider:disabled {
  cursor: default;
  opacity: 0.58;
}

.progress-slider::-webkit-slider-runnable-track {
  height: 28px;
  background: transparent;
}

.progress-slider::-webkit-slider-thumb {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(255, 247, 220, 0.94);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6c7, #ffd86c 58%, #f2a92c);
  box-shadow:
    0 0 0 2px rgba(0, 0, 0, 0.28),
    0 0 18px rgba(255, 216, 108, 0.66);
  -webkit-appearance: none;
  appearance: none;
}

.progress-slider::-moz-range-track {
  height: 28px;
  background: transparent;
}

.progress-slider::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(255, 247, 220, 0.94);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6c7, #ffd86c 58%, #f2a92c);
  box-shadow:
    0 0 0 2px rgba(0, 0, 0, 0.28),
    0 0 18px rgba(255, 216, 108, 0.66);
}

.progress-scale {
  margin-top: 8px;
  color: rgba(255, 246, 214, 0.72);
  font-size: 0.72rem;
}

.ticket-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.is-hidden {
  display: none !important;
}

.ticket-select-stage {
  display: grid;
  gap: 10px;
}

.ticket-option {
  position: relative;
  isolation: isolate;
  min-height: 116px;
  padding: 13px 14px 13px 96px;
  overflow: hidden;
  border: 2px solid rgba(255, 216, 108, 0.58);
  border-radius: 8px;
  color: var(--ink);
  text-align: left;
  background:
    linear-gradient(90deg, rgba(94, 12, 17, 0.94), rgba(24, 28, 38, 0.82)),
    url("./assets/xixiangfeng-20-ticket-bg_opt.jpg") top center / 100% auto no-repeat;
  box-shadow: var(--shadow);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    filter 160ms ease;
}

.ticket-option::before,
.ticket-option::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.ticket-option::before {
  left: 12px;
  top: 50%;
  z-index: 0;
  width: 64px;
  height: 64px;
  border: 2px solid rgba(255, 225, 135, 0.88);
  border-radius: 50%;
  background:
    url("./assets/logo-mark_opt.webp") center / 118% 118% no-repeat,
    radial-gradient(circle, rgba(255, 225, 135, 0.24), rgba(119, 16, 20, 0.5));
  box-shadow:
    inset 0 0 0 2px rgba(7, 72, 143, 0.5),
    0 10px 18px rgba(0, 0, 0, 0.28);
  transform: translateY(-50%);
}

.ticket-option::after {
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 92% 24%, rgba(255, 225, 135, 0.22), transparent 24%),
    linear-gradient(90deg, rgba(118, 14, 19, 0.96) 0%, rgba(87, 16, 31, 0.9) 52%, rgba(8, 45, 91, 0.9) 100%);
}

.ticket-option.featured {
  border-color: rgba(255, 232, 143, 0.92);
}

.ticket-option.featured::after {
  background:
    radial-gradient(circle at 86% 20%, rgba(255, 232, 143, 0.34), transparent 26%),
    linear-gradient(90deg, rgba(150, 17, 25, 0.96) 0%, rgba(108, 19, 48, 0.9) 50%, rgba(8, 91, 171, 0.9) 100%);
}

.ticket-option:hover,
.ticket-option:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(255, 239, 184, 0.96);
  filter: brightness(1.05);
}

.ticket-option span {
  display: block;
}

.ticket-option-label {
  width: fit-content;
  margin-bottom: 5px;
  padding: 2px 7px;
  border: 1px solid rgba(255, 225, 135, 0.36);
  border-radius: 999px;
  color: rgba(255, 239, 184, 0.86);
  background: rgba(0, 0, 0, 0.22);
  font-size: 0.68rem;
  font-weight: 900;
}

.ticket-option-name {
  display: block;
  color: #ffe9ad;
  font-size: 1.2rem;
  font-weight: 900;
  line-height: 1.2;
  text-shadow: 0 2px 0 rgba(88, 12, 14, 0.64);
}

.ticket-option-meta {
  margin-top: 4px;
  color: rgba(255, 246, 214, 0.78);
  font-size: 0.86rem;
  line-height: 1.5;
}

.ticket-option.is-locked {
  border-color: rgba(255, 216, 108, 0.28);
  opacity: 0.72;
}

.ticket-option.is-locked::before {
  filter: grayscale(1) contrast(0.78);
  opacity: 0.34;
}

.ticket-option.can-unlock {
  filter: none;
  opacity: 0.9;
}

.ticket-unlock-state {
  width: fit-content;
  margin-top: 8px;
  padding: 4px 9px;
  border: 1px solid rgba(255, 216, 108, 0.46);
  border-radius: 999px;
  color: #4b1a00 !important;
  background: linear-gradient(180deg, #fff0a9, #f5ae32);
  font-size: 0.75rem !important;
  font-weight: 900;
}

.ticket-option.is-locked:not(.can-unlock) .ticket-unlock-state {
  color: rgba(255, 246, 214, 0.7) !important;
  background: rgba(255, 255, 255, 0.08);
}

.ticket {
  position: relative;
  width: 100%;
  max-width: 436px;
  min-height: var(--ticket-height, 620px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 3px;
  color: #ffeebc;
  background:
    var(--ticket-bg, url("./assets/xixiangfeng-ticket-bg_opt.jpg")) top center / 100% auto no-repeat,
    linear-gradient(180deg, #c7191e 0, #a71217 58%, #ba171b 100%);
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.46),
    0 0 0 1px rgba(255, 225, 135, 0.14);
}

.ticket::before,
.ticket::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border: 3px solid var(--blue);
  border-radius: 18px;
}

.ticket::before {
  inset: 10px;
  border-color: rgba(11, 94, 186, 0.85);
}

.ticket::after {
  inset: 17px;
  border-color: rgba(255, 216, 108, 0.65);
}

.ticket::before,
.ticket::after,
.ticket-edge,
.ticket-header,
.top-prize,
.vertical-blessing,
.ticket-rule,
.ticket-footer {
  display: none;
}

.ticket > * {
  position: relative;
  z-index: 1;
}

.ticket-edge {
  position: absolute;
  top: 42%;
  bottom: 17%;
  width: 32px;
  border: 3px solid #ffd46b;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--red), var(--red-deep));
  z-index: 1;
}

.ticket-edge-left {
  left: 14px;
}

.ticket-edge-right {
  right: 14px;
}

.ticket-header {
  padding: 5px 16px 0;
  text-align: center;
}

.small-print-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: rgba(255, 246, 214, 0.86);
  font-size: 0.72rem;
  font-weight: 700;
}

.ticket h1 {
  margin: 7px 0 6px;
  display: flex;
  justify-content: center;
  gap: 6px;
  color: var(--gold);
  font-size: 4rem;
  line-height: 1;
  letter-spacing: 0;
  text-shadow:
    0 4px 0 #7d1215,
    0 0 18px rgba(255, 226, 130, 0.4);
}

.ticket h1 span {
  min-width: 1em;
  padding: 8px 3px 10px;
  border: 5px solid var(--blue);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #e82a25, #ba1519 72%);
  box-shadow:
    inset 0 0 0 3px #f8d36f,
    0 4px 0 rgba(0, 0, 0, 0.15);
}

.ribbon,
.top-prize {
  width: fit-content;
  margin: 0 auto;
  border-radius: 999px;
  border: 3px solid #ffd36d;
  background: linear-gradient(180deg, #d7201e, #a80f15);
  box-shadow: inset 0 0 0 2px var(--blue);
}

.ribbon {
  padding: 4px 34px;
  color: #ffeab3;
  font-size: 1.1rem;
  font-weight: 900;
}

.top-prize {
  margin-top: 8px;
  padding: 7px 18px;
  color: var(--gold);
  font-size: 1.15rem;
  font-weight: 900;
}

.play-frame {
  position: absolute;
  left: 50%;
  top: var(--ticket-top, 260px);
  width: var(--scratch-width, 293px);
  height: var(--scratch-height, 293px);
  margin: 0;
  display: block;
  transform: translateX(-50%);
  z-index: 2;
}

.vertical-blessing {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 10px 5px;
  border: 3px solid #ffd36d;
  border-radius: 999px;
  background: linear-gradient(180deg, #c8191c, #8d1015);
  color: #ffe6a1;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
  writing-mode: vertical-rl;
  letter-spacing: 0;
  box-shadow: inset 0 0 0 2px var(--blue);
}

.scratch-area {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  touch-action: none;
}

.prize-grid,
#scratchCanvas {
  position: absolute;
  inset: 0;
}

.prize-grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-cols, 5), 1fr);
  grid-template-rows: repeat(var(--grid-rows, 5), 1fr);
  gap: var(--grid-gap, 6px);
  padding: var(--grid-pad, 10px);
  overflow: hidden;
  border-radius: 2px;
  background:
    repeating-linear-gradient(112deg, rgba(104, 38, 48, 0.26) 0 1px, transparent 1px 8px),
    radial-gradient(circle at 30% 18%, rgba(255, 255, 255, 0.82), transparent 17%),
    linear-gradient(135deg, #ece9df 0%, #aeb2b1 36%, #d6d7d1 58%, #8d9494 100%);
  box-shadow:
    inset 0 0 0 1px rgba(70, 70, 66, 0.28),
    inset 0 0 24px rgba(255, 255, 255, 0.28);
  z-index: 1;
}

.prize-cell {
  min-width: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #202020;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
  box-shadow: none;
}

.prize-cell::before {
  display: none;
}

.prize-symbol {
  font-size: var(--symbol-size, clamp(0.78rem, 4vw, 1.08rem));
  font-weight: 900;
  line-height: 0.95;
}

.prize-cell-direct {
  border-radius: 0;
  background: transparent;
  color: #202020;
  box-shadow: none;
}

.prize-cell-direct::before {
  display: none;
}

.prize-direct-label {
  color: #202020;
  font-size: clamp(0.56rem, 2.9vw, 0.78rem);
  font-weight: 900;
  line-height: 1;
}

.prize-direct-amount {
  margin-top: 2px;
  font-size: clamp(0.78rem, 4.8vw, 1.2rem);
  font-weight: 1000;
  line-height: 1;
}

.prize-grid[data-play-type="direct_amount"] {
  align-items: center;
}

.prize-amount {
  margin-top: 1px;
  font-size: var(--amount-size, clamp(0.52rem, 2.4vw, 0.68rem));
  font-weight: 900;
  line-height: 0.95;
}

.prize-grid[data-denomination="30"] .prize-symbol,
.prize-grid[data-denomination="50"] .prize-symbol {
  line-height: 0.9;
}

.prize-grid[data-denomination="30"] .prize-amount,
.prize-grid[data-denomination="50"] .prize-amount {
  margin-top: 0;
  line-height: 0.9;
}

#scratchCanvas {
  z-index: 4;
  width: 100%;
  height: 100%;
  cursor: grab;
}

#scratchCanvas:active {
  cursor: grabbing;
}

.ticket-rule {
  width: min(88%, 320px);
  margin: 8px auto 0;
  color: rgba(255, 239, 191, 0.92);
  font-size: 0.68rem;
  line-height: 1.55;
  text-align: center;
}

.ticket-footer {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 18px;
  color: #ffe6a3;
  font-size: 0.96rem;
  font-weight: 900;
}

.barcode {
  width: 112px;
  height: 28px;
  border: 3px solid #f4e8ca;
  background:
    repeating-linear-gradient(90deg, #111 0 3px, transparent 3px 6px, #111 6px 8px, transparent 8px 12px),
    #fff;
}

.action-panel {
  padding-bottom: 4px;
}

.primary-button svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.primary-button:hover,
.primary-button:focus-visible,
.dialog-button:hover,
.dialog-button:focus-visible {
  outline: 3px solid rgba(255, 216, 108, 0.34);
  outline-offset: 2px;
}

.history-card {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.history-card h2 {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 1.16rem;
  line-height: 1.2;
  text-align: center;
}

.full-history-list {
  display: grid;
  gap: 9px;
  min-height: 120px;
  max-height: min(58vh, 520px);
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.history-card li {
  padding: 0;
}

.history-record {
  width: 100%;
  min-height: 56px;
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 216, 108, 0.18);
  border-radius: 8px;
  color: inherit;
  text-align: left;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.035));
}

.history-card li.empty {
  display: flex;
  justify-content: center;
  padding: 20px 10px;
  color: var(--muted);
  font-size: 0.86rem;
}

.history-icon {
  font-size: 1.35rem;
  text-align: center;
}

.history-main {
  min-width: 0;
  color: #ffe7a8;
  font-weight: 900;
}

.history-sub {
  color: rgba(255, 246, 214, 0.58);
  font-size: 0.72rem;
}

.history-card p {
  margin: 9px 0 0;
  color: rgba(255, 246, 214, 0.58);
  font-size: 0.75rem;
  text-align: center;
}

.button-stack {
  display: grid;
  gap: 10px;
}

.primary-button {
  min-height: 58px;
  border: 3px solid #ffd36d;
  border-radius: 999px;
  color: #fff2c0;
  font-size: 1.25rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.24),
    0 10px 20px rgba(0, 0, 0, 0.3),
    0 0 24px rgba(255, 183, 57, 0.14);
}

.primary-button.blue {
  background: linear-gradient(180deg, #21a5f2, #0867c4 55%, #07366e);
}

.primary-button.red {
  background: linear-gradient(180deg, #f15543, #c31e20 55%, #851215);
}

.primary-button.ghost {
  min-height: 44px;
  border-color: rgba(255, 216, 108, 0.46);
  color: rgba(255, 246, 214, 0.86);
  font-size: 0.95rem;
  background: rgba(11, 14, 17, 0.58);
}

.rule-dialog {
  width: min(88vw, 360px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 225, 135, 0.15), transparent 38%),
    var(--panel-strong);
  box-shadow: var(--shadow);
}

.sheet-dialog {
  width: min(92vw, 430px);
}

.ticket-dialog {
  width: min(94vw, 420px);
}

.rule-dialog::backdrop {
  background: rgba(0, 0, 0, 0.58);
}

.rule-dialog form {
  padding: 20px;
}

.rule-dialog h2,
.page-header h2 {
  margin: 0 0 10px;
  color: var(--gold);
}

.rule-dialog p,
.page-header p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.page-header {
  margin-bottom: 12px;
}

.page-header strong {
  color: var(--gold);
}

.sort-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.sort-button {
  min-height: 36px;
  border: 1px solid rgba(255, 216, 108, 0.34);
  border-radius: 999px;
  color: rgba(255, 246, 214, 0.72);
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.82rem;
  font-weight: 900;
}

.sort-button.is-active {
  color: #4b1a00;
  background: linear-gradient(180deg, #ffe58c, #f5ae32);
}

.snapshot-ticket-wrap {
  max-height: min(58vh, 520px);
  margin-top: 12px;
  overflow: auto;
}

.snapshot-ticket {
  width: min(100%, 320px);
  margin: 0 auto;
  box-shadow: none;
}

.snapshot-ticket.is-empty {
  min-height: 180px;
}

.snapshot-empty {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  color: rgba(255, 246, 214, 0.62);
  text-align: center;
}

.result-dialog {
  width: min(88vw, 360px);
  padding: 0;
  border: 1px solid rgba(255, 216, 108, 0.64);
  border-radius: 8px;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 16%, rgba(255, 216, 108, 0.3), transparent 34%),
    linear-gradient(180deg, rgba(114, 14, 20, 0.98), rgba(18, 14, 18, 0.98));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.52);
}

.result-dialog::backdrop {
  background: rgba(0, 0, 0, 0.68);
}

.result-dialog form {
  position: relative;
  overflow: hidden;
  padding: 24px 20px 20px;
  text-align: center;
}

.result-burst {
  position: absolute;
  inset: -80px;
  background:
    repeating-conic-gradient(from 0deg, rgba(255, 216, 108, 0.24) 0 9deg, transparent 9deg 18deg);
  animation: burstSpin 6s linear infinite;
  opacity: 0.7;
}

.result-medal,
.result-dialog h2,
.result-dialog strong,
.result-dialog p,
.result-stats,
.result-dialog .dialog-button {
  position: relative;
  z-index: 1;
}

.result-medal {
  width: 76px;
  height: 76px;
  margin: 0 auto 10px;
  border: 4px solid #ffe58c;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #7f1114;
  background: radial-gradient(circle at 50% 35%, #fff1b7, #f1a82c);
  font-size: 2.2rem;
  font-weight: 900;
  box-shadow: 0 0 26px rgba(255, 216, 108, 0.48);
  animation: medalPop 680ms cubic-bezier(0.2, 1.25, 0.4, 1) both;
}

.result-dialog h2 {
  margin: 0;
  color: #ffe7a8;
  font-size: 1.35rem;
}

.result-dialog strong {
  display: block;
  margin-top: 8px;
  color: var(--gold);
  font-size: 2.25rem;
  line-height: 1.1;
  text-shadow: 0 3px 0 rgba(82, 22, 0, 0.48);
}

.result-dialog p {
  margin: 8px 0 0;
  color: rgba(255, 246, 214, 0.82);
  line-height: 1.55;
}

.result-stats {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.result-stats span {
  padding: 5px 9px;
  border: 1px solid rgba(255, 216, 108, 0.28);
  border-radius: 999px;
  color: rgba(255, 246, 214, 0.78);
  background: rgba(0, 0, 0, 0.24);
  font-size: 0.76rem;
  font-weight: 900;
}

.result-dialog.is-win strong {
  animation: rewardFlash 900ms ease both;
}

.result-dialog.is-big {
  border-color: rgba(255, 232, 143, 0.9);
}

.result-dialog.is-big .result-medal {
  animation:
    medalPop 680ms cubic-bezier(0.2, 1.25, 0.4, 1) both,
    goldBreath 1300ms ease-in-out infinite 680ms;
}

.dialog-button {
  width: 100%;
  min-height: 46px;
  margin-top: 18px;
  border: 2px solid var(--gold);
  border-radius: 999px;
  color: #4b1a00;
  font-weight: 900;
  background: linear-gradient(180deg, #fff0a9, #f5ae32);
}

.win-pulse {
  animation: winPulse 680ms ease both;
}

.ticket.revealed .top-prize {
  animation: winPulse 720ms ease both;
}

@keyframes winPulse {
  0% {
    transform: scale(1);
    filter: brightness(1);
  }

  48% {
    transform: scale(1.045);
    filter: brightness(1.28);
  }

  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

@keyframes burstSpin {
  to {
    transform: rotate(1turn);
  }
}

@keyframes medalPop {
  0% {
    transform: scale(0.62) rotate(-8deg);
    opacity: 0;
  }

  72% {
    transform: scale(1.08) rotate(3deg);
    opacity: 1;
  }

  100% {
    transform: scale(1) rotate(0deg);
  }
}

@keyframes rewardFlash {
  0% {
    transform: translateY(6px) scale(0.92);
    opacity: 0;
    filter: brightness(1);
  }

  55% {
    transform: translateY(0) scale(1.08);
    opacity: 1;
    filter: brightness(1.35);
  }

  100% {
    transform: translateY(0) scale(1);
    filter: brightness(1);
  }
}

@keyframes goldBreath {
  0%,
  100% {
    box-shadow: 0 0 26px rgba(255, 216, 108, 0.48);
  }

  50% {
    box-shadow: 0 0 44px rgba(255, 232, 143, 0.86);
  }
}

@media (max-width: 390px) {
  .game-shell {
    padding-inline: 8px;
  }

  .top-entry-buttons {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
  }

  .top-wallet {
    max-width: 100%;
    height: var(--top-control-height);
    padding-inline: 10px;
  }

  .top-actions {
    gap: 6px;
  }

  .entry-button {
    padding-inline: 8px;
    font-size: 0.76rem;
  }

  .brand-hero {
    min-height: 102px;
    padding-left: 88px;
  }

  .brand-mark {
    left: 10px;
    width: 66px;
    height: 66px;
  }

  .brand-copy h1 {
    font-size: 2.45rem;
  }

  .ticket-option {
    min-height: 104px;
    padding-left: 86px;
  }

  .ticket-option::before {
    left: 10px;
    width: 58px;
    height: 58px;
  }

  .ticket {
    max-width: 100%;
  }

  .ticket h1 {
    font-size: 3.3rem;
    gap: 4px;
  }

  .ticket h1 span {
    border-width: 4px;
  }

  .ribbon {
    padding-inline: 24px;
    font-size: 1rem;
  }

  .top-prize {
    font-size: 1rem;
  }

}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
