* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #6C5CE7;
  --primary-light: #A29BFE;
  --accent: #FD79A8;
  --bg-dark: #0F0A1A;
  --bg-card: rgba(255, 255, 255, 0.08);
  --text-primary: #FFFFFF;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --radius: 16px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', 'Microsoft YaHei', sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Pages */
.page {
  display: none;
  min-height: 100vh;
  position: relative;
}
.page.active {
  display: flex;
  flex-direction: column;
}

/* HOME */
.home-bg {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: 
    radial-gradient(circle at 20% 20%, rgba(108, 92, 231, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(253, 121, 168, 0.2) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(0, 206, 209, 0.1) 0%, transparent 60%);
  z-index: 0;
  animation: bgPulse 8s ease-in-out infinite alternate;
}

@keyframes bgPulse {
  0% { opacity: 0.8; }
  100% { opacity: 1; }
}

.container {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

.home-header {
  text-align: center;
  padding: 60px 0 30px;
}

.logo-icon {
  font-size: 56px;
  margin-bottom: 12px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.title-glow {
  font-size: 36px;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 0%, #A29BFE 50%, #FD79A8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 4px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 16px;
  margin-top: 8px;
  letter-spacing: 2px;
}

/* Test Cards */
.test-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 30px;
}

.test-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.test-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}

.card-mbti::before {
  background: linear-gradient(90deg, #6C5CE7, #A29BFE);
}
.card-pdp::before {
  background: linear-gradient(90deg, #FF6B35, #FFC107);
}
.card-fpa::before {
  background: linear-gradient(90deg, #E53935, #2196F3, #FDD835, #43A047);
}

.test-card:active {
  transform: scale(0.97);
}

.card-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}
.card-badge.hot {
  background: linear-gradient(135deg, #FF6B35, #FFC107);
}
.card-badge.fun {
  background: linear-gradient(135deg, #00CED1, #43A047);
}

.card-icon {
  font-size: 40px;
  margin-bottom: 8px;
}

.test-card h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.test-card p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 12px;
}

.card-tags {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.card-tags span {
  background: rgba(108, 92, 231, 0.2);
  color: var(--primary-light);
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid rgba(108, 92, 231, 0.3);
}

.btn-start {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: all 0.3s;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}

.btn-start:active {
  transform: scale(0.97);
  opacity: 0.9;
}

/* Footer */
.home-footer {
  text-align: center;
  padding: 20px 0 40px;
  color: var(--text-secondary);
  font-size: 13px;
}

.counter {
  color: var(--accent);
  font-weight: 700;
}

/* TEST PAGE */
#test-page {
  background: var(--bg-dark);
}

.test-header {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(15, 10, 26, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.btn-back {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  font-size: 20px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.btn-back:active {
  background: rgba(255,255,255,0.2);
}

.progress-info {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

#test-title {
  font-weight: 600;
}

#progress-text {
  color: var(--text-secondary);
  font-size: 13px;
}

.progress-bar {
  height: 3px;
  background: rgba(255,255,255,0.1);
  position: sticky;
  top: 68px;
  z-index: 10;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.4s ease;
  border-radius: 2px;
  width: 0%;
}

.test-body {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 20px 40px;
}

.question-card {
  max-width: 480px;
  width: 100%;
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.question-number {
  font-size: 13px;
  color: var(--primary-light);
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.question-text {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 28px;
  min-height: 60px;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-btn {
  width: 100%;
  text-align: left;
  padding: 16px 20px;
  border: 1.5px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.5;
  cursor: pointer;
  transition: all 0.25s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.option-btn:active {
  transform: scale(0.98);
}

.option-btn:hover {
  border-color: var(--primary-light);
  background: rgba(108, 92, 231, 0.15);
}

.option-btn.selected {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(108, 92, 231, 0.3), rgba(253, 121, 168, 0.15));
  box-shadow: 0 0 20px rgba(108, 92, 231, 0.2);
}

/* PDP scale options */
.scale-options {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.scale-btn {
  flex: 1;
  padding: 14px 8px;
  border: 1.5px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
  font-size: 13px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
}

.scale-btn:active {
  transform: scale(0.95);
}

.scale-btn .scale-num {
  display: block;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.scale-btn.selected {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(108, 92, 231, 0.3), rgba(253, 121, 168, 0.15));
}

/* RESULT PAGE */
#result-page {
  background: var(--bg-dark);
  justify-content: flex-start;
}

.result-container {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 20px 40px;
  width: 100%;
}

.result-header {
  text-align: center;
  padding: 40px 0 24px;
}

.result-emoji {
  font-size: 72px;
  margin-bottom: 12px;
  animation: float 3s ease-in-out infinite;
}

.result-type-name {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 4px;
  background: linear-gradient(135deg, #fff 0%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.result-type-code {
  font-size: 16px;
  color: var(--primary-light);
  font-weight: 600;
  letter-spacing: 3px;
  margin-bottom: 8px;
}

.result-type-traits {
  font-size: 14px;
  color: var(--text-secondary);
}

.result-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.result-card h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--primary-light);
}

.result-card p {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.result-card ul {
  list-style: none;
  padding: 0;
}

.result-card li {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
  padding-left: 20px;
  position: relative;
}

.result-card li::before {
  content: '✦';
  position: absolute;
  left: 0;
  color: var(--primary-light);
  font-size: 10px;
}

/* Dimension bars */
.dimension-bar {
  margin-bottom: 16px;
}

.dimension-labels {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}

.dim-left { color: var(--primary-light); font-weight: 600; }
.dim-right { color: var(--accent); font-weight: 600; }

.bar-track {
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 1s ease;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.dim-percent {
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Radar / score display for PDP */
.score-bars {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.score-bar-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.score-bar-icon {
  font-size: 28px;
  width: 40px;
  text-align: center;
}

.score-bar-info {
  flex: 1;
}

.score-bar-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.score-bar-track {
  height: 10px;
  background: rgba(255,255,255,0.1);
  border-radius: 5px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 1.2s ease;
}

.score-bar-value {
  font-size: 14px;
  font-weight: 700;
  min-width: 32px;
  text-align: right;
}

/* Action buttons */
.result-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

.btn-action {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-action.primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
}

.btn-action.secondary {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
  border: 1px solid rgba(255,255,255,0.15);
}

.btn-action:active {
  transform: scale(0.97);
}

/* Watermark for screenshots */
.result-watermark {
  text-align: center;
  padding: 20px 0 10px;
  font-size: 12px;
  color: rgba(255,255,255,0.3);
  letter-spacing: 1px;
}

/* FPA color blocks */
.color-result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.color-block {
  padding: 16px;
  border-radius: 14px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.color-block.dominant {
  grid-column: 1 / -1;
}

.color-block-emoji {
  font-size: 28px;
  margin-bottom: 6px;
}

.color-block-name {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 2px;
}

.color-block-score {
  font-size: 24px;
  font-weight: 800;
}

.color-block-label {
  font-size: 11px;
  opacity: 0.8;
}

/* Loading animation */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 20px;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--primary-light);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  color: var(--text-secondary);
  font-size: 15px;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* Section Divider */
.section-divider {
  text-align: center;
  margin: 8px 0 16px;
  color: var(--text-secondary);
  font-size: 13px;
  letter-spacing: 3px;
}

.card-tarot::before {
  background: linear-gradient(90deg, #9C27B0, #6C5CE7, #E040FB);
}

.card-dark::before {
  background: linear-gradient(90deg, #1a1a2e, #16213e, #0f3460);
}
.card-dark {
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.card-dark:hover {
  border-color: rgba(244, 67, 54, 0.5);
  box-shadow: 0 8px 32px rgba(244, 67, 54, 0.15);
}

/* Dark Triad Result Styles */
.dark-dim-bar {
  margin-bottom: 16px;
}
.dark-dim-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.dark-dim-name {
  font-size: 14px;
  font-weight: 600;
}
.dark-dim-score {
  font-size: 13px;
  color: var(--text-secondary);
}
.dark-dim-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}
.dark-dim-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 1s ease;
}
.dark-dim-level {
  font-size: 12px;
  margin-top: 4px;
  text-align: right;
}

/* TAROT PAGE */
.tarot-body {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px;
  width: 100%;
}

.tarot-spread-select {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 20px;
}

.spread-option {
  background: var(--bg-card);
  border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s;
  text-align: center;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.spread-option:active {
  transform: scale(0.97);
}

.spread-option:hover {
  border-color: #9C27B0;
  background: rgba(156, 39, 176, 0.1);
}

.spread-option .spread-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.spread-option h4 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.spread-option p {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Tarot Card Display */
.tarot-deck {
  text-align: center;
  padding: 30px 0;
}

.tarot-deck-title {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.tarot-cards-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.tarot-card-slot {
  width: 100px;
  height: 150px;
  perspective: 600px;
  cursor: pointer;
}

.tarot-card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 12px;
}

.tarot-card-slot.flipped .tarot-card-inner {
  transform: rotateY(180deg);
}

.tarot-card-front,
.tarot-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.tarot-card-back {
  background: linear-gradient(135deg, #1a0533, #2d1b69);
  border: 2px solid rgba(156, 39, 176, 0.4);
  box-shadow: 0 4px 20px rgba(156, 39, 176, 0.2);
}

.tarot-card-back::after {
  content: '✦';
  font-size: 28px;
  color: rgba(156, 39, 176, 0.5);
}

.tarot-card-front {
  transform: rotateY(180deg);
  background: linear-gradient(135deg, #2d1b69, #1a0533);
  border: 2px solid rgba(233, 30, 99, 0.5);
  padding: 8px;
}

.tarot-card-front .card-emoji {
  font-size: 36px;
  margin-bottom: 4px;
}

.tarot-card-front .card-name {
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
}

.tarot-card-front .card-orient {
  font-size: 10px;
  color: var(--accent);
  margin-top: 2px;
}

.tarot-position-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
  text-align: center;
}

.tarot-card-slot.waiting {
  animation: cardGlow 2s ease-in-out infinite;
}

@keyframes cardGlow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.2); }
}

.tarot-card-slot.revealed {
  animation: none;
}

.btn-draw {
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
  display: block;
  padding: 14px 28px;
  border: none;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #9C27B0, #E040FB);
  cursor: pointer;
  transition: all 0.3s;
}

.btn-draw:active {
  transform: scale(0.97);
}

.btn-draw:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Tarot Result */
.tarot-reading {
  margin-top: 24px;
}

.tarot-reading-card {
  background: var(--bg-card);
  border: 1px solid rgba(156, 39, 176, 0.2);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: slideUp 0.5s ease;
}

.tarot-reading-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.tarot-reading-emoji {
  font-size: 36px;
}

.tarot-reading-info h4 {
  font-size: 16px;
  font-weight: 700;
}

.tarot-reading-info .orient-tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 2px;
}

.orient-tag.upright {
  background: rgba(76, 175, 80, 0.2);
  color: #4CAF50;
}

.orient-tag.reversed {
  background: rgba(244, 67, 54, 0.2);
  color: #F44336;
}

.tarot-reading-section {
  margin-top: 12px;
}

.tarot-reading-section h5 {
  font-size: 13px;
  color: var(--primary-light);
  margin-bottom: 4px;
}

.tarot-reading-section p {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.tarot-keywords {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.tarot-keywords span {
  background: rgba(156, 39, 176, 0.15);
  color: #CE93D8;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 20px;
}

/* Responsive */
@media (min-width: 768px) {
  .test-cards {
    padding-bottom: 40px;
  }
  .test-card {
    padding: 28px;
  }
  .question-text {
    font-size: 22px;
  }
}
