:root {
  color-scheme: dark;
  --bg: #07080d;
  --panel: #10131d;
  --ink: #eef0f6;
  --muted: #a4afbf;
  --cyan: #66e6eb;
  --amber: #ffbf78;
  --border: #2a3244;
  --form: #78ebc5;
  font: 16px/1.5 "Segoe UI", "Noto Sans", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  min-height: 100vh;
  margin: 0;
  background: radial-gradient(ellipse at 75% 16%, #1a203b88, transparent 53%);
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--cyan); }
button { font: inherit; }
button, label { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 4px; }

.shell { width: min(1112px, calc(100% - 48px)); margin-inline: auto; }
.skip {
  position: fixed;
  z-index: 4;
  top: .75rem;
  left: .75rem;
  background: var(--panel);
  border: 1px solid var(--cyan);
  padding: .7rem;
  transform: translateY(-180%);
}
.skip:focus { transform: none; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.top {
  min-height: 82px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; gap: .75rem; min-height: 44px; }
.brand-mark {
  display: block;
  width: 31px;
  height: 31px;
  border: 1px solid #65d8e6;
  border-radius: 48% 52% 47% 53%;
  background: radial-gradient(circle at 42% 34%, #b8ffed 0 7%, #6addce 8% 17%, transparent 18%),
              radial-gradient(circle at 48% 56%, #4cb5bc66, transparent 66%);
  box-shadow: inset 0 0 8px #61e6ef65, 0 0 18px #3ee4ed25;
}
.brand-text { display: grid; line-height: 1.15; gap: .22rem; }
.brand-text strong { font-size: .96rem; letter-spacing: .16em; }
.brand-text small { font-size: .76rem; letter-spacing: .23em; color: var(--muted); }
.network {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-height: 44px;
  padding-inline: .78rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #10141d;
  font-size: .875rem;
  cursor: pointer;
}
.network:hover { border-color: var(--cyan); color: var(--ink); }
.network:disabled { cursor: progress; }
.network-dot, .caption-dot {
  width: .44rem;
  height: .44rem;
  flex: 0 0 .44rem;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px #66e6eb80;
}
.network[data-mode="offline"] .network-dot { background: #a9aebe; box-shadow: none; }
.network[data-mode="connecting"] .network-dot { background: var(--amber); box-shadow: 0 0 9px #ffbf7870; }

.game { padding-block: clamp(24px, 5vw, 64px); }
.workbench {
  display: grid;
  grid-template-columns: minmax(0, .90fr) minmax(0, 1fr);
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: clip;
  background: #10131de0;
  box-shadow: 0 25px 64px #0005;
}
.habitat {
  position: relative;
  min-height: 485px;
  display: grid;
  align-content: end;
  overflow: hidden;
  isolation: isolate;
  border-right: 1px solid var(--border);
  background:
    linear-gradient(#293a482c 1px, transparent 1px) 50% / 30px 30px,
    linear-gradient(90deg, #293a482c 1px, transparent 1px) 50% / 30px 30px,
    radial-gradient(ellipse at 50% 46%, #20324e 0%, #111825 50%, #0c0f17 82%);
}
[data-base="silicon"] { --form: #cbb1ff; }
[data-base="cryo"] { --form: #a9d7ff; }
.chamber {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  mask-image: radial-gradient(ellipse at 50% 47%, #000 44%, #0008 79%, transparent 99%);
}
.orbit {
  position: absolute;
  top: 45%;
  left: 50%;
  translate: -50% -50%;
  width: min(78%, 340px);
  aspect-ratio: 1;
  border: 1px solid #718eaf55;
  border-radius: 50%;
}
.orbit-inner { width: min(64%, 280px); border-style: dashed; border-color: #80a6ca55; }
.orbit::before, .orbit::after {
  content: "";
  position: absolute;
  width: 5px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--form);
  box-shadow: 0 0 12px var(--form);
}
.orbit::before { top: 13%; left: 14%; }
.orbit::after { bottom: 13%; right: 14%; }
.orbit-inner::after, .orbit-inner::before { display: none; }
.specimen {
  position: absolute;
  top: 44%;
  left: 50%;
  width: clamp(104px, 17vw, 190px);
  aspect-ratio: 1;
  translate: -50% -50%;
}
.egg {
  position: absolute;
  inset: 5% 13%;
  border: 1px solid #c5fff0;
  border-radius: 48% 52% 49% 51% / 65% 65% 35% 35%;
  background:
    radial-gradient(ellipse at 43% 36%, #e8fff7 0 3%, #c7f7e39c 4% 12%, transparent 28%),
    radial-gradient(ellipse at 70% 66%, #4cb39dbb, transparent 57%),
    radial-gradient(ellipse at 22% 17%, #8ef2d4, #367185 63%, #233147);
  box-shadow: 0 0 38px #6ddccb65, inset 0 0 24px #a5ffe87a;
  transform: rotate(12deg);
  animation: float 6s ease-in-out infinite;
}
.habitat[data-phase="choose"] .egg { opacity: .68; filter: saturate(.72); }
.habitat[data-phase="capsule"] .egg { box-shadow: 0 0 55px #6ddccb80, inset 0 0 27px #a5ffe8a0; }
.habitat[data-phase="alive"] .egg { display: none; }
.organism {
  display: none;
  position: absolute;
  inset: 0;
  filter: drop-shadow(0 0 22px color-mix(in srgb, var(--form), transparent 49%));
  animation: float 7s ease-in-out infinite;
}
[data-phase="alive"][data-base="carbon"] .carbon,
[data-phase="alive"][data-base="silicon"] .silicon,
[data-phase="alive"][data-base="cryo"] .cryo { display: block; }
.organism i { position: absolute; display: block; }
.carbon::before,
.cryo::before, .silicon::before {
  content: "";
  position: absolute;
  border: 1px solid var(--form);
}
.carbon::before {
  inset: 18% 18% 20% 5%;
  z-index: 1;
  border-radius: 61% 48% 56% 44%;
  background:
    radial-gradient(circle at 29% 42%, #14203b 0 4%, #d7ffe9 4.5% 7%, transparent 7.5%),
    radial-gradient(circle at 47% 33%, #14203b 0 4%, #d7ffe9 4.5% 7%, transparent 7.5%),
    radial-gradient(ellipse at 30% 23%, #c1e1ae, #629b8c 44%, #42737c 66%, #1c3c4d);
}
.carbon i { height: 23%; width: 35%; background: #68a590; border-radius: 6% 96% 18% 87%; }
.carbon i:nth-child(1) { left: 65%; top: 38%; rotate: -22deg; transform-origin: left center; }
.carbon i:nth-child(2) { left: 11%; bottom: 17%; rotate: 36deg; }
.carbon i:nth-child(3) { left: 54%; bottom: 17%; rotate: -32deg; }
.carbon b { z-index: 2; border-radius: 50%; inset: 47% 31% 29% 34%; background: repeating-radial-gradient(ellipse at 45% 21%, transparent 0 4px, #e0ffba9e 5px 6px, transparent 7px 9px); }
.carbon b, .silicon b, .cryo b { display: none; position: absolute; }
.silicon::before {
  inset: 14% 11% 22%;
  clip-path: polygon(16% 12%, 47% 0, 77% 12%, 98% 43%, 84% 86%, 55% 100%, 22% 95%, 2% 55%);
  background:
    radial-gradient(circle at 31% 50%, #faf4ff 0 3%, #d6b8ff 4% 5%, transparent 6%),
    radial-gradient(circle at 49% 38%, #faf4ff 0 3%, #d6b8ff 4% 5%, transparent 6%),
    conic-gradient(from 25deg at 50% 48%, #b49bd0 0 15%, #645780 15% 23%, #392e4e 23% 32%, #8c78ad 32% 46%, #5b506b 46% 55%, #a494c3 55% 70%, #736485 70% 84%, #ba9fd6 84%);
}
.silicon i {
  height: 32%; width: 21%;
  clip-path: polygon(49% 0, 94% 28%, 77% 93%, 25% 100%, 0 64%);
  background: linear-gradient(115deg, #efd8ff, #9e85bb 43%, #4f3e69 46%, #8776a3);
}
.silicon i:nth-child(1) { left: 12%; bottom: 14%; rotate: -25deg; }
.silicon i:nth-child(2) { left: 62%; bottom: 13%; rotate: 19deg; }
.silicon i:nth-child(3) { right: 3%; top: 31%; rotate: 24deg; }
.silicon b { z-index: 1; inset: 5% 27% 68% 32%; clip-path: polygon(0 100%, 35% 20%, 55% 65%, 81% 0, 100% 100%); background: linear-gradient(165deg, #e7d9ff, #9478c8); }
.cryo::before {
  inset: 14% 22% 27% 9%;
  z-index: 1;
  border-radius: 60% 48% 60% 46%;
  background:
    radial-gradient(circle at 31% 43%, #c8effc 0 5%, transparent 8%),
    radial-gradient(circle at 47% 36%, #d9e8ff 0 4%, transparent 7%),
    radial-gradient(ellipse at 40% 40%, #ecf8ff90, #8cb4f5a0 33%, #4575a345 72%, #73b2df90);
  box-shadow: inset 0 0 12px #bee6ffbc;
}
.cryo i {
  width: 52%; height: 24%; right: 0;
  top: 30%;
  border-radius: 80% 6% 78% 6%;
  rotate: -20deg;
  background: linear-gradient(135deg, #99b5ff44, #9bcfff8c, #6ea6f078);
  border: 1px solid #a9d8fc8a;
}
.cryo i:nth-child(2) { top: 55%; rotate: 18deg; right: 5%; scale: .85; }
.cryo i:nth-child(3) { top: 66%; rotate: 54deg; right: 31%; scale: .75; }
.cryo b { inset: 44% 34% 37% 33%; z-index: 2; border-radius: 48%; border-top: 2px solid #cceeff; border-bottom: 1px solid #a5bbff; rotate: -23deg; }
[data-stage="juvenile"] .organism,
[data-stage="adult"] .organism,
[data-stage="mature"] .organism { scale: 1.15; }
[data-stage="adult"] .organism,
[data-stage="mature"] .organism { scale: 1.25; }
[data-stage="mature"] .organism { scale: 1.35; }
[data-stage="juvenile"] .organism b,
[data-stage="adult"] .organism b,
[data-stage="mature"] .organism b { display: block; }
[data-variant="1"] .carbon b { inset: 25% 53% 54% 26%; background: radial-gradient(circle, #15233f 0 26%, #d7ffe9 32% 48%, transparent 56%); }
[data-variant="1"] .silicon b { inset: 32% 33% 42% 42%; clip-path: polygon(51% 6%, 100% 50%, 52% 96%, 5% 50%); background: #e2d6ff; }
[data-variant="1"] .cryo b { inset: 23% 51% 52% 21%; border-top: 0; border-right: 1px solid #e1f4ff; rotate: 33deg; }
.habitat[data-mode="resting"] .organism,
.habitat[data-mode="hibernation"] .organism { animation-play-state: paused; opacity: .76; }
[data-base="silicon"] .egg {
  border-radius: 25%;
  clip-path: polygon(33% 0, 70% 6%, 100% 35%, 91% 76%, 61% 100%, 22% 92%, 0 56%, 10% 27%);
  background: conic-gradient(from 16deg at 49% 49%, #655272 0 19%, #a18bb4 19% 23%, #54365d 23% 37%, #251d3a 37% 52%, #8b6aab 52% 55%, #50345e 55% 78%, #c4a4db 78% 81%, #6e537f 81%);
  box-shadow: inset 0 0 28px #d5c2ffa0;
}
[data-base="cryo"] .egg {
  border-radius: 42% 59% 55% 42%;
  border-color: #b7dcff;
  background: radial-gradient(ellipse at 40% 39%, #ccedffbd 0 12%, #728cdca0 33%, #354e7b5c 64%, #92cef480 88%);
  box-shadow: 0 0 38px #82bbff65, inset 0 0 24px #d1e8ff7a;
}
.plinth {
  position: absolute;
  top: 65%;
  left: 50%;
  width: min(58%, 235px);
  height: 37px;
  translate: -50%;
  border: 1px solid #72c6e14a;
  border-radius: 50%;
  background: radial-gradient(ellipse, #4cb7c43e, #16233524 53%, transparent 72%);
}
.habitat-caption {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  padding: 1.3rem 1.45rem;
  background: linear-gradient(transparent, #0b1019d9 35%);
}
.caption-dot { margin-top: .55rem; background: var(--form); }
.habitat-caption p { margin: 0; }
.habitat-caption p:first-child { font-weight: 650; }
.habitat-caption p + p { color: var(--muted); font-size: .875rem; }
@keyframes float {
  0%, 100% { transform: translateY(3px) rotate(7deg); }
  50% { transform: translateY(-8px) rotate(3deg); }
}

.console { min-width: 0; padding: clamp(20px, 4vw, 48px); align-self: center; }
h1, h2 { margin: 0; line-height: 1.14; letter-spacing: -.025em; }
h1 { font-size: clamp(1.9rem, 3.7vw, 3.2rem); }
h2 { font-size: clamp(1.35rem, 3.2vw, 2rem); }
.lead { color: var(--muted); margin: .7rem 0 1.3rem; }
.choices { display: grid; gap: .55rem; margin: 0 0 1.1rem; padding: 0; border: 0; }
.choice {
  position: relative;
  display: grid;
  grid-template-columns: 2.45rem minmax(0, 1fr) 1.1rem;
  align-items: center;
  gap: .6rem;
  padding: .6rem .75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #151927;
  cursor: pointer;
}
.choice:hover { border-color: #6a7a95; }
.choice:has(input:checked) { border-color: var(--form); background: #1b2532; }
.choice:has(input:focus-visible) { outline: 2px solid var(--amber); outline-offset: 2px; }
.choice input { margin: 0; accent-color: var(--form); width: 1rem; height: 1rem; }
.choice strong, .choice small { display: block; }
.choice small { color: var(--muted); font-size: .87rem; }
.form-mark {
  width: 1.8rem;
  aspect-ratio: 1;
  margin-left: .1rem;
  border: 1px solid var(--form);
  border-radius: 75% 25% 75% 25%;
  background: radial-gradient(ellipse at 34% 22%, var(--form), transparent 83%);
  transform: rotate(16deg);
  box-shadow: 0 0 12px color-mix(in srgb, var(--form), transparent 75%);
}
[data-base="silicon"] .form-mark { border-radius: 75% 75% 42% 30%; transform: rotate(0); }
[data-base="cryo"] .form-mark { border-radius: 64% 57% 47% 60%; transform: rotate(-15deg); }

.button {
  min-height: 46px;
  padding: .6rem .9rem;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 650;
  line-height: 1.27;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
}
.button:hover { filter: brightness(1.16); }
.button:disabled { cursor: default; opacity: .5; filter: none; }
.primary { background: #75e2e8; color: #0a171e; }
.secondary { background: #1d2737; border-color: #3a4b64; }
.danger { background: #502930; border-color: #99646b; }
.text-button { color: var(--muted); font-size: .875rem; padding-inline: .45rem; }
.text-button:hover { color: var(--cyan); }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: .72rem 1rem; margin-bottom: 1.15rem; }
.metric-label { display: flex; justify-content: space-between; gap: .4rem; font-size: .875rem; }
.metric-number { color: var(--muted); font-variant-numeric: tabular-nums; }
meter { display: block; width: 100%; height: .45rem; margin-top: .35rem; appearance: none; }
meter::-webkit-meter-bar { background: #293344; border: 0; border-radius: 5px; }
meter::-webkit-meter-optimum-value { background: #70dbc7; border-radius: 5px; }
meter::-webkit-meter-suboptimum-value { background: #ffc285; border-radius: 5px; }
meter::-webkit-meter-even-less-good-value { background: #f5878e; border-radius: 5px; }
meter::-moz-meter-bar { background: #70dbc7; border-radius: 5px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.care { text-align: left; }
.care small, .care span { display: block; }
.care small { margin-bottom: .18rem; font-size: .875rem; font-weight: 500; opacity: .86; }
.menus { display: flex; flex-wrap: wrap; column-gap: .3rem; border-top: 1px solid var(--border); margin-top: 1rem; padding-top: .25rem; }
.reset { margin-left: auto; }
.feedback { color: var(--cyan); font-size: .875rem; margin: .7rem 0 0; }
.feedback:empty { margin: 0; }
.notice { color: var(--muted); font-size: 1rem; }
.storage { color: var(--amber); font-size: .875rem; }
dialog {
  width: min(480px, calc(100% - 32px));
  border: 1px solid #485675;
  border-radius: 18px;
  color: var(--ink);
  background: #131925;
  padding: 1.45rem;
}
dialog::backdrop { background: #04070cca; }
dialog p { color: var(--muted); margin: .75rem 0; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .55rem; margin-top: 1.2rem; }
.passport { display: grid; grid-template-columns: 1fr auto; gap: .5rem 1rem; }
.passport dt { color: var(--muted); }
.passport dd { margin: 0; text-align: right; }

@media (max-width: 780px) {
  .shell { width: min(100% - 28px, 540px); }
  .top { min-height: 65px; }
  .game { padding-block: 18px 34px; }
  .workbench { grid-template-columns: minmax(0, 1fr); border-radius: 18px; }
  .habitat { min-height: clamp(176px, 42vw, 243px); border-right: 0; border-bottom: 1px solid var(--border); }
  .orbit { width: 160px; }
  .orbit-inner { width: 128px; }
  .specimen { width: 78px; }
  .plinth { width: 108px; height: 21px; }
  .habitat-caption { padding: .6rem .8rem; }
  .lead { margin-bottom: 1rem; }
}
@media (max-width: 380px) {
  .console { padding: 16px; }
  .metrics { gap: .55rem .65rem; }
  .actions { grid-template-columns: 1fr; }
  .care { display: flex; flex-direction: column; justify-content: center; }
  .reset { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}


.organism-condition { color: var(--form); font-size: .95rem; margin-block: 0 .85rem; }
.additional-actions { margin-top: .55rem; }
.additional-actions .button { font-size: .875rem; }
dialog { max-height: min(85vh, 640px); overflow: auto; }
dialog ul { color: var(--muted); line-height: 1.75; padding-left: 1.4rem; }
