:root {
  color-scheme: dark;
  font-family: Inter, ui-rounded, "SF Pro Rounded", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #050614;
  color: #f6f3ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background:
    radial-gradient(circle at 70% 20%, rgba(102, 64, 190, 0.22), transparent 38%),
    #050614;
}

button {
  font: inherit;
}

button:focus-visible {
  outline: 3px solid rgba(131, 242, 222, 0.92);
  outline-offset: 4px;
}

.game-shell,
#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

#game {
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.hud {
  position: fixed;
  z-index: 2;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: max(18px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left));
  pointer-events: none;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.65);
}

.brand {
  display: grid;
  gap: 2px;
  letter-spacing: 0.08em;
}

.eyebrow {
  color: #a89ed4;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.18em;
}

.brand strong {
  font-size: clamp(0.88rem, 2vw, 1.05rem);
}

.scoreboard {
  display: flex;
  gap: clamp(14px, 4vw, 36px);
  text-align: right;
}

.charge {
  position: fixed;
  z-index: 2;
  top: max(76px, calc(env(safe-area-inset-top) + 58px));
  right: max(20px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  gap: 8px;
  color: #b9efdF;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  pointer-events: none;
}

.double-pulse {
  position: fixed;
  z-index: 2;
  top: max(100px, calc(env(safe-area-inset-top) + 82px));
  right: max(20px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  gap: 8px;
  color: #f4dda0;
  font-size: .68rem;
  letter-spacing: .04em;
  pointer-events: none;
}

.double-pulse[hidden] { display: none; }

.double-pulse-orb {
  width: 13px;
  height: 13px;
  border: 2px solid #ffe39a;
  border-radius: 50%;
  box-shadow: inset 0 0 8px #d29cff, 0 0 15px rgba(255, 220, 130, .72);
}

.double-pulse.is-spent { color: rgba(185, 180, 210, .48); }
.double-pulse.is-spent .double-pulse-orb { border-color: rgba(185, 180, 210, .4); box-shadow: none; }

.charge-orb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #76efdb;
  box-shadow: 0 0 15px rgba(118, 239, 219, 0.86);
}

.charge.is-empty {
  color: rgba(185, 180, 210, 0.48);
}

.charge.is-empty .charge-orb {
  background: transparent;
  box-shadow: none;
  border: 1px solid rgba(185, 180, 210, 0.45);
}

.objective {
  position: fixed;
  z-index: 2;
  top: max(112px, calc(env(safe-area-inset-top) + 92px));
  left: 50%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(165, 147, 236, 0.18);
  border-radius: 999px;
  background: rgba(8, 9, 28, 0.58);
  color: #d8d2f1;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  transform: translateX(-50%);
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.objective-mark {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f4d486;
  box-shadow: 0 0 12px rgba(244, 212, 134, 0.86);
}

.scoreboard span {
  display: grid;
}

.scoreboard b {
  font-size: clamp(1.2rem, 4vw, 1.75rem);
  line-height: 1;
}

.scoreboard small {
  margin-top: 4px;
  color: #a89ed4;
  font-size: 0.64rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.resonance-score {
  min-width: 62px;
}

.resonance-petals {
  display: flex;
  min-height: 28px;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.resonance-petals i {
  display: block;
  width: 7px;
  height: 15px;
  border-radius: 70% 30% 70% 30%;
  background: #ffe39a;
  box-shadow: 0 0 12px rgba(245, 201, 95, 0.82);
  transform: rotate(35deg);
  transition: opacity 220ms ease, filter 220ms ease, box-shadow 220ms ease;
}

.resonance-score[data-petals="2"] .resonance-petals i:nth-child(3),
.resonance-score[data-petals="1"] .resonance-petals i:nth-child(n + 2) {
  opacity: 0.2;
  filter: saturate(0);
  box-shadow: none;
}

.coach {
  position: fixed;
  z-index: 2;
  left: 50%;
  bottom: max(74px, calc(env(safe-area-inset-bottom) + 58px));
  width: min(88vw, 430px);
  padding: 14px 18px;
  border: 1px solid rgba(184, 167, 255, 0.18);
  border-radius: 18px;
  background: rgba(9, 10, 31, 0.68);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(14px);
  text-align: center;
  transform: translateX(-50%);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.coach.is-hidden {
  opacity: 0;
  transform: translate(-50%, 10px);
}

.coach strong,
.coach span {
  display: block;
}

.coach strong {
  color: #fff;
  font-size: 0.92rem;
}

.coach span {
  margin-top: 4px;
  color: #b9b4d2;
  font-size: 0.76rem;
}

.tutorial-guide {
  position: fixed;
  z-index: 4;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: end;
  justify-items: center;
  padding: 24px max(18px, env(safe-area-inset-right)) max(76px, calc(env(safe-area-inset-bottom) + 62px)) max(18px, env(safe-area-inset-left));
  pointer-events: none;
}

.tutorial-guide[hidden],
.tutorial-actions[hidden] {
  display: none;
}

.tutorial-guide.is-blocking {
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 45%, rgba(82, 69, 148, .12), rgba(3, 4, 15, .68));
  backdrop-filter: blur(3px);
  pointer-events: auto;
}

.tutorial-card {
  position: relative;
  justify-self: center;
  width: min(92vw, 520px);
  padding: 20px 22px;
  overflow: hidden;
  border: 1px solid rgba(160, 235, 220, .34);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(15, 16, 48, .94), rgba(8, 25, 36, .94));
  box-shadow: 0 24px 80px rgba(0, 0, 0, .48), 0 0 50px rgba(83, 221, 197, .08);
  backdrop-filter: blur(18px);
}

.tutorial-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #8f6cff, #67e8d0, #ffe08c);
}

.tutorial-card h2 {
  margin: 8px 0 7px;
  color: #fbf9ff;
  font-size: clamp(1.35rem, 4vw, 2rem);
  line-height: 1.08;
  letter-spacing: -.025em;
}

.tutorial-card p {
  margin: 0;
  color: #c5c0d8;
  font-size: .9rem;
  line-height: 1.5;
}

.tutorial-prompt {
  display: block;
  margin-top: 13px;
  color: #8fe8d7;
  font-size: .78rem;
  line-height: 1.4;
}

.tutorial-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
}

.tutorial-ready .tutorial-card {
  border-color: rgba(255, 224, 140, .72);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .48), 0 0 56px rgba(255, 215, 118, .18);
  animation: tutorial-ready 1.45s ease-in-out infinite;
}

.tutorial-ready .tutorial-prompt {
  color: #ffe39a;
  font-size: .86rem;
}

.tutorial-searching .tutorial-card {
  border-color: rgba(184, 167, 255, .28);
}

.tutorial-captured .tutorial-card {
  border-color: rgba(255, 222, 137, .46);
  background: linear-gradient(145deg, rgba(27, 23, 65, .97), rgba(11, 49, 52, .96));
}

.tutorial-focus {
  display: none;
}

.is-tutorial .coach,
.is-tutorial .test-controls,
.is-tutorial .prototype-note {
  display: none;
}

@keyframes tutorial-ready {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.result {
  position: fixed;
  z-index: 3;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 28px;
  background: radial-gradient(circle, rgba(31, 25, 70, 0.66), rgba(4, 5, 17, 0.92));
  text-align: center;
  backdrop-filter: blur(8px);
}

.result[hidden] {
  display: none;
}

.result h1 {
  max-width: 520px;
  margin: 12px 0 8px;
  font-size: clamp(1.8rem, 7vw, 3.5rem);
  line-height: 1.03;
}

.result p {
  margin: 0 0 26px;
  color: #c6c1dc;
}

.result-impact {
  max-width: 470px;
  margin: -14px 0 24px;
  color: #8fe8d7;
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: 0.025em;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(100px, 1fr));
  width: min(100%, 680px);
  margin: 0 0 26px;
  overflow: hidden;
  border: 1px solid rgba(184, 167, 255, 0.16);
  border-radius: 16px;
  background: rgba(9, 10, 31, 0.54);
}

.result-stats div {
  display: grid;
  gap: 6px;
  padding: 14px 12px;
}

.result-stats div + div {
  border-left: 1px solid rgba(184, 167, 255, 0.13);
}

.result-stats dt {
  color: #a89ed4;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.result-stats dd {
  margin: 0;
  color: #fff0b0;
  font-size: 1.15rem;
  font-weight: 800;
}

.result button {
  min-width: 190px;
  padding: 14px 22px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: linear-gradient(135deg, #8f6cff, #48c6d7);
  box-shadow: 0 12px 40px rgba(107, 92, 255, 0.32);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.story,
.restoration,
.route-choice {
  position: fixed;
  z-index: 4;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  min-height: 100%;
  overflow: auto;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 22% 34%, rgba(78, 58, 151, 0.24), transparent 34%),
    linear-gradient(145deg, #08091e, #050612 68%);
}

.route-choice.preview-serene {
  background:
    radial-gradient(circle at 24% 48%, rgba(79, 235, 207, .26), transparent 35%),
    linear-gradient(145deg, #071b28, #050b18 70%);
}

.route-choice.preview-bold {
  background:
    radial-gradient(circle at 24% 48%, rgba(240, 153, 83, .2), transparent 30%),
    radial-gradient(circle at 78% 26%, rgba(211, 67, 157, .24), transparent 38%),
    linear-gradient(145deg, #1b0a20, #080617 70%);
}

.route-choice.preview-bold .route-star { background: #ffd08b; box-shadow: 0 0 32px #d34a9f; }
.route-choice.preview-bold .route-line { background: linear-gradient(90deg, rgba(255,196,111,.82), rgba(213,69,160,.12)); }

.route-serene .objective,
.route-serene .coach { border-color: rgba(99, 238, 210, .3); background: rgba(5, 29, 39, .7); }
.route-bold .objective,
.route-bold .coach { border-color: rgba(243, 153, 100, .3); background: rgba(35, 8, 34, .72); }
.route-bold .objective-mark { background: #ff9c78; box-shadow: 0 0 14px rgba(255, 106, 139, .88); }
.route-serene .life-progress span { background: linear-gradient(90deg, #3f8eb3, #69efd3, #b6f1c4); }
.route-bold .life-progress span { background: linear-gradient(90deg, #8a4fda, #e04f9c, #ffc56f); }

.story[hidden],
.restoration[hidden],
.route-choice[hidden] {
  display: none;
}

.is-prologue .test-controls,
.is-prologue .prototype-note {
  display: none;
}

.route-choice {
  grid-template-columns: minmax(280px, .75fr) minmax(420px, 1.25fr);
  background:
    radial-gradient(circle at 20% 48%, rgba(90, 217, 196, .16), transparent 30%),
    radial-gradient(circle at 78% 25%, rgba(139, 99, 235, .17), transparent 34%),
    #060718;
}

.route-constellation { position: relative; min-height: 460px; overflow: hidden; }
.route-star { position: absolute; width: 18px; height: 18px; border-radius: 50%; background: #dffff8; box-shadow: 0 0 28px #73e6d2; }
.star-a { top: 26%; left: 22%; }
.star-b { top: 43%; left: 48%; width: 30px; height: 30px; }
.star-c { top: 67%; left: 27%; background: #ffe19a; box-shadow: 0 0 28px #e7ac62; }
.star-d { top: 54%; left: 72%; width: 12px; height: 12px; background: #ffe19a; box-shadow: 0 0 22px #e7ac62; }
.route-line { position: absolute; height: 2px; transform-origin: left; background: linear-gradient(90deg, rgba(111,231,210,.8), rgba(149,112,235,.1)); }
.line-a { top: 29%; left: 24%; width: 210px; transform: rotate(29deg); }
.line-b { top: 46%; left: 51%; width: 170px; transform: rotate(32deg); background: linear-gradient(90deg, rgba(255,218,142,.8), rgba(232,160,83,.08)); }

.route-copy {
  display: grid;
  align-content: center;
  justify-items: start;
  padding: clamp(34px, 6vw, 82px);
}

.route-copy h1 { margin: 12px 0 10px; font-size: clamp(2.15rem, 5vw, 4.7rem); line-height: .98; letter-spacing: -.045em; }
.route-copy > p { max-width: 620px; color: #bbb6d1; line-height: 1.55; }
.route-options { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: min(100%, 680px); margin: 28px 0 14px; }
.route-card,
.choice-card {
  min-height: 156px;
  padding: 20px;
  border: 1px solid rgba(183, 167, 240, .2);
  border-radius: 20px;
  background: rgba(15, 16, 46, .72);
  color: #f7f3ff;
  text-align: left;
  cursor: pointer;
  transition: border-color 180ms ease, transform 180ms ease, background 180ms ease;
}
.route-card:hover,
.choice-card:hover { transform: translateY(-2px); border-color: rgba(155, 236, 218, .54); }
.route-card[aria-pressed="true"],
.choice-card[aria-pressed="true"] { border-color: #8ee9d7; background: rgba(39, 71, 79, .72); box-shadow: 0 0 0 2px rgba(105, 232, 208, .12); }
.bold-route[aria-pressed="true"],
.sanctuary-choice[aria-pressed="true"] { border-color: #f2c879; background: rgba(91, 61, 44, .68); }
.route-card span,
.route-card strong,
.route-card small,
.route-card b,
.choice-card strong,
.choice-card span { display: block; }
.route-symbol { color: #9df0df; font-size: 1.55rem; }
.bold-route .route-symbol { color: #f4cd80; }
.route-card strong { margin-top: 10px; font-size: 1.08rem; }
.route-card small,
.choice-card span { margin-top: 7px; color: #bcb6d0; line-height: 1.4; }
.route-card b { margin-top: 13px; color: #8ce5d4; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; }
.bold-route b { color: #efc476; }
.route-copy .choice-consequence { min-height: 24px; margin: 0 0 18px; color: #d8d0ef; font-size: .8rem; }
.primary-action:disabled { cursor: not-allowed; opacity: .42; box-shadow: none; }

.restoration-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: min(100%, 560px); margin: 22px 0 10px; }
.restoration-choices[hidden] { display: none; }
.choice-card { min-height: 116px; padding: 16px; }
.choice-card strong { font-size: .92rem; }

.story-visual,
.home-world {
  position: relative;
  min-height: 480px;
  overflow: hidden;
  isolation: isolate;
}

.story-visual::before,
.home-world::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image:
    radial-gradient(circle at 15% 18%, rgba(255, 255, 255, 0.65) 0 1px, transparent 1.5px),
    radial-gradient(circle at 74% 25%, rgba(204, 196, 255, 0.6) 0 1px, transparent 1.5px),
    radial-gradient(circle at 40% 70%, rgba(255, 236, 200, 0.5) 0 1px, transparent 1.5px);
  background-size: 130px 110px, 170px 150px, 210px 180px;
}

.story-planet {
  position: absolute;
  right: 6%;
  bottom: -26%;
  width: min(58vw, 620px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 28%, #777195, #35344e 46%, #17192d 76%);
  box-shadow: inset -60px -70px 110px rgba(2, 3, 12, 0.72), 0 -20px 100px rgba(103, 84, 188, 0.16);
  transition: background 900ms ease, box-shadow 900ms ease;
}

.story-atmosphere {
  position: absolute;
  right: 3%;
  bottom: -29%;
  width: min(64vw, 680px);
  aspect-ratio: 1;
  border: 2px solid rgba(130, 117, 193, 0.16);
  border-radius: 50%;
  filter: blur(3px);
}

.story-capsule {
  position: absolute;
  top: 26%;
  left: 22%;
  width: 58px;
  height: 22px;
  border: 2px solid rgba(239, 232, 255, 0.8);
  border-radius: 55% 45% 45% 55%;
  background: linear-gradient(90deg, #f0eaff, #756aa6);
  box-shadow: -34px 0 32px rgba(132, 102, 255, 0.55);
  transform: rotate(24deg);
  animation: capsule-drift 3.8s ease-in-out infinite;
}

.story-signal {
  position: absolute;
  top: 10%;
  right: 16%;
  width: 110px;
  height: 110px;
  border: 1px solid rgba(111, 239, 217, 0.5);
  border-radius: 50%;
  box-shadow: 0 0 40px rgba(79, 224, 204, 0.22), inset 0 0 34px rgba(79, 224, 204, 0.18);
  animation: signal-pulse 2.6s ease-out infinite;
}

.story-plant,
.story-companion {
  position: absolute;
  opacity: 0;
  transition: opacity 600ms ease, transform 900ms ease;
}

.story-plant {
  right: 32%;
  bottom: 22%;
  width: 10px;
  height: 48px;
  border-radius: 60% 15%;
  background: linear-gradient(#9af5df, #4c7c8c);
  box-shadow: -14px 10px 0 -2px #60999b, 14px 18px 0 -2px #8466ad, 0 0 28px rgba(120, 240, 216, 0.38);
  transform: scale(0.4);
}

.story-companion {
  right: 22%;
  bottom: 34%;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e7fff9;
  box-shadow: 0 0 28px #6fe4d1;
}

.scene-silence .story-planet,
.scene-echo .story-planet,
.scene-mission .story-planet {
  background: radial-gradient(circle at 38% 28%, #7970a0, #3a4f67 42%, #17263a 74%);
  box-shadow: inset -60px -70px 110px rgba(2, 3, 12, 0.62), 0 -20px 120px rgba(91, 226, 204, 0.18);
}

.scene-silence .story-capsule {
  top: 43%;
  left: 46%;
  transform: rotate(10deg) scale(.9);
}

.scene-silence .story-signal {
  top: 44%;
  right: 31%;
  width: 72px;
  height: 72px;
}

.scene-echo .story-capsule,
.scene-mission .story-capsule,
.scene-echo .story-signal,
.scene-mission .story-signal {
  opacity: 0.22;
}

.scene-echo .story-plant,
.scene-echo .story-companion,
.scene-mission .story-plant,
.scene-mission .story-companion {
  opacity: 1;
  transform: scale(1);
}

.scene-echo .story-signal {
  opacity: .9;
  border-width: 3px;
  box-shadow: 0 0 70px rgba(79, 224, 204, .4), inset 0 0 38px rgba(132, 108, 255, .42);
}

.scene-mission .story-capsule {
  top: 23%;
  left: 31%;
  opacity: 1;
  transform: rotate(34deg) scale(1.08);
}

.scene-mission .story-signal {
  top: 20%;
  right: 28%;
  opacity: .76;
  border-style: dashed;
}

.story-copy,
.restoration-copy {
  display: grid;
  align-content: center;
  justify-items: start;
  padding: clamp(34px, 7vw, 90px);
  background: linear-gradient(90deg, rgba(6, 7, 21, 0.12), rgba(6, 7, 21, 0.88) 28%);
}

.story-copy h1,
.restoration-copy h1 {
  max-width: 560px;
  margin: 12px 0 16px;
  font-size: clamp(2.25rem, 6vw, 5.5rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.story-copy p,
.restoration-copy p {
  max-width: 470px;
  margin: 0;
  color: #bbb6d1;
  font-size: clamp(0.96rem, 1.8vw, 1.15rem);
  line-height: 1.6;
}

.story-progress {
  display: grid;
  grid-template-columns: auto minmax(90px, 150px);
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  color: #aaa3cd;
  font-size: .68rem;
  font-weight: 750;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.story-progress > i {
  display: block;
  width: 100%;
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(180, 166, 231, .18);
}

.story-progress b {
  display: block;
  width: 25%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8f6cff, #6ce5d0);
  box-shadow: 0 0 16px rgba(108, 229, 208, .55);
  transition: width 360ms ease;
}

.story-concept {
  width: min(100%, 500px);
  margin-top: 22px;
  padding: 14px 16px;
  border: 1px solid rgba(151, 226, 211, .2);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(71, 53, 131, .28), rgba(28, 77, 83, .2));
}

.story-concept strong {
  display: block;
  margin-bottom: 4px;
  color: #91ead9;
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.story-concept p {
  color: #d4cee6;
  font-size: .88rem;
  line-height: 1.45;
}

.mission-briefing {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: min(100%, 560px);
  margin: 18px 0 0;
}

.mission-briefing[hidden],
.text-action[hidden] {
  display: none;
}

.mission-briefing div {
  min-height: 84px;
  padding: 13px;
  border: 1px solid rgba(184, 167, 255, .16);
  border-radius: 14px;
  background: rgba(13, 15, 43, .66);
}

.mission-briefing dt {
  margin-bottom: 7px;
  color: #9e96c6;
  font-size: .62rem;
  font-weight: 750;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.mission-briefing dd {
  margin: 0;
  color: #f5f1ff;
  font-size: .78rem;
  font-weight: 700;
  line-height: 1.35;
}

.story-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 32px;
}

.primary-action,
.text-action {
  min-height: 48px;
  border-radius: 999px;
  cursor: pointer;
}

.primary-action {
  min-width: 180px;
  padding: 13px 22px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: linear-gradient(135deg, #8f6cff, #48c6d7);
  box-shadow: 0 12px 40px rgba(107, 92, 255, 0.28);
  color: #fff;
  font-weight: 800;
}

.text-action {
  padding: 12px 4px;
  border: 0;
  background: transparent;
  color: #aaa4c2;
}

.home-world {
  background: radial-gradient(circle at 55% 48%, rgba(91, 72, 159, 0.16), transparent 50%);
}

.home-world::after {
  content: "";
  position: absolute;
  top: 16%;
  left: 12%;
  width: min(56vw, 590px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, #6c6885, #353747 48%, #151824 78%);
  box-shadow: inset -55px -65px 100px rgba(1, 2, 9, 0.66), 0 0 100px rgba(112, 85, 187, 0.16);
  transition: background 1.5s ease, box-shadow 1.5s ease;
}

.home-glow,
.home-river,
.home-plant,
.home-ruin,
.home-creature,
.home-root-network,
.home-canopy,
.home-sanctuary,
.home-rare-life,
.home-echo {
  position: absolute;
  z-index: 1;
}

.home-echo {
  top: 28%;
  left: 43%;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff4c5;
  box-shadow: 0 0 42px #efc969, 0 0 90px rgba(239, 201, 105, 0.5);
  animation: echo-float 2.4s ease-in-out infinite;
  transition: transform 1.2s ease, opacity 900ms ease;
}

.home-glow {
  top: 47%;
  left: 35%;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(89, 235, 207, 0.32), transparent 68%);
  opacity: 0;
  transform: scale(0.2);
  transition: opacity 1.2s ease 400ms, transform 1.4s ease 400ms;
}

.home-river {
  top: 55%;
  left: 24%;
  width: 280px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(90deg, transparent, #67d8df, #5eaee6, transparent);
  opacity: 0;
  transform: rotate(18deg) scaleX(0.1);
  transform-origin: left;
  transition: opacity 800ms ease 700ms, transform 1.5s ease 700ms;
}

.home-plant {
  width: 12px;
  height: 46px;
  border-radius: 70% 10%;
  background: #76d8bc;
  box-shadow: -12px 12px 0 -2px #5ea798, 12px 18px 0 -2px #7861a8;
  opacity: 0;
  transform: scale(0.2);
  transition: opacity 500ms ease 1s, transform 900ms cubic-bezier(0.2, 0.8, 0.2, 1.2) 1s;
}

.plant-one { top: 44%; left: 37%; }
.plant-two { top: 58%; left: 48%; transition-delay: 1.18s; }

.home-ruin {
  top: 32%;
  left: 27%;
  width: 70px;
  height: 82px;
  border: 2px solid rgba(173, 157, 225, 0.58);
  border-bottom: 0;
  border-radius: 50% 50% 0 0;
  opacity: 0.18;
  transform: translateY(35px);
  transition: opacity 900ms ease 1.15s, transform 1.1s ease 1.15s;
}

.home-creature {
  top: 64%;
  left: 38%;
  width: 17px;
  height: 12px;
  border-radius: 50%;
  background: #e9fff8;
  box-shadow: 0 0 22px #6de2d0;
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 500ms ease 1.65s, transform 900ms ease 1.65s;
}

.home-world.is-awake::after {
  background: radial-gradient(circle at 38% 30%, #7b76a2, #37647a 42%, #183448 76%);
  box-shadow: inset -55px -65px 100px rgba(1, 2, 9, 0.58), 0 0 120px rgba(83, 226, 200, 0.23);
}

.home-world.is-awake .home-echo {
  opacity: 0;
  transform: translate(-70px, 150px) scale(0.2);
}

.home-world.is-awake .home-glow,
.home-world.is-awake .home-river,
.home-world.is-awake .home-plant,
.home-world.is-awake .home-ruin,
.home-world.is-awake .home-creature {
  opacity: 1;
}

.home-world.is-awake .home-glow { transform: scale(1); }
.home-world.is-awake .home-river { transform: rotate(18deg) scaleX(1); }
.home-world.is-awake .home-plant { transform: scale(1); }
.home-world.is-awake .home-ruin,
.home-world.is-awake .home-creature { transform: translate(0); }

.home-root-network {
  top: 52%;
  left: 22%;
  width: 310px;
  height: 120px;
  opacity: 0;
  background:
    linear-gradient(18deg, transparent 46%, #66b88c 48% 50%, transparent 52%),
    linear-gradient(-13deg, transparent 47%, #4e987d 49% 51%, transparent 53%),
    linear-gradient(34deg, transparent 48%, #90d19b 49% 50%, transparent 52%);
  filter: drop-shadow(0 0 10px rgba(93, 221, 165, 0.4));
  transform: scaleX(0.15);
  transform-origin: center;
  transition: opacity 700ms ease, transform 1.35s ease;
}

.home-canopy {
  width: 54px;
  height: 62px;
  border-radius: 70% 30% 62% 38%;
  opacity: 0;
  background: radial-gradient(circle at 38% 30%, #c0f39a, #3d936e 58%, #255b56);
  box-shadow: 0 0 30px rgba(85, 220, 155, 0.25);
  transform: translateY(28px) scale(0.2) rotate(-12deg);
  transition: opacity 650ms ease 300ms, transform 900ms cubic-bezier(.2,.85,.2,1.2) 300ms;
}

.canopy-one { top: 35%; left: 30%; }
.canopy-two { top: 46%; left: 45%; width: 68px; height: 76px; transition-delay: 520ms; }
.canopy-three { top: 29%; left: 53%; width: 45px; height: 52px; transition-delay: 690ms; }

.home-sanctuary {
  top: 39%;
  left: 38%;
  width: 88px;
  height: 74px;
  border: 3px solid rgba(207, 238, 171, 0.7);
  border-bottom: 0;
  border-radius: 52% 52% 10% 10%;
  opacity: 0;
  box-shadow: 0 0 24px rgba(149, 236, 176, 0.28);
  transform: translateY(22px);
  transition: opacity 800ms ease 850ms, transform 900ms ease 850ms;
}

.home-rare-life {
  top: 61%;
  left: 53%;
  width: 24px;
  height: 14px;
  border-radius: 65% 35% 60% 40%;
  opacity: 0;
  background: #fff5b3;
  box-shadow: -13px -8px 0 -5px #fff5b3, 0 0 28px #c8ff9f;
  transform: translateX(-32px) rotate(-8deg);
  transition: opacity 650ms ease 1.25s, transform 1.1s ease 1.25s;
}

.home-world[class*="roots-"] .home-echo {
  opacity: 0;
  transform: translate(-15px, 130px) scale(0.15);
}

.home-world[class*="roots-"] .home-root-network {
  opacity: 1;
  transform: scaleX(1);
}

.home-world.roots-tenue::after {
  background: radial-gradient(circle at 38% 30%, #777899, #355e5b 45%, #1a3035 76%);
}

.home-world.roots-tenue .canopy-one { opacity: .72; transform: translateY(0) scale(.72) rotate(-12deg); }

.home-world.roots-estavel::after,
.home-world.roots-radiante::after {
  background: radial-gradient(circle at 38% 30%, #91a982, #2e7860 43%, #153f3d 76%);
  box-shadow: inset -55px -65px 100px rgba(1, 2, 9, 0.45), 0 0 130px rgba(93, 235, 165, 0.28);
}

.home-world.roots-estavel .home-canopy,
.home-world.roots-radiante .home-canopy,
.home-world.roots-estavel .home-sanctuary,
.home-world.roots-radiante .home-sanctuary {
  opacity: 1;
  transform: translateY(0) scale(1) rotate(-12deg);
}

.home-world.roots-estavel .home-sanctuary,
.home-world.roots-radiante .home-sanctuary { transform: translateY(0); }

.home-world.roots-radiante::after {
  background: radial-gradient(circle at 36% 27%, #d1d78e, #31956c 39%, #15534b 72%);
  box-shadow: inset -45px -60px 90px rgba(1, 2, 9, 0.34), 0 0 160px rgba(131, 255, 187, 0.4);
}

.home-world.roots-radiante .home-canopy { filter: saturate(1.25) brightness(1.1); }
.home-world.has-rare-life .home-rare-life { opacity: 1; transform: translateX(0) rotate(-8deg); }

.home-world.choice-crystal-grove .home-canopy {
  background: radial-gradient(circle at 38% 30%, #e4ffbc, #54c99a 48%, #566fc4);
  clip-path: polygon(50% 0, 92% 68%, 62% 100%, 17% 77%);
  border-radius: 20% 55% 35% 60%;
}

.home-world.choice-crystal-grove .home-root-network { filter: drop-shadow(0 0 15px rgba(123, 245, 204, .7)); }
.home-world.choice-ancient-sanctuary .home-sanctuary { border-width: 5px; border-color: rgba(255, 222, 156, .88); box-shadow: 0 0 38px rgba(255, 198, 113, .48); }
.home-world.choice-ancient-sanctuary .home-canopy { filter: sepia(.18) saturate(.82); }

.restoration-status {
  margin: 24px 0;
  color: #82e5d3;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@keyframes capsule-drift {
  50% { transform: translate(12px, -8px) rotate(24deg); }
}

@keyframes signal-pulse {
  0% { opacity: 0.15; transform: scale(0.75); }
  70%, 100% { opacity: 0; transform: scale(1.35); }
}

@keyframes echo-float {
  50% { transform: translateY(-10px); }
}

.prototype-note {
  position: fixed;
  z-index: 2;
  bottom: max(14px, env(safe-area-inset-bottom));
  left: 50%;
  margin: 0;
  color: rgba(222, 216, 255, 0.45);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transform: translateX(-50%);
  pointer-events: none;
}

.test-controls {
  position: fixed;
  z-index: 5;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(34px, calc(env(safe-area-inset-bottom) + 24px));
  display: flex;
  gap: 6px;
}

.test-controls button {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid rgba(190, 180, 225, .17);
  border-radius: 12px;
  background: rgba(8, 9, 27, .7);
  color: rgba(218, 211, 239, .64);
  font-size: .66rem;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.life-progress {
  position: fixed;
  z-index: 2;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  left: max(20px, env(safe-area-inset-left));
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(218, 210, 255, 0.11);
  pointer-events: none;
}

.life-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #755eff, #5ef2d8, #f5cf78);
  box-shadow: 0 0 14px rgba(94, 242, 216, 0.5);
  transition: width 320ms ease;
}

@media (max-width: 520px) {
  .hud {
    padding-top: max(14px, env(safe-area-inset-top));
  }

  .scoreboard {
    gap: 10px;
  }

  .brand strong {
    font-size: 0.78rem;
  }

  .scoreboard b {
    font-size: 1.08rem;
  }

  .scoreboard small {
    font-size: 0.52rem;
  }

  .resonance-score {
    min-width: 52px;
  }

  .resonance-petals {
    min-height: 18px;
  }

  .resonance-petals i {
    width: 6px;
    height: 12px;
  }

  .charge {
    top: max(66px, calc(env(safe-area-inset-top) + 50px));
    font-size: 0.6rem;
  }

  .objective {
    top: max(96px, calc(env(safe-area-inset-top) + 78px));
    max-width: 76vw;
    white-space: nowrap;
  }

  .coach {
    padding: 12px 14px;
  }

  .prototype-note {
    width: 82vw;
    text-align: center;
  }

  .test-controls { right: 10px; bottom: 42px; flex-direction: column; }
  .test-controls button { min-height: 42px; padding: 6px 9px; font-size: .58rem; }

  .result-stats {
    grid-template-columns: 1fr;
    width: min(82vw, 320px);
  }

  .result-stats div {
    grid-template-columns: 1fr auto;
    align-items: center;
    text-align: left;
  }

  .result-stats div + div {
    border-top: 1px solid rgba(184, 167, 255, 0.13);
    border-left: 0;
  }
}

@media (max-width: 760px) {
  .story,
  .restoration,
  .route-choice {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(300px, 48vh) auto;
  }

  .route-choice { grid-template-rows: minmax(190px, 30vh) auto; }
  .route-constellation { min-height: 190px; }
  .route-copy { align-content: start; padding: 24px 20px max(34px, env(safe-area-inset-bottom)); }
  .route-options { margin-top: 20px; }

  .story-visual,
  .home-world {
    min-height: 300px;
  }

  .story-planet {
    right: -8%;
    bottom: -54%;
    width: min(110vw, 520px);
  }

  .story-atmosphere {
    right: -12%;
    bottom: -58%;
    width: min(120vw, 570px);
  }

  .story-capsule { top: 28%; left: 18%; }
  .story-signal { top: 8%; right: 14%; }
  .story-plant { right: 31%; bottom: 10%; }
  .story-companion { right: 20%; bottom: 25%; }

  .story-copy,
  .restoration-copy {
    align-content: start;
    padding: 28px 24px max(30px, env(safe-area-inset-bottom));
    background: linear-gradient(0deg, rgba(6, 7, 21, 0.98), rgba(6, 7, 21, 0.84));
  }

  .story-copy h1,
  .restoration-copy h1 {
    font-size: clamp(2rem, 10vw, 3.25rem);
  }

  .story-actions {
    width: 100%;
    justify-content: space-between;
    margin-top: 24px;
  }

  .story-progress { margin-bottom: 15px; }
  .story-concept { margin-top: 16px; }
  .mission-briefing { grid-template-columns: 1fr; }
  .mission-briefing div {
    display: grid;
    grid-template-columns: 82px 1fr;
    align-items: center;
    min-height: 52px;
    padding: 10px 12px;
  }
  .mission-briefing dt { margin: 0; }

  .home-world::after {
    top: 4%;
    left: 5%;
    width: 90vw;
    max-width: 430px;
  }

  .home-echo { top: 20%; left: 48%; }
  .home-glow { top: 38%; left: 28%; }
  .home-river { top: 52%; left: 15%; width: 240px; }
  .plant-one { top: 36%; left: 35%; }
  .plant-two { top: 56%; left: 52%; }
  .home-ruin { top: 25%; left: 21%; }
  .home-creature { top: 63%; left: 36%; }
  .home-root-network { top: 48%; left: 12%; width: 290px; }
  .canopy-one { top: 27%; left: 27%; }
  .canopy-two { top: 42%; left: 46%; }
  .canopy-three { top: 22%; left: 57%; }
  .home-sanctuary { top: 33%; left: 38%; }
  .home-rare-life { top: 62%; left: 56%; }
}

@media (max-width: 520px) {
  .route-options,
  .restoration-choices { grid-template-columns: 1fr; }
  .route-card { min-height: 128px; }
  .double-pulse { top: max(89px, calc(env(safe-area-inset-top) + 72px)); font-size: .58rem; }
  .story-actions { flex-direction: column; align-items: stretch; gap: 10px; }
  .story-actions .primary-action { width: 100%; min-width: 0; }
  .story-actions .text-action { align-self: center; min-height: 44px; }
  .tutorial-guide { padding-bottom: max(58px, calc(env(safe-area-inset-bottom) + 48px)); }
  .tutorial-guide.is-blocking { padding: 18px; }
  .tutorial-card { width: 100%; padding: 18px; border-radius: 19px; }
  .tutorial-actions { flex-direction: column; align-items: stretch; gap: 8px; }
  .tutorial-actions .primary-action { width: 100%; min-width: 0; }
  .tutorial-actions .text-action { align-self: center; min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .coach {
    transition: none;
  }

  .resonance-petals i,
  .life-progress span {
    transition: none;
  }

  .story-capsule,
  .story-signal,
  .home-echo {
    animation: none;
  }

  .story-planet,
  .story-plant,
  .story-companion,
  .home-world::after,
  .home-glow,
  .home-river,
  .home-plant,
  .home-ruin,
  .home-creature,
  .home-root-network,
  .home-canopy,
  .home-sanctuary,
  .home-rare-life,
  .home-echo {
    transition-duration: 1ms;
    transition-delay: 0ms;
  }

  .story-progress b { transition: none; }
  .tutorial-ready .tutorial-card { animation: none; }
}
