:root {
  --red: #d71920;
  --hot-red: #f43f3f;
  --deep-red: #8f0f18;
  --dark-red: #650910;
  --gold: #ffd166;
  --light-gold: #fff2bc;
  --paper: #fffaf0;
  --ink: #2b1512;
  --muted: #85625a;
  --line: #f1d5b5;
  --green: #1f9d65;
  --shadow: 0 24px 60px rgba(112, 9, 18, 0.22);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 209, 102, 0.35), transparent 18rem),
    radial-gradient(circle at 88% 4%, rgba(255, 241, 168, 0.28), transparent 16rem),
    linear-gradient(180deg, #b90f1a 0%, #e0242d 38%, #fff3d2 100%);
}

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

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 26px 18px 46px;
}

.mobile-panel {
  width: min(470px, 100%);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(255, 229, 154, 0.72);
  border-radius: 30px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.hero {
  position: relative;
  min-height: 338px;
  padding: 20px 22px 28px;
  color: #fff;
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 229, 154, 0.42), transparent 7rem),
    radial-gradient(circle at 92% 28%, rgba(255, 209, 102, 0.38), transparent 8rem),
    linear-gradient(145deg, #e72932 0%, #b40f1a 54%, #7d0a13 100%);
  background-position: center;
  background-size: cover;
}

.hero::before,
.hero::after {
  position: absolute;
  border-radius: 50%;
  content: "";
}

.hero::before {
  right: -54px;
  bottom: -54px;
  width: 180px;
  height: 180px;
  border: 22px solid rgba(255, 209, 102, 0.28);
}

.hero::after {
  left: -34px;
  top: 92px;
  width: 94px;
  height: 94px;
  background: rgba(255, 241, 168, 0.14);
}

.topbar,
.block-head,
.admin-header,
.admin-actions,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ghost-button {
  position: relative;
  z-index: 1;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(255, 229, 154, 0.72);
  border-radius: 999px;
  color: var(--light-gold);
  background: rgba(255, 255, 255, 0.1);
  font-weight: 800;
}

.hero-copy {
  position: relative;
  z-index: 1;
  margin-top: 50px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--light-gold);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0;
}

.hero h1,
.admin-header h1,
.login-box h1 {
  margin: 0;
  font-size: 40px;
  line-height: 1.1;
  letter-spacing: 0;
}

.hero p {
  max-width: 390px;
  margin: 16px 0 0;
  color: #fff7d6;
  font-size: 16px;
  line-height: 1.72;
}

.qualification-card {
  display: grid;
  gap: 12px;
  margin: -42px 20px 0;
  padding: 18px;
  border: 1px solid rgba(255, 209, 102, 0.72);
  border-radius: 18px;
  background: linear-gradient(135deg, #fff8dc, #ffffff);
  box-shadow: 0 18px 34px rgba(112, 9, 18, 0.16);
  position: relative;
  z-index: 2;
}

.payout-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.qualification-card div {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.qualification-card span {
  color: var(--deep-red);
  font-size: 15px;
  font-weight: 900;
}

.qualification-card strong {
  color: var(--red);
  font-size: 16px;
}

.qualification-card b {
  font-size: 34px;
}

.form-band,
.lottery-zone,
.wechat-card {
  padding: 20px;
}

.ticker-card {
  margin: 0 20px 16px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 209, 102, 0.72);
  border-radius: 16px;
  background: #fff8dc;
  overflow: hidden;
}

.ticker-title {
  margin-bottom: 8px;
  color: var(--deep-red);
  font-size: 13px;
  font-weight: 900;
}

.ticker-window {
  height: 96px;
  overflow: hidden;
}

.ticker-track {
  display: grid;
  gap: 8px;
  animation: tickerMove 12s linear infinite;
}

.ticker-track span {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0 10px;
  border-radius: 10px;
  color: #8f0f18;
  background: #fff0bc;
  font-size: 13px;
  font-weight: 800;
}

.compact-form {
  padding-bottom: 8px;
}

label {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--dark-red);
  font-size: 14px;
  font-weight: 900;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px 14px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(215, 25, 32, 0.12);
}

.primary-button,
.secondary-button,
.plain-button,
.demo-button {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 10px;
  font-weight: 900;
}

.primary-button {
  color: #fff;
  background: linear-gradient(135deg, #f23a3f, #b80f18);
  box-shadow: 0 10px 22px rgba(215, 25, 32, 0.24);
}

.secondary-button {
  color: var(--deep-red);
  background: #fff4d1;
}

.secondary-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  color: var(--deep-red);
  background: #fff4d1;
  font-weight: 900;
  text-decoration: none;
}

.plain-button {
  width: 100%;
  margin-top: 10px;
  color: var(--muted);
  background: transparent;
}

.full-button {
  width: 100%;
}

.demo-button {
  margin-top: 10px;
  color: #8f0f18;
  background: linear-gradient(135deg, #fff7c7, #ffd166);
  box-shadow: 0 8px 18px rgba(201, 136, 20, 0.18);
}

.demo-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.code-status {
  margin: 0;
  padding: 12px 13px;
  border-radius: 10px;
  color: #9b6200;
  background: #fff0bc;
  font-size: 13px;
  line-height: 1.55;
}

.code-status.ok {
  color: #11633e;
  background: rgba(31, 157, 101, 0.13);
}

.lottery-zone {
  background: linear-gradient(180deg, #fff6dc 0%, #fffaf0 100%);
  text-align: center;
}

.wheel-stage {
  position: relative;
  margin: 0 auto;
  padding: 12px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffefad 0%, #d71920 64%, #850b13 100%);
  box-shadow: 0 22px 42px rgba(112, 9, 18, 0.26);
}

.wheel-lights {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, #fff4bd 0 5deg, transparent 5deg 10deg);
  opacity: 0.55;
  animation: lightsPulse 16s linear infinite;
}

.wheel-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: min(410px, 100%);
  aspect-ratio: 1;
  margin: 0 auto;
}

#lotteryWheel {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 20px 30px rgba(112, 9, 18, 0.25));
  transition: transform 7.8s cubic-bezier(0.08, 0.78, 0.05, 1);
}

.draw-button {
  position: absolute;
  display: grid;
  place-items: center;
  width: 126px;
  height: 126px;
  border: 10px solid #fff7c7;
  border-radius: 50%;
  color: #8f0f18;
  background: radial-gradient(circle at 35% 28%, #fff8ca 0%, #ffd166 42%, #c98814 100%);
  box-shadow: 0 14px 30px rgba(201, 136, 20, 0.42);
  font-size: 19px;
  font-weight: 900;
  line-height: 1.15;
}

.draw-button::before {
  position: absolute;
  top: -38px;
  width: 0;
  height: 0;
  border-right: 17px solid transparent;
  border-bottom: 42px solid #ffd166;
  border-left: 17px solid transparent;
  content: "";
}

.draw-button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.45);
  opacity: 0.72;
}

.notice,
.helper-text {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.wechat-card {
  display: grid;
  gap: 12px;
  margin: 0 20px 22px;
  border: 1px solid rgba(255, 209, 102, 0.72);
  border-radius: 16px;
  background: #fff8dc;
}

.wechat-card span,
.wechat-card p {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.wechat-card strong {
  display: block;
  margin: 5px 0;
  color: var(--deep-red);
  font-size: 16px;
}

.block-head button,
#exportRecords {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--deep-red);
  background: #ffe59a;
  font-weight: 900;
}

.admin-shell {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.admin-login,
.admin-panel {
  width: 100%;
  margin: 0;
}

.login-box {
  width: min(420px, 100%);
  margin: 40px auto 0;
  padding: 24px;
  border: 1px solid rgba(255, 229, 154, 0.72);
  border-radius: 18px;
  background: rgba(255, 250, 240, 0.96);
  box-shadow: var(--shadow);
}

.login-box .eyebrow,
.admin-header .eyebrow {
  color: var(--red);
}

.login-box h1 {
  margin-bottom: 18px;
  font-size: 30px;
}

.admin-header {
  position: sticky;
  top: 12px;
  z-index: 4;
  padding: 14px 18px;
  border: 1px solid rgba(255, 229, 154, 0.72);
  border-radius: 16px;
  background: rgba(255, 250, 240, 0.98);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 12px;
}

.admin-block {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: 14px;
  border: 1px solid rgba(255, 229, 154, 0.72);
  border-radius: 14px;
  background: rgba(255, 250, 240, 0.96);
  box-shadow: 0 12px 34px rgba(112, 9, 18, 0.1);
}

.admin-block:hover {
  border-color: rgba(255, 209, 102, 0.95);
}

.admin-block.wide {
  grid-column: 1 / -1;
}

.module-title h2 {
  margin: 0;
  font-size: 16px;
}

.module-title {
  display: grid;
  gap: 6px;
  min-height: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  background: linear-gradient(180deg, #fff3c7, #fffaf0);
  color: var(--deep-red);
}

.module-title p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.55;
}

.collapse-toggle {
  justify-self: start;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--deep-red);
  background: #ffe59a;
  font-size: 12px;
  font-weight: 900;
}

.admin-block.is-collapsed {
  align-items: center;
}

.admin-block.is-collapsed .module-body {
  display: none;
}

.admin-block.is-collapsed .module-title {
  min-height: auto;
}

.module-body {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.settings-block .image-preview,
.settings-block .qr-preview {
  margin: 0;
}

.settings-layout {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
}

.settings-layout > .compact-grid,
.settings-layout > .asset-row {
  grid-column: 1 / -1;
}

.settings-layout > .primary-button {
  justify-self: start;
}

.compact-grid {
  display: grid;
  gap: 10px;
}

.compact-grid.two {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.compact-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.compact-grid.three {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
}

.align-end {
  align-self: end;
}

.admin-account-list {
  display: grid;
  gap: 8px;
}

.admin-account-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(241, 213, 181, 0.9);
  border-radius: 10px;
  background: #fffdf8;
}

.asset-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) auto auto minmax(0, 1fr);
  gap: 10px;
  align-items: end;
}

.inline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.compact-head {
  min-height: 36px;
}

.block-head.compact-head {
  margin-bottom: -2px;
}

.admin-block label {
  margin-bottom: 0;
  font-size: 13px;
}

.admin-block input,
.admin-block textarea,
.admin-block select {
  padding: 9px 10px;
  border-radius: 8px;
}

.qr-preview,
.image-preview {
  display: grid;
  place-items: center;
  width: 132px;
  min-height: 96px;
  margin: -4px 0 10px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.compact-preview {
  display: inline-grid;
  vertical-align: top;
  margin-right: 10px;
}

.image-preview {
  width: 220px;
  min-height: 150px;
}

.qr-preview img,
.image-preview img {
  width: 118px;
  height: 118px;
  object-fit: cover;
}

.image-preview img {
  width: 206px;
  height: 136px;
  border-radius: 10px;
}

small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.prize-editor {
  display: grid;
  gap: 8px;
  margin-top: 0;
}

.prize-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 78px 82px 34px;
  gap: 6px;
  align-items: center;
}

.code-create-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.prize-row input,
.prize-row select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 10px;
  background: #fff;
}

.icon-button {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: #fff;
  background: #b80f18;
  font-weight: 900;
}

.record-table-wrap {
  width: 100%;
  margin-top: 0;
  overflow-x: auto;
  border: 1px solid rgba(241, 213, 181, 0.9);
  border-radius: 12px;
  background: #fffdf8;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.pagination-bar label {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.pagination-bar select {
  width: auto;
  min-height: 34px;
  padding: 0 8px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  color: var(--muted);
  background: #fff7dd;
  font-size: 12px;
  font-weight: 900;
}

tbody tr:hover {
  background: #fff8e6;
}

.table-action {
  min-height: 30px;
  margin-right: 6px;
  padding: 0 10px;
  border-radius: 8px;
  color: #11633e;
  background: rgba(31, 157, 101, 0.13);
  font-weight: 800;
}

.table-action.danger {
  color: #b80f18;
  background: rgba(215, 25, 32, 0.12);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  overflow-y: auto;
  background: rgba(43, 21, 18, 0.68);
  z-index: 10;
}

.redpacket-modal {
  width: min(390px, 100%);
  position: relative;
  animation: packetPop 0.55s cubic-bezier(0.18, 0.9, 0.2, 1.2);
}

.payout-modal {
  width: min(440px, 100%);
  padding: 24px;
  border: 2px solid var(--gold);
  border-radius: 18px;
  background: #fffaf0;
  box-shadow: var(--shadow);
}

.payout-modal h2 {
  margin: 0 0 8px;
  color: var(--deep-red);
}

.payout-modal p {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.6;
}

.packet-lid {
  height: 86px;
  border-radius: 28px 28px 50% 50%;
  background: linear-gradient(135deg, #ff5757, #9e0914);
  box-shadow: 0 16px 28px rgba(80, 4, 10, 0.25);
  transform-origin: bottom center;
  animation: lidOpen 0.9s 0.25s ease both;
}

.packet-body {
  margin-top: -26px;
  padding: 38px 20px 20px;
  border: 2px solid var(--gold);
  border-radius: 26px;
  background: linear-gradient(180deg, #d71920 0%, #a50914 100%);
  color: #fff7d6;
  text-align: center;
  box-shadow: var(--shadow);
}

.modal-label {
  color: var(--light-gold);
  font-weight: 900;
}

.packet-body h2 {
  margin: 8px 0;
  color: #fff;
  font-size: 32px;
}

.packet-body p {
  color: #fff7d6;
  line-height: 1.6;
}

.claim-card-preview {
  width: min(260px, 100%);
  margin: 12px auto;
  border: 1px solid rgba(255, 209, 102, 0.75);
  border-radius: 14px;
  overflow: hidden;
  background: #fffaf0;
}

.claim-card-preview canvas {
  display: block;
  width: 100%;
  height: auto;
}

.modal-actions {
  justify-content: center;
  flex-wrap: wrap;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  max-width: min(380px, calc(100% - 32px));
  padding: 12px 16px;
  border-radius: 999px;
  color: #fff;
  background: rgba(101, 9, 16, 0.92);
  z-index: 20;
}

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

@keyframes lightsPulse {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes tickerMove {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-50%);
  }
}

@keyframes packetPop {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes lidOpen {
  from {
    transform: rotateX(0deg);
  }
  to {
    transform: rotateX(24deg);
  }
}

@media (max-width: 780px) {
  .app-shell {
    padding: 0;
  }

  .mobile-panel {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .hero {
    min-height: 318px;
  }

  .hero h1 {
    font-size: 36px;
  }

  .admin-login,
  .admin-panel {
    padding: 0;
  }

  .admin-shell {
    padding: 10px;
  }

  .admin-header,
  .admin-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .admin-block {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .module-title {
    min-height: auto;
  }

  .settings-layout,
  .compact-grid.two,
  .compact-grid.three,
  .compact-grid.four,
  .asset-row {
    grid-template-columns: 1fr;
  }

  .settings-block {
    grid-template-columns: 1fr;
  }

  .settings-block label:nth-of-type(3),
  .settings-block label:nth-of-type(5),
  .settings-block label:nth-of-type(8) {
    grid-column: auto;
  }

  .admin-actions {
    justify-content: start;
    flex-wrap: wrap;
  }

  .admin-header h1 {
    font-size: 26px;
  }

  .prize-row {
    grid-template-columns: minmax(0, 1fr) 72px 82px 34px;
  }

  .admin-account-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto auto;
  }

  .pagination-bar {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .code-create-grid {
    grid-template-columns: 1fr;
  }

  .record-table-wrap {
    max-width: calc(100vw - 44px);
  }
}

@media (max-width: 480px) {
  .hero {
    min-height: 292px;
    padding: 18px 18px 24px;
  }

  .hero-copy {
    margin-top: 38px;
  }

  .hero h1 {
    font-size: 32px;
  }

  .hero p {
    font-size: 14px;
  }

  .qualification-card {
    margin: -34px 14px 0;
    padding: 14px;
  }

  .form-band,
  .lottery-zone,
  .wechat-card {
    padding: 16px 14px;
  }

  .ticker-card,
  .wechat-card {
    margin-right: 14px;
    margin-left: 14px;
  }

  .wheel-stage {
    padding: 9px;
  }

  .wheel-wrap {
    width: min(342px, 100%);
  }

  .draw-button {
    width: 104px;
    height: 104px;
    border-width: 8px;
    font-size: 16px;
  }

  .draw-button::before {
    top: -31px;
    border-right-width: 14px;
    border-bottom-width: 35px;
    border-left-width: 14px;
  }

  .redpacket-modal {
    width: min(350px, 100%);
  }

  .packet-lid {
    height: 64px;
  }

  .packet-body {
    max-height: calc(100vh - 72px);
    overflow-y: auto;
    padding: 30px 16px 18px;
  }

  .claim-card-preview {
    width: min(220px, 100%);
  }

  .modal-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .admin-shell {
    padding: 8px;
  }

  .admin-header {
    position: static;
  }

  .admin-header h1 {
    font-size: 23px;
  }

  .admin-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .secondary-link,
  .secondary-button {
    justify-content: center;
    min-height: 38px;
    padding: 0 10px;
  }

  .admin-block {
    padding: 10px;
  }

  .prize-row {
    grid-template-columns: 1fr 70px;
  }

  .prize-row select {
    grid-column: 1;
  }

  .icon-button {
    grid-column: 2;
    grid-row: 2;
  }

  .admin-account-row {
    grid-template-columns: 1fr 1fr;
  }

  .admin-account-row .account-username,
  .admin-account-row .account-password {
    grid-column: 1 / -1;
  }

  .qr-preview,
  .image-preview {
    width: 100%;
  }

  .image-preview img {
    width: 100%;
    max-width: 240px;
  }

  .payout-modal {
    padding: 18px;
  }
}
