:root {
  --bg-deep: radial-gradient(ellipse 1400px 900px at 65% -5%, #1d2333, #0d1018 65%, #08090f 100%);
  --text: #ebe9e6;
  --muted: #a8aebb;
  --card: rgba(16, 20, 30, 0.65);
  --card-strong: rgba(16, 20, 30, 0.88);
  --border: rgba(255, 255, 255, 0.14);
  --shadow: 0 12px 45px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255,255,255,0.05);
  --accent-vv: #a89dff;
  --accent-fire: #ff7558;
  --accent-water: #58d5ff;
  --accent: var(--accent-vv);
}

body.neiv { --accent: var(--accent-fire); }
body.vien { --accent: var(--accent-water); }
body.vv { --accent: var(--accent-vv); }

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg-deep);
  color: var(--text);
  font-family: "Crimson Pro", ui-serif, Georgia, "Times New Roman", serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  overflow-x: hidden;
}

.stars {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  background-image: 
    radial-gradient(2px 2px at 20px 30px, rgba(255,255,255,0.3), transparent),
    radial-gradient(2px 2px at 60px 70px, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 50px 50px, rgba(255,255,255,0.2), transparent),
    radial-gradient(1px 1px at 130px 80px, rgba(255,255,255,0.3), transparent),
    radial-gradient(2px 2px at 90px 10px, rgba(255,255,255,0.35), transparent);
  background-repeat: repeat;
  background-size: 200px 200px;
  animation: twinkle 120s linear infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.site-header {
  display: grid;
  place-items: center;
  padding: 20px 16px 12px;
  position: relative;
  z-index: 1;
}

.brand { 
  text-align: center; 
  position: relative; 
}

.logo-img {
  max-width: 200px;
  height: auto;
  display: block;
  margin: 0 auto 16px;
  filter: drop-shadow(0 0 30px rgba(168,157,255,0.4)) drop-shadow(0 0 60px rgba(88,213,255,0.2));
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.5s ease;
  cursor: pointer;
  position: relative;
  z-index: 2;
}

.logo-img::before {
  content: '';
  position: absolute;
  inset: -20px;
  background: radial-gradient(circle, rgba(168,157,255,0.2) 0%, transparent 70%);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.5s ease;
  z-index: -1;
}

.logo-img:hover {
  transform: scale(1.1) rotate(5deg);
  filter: drop-shadow(0 0 40px rgba(168,157,255,0.6)) drop-shadow(0 0 80px rgba(88,213,255,0.4));
}

.logo-img:hover::before {
  opacity: 1;
  animation: logo-glow 2s ease-in-out infinite;
}

@keyframes logo-glow {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 1; }
}

.tagline { 
  color: var(--muted); 
  margin: 0; 
  font-size: 16px; 
  font-weight: 300;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  opacity: 0.8;
  position: relative;
}

.tagline::before,
.tagline::after {
  content: '✦';
  display: inline-block;
  margin: 0 12px;
  opacity: 0.5;
  animation: twinkle-symbol 3s ease-in-out infinite;
}

@keyframes twinkle-symbol {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.2); }
}

.game {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 20px 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
  position: relative;
  z-index: 1;
}

.wheel-area { 
  display: grid; 
  justify-items: center; 
  gap: 16px; 
  width: 100%; 
  max-width: 520px;
  position: relative;
}

.wheel-container {
  position: relative;
  width: min(85vw, 480px);
  aspect-ratio: 1 / 1;
  background: linear-gradient(145deg, rgba(255,255,255,0.07) 0%, rgba(255,255,255,0.02) 50%, rgba(0,0,0,0.1) 100%)
              , var(--card);
  border: 1.5px solid var(--border);
  border-radius: 9999px;
  box-shadow: var(--shadow), 0 0 60px color-mix(in oklab, var(--accent) 15%, transparent);
  overflow: hidden;
  transition: box-shadow 0.5s ease, transform 0.3s ease;
}

.wheel-container:hover {
  box-shadow: var(--shadow), 0 0 90px color-mix(in oklab, var(--accent) 28%, transparent);
  transform: scale(1.02);
}

.wheel-container.spinning {
  animation: container-shake 0.5s ease-in-out;
}

@keyframes container-shake {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.01) rotate(1deg); }
  75% { transform: scale(1.01) rotate(-1deg); }
}

.wheel {
  position: absolute;
  inset: 8px;
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  object-fit: contain;
  transform: rotate(0deg);
  will-change: transform;
  border-radius: 50%;
  overflow: hidden;
}

.glow {
  position: absolute;
  inset: -18%;
  background: radial-gradient(55% 55% at 52% 48%, color-mix(in oklab, var(--accent) 70%, transparent), transparent 65%);
  filter: blur(28px);
  opacity: 0.4;
  pointer-events: none;
  animation: pulse-glow 4s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.35; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.05); }
}

.runes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1s ease;
}

.runes.active {
  opacity: 1;
  animation: rune-appear 2s ease;
}

@keyframes rune-appear {
  0% { opacity: 0; transform: rotate(0deg); }
  50% { opacity: 0.8; }
  100% { opacity: 0; transform: rotate(360deg); }
}

.pointer {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-bottom: 18px solid var(--accent);
  filter: drop-shadow(0 6px 6px rgba(0,0,0,0.45));
  z-index: 3;
}

.gentle-spin { animation: gentle 60s linear infinite; }

@keyframes gentle { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.controls { display: flex; gap: 10px; }

.btn {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  color: var(--text);
  background: color-mix(in oklab, var(--card-strong) 80%, black 20%);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  pointer-events: auto;
  touch-action: manipulation;
  user-select: none;
}

.btn.primary { 
  border-color: color-mix(in oklab, var(--accent) 45%, white 5%);
  background: linear-gradient(180deg, color-mix(in oklab, var(--accent) 26%, transparent), color-mix(in oklab, var(--accent) 8%, transparent)), var(--card-strong);
  box-shadow: 0 4px 12px color-mix(in oklab, var(--accent) 15%, transparent);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.btn.primary:hover { 
  transform: translateY(-2px); 
  box-shadow: 0 10px 28px color-mix(in oklab, var(--accent) 32%, transparent); 
  border-color: color-mix(in oklab, var(--accent) 55%, white 10%);
}
.btn:active { 
  transform: translateY(0); 
  background: color-mix(in oklab, var(--accent) 20%, var(--card-strong));
}
.btn.ghost { background: transparent; }
.btn.ghost:active {
  background: rgba(255,255,255,0.05);
}

.btn.reset {
  background: linear-gradient(180deg, rgba(255,117,88,0.15), rgba(255,117,88,0.05));
  border-color: color-mix(in oklab, var(--accent-fire) 30%, var(--border));
  font-size: 13px;
  padding: 10px 14px;
}

.btn.reset:hover {
  background: linear-gradient(180deg, rgba(255,117,88,0.25), rgba(255,117,88,0.1));
  border-color: color-mix(in oklab, var(--accent-fire) 50%, var(--border));
}

.btn.reset:active {
  background: linear-gradient(180deg, rgba(255,117,88,0.35), rgba(255,117,88,0.15));
}

.result {
  min-height: 50px;
  max-width: min(85vw, 500px);
  text-align: center;
  padding: 14px 18px;
  border-radius: 16px;
  border: 1.5px solid var(--border);
  background: linear-gradient(135deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 16px;
  line-height: 1.5;
}

.spin-counter {
  position: absolute;
  bottom: -32px;
  right: 0;
  font-size: 13px;
  color: var(--muted);
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

.game-stats {
  margin-top: 20px;
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.05);
}

.stat-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 14px;
  color: var(--accent);
  font-weight: 500;
  font-family: "Cinzel", ui-serif, Georgia, serif;
}

.paths-area { 
  width: 100%; 
  max-width: 820px;
  margin: 0 auto;
}

.section-title {
  font-family: "Cinzel", ui-serif, Georgia, serif;
  font-size: 20px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 10px 0 18px;
  color: color-mix(in oklab, var(--text) 94%, white 6%);
  text-align: center;
}

.paths {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.path-card {
  display: grid;
  grid-template-columns: 64px 1fr;
  align-items: center;
  gap: 14px;
  width: 100%;
  border: 1.5px solid var(--border);
  background: linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02) 60%, rgba(0,0,0,0.02));
  border-radius: 18px;
  padding: 12px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  pointer-events: auto;
  touch-action: manipulation;
  user-select: none;
}
.path-card:hover { 
  transform: translateY(-2px); 
  border-color: color-mix(in oklab, var(--accent) 35%, var(--border)); 
  box-shadow: 0 6px 18px rgba(0,0,0,0.3);
}
.path-card:active {
  transform: translateY(0);
  background: color-mix(in oklab, var(--accent) 8%, var(--card));
}
.path-card.selected { 
  border-color: color-mix(in oklab, var(--accent) 60%, var(--border)); 
  box-shadow: 0 8px 24px color-mix(in oklab, var(--accent) 25%, transparent); 
  background: linear-gradient(135deg, color-mix(in oklab, var(--accent) 10%, transparent), rgba(255,255,255,0.03) 60%, rgba(0,0,0,0.02));
}
.path-card[aria-pressed="true"] { outline: none; }

.path-card img {
  width: 64px; 
  height: 64px; 
  object-fit: cover; 
  border-radius: 14px; 
  border: 1.5px solid var(--border);
  background: radial-gradient(circle at 40% 30%, rgba(255,255,255,0.08), transparent 70%);
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  pointer-events: auto;
}

.path-card img.avatar-clickable {
  cursor: zoom-in;
}

.path-card img.avatar-clickable:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.path-card.selected img {
  border-color: color-mix(in oklab, var(--accent) 50%, var(--border));
}

.card-content h3 {
  margin: 0 0 5px;
  font-family: "Cinzel", ui-serif, Georgia, serif;
  font-size: 17px;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.card-content p { 
  margin: 0; 
  color: var(--muted); 
  font-size: 13.5px; 
  line-height: 1.4;
}

.progress { margin-top: 14px; }
.steps { display: flex; gap: 10px; }
.step {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px dashed var(--border);
  color: var(--muted);
  font-size: 12px;
}
.step.active { border-style: solid; border-color: color-mix(in oklab, var(--accent) 50%, var(--border)); color: color-mix(in oklab, var(--text) 90%, white 10%); }

.lore-section {
  width: 100%;
  max-width: 820px;
  padding: 32px 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  margin: 0 auto;
  position: relative;
}

.lore-title {
  font-family: "Cinzel", ui-serif, Georgia, serif;
  font-size: 26px;
  letter-spacing: 0.08em;
  text-align: center;
  margin: 0 0 28px;
  color: var(--accent);
  text-transform: uppercase;
}

.archetype-card {
  margin: 0 0 32px;
  padding: 28px 32px;
  border: none;
  border-radius: 0;
  background: transparent;
  position: relative;
  transition: transform 0.4s ease, opacity 0.4s ease;
  box-shadow: none;
}

.archetype-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, transparent 50%, rgba(0,0,0,0.02) 100%);
  border-radius: 0;
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: -1;
}

.archetype-card:hover {
  transform: translateY(-4px);
}

.archetype-card:hover::before {
  opacity: 1;
}

.archetype-card.fire::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--accent-fire), transparent);
  opacity: 0.6;
}

.archetype-card.water::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--accent-water), transparent);
  opacity: 0.6;
}

.archetype-card.wholeness::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--accent-vv), transparent);
  opacity: 0.6;
}

.archetype-symbol {
  font-size: 48px;
  line-height: 1;
  margin-bottom: 14px;
  text-align: center;
  opacity: 0.75;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.3));
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.archetype-card:hover .archetype-symbol {
  transform: scale(1.08);
  opacity: 0.9;
}

.archetype-card h3 {
  font-family: "Cinzel", ui-serif, Georgia, serif;
  letter-spacing: 0.06em;
  margin: 0 0 12px;
  text-align: center;
  font-size: 22px;
  font-weight: 600;
}

.archetype-card p {
  margin: 0 0 9px;
  color: var(--muted);
  line-height: 1.65;
  text-align: center;
  font-size: 15px;
}

.archetype-card p.essence {
  font-style: italic;
  color: color-mix(in oklab, var(--accent) 85%, white 15%);
  margin-top: 12px;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.game-paths {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px dashed var(--border);
}

.game-paths h3 {
  font-family: "Cinzel", ui-serif, Georgia, serif;
  letter-spacing: 0.06em;
  text-align: center;
  margin: 0 0 18px;
  font-size: 18px;
}

.path-descriptions {
  display: grid;
  gap: 14px;
}

.path-desc {
  padding: 18px 20px;
  border: none;
  border-radius: 0;
  background: transparent;
  position: relative;
}

.path-desc::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(180deg, var(--accent), transparent);
  opacity: 0.4;
}

.path-desc h4 {
  margin: 0 0 6px;
  font-family: "Cinzel", ui-serif, Georgia, serif;
  font-size: 16px;
  letter-spacing: 0.04em;
}

.path-desc p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.path-desc.master::before {
  background: linear-gradient(180deg, var(--accent-vv), var(--accent-water), transparent);
  width: 2px;
  opacity: 0.6;
}

.site-footer {
  margin-top: 36px;
  padding: 18px 16px 36px;
  text-align: center;
  color: var(--muted);
}

.footer-quote {
  font-style: italic;
  font-size: 15px;
  letter-spacing: 0.05em;
  margin: 0 0 12px;
  color: color-mix(in oklab, var(--text) 75%, var(--muted) 25%);
  opacity: 0.85;
}

.site-footer a { color: var(--accent); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  animation: fade-in 0.3s ease;
}

.modal-content {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: scale-in 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.modal-content img {
  max-width: 100%;
  max-height: 80vh;
  width: auto;
  height: auto;
  border-radius: 20px;
  border: 2px solid var(--accent);
  box-shadow: 0 20px 60px rgba(0,0,0,0.7), 0 0 40px color-mix(in oklab, var(--accent) 30%, transparent);
}

.modal-title {
  margin-top: 16px;
  font-family: "Cinzel", ui-serif, Georgia, serif;
  font-size: 24px;
  letter-spacing: 0.08em;
  color: var(--text);
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.modal-close {
  position: absolute;
  top: -50px;
  right: 0;
  width: 44px;
  height: 44px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  color: white;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  transform: scale(1.1) rotate(90deg);
  background: rgba(0,0,0,0.8);
  border-color: var(--accent);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scale-in {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@media (max-width: 768px) {
  .game { padding: 12px 16px 64px; gap: 28px; }
  .paths { grid-template-columns: 1fr; gap: 10px; }
  .wheel-container { width: min(90vw, 420px); }
  .wheel-area { max-width: 100%; }
  .paths-area { max-width: 100%; }
  .lore-section { padding: 24px 0; max-width: 100%; }
  .logo-img { max-width: 160px; }
  .tagline { font-size: 14px; }
  .result { font-size: 15px; padding: 12px 14px; }
  .archetype-card { padding: 24px 20px; }
  .archetype-symbol { font-size: 42px; }
  .modal-content img { max-height: 70vh; }
  .modal-title { font-size: 20px; }
  .modal-close { top: -45px; width: 40px; height: 40px; font-size: 28px; }
  .btn { padding: 10px 16px; font-size: 15px; }
}

@media (max-width: 480px) {
  .wheel-container { width: min(92vw, 360px); }
  .logo-img { max-width: 140px; }
  .tagline { font-size: 13px; }
  .paths { gap: 8px; }
  .path-card { grid-template-columns: 56px 1fr; gap: 10px; padding: 10px; }
  .path-card img { width: 56px; height: 56px; }
  .modal-content img { max-height: 60vh; }
  .modal-title { font-size: 18px; margin-top: 12px; }
  .btn { padding: 9px 14px; font-size: 14px; }
  .archetype-card { padding: 20px 16px; }
}


