:root {
  --bg: #0b1020;
  --bg-soft: #151d34;
  --card: rgba(255, 255, 255, 0.06);
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #f59e0b;
  --accent-2: #22d3ee;
  --danger: #fb7185;
  --radius: 18px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

/* 组件自身的 display 会盖掉 hidden 属性的默认样式，这里强制兜底 */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: "PingFang SC", "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(34, 211, 238, 0.18), transparent 32%),
    radial-gradient(circle at 80% 20%, rgba(245, 158, 11, 0.16), transparent 24%),
    linear-gradient(180deg, #0b1020 0%, #111827 100%);
}

body {
  min-height: 100vh;
}

.app {
  width: min(100%, 430px);
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  padding: 20px 16px 32px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

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

.screen.active {
  display: block;
}

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

.brand {
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 12px;
}

.hero-title {
  font-size: 34px;
  line-height: 1.15;
  margin: 0 0 12px;
}

.hero-desc {
  color: var(--muted);
  line-height: 1.7;
  margin: 0 0 28px;
}

.card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero-card {
  padding: 28px 22px;
  margin-top: 24px;
}

.version-options {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.version-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 15px;
  color: var(--text);
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.version-card.active {
  border-color: var(--accent);
  background: rgba(245, 158, 11, 0.1);
}

.version-icon {
  font-size: 24px;
}

.version-copy {
  display: grid;
  gap: 3px;
  flex: 1;
}

.version-copy strong {
  font-size: 16px;
}

.version-copy small {
  color: var(--muted);
}

.version-check {
  visibility: hidden;
  color: var(--accent);
  font-weight: 700;
}

.version-card.active .version-check {
  visibility: visible;
}

.feature-list {
  display: grid;
  gap: 12px;
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
}

.feature-list li {
  padding-left: 18px;
  position: relative;
  color: #dbeafe;
}

.feature-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.btn {
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 15px 18px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary {
  color: #111827;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

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

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.source-tag {
  display: inline-block;
  margin-top: 14px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.source-tag.api {
  color: #34d399;
  background: rgba(52, 211, 153, 0.12);
}

.source-tag.fallback {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.12);
}

.quiz-head {
  margin-bottom: 18px;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width 0.25s ease;
}

.progress-text {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.question-card {
  padding: 24px 20px;
}

.section-label {
  color: var(--accent-2);
  font-size: 13px;
  margin-bottom: 10px;
}

.question-text {
  font-size: 22px;
  line-height: 1.45;
  margin: 0 0 22px;
}

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

.option-btn {
  text-align: left;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.option-btn:active {
  transform: scale(0.98);
  border-color: rgba(245, 158, 11, 0.5);
}

.result-card {
  padding: 24px 20px 20px;
  position: relative;
}

.result-detail-wrap {
  position: relative;
  margin-top: 16px;
}

.result-detail.locked {
  filter: blur(10px);
  opacity: 0.5;
  user-select: none;
  pointer-events: none;
}

.result-emoji {
  font-size: 54px;
  margin-bottom: 8px;
}

.result-title {
  font-size: 28px;
  margin: 0;
}

.result-subtitle {
  color: var(--muted);
  margin: 8px 0 16px;
}

.result-description {
  line-height: 1.8;
  color: #e2e8f0;
}

.result-quote {
  margin-top: 18px;
  color: var(--accent-2);
  font-style: italic;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.tag {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.12);
  color: #a5f3fc;
  font-size: 12px;
}

.rare-badge {
  display: inline-block;
  margin-bottom: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(251, 113, 133, 0.16);
  color: #fda4af;
  font-size: 12px;
}

.lock-panel {
  position: absolute;
  inset: -8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px 16px;
  border-radius: 16px;
  background: linear-gradient(
    180deg,
    rgba(11, 16, 32, 0.45) 0%,
    rgba(11, 16, 32, 0.82) 45%
  );
}

.lock-icon {
  font-size: 26px;
}

.lock-text {
  margin: 0;
  color: #e2e8f0;
  font-size: 15px;
}

.lock-panel .btn {
  width: auto;
  max-width: 100%;
  padding: 13px 26px;
  font-size: 15px;
}

.result-platform-ad {
  display: block;
  margin-top: 16px;
  min-height: 72px;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.35);
}

.result-platform-ad[hidden] {
  display: none !important;
}

.result-ad-banner {
  position: relative;
  display: block;
  margin-top: 16px;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.18);
  text-decoration: none;
}

.result-ad-label {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.72);
  color: #94a3b8;
  font-size: 11px;
  letter-spacing: 0.04em;
}

.result-ad-image {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
}

.result-actions {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.btn-link {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 0;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.btn-text {
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 14px;
  cursor: pointer;
  padding: 0;
}

.ranking-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.ranking-head h2 {
  margin: 0;
  font-size: 22px;
}

.ranking-stats {
  text-align: center;
  padding: 18px 12px 8px;
  margin-bottom: 12px;
}

.ranking-stats-label {
  color: #94a3b8;
  font-size: 13px;
  letter-spacing: 0.04em;
}

.ranking-stats-num {
  font-size: 52px;
  line-height: 1.1;
  font-weight: 800;
  color: #fbbf24;
  margin: 6px 0;
  font-variant-numeric: tabular-nums;
}

.ranking-me {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.16), rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(245, 158, 11, 0.28);
}

.ranking-me-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.ranking-me-emoji {
  font-size: 28px;
}

.ranking-me-label {
  color: #94a3b8;
  font-size: 12px;
  margin-bottom: 2px;
}

.ranking-me-rank {
  font-size: 18px;
  font-weight: 700;
  color: #fef3c7;
}

.ranking-me-persona {
  margin-top: 4px;
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.4;
}

.ranking-me-pct {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  color: #fbbf24;
  white-space: nowrap;
}

.ranking-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.ranking-tabs-tip {
  margin: 0 0 12px;
  font-size: 12px;
  color: #64748b;
  text-align: center;
}

.ranking-tab {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  cursor: pointer;
}

.ranking-tab.active {
  border-color: rgba(245, 158, 11, 0.55);
  background: rgba(245, 158, 11, 0.14);
  color: #fbbf24;
}

.ranking-list {
  padding: 8px 12px;
  min-height: 280px;
}

.ranking-item {
  display: grid;
  grid-template-columns: 42px 42px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 14px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ranking-item:last-child {
  border-bottom: none;
}

.ranking-rank {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
}

.ranking-item.top1 .ranking-rank { background: rgba(251, 191, 36, 0.25); color: #fbbf24; }
.ranking-item.top2 .ranking-rank { background: rgba(148, 163, 184, 0.25); color: #e2e8f0; }
.ranking-item.top3 .ranking-rank { background: rgba(251, 146, 60, 0.22); color: #fdba74; }

.ranking-emoji {
  font-size: 28px;
  text-align: center;
}

.ranking-title {
  font-size: 16px;
  font-weight: 600;
}

.ranking-count {
  color: #94a3b8;
  font-size: 13px;
}

.ranking-empty {
  padding: 48px 16px;
  text-align: center;
  color: #94a3b8;
}

.ranking-section-title {
  margin: 20px 0 10px;
  font-size: 15px;
  font-weight: 600;
  color: #cbd5e1;
}

.ranking-latest {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ranking-latest-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 72px;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.ranking-latest-body {
  min-width: 0;
  overflow: hidden;
}

.ranking-latest-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 22px;
  background: rgba(255, 255, 255, 0.06);
}

.ranking-latest-name {
  font-size: 14px;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ranking-latest-result {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ranking-latest-time {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ranking-latest-empty {
  padding: 16px;
  text-align: center;
  color: #64748b;
  font-size: 13px;
}

.ranking-updated {
  margin-top: 16px;
  margin-bottom: 8px;
  text-align: center;
  font-size: 12px;
  color: #64748b;
}

.pk-head {
  text-align: center;
  margin-bottom: 18px;
}

.pk-head h2 {
  margin: 0 0 8px;
}

.pk-status {
  margin: 0;
  color: #94a3b8;
}

.pk-board {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: stretch;
  margin-bottom: 18px;
}

.pk-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 16px 12px;
  text-align: center;
  min-height: 220px;
}

.pk-role {
  color: #22d3ee;
  font-size: 12px;
  margin-bottom: 12px;
}

.pk-emoji {
  font-size: 42px;
  margin-bottom: 8px;
}

.pk-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}

.pk-subtitle {
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.5;
}

.pk-vs {
  align-self: center;
  font-weight: 800;
  color: #f59e0b;
}

.pk-placeholder {
  padding-top: 36px;
  color: #94a3b8;
}

.pk-placeholder-icon {
  font-size: 34px;
  margin-bottom: 8px;
}

.pk-placeholder p {
  margin: 0;
  font-size: 13px;
}

.poster-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  background: rgba(2, 6, 23, 0.72);
}

.poster-modal[hidden] {
  display: none !important;
}

.poster-sheet {
  width: min(100%, 420px);
  max-height: 92vh;
  overflow: auto;
  padding: 18px 16px 22px;
  border-radius: 24px 24px 18px 18px;
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.poster-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.poster-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.poster-preview {
  border-radius: 18px;
  overflow: hidden;
  background: #0b1020;
}

.poster-preview img {
  display: block;
  width: 100%;
  height: auto;
  -webkit-touch-callout: default;
  user-select: none;
}

.poster-tip {
  margin: 14px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  z-index: 1100;
  transform: translateX(-50%);
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.92);
  color: #f8fafc;
  font-size: 14px;
  white-space: nowrap;
  pointer-events: none;
}

.toast[hidden] {
  display: none !important;
}

.loading-box {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

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

.ad-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 20px;
}

.ad-modal {
  width: min(100%, 320px);
  padding: 24px;
  border-radius: 18px;
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.ad-title {
  margin: 0 0 8px;
  font-size: 18px;
}

.ad-desc {
  margin: 0 0 16px;
  color: var(--muted);
}

.ad-progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.ad-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
}

.ad-skip {
  margin-top: 16px;
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

#screen-quiz {
  position: relative;
}

.quiz-mid-gate {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(11, 16, 32, 0.88);
  backdrop-filter: blur(6px);
}

.quiz-mid-gate-card {
  width: 100%;
  max-width: 320px;
  padding: 28px 22px;
  text-align: center;
}

.quiz-mid-title {
  margin: 12px 0 8px;
  font-size: 20px;
}

.quiz-mid-desc {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

.share-fallback-modal {
  width: min(100%, 360px);
}

.share-fallback-text {
  margin: 0 0 16px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  font-size: 13px;
  line-height: 1.6;
  max-height: 120px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  text-align: left;
}

.share-fallback-modal .btn {
  width: 100%;
  margin-bottom: 10px;
}

.share-fallback-modal .ad-cancel {
  margin-top: 4px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 8px;
  font-size: 14px;
}
