:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #fafbfc;
  --border: #e5eaf0;
  --border-strong: #d7dde5;
  --text-main: #111827;
  --text-soft: #667085;
  --text-muted: #98a2b3;
  --primary: #111827;
  --danger: #dc2626;
  --shadow: 0 12px 32px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  background: var(--bg);
  color: var(--text-main);
}

button,
input {
  font: inherit;
}

.page-shell {
  min-height: 100vh;
}

.ambient,
.bubble,
.image-orbit {
  display: none;
}

.admin-entry-button {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 12;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-main);
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.lottery-page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 88px 0 40px;
}

.hero-card,
.draw-panel,
.catalog-card,
.history-card,
.wheel-stage,
.modal-card,
.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  align-items: center;
  gap: 24px;
  padding: 28px;
  border-radius: 24px;
}

.hero-copy h1,
.panel-header h2,
.wheel-stage-head h3,
.catalog-head h3,
.history-header h2,
.modal-card h2,
.admin-card h2 {
  margin: 0;
  font-weight: 700;
  color: var(--text-main);
}

.hero-copy h1 {
  font-size: clamp(32px, 4vw, 44px);
  letter-spacing: -0.03em;
}

.panel-note,
.catalog-tip,
.admin-summary,
.field-label,
.history-item span,
.history-empty,
.card-meta span {
  color: var(--text-soft);
}

.hero-visual {
  display: grid;
  place-items: center;
  min-height: 220px;
}

.jellyfish-image {
  width: min(100%, 240px);
  opacity: 0.9;
}

.draw-panel {
  margin-top: 20px;
  padding: 24px;
  border-radius: 24px;
}

.panel-header,
.catalog-head,
.history-header,
.admin-header,
.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-note,
.catalog-tip {
  margin: 0;
  font-size: 13px;
}

.wheel-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 20px;
}

.wheel-stage,
.catalog-card,
.history-card {
  padding: 22px;
  border-radius: 20px;
}

.wheel-stage-head {
  text-align: center;
}

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

.wheel-frame::before {
  content: "";
  position: absolute;
  inset: 7%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(111, 210, 255, 0.18), rgba(140, 107, 255, 0.08), transparent 72%);
  filter: blur(14px);
}

.wheel-pointer {
  position: absolute;
  top: 10px;
  left: 50%;
  z-index: 4;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-top: 28px solid #ff7a45;
  filter: drop-shadow(0 8px 10px rgba(255, 122, 69, 0.28));
}

.wheel-rotator {
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  transition: transform 5.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.wheel-disc {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(112, 133, 255, 0.24);
  overflow: hidden;
  box-shadow:
    inset 0 0 0 10px rgba(255, 255, 255, 0.68),
    0 20px 44px rgba(108, 131, 255, 0.14);
}

.wheel-disc::after {
  content: "";
  position: absolute;
  inset: 20%;
  border-radius: 50%;
  border: 1px solid rgba(106, 168, 255, 0.2);
}

.wheel-label-layer {
  position: absolute;
  inset: 0;
}

.wheel-label {
  position: absolute;
  display: grid;
  gap: 4px;
  place-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), color-mix(in srgb, var(--label-soft) 70%, white));
  text-align: center;
  pointer-events: none;
  transform: translate(-50%, -50%);
  box-shadow: 0 10px 22px color-mix(in srgb, var(--label-accent) 18%, transparent);
}

.wheel-label-name {
  display: block;
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
  color: #0f172a;
}

.wheel-label-stock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--label-accent) 14%, white);
  color: color-mix(in srgb, var(--label-accent) 82%, #0f172a);
  font-size: 11px;
}

.wheel-label.is-empty {
  opacity: 0.7;
}

.wheel-label.is-winner {
  border-color: color-mix(in srgb, var(--label-accent) 62%, white);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--label-accent) 34%, white),
    0 14px 26px color-mix(in srgb, var(--label-accent) 26%, transparent);
}

.wheel-center-button {
  position: relative;
  z-index: 5;
  width: 144px;
  height: 144px;
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 0;
  border: 1px solid rgba(130, 156, 255, 0.28);
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.72)),
    linear-gradient(135deg, #ffe179, #6fd5ff 54%, #8f7cff);
  color: #102042;
  cursor: pointer;
  box-shadow:
    0 18px 36px rgba(111, 213, 255, 0.28),
    inset 0 8px 18px rgba(255, 255, 255, 0.42);
}

.wheel-center-button:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.core-label {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: #102042;
}

.wheel-center-subtitle {
  font-size: 12px;
  color: rgba(16, 32, 66, 0.72);
}

.catalog-card {
  margin-top: 20px;
}

.prize-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.prize-empty-state {
  grid-column: 1 / -1;
  padding: 24px;
  border: 1px dashed var(--border-strong);
  border-radius: 16px;
  background: var(--surface-soft);
  color: var(--text-soft);
  text-align: center;
}

.prize-card {
  min-height: 152px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
}

.prize-card::before {
  display: none;
}

.prize-card.is-winner {
  border-color: var(--primary);
}

.prize-card.is-empty {
  background: #f4f5f7;
  color: var(--text-soft);
}

.prize-card h3 {
  margin: 18px 0 0;
  font-size: 24px;
  line-height: 1.25;
}

.prize-card p {
  display: none;
}

.card-head,
.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-index,
.card-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
}

.card-index {
  background: #f3f4f6;
  color: var(--text-soft);
}

.card-state {
  background: #eef2f6;
  color: var(--text-soft);
}

.card-state.is-sold-out {
  background: #eceff3;
}

.card-meta {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.card-meta strong {
  font-size: 18px;
  color: var(--text-main);
}

.history-card {
  margin-top: 20px;
}

.history-list {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.history-item,
.history-empty {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-soft);
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.history-item strong {
  font-size: 15px;
}

.modal-shell[hidden] {
  display: none;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
}

.admin-modal {
  z-index: 24;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.28);
}

.modal-card,
.admin-card {
  position: relative;
  z-index: 1;
}

.modal-card {
  width: min(100%, 420px);
  padding: 28px;
  border-radius: 20px;
  text-align: center;
}

.result-prize {
  margin: 14px 0 8px;
  font-size: clamp(28px, 5vw, 38px);
  font-weight: 800;
}

.modal-button,
.admin-primary-button,
.admin-secondary-button,
.admin-danger-button,
.icon-button {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  cursor: pointer;
}

.modal-button {
  margin-top: 22px;
  border: 0;
  background: var(--primary);
  color: #ffffff;
}

.admin-card {
  width: min(100%, 900px);
  max-height: min(88vh, 920px);
  padding: 24px;
  border-radius: 22px;
  overflow: auto;
}

.icon-button {
  width: 40px;
  min-width: 40px;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.admin-auth-view,
.admin-editor-view {
  margin-top: 18px;
}

.field-group {
  display: grid;
  gap: 8px;
}

.field-input {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
  color: var(--text-main);
  outline: none;
}

.field-input:focus {
  border-color: var(--primary);
}

.field-feedback {
  margin: 12px 0 0;
  font-size: 14px;
}

.field-feedback.is-error {
  color: var(--danger);
}

.field-feedback.is-success {
  color: #047857;
}

.admin-primary-button {
  border: 0;
  background: var(--primary);
  color: #ffffff;
}

.admin-secondary-button {
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text-main);
}

.admin-danger-button {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

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

.admin-prize-list {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.admin-prize-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px 120px 110px;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-soft);
}

.admin-list-empty {
  padding: 20px 16px;
  border: 1px dashed var(--border-strong);
  border-radius: 16px;
  background: var(--surface-soft);
  color: var(--text-soft);
  text-align: center;
}

.admin-prize-info {
  display: grid;
  gap: 8px;
}

.admin-prize-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-prize-title strong {
  font-size: 17px;
}

.admin-probability {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #f3f4f6;
  color: var(--text-soft);
  font-size: 12px;
}

.admin-probability.is-empty {
  background: #eceff3;
}

.admin-prize-text {
  display: none;
}

.admin-row-actions {
  display: grid;
  align-items: end;
}

@media (max-width: 1024px) {
  .wheel-layout {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 860px) {
  .hero-card {
  .hero-visual {
    min-height: 180px;
  }

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

  .panel-header,
  .catalog-head,
  .history-header,
  .admin-header,
  .admin-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .history-item {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 560px) {
  .admin-entry-button {
    top: 14px;
    right: 14px;
  }

  .lottery-page {
    width: min(100% - 20px, 100%);
    padding: 72px 0 28px;
  }

  .hero-card,
  .draw-panel,
  .catalog-card,
  .history-card,
  .wheel-stage,
  .modal-card,
  .admin-card {
    padding: 18px;
    border-radius: 18px;
  }

  .wheel-frame {
    width: min(100%, 360px);
  }

  .wheel-center-button {
    width: 124px;
    height: 124px;
  }

  .core-label {
    font-size: 18px;
  }

  .admin-actions {
    width: 100%;
  }

  .admin-actions button {
    width: 100%;
  }
}
