:root {
  --bg: #0a0c10;
  --bg-elev: #12161f;
  --border: rgba(212, 175, 55, 0.22);
  --gold: #d4af37;
  --gold-dim: #9a7b2c;
  --text: #e8eaed;
  --muted: #8a9199;
  --accent: #4a9eff;
  --danger: #c44c4c;
  --radius: 12px;
  --font: "Noto Sans SC", system-ui, sans-serif;
  --font-display: "ZCOOL XiaoWei", "Noto Sans SC", serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  min-height: 100svh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0)
    env(safe-area-inset-left, 0);
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(212, 175, 55, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(212, 175, 55, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, black, transparent);
  z-index: 0;
}

.glow {
  position: fixed;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.18;
  pointer-events: none;
  z-index: 0;
}

.glow-a {
  top: -120px;
  right: -80px;
  background: #3d6ab0;
}

.glow-b {
  bottom: -100px;
  left: -100px;
  background: var(--gold);
}

.site-header {
  position: relative;
  z-index: 1;
  padding: 1rem clamp(0.75rem, 4vw, 2rem) 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.logo-mark {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  letter-spacing: 0.12em;
  color: var(--gold);
  text-shadow: 0 0 24px rgba(212, 175, 55, 0.35);
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 0 auto;
  padding: 1rem clamp(0.75rem, 4vw, 1.5rem) max(1.5rem, env(safe-area-inset-bottom))
    clamp(0.75rem, 4vw, 1.5rem);
}

.shell--survey {
  max-width: 720px;
}

.panel {
  display: none;
  animation: fadeIn 0.35s ease;
}

.panel.visible {
  display: block;
}

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

h1 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 5vw, 1.85rem);
  font-weight: 400;
  margin: 0 0 1rem;
  line-height: 1.35;
}

.hl {
  color: var(--gold);
}

.lead {
  color: var(--muted);
  font-size: clamp(0.88rem, 3.8vw, 0.95rem);
  margin: 0 0 1.5rem;
  text-align: left;
}

.lead-credit {
  display: block;
  margin-top: 0.65rem;
  font-size: 0.82rem;
  color: #6e7480;
}

.btn {
  font-family: inherit;
  font-size: max(16px, 0.95rem);
  padding: 0.85rem 1.25rem;
  min-height: 48px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn-block {
  display: block;
  width: 100%;
  box-sizing: border-box;
}

.btn:active {
  transform: scale(0.98);
}

.btn.primary {
  background: linear-gradient(160deg, #2a3344 0%, #1a1f2a 100%);
  color: var(--text);
  border-color: rgba(212, 175, 55, 0.45);
  box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.12), 0 8px 24px rgba(0, 0, 0, 0.4);
}

.btn.primary:hover {
  border-color: var(--gold);
  background: linear-gradient(160deg, #323c50 0%, #1f2533 100%);
}

.btn.secondary {
  background: transparent;
  color: var(--muted);
}

.btn.secondary:hover {
  color: var(--text);
  border-color: var(--muted);
}

.survey-sticky {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: -0.5rem -0.25rem 1.25rem;
  padding: 0.65rem 0.85rem;
  background: rgba(10, 12, 16, 0.88);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.survey-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.survey-meta-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.06em;
}

.survey-progress {
  font-size: 0.78rem;
  color: var(--muted);
}

.survey-form {
  padding-bottom: 2rem;
}

.survey-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  margin: 0 0 0.85rem;
  padding: 0.85rem 1rem 1rem;
}

.survey-legend {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  padding: 0;
  margin: 0 0 0.75rem;
  line-height: 1.45;
}

.survey-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}

.survey-options input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.survey-opt {
  display: flex;
  align-items: center;
  font-size: max(15px, 0.88rem);
  line-height: 1.45;
  padding: 0.8rem 0.95rem;
  min-height: 48px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.survey-opt:hover {
  border-color: rgba(212, 175, 55, 0.45);
  color: var(--text);
}

.survey-options input:focus-visible + .survey-opt {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.survey-options input:checked + .survey-opt {
  border-color: rgba(212, 175, 55, 0.55);
  background: rgba(30, 38, 52, 0.95);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(212, 175, 55, 0.1);
}

.survey-footer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.survey-submit {
  width: 100%;
  max-width: 320px;
}

.survey-hint {
  margin: 0.75rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.result-grid {
  display: grid;
  gap: 1.5rem;
  align-items: start;
}

@media (min-width: 720px) {
  .result-grid {
    grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
    gap: 2rem;
  }
}

.result-visual {
  margin: 0;
  padding: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: radial-gradient(ellipse at center, #1a2030 0%, #12161f 100%);
  width: 100%;
  max-width: 320px;
  margin-inline: auto;
  aspect-ratio: 709 / 895;
}

@media (min-width: 720px) {
  .result-visual {
    margin-inline: 0;
    max-width: none;
    width: 100%;
  }
}

.result-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.result-body {
  min-width: 0;
}

.result-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

.result-name {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 6vw, 2.25rem);
  margin: 0 0 1rem;
  color: var(--gold);
  letter-spacing: 0.06em;
  font-weight: 400;
}

.dim-bars {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0 0 1.25rem;
}

.dim-row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
  margin-bottom: 0.35rem;
}

.dim-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.dim-sublabel {
  font-size: 0.82rem;
  color: var(--text);
  font-weight: 600;
}

.dim-pct {
  margin-left: auto;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--gold-dim);
}

.dim-track {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  overflow: hidden;
}

.dim-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.45s ease;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
}

.dim-fill.dim-pos-a {
  background: linear-gradient(90deg, #5a7aa8, #6a9fff);
}

.dim-fill.dim-pos-b {
  background: linear-gradient(90deg, #8b7355, var(--gold));
}

.result-desc {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 1.25rem;
}

.result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.tag {
  font-size: 0.78rem;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--muted);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.result-about {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.result-about-title {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin: 0 0 0.75rem;
}

.result-about-body {
  font-size: 0.8rem;
  line-height: 1.65;
  color: #6e7480;
}

.result-about-body p {
  margin: 0 0 0.65rem;
}

.result-about-body p:last-child {
  margin-bottom: 0;
}

.result-about-credit {
  margin-top: 0.85rem;
  padding-top: 0.65rem;
  border-top: 1px dashed rgba(212, 175, 55, 0.15);
  font-size: 0.78rem;
  color: #5c6370;
}

.toast {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--accent);
}

@media (max-width: 540px) {
  .result-actions {
    flex-direction: column;
  }

  .result-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
  }

  #view-landing {
    text-align: center;
  }

  #view-landing .lead {
    text-align: left;
  }
}

@media (min-width: 600px) {
  .shell:not(.shell--survey) {
    max-width: 560px;
  }
}
