:root {
  color-scheme: dark;
  --bg: #110f12;
  --panel: rgba(24, 22, 27, 0.84);
  --panel-strong: rgba(32, 28, 35, 0.94);
  --panel-soft: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.1);
  --text: #f7efe7;
  --muted: #c9bcae;
  --accent: #ff8c42;
  --accent-strong: #ffb347;
  --accent-soft: rgba(255, 152, 72, 0.18);
  --green: #72f2c0;
  --danger: #ff7f7f;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.35);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --content-width: 960px;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "MiSans", "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at top, rgba(255, 166, 96, 0.22), transparent 30%),
    radial-gradient(circle at 80% 20%, rgba(232, 107, 40, 0.2), transparent 24%),
    linear-gradient(160deg, #171217 0%, #0d0b0d 54%, #151a1f 100%);
  color: var(--text);
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.page-shell {
  position: relative;
  min-height: 100vh;
  padding: 24px 16px 40px;
}

.ambient {
  position: fixed;
  border-radius: 999px;
  filter: blur(20px);
  opacity: 0.6;
  pointer-events: none;
}

.ambient-a {
  width: 180px;
  height: 180px;
  top: 10%;
  left: -40px;
  background: rgba(255, 170, 89, 0.18);
}

.ambient-b {
  width: 220px;
  height: 220px;
  right: -80px;
  top: 35%;
  background: rgba(255, 115, 56, 0.14);
}

.ambient-c {
  width: 200px;
  height: 200px;
  left: 20%;
  bottom: -60px;
  background: rgba(80, 226, 183, 0.12);
}

.app {
  position: relative;
  width: min(100%, var(--content-width));
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.hero-card,
.roulette-card,
.result-card,
.history-card,
.drawer-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(18px);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 24px 20px;
  display: grid;
  gap: 22px;
}

.hero-copy {
  position: relative;
}

.section-tag,
.stat-label,
.picker-label,
.disc-center__label {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  color: var(--muted);
}

.hero-copy h1,
.section-head h2,
.drawer-head h2 {
  margin: 0;
  font-family: "Alimama ShuHeiTi", "DingTalk JinBuTi", "MiSans", "Segoe UI Variable Display", sans-serif;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.hero-copy h1 {
  max-width: 12ch;
  margin-top: 10px;
  font-size: clamp(2rem, 8vw, 3.8rem);
  line-height: 0.98;
}

.secret-trigger {
  position: absolute;
  top: 0;
  right: 0;
  width: 58px;
  height: 58px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.secret-trigger__dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stat-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.stat-value {
  display: block;
  margin-top: 10px;
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  font-weight: 800;
}

.stat-value--small {
  font-size: clamp(1rem, 4.2vw, 1.35rem);
  letter-spacing: 0.08em;
}

.roulette-card {
  padding: 20px;
  display: grid;
  gap: 18px;
}

.roulette-stage {
  display: grid;
  place-items: center;
  padding: 6px 0;
}

.roulette-shell {
  position: relative;
  width: min(100%, 380px);
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
}

.roulette-glow {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 154, 80, 0.34), transparent 48%),
    radial-gradient(circle at 40% 30%, rgba(255, 255, 255, 0.22), transparent 18%);
  filter: blur(22px);
}

.roulette-disc {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 191, 120, 0.12), rgba(255, 191, 120, 0) 34%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  box-shadow: inset 0 0 40px rgba(255, 255, 255, 0.04), 0 24px 55px rgba(0, 0, 0, 0.35);
}

.disc-rotor {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  will-change: transform;
}

.name-orbits {
  position: absolute;
  inset: 7%;
  border-radius: 50%;
  pointer-events: none;
}

.orbit-chip {
  position: absolute;
  left: 50%;
  top: 50%;
  min-width: 76px;
  max-width: 92px;
  padding: 8px 10px;
  border-radius: 999px;
  text-align: center;
  font-size: 12px;
  color: rgba(255, 243, 230, 0.88);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.disc-ring {
  position: absolute;
  inset: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.disc-ring--outer {
  width: 88%;
  height: 88%;
}

.disc-ring--mid {
  width: 62%;
  height: 62%;
}

.disc-ring--inner {
  width: 36%;
  height: 36%;
}

.disc-sweep {
  position: absolute;
  inset: -10%;
  background:
    conic-gradient(
      from 0deg,
      rgba(255, 160, 93, 0),
      rgba(255, 160, 93, 0.42),
      rgba(255, 160, 93, 0)
    );
  transform-origin: center;
  mix-blend-mode: screen;
}

.lock-flash {
  position: absolute;
  inset: 20%;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 247, 240, 0.95), rgba(255, 194, 132, 0.28) 34%, rgba(255, 194, 132, 0) 64%);
  opacity: 0;
  pointer-events: none;
  filter: blur(8px);
  z-index: 2;
}

.disc-center {
  position: absolute;
  inset: 50%;
  width: 44%;
  height: 44%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  display: grid;
  place-items: center;
  padding: 18px;
  text-align: center;
  background: rgba(10, 10, 12, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 24px rgba(255, 255, 255, 0.05);
  z-index: 3;
}

.slot-window {
  position: relative;
  width: 100%;
  max-width: 148px;
  height: 104px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01)),
    rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.slot-window::before,
.slot-window::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 24px;
  z-index: 2;
  pointer-events: none;
}

.slot-window::before {
  top: 0;
  background: linear-gradient(180deg, rgba(10, 10, 12, 0.95), rgba(10, 10, 12, 0));
}

.slot-window::after {
  bottom: 0;
  background: linear-gradient(0deg, rgba(10, 10, 12, 0.95), rgba(10, 10, 12, 0));
}

.slot-window .slot-focus {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 50%;
  height: 34px;
  transform: translateY(-50%);
  border-radius: 12px;
  background: rgba(255, 156, 86, 0.08);
  border: 1px solid rgba(255, 166, 96, 0.22);
  box-shadow: inset 0 0 18px rgba(255, 160, 93, 0.08);
  z-index: 1;
  will-change: transform, opacity;
}

.slot-window .slot-focus.is-hit {
  background: rgba(255, 168, 97, 0.18);
  border-color: rgba(255, 205, 157, 0.74);
  box-shadow:
    0 0 26px rgba(255, 180, 111, 0.36),
    inset 0 0 26px rgba(255, 223, 190, 0.16);
}

.slot-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  will-change: transform;
}

.slot-item {
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0 12px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: rgba(255, 245, 235, 0.58);
}

.slot-item.is-center {
  color: rgba(255, 245, 235, 1);
}

.disc-center__name {
  display: block;
  margin-top: 10px;
  font-size: clamp(0.95rem, 4.2vw, 1.2rem);
  line-height: 1.2;
  letter-spacing: 0.08em;
}

.control-panel {
  display: grid;
  gap: 14px;
}

.picker-panel,
.action-row,
.result-list,
.history-list,
.drawer-toolbar,
.student-grid {
  width: 100%;
}

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

.picker-stepper {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.stepper-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 22px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.stepper-value {
  min-width: 2ch;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 800;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.drawer-close {
  transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

.primary-btn,
.secondary-btn,
.ghost-btn {
  min-height: 54px;
  border-radius: var(--radius-md);
  padding: 0 18px;
}

.primary-btn {
  color: #2c1600;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
}

.secondary-btn,
.ghost-btn,
.drawer-close {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

.primary-btn:disabled,
.secondary-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

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

.section-head h2 {
  margin-top: 6px;
  font-size: 1.45rem;
}

.section-chip {
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
}

.result-card,
.history-card {
  padding: 20px;
}

.result-list {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.result-pill,
.history-item,
.student-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.result-pill {
  min-width: calc(50% - 6px);
  padding: 14px 16px;
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(255, 178, 110, 0.18), rgba(255, 255, 255, 0.03)),
    rgba(255, 255, 255, 0.04);
}

.result-pill__order {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.result-pill__name {
  display: block;
  margin-top: 6px;
  font-size: 1.2rem;
  font-weight: 800;
}

.result-empty,
.history-empty {
  width: 100%;
  padding: 18px;
  border-radius: 18px;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}

.history-list {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}

.history-item {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
}

.history-item__time {
  font-size: 12px;
  color: var(--muted);
}

.history-item__names {
  font-size: 15px;
  line-height: 1.6;
}

.history-card .section-head,
.result-card .section-head {
  align-items: end;
}

.settings-drawer {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 20;
}

.settings-drawer.is-open {
  display: block;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
}

.drawer-panel {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: min(100%, 520px);
  padding: 22px 18px 18px;
  border-radius: 28px 0 0 28px;
  overflow: auto;
  background: var(--panel-strong);
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.drawer-close {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 28px;
}

.drawer-toolbar {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.search-box {
  display: grid;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.search-box input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  outline: none;
}

.drawer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.drawer-tip {
  margin: 16px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.student-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.student-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
}

.student-card input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.student-card__name {
  font-size: 15px;
}

.student-card.is-hidden {
  display: none;
}

.is-muted {
  opacity: 0.45;
}

@media (min-width: 820px) {
  .page-shell {
    padding: 34px 22px 56px;
  }

  .hero-card {
    grid-template-columns: 1.35fr 1fr;
    align-items: end;
  }

  .roulette-card {
    grid-template-columns: 1.15fr 0.85fr;
    align-items: center;
    padding: 22px;
  }

  .result-card,
  .history-card {
    padding: 24px;
  }
}

@media (max-width: 560px) {
  .stats-grid,
  .student-grid,
  .drawer-actions,
  .action-row {
    grid-template-columns: 1fr;
  }

  .result-pill {
    min-width: 100%;
  }

  .drawer-panel {
    width: 100%;
    border-radius: 28px 28px 0 0;
    top: auto;
    max-height: 88vh;
  }

  .orbit-chip {
    min-width: 64px;
    max-width: 72px;
    font-size: 11px;
    padding: 7px 8px;
  }
}
