/* ============================================================
   Petualangan Jiwa — styles v2
   Theme: malam berbintang dengan sentuhan emas & ungu mistis
   ============================================================ */

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

/* IMPORTANT: ensure [hidden] works on every element regardless of display rule */
[hidden] { display: none !important; }

:root {
  --bg-0: #0a0820;
  --bg-1: #15102f;
  --bg-2: #1d1644;
  --gold: #f3c66a;
  --gold-soft: #ffe1a3;
  --violet: #a07dff;
  --violet-deep: #5a3ca8;
  --rose: #f08bb6;
  --teal: #6fb8a8;
  --ink: #fdfcef;
  --ink-mute: #c5bfde;
  --ink-soft: #8a83ad;
  --line: rgba(255,255,255,0.08);
  --card: rgba(28, 22, 60, 0.6);
  --card-strong: rgba(36, 28, 76, 0.85);
  --shadow-soft: 0 12px 30px rgba(0,0,0,.35);
  --shadow-glow: 0 0 60px rgba(243, 198, 106, 0.18);
  --r-md: 14px;
  --r-lg: 22px;
  --r-xl: 32px;
}

html, body {
  min-height: 100%;
  background: var(--bg-0);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body {
  background:
    radial-gradient(900px 600px at 20% 10%, rgba(160,125,255,0.18), transparent 60%),
    radial-gradient(700px 500px at 80% 90%, rgba(243,198,106,0.10), transparent 60%),
    linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 60%, var(--bg-0) 100%);
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ============== STARS BACKGROUND ============== */
#stars {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 20px 30px, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 60px 80px, rgba(255,255,255,0.5), transparent),
    radial-gradient(1.5px 1.5px at 130px 50px, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 200px 120px, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 270px 30px, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 330px 90px, rgba(255,255,255,0.5), transparent),
    radial-gradient(2px 2px at 20px 200px, rgba(255,225,163,0.7), transparent),
    radial-gradient(1px 1px at 100px 250px, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 180px 290px, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 250px 220px, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 310px 270px, rgba(255,255,255,0.4), transparent);
  background-size: 360px 320px;
  background-repeat: repeat;
  opacity: 0.9;
  animation: drift 60s linear infinite;
}
@keyframes drift {
  from { transform: translateY(0); }
  to   { transform: translateY(-320px); }
}

#aurora {
  position: fixed; inset: -10% -10%; z-index: 0; pointer-events: none;
  background:
    radial-gradient(40% 30% at 30% 30%, rgba(160,125,255,0.16), transparent 70%),
    radial-gradient(40% 30% at 70% 70%, rgba(243,198,106,0.12), transparent 70%);
  filter: blur(40px);
  animation: aurora 18s ease-in-out infinite alternate;
}
@keyframes aurora {
  0%   { transform: translate(0,0)   scale(1);    opacity: 0.7; }
  100% { transform: translate(3%, -3%) scale(1.1); opacity: 1.0; }
}

/* ============== SCREENS ============== */
.screen {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
  animation: screenIn .55s ease both;
}
.screen[data-active] { display: flex; }
@keyframes screenIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============== HOME / GATE ============== */
.home-wrap {
  width: min(640px, 100%);
  text-align: center;
  padding: 44px 22px;
  position: relative;
}
.lantern {
  width: 100px; height: 100px;
  margin: 0 auto 22px;
  position: relative;
  display: grid; place-items: center;
}
.lantern-glow {
  position: absolute; inset: -30px;
  background: radial-gradient(circle, rgba(243,198,106,0.55), transparent 60%);
  filter: blur(8px);
  animation: lanternPulse 2.6s ease-in-out infinite;
}
.lantern-emoji {
  font-size: 80px;
  position: relative;
  filter: drop-shadow(0 0 18px rgba(243,198,106,0.6));
  animation: lanternBob 4s ease-in-out infinite;
}
@keyframes lanternPulse {
  0%, 100% { opacity: .6; transform: scale(1); }
  50%      { opacity: 1;  transform: scale(1.1); }
}
@keyframes lanternBob {
  0%,100% { transform: translateY(0) rotate(-2deg); }
  50%     { transform: translateY(-6px) rotate(2deg); }
}
.title {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: clamp(40px, 8vw, 64px);
  letter-spacing: 1px;
  line-height: 1.05;
  margin-bottom: 14px;
  text-shadow: 0 4px 24px rgba(0,0,0,.45);
}
.gold {
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 18px rgba(243,198,106,.4));
}
.tagline {
  color: var(--ink-mute);
  font-size: 16px;
  margin-bottom: 30px;
  line-height: 1.6;
}
.cta-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  margin-bottom: 24px;
}
.badges {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
}
.badge {
  font-size: 12.5px;
  padding: 7px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-mute);
  backdrop-filter: blur(8px);
}

/* User pill (top-right of home) */
.user-pill {
  position: absolute;
  top: 16px; right: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--card-strong);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 8px 7px 14px;
  font-size: 13px;
  color: var(--ink);
  backdrop-filter: blur(10px);
  z-index: 5;
}
.user-icon { font-size: 14px; }
.user-name { font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  border: 0;
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}
.user-menu-btn:hover { background: rgba(255,255,255,0.12); }
.user-menu {
  position: absolute;
  top: 50px; right: 0;
  min-width: 180px;
  background: var(--card-strong);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px;
  box-shadow: var(--shadow-soft);
  display: flex; flex-direction: column;
  z-index: 10;
}
.user-menu button {
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--ink);
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13.5px;
  font-family: inherit;
}
.user-menu button:hover { background: rgba(255,255,255,0.06); }

/* ============== FORMS (REGISTER/LOGIN) ============== */
.form-wrap {
  width: min(440px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 36px 28px;
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-soft);
  position: relative;
}
.back-link {
  background: transparent;
  border: 0;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
  margin-bottom: 8px;
}
.back-link:hover { color: var(--ink); }
.form-title {
  font-family: 'Cinzel', serif;
  color: var(--gold-soft);
  font-size: 26px;
  margin-bottom: 6px;
}
.form-sub {
  color: var(--ink-mute);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 24px;
}
.field { margin-bottom: 16px; position: relative; }
.field label {
  display: block;
  font-size: 12.5px;
  letter-spacing: 0.3px;
  color: var(--ink-mute);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1.5px solid rgba(255,255,255,0.10);
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
  transition: border-color .2s, background .2s;
}
.field input:focus {
  outline: 0;
  border-color: var(--gold);
  background: rgba(243,198,106,0.06);
}
.field input.invalid { border-color: #d96a6a; background: rgba(217,106,106,0.06); }
.field .hint { font-size: 11.5px; color: var(--ink-soft); display: block; margin-top: 4px; }
.field .error {
  font-size: 12px;
  color: #ff8a8a;
  display: block;
  margin-top: 6px;
  min-height: 16px;
}
.form-submit { width: 100%; margin-top: 8px; }
.form-foot {
  text-align: center;
  font-size: 13.5px;
  color: var(--ink-mute);
  margin-top: 16px;
}
.form-foot a { color: var(--gold-soft); text-decoration: none; font-weight: 600; }
.form-foot a:hover { text-decoration: underline; }

/* ============== BUTTONS ============== */
.btn-primary {
  position: relative;
  isolation: isolate;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  color: #1a1233;
  background: linear-gradient(180deg, var(--gold-soft) 0%, var(--gold) 100%);
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 999px;
  padding: 14px 26px;
  cursor: pointer;
  letter-spacing: 0.3px;
  box-shadow:
    0 6px 24px rgba(243,198,106,0.35),
    inset 0 1px 0 rgba(255,255,255,0.55);
  transition: transform .18s ease, box-shadow .25s ease;
  overflow: hidden;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(243,198,106,0.45), inset 0 1px 0 rgba(255,255,255,0.55); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-primary .btn-glow {
  position: absolute; inset: -2px; z-index: -1;
  background: conic-gradient(from 0deg, transparent, rgba(255,255,255,.5), transparent 60%);
  animation: rotate 4s linear infinite;
  opacity: 0.5;
}
@keyframes rotate { to { transform: rotate(360deg); } }
.btn-primary .btn-label { position: relative; z-index: 1; }

.btn-ghost {
  font-family: inherit; font-size: 14.5px; font-weight: 500;
  color: var(--ink-mute);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 11px 18px;
  cursor: pointer;
  transition: background .2s, color .2s, border .2s;
}
.btn-ghost:hover { background: var(--card); color: var(--ink); border-color: rgba(255,255,255,0.18); }

.btn-mini {
  font-family: inherit; font-size: 13px; font-weight: 500;
  color: var(--ink-soft);
  background: transparent;
  border: 1px dashed rgba(255,255,255,0.12);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  transition: color .2s, border .2s;
}
.btn-mini:hover { color: var(--ink); border-color: rgba(255,255,255,0.25); }
.btn-mini:disabled { opacity: 0.35; cursor: not-allowed; }

/* ============== INTRO STORY ============== */
.story-wrap {
  width: min(560px, 100%);
  text-align: center;
}
.story-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 40px 28px;
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-soft);
  margin-bottom: 22px;
  animation: cardIn .55s ease both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1);   }
}
.story-art {
  font-size: 64px;
  margin-bottom: 18px;
  filter: drop-shadow(0 6px 18px rgba(160,125,255,.4));
  animation: floaty 5s ease-in-out infinite;
}
@keyframes floaty {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-8px); }
}
.story-text {
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink);
}
.story-text em { color: var(--gold-soft); font-style: italic; }
.story-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* ============== QUEST HUD ============== */
#quest { flex-direction: column; padding: 18px 14px 30px; align-items: stretch; }
.hud {
  width: min(720px, 100%);
  margin: 0 auto 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px 16px;
  backdrop-filter: blur(14px);
}
.hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.level-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(180deg, rgba(243,198,106,0.18), rgba(243,198,106,0.06));
  border: 1px solid rgba(243,198,106,0.35);
  padding: 5px 12px 5px 8px;
  border-radius: 999px;
  font-size: 13.5px;
}
.level-badge { font-size: 18px; }
.level-title {
  font-family: 'Cinzel', serif;
  letter-spacing: 0.6px;
  color: var(--gold-soft);
  font-weight: 600;
}
.quest-counter {
  font-family: 'Cinzel', serif;
  font-size: 16px;
  letter-spacing: 1px;
  color: var(--ink);
}
.quest-counter .muted { color: var(--ink-soft); }

.xp-bar {
  position: relative;
  height: 8px;
  background: rgba(255,255,255,0.05);
  border-radius: 999px;
  overflow: hidden;
}
.xp-fill {
  position: absolute; inset: 0 100% 0 0;
  background: linear-gradient(90deg, var(--gold), #ffd07a 50%, var(--gold-soft));
  border-radius: 999px;
  box-shadow: 0 0 18px rgba(243,198,106,0.6);
  transition: right 0.55s cubic-bezier(.5,.2,.2,1);
}
.xp-shine {
  position: absolute; top: 0; bottom: 0; left: 0; width: 30%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  animation: shine 2.4s linear infinite;
  pointer-events: none;
}
@keyframes shine {
  from { transform: translateX(-100%); }
  to   { transform: translateX(400%); }
}

/* ============== QUEST STAGE ============== */
.quest-stage { width: min(720px, 100%); margin: 0 auto; flex: 1; }

.question-card {
  background: var(--card-strong);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 28px 22px;
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-soft);
  animation: cardIn .45s ease both;
}
.question-card.swap-out {
  animation: swapOut .35s ease both;
}
.question-card.swap-in {
  animation: swapIn .45s ease both;
}
@keyframes swapOut {
  to { opacity: 0; transform: translateY(-12px); }
}
@keyframes swapIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.prompt {
  font-size: clamp(18px, 3.2vw, 22px);
  line-height: 1.55;
  text-align: center;
  margin-bottom: 24px;
  color: var(--ink);
  font-weight: 500;
  font-family: 'Cinzel', serif;
  letter-spacing: 0.3px;
}
.choices {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: stretch;
}
@media (max-width: 600px) {
  .choices { grid-template-columns: 1fr; }
  .vs { transform: rotate(90deg); }
}
.choice {
  position: relative;
  text-align: left;
  padding: 18px 18px 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  border: 1.5px solid rgba(255,255,255,0.10);
  border-radius: 18px;
  color: var(--ink);
  font-family: inherit;
  font-size: 15.5px;
  line-height: 1.5;
  cursor: pointer;
  transition: transform .2s ease, border-color .25s, background .25s, box-shadow .25s;
  overflow: hidden;
}
.choice:hover {
  border-color: rgba(243,198,106,0.55);
  background: linear-gradient(180deg, rgba(243,198,106,0.10), rgba(243,198,106,0.02));
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(0,0,0,0.3), 0 0 32px rgba(243,198,106,0.15);
}
.choice:active { transform: translateY(0); }
.choice.picked {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(243,198,106,0.22), rgba(243,198,106,0.08));
  animation: pop .35s ease;
}
@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.04); }
  100% { transform: scale(1); }
}
.choice-tag {
  font-family: 'Cinzel', serif;
  font-size: 11.5px;
  letter-spacing: 1.2px;
  color: var(--gold);
  margin-bottom: 6px;
}
.choice-text { font-weight: 500; }
.choice-arrow {
  position: absolute; right: 14px; bottom: 12px;
  color: var(--gold);
  opacity: 0; transform: translate(-4px, 4px);
  transition: opacity .2s, transform .2s;
  font-size: 18px;
}
.choice:hover .choice-arrow { opacity: 1; transform: translate(0,0); }

.vs {
  align-self: center;
  font-family: 'Cinzel', serif;
  font-size: 22px;
  color: var(--gold);
  opacity: .65;
  text-align: center;
}

.quest-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 16px;
}
.hint { font-size: 12.5px; color: var(--ink-soft); }

/* ============== CHAPTER BANNER ============== */
.chapter-banner {
  width: 100%;
  display: grid;
  place-items: center;
  animation: cardIn .55s ease both;
}
.chapter-frame {
  background: var(--card-strong);
  border: 1px solid rgba(243,198,106,0.45);
  border-radius: var(--r-xl);
  padding: 36px 26px;
  text-align: center;
  max-width: 520px;
  box-shadow: 0 0 60px rgba(243,198,106,0.18);
  position: relative;
}
.chapter-frame::before, .chapter-frame::after {
  content: ""; position: absolute; left: 50%; transform: translateX(-50%);
  width: 60%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(243,198,106,0.6), transparent);
}
.chapter-frame::before { top: 14px; }
.chapter-frame::after  { bottom: 14px; }
.chapter-num {
  font-family: 'Cinzel', serif;
  letter-spacing: 4px;
  font-size: 12px;
  color: var(--gold);
  margin-bottom: 8px;
}
.chapter-title {
  font-family: 'Cinzel', serif;
  font-size: 28px;
  margin-bottom: 12px;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.chapter-sub {
  color: var(--ink-mute);
  font-size: 15px;
  line-height: 1.65;
  margin-bottom: 22px;
}

/* ============== REVEAL ============== */
#reveal { background: radial-gradient(ellipse at center, rgba(160,125,255,0.18), transparent 60%); }
.reveal-wrap {
  text-align: center;
  width: min(560px, 100%);
}
.reveal-line {
  font-family: 'Cinzel', serif;
  font-size: 18px;
  color: var(--ink-mute);
  margin-bottom: 30px;
  animation: fadeIn 1s ease both;
}
.reveal-orb {
  width: 180px; height: 180px;
  margin: 0 auto 28px;
  border-radius: 50%;
  position: relative;
  background: radial-gradient(circle at 30% 30%, var(--gold-soft), var(--gold) 50%, var(--violet-deep) 100%);
  box-shadow: 0 0 80px rgba(243,198,106,.55), 0 0 200px rgba(160,125,255,.3);
  animation: orb 1.4s ease-in-out infinite alternate;
  display: grid; place-items: center;
}
.reveal-orb-inner {
  font-size: 64px;
  filter: drop-shadow(0 0 18px rgba(255,255,255,.6));
  animation: spinSlow 8s linear infinite;
}
@keyframes orb {
  from { transform: scale(0.95); }
  to   { transform: scale(1.05); }
}
@keyframes spinSlow {
  to { transform: rotate(360deg); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.reveal-sub {
  font-size: 14px;
  color: var(--ink-soft);
  letter-spacing: 0.5px;
  animation: fadeIn 1.2s ease both;
}

/* ============== RESULT ============== */
#result { padding: 30px 14px 60px; align-items: flex-start; }
.result-wrap {
  width: min(720px, 100%);
  margin: 0 auto;
}
.result-card {
  position: relative;
  text-align: center;
  padding: 50px 24px 36px;
  border-radius: var(--r-xl);
  background: var(--card-strong);
  border: 1px solid rgba(255,255,255,0.10);
  overflow: hidden;
  margin-bottom: 22px;
  box-shadow: var(--shadow-soft);
  animation: bigPop .8s cubic-bezier(.2,.9,.2,1.1) both;
}
@keyframes bigPop {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}
.result-aura {
  position: absolute; inset: -30%;
  background: radial-gradient(circle, var(--aura-color, var(--gold)) 0%, transparent 60%);
  opacity: 0.22;
  filter: blur(40px);
  animation: orb 4s ease-in-out infinite alternate;
  z-index: 0;
}
.result-icon {
  font-size: 84px;
  margin-bottom: 14px;
  position: relative; z-index: 1;
  filter: drop-shadow(0 0 24px rgba(255,255,255,.4));
  animation: floaty 4s ease-in-out infinite;
}
.result-mbti {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: clamp(46px, 10vw, 76px);
  letter-spacing: 8px;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 4px;
  position: relative; z-index: 1;
}
.result-epithet {
  font-family: 'Cinzel', serif;
  font-size: clamp(20px, 4vw, 26px);
  letter-spacing: 1.2px;
  color: var(--ink);
  margin-bottom: 6px;
  position: relative; z-index: 1;
}
.result-tagline {
  color: var(--ink-mute);
  font-size: 14.5px;
  position: relative; z-index: 1;
  font-style: italic;
}
.result-nameid {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--ink-soft);
  letter-spacing: 0.5px;
  position: relative; z-index: 1;
}

.result-body {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 28px 22px;
  backdrop-filter: blur(14px);
}
.result-short {
  color: var(--ink);
  font-size: 16px;
  line-height: 1.7;
  margin-bottom: 26px;
  text-align: center;
}

/* trait bars */
.trait-bars { display: flex; flex-direction: column; gap: 16px; margin-bottom: 30px; }
.trait { font-size: 13px; }
.trait-row {
  display: flex; justify-content: space-between;
  color: var(--ink-mute);
  margin-bottom: 4px;
}
.trait-row.right { color: var(--ink-soft); margin-top: 4px; margin-bottom: 0; }
.trait-pct { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
.trait-bar {
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.trait-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, var(--violet), var(--gold));
  transition: width 1.2s cubic-bezier(.5,.2,.2,1);
  box-shadow: 0 0 18px rgba(160,125,255,0.5);
}

.section-h {
  font-family: 'Cinzel', serif;
  font-size: 18px;
  letter-spacing: 1px;
  color: var(--gold-soft);
  margin: 28px 0 14px;
  text-align: center;
}

.result-desc {
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.75;
  white-space: pre-line;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 18px;
  margin-bottom: 8px;
}

.result-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
  margin-top: 14px;
}
@media (max-width: 540px) { .result-cols { grid-template-columns: 1fr; } }
.result-col {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
}
.col-h {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  letter-spacing: 1px;
  color: var(--gold-soft);
  margin-bottom: 12px;
}
.result-col ul { list-style: none; padding: 0; }
.result-col li {
  font-size: 14.5px;
  color: var(--ink);
  padding: 6px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.06);
}
.result-col li:last-child { border-bottom: none; }

.careers {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 28px;
}
.career-chip {
  font-size: 13px;
  background: linear-gradient(180deg, rgba(243,198,106,0.15), rgba(243,198,106,0.05));
  border: 1px solid rgba(243,198,106,0.3);
  color: var(--gold-soft);
  padding: 6px 12px;
  border-radius: 999px;
}

.result-actions {
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
  margin-bottom: 16px;
  margin-top: 10px;
}

.footnote {
  text-align: center;
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 6px;
}

/* ============== MODAL ============== */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  padding: 18px;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(8, 6, 24, 0.7);
  backdrop-filter: blur(8px);
  animation: fadeIn .25s ease both;
}
.modal-card {
  position: relative;
  width: min(480px, 100%);
  background: var(--card-strong);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 30px 24px 26px;
  z-index: 1;
  animation: cardIn .35s ease both;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-card.modal-wide { width: min(620px, 100%); }
.modal-x {
  position: absolute; top: 12px; right: 14px;
  font-size: 26px; line-height: 1;
  background: transparent; border: 0; color: var(--ink-soft);
  cursor: pointer;
  z-index: 2;
}
.modal-card h2 {
  font-family: 'Cinzel', serif;
  margin-bottom: 14px;
  font-size: 22px;
  color: var(--gold-soft);
}
.modal-card p { color: var(--ink-mute); line-height: 1.6; margin-bottom: 12px; font-size: 14.5px; }
.modal-card p.small { font-size: 12.5px; }
.modal-card p.muted { color: var(--ink-soft); }
.modal-card ul { padding-left: 18px; margin-bottom: 12px; }
.modal-card li { color: var(--ink); margin-bottom: 6px; font-size: 14.5px; }
.modal-card .btn-primary { width: 100%; margin-top: 8px; }

/* ============== HISTORY MODAL ============== */
.history-list {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 12px;
}
.history-item {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
}
.history-icon {
  font-size: 24px;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(243,198,106,0.15);
}
.history-meta { font-size: 13px; }
.history-mbti {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--gold-soft);
  font-size: 16px;
}
.history-epithet { color: var(--ink); font-size: 13px; margin-top: 2px; }
.history-date { color: var(--ink-soft); font-size: 11.5px; margin-top: 2px; }
.history-actions { display: flex; gap: 6px; }

/* ============== SHARE MODAL ============== */
.share-preview-wrap {
  display: grid;
  place-items: center;
  margin: 12px 0 16px;
}
.share-preview-wrap canvas {
  width: 100%;
  max-width: 320px;
  height: auto;
  border-radius: 18px;
  box-shadow: 0 14px 36px rgba(0,0,0,0.45);
  background: #14102d;
}
.share-link-row {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px 4px 4px 10px;
}
.share-link-row input {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  min-width: 0;
}
.share-link-row input:focus { outline: 0; }
.share-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.share-actions .btn-primary { flex: 1 1 auto; }

/* ============== TOAST ============== */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  background: var(--card-strong);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 200;
  box-shadow: var(--shadow-soft);
  animation: toastIn .3s ease both;
  max-width: 90vw;
  text-align: center;
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ============== LOADING OVERLAY ============== */
.loading-overlay {
  position: fixed; inset: 0;
  z-index: 300;
  display: grid; place-items: center;
  background: rgba(8, 6, 24, 0.75);
  backdrop-filter: blur(4px);
}
.loading-spinner {
  width: 56px; height: 56px;
  border: 4px solid rgba(243,198,106,0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============== PARTICLES (level up) ============== */
.particle {
  position: fixed;
  pointer-events: none;
  width: 8px; height: 8px;
  border-radius: 50%;
  z-index: 50;
  background: radial-gradient(circle, var(--gold-soft), var(--gold) 60%, transparent 70%);
  animation: particle 1.1s ease-out forwards;
}
@keyframes particle {
  from { transform: translate(0,0) scale(1); opacity: 1; }
  to   { transform: translate(var(--dx), var(--dy)) scale(0.2); opacity: 0; }
}

/* ============== CONFETTI (final reveal) ============== */
.confetti {
  position: fixed;
  pointer-events: none;
  top: -10px;
  width: 8px; height: 12px;
  z-index: 60;
  animation: confetti 3s linear forwards;
}
@keyframes confetti {
  0% { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0.6; }
}

/* ============== MEDIA SMALL ============== */
@media (max-width: 480px) {
  .home-wrap { padding: 24px 14px; }
  .story-card { padding: 30px 18px; }
  .question-card { padding: 22px 16px; }
  .result-card { padding: 36px 18px 26px; }
  .result-body { padding: 22px 16px; }
  .badges .badge { font-size: 11.5px; padding: 6px 10px; }
  .form-wrap { padding: 26px 18px; }
  .user-pill { top: 12px; right: 12px; padding: 6px 6px 6px 12px; }
  .user-name { max-width: 90px; }
}
