:root {
  --void: #07040a;
  --tissue: #14080f;
  --membrane: #3a1424;
  --vein: #c42a4a;
  --pulse: #ff2d55;
  --bio: #3dffc4;
  --ice: #7af0ff;
  --nucleus: #ffc857;
  --cyto: rgba(255, 214, 226, 0.78);
  --mute: rgba(255, 214, 226, 0.42);
  --glass: rgba(18, 8, 14, 0.62);
  --line: rgba(255, 45, 85, 0.28);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  --font: "Outfit", system-ui, sans-serif;
  --serif: "Cormorant Garamond", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-biome="coral"] {
  --void: #12070a;
  --tissue: #2a0e14;
  --membrane: #6a2430;
  --vein: #ff6b4a;
  --pulse: #ff8a5b;
  --bio: #ffd29d;
  --ice: #ffc2c2;
  --nucleus: #ffe08a;
  --line: rgba(255, 107, 74, 0.32);
}

html[data-biome="mycelium"] {
  --void: #06100b;
  --tissue: #0c1a12;
  --membrane: #1d3a28;
  --vein: #7dffa1;
  --pulse: #b8ff4d;
  --bio: #7dffa1;
  --ice: #e7ffb0;
  --nucleus: #f4e07a;
  --line: rgba(125, 255, 161, 0.28);
}

html[data-biome="aurora"] {
  --void: #070816;
  --tissue: #101428;
  --membrane: #2a2458;
  --vein: #c084fc;
  --pulse: #7af0ff;
  --bio: #c084fc;
  --ice: #e9d5ff;
  --nucleus: #3dffc4;
  --line: rgba(192, 132, 252, 0.35);
}

html[data-stage="juvenile"] .mark { letter-spacing: 0.4em; }
html[data-stage="adult"] .heart { box-shadow: 0 0 0 6px rgba(255,45,85,0.16), 0 10px 36px rgba(61,255,196,0.28); }
html[data-stage="elder"] .mark { letter-spacing: 0.5em; color: var(--bio); }
html[data-stage="myth"] .heart {
  box-shadow: 0 0 0 8px rgba(192,132,252,0.2), 0 0 48px var(--pulse), 0 0 90px var(--bio);
}
html[data-stage="myth"] .whisper { color: var(--nucleus); }

html[data-season="wiosna"] .veil {
  background:
    radial-gradient(ellipse at 50% 120%, rgba(125, 255, 161, 0.14), transparent 52%),
    radial-gradient(ellipse at 20% 10%, rgba(255, 200, 87, 0.08), transparent 40%);
}
html[data-season="lato"] .veil {
  background:
    radial-gradient(ellipse at 50% 120%, rgba(255, 107, 74, 0.16), transparent 52%),
    radial-gradient(ellipse at 80% 10%, rgba(255, 200, 87, 0.1), transparent 40%);
}
html[data-season="jesien"] .veil {
  background:
    radial-gradient(ellipse at 50% 120%, rgba(196, 42, 74, 0.16), transparent 52%),
    radial-gradient(ellipse at 70% 20%, rgba(255, 138, 91, 0.08), transparent 42%);
}
html[data-season="zima"] .veil {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(122, 240, 255, 0.1), transparent 50%),
    radial-gradient(ellipse at 50% 120%, rgba(80, 90, 140, 0.18), transparent 55%);
}
html[data-season="zima"] .whisper { color: var(--ice); }
html[data-sick="1"] .veil { filter: grayscale(0.45) saturate(0.55); }
html[data-sick="1"] .heart { filter: grayscale(0.3); }
html[data-sick="1"] .whisper { color: var(--mute); }

html[data-biome="krew"] {
  --void: #0c0304;
  --tissue: #1a0608;
  --membrane: #4a1018;
  --vein: #ff1f3d;
  --pulse: #ff3355;
  --bio: #ff8fa0;
  --ice: #ffd0d6;
  --nucleus: #ffb020;
  --line: rgba(255, 31, 61, 0.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--void); color: var(--cyto); font-family: var(--font); overflow: hidden; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
::selection { background: var(--pulse); color: #fff; }

/* ——— boot ——— */
.boot {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 40%, #1a0810 0%, var(--void) 62%);
}
.boot.leave { animation: fadeOut 0.9s var(--ease) forwards; pointer-events: none; }
#boot-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.boot-core {
  position: absolute; width: 220px; height: 220px;
  display: grid; place-items: center; pointer-events: none;
}
.boot-nucleus {
  width: 28px; height: 28px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, var(--pulse) 45%, #7a1028);
  box-shadow: 0 0 30px var(--pulse), 0 0 80px rgba(255, 45, 85, 0.45);
  animation: beat 1.05s ease-in-out infinite;
}
.boot-ring, .boot-ring.delay {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1px solid rgba(255, 45, 85, 0.28);
  animation: grow 2.8s var(--ease) infinite;
}
.boot-ring.delay { animation-delay: 1.4s; }
.boot-copy {
  position: relative; z-index: 2; text-align: center;
  margin-top: 280px; width: min(560px, 88vw);
}
.boot-mark {
  font-family: var(--serif); font-size: clamp(42px, 8vw, 72px);
  letter-spacing: 0.28em; font-weight: 400; color: #fff;
}
.boot-sub {
  margin-top: 4px; letter-spacing: 0.42em; text-transform: uppercase;
  font-size: 11px; color: var(--mute);
}
.boot-log {
  list-style: none; margin: 28px 0 18px; text-align: left;
  font-family: var(--mono); font-size: 12px; line-height: 1.7; color: var(--bio);
  min-height: 10.2em;
}
.boot-log li { opacity: 0; transform: translateY(6px); animation: in 0.45s var(--ease) forwards; }
.boot-log .ms { color: var(--mute); margin-right: 10px; }
.boot-skip {
  margin-top: 8px; padding: 10px 16px;
  color: var(--mute); letter-spacing: 0.08em; font-size: 12px;
  border: 1px solid transparent; border-radius: 999px;
}
.boot-skip:hover { color: #fff; border-color: var(--line); }

/* ——— os shell ——— */
.os { position: fixed; inset: 0; }
#biome { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.veil {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 120%, rgba(255, 45, 85, 0.12), transparent 50%),
    radial-gradient(ellipse at 80% 10%, rgba(61, 255, 196, 0.06), transparent 40%);
}
.noise {
  position: absolute; inset: 0; pointer-events: none; opacity: var(--pheno-noise, 0.07); mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.nerve {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr minmax(0, 520px) 1fr;
  align-items: center; gap: 16px;
  padding: 14px 22px 10px;
  background: linear-gradient(to bottom, rgba(7,4,10,0.72), transparent);
}
.mark {
  font-family: var(--serif); letter-spacing: 0.34em; font-size: 15px; color: #fff;
}
.gen { margin-left: 12px; font-family: var(--mono); font-size: 11px; color: var(--bio); }
.whisper {
  text-align: center; font-family: var(--serif); font-style: var(--pheno-voice, italic);
  font-size: 16px; color: var(--cyto); min-height: 1.2em;
  transition: opacity 0.6s ease;
}
.whisper.dim { opacity: 0.2; }
.nerve-right { display: flex; justify-content: flex-end; align-items: center; gap: 14px; }
.age, .clock { font-family: var(--mono); font-size: 12px; color: var(--mute); font-variant-numeric: tabular-nums; }
.ghost {
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--mute); padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px;
}
.ghost:hover { color: #fff; }

.desktop {
  position: absolute; inset: 64px 18px 92px;
  display: flex; flex-direction: column; flex-wrap: wrap; align-content: flex-start;
  gap: 10px; z-index: 5;
}
.desk-icon {
  width: 92px; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 10px 6px; border-radius: 18px; color: var(--cyto);
  background: transparent; transition: background 0.25s;
  text-decoration: none;
}
.desk-icon:hover, .desk-icon:focus-visible { background: rgba(255,255,255,0.05); }
.desk-icon .cell {
  width: 44px; height: 44px; border-radius: 42% 58% 50% 50% / 42% 42% 58% 58%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.35), transparent 28%),
              linear-gradient(160deg, var(--membrane), rgba(7,4,10,0.4));
  border: 1px solid var(--line);
  box-shadow: inset 0 0 12px rgba(255,45,85,0.25), 0 8px 18px rgba(0,0,0,0.35);
  animation: morph 7s ease-in-out infinite;
  font-size: 18px;
}
.desk-icon b { font-weight: 400; font-size: 11px; letter-spacing: 0.04em; text-align: center; }

.windows { position: absolute; inset: 0; z-index: 15; pointer-events: none; }
.win {
  position: absolute; pointer-events: auto;
  min-width: 280px; min-height: 200px;
  display: flex; flex-direction: column;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--pheno-win, 22px);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.06);
  backdrop-filter: blur(18px) saturate(1.2);
  overflow: hidden;
  animation: birth 0.55s var(--ease);
}
.win.dying { animation: death 0.42s var(--ease) forwards; }
.win.focus { border-color: rgba(255, 45, 85, 0.55); box-shadow: var(--shadow), 0 0 0 1px rgba(255,45,85,0.2), inset 0 0 40px rgba(255,45,85,0.05); }
.win-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px 8px; cursor: grab; user-select: none;
  background: linear-gradient(to bottom, rgba(255,255,255,0.04), transparent);
}
.win-bar:active { cursor: grabbing; }
.win-dots { display: flex; gap: 6px; }
.win-dots i {
  width: 11px; height: 11px; border-radius: 50%; display: block; border: 0;
  background: var(--membrane);
}
.win-dots .x { background: #ff5a6a; }
.win-dots .n { background: var(--nucleus); }
.win-dots .m { background: var(--bio); }
.win-dots button {
  width: 11px; height: 11px; border-radius: 50%; padding: 0; line-height: 0;
}
.win-title {
  flex: 1; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--mute);
}
.win-body { flex: 1; min-height: 0; overflow: auto; padding: 6px 14px 16px; }
.win-resize {
  position: absolute; right: 4px; bottom: 4px; width: 16px; height: 16px; cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 50%, var(--pulse) 50%);
  opacity: 0.45; border-radius: 4px;
}

.vitals {
  position: absolute; right: 18px; top: 68px; z-index: 12;
  width: 148px; display: flex; flex-direction: column; gap: 10px;
  padding: 12px 12px 14px;
  border: 1px solid var(--line); border-radius: 18px;
  background: rgba(10, 5, 10, 0.4); backdrop-filter: blur(10px);
}
.vital { display: grid; gap: 4px; }
.vital span { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--mute); }
.vital b { font-family: var(--mono); font-size: 20px; color: var(--pulse); font-weight: 500; }
.bar { height: 4px; background: rgba(255,255,255,0.08); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 30%; background: linear-gradient(90deg, var(--pulse), var(--bio)); border-radius: inherit; }

.spine {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; align-items: flex-end; justify-content: center; gap: 22px;
  padding: 0 22px 16px;
  background: linear-gradient(to top, rgba(7,4,10,0.78), transparent);
}
.heart {
  width: var(--pheno-heart, 52px); height: var(--pheno-heart, 52px); border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff8aa0, var(--pulse) 50%, #6a1020);
  box-shadow: 0 0 0 6px rgba(255,45,85,0.12), 0 10px 30px rgba(255,45,85,0.35);
  display: grid; place-items: center;
  animation: beat 1.05s ease-in-out infinite;
}
.heart-core {
  width: 14px; height: 14px; border-radius: 50%; background: #fff8;
}
.dock {
  display: flex; gap: var(--pheno-gap, 8px); padding: 8px;
  background: rgba(12, 6, 12, 0.55);
  border: 1px solid var(--line); border-radius: 22px;
  backdrop-filter: blur(16px);
}
.dock button {
  width: 46px; height: 46px; border-radius: 16px;
  display: grid; place-items: center;
  background: radial-gradient(circle at 30% 25%, rgba(255,255,255,0.16), transparent 40%),
              var(--tissue);
  border: 1px solid var(--line);
  transition: transform 0.25s var(--ease), border-color 0.2s;
  font-size: 18px;
}
.dock button:hover { transform: translateY(-7px); border-color: var(--pulse); }
.dock button.open { box-shadow: 0 0 0 1px var(--bio); }
.clock { position: absolute; right: 22px; bottom: 28px; }

/* ——— apps ——— */
.app-h {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 4px 0 12px; font-size: 12px; color: var(--mute); letter-spacing: 0.08em;
}
.app-h strong { color: #fff; font-weight: 500; letter-spacing: 0; font-size: 16px; }

.term {
  background: rgba(0,0,0,0.35); border-radius: 14px; padding: 12px;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.55; min-height: 100%;
}
.term-out { white-space: pre-wrap; word-break: break-word; color: var(--bio); }
.term-out .err { color: #ff8aa0; }
.term-out .dim { color: var(--mute); }
.term-row { display: flex; gap: 8px; margin-top: 6px; }
.term-row span { color: var(--pulse); }
.term-row input {
  flex: 1; background: none; border: 0; outline: none; color: #fff; caret-color: var(--bio);
}

.cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.file-cell {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 8px; border-radius: 16px; background: rgba(255,255,255,0.03);
  border: 1px solid transparent; color: var(--cyto); font-size: 11px; text-align: center;
}
.file-cell:hover { border-color: var(--line); }
.file-cell .blob {
  width: 36px; height: 36px;
  border-radius: 40% 60% 55% 45% / 50% 40% 60% 50%;
  background: radial-gradient(circle at 30% 30%, #fff8, var(--bio));
  animation: morph 6s ease-in-out infinite;
}
.file-cell.dir .blob { background: radial-gradient(circle at 30% 30%, #fff8, var(--nucleus)); }
.crumb { font-family: var(--mono); font-size: 11px; color: var(--mute); margin-bottom: 10px; }

.procs { display: flex; flex-direction: column; gap: 8px; }
.proc {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 10px;
  padding: 10px 12px; border-radius: 14px; background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.04);
}
.proc b { font-weight: 500; font-size: 13px; }
.proc em { font-style: normal; font-size: 11px; color: var(--mute); }
.proc .life { height: 3px; grid-column: 1 / -1; background: #fff1; border-radius: 99px; overflow: hidden; }
.proc .life i { display: block; height: 100%; background: var(--bio); }

.notes { width: 100%; min-height: 220px; resize: vertical; background: rgba(0,0,0,0.28);
  border: 1px solid var(--line); border-radius: 14px; padding: 12px; outline: none; color: var(--cyto); }
.row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.btn {
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: rgba(255,45,85,0.12); font-size: 12px; letter-spacing: 0.06em;
}
.btn:hover { background: rgba(255,45,85,0.28); }
.btn.ghost { background: transparent; }

.set { display: flex; flex-direction: column; gap: 14px; }
.set label { font-size: 12px; color: var(--mute); display: grid; gap: 6px; }
.set select, .set input[type="range"] { accent-color: var(--pulse); }
.set select {
  background: rgba(0,0,0,0.35); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; color: #fff;
}

.lab-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { padding: 12px; border-radius: 14px; background: rgba(0,0,0,0.28); }
.stat span { display: block; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--mute); }
.stat b { font-family: var(--mono); font-size: 22px; color: var(--bio); font-weight: 500; }

.about { font-family: var(--serif); font-size: 20px; line-height: 1.45; }
.about p + p { margin-top: 10px; }
.about .tiny { font-family: var(--font); font-size: 12px; color: var(--mute); letter-spacing: 0.04em; }

/* sleep */
.sleep {
  position: fixed; inset: 0; z-index: 70;
  background: #030206;
}
#dream-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.sleep-copy {
  position: relative; z-index: 2; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding: 0 24px 80px; text-align: center;
}
.dream-text {
  font-family: var(--serif); font-style: italic; font-size: clamp(18px, 3vw, 28px);
  max-width: 22em; margin: 12px 0 20px; color: var(--cyto);
}

/* motion */
@keyframes beat {
  0%, 100% { transform: scale(1); }
  22% { transform: scale(1.16); }
  36% { transform: scale(0.96); }
  52% { transform: scale(1.08); }
}
@keyframes grow {
  from { transform: scale(0.35); opacity: 0.7; }
  to { transform: scale(1.25); opacity: 0; }
}
@keyframes in { to { opacity: 1; transform: none; } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes birth {
  from { opacity: 0; transform: scale(0.72); filter: blur(8px); }
  to { opacity: 1; transform: none; filter: none; }
}
@keyframes death {
  to { opacity: 0; transform: scale(0.4); filter: blur(10px); }
}
@keyframes morph {
  0%, 100% { border-radius: 42% 58% 50% 50% / 42% 42% 58% 58%; }
  50% { border-radius: 58% 42% 48% 52% / 52% 58% 42% 48%; }
}

@media (max-width: 720px) {
  .nerve { grid-template-columns: 1fr; text-align: center; }
  .nerve-right { justify-content: center; }
  .vitals { display: none; }
  .whisper { font-size: 14px; }
  .clock { display: none; }
  .kora-quick { max-width: 52vw; }
  .dock { max-width: 46vw; overflow-x: auto; }
}

.evo-toast {
  position: absolute; left: 50%; bottom: 96px; z-index: 30;
  transform: translate(-50%, 12px);
  max-width: min(560px, 86vw);
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(10, 5, 12, 0.78);
  backdrop-filter: blur(12px);
  font-family: var(--serif); font-style: italic; font-size: 15px;
  text-align: center; pointer-events: none;
  opacity: 0; transition: opacity 0.4s ease, transform 0.4s var(--ease);
}
.evo-toast.show { opacity: 1; transform: translate(-50%, 0); }

.genes { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.gene {
  display: grid; grid-template-columns: 86px 1fr 52px; gap: 8px; align-items: center;
  font-size: 11px; color: var(--mute);
}
.gene em { font-style: normal; font-family: var(--mono); font-size: 10px; text-align: right; }
.evo-log { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; max-height: 160px; overflow: auto; }
.evo-log .tiny { grid-column: 1 / -1; font-size: 11px; color: var(--bio); }
.desk-icon.evo-in { animation: birth 0.7s var(--ease); }

.kora-stream {
  height: 250px; overflow: auto; padding: 10px 12px;
  background: rgba(0,0,0,0.32); border-radius: 14px;
  font-family: var(--serif); font-size: 16px; line-height: 1.45;
}
.kora-line { margin: 0 0 8px; }
.kora-line.user { color: var(--mute); }
.kora-line.vitae { color: var(--cyto); }
.kora-form { display: flex; gap: 8px; margin-top: 10px; }
.kora-launch {
  border-color: var(--bio) !important;
  color: var(--bio) !important;
  letter-spacing: 0.2em;
}
.kora-quick {
  display: flex; align-items: center; gap: 6px;
  max-width: min(380px, 42vw);
}
.kora-quick input {
  flex: 1; min-width: 0;
  background: rgba(0,0,0,0.45); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 12px; outline: none;
}
.desk-icon[data-app="kora"] .cell {
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.35), transparent 28%),
              linear-gradient(160deg, var(--pulse), var(--membrane));
  font-family: var(--serif); font-size: 20px;
}

.kora-form input {
  flex: 1; background: rgba(0,0,0,0.35); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 14px; outline: none;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
