/* ═══════════ The Universe — cosmic theme ═══════════ */
:root {
  --bg: #070510;
  --bg2: #0d0a1f;
  --gold: #e8b84b;
  --gold-soft: #f5d98a;
  --violet: #8b6fd8;
  --cyan: #5fd4d0;
  --text: #e9e4f5;
  --dim: #9a90b8;
  --bad: #d86f6f;
  --card: rgba(20, 14, 45, 0.82);
  --line: rgba(232, 184, 75, 0.25);
  --serif: "Palatino", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: radial-gradient(ellipse at 50% -10%, #1a1238 0%, var(--bg) 60%);
  color: var(--text);
  font-family: var(--sans);
  overflow-x: hidden;
}
#stars { position: fixed; inset: 0; z-index: 0; pointer-events: none; }

.screen { display: none; position: relative; z-index: 2; min-height: 100vh; }
.screen.active { display: block; }
.hidden { display: none !important; }

h1, h2, h3, .game-title { font-family: var(--serif); font-weight: 500; }

/* ── Title ── */
.title-inner { max-width: 720px; margin: 0 auto; padding: 11vh 24px 40px; text-align: center; }
.kicker { letter-spacing: 0.35em; font-size: 11px; color: var(--gold); opacity: 0.85; }
.game-title {
  font-size: clamp(56px, 11vw, 110px);
  line-height: 1.05;
  margin: 14px 0 4px;
  background: linear-gradient(160deg, #fff 10%, var(--gold-soft) 45%, var(--violet) 95%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 80px rgba(139, 111, 216, 0.35);
}
.tagline { font-family: var(--serif); font-size: 22px; color: var(--gold-soft); letter-spacing: 0.18em; }
.subtitle { margin: 18px 0 30px; color: var(--dim); font-size: 16px; line-height: 1.6; }
.subtitle em { color: var(--cyan); font-style: normal; }

.enter-box { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.enter-box input {
  width: min(340px, 86vw); padding: 14px 18px; font-size: 17px; text-align: center;
  background: rgba(255,255,255,0.06); border: 1px solid var(--line); border-radius: 12px;
  color: var(--text); outline: none; font-family: var(--serif);
}
.enter-box input:focus { border-color: var(--gold); box-shadow: 0 0 24px rgba(232,184,75,0.2); }
.micro { font-size: 12px; color: var(--dim); }

.btn-gold {
  cursor: pointer; border: none; border-radius: 12px; padding: 14px 34px;
  font-size: 17px; font-weight: 600; color: #1c1305;
  background: linear-gradient(160deg, var(--gold-soft), var(--gold));
  box-shadow: 0 0 30px rgba(232,184,75,0.35), inset 0 1px 0 rgba(255,255,255,0.5);
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 0 46px rgba(232,184,75,0.55); }
.btn-gold.big { width: 100%; padding: 16px; font-size: 19px; margin-top: 14px; }
.btn-ghost {
  cursor: pointer; background: transparent; border: 1px solid var(--line); border-radius: 10px;
  color: var(--dim); padding: 10px 18px; font-size: 14px; transition: all 0.15s;
}
.btn-ghost:hover { color: var(--gold-soft); border-color: var(--gold); }

.world-pulse { margin-top: 34px; min-height: 22px; font-size: 13px; color: var(--cyan); opacity: 0.9; }

.landing-copy {
  max-width: 680px; margin: 30px auto 60px; padding: 36px 28px;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  text-align: left; line-height: 1.7; color: var(--dim);
}
.landing-copy h2 { color: var(--text); font-size: 26px; margin-bottom: 12px; }
.landing-copy h3 { color: var(--gold-soft); font-size: 18px; margin: 22px 0 8px; }
.landing-copy strong { color: var(--text); }
.landing-copy em { color: var(--cyan); font-style: normal; }

/* ── Heavens ── */
.heavens-inner { max-width: 1060px; margin: 0 auto; padding: 6vh 20px 60px; }
.heavens-title { text-align: center; font-size: clamp(36px, 6vw, 54px); color: var(--gold-soft); text-shadow: 0 0 50px rgba(232,184,75,0.4); }
.god-line { text-align: center; font-family: var(--serif); font-style: italic; color: var(--violet); margin: 10px 0 26px; font-size: 17px; min-height: 24px; }

.heavens-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 860px) { .heavens-grid { grid-template-columns: 1fr; } }

.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 22px;
  backdrop-filter: blur(6px);
}
.panel h3 { color: var(--gold-soft); margin-bottom: 14px; font-size: 19px; }
.panel label { display: block; margin: 16px 0 7px; font-size: 13px; letter-spacing: 0.08em; color: var(--dim); text-transform: uppercase; }
.hint { text-transform: none; letter-spacing: 0; opacity: 0.7; }

.soul-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.stat-chip {
  background: rgba(255,255,255,0.05); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; font-size: 13px; color: var(--dim);
}
.stat-chip b { color: var(--text); display: block; font-size: 17px; }

.akashic-list { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.akashic-row {
  font-size: 13px; padding: 9px 12px; border-radius: 9px; background: rgba(255,255,255,0.04);
  color: var(--dim); line-height: 1.45; border-left: 2px solid var(--violet);
}
.akashic-row.learned { border-left-color: var(--gold); }
.akashic-row b { color: var(--text); }
.akashic-empty { font-style: italic; color: var(--dim); font-size: 14px; }

.form-preview {
  text-align: center; padding: 14px; border-radius: 12px; margin-bottom: 4px;
  background: rgba(255,255,255,0.04); border: 1px dashed var(--line); line-height: 1.5; font-size: 14px; color: var(--dim);
}
.form-preview .big-emoji { font-size: 44px; display: block; }
.form-preview b { color: var(--gold-soft); font-size: 17px; }

.pick-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pick {
  cursor: pointer; border: 1px solid var(--line); background: rgba(255,255,255,0.04);
  color: var(--dim); border-radius: 10px; padding: 8px 13px; font-size: 13.5px; transition: all 0.12s;
}
.pick:hover { color: var(--text); border-color: var(--violet); }
.pick.sel { color: #1c1305; background: linear-gradient(160deg, var(--gold-soft), var(--gold)); border-color: var(--gold); font-weight: 600; }
.pick small { display: block; opacity: 0.75; font-size: 11px; }
.pick.sel small { opacity: 0.85; }

.feed-panel { margin-top: 18px; }
#collective-meter { font-size: 13px; color: var(--cyan); font-weight: 400; margin-left: 8px; }
.world-feed { list-style: none; max-height: 150px; overflow-y: auto; }
.world-feed li { font-size: 13px; color: var(--dim); padding: 5px 0; border-bottom: 1px dotted rgba(255,255,255,0.07); }
.world-feed li::before { content: "✦ "; color: var(--violet); }

/* ── Life ── */
#screen-life { height: 100vh; overflow: hidden; }
#world { position: absolute; inset: 0; width: 100%; height: 100%; }
#hud { position: absolute; inset: 0; pointer-events: none; display: flex; flex-direction: column; justify-content: space-between; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); }
.hud-top { display: flex; flex-direction: column; gap: 6px; }
#hud-identity { font-family: var(--serif); font-size: 17px; color: var(--gold-soft); text-shadow: 0 1px 8px #000; }
#hud-age { font-size: 13px; color: var(--dim); }
.mission {
  max-width: 480px; font-size: 14px; line-height: 1.5; color: var(--cyan);
  background: rgba(7,5,16,0.65); border: 1px solid rgba(95,212,208,0.25); border-radius: 10px; padding: 9px 13px;
  transition: filter 1.2s, color 1.2s;
}
.mission.fogged { color: var(--dim); border-color: var(--line); }
.hud-meters { display: flex; flex-direction: column; gap: 7px; max-width: 320px; }
.meter { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--dim); }
.meter span { width: 92px; text-shadow: 0 1px 6px #000; }
.meter b { color: var(--text); font-size: 11px; width: 56px; }
.bar { flex: 1; height: 8px; border-radius: 5px; background: rgba(255,255,255,0.1); overflow: hidden; }
.bar i { display: block; height: 100%; width: 50%; border-radius: 5px; background: linear-gradient(90deg, var(--gold-soft), var(--gold)); transition: width 0.4s; }
.bar i.bad { background: linear-gradient(90deg, #8a5050, var(--bad)); }
.bar i.freq { background: linear-gradient(90deg, var(--violet), var(--cyan)); }
.whisper {
  align-self: center; margin-bottom: 8px; font-family: var(--serif); font-style: italic;
  font-size: 16px; color: rgba(233,228,245,0.85); text-shadow: 0 0 18px var(--violet);
  opacity: 0; transition: opacity 1.4s; text-align: center; max-width: 90vw;
}
.whisper.show { opacity: 1; }

.event-modal {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(7,5,16,0.6); backdrop-filter: blur(3px); z-index: 5;
}
.event-card {
  width: min(480px, 92vw); background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; padding: 26px; box-shadow: 0 0 60px rgba(139,111,216,0.25);
  animation: pop 0.25s ease-out;
}
@keyframes pop { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.event-card h3 { color: var(--gold-soft); font-size: 21px; margin-bottom: 10px; }
.event-card p { color: var(--dim); line-height: 1.6; font-size: 15px; margin-bottom: 18px; }
#ev-choices { display: flex; flex-direction: column; gap: 9px; }
.choice {
  cursor: pointer; text-align: left; padding: 12px 15px; border-radius: 11px; font-size: 14.5px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--line); color: var(--text); transition: all 0.12s;
}
.choice:hover { border-color: var(--gold); background: rgba(232,184,75,0.1); }
.choice small { display: block; color: var(--dim); margin-top: 3px; font-size: 12px; }

.rock-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 4; }
.rock-inner { text-align: center; color: var(--dim); }
.rock-emoji { font-size: 90px; animation: breathe 6s ease-in-out infinite; }
@keyframes breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.04); } }
.rock-inner h3 { font-size: 28px; color: var(--text); margin: 12px 0 6px; }
.rock-timer { margin: 14px 0; font-size: 14px; color: var(--cyan); }

/* ── Review ── */
.review-inner { max-width: 560px; margin: 0 auto; padding: 9vh 22px 60px; text-align: center; }
#review-title { font-size: clamp(34px, 6vw, 48px); color: var(--gold-soft); }
.obituary {
  margin: 26px 0; padding: 28px 26px; border-radius: 18px; text-align: left;
  background: linear-gradient(170deg, rgba(26,18,56,0.95), rgba(13,10,31,0.95));
  border: 1px solid var(--gold); box-shadow: 0 0 70px rgba(232,184,75,0.18);
  font-family: var(--serif); line-height: 1.75; font-size: 16px;
}
.obituary .ob-head { font-size: 13px; letter-spacing: 0.25em; color: var(--gold); text-transform: uppercase; }
.obituary .ob-name { font-size: 24px; color: var(--text); margin: 6px 0; }
.obituary .ob-line { color: var(--dim); }
.obituary .ob-line b { color: var(--gold-soft); }
.obituary .ob-emoji { margin-top: 10px; font-size: 18px; letter-spacing: 4px; }
.review-gains { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; margin-bottom: 26px; }
.gain {
  font-size: 13.5px; padding: 8px 14px; border-radius: 999px;
  background: rgba(95,212,208,0.1); border: 1px solid rgba(95,212,208,0.35); color: var(--cyan);
  animation: pop 0.3s ease-out backwards;
}
.gain.neg { background: rgba(216,111,111,0.1); border-color: rgba(216,111,111,0.4); color: var(--bad); }
.review-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ── Revelation ── */
.revelation-inner { max-width: 620px; margin: 0 auto; padding: 14vh 24px; text-align: center; }
#rev-title { font-size: clamp(36px, 7vw, 60px); color: var(--gold-soft); text-shadow: 0 0 80px var(--gold); animation: glow 3s ease-in-out infinite; }
@keyframes glow { 0%,100% { text-shadow: 0 0 40px rgba(232,184,75,0.5); } 50% { text-shadow: 0 0 110px rgba(232,184,75,0.95); } }
.rev-body { font-family: var(--serif); font-size: 19px; line-height: 1.9; color: var(--text); margin: 30px 0 40px; }
.rev-body em { color: var(--cyan); }

/* ── Bits ── */
.flash {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 50;
  background: var(--card); border: 1px solid var(--gold); color: var(--gold-soft);
  padding: 12px 22px; border-radius: 12px; font-size: 15px; box-shadow: 0 0 40px rgba(232,184,75,0.3);
  animation: pop 0.25s ease-out;
}
.voice-toggle {
  position: fixed; bottom: 16px; right: 16px; z-index: 40; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  width: 44px; height: 44px; border-radius: 50%; font-size: 18px;
}
.voice-toggle.off { opacity: 0.45; }
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: rgba(139,111,216,0.4); border-radius: 4px; }
