:root {
  --orange: #ff7a18;
  --orange-dark: #de4f00;
  --blue: #0d6efd;
  --ink: #1e2540;
  --muted: #66728d;
  --line: #e1e7f2;
  --panel: #ffffff;
  --soft: #f7f9fd;
  --danger: #d93026;
  --success: #0b875b;
  --gold: #ffc85a;
  --gold-soft: #ffeec2;
  --wheel-navy: #1f2f5f;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: "Trebuchet MS", "Avenir Next", "Microsoft YaHei", sans-serif;
  background: #eef3f8;
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  font: inherit;
}

.page {
  min-height: 100svh;
  background:
    radial-gradient(circle at top left, rgba(255, 198, 90, .34), transparent 28%),
    radial-gradient(circle at top right, rgba(13, 110, 253, .16), transparent 24%),
    linear-gradient(180deg, #fff8ef 0%, #eef4fb 44%, #e8eef8 100%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 50px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, .86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 800;
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(145deg, #ff8f2f, #db4700);
  box-shadow: 0 10px 18px rgba(255, 122, 24, .28);
}

.env-pill {
  padding: 4px 9px;
  border-radius: 999px;
  color: #7e4a00;
  background: linear-gradient(180deg, #fff8de, #ffe9b0);
  border: 1px solid #ffd979;
  font-size: 12px;
  font-weight: 700;
}

.main {
  width: min(100%, 480px);
  margin: 0 auto;
  padding: 18px 12px 32px;
}

.hero {
  padding: 4px 0 14px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #b76400;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.16;
  letter-spacing: 0;
}

.subcopy {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.lottery-switcher {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 0 16px;
}

.lottery-tab {
  height: 44px;
  border: 1px solid #dbe4f2;
  border-radius: 999px;
  color: #5a6785;
  background: rgba(255, 255, 255, .82);
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(31, 47, 74, .06);
}

.lottery-tab.active {
  color: #fff;
  border-color: #ff8a2a;
  background: linear-gradient(135deg, #ff9f39 0%, #e95b00 100%);
  box-shadow: 0 14px 26px rgba(255, 122, 24, .24);
}

.lottery-pane[hidden] {
  display: none;
}

.lottery-head {
  margin-bottom: 8px;
}

.lottery-head h2 {
  margin: 0;
  font-size: 20px;
}

.lottery-head p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.lottery-card,
.panel,
.rules {
  background: rgba(255, 255, 255, .96);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 20px 54px rgba(31, 47, 74, .1);
}

.lottery-card {
  padding: 18px;
}

.wheel-wrap {
  --wheel-size: min(100%, 336px);
  --wheel-shadow-size: calc(var(--wheel-size) + 22px);
  --wheel-glow-size: calc(var(--wheel-size) + 12px);
  --pointer-size: clamp(30px, 9vw, 38px);
  --center-size: calc(var(--wheel-size) * .38);
  position: relative;
  width: 100%;
  min-height: calc(var(--wheel-size) + 40px);
  padding-top: 12px;
  display: grid;
  place-items: center;
}

.wheel-shadow,
.wheel-glow {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.wheel-shadow {
  width: var(--wheel-shadow-size);
  aspect-ratio: 1;
  background: radial-gradient(circle, rgba(31, 47, 95, .18), rgba(31, 47, 95, 0) 70%);
  filter: blur(18px);
  transform: translateY(16px) scale(.92);
}

.wheel-glow {
  width: var(--wheel-glow-size);
  aspect-ratio: 1;
  background: radial-gradient(circle, rgba(255, 220, 121, .5), rgba(255, 220, 121, 0) 64%);
  transform: scale(1.06);
}

.pointer {
  position: absolute;
  top: 0;
  z-index: 7;
  width: 0;
  height: 0;
  border-left: calc(var(--pointer-size) * .48) solid transparent;
  border-right: calc(var(--pointer-size) * .48) solid transparent;
  border-top: var(--pointer-size) solid #ff6f1a;
  filter: drop-shadow(0 7px 10px rgba(122, 44, 0, .28));
}

.pointer::after {
  content: "";
  position: absolute;
  left: calc(var(--pointer-size) * -.22);
  top: calc(var(--pointer-size) * -.98);
  width: calc(var(--pointer-size) * .42);
  height: calc(var(--pointer-size) * .42);
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff3cf, #ffc14e 58%, #df7800);
  box-shadow: 0 0 0 calc(var(--pointer-size) * .14) rgba(255, 255, 255, .92);
}

.wheel {
  width: var(--wheel-size);
  max-width: 100%;
  aspect-ratio: 1;
  position: relative;
  overflow: hidden;
  border-radius: 50%;
  border: 14px solid rgba(255, 255, 255, .96);
  box-shadow:
    0 22px 36px rgba(20, 36, 64, .18),
    inset 0 0 0 8px rgba(255, 221, 154, .85),
    inset 0 0 0 18px rgba(255, 255, 255, .72);
  transition: transform 4.5s cubic-bezier(.12, .82, .08, 1);
  background: linear-gradient(180deg, #fffdf4, #fff3d6);
}

.wheel::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 2px dashed rgba(255, 248, 220, .9);
  opacity: .9;
}

.wheel-face {
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow:
    inset 0 -10px 24px rgba(31, 47, 95, .08),
    inset 0 14px 28px rgba(255, 255, 255, .46);
}

.wheel-face::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 20%, rgba(255,255,255,.6), transparent 32%),
    linear-gradient(180deg, rgba(255,255,255,.08), rgba(31,47,95,.06));
  pointer-events: none;
}

.wheel-center-ring {
  position: absolute;
  width: var(--center-size);
  height: var(--center-size);
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, #fffdf7, #ffe7a2 46%, #ffb13d 70%, #e27100 100%);
  border: 8px solid rgba(255,255,255,.95);
  box-shadow:
    0 10px 18px rgba(171, 95, 0, .22),
    inset 0 3px 8px rgba(255,255,255,.62);
  z-index: 6;
}

.slice-label {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  transform-origin: 50% 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  pointer-events: none;
}

.slice-label span {
  display: block;
  margin-top: 0;
}

.slice-pill {
  padding: 8px 10px;
  border-radius: 999px;
  color: var(--wheel-navy);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
}

.vertical-pill {
  width: 100%;
  height: 100%;
  padding: 12px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  letter-spacing: .06em;
  line-height: 1.1;
  border-radius: 999px;
  font-size: 12px;
}

.slice-label.active .slice-pill {
  color: #8e4b00;
  text-shadow:
    0 0 14px rgba(255, 235, 170, .95),
    0 0 24px rgba(255, 192, 76, .6);
  animation: winning-flash 720ms ease-in-out infinite;
}

.wheel-empty {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 42px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 800;
}

.spin-btn {
  position: absolute;
  z-index: 8;
  width: calc(var(--center-size) + 10px);
  height: calc(var(--center-size) + 10px);
  border: 0;
  border-radius: 50%;
  color: #fff;
  background:
    radial-gradient(circle at 32% 28%, #fff2cf 0 10%, rgba(255,255,255,0) 11%),
    linear-gradient(180deg, #ff952f, var(--orange-dark));
  box-shadow:
    0 16px 28px rgba(255, 106, 0, .34),
    inset 0 4px 10px rgba(255,255,255,.26);
  cursor: pointer;
  animation: pulse-spin-btn 2.1s ease-in-out infinite;
}

.spin-btn span,
.spin-btn b {
  display: block;
}

.spin-btn span {
  font-size: clamp(15px, 4vw, 17px);
  letter-spacing: .06em;
}

.spin-btn b {
  font-size: clamp(18px, 4.8vw, 22px);
}

.spin-btn:disabled {
  background: #aab3c1;
  box-shadow: none;
  cursor: not-allowed;
  animation: none;
}

.form {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 800;
  color: #3a4658;
}

input {
  width: 100%;
  height: 46px;
  padding: 0 12px;
  border: 1px solid #cbd4e3;
  border-radius: 6px;
  outline: none;
  background: #fff;
  color: var(--ink);
}

input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(19, 102, 255, .13);
}

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

.hint.error {
  color: var(--danger);
  font-weight: 800;
}

.hint.ok {
  color: var(--success);
  font-weight: 800;
}

.result {
  display: none;
  margin-top: 14px;
  padding: 14px;
  border-radius: 8px;
  background: #fff7f0;
  border: 1px solid #ffd6ba;
  line-height: 1.7;
}

.result.show {
  display: block;
}

.result strong {
  color: #bf4c00;
  font-size: 18px;
}

.prize-mapping-panel,
.panel,
.rules {
  margin-top: 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.panel-head h2,
.rules h2 {
  margin: 0;
  font-size: 18px;
}

.panel,
.rules {
  padding: 18px;
}

.prize-mapping-list {
  overflow-x: auto;
}

.mapping-table-wrap {
  border: 1px solid #e4eaf3;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}

.mapping-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.mapping-table th,
.mapping-table td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
  line-height: 1.6;
}

.mapping-table thead th {
  color: #66728d;
  font-size: 13px;
  font-weight: 800;
  background: linear-gradient(180deg, #f8fbff 0%, #f2f6fc 100%);
  border-bottom: 1px solid #e4eaf3;
}

.mapping-table tbody tr + tr th,
.mapping-table tbody tr + tr td {
  border-top: 1px solid #edf1f7;
}

.mapping-table tbody th.mapping-level {
  width: 96px;
  color: #a34f00;
  font-weight: 900;
  background: #fffaf1;
}

.mapping-table tbody td.mapping-prize {
  color: #2f3a56;
  background: #fff;
}

.mapping-empty {
  padding: 14px;
  border-radius: 14px;
  color: var(--muted);
  background: #f7f9fd;
  border: 1px dashed #cfd8e6;
  text-align: center;
}

@media (max-width: 420px) {
  .mapping-table {
    min-width: 320px;
  }

  .mapping-table th,
  .mapping-table td {
    padding: 11px 12px;
    font-size: 13px;
  }

  .mapping-table tbody th.mapping-level {
    width: 84px;
  }
}

.result p {
  margin: 4px 0;
  font-weight: 800;
}

.result small {
  color: var(--muted);
}

.panel,
.rules {
  margin-top: 14px;
  padding: 16px;
  box-shadow: none;
  background: rgba(255, 255, 255, .88);
}

.panel-head {
  margin-bottom: 12px;
}

.panel h2,
.rules h2 {
  margin: 0;
  font-size: 18px;
}

.query-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px;
  gap: 9px;
}

.query-row button {
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: var(--blue);
  font-weight: 800;
}

.query-result {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  background: var(--soft);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.query-result b {
  color: var(--orange-dark);
}

.rules {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.rules p {
  margin: 8px 0 0;
}

@keyframes pulse-spin-btn {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.035);
  }
}

@keyframes winning-flash {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
    text-shadow:
      0 0 10px rgba(255, 235, 170, .8),
      0 0 18px rgba(255, 192, 76, .45);
  }
  50% {
    opacity: .35;
    transform: scale(1.08);
    text-shadow:
      0 0 20px rgba(255, 247, 210, 1),
      0 0 32px rgba(255, 184, 61, .8);
  }
}

@media (max-width: 380px) {
  h1 {
    font-size: 27px;
  }

  .wheel-wrap {
    --wheel-size: min(100%, 304px);
    min-height: calc(var(--wheel-size) + 32px);
  }

  .spin-btn {
    width: calc(var(--center-size) + 6px);
    height: calc(var(--center-size) + 6px);
  }

  .slice-pill {
    font-size: 11px;
    padding: 7px 8px;
  }

  .vertical-pill {
    font-size: 11px;
    padding: 10px 5px;
  }
}
