:root {
  --court: #080c14;
  --court-elevated: #101828;
  --court-card: #0f1624;
  --gold: #c9a227;
  --gold-bright: #f0d078;
  --arena: #e85d04;
  --text: #f4f4f5;
  --muted: #8b95a8;
  --line: rgba(255, 255, 255, 0.07);
  --line-gold: rgba(201, 162, 39, 0.35);
  --radius: 14px;
  --font-display: "Bebas Neue", sans-serif;
  --font-body: "Noto Sans SC", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background: var(--court);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90% 45% at 50% -5%, rgba(201, 162, 39, 0.08), transparent 55%),
    radial-gradient(ellipse 50% 35% at 100% 90%, rgba(232, 93, 4, 0.05), transparent);
}

.app {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: max(24px, env(safe-area-inset-top)) 20px max(40px, env(safe-area-inset-bottom));
}

.screen { display: none; }
.screen.active { display: block; }

/* —— 开场 —— */
#screen-intro { padding-top: 12px; }

.logo-mark {
  font-size: 52px;
  text-align: center;
  margin: 28px 0 8px;
  filter: drop-shadow(0 8px 24px rgba(201, 162, 39, 0.2));
}

.eyebrow {
  text-align: center;
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1 {
  font-family: var(--font-display);
  font-size: 64px;
  text-align: center;
  letter-spacing: 0.06em;
  line-height: 0.95;
  margin: 10px 0 20px;
  color: var(--text);
}

h1 span {
  display: block;
  font-size: 0.42em;
  letter-spacing: 0.28em;
  color: var(--gold);
  margin-bottom: 4px;
}

h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 22px;
}

.lead {
  text-align: center;
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 36px;
  min-height: 52px;
  font-size: 15px;
  padding: 0 8px;
}

.look-hint {
  margin: -4px 0 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.fine {
  text-align: center;
  color: #5c6578;
  font-size: 11px;
  margin-top: 24px;
  letter-spacing: 0.04em;
}

/* —— 按钮 —— */
.btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: var(--radius);
  padding: 15px 20px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease;
  letter-spacing: 0.02em;
}

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

.btn-primary {
  background: var(--court-elevated);
  color: var(--gold-bright);
  border: 1px solid var(--line-gold);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.btn-primary:hover {
  box-shadow: 0 6px 24px rgba(201, 162, 39, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  margin-top: 10px;
  font-weight: 500;
}

.btn-wall-wrap {
  position: relative;
  margin-top: 12px;
}

.btn-wall-ring {
  position: absolute;
  inset: -4px;
  border-radius: calc(var(--radius) + 4px);
  border: 2px solid rgba(201, 162, 39, 0.45);
  pointer-events: none;
  opacity: 0;
}

.btn-wall-hint {
  display: block;
  text-align: center;
  font-size: 11px;
  color: var(--gold);
  letter-spacing: 0.12em;
  margin-bottom: 8px;
  opacity: 0.85;
}

.btn-wall {
  position: relative;
  z-index: 1;
  background: linear-gradient(180deg, #1a2236 0%, #0f1624 100%);
  color: var(--gold-bright);
  border: 1px solid var(--line-gold);
  font-weight: 700;
  box-shadow: 0 0 32px rgba(201, 162, 39, 0.12);
  overflow: hidden;
}

.btn-wall::after {
  content: "";
  position: absolute;
  top: 0;
  left: -120%;
  width: 80%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(240, 208, 120, 0.12), transparent);
  animation: wallShimmer 3.2s ease-in-out infinite;
}

@keyframes wallShimmer {
  0%, 100% { left: -120%; }
  50% { left: 140%; }
}

.btn-wall:disabled,
.btn-wall-done {
  opacity: 0.65;
  box-shadow: none;
}

.btn-wall:disabled::after,
.btn-wall-done::after {
  animation: none;
}

.btn-wall-wrap.is-done .btn-wall-hint {
  color: var(--muted);
}

.wall-open-link {
  display: block;
  margin-top: 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--gold-bright);
  text-decoration: none;
  letter-spacing: 0.04em;
}

.wall-open-link:hover {
  text-decoration: underline;
}

/* —— 进度 —— */
.progress {
  height: 3px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 2px;
  margin-bottom: 28px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  border-radius: 2px;
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 0 12px rgba(201, 162, 39, 0.35);
}

/* —— 表单 —— */
.field { display: block; margin-bottom: 24px; }

.field > span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
  letter-spacing: 0.06em;
}

.field input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--court-card);
  color: var(--text);
  font-size: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input[type="text"]:focus {
  outline: none;
  border-color: var(--line-gold);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.12);
}

.jersey-field {
  margin-bottom: 28px;
}

.jersey-input-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: 148px;
  margin: 0 auto;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.35));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.jersey-input-wrap:focus-within {
  border-color: var(--line-gold);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.jersey-hash {
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 1;
  color: var(--gold);
  opacity: 0.85;
  user-select: none;
}

.jersey-input {
  width: 72px;
  padding: 4px 0;
  border: none;
  background: transparent;
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-size: 36px;
  line-height: 1;
  letter-spacing: 0.06em;
  text-align: center;
}

.jersey-input:focus {
  outline: none;
}

.jersey-input::placeholder {
  color: #5c6578;
  font-size: 18px;
  letter-spacing: 0.12em;
  font-family: var(--font-body);
  font-weight: 500;
}

.jersey-input-hint {
  margin-top: 10px;
  text-align: center;
  font-size: 11px;
  color: #5c6578;
  letter-spacing: 0.04em;
}

.field input[type="range"] {
  width: 100%;
  accent-color: var(--gold);
}

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--court-card);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.chip.selected {
  border-color: var(--gold);
  color: var(--gold-bright);
  background: rgba(201, 162, 39, 0.1);
  box-shadow: inset 3px 0 0 var(--gold);
}

.body-tag {
  text-align: center;
  color: var(--gold);
  font-size: 13px;
  margin: -4px 0 22px;
  letter-spacing: 0.04em;
}

/* —— 问卷 —— */
.quiz-step {
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.14em;
  margin-bottom: 10px;
}

.options { display: flex; flex-direction: column; gap: 10px; }

.option {
  text-align: left;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  border-left: 3px solid transparent;
  background: var(--court-card);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, transform 0.12s;
}

.option:hover {
  border-left-color: rgba(201, 162, 39, 0.5);
  background: rgba(255, 255, 255, 0.03);
}

.option:active {
  transform: scale(0.99);
}

/* —— 翻卡 —— */
#screen-flip {
  text-align: center;
  padding-top: 72px;
}

.flip-card {
  perspective: 1000px;
  width: 200px;
  height: 280px;
  margin: 0 auto 28px;
}

.flip-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  will-change: transform;
}

.flip-front,
.flip-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 52px;
  letter-spacing: 0.08em;
}

.flip-front {
  background: linear-gradient(145deg, #141c2e, #080c14);
  color: var(--gold);
  border: 2px solid var(--line-gold);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.flip-back {
  background: linear-gradient(160deg, #1a2236, #0a0f18);
  transform: rotateY(180deg);
  color: var(--gold-bright);
  border: 2px solid var(--gold);
}

.flip-text {
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.06em;
}

/* —— 结果卡 —— */
#screen-result { padding-bottom: 28px; }

.result-card {
  background: var(--court-card);
  border: 1px solid var(--line-gold);
  border-radius: 18px;
  padding: 20px 18px 24px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  position: relative;
  overflow: hidden;
}

.result-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.result-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 40% at 50% 0%, rgba(201, 162, 39, 0.06), transparent 60%);
  pointer-events: none;
}

.rarity {
  position: relative;
  text-align: center;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.22em;
  color: var(--gold);
  margin-bottom: 0;
}

.rating-reveal {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
  min-height: 22px;
}

.rarity.epic { color: var(--gold-bright); }
.rarity.legendary { color: var(--gold-bright); text-shadow: 0 0 20px rgba(240, 208, 120, 0.35); }

.avatar-wrap {
  position: relative;
  width: 140px;
  height: 186px;
  margin: 0 auto 12px;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(0, 0, 0, 0.55) 100%);
  border: 1px solid var(--line-gold);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1), height 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  display: block;
}

.avatar-img[hidden],
.avatar-wrap canvas[hidden] {
  display: none !important;
}

.avatar-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.avatar-ovr {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #fff4cc, #d4af37 52%, #7a5c10);
  border: 2px solid rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1;
  color: #1a1204;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  z-index: 2;
  pointer-events: none;
}

.avatar-ovr[hidden] {
  display: none !important;
}

.avatar-wrap.avatar-loading-active canvas {
  opacity: 0.4;
  filter: blur(1px);
}

.avatar-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(8, 12, 20, 0.65);
  pointer-events: none;
}

.avatar-loading[hidden] { display: none !important; }

.avatar-loading-pulse {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(201, 162, 39, 0.25);
  border-top-color: var(--gold);
  animation: avatarSpin 0.85s linear infinite;
}

.avatar-loading-text {
  font-size: 10px;
  color: var(--gold);
  letter-spacing: 0.1em;
}

.char-borrow-hint,
.char-canvas-hint {
  text-align: center;
  font-size: 11px;
  margin: -4px 0 12px;
  line-height: 1.45;
  padding: 0 12px;
}

.char-borrow-hint { color: var(--gold); opacity: 0.9; }
.char-canvas-hint { color: var(--muted); }
.char-borrow-hint[hidden],
.char-canvas-hint[hidden] { display: none !important; }

@keyframes avatarSpin {
  to { transform: rotate(360deg); }
}

#result-name {
  position: relative;
  text-align: center;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.meta {
  position: relative;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 16px;
}

.title-block {
  position: relative;
  text-align: center;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.main-title {
  font-size: 24px;
  font-weight: 900;
  color: var(--gold-bright);
  line-height: 1.25;
}

.sub-title {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
  line-height: 1.5;
}

.radar-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  margin: 8px 0 4px;
}

.stat-bars { position: relative; margin: 14px 0; }

.stat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 12px;
}

.stat-row span:first-child {
  width: 72px;
  color: var(--muted);
  flex-shrink: 0;
}

.stat-row span:last-child {
  width: 44px;
  text-align: right;
  flex-shrink: 0;
  font-size: 11px;
  color: var(--gold);
  font-family: var(--font-display);
  letter-spacing: 0.04em;
}

.stat-bar {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #8a6b12, var(--gold-bright));
  box-shadow: 0 0 8px rgba(201, 162, 39, 0.25);
}

.dna-block {
  position: relative;
  margin-top: 16px;
  padding: 14px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--line);
}

.dna-label {
  font-size: 10px;
  color: var(--gold);
  letter-spacing: 0.14em;
  font-family: var(--font-display);
}

.dna-type {
  font-size: 17px;
  font-weight: 700;
  margin: 6px 0 4px;
}

.dna-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}

.hidden-attr {
  position: relative;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(201, 162, 39, 0.06);
  border: 1px dashed var(--line-gold);
  font-size: 12px;
  color: var(--gold);
  text-align: center;
  line-height: 1.5;
}

.ovr-row {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.ovr {
  font-family: var(--font-display);
  font-size: 56px;
  color: var(--gold-bright);
  line-height: 1;
  text-shadow: 0 4px 24px rgba(201, 162, 39, 0.25);
}

.ovr-title {
  font-size: 13px;
  color: var(--muted);
  max-width: 140px;
  line-height: 1.4;
}

.actions { margin-top: 18px; }

.share-canvas {
  position: fixed;
  left: -9999px;
  top: 0;
  pointer-events: none;
}

@media (max-width: 380px) {
  h1 { font-size: 52px; }
  .main-title { font-size: 20px; }
  .ovr { font-size: 48px; }
}
