:root {
  --bg: #050b13;
  --bg-deep: #03070f;
  --surface: rgba(11, 19, 33, 0.86);
  --surface-2: rgba(13, 24, 42, 0.82);
  --surface-soft: rgba(17, 29, 50, 0.72);
  --line: rgba(184, 203, 239, 0.22);
  --line-soft: rgba(184, 203, 239, 0.12);
  --text: #ebf3ff;
  --muted: #9fb1cd;
  --primary: #7db8ff;
  --primary-strong: #a3ceff;
  --accent: #7df0d2;
  --accent-soft: rgba(125, 240, 210, 0.16);
  --danger: #ff8faa;
  --radius-xl: 30px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow: 0 30px 100px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 12% 10%, #132845 0%, transparent 34%),
    radial-gradient(circle at 84% 18%, #0f3240 0%, transparent 38%),
    linear-gradient(180deg, #081422 0%, var(--bg) 36%, var(--bg-deep) 100%);
}

body {
  position: relative;
  overflow-x: hidden;
}

button,
input,
textarea {
  font: inherit;
}

strong,
h1,
h2,
h3,
.stat-value,
.result-code,
.btn {
  font-family: "Manrope", "Noto Sans SC", sans-serif;
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(18px);
  opacity: 0.48;
  z-index: 0;
  pointer-events: none;
}

.orb-a {
  width: 360px;
  height: 360px;
  top: -90px;
  right: -40px;
  background: rgba(121, 167, 255, 0.4);
}

.orb-b {
  width: 380px;
  height: 380px;
  left: -130px;
  bottom: 8%;
  background: rgba(125, 240, 210, 0.28);
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.026) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.42), transparent 86%);
  z-index: 0;
  pointer-events: none;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 44px 0 70px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hidden {
  display: none;
}

.section-visible {
  animation: sectionIn 0.4s ease;
}

@keyframes sectionIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.32fr) minmax(300px, 0.8fr);
  gap: 28px;
  padding: 34px;
}

.hero h1,
.test h2,
.result h2,
.types h2 {
  margin: 14px 0 14px;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.hero h1 {
  font-size: clamp(2.3rem, 5vw, 4.3rem);
}

.hero p,
.result-subtitle,
.question-prompt,
.result-panel p,
.result-panel li,
.feature-list li,
.share-summary {
  color: var(--muted);
  line-height: 1.72;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(127, 183, 255, 0.12);
  border: 1px solid rgba(172, 210, 255, 0.22);
  color: #dbeaff;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.hero-actions,
.result-actions,
.test-actions,
.types-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  min-height: 46px;
  padding: 12px 20px;
  cursor: pointer;
  font-weight: 750;
  letter-spacing: 0.01em;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.2s ease, box-shadow 0.2s ease;
}

a.btn {
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:focus-visible,
.option-btn:focus-visible {
  outline: 2px solid rgba(166, 213, 255, 0.75);
  outline-offset: 2px;
}

.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary {
  color: #031017;
  background: linear-gradient(140deg, var(--accent), #9ef6e0);
  box-shadow: 0 8px 24px rgba(125, 240, 210, 0.24);
}

.btn-secondary {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-ghost {
  color: #c7d6f2;
  background: transparent;
  border: 1px solid rgba(199, 214, 242, 0.2);
}

.feature-list {
  margin: 20px 0 0;
  padding-left: 18px;
}

.hero-stats {
  display: grid;
  gap: 14px;
}

.stat-card,
.result-panel,
.dimension-card,
.type-card,
.share-panel {
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
}

.stat-card {
  padding: 20px;
}

.stat-label {
  display: block;
  color: var(--muted);
  margin-bottom: 10px;
  font-size: 0.95rem;
}

.stat-value {
  font-size: 1.28rem;
  font-weight: 800;
}

.test,
.result,
.types {
  padding: 32px;
}

.page-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  margin-bottom: 14px;
}

.test-head,
.result-top {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.progress-wrap {
  min-width: min(320px, 100%);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 0.93rem;
}

.progress-bar {
  height: 12px;
  margin-top: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

#progressBarFill {
  height: 100%;
  width: 8%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.progress-dots {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 6px;
}

.progress-dot {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.11);
  transition: background 0.2s ease, transform 0.2s ease;
}

.progress-dot.done {
  background: rgba(125, 240, 210, 0.5);
}

.progress-dot.active {
  background: var(--primary-strong);
  transform: scaleY(1.2);
}

.question-stage {
  margin-top: 20px;
}

.question-stage.switching {
  animation: cardSwitch 0.28s ease;
}

@keyframes cardSwitch {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.question-prompt {
  margin: 0 0 20px;
  font-size: 1.08rem;
}

.options-wrap {
  display: grid;
  gap: 12px;
}

.option-btn {
  width: 100%;
  text-align: left;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(198, 216, 246, 0.17);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.18s ease, box-shadow 0.2s ease;
}

.option-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(181, 206, 246, 0.34);
}

.option-btn strong {
  display: inline-block;
  font-size: 1rem;
}

.option-btn small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

.option-btn.selected {
  background: rgba(125, 184, 255, 0.18);
  border-color: rgba(178, 211, 255, 0.52);
  box-shadow: inset 0 0 0 1px rgba(178, 211, 255, 0.34);
}

.option-btn.selected strong::before {
  content: "✓ ";
  color: #d6ebff;
}

.inline-feedback {
  min-height: 24px;
  margin: 14px 2px 0;
  color: #ffced8;
  font-size: 0.94rem;
}

.test-actions {
  justify-content: space-between;
  margin-top: 8px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.03);
}

.result-grid,
.types-grid,
.dimension-grid {
  display: grid;
  gap: 16px;
}

.result-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 24px;
}

.result-panel {
  padding: 20px;
}

.accent-panel {
  background: linear-gradient(180deg, rgba(125, 184, 255, 0.2), rgba(125, 184, 255, 0.08));
}

.result-panel h3,
.dimension-card h3,
.type-card h3,
.share-panel h3 {
  margin-top: 0;
  margin-bottom: 10px;
}

.result-panel ul {
  margin: 0;
  padding-left: 20px;
}

.result-code-wrap {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.result-code {
  flex-shrink: 0;
  font-size: clamp(1.55rem, 3.8vw, 2.7rem);
  font-weight: 900;
  letter-spacing: 0.18em;
  color: #d7fff6;
  text-shadow: 0 0 18px rgba(125, 240, 210, 0.25);
}

.result-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.83rem;
  font-weight: 700;
  color: #cde3ff;
  border: 1px solid rgba(205, 227, 255, 0.25);
  background: rgba(205, 227, 255, 0.08);
}

.dimension-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 20px;
}

.dimension-card {
  padding: 16px;
}

.dimension-card .bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin: 10px 0 8px;
}

.dimension-card .bar > div {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.dimension-meta,
.dimension-score {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.88rem;
}

.dimension-score {
  margin-top: 6px;
}

.share-panel {
  margin-top: 20px;
  padding: 20px;
  background: linear-gradient(180deg, rgba(125, 240, 210, 0.1), rgba(125, 184, 255, 0.08));
}

.share-summary {
  margin-top: 0;
}

.result-actions {
  margin-top: 14px;
}

.types-head {
  justify-content: space-between;
  margin-bottom: 22px;
}

.types-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.type-card {
  padding: 20px;
}

.type-code {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(125, 240, 210, 0.12);
  color: #c6fff2;
  font-size: 0.92rem;
  font-weight: 700;
}

.type-card p {
  color: var(--muted);
  line-height: 1.68;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  min-width: min(90vw, 320px);
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(8, 16, 30, 0.95);
  color: #eff6ff;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 99;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 980px) {
  .hero,
  .result-grid,
  .types-grid,
  .dimension-grid {
    grid-template-columns: 1fr;
  }

  .test-head,
  .result-top,
  .types-head,
  .page-nav {
    flex-direction: column;
    align-items: stretch;
  }

  .result-code-wrap {
    justify-items: start;
  }
}

@media (max-width: 760px) {
  .progress-dots {
    gap: 4px;
  }

  .progress-dot {
    height: 5px;
  }

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

  .result-actions .btn {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 18px, 1000px);
    padding: 18px 0 calc(42px + env(safe-area-inset-bottom));
  }

  .hero,
  .test,
  .result,
  .types {
    padding: 18px;
    border-radius: 22px;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .question-prompt {
    font-size: 1rem;
  }

  .option-btn {
    min-height: 66px;
  }

  .test-actions {
    position: sticky;
    bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 10;
    backdrop-filter: blur(10px);
    margin-top: 10px;
  }

  .test-actions .btn {
    flex: 1;
    justify-content: center;
  }

  .result-code {
    letter-spacing: 0.13em;
  }

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

  .progress-meta {
    font-size: 0.85rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
