:root {
  color-scheme: dark;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
  --ink: #071c15;
  --charcoal: #0d3528;
  --forest: #0d3528;
  --forest-deep: #06251c;
  --forest-bright: #17543d;
  --gold: #d7b86a;
  --gold-deep: #9b742c;
  --gold-pale: #f1dda3;
  --ivory: #fff7e7;
  --green: #173f30;
  --muted: rgba(255, 247, 231, 0.66);
  --safe-top: max(14px, env(safe-area-inset-top));
  --safe-bottom: max(14px, env(safe-area-inset-bottom));
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: #061812;
}

body {
  min-width: 320px;
  color: var(--ivory);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

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

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--gold-pale);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.app-shell {
  position: relative;
  isolation: isolate;
  width: min(100%, 480px);
  min-height: 100svh;
  margin: 0 auto;
  overflow-x: clip;
  overflow-y: visible;
  background:
    linear-gradient(180deg, rgba(9, 48, 35, 0.16) 0%, rgba(6, 37, 28, 0.9) 64%, #061f18 100%),
    var(--charcoal);
  box-shadow: 0 0 64px rgba(0, 0, 0, 0.5);
}

.campaign-texture {
  position: absolute;
  z-index: -3;
  inset: 0;
  background-image: url("./assets/areca-plantation.jpg");
  background-position: center 48%;
  background-size: cover;
  opacity: 0.32;
  filter: saturate(0.7) contrast(1.08) brightness(0.62);
}

.paper-grain {
  position: absolute;
  z-index: -2;
  inset: 0;
  pointer-events: none;
  opacity: 0.3;
  background-image:
    repeating-linear-gradient(90deg, transparent 0 7px, rgba(255, 237, 191, 0.028) 8px),
    repeating-linear-gradient(0deg, transparent 0 10px, rgba(0, 0, 0, 0.07) 11px);
}

.app-shell::before,
.app-shell::after {
  position: absolute;
  z-index: -1;
  content: "";
  pointer-events: none;
}

.app-shell::before {
  top: 88px;
  left: 50%;
  width: 390px;
  height: 390px;
  border: 1px solid rgba(224, 183, 91, 0.15);
  transform: translateX(-50%) rotate(45deg);
  box-shadow: inset 0 0 0 14px rgba(224, 183, 91, 0.025);
}

.app-shell::after {
  inset: 0;
  border-inline: 1px solid rgba(224, 183, 91, 0.14);
}

.app-shell.is-landing .campaign-texture,
.app-shell.is-landing .paper-grain,
.app-shell.is-landing::before,
.app-shell.is-landing::after,
.app-shell.is-landing .topbar,
.app-shell.is-landing .site-footer {
  display: none;
}

.app-shell.is-landing .stage {
  min-height: 100svh;
}

.topbar {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 58px;
  padding: var(--safe-top) 18px 0;
}

.header-link,
.text-button {
  border: 0;
  padding: 8px 0;
  background: transparent;
  color: rgba(255, 244, 213, 0.82);
  font-size: 13px;
  letter-spacing: 0;
  cursor: pointer;
}

.header-link:first-child {
  justify-self: start;
}

.header-link:last-child {
  justify-self: end;
}

.header-link:active,
.text-button:active {
  color: var(--gold-pale);
}

.scan-status {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  border: 1px solid rgba(224, 183, 91, 0.35);
  border-radius: 999px;
  padding: 4px 10px;
  background: rgba(24, 60, 46, 0.55);
  color: var(--ivory);
  font-size: 11px;
  white-space: nowrap;
}

.scan-status__mark {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #70c493;
  box-shadow: 0 0 0 3px rgba(112, 196, 147, 0.13);
}

.stage {
  position: relative;
  z-index: 1;
  min-height: calc(100svh - 116px);
}

.screen {
  width: 100%;
  min-height: calc(100svh - 116px);
  padding: 24px 24px 22px;
}

.screen.is-active {
  animation: screen-in 500ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.screen--landing {
  position: relative;
  height: 100svh;
  min-height: 620px;
  overflow: hidden;
  padding: 0;
  background: #092d22;
}

.landing-visual {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.landing-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 46%;
  filter: saturate(0.82) contrast(1.04) brightness(0.78);
}

.landing-visual::before,
.landing-visual::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
}

.landing-visual::before {
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(10, 74, 91, 0.05) 0%, rgba(5, 40, 29, 0.12) 38%, rgba(3, 29, 21, 0.88) 100%),
    linear-gradient(90deg, rgba(5, 33, 24, 0.38), transparent 20% 80%, rgba(5, 33, 24, 0.38));
}

.landing-visual::after {
  z-index: 2;
  top: 36%;
  height: 30%;
  background: linear-gradient(180deg, transparent, rgba(231, 244, 225, 0.24), transparent);
  filter: blur(14px);
  transform: skewY(-4deg);
}

.mist-band {
  position: absolute;
  z-index: 2;
  right: -20%;
  left: -20%;
  height: 54px;
  background: linear-gradient(90deg, transparent, rgba(238, 247, 230, 0.33) 30% 68%, transparent);
  filter: blur(17px);
  pointer-events: none;
}

.mist-band--one {
  top: 31%;
  transform: rotate(-6deg);
}

.mist-band--two {
  top: 45%;
  opacity: 0.62;
  transform: rotate(4deg);
}

.landing-copy {
  position: absolute;
  z-index: 3;
  top: max(56px, 7.5svh);
  right: 22px;
  left: 22px;
  text-align: center;
  text-shadow: 0 3px 18px rgba(0, 22, 16, 0.52);
}

.landing-brand {
  display: inline-block;
  margin: 0 0 13px;
  border-block: 1px solid rgba(245, 218, 150, 0.62);
  padding: 4px 14px;
  color: #fff1c8;
  font-family: "STSong", "Songti SC", serif;
  font-size: 13px;
  letter-spacing: 4px;
}

.landing-kicker {
  margin: 0 0 6px;
  color: rgba(255, 241, 200, 0.78);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 10px;
  letter-spacing: 3px;
}

.landing-copy h1 {
  margin: 0;
  color: #f3cd73;
  font-family: "STSong", "Songti SC", serif;
  font-size: 50px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0;
  white-space: nowrap;
  text-shadow: 0 3px 0 #72501e, 0 8px 22px rgba(0, 30, 20, 0.55);
}

.landing-copy h1 span {
  color: #fff0b8;
}

.landing-subtitle {
  margin: 13px 0 0;
  color: rgba(255, 247, 221, 0.9);
  font-size: 13px;
  letter-spacing: 2px;
}

.landing-steps {
  position: absolute;
  z-index: 3;
  right: 18px;
  bottom: 126px;
  left: 18px;
  color: #fff4d7;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 20, 13, 0.72);
}

.landing-steps__title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: auto;
  margin: 0 auto 17px;
}

.landing-steps__title span {
  width: 5px;
  height: 5px;
  border: 1px solid rgba(244, 211, 130, 0.82);
  background: rgba(5, 41, 28, 0.42);
  transform: rotate(45deg);
}

.landing-steps__title span:last-child {
  transform: rotate(45deg);
}

.landing-steps__title strong {
  color: #f8df9e;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1px;
}

.landing-steps ol {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.landing-steps li {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
}

.landing-steps li > strong {
  margin-top: 9px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.landing-steps li > small {
  margin-top: 3px;
  color: rgba(255, 244, 215, 0.72);
  font-size: 10px;
  white-space: nowrap;
}

.step-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 60px;
  height: 54px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #ffe9ae;
  filter: drop-shadow(0 5px 10px rgba(0, 20, 13, 0.28));
}

.step-icon--qr {
  grid-template-columns: repeat(2, 16px);
  grid-template-rows: repeat(2, 16px);
  gap: 4px;
}

.step-icon--qr i {
  position: relative;
  width: 16px;
  height: 16px;
  border: 2px solid #ffe9ae;
  background: rgba(5, 41, 28, 0.5);
  box-shadow: none;
}

.step-icon--qr i:not(:last-child)::after {
  position: absolute;
  inset: 3px;
  background: #ffe9ae;
  content: "";
}

.step-icon--qr i:last-child {
  border-width: 0;
  background:
    linear-gradient(90deg, #ffe9ae 0 4px, transparent 4px 8px, #ffe9ae 8px 12px, transparent 12px),
    linear-gradient(0deg, #ffe9ae 0 4px, transparent 4px 8px, #ffe9ae 8px 12px, transparent 12px);
}

.step-icon--code i {
  width: 29px;
  height: 38px;
  border: 2px solid #ffe9ae;
  border-radius: 5px;
}

.step-icon--code i::after {
  position: absolute;
  bottom: 13px;
  left: 50%;
  width: 8px;
  height: 2px;
  background: #ffe9ae;
  content: "";
  transform: translateX(-50%);
}

.step-icon--code b {
  position: absolute;
  top: 13px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #e6b650;
  color: #173a2b;
  font-family: Georgia, serif;
  font-size: 12px;
}

.step-icon--card i {
  position: absolute;
  width: 28px;
  height: 35px;
  border: 1px solid rgba(255, 233, 174, 0.6);
  border-radius: 4px;
  transform: translate(5px, -4px) rotate(7deg);
}

.step-icon--card b {
  position: relative;
  display: grid;
  place-items: center;
  width: 30px;
  height: 38px;
  border-radius: 4px;
  background: #f3d580;
  color: #28503b;
  font-family: "STSong", "Songti SC", serif;
  font-size: 18px;
  box-shadow: 0 4px 10px rgba(0, 20, 13, 0.22);
}

.scan-button {
  position: absolute;
  z-index: 4;
  right: 24px;
  bottom: max(28px, env(safe-area-inset-bottom));
  left: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 58px;
  border: 1px solid rgba(255, 243, 202, 0.92);
  border-radius: 8px;
  padding: 0 24px;
  background: linear-gradient(180deg, #fff0ba 0%, #e6b95a 100%);
  color: #244131;
  font-size: 18px;
  font-weight: 700;
  box-shadow: 0 11px 28px rgba(0, 25, 15, 0.38), inset 0 1px rgba(255, 255, 255, 0.72);
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease;
}

.scan-button:active {
  transform: translateY(2px);
  filter: brightness(0.96);
}

.scan-button.is-loading {
  cursor: wait;
}

.scan-button.is-loading .scan-button__label {
  opacity: 0;
}

.scan-button.is-loading .scan-button__arrow {
  opacity: 0;
}

.scan-button__arrow {
  font-size: 21px;
  font-weight: 400;
}

.scan-button__loading {
  position: absolute;
  width: 23px;
  height: 23px;
  border: 3px solid rgba(23, 58, 43, 0.24);
  border-top-color: #173a2b;
  border-radius: 50%;
  opacity: 0;
}

.scan-button.is-loading .scan-button__loading {
  opacity: 1;
  animation: spin 650ms linear infinite;
}

.brand-block {
  margin-top: 5vh;
  text-align: center;
}

.brand-kicker,
.draw-eyebrow,
.modal-kicker,
.result-kicker {
  margin: 0 0 8px;
  color: var(--gold);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 11px;
  letter-spacing: 3px;
}

.brand-block h1 {
  margin: 0;
  color: var(--gold-pale);
  font-family: "STSong", "Songti SC", serif;
  font-size: 48px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-shadow: 0 2px 18px rgba(224, 183, 91, 0.18);
}

.brand-block h1 span {
  color: #fff6dc;
}

.brand-subtitle {
  margin: 14px 0 0;
  color: rgba(255, 244, 213, 0.75);
  font-size: 14px;
  letter-spacing: 4px;
}

.seal-line {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  width: min(100%, 280px);
  margin: 31px auto 26px;
}

.seal-line span,
.site-footer__line {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(224, 183, 91, 0.65));
}

.seal-line span:last-child,
.site-footer__line:last-child {
  transform: scaleX(-1);
}

.seal-line b {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border: 1px solid var(--gold);
  background: rgba(14, 63, 46, 0.82);
  color: var(--gold-pale);
  font-family: "STSong", "Songti SC", serif;
  font-size: 17px;
  font-weight: 500;
  transform: rotate(45deg);
}

.seal-line b > i {
  font-style: normal;
  transform: rotate(-45deg);
}

.entry-form {
  width: min(100%, 340px);
  margin: 0 auto;
  border-block: 1px solid rgba(224, 183, 91, 0.22);
  padding: 22px 0 24px;
  background: rgba(7, 42, 31, 0.3);
}

.entry-form fieldset {
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

.entry-form legend {
  width: 100%;
  margin-bottom: 16px;
  color: var(--ivory);
  font-size: 14px;
  text-align: center;
}

.digit-group {
  display: grid;
  grid-template-columns: repeat(4, 58px);
  justify-content: center;
  gap: 10px;
}

.digit-input {
  width: 58px;
  height: 64px;
  border: 1px solid rgba(224, 183, 91, 0.5);
  border-radius: 6px;
  background:
    linear-gradient(145deg, rgba(255, 244, 213, 0.12), rgba(255, 244, 213, 0.03)),
    rgba(7, 38, 28, 0.82);
  color: var(--gold-pale);
  caret-color: var(--gold-pale);
  font-family: Georgia, serif;
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  box-shadow: inset 0 0 0 3px rgba(5, 31, 23, 0.48);
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.digit-input:focus {
  border-color: var(--gold-pale);
  background: rgba(23, 84, 61, 0.9);
  transform: translateY(-2px);
}

.digit-input.is-filled {
  border-color: var(--gold);
}

.digit-group.has-error {
  animation: field-shake 360ms ease;
}

.digit-group.has-error .digit-input {
  border-color: #ff8b74;
}

.form-message {
  min-height: 20px;
  margin: 10px 0 0;
  color: #ffc3b5;
  font-size: 12px;
  text-align: center;
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  width: min(100%, 270px);
  min-height: 50px;
  margin: 2px auto 0;
  border: 1px solid #f2cd76;
  border-radius: 7px;
  padding: 0 22px;
  background: linear-gradient(135deg, #f4d886, #c9912d);
  color: #173a2b;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 9px 24px rgba(0, 0, 0, 0.24), inset 0 1px rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease, opacity 160ms ease;
}

.primary-button:active {
  transform: translateY(2px);
  filter: brightness(0.96);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.primary-button.is-loading .button-arrow {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(23, 58, 43, 0.3);
  border-top-color: #173a2b;
  border-radius: 50%;
  color: transparent;
  animation: spin 650ms linear infinite;
}

.button-arrow {
  font-size: 21px;
  font-weight: 400;
}

.entry-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
  color: rgba(255, 244, 213, 0.55);
  font-size: 11px;
}

.entry-meta i {
  width: 3px;
  height: 3px;
  background: var(--gold);
  transform: rotate(45deg);
}

.winner-strip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: min(100%, 340px);
  min-height: 34px;
  margin: 28px auto 0;
  border-left: 2px solid var(--gold);
  padding: 0 12px;
  background: rgba(6, 37, 28, 0.58);
  color: rgba(255, 244, 213, 0.72);
  font-size: 11px;
}

.winner-strip__label {
  color: var(--gold-pale);
  font-weight: 700;
}

.winner-strip__window {
  height: 18px;
  overflow: hidden;
}

.winner-strip__track {
  display: flex;
  flex-direction: column;
  animation: ticker 8s steps(3, end) infinite;
}

.winner-strip__track span {
  height: 18px;
  overflow: hidden;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screen--draw {
  display: flex;
  flex-direction: column;
  padding-top: 28px;
}

.draw-heading {
  text-align: center;
}

.draw-heading h2 {
  margin: 0;
  color: var(--gold-pale);
  font-family: "STSong", "Songti SC", serif;
  font-size: 34px;
  line-height: 1.2;
  letter-spacing: 0;
}

.draw-heading > p:last-child {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 2px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 10px;
  width: min(100%, 360px);
  margin: 31px auto 0;
  perspective: 900px;
}

.fortune-card {
  position: relative;
  width: 100%;
  aspect-ratio: 0.72;
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
  cursor: pointer;
  perspective: 850px;
  transition: opacity 300ms ease, filter 300ms ease, transform 180ms ease;
}

.fortune-card:not(:disabled):active {
  transform: translateY(2px) scale(0.98);
}

.fortune-card__inner {
  position: absolute;
  inset: 0;
  display: block;
  transform-style: preserve-3d;
  transition: transform 760ms cubic-bezier(0.2, 0.75, 0.25, 1.15);
}

.fortune-card.is-flipped .fortune-card__inner {
  transform: rotateY(180deg);
}

.fortune-card.is-selected {
  z-index: 2;
  filter: drop-shadow(0 15px 18px rgba(0, 0, 0, 0.34));
}

.fortune-card.is-selected::before {
  position: absolute;
  z-index: -1;
  inset: -7px;
  border: 1px solid rgba(246, 223, 161, 0.75);
  border-radius: 8px;
  content: "";
  animation: selected-frame 1.2s ease-in-out infinite;
}

.fortune-card.is-muted {
  filter: grayscale(0.45) brightness(0.52);
  opacity: 0.64;
}

.fortune-card.is-pending .fortune-card__inner {
  animation: card-thinking 600ms ease-in-out infinite alternate;
}

.fortune-card__face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 8px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.fortune-card__front {
  border: 1px solid rgba(246, 223, 161, 0.7);
  background:
    linear-gradient(135deg, transparent 47%, rgba(224, 183, 91, 0.11) 48% 52%, transparent 53%),
    linear-gradient(45deg, transparent 47%, rgba(224, 183, 91, 0.08) 48% 52%, transparent 53%),
    linear-gradient(160deg, #1b5a42 0%, #082d22 55%, #124b37 100%);
  box-shadow: inset 0 0 0 4px #082a20, inset 0 0 0 5px rgba(224, 183, 91, 0.45);
}

.fortune-card__front::before,
.fortune-card__front::after {
  position: absolute;
  width: 56px;
  height: 14px;
  border: 1px solid rgba(224, 183, 91, 0.26);
  border-radius: 50%;
  content: "";
  transform: rotate(-35deg);
}

.fortune-card__front::before {
  top: 14px;
  right: -27px;
}

.fortune-card__front::after {
  bottom: 14px;
  left: -27px;
}

.card-emblem {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--gold);
  background: #1d3f30;
  box-shadow: inset 0 0 0 4px #183327, 0 5px 15px rgba(0, 0, 0, 0.22);
  transform: rotate(45deg);
}

.card-emblem b {
  color: var(--gold-pale);
  font-family: "STSong", "Songti SC", serif;
  font-size: 25px;
  font-weight: 500;
  transform: rotate(-45deg);
}

.card-number {
  margin-top: 16px;
  color: rgba(246, 223, 161, 0.66);
  font-family: Georgia, serif;
  font-size: 12px;
  letter-spacing: 2px;
}

.card-corner {
  position: absolute;
  color: rgba(224, 183, 91, 0.68);
  font-family: "STSong", "Songti SC", serif;
  font-size: 11px;
}

.card-corner--top {
  top: 10px;
  left: 11px;
}

.card-corner--bottom {
  right: 11px;
  bottom: 10px;
  transform: rotate(180deg);
}

.fortune-card__back {
  border: 1px solid #f7dc8f;
  background:
    linear-gradient(45deg, rgba(23, 84, 61, 0.09) 25%, transparent 25% 75%, rgba(23, 84, 61, 0.09) 75%),
    #fff1c8;
  background-size: 18px 18px;
  color: #174b38;
  box-shadow: inset 0 0 0 5px #d6a443, inset 0 0 0 7px #fff1c8;
  transform: rotateY(180deg);
}

.card-result-label {
  font-size: 11px;
  letter-spacing: 1px;
}

.card-result-amount {
  margin-top: 8px;
  font-family: Georgia, serif;
  font-size: 25px;
}

.card-result-unit {
  margin-top: 2px;
  font-size: 10px;
}

.draw-status {
  min-height: 21px;
  margin: 22px 0 0;
  color: rgba(255, 244, 213, 0.65);
  font-size: 12px;
  text-align: center;
}

.draw-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100%, 360px);
  min-height: 38px;
  margin: auto auto 0;
  border-top: 1px solid rgba(224, 183, 91, 0.18);
  color: rgba(255, 244, 213, 0.48);
  font-size: 11px;
}

.draw-footer .text-button {
  color: var(--gold-pale);
}

.site-footer {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 24px var(--safe-bottom);
  color: rgba(255, 244, 213, 0.38);
  font-family: "STSong", "Songti SC", serif;
  font-size: 10px;
  letter-spacing: 1px;
}

.modal {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
}

.modal.is-opening .modal__panel {
  animation: modal-in 360ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 21, 15, 0.8);
  backdrop-filter: blur(8px);
}

.modal__panel {
  position: relative;
  z-index: 1;
  width: min(100%, 360px);
  max-height: min(690px, calc(100svh - 36px));
  overflow-y: auto;
  border: 1px solid rgba(224, 183, 91, 0.72);
  border-radius: 8px;
  background: #0d3528;
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.5), inset 0 0 0 5px rgba(224, 183, 91, 0.05);
}

.modal__close {
  position: absolute;
  z-index: 4;
  top: 10px;
  right: 10px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: rgba(5, 35, 26, 0.62);
  color: var(--ivory);
  font-size: 25px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
}

.result-panel {
  overflow: hidden;
  padding: 34px 24px 28px;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.68), transparent 32%),
    linear-gradient(180deg, #fff9e9, #f3e5bd 72%, #e8d39c);
  text-align: center;
}

.result-panel::before {
  position: absolute;
  top: -136px;
  left: 50%;
  width: 310px;
  height: 310px;
  border: 1px solid rgba(246, 223, 161, 0.25);
  content: "";
  transform: translateX(-50%) rotate(45deg);
}

.result-panel h2,
.info-panel h2 {
  position: relative;
  z-index: 1;
  margin: 0;
  color: var(--gold-pale);
  font-family: "STSong", "Songti SC", serif;
  font-size: 25px;
  letter-spacing: 0;
}

.result-panel h2 {
  color: #174b38;
}

.result-kicker {
  position: relative;
  z-index: 1;
  margin-top: 2px;
}

.result-panel .result-kicker {
  color: var(--gold-deep);
}

.result-panel .modal__close {
  background: rgba(13, 53, 40, 0.9);
  color: var(--ivory);
}

.result-art {
  position: relative;
  z-index: 1;
  display: block;
  width: 190px;
  height: auto;
  margin: 19px auto -5px;
  filter: drop-shadow(0 12px 14px rgba(45, 37, 20, 0.2));
}

.result-amount {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  color: #174b38;
  font-family: Georgia, serif;
  line-height: 1;
}

.result-amount small {
  margin: 8px 5px 0 0;
  font-size: 22px;
}

.result-amount strong {
  font-size: 58px;
  letter-spacing: 0;
}

.result-note {
  position: relative;
  z-index: 1;
  margin: 12px 0 20px;
  color: rgba(13, 53, 40, 0.68);
  font-size: 12px;
}

.primary-button--light {
  position: relative;
  z-index: 1;
  width: min(100%, 240px);
}

.info-panel {
  padding: 29px 24px 26px;
  background:
    linear-gradient(90deg, transparent 0 20px, rgba(224, 183, 91, 0.04) 20px 21px, transparent 21px),
    #0c3024;
}

.info-panel .modal-kicker {
  margin-right: 40px;
}

.info-panel h2 {
  margin-bottom: 24px;
  font-size: 28px;
}

.rules-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rules-list li {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 13px;
  border-top: 1px solid rgba(224, 183, 91, 0.16);
  padding: 15px 0;
}

.rules-list li:last-child {
  border-bottom: 1px solid rgba(224, 183, 91, 0.16);
}

.rules-list span {
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: 14px;
}

.rules-list p {
  margin: 0;
  color: rgba(255, 244, 213, 0.72);
  font-size: 13px;
  line-height: 1.7;
}

.record-list {
  display: grid;
  gap: 10px;
}

.record-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border-block: 1px solid rgba(224, 183, 91, 0.16);
  padding: 13px 0;
}

.record-item + .record-item {
  border-top: 0;
}

.record-item__seal {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(224, 183, 91, 0.52);
  background: var(--green);
  color: var(--gold-pale);
  font-family: "STSong", "Songti SC", serif;
}

.record-item__main strong,
.record-item__main time {
  display: block;
}

.record-item__main strong {
  color: var(--ivory);
  font-size: 13px;
}

.record-item__main time {
  margin-top: 4px;
  color: rgba(255, 244, 213, 0.42);
  font-size: 10px;
}

.record-item__amount {
  color: var(--gold-pale);
  font-family: Georgia, serif;
  font-size: 18px;
  font-weight: 700;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 150px;
  border-block: 1px solid rgba(224, 183, 91, 0.16);
  color: rgba(255, 244, 213, 0.5);
  font-size: 13px;
}

.toast {
  position: fixed;
  z-index: 200;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 50%;
  max-width: min(330px, calc(100vw - 40px));
  border: 1px solid rgba(224, 183, 91, 0.52);
  border-radius: 6px;
  padding: 11px 16px;
  background: rgba(25, 60, 46, 0.95);
  color: var(--ivory);
  font-size: 12px;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.34);
  transform: translateX(-50%);
  animation: toast-in 240ms ease both;
}

.confetti-piece {
  position: fixed;
  z-index: 120;
  top: -18px;
  width: 8px;
  height: 15px;
  pointer-events: none;
  animation: confetti-fall var(--fall-duration) cubic-bezier(0.15, 0.7, 0.25, 1) forwards;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes field-shake {
  0%, 100% { transform: translateX(0); }
  30% { transform: translateX(-7px); }
  60% { transform: translateX(7px); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes ticker {
  0%, 27% { transform: translateY(0); }
  34%, 60% { transform: translateY(-18px); }
  67%, 94% { transform: translateY(-36px); }
  100% { transform: translateY(0); }
}

@keyframes card-thinking {
  from { transform: translateY(0) rotateY(0); }
  to { transform: translateY(-5px) rotateY(5deg); }
}

@keyframes selected-frame {
  0%, 100% { opacity: 0.42; transform: scale(0.98); }
  50% { opacity: 1; transform: scale(1.02); }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes confetti-fall {
  0% { opacity: 0; transform: translate3d(0, -12px, 0) rotate(0deg); }
  12% { opacity: 1; }
  100% { opacity: 0; transform: translate3d(var(--drift), 105vh, 0) rotate(var(--spin)); }
}

@media (max-width: 360px) {
  .screen {
    padding-inline: 17px;
  }

  .screen.screen--landing {
    padding: 0;
  }

  .brand-block {
    margin-top: 3vh;
  }

  .brand-block h1 {
    font-size: 43px;
  }

  .digit-group {
    grid-template-columns: repeat(4, 54px);
    gap: 7px;
  }

  .digit-input {
    width: 54px;
    height: 60px;
  }

  .card-grid {
    gap: 9px 8px;
  }

  .draw-heading h2 {
    font-size: 31px;
  }

  .landing-copy {
    right: 16px;
    left: 16px;
  }

  .landing-copy h1 {
    font-size: 45px;
  }

  .landing-steps {
    right: 12px;
    left: 12px;
  }

  .landing-steps ol {
    gap: 5px;
  }

  .landing-steps li > strong {
    font-size: 11px;
  }

  .landing-steps li > small {
    font-size: 9px;
  }

  .scan-button {
    right: 18px;
    left: 18px;
  }
}

@media (max-height: 700px) {
  .landing-copy {
    top: 35px;
  }

  .landing-brand {
    margin-bottom: 8px;
  }

  .landing-copy h1 {
    font-size: 43px;
  }

  .landing-subtitle {
    margin-top: 8px;
  }

  .landing-steps {
    bottom: 105px;
  }

  .landing-steps__title {
    margin-bottom: 10px;
  }

  .step-icon {
    width: 50px;
    height: 50px;
  }

  .scan-button {
    bottom: max(18px, env(safe-area-inset-bottom));
    min-height: 52px;
  }
}

@media (min-height: 800px) {
  .brand-block {
    margin-top: 7vh;
  }

  .card-grid {
    margin-top: 36px;
  }
}

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