:root {
  --ink: #24152f;
  --muted: #8d8198;
  --gold: #ffbf35;
  --purple: #1b0d26;
  --panel: #fff;
  --line: #eee9f2;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: #f4f6fb;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
}

.topbar {
  height: 74px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  position: relative;
  z-index: 2;
}

.topbar h1 {
  font-size: 21px;
  margin: 0;
  letter-spacing: 1px;
}

.topbar .back {
  font-size: 42px;
  line-height: 1;
  color: #1d1b20;
  text-decoration: none;
}

.topbar .menu {
  font-size: 24px;
  letter-spacing: 3px;
  color: #222;
  text-decoration: none;
}

.topbar .logout-link {
  color: #9e6b13;
  font-size: 14px;
  text-decoration: none;
}

.wheel-page {
  min-height: 100vh;
  background: radial-gradient(circle at 50% 28%, #3a1d35 0, #1d0c27 48%, #16091f 100%);
  color: #fff;
}

.auth-main {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 18px;
}

.auth-card {
  width: min(92vw, 430px);
  background: #fff;
  color: var(--ink);
  border-radius: 18px;
  padding: 34px;
  text-align: center;
  box-shadow: 0 20px 70px #05010866;
}

.auth-card h1 {
  margin: 8px 0;
  color: #df8e0f;
  font-size: 30px;
}

.auth-card > p {
  margin: 0 0 22px;
  color: var(--muted);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  margin: 0 0 18px;
  background: #f5f1f8;
  border-radius: 12px;
}

.auth-tabs button {
  min-height: 42px;
  border-radius: 9px;
  background: transparent;
  color: #6f6475;
  font-weight: 700;
}

.auth-tabs button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 5px 16px #2b18330f;
}

.auth-grid {
  display: block;
  text-align: left;
}

.auth-form {
  border: 1px solid #eee5f1;
  border-radius: 14px;
  padding: 20px;
  background: #fff;
}

.auth-form h2 {
  margin: 0 0 16px;
  font-size: 20px;
}

.auth-form label {
  display: block;
  color: #6f6475;
  font-size: 13px;
  margin-bottom: 14px;
}

.auth-form input {
  display: block;
  width: 100%;
  border: 1px solid #e6e1ea;
  border-radius: 9px;
  padding: 12px 13px;
  margin-top: 7px;
  outline: none;
}

.auth-form input:focus {
  border-color: #dca72c;
}

.auth-form .primary {
  width: 100%;
}

.player-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(88vw, 450px);
  margin: 0 auto 18px;
  color: #ead5ef;
  font-size: 13px;
}

.player-bar a {
  color: #ffcc60;
  text-decoration: none;
}

.wheel-main {
  max-width: 720px;
  margin: auto;
  text-align: center;
  padding: 28px 18px 60px;
  position: relative;
  overflow: hidden;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 5px;
  color: #ffce62;
  margin: 0 0 12px;
}

.wheel-main h2 {
  font-size: 28px;
  margin: 0;
  color: #ffc447;
  font-weight: 700;
  text-shadow: 0 2px 18px #e78b1c;
}

.ornament {
  font-size: 32px;
  color: #ffd447;
  margin: 20px 0;
}

.wheel-wrap {
  width: min(82vw, 450px);
  aspect-ratio: 1;
  margin: 26px auto 18px;
  position: relative;
  display: grid;
  place-items: center;
}

.wheel {
  width: 100%;
  height: 100%;
  border: 13px solid #f8d35c;
  border-radius: 50%;
  position: relative;
  display: grid;
  place-items: center;
  background: var(--wheel-bg);
  box-shadow: 0 0 0 5px #d39d25, 0 12px 35px #0c0510;
  transition: transform 4.8s cubic-bezier(.15, .8, .15, 1);
}

.wheel span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 36%;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%) rotate(calc(360deg / var(--segments) * var(--i))) translateY(clamp(-126px, -25vw, -76px)) rotate(calc(-360deg / var(--segments) * var(--i)));
  transform-origin: center;
  color: #3d2438;
  text-shadow: 0 1px #fff8;
  pointer-events: none;
}

.wheel span em {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: normal;
  font-size: clamp(13px, 3vw, 18px);
  font-weight: 700;
  line-height: 1.15;
}

.spin-btn {
  width: 94px;
  height: 94px;
  border-radius: 50%;
  background: linear-gradient(#ffd35c, #f39a0b);
  color: #fff;
  border: 4px solid #ffe89a;
  box-shadow: 0 5px 13px #8d4c08;
  z-index: 2;
}

.spin-btn b {
  display: block;
  font-size: 30px;
  line-height: 28px;
}

.spin-btn small {
  font-size: 11px;
}

.spin-btn:disabled {
  filter: grayscale(1);
  cursor: not-allowed;
}

.pointer {
  position: absolute;
  top: -3px;
  z-index: 3;
  width: 0;
  height: 0;
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-top: 38px solid #fff2b0;
  filter: drop-shadow(0 2px 2px #5e3c0e);
}

.count {
  font-size: 15px;
  color: #d7bfdc;
}

.count strong {
  color: #ffc74c;
  font-size: 24px;
}

.actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 22px;
}

.primary,
.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  min-height: 48px;
  padding: 0 28px;
  font-weight: 700;
  text-decoration: none;
}

.primary {
  background: linear-gradient(135deg, #ffcf50, #f49b14);
  color: #3f2410;
  box-shadow: 0 8px 22px #bd771c55;
}

.actions .primary {
  font-size: 17px;
}

.ghost {
  background: #2b1833;
  border: 1px solid #674d72;
  color: #f7eaf8;
}

.tip {
  font-size: 12px;
  color: #907696;
  margin-top: 26px;
}

.notice {
  padding: 12px 16px;
  border-radius: 10px;
  text-align: left;
  margin: 12px 0;
  font-size: 14px;
}

.notice.error {
  background: #fff0f0;
  color: #b33b3b;
}

.notice.success {
  background: #ebfff5;
  color: #198354;
}

.modal {
  position: fixed;
  inset: 0;
  background: #15091bcc;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: .25s;
  z-index: 10;
}

.modal.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: min(88vw, 360px);
  background: #fff;
  border-radius: 18px;
  padding: 32px 24px;
  text-align: center;
  color: var(--ink);
  box-shadow: 0 20px 70px #0008;
}

.confetti {
  font-size: 45px;
  color: #f6b526;
}

.modal-card p {
  margin: 8px 0;
  color: var(--muted);
}

.modal-card h3 {
  font-size: 30px;
  color: #df8e0f;
  margin: 8px 0;
}

.result-desc {
  color: #756b7c;
  margin-bottom: 22px;
}

.claim-form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  text-align: left;
}

.claim-form[hidden],
[hidden] {
  display: none !important;
}

.claim-form label {
  display: block;
  color: #6f6475;
  font-size: 13px;
}

.claim-form input {
  width: 100%;
  border: 1px solid #e6e1ea;
  border-radius: 10px;
  padding: 13px 14px;
  margin-top: 7px;
  outline: none;
}

.claim-form input:focus {
  border-color: #dca72c;
}

.claim-form .primary {
  width: 100%;
}

.claim-msg {
  min-height: 20px;
  color: #d6810f;
  font-size: 13px;
  text-align: center;
}

.primary:disabled {
  filter: grayscale(1);
  cursor: not-allowed;
}

.light {
  border-bottom: 1px solid #eee;
}

.records-main {
  max-width: 760px;
  margin: auto;
  padding: 18px;
}

.records-head {
  display: flex;
  justify-content: space-between;
  color: #40566c;
  font-weight: 600;
  margin: 8px 0 20px;
}

.records-head a {
  color: #d59117;
  text-decoration: none;
}

.record {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fff;
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: 0 6px 20px #26324b0d;
}

.record-icon {
  font-size: 36px;
}

.record h3 {
  margin: 0 0 5px;
  font-size: 20px;
}

.record p {
  margin: 0;
  color: #555;
}

.record time {
  display: block;
  color: #a3a6b1;
  font-size: 13px;
  margin-top: 9px;
}

.tag {
  margin-left: auto;
  color: #926018;
  background: #fff6df;
  border-radius: 30px;
  padding: 9px 13px;
  font-size: 13px;
}

.empty {
  text-align: center;
  color: #9ca3af;
  padding: 80px 0;
}

.admin-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, #21102e, #42203d);
  padding: 20px;
}

.login-card {
  width: min(92vw, 420px);
  background: #fff;
  border-radius: 20px;
  padding: 42px 34px;
  text-align: center;
  box-shadow: 0 18px 50px #0004;
}

.brand-mark,
.brand-dot {
  color: #e9a521;
  font-size: 32px;
}

.login-card h1 {
  margin: 8px 0;
  font-size: 25px;
}

.login-card > p {
  color: var(--muted);
  margin-bottom: 26px;
}

.login-card form {
  text-align: left;
}

.login-card label,
.settings-form label,
.password-form label {
  display: block;
  font-size: 13px;
  color: #6f6475;
  margin-bottom: 16px;
}

.login-card input,
.settings-form input,
.password-form input,
.prize-row input {
  display: block;
  width: 100%;
  border: 1px solid #e6e1ea;
  border-radius: 9px;
  padding: 12px 13px;
  margin-top: 7px;
  outline: none;
}

.login-card input:focus,
.settings-form input:focus,
.password-form input:focus,
.prize-row input:focus {
  border-color: #dca72c;
}

.login-card .primary {
  width: 100%;
  margin-top: 5px;
}

.back-link {
  display: block;
  margin-top: 20px;
  color: #997b32;
  text-decoration: none;
  font-size: 14px;
}

.dash-top {
  height: 66px;
  background: #21122b;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 5vw;
}

.brand-dot {
  font-size: 22px;
  margin-right: 8px;
}

.user {
  color: #d7c9dd;
  font-size: 14px;
}

.user a {
  color: #ffcc60;
  margin-left: 15px;
  text-decoration: none;
}

.dash-main {
  max-width: 1180px;
  margin: auto;
  padding: 38px 22px;
}

.dash-title {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 22px;
}

.dash-title h1 {
  margin: 0;
  font-size: 30px;
}

.view-btn {
  color: #9e6b13;
  border: 1px solid #e5d6b5;
  background: #fffaf0;
  border-radius: 9px;
  padding: 10px 16px;
  text-decoration: none;
}

.panel {
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 5px 20px #26324b0a;
}

.panel-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 20px;
}

.panel-title h2 {
  margin: 0;
  font-size: 20px;
}

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

.settings-form {
  display: flex;
  align-items: end;
  gap: 16px;
}

.password-form {
  display: flex !important;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  max-width: 380px;
}

.settings-form label {
  flex: 1;
  margin: 0;
}

.password-form label {
  display: flex !important;
  flex-direction: column;
  gap: 7px;
  margin: 0 !important;
  line-height: 1.3;
}

.password-form label span {
  display: block;
  color: #6f6475;
  font-size: 13px;
}

.password-form input {
  display: block !important;
  width: 100% !important;
  margin: 0 !important;
}

.settings-form .small,
.password-form .small {
  height: 44px;
}

.password-form .small {
  width: 138px;
}

.small {
  min-height: 40px;
  padding: 0 18px;
  font-size: 14px;
}

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

.prize-row {
  display: grid;
  grid-template-columns: 1.1fr 1.5fr 100px 88px 92px 50px 50px;
  gap: 9px;
  align-items: end;
}

.prize-row .field {
  display: block;
  margin: 0;
}

.prize-row .field span {
  display: block;
  color: #8d8198;
  font-size: 12px;
  margin: 0 0 6px;
}

.prize-row input {
  margin: 0;
  padding: 10px;
}

.prize-row.new {
  padding-top: 12px;
  border-top: 1px dashed #ddd;
}

.switch {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #756b7c;
  font-size: 12px;
  margin-bottom: 11px;
}

.switch input {
  display: none;
}

.switch i {
  width: 34px;
  height: 20px;
  border-radius: 20px;
  background: #d9d6dd;
  position: relative;
  flex: 0 0 auto;
}

.switch i:after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  left: 2px;
  top: 2px;
  transition: .2s;
  box-shadow: 0 1px 3px #0002;
}

.switch input:checked + i {
  background: #37b678;
}

.switch input:checked + i:after {
  left: 16px;
}

.save-link,
.delete-link {
  background: none;
  font-size: 13px;
  margin-bottom: 12px;
}

.save-link {
  color: #3f75d8;
}

.delete-link {
  color: #d65353;
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  text-align: left;
  padding: 13px 8px;
  border-bottom: 1px solid var(--line);
}

th {
  color: #8b8292;
  font-weight: 500;
}

.table-gift {
  margin-right: 8px;
}

.empty-cell {
  text-align: center;
  color: #aaa;
  padding: 28px;
}

@media (max-width: 640px) {
  .wheel-main {
    padding-top: 22px;
  }

  .auth-card {
    padding: 26px 18px;
  }

  .auth-card h1 {
    font-size: 25px;
  }

  .auth-grid {
    display: block;
  }

  .player-bar {
    width: min(88vw, 390px);
  }

  .wheel-main h2 {
    font-size: 23px;
  }

  .wheel-wrap {
    width: min(88vw, 390px);
  }

  .wheel span {
    width: 34%;
    height: 24px;
  }

  .wheel span em {
    font-size: 13px;
  }

  .actions {
    flex-direction: column;
    align-items: center;
  }

  .actions > * {
    width: min(85vw, 300px);
  }

  .settings-form {
    display: block;
  }

  .password-form {
    display: block;
  }

  .settings-form label,
  .password-form label {
    margin-bottom: 12px;
  }

  .settings-form .small,
  .password-form .small {
    width: 100%;
  }

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

  .prize-row .switch {
    grid-column: 1 / 3;
    margin-bottom: 0;
  }

  .prize-row .save-link,
  .prize-row .delete-link {
    grid-row: 4;
    margin-bottom: 0;
  }

  .prize-row.new .primary {
    grid-column: 1 / -1;
  }

  .dash-title {
    align-items: start;
    gap: 12px;
  }

  .dash-title h1 {
    font-size: 25px;
  }

  .dash-top {
    padding: 0 18px;
  }

  .user {
    font-size: 12px;
  }

  .panel {
    padding: 18px 14px;
  }

  .panel-title {
    display: block;
  }

  .panel-title span {
    display: block;
    margin-top: 5px;
  }

  .record {
    padding: 16px;
  }

  .tag {
    display: none;
  }
}
