:root {
  --bg: #090b16;
  --card: rgba(20, 24, 47, 0.73);
  --text: #f4f6ff;
  --sub: #a8b0d3;
  --primary: linear-gradient(135deg, #8b5bff, #5ad4ff);
  --like: linear-gradient(135deg, #35ca87, #2ab3bb);
  --accept: linear-gradient(135deg, #ffd466, #ff9f5f);
  --reject: linear-gradient(135deg, #ff7b8a, #ff5ca9);
  --line: #2f386a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(circle at 20% -10%, #25377f 0%, transparent 38%),
    radial-gradient(circle at 90% -30%, #4a2676 0%, transparent 35%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---------------- Wheel (light) page ---------------- */
.wheel-page {
  background: #f6f7fb;
  color: #161a2a;
}

.wheel-shell {
  width: min(520px, 92vw);
  margin: 0 auto;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 18px 0 26px;
}

.wheel-board {
  padding: 8px 6px 0;
}

.wheel-panel.hidden {
  display: none;
}

.wheel-list-head,
.wheel-editor-head,
.wheel-player-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.wheel-list-title {
  margin: 0;
  font-size: 28px;
  font-weight: 900;
}

.wheel-list-sub {
  margin: 6px 0 0;
  color: rgba(22, 26, 42, 0.62);
  line-height: 1.55;
}

.wheel-list {
  margin-top: 16px;
  display: grid;
  gap: 14px;
}

.wheel-list-card,
.wheel-editor-card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(22, 26, 42, 0.08);
  border-radius: 24px;
  padding: 18px 18px 16px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.05);
}

.wheel-list-card-main {
  min-width: 0;
}

.wheel-list-card-title {
  font-size: 24px;
  font-weight: 900;
  color: #151827;
  line-height: 1.3;
  word-break: break-word;
}

.wheel-list-card-meta {
  margin-top: 8px;
  color: rgba(22, 26, 42, 0.5);
  font-size: 14px;
}

.wheel-list-card-actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.wheel-card-btn,
.wheel-add-btn,
.wheel-save-btn,
.wheel-back-chip,
.wheel-option-delete {
  border: 1px solid rgba(22, 26, 42, 0.12);
  background: rgba(255, 255, 255, 0.92);
  color: #202437;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
}

.wheel-card-btn,
.wheel-back-chip {
  padding: 10px 14px;
}

.wheel-add-btn,
.wheel-save-btn {
  padding: 12px 16px;
}

.wheel-card-btn.danger,
.wheel-option-delete {
  color: #d23b58;
}

.wheel-main {
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  gap: 14px;
  align-content: start;
  padding: 8px 0 0;
}

.wheel-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 6px;
}

.wheel-topbar-right {
  display: flex;
  gap: 10px;
  align-items: center;
}

.wheel-icon-btn {
  height: 40px;
  width: 40px;
  border-radius: 999px;
  border: 1px solid rgba(22, 26, 42, 0.12);
  background: rgba(255, 255, 255, 0.9);
  color: #202437;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
}

.wheel-icon-btn:active {
  transform: translateY(1px);
}

.wheel-mode {
  border: 1px solid rgba(22, 26, 42, 0.12);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  padding: 4px;
  display: inline-flex;
  gap: 4px;
  cursor: pointer;
}

.wheel-mode-pill {
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  color: rgba(22, 26, 42, 0.7);
  user-select: none;
}

.wheel-mode-pill.active {
  background: #161a2a;
  color: #fff;
}

.wheel-topic {
  margin: 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(22, 26, 42, 0.1);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.06);
  color: rgba(22, 26, 42, 0.82);
}

.wheel-topic-icon {
  opacity: 0.85;
}

.wheel-progress {
  margin-left: 6px;
  font-size: 12px;
  color: rgba(22, 26, 42, 0.55);
}

.wheel-result {
  text-align: center;
  font-weight: 900;
  font-size: 28px;
  letter-spacing: 0.2px;
  padding: 6px 8px;
  min-height: 40px;
}

.wheel-stage {
  position: relative;
  display: grid;
  place-items: center;
  padding: 4px 0 6px;
}

.wheel-pointer {
  position: absolute;
  top: 14px;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 16px solid rgba(22, 26, 42, 0.78);
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.12));
  z-index: 3;
}

.wheel-rotator {
  position: relative;
  width: 360px;
  height: 360px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.08);
  border: 10px solid rgba(255, 255, 255, 0.92);
  will-change: transform;
  transform-origin: 50% 50%;
  overflow: hidden;
}

.wheel-rotator canvas {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  display: block;
}

.wheel-hole {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 112px;
  height: 112px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(22, 26, 42, 0.08);
}

.wheel-actions {
  display: grid;
  grid-template-columns: 54px 1fr 54px;
  gap: 14px;
  align-items: center;
  margin-top: 6px;
}

.wheel-mini-btn {
  height: 44px;
  width: 54px;
  border-radius: 999px;
  border: 1px solid rgba(22, 26, 42, 0.12);
  background: rgba(255, 255, 255, 0.92);
  color: rgba(22, 26, 42, 0.8);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.wheel-mini-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.wheel-spin-btn {
  height: 46px;
  border-radius: 999px;
  border: 1px solid rgba(22, 26, 42, 0.12);
  background: rgba(255, 255, 255, 0.92);
  color: rgba(22, 26, 42, 0.75);
  font-weight: 800;
  letter-spacing: 0.2px;
  cursor: pointer;
}

.wheel-spin-btn:active {
  transform: translateY(1px);
}

.wheel-secondary {
  display: grid;
  place-items: center;
}

.wheel-options-head {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.wheel-option-count {
  color: rgba(22, 26, 42, 0.55);
  font-size: 13px;
}

.wheel-field {
  display: grid;
  gap: 8px;
}

.wheel-field-label {
  color: rgba(22, 26, 42, 0.76);
  font-weight: 800;
}

.wheel-input {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(22, 26, 42, 0.1);
  background: #fff;
  color: #171b2a;
  padding: 14px 16px;
  font-size: 16px;
  outline: none;
}

.wheel-input:focus {
  border-color: rgba(95, 140, 255, 0.65);
  box-shadow: 0 0 0 4px rgba(95, 140, 255, 0.12);
}

.wheel-options-editor {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.wheel-option-row {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  gap: 10px;
  align-items: center;
}

.wheel-option-color {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.04);
}

.wheel-option-input {
  padding: 12px 14px;
}

.wheel-option-delete {
  padding: 10px 14px;
}

.wheel-next-text {
  height: 44px;
  min-width: 160px;
  border-radius: 999px;
  border: 1px solid rgba(22, 26, 42, 0.12);
  background: rgba(255, 255, 255, 0.92);
  color: rgba(22, 26, 42, 0.66);
  font-weight: 800;
  cursor: pointer;
}

.wheel-next-text:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

@media (max-width: 520px) {
  .wheel-list-card-title {
    font-size: 20px;
  }

  .wheel-option-row {
    grid-template-columns: 16px 1fr;
  }

  .wheel-option-delete {
    grid-column: 2;
    justify-self: start;
  }

  .wheel-rotator,
  .wheel-rotator canvas {
    width: 320px;
    height: 320px;
  }

  .wheel-hole {
    width: 102px;
    height: 102px;
  }
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
  z-index: -1;
}

.orb-1 {
  width: 340px;
  height: 340px;
  left: -120px;
  top: -70px;
  background: rgba(86, 171, 255, 0.35);
}

.orb-2 {
  width: 420px;
  height: 420px;
  right: -150px;
  top: 80px;
  background: rgba(183, 90, 255, 0.28);
}

.orb-3 {
  width: 360px;
  height: 360px;
  left: 38%;
  bottom: -170px;
  background: rgba(89, 255, 192, 0.18);
}

.container {
  width: min(920px, 92%);
  margin: 32px auto;
}

.hero {
  text-align: center;
}

.top-nav {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.eyebrow {
  letter-spacing: 1px;
  font-size: 12px;
  color: #9bc7ff;
  margin: 0 0 8px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: 46px;
  letter-spacing: 0.5px;
  text-shadow: 0 4px 18px rgba(126, 95, 255, 0.5);
}

.hero p {
  margin: 0 0 6px;
}

.subtle {
  color: var(--sub);
  font-size: 14px;
}

.card {
  margin-top: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 26px;
  backdrop-filter: blur(7px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.home-card h2 {
  margin-top: 0;
}

.home-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 12px;
}

.module-card {
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: 16px;
  border: 1px solid #3b4686;
  background: rgba(26, 32, 64, 0.58);
  padding: 16px;
  transition: transform 0.1s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.module-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.28);
  border-color: rgba(141, 103, 255, 0.7);
}

.module-card-xpti {
  background: linear-gradient(135deg, rgba(26, 32, 64, 0.6), rgba(36, 27, 83, 0.55));
  border-color: rgba(120, 98, 220, 0.75);
}

.module-top {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
}

.module-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  color: #e9edff;
  background: linear-gradient(135deg, rgba(90, 212, 255, 0.2), rgba(139, 91, 255, 0.25));
  border: 1px solid rgba(154, 174, 255, 0.25);
}

.module-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.module-desc {
  margin-top: 10px;
  color: #d6dbff;
  line-height: 1.65;
}

.module-cta {
  margin-top: 14px;
}

.home-note {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(29, 36, 73, 0.42);
  border: 1px solid rgba(74, 88, 151, 0.65);
  color: #cfe7ff;
  line-height: 1.6;
}

.intro-lead {
  color: #d8defc;
  margin: 8px 0 14px;
}

.hidden {
  display: none;
}

.score-rule {
  display: grid;
  gap: 10px;
  margin: 14px 0 20px;
  color: #edf1ff;
}

.tips {
  margin: 6px 0 14px;
  color: #9ad7ff;
  font-size: 14px;
}

.progress-wrap {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  background: linear-gradient(135deg, #343f77, #27315f);
  border: 1px solid #4a5897;
}

.mood-text {
  margin: 2px 0 12px;
  color: #8fe8f9;
  font-size: 14px;
  min-height: 22px;
}

.progress-bar {
  margin: 12px 0 20px;
  width: 100%;
  height: 10px;
  background: #2a3158;
  border-radius: 999px;
  overflow: hidden;
}

.fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #65d5ff, #8c63ff, #ff79bf);
  transition: width 0.22s ease, filter 0.25s ease;
  filter: drop-shadow(0 0 6px rgba(139, 91, 255, 0.7));
}

.term-desc {
  color: #d6dbff;
  line-height: 1.65;
  background: rgba(29, 36, 73, 0.62);
  border: 1px solid #3a4684;
  border-radius: 12px;
  padding: 14px;
}

.choices {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.xpti-choices {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.xpti-score-btn {
  color: #d8e1ff;
}

#xptiOptionHint {
  font-size: 17px;
  line-height: 1.75;
}

.quiz-nav {
  margin-top: 12px;
}

.btn {
  border: none;
  border-radius: 12px;
  color: #fff;
  padding: 11px 14px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s ease, box-shadow 0.2s ease;
}

.btn:hover {
  opacity: 0.95;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.primary {
  background: var(--primary);
}

.like {
  background: var(--like);
}

.accept {
  background: var(--accept);
  color: #232323;
}

.reject {
  background: var(--reject);
}

.choices .btn.selected {
  filter: brightness(0.78) saturate(1.05);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.36), 0 8px 20px rgba(0, 0, 0, 0.35);
}

#quizCard.question-fade-out {
  opacity: 0.28;
  transform: translateY(8px) scale(0.995);
  transition: opacity 0.17s ease, transform 0.17s ease;
}

#quizCard.question-fade-in {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: opacity 0.23s ease, transform 0.23s ease;
}

.ghost {
  background: transparent;
  border: 1px solid #4b5aa0;
  color: #d8e1ff;
}

.xp-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.xp-title {
  margin: 0;
}

.xp-sub {
  margin: 6px 0 0;
  color: var(--sub);
  font-size: 14px;
}

.xp-search {
  min-width: min(360px, 100%);
  display: grid;
  gap: 8px;
  justify-items: end;
}

.xp-input {
  width: min(420px, 100%);
  border-radius: 12px;
  border: 1px solid rgba(75, 90, 160, 0.9);
  background: rgba(20, 24, 47, 0.6);
  color: var(--text);
  padding: 12px 12px;
  outline: none;
}

.xp-input:focus {
  border-color: rgba(90, 212, 255, 0.85);
  box-shadow: 0 0 0 4px rgba(90, 212, 255, 0.14);
}

.xp-count {
  color: var(--sub);
  font-size: 13px;
}

.xp-list {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
}

.xp-item {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(75, 90, 160, 0.8);
  background: rgba(29, 36, 73, 0.4);
  border-radius: 14px;
  padding: 12px 12px;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.2s ease, background 0.2s ease;
}

.xp-item:hover {
  transform: translateY(-1px);
  border-color: rgba(141, 103, 255, 0.7);
  background: rgba(29, 36, 73, 0.62);
}

.xp-item-name {
  display: block;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.xp-item-hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #9ad7ff;
}

.xp-empty {
  grid-column: 1 / -1;
  padding: 14px;
  border-radius: 14px;
  border: 1px dashed rgba(75, 90, 160, 0.75);
  color: var(--sub);
  background: rgba(29, 36, 73, 0.28);
}

.xp-dialog {
  border: 1px solid rgba(75, 90, 160, 0.9);
  border-radius: 18px;
  padding: 0;
  background: rgba(20, 24, 47, 0.92);
  color: var(--text);
  width: min(720px, 92vw);
}

.xp-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}

.xp-dialog-inner {
  padding: 16px;
}

.xp-dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.xp-dialog-name {
  font-size: 22px;
  font-weight: 900;
}

.xp-dialog-alias {
  margin-top: 6px;
  color: var(--sub);
  font-size: 13px;
}

.xp-dialog-desc {
  margin-top: 12px;
  line-height: 1.75;
  color: #d6dbff;
  background: rgba(29, 36, 73, 0.55);
  border: 1px solid rgba(58, 70, 132, 0.85);
  border-radius: 14px;
  padding: 14px;
}

.result-grid {
  margin: 8px 0 16px;
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
}

.result-item {
  background: rgba(30, 36, 70, 0.68);
  border: 1px solid #3b4686;
  border-radius: 12px;
  padding: 10px;
}

.result-item span {
  display: block;
  color: var(--sub);
  font-size: 13px;
}

.result-item strong {
  font-size: 22px;
}

.result-title {
  margin-top: 12px;
  font-size: 24px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  background: rgba(45, 57, 113, 0.82);
  border: 1px solid #5463a9;
  color: #d7ddff;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
}

.analysis {
  margin: 18px 0;
  color: #dbe1ff;
}

#analysisText {
  margin-top: 10px;
  line-height: 1.65;
  color: #cfd6ff;
}

.result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.footer {
  margin: 20px 0 8px;
  text-align: center;
  color: #7f8abe;
  font-size: 12px;
}

@media (max-width: 740px) {
  .hero h1 {
    font-size: 36px;
  }

  .home-grid {
    grid-template-columns: 1fr;
  }

  .xp-list {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .choices {
    grid-template-columns: 1fr;
  }

  .xpti-choices {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .result-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}
