:root {
  --bg: #0b0c10;
  --card: #111318;
  --text: #e8e9ec;
  --sub: #7c7f8e;
  --accent: #f59e0b;
  --accent2: #fb923c;
  --border: rgba(245,158,11,0.18);
  --radius: 16px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color: var(--text); font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif; }

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(11,12,16,0.9); backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 100;
}
.topbar-logo { font-size: 15px; font-weight: 700; color: var(--text); text-decoration: none; }
.topbar-logo span { color: var(--accent); }
.lang-toggle {
  font-size: 12px; color: var(--sub); background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 6px;
  padding: 4px 10px; cursor: pointer; transition: color 0.15s;
}
.lang-toggle:hover { color: var(--text); }

/* Hero */
.hero {
  text-align: center; padding: 40px 20px 30px;
  background: radial-gradient(ellipse at 50% 0%, rgba(245,158,11,0.12) 0%, transparent 70%);
}
.hero-emoji { font-size: 52px; margin-bottom: 12px; }
.hero h1 { font-size: 26px; font-weight: 800; line-height: 1.25; margin-bottom: 8px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero-sub { font-size: 14px; color: var(--sub); line-height: 1.6; max-width: 320px; margin: 0 auto 24px; }

/* Mode buttons */
.mode-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.mode-btn {
  padding: 10px 22px; border-radius: 10px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: transform 0.15s, box-shadow 0.15s; border: none;
}
.mode-btn.primary {
  background: linear-gradient(135deg, var(--accent), #d97706);
  color: #fff; box-shadow: 0 4px 14px rgba(245,158,11,0.35);
}
.mode-btn.secondary {
  background: rgba(255,255,255,0.07); color: var(--text);
  border: 1px solid rgba(255,255,255,0.12);
}
.mode-btn:hover { transform: translateY(-1px); }
.mode-btn:active { transform: translateY(0); }

/* Quiz container */
#quiz { display: none; padding: 20px 20px 40px; max-width: 480px; margin: 0 auto; }
.progress-wrap { margin-bottom: 16px; }
.progress-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--sub); margin-bottom: 6px; }
.progress-bar { height: 4px; background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #d97706); border-radius: 2px; transition: width 0.3s; }

/* Card */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 22px;
  min-height: 180px; display: flex; flex-direction: column;
  justify-content: center; align-items: center; text-align: center;
  position: relative; overflow: hidden;
  transition: transform 0.2s, opacity 0.2s;
  cursor: grab;
  user-select: none;
}
.card.swipe-left  { transform: translateX(-120%) rotate(-12deg); opacity: 0; }
.card.swipe-right { transform: translateX(120%)  rotate(12deg);  opacity: 0; }
.card-badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--sub); margin-bottom: 14px;
}
.card-q {
  font-size: 16px; font-weight: 600; line-height: 1.55; color: var(--text);
}

/* Answer buttons */
.btns { display: flex; gap: 14px; margin-top: 20px; }
.btn {
  flex: 1; padding: 12px 10px; border-radius: 10px; font-size: 14px; font-weight: 600;
  border: none; cursor: pointer; transition: transform 0.15s, box-shadow 0.15s;
}
.btn.left {
  background: rgba(251,146,60,0.15); color: #fb923c;
  border: 1px solid rgba(251,146,60,0.3);
}
.btn.right {
  background: rgba(245,158,11,0.15); color: var(--accent);
  border: 1px solid rgba(245,158,11,0.3);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

/* Swipe hint */
.swipe-hint { text-align: center; font-size: 11px; color: var(--sub); margin-top: 10px; opacity: 0.7; }

/* Ending / result */
#ending { display: none; padding: 24px 20px 60px; max-width: 480px; margin: 0 auto; }
.result-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 22px; text-align: center;
  margin-bottom: 20px;
}
.result-emoji { font-size: 48px; margin-bottom: 10px; }
.result-type { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.result-type em { font-style: normal; color: var(--accent); }
.result-wing { font-size: 13px; color: var(--sub); margin-bottom: 4px; }
.result-label { font-size: 13px; color: var(--sub); margin-bottom: 20px; }

/* Top 3 scores */
.top-scores { display: flex; flex-direction: column; gap: 8px; }
.tscore-item { display: flex; align-items: center; gap: 10px; }
.tscore-name { font-size: 12px; color: var(--sub); width: 70px; text-align: left; flex-shrink: 0; }
.tscore-bar { flex: 1; height: 6px; background: rgba(255,255,255,0.08); border-radius: 3px; overflow: hidden; }
.tscore-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent), #d97706); transition: width 0.8s; }
.tscore-val { font-size: 11px; color: var(--sub); width: 30px; text-align: right; flex-shrink: 0; }

/* AI analysis */
.ai { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-top: 20px; }
.ai-header { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.ai-header-icon { font-size: 18px; }
.ai-header-text { font-size: 14px; font-weight: 700; }
#aiText { font-size: 14px; color: #c4c8d8; line-height: 1.75; white-space: pre-wrap; }
.ai-loading { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--sub); }
.dots { display: inline-flex; gap: 3px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s infinite; }
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse { 0%,80%,100%{opacity:0.2} 40%{opacity:1} }

/* Retake */
.retake-btn {
  display: block; width: 100%; padding: 12px; border-radius: 10px;
  background: rgba(255,255,255,0.06); color: var(--sub);
  border: 1px solid rgba(255,255,255,0.1); font-size: 14px;
  cursor: pointer; margin-top: 14px; transition: color 0.15s;
}
.retake-btn:hover { color: var(--text); }

/* Mobile */
@media (max-width: 480px) {
  .hero h1 { font-size: 22px; }
  .card-q { font-size: 15px; }
  .result-type { font-size: 19px; }
}
