:root {
  --cyan: #72fff8;
  --cyan-strong: #18d8ff;
  --ink: #030712;
  --night: #06101f;
  --panel: rgba(2, 8, 23, 0.78);
  --panel-solid: #071121;
  --line: rgba(114, 255, 248, 0.28);
  --white: #f8fbff;
  --muted: #b8c7d9;
  --danger: #ff6b7a;
  --gold: #ffd56a;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ink);
  color: var(--white);
}

html {
  scroll-behavior: smooth;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.guest-shell {
  min-height: 100vh;
  scroll-snap-type: y proximity;
}

.cover-screen {
  position: relative;
  min-height: 100vh;
  scroll-snap-align: start;
  background: #02030a;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.cover-image {
  display: block;
  width: auto;
  max-width: 720px;
  height: 100vh;
  max-height: 100vh;
  object-fit: contain;
}

.cover-action {
  position: absolute;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  justify-content: center;
  width: min(260px, 72vw);
  padding: 0;
  pointer-events: none;
}

.swipe-hint {
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  text-shadow:
    0 0 7px rgba(114,255,248,0.92),
    0 0 18px rgba(24,216,255,0.78),
    0 2px 5px rgba(0,0,0,0.85);
  animation: swipeTextPulse 1.6s ease-in-out infinite;
}

.swipe-arrows {
  display: grid;
  gap: 0;
  justify-items: center;
  line-height: 0.8;
  margin-bottom: 1px;
}

.swipe-arrows span {
  display: block;
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  text-shadow:
    0 0 8px rgba(114,255,248,0.95),
    0 0 18px rgba(24,216,255,0.78),
    0 2px 5px rgba(0,0,0,0.85);
  opacity: 0.22;
  transform: translateY(8px);
  animation: arrowGuide 1.35s ease-in-out infinite;
}

.swipe-arrows span:nth-child(1) {
  animation-delay: 0.26s;
}

.swipe-arrows span:nth-child(2) {
  animation-delay: 0.13s;
}

.swipe-arrows span:nth-child(3) {
  animation-delay: 0s;
}

@keyframes arrowGuide {
  0%,
  100% {
    opacity: 0.15;
    transform: translateY(8px);
  }

  42% {
    opacity: 1;
    transform: translateY(-3px);
  }

  70% {
    opacity: 0.35;
    transform: translateY(-8px);
  }
}

@keyframes swipeTextPulse {
  0%,
  100% {
    opacity: 0.72;
  }

  50% {
    opacity: 1;
  }
}

.admin-link {
  position: absolute;
  z-index: 3;
  top: 18px;
  right: 18px;
  color: var(--white);
  text-decoration: none;
  padding: 9px 14px;
  border: 1px solid rgba(255,255,255,0.4);
  background: rgba(0,0,0,0.42);
  border-radius: 999px;
  font-size: 14px;
}

.primary-button,
.ghost-button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 20px;
  font-weight: 800;
}

.primary-button {
  color: #001018;
  background: linear-gradient(135deg, var(--cyan), var(--cyan-strong));
  box-shadow: 0 0 24px rgba(24, 216, 255, 0.34);
}

.ghost-button {
  color: var(--white);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.16);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.danger-button {
  min-height: 44px;
  border-radius: 8px;
  padding: 0 20px;
  font-weight: 800;
  color: #fff;
  background: rgba(255, 107, 122, 0.18);
  border: 1px solid rgba(255, 107, 122, 0.54);
}

.lottery-screen {
  position: relative;
  min-height: 100vh;
  scroll-snap-align: start;
  padding: 24px 16px 32px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #02030a;
}

.lottery-backdrop {
  position: absolute;
  inset: 0;
  background: url("/assets/lottery-bg.jpg") center / cover no-repeat;
  transform: scale(1.02);
}

.floating-draw-button {
  position: absolute;
  z-index: 4;
  top: max(18px, env(safe-area-inset-top));
  right: 18px;
  min-height: 42px;
  border: 1px solid rgba(114,255,248,0.72);
  border-radius: 999px;
  padding: 0 18px;
  color: #001018;
  background: linear-gradient(135deg, var(--cyan), var(--cyan-strong));
  font-weight: 900;
  box-shadow: 0 0 28px rgba(24, 216, 255, 0.42);
}

.modal-overlay {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(4px);
}

.lottery-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  padding: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(10px);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.48);
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 50%;
  background: rgba(0,0,0,0.44);
  color: var(--white);
  font-size: 24px;
  line-height: 1;
}

.brand-row {
  display: flex;
  gap: 14px;
  align-items: center;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--cyan);
  color: #03111a;
  font-weight: 900;
}

h1,
h2,
p {
  margin: 0;
}

.brand-row h1,
.admin-header h1 {
  font-size: 26px;
  line-height: 1.2;
}

.brand-row p,
.message {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.wheel-wrap {
  position: relative;
  width: min(82vw, 360px);
  aspect-ratio: 1;
  margin: 26px auto 20px;
}

.pointer {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: -4px;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 18px solid transparent;
  border-right: 18px solid transparent;
  border-top: 32px solid var(--gold);
  filter: drop-shadow(0 5px 8px rgba(0,0,0,0.45));
}

.wheel {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 10px solid rgba(255,255,255,0.88);
  background: conic-gradient(from -90deg,
    #ff476d 0 60deg,
    #ffd166 60deg 120deg,
    #18d8ff 120deg 180deg,
    #72fff8 180deg 240deg,
    #2dd4bf 240deg 300deg,
    #8b5cf6 300deg 360deg);
  box-shadow: inset 0 0 0 2px rgba(0,0,0,0.28), 0 0 36px rgba(114,255,248,0.38);
  transition: transform 4.2s cubic-bezier(.14,.84,.12,1);
}

.wheel::after {
  content: "";
  position: absolute;
  inset: 13%;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.45);
}

.wheel-center {
  position: absolute;
  z-index: 2;
  inset: 50% auto auto 50%;
  width: 76px;
  height: 76px;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #020617;
  border: 5px solid var(--cyan);
  color: var(--cyan);
  font-size: 34px;
  font-weight: 900;
}

.wheel-label {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  width: 86px;
  margin-left: -43px;
  margin-top: -13px;
  text-align: center;
  color: #06101f;
  font-weight: 900;
  font-size: 17px;
  text-shadow: 0 1px 0 rgba(255,255,255,0.5);
  transform-origin: 43px 13px;
}

.label-special { transform: rotate(30deg) translateY(-118px) rotate(-30deg); }
.label-first { transform: rotate(90deg) translateY(-118px) rotate(-90deg); }
.label-second { transform: rotate(150deg) translateY(-118px) rotate(-150deg); }
.label-third { transform: rotate(210deg) translateY(-118px) rotate(-210deg); }
.label-fourth { transform: rotate(270deg) translateY(-118px) rotate(-270deg); }
.label-lucky { transform: rotate(330deg) translateY(-118px) rotate(-330deg); }

.draw-form label,
.stack-form label,
.inline-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.code-row,
.inline-form {
  display: flex;
  gap: 10px;
  align-items: end;
  margin-top: 8px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  background: rgba(1, 5, 15, 0.72);
  color: var(--white);
  min-height: 44px;
  padding: 0 12px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(114,255,248,0.18);
}

.result-card {
  margin-top: 16px;
  min-height: 74px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.36);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 14px;
  color: var(--muted);
}

.result-card strong {
  display: block;
  color: var(--cyan);
  font-size: 24px;
  margin-bottom: 4px;
}

.admin-page {
  background:
    linear-gradient(135deg, rgba(24,216,255,0.13), transparent 34%),
    #050914;
}

.admin-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 46px;
}

.login-panel,
.admin-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-solid);
  box-shadow: 0 18px 60px rgba(0,0,0,0.35);
}

.login-panel {
  width: min(420px, 100%);
  margin: 12vh auto 0;
  padding: 24px;
}

.stack-form {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
}

.eyebrow {
  color: var(--cyan);
  font-weight: 900;
  letter-spacing: 0;
  margin-bottom: 4px;
}

.header-actions {
  display: flex;
  gap: 10px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.summary-card {
  padding: 16px;
  border-radius: 8px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
}

.summary-card span {
  color: var(--muted);
  font-size: 13px;
}

.summary-card strong {
  display: block;
  margin-top: 6px;
  font-size: 26px;
}

.admin-card {
  padding: 18px;
  margin-top: 14px;
}

.admin-card h2 {
  font-size: 20px;
  margin-bottom: 14px;
}

.inline-form label {
  min-width: 190px;
  flex: 1;
}

textarea {
  display: block;
  min-height: 120px;
  padding: 12px;
  margin-top: 14px;
  resize: vertical;
}

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

.table-head h2 {
  margin: 0;
}

.table-head input {
  width: min(320px, 46vw);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.09);
  text-align: left;
  font-size: 14px;
}

th {
  color: var(--cyan);
  font-weight: 900;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(114,255,248,0.12);
  color: var(--cyan);
  font-weight: 800;
}

.pill.used {
  background: rgba(255,107,122,0.12);
  color: var(--danger);
}

@media (max-width: 720px) {
  .lottery-screen {
    padding: 14px;
  }

  .lottery-panel {
    padding: 15px;
  }

  .floating-draw-button {
    right: 14px;
  }

  .brand-row h1 {
    font-size: 22px;
  }

  .code-row,
  .inline-form,
  .admin-header,
  .table-head {
    display: grid;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .header-actions {
    flex-wrap: wrap;
  }

  .table-head input {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .wheel-label {
    font-size: 15px;
  }

  .label-special { transform: rotate(30deg) translateY(-104px) rotate(-30deg); }
  .label-first { transform: rotate(90deg) translateY(-104px) rotate(-90deg); }
  .label-second { transform: rotate(150deg) translateY(-104px) rotate(-150deg); }
  .label-third { transform: rotate(210deg) translateY(-104px) rotate(-210deg); }
  .label-fourth { transform: rotate(270deg) translateY(-104px) rotate(-270deg); }
  .label-lucky { transform: rotate(330deg) translateY(-104px) rotate(-330deg); }
}
