:root {
  --ink: #e8ffe0;
  --bleed: #ff2a6d;
  --halo: #00ffd1;
  --bone: #fff8d6;
  --void: #05020a;
}

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

html, body {
  height: 100%;
  background: var(--void);
  color: var(--ink);
  font-family: "Courier New", "Courier", ui-monospace, monospace;
  overflow: hidden;
  cursor: default;
  -webkit-font-smoothing: none;
}

body::selection, body *::selection {
  background: var(--bleed);
  color: var(--void);
}

/* ---------- background layers ---------- */
#shader, #trails {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
#shader { z-index: 0; }
#trails { z-index: 2; mix-blend-mode: screen; }

#scanlines {
  position: fixed; inset: 0;
  z-index: 50;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(0,0,0,0.15) 0px,
      rgba(0,0,0,0.15) 1px,
      transparent 2px,
      transparent 3px
    );
  mix-blend-mode: multiply;
  animation: scanroll 6s linear infinite;
}
@keyframes scanroll {
  from { background-position-y: 0; }
  to   { background-position-y: 120px; }
}

#vignette {
  position: fixed; inset: 0;
  z-index: 51;
  pointer-events: none;
  background: radial-gradient(ellipse at center,
    transparent 40%, rgba(0,0,0,0.75) 100%);
}

#aberration {
  position: fixed; inset: 0;
  z-index: 52;
  pointer-events: none;
  background: transparent;
  box-shadow: inset 0 0 200px rgba(255,42,109,0.08),
              inset 0 0 400px rgba(0,255,209,0.04);
  animation: pulse 7s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { filter: hue-rotate(0deg); }
  50%     { filter: hue-rotate(40deg); }
}

/* ---------- boot screen ---------- */
#boot {
  position: fixed; inset: 0;
  z-index: 100;
  background: #000;
  color: var(--halo);
  padding: 4vh 4vw;
  font-size: 14px;
  line-height: 1.4;
  overflow: hidden;
  transition: opacity 1.2s;
}
#boot.gone { opacity: 0; pointer-events: none; }
#bootlog { white-space: pre-wrap; }

/* ---------- title ---------- */
#titlebar {
  position: fixed;
  top: 3vh;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  text-align: center;
  pointer-events: none;
}
h1.glitch {
  font-size: clamp(2.5rem, 8vw, 7rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  color: var(--bone);
  text-shadow:
    0 0 10px var(--halo),
    0 0 30px var(--bleed);
  position: relative;
}
h1.glitch::before,
h1.glitch::after {
  content: attr(data-text);
  position: absolute; inset: 0;
  mix-blend-mode: screen;
}
h1.glitch::before {
  color: var(--bleed);
  animation: glitchA 3.2s infinite steps(1);
  clip-path: polygon(0 0,100% 0,100% 33%,0 33%);
}
h1.glitch::after {
  color: var(--halo);
  animation: glitchB 2.7s infinite steps(1);
  clip-path: polygon(0 66%,100% 66%,100% 100%,0 100%);
}
@keyframes glitchA {
  0%,92%,100% { transform: translate(0,0); }
  93% { transform: translate(-4px,-1px); }
  95% { transform: translate(3px,2px); }
  97% { transform: translate(-2px,3px); }
}
@keyframes glitchB {
  0%,88%,100% { transform: translate(0,0); }
  89% { transform: translate(3px,1px); }
  91% { transform: translate(-3px,-2px); }
  93% { transform: translate(2px,2px); }
}
.sub {
  font-size: 0.9rem;
  letter-spacing: 0.4em;
  color: var(--ink);
  opacity: 0.7;
  text-transform: uppercase;
}

/* ---------- ascii rain ---------- */
#ascii-rain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
  font-family: "Courier New", monospace;
  font-size: 14px;
  line-height: 1;
  color: var(--halo);
  opacity: 0.35;
}
.drop {
  position: absolute;
  top: -20%;
  white-space: pre;
  writing-mode: vertical-rl;
  text-orientation: upright;
  animation: fall linear infinite;
  text-shadow: 0 0 6px var(--halo);
}
@keyframes fall {
  to { transform: translateY(130vh); }
}

/* ---------- eyes ---------- */
#eyes {
  position: fixed; inset: 0;
  z-index: 5;
  pointer-events: none;
}
.eye {
  position: absolute;
  width: 64px; height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%,
    var(--bone) 0%, var(--bone) 45%,
    rgba(255,248,214,0.2) 46%, transparent 70%);
  filter: drop-shadow(0 0 10px var(--bleed));
  animation: blink 5s infinite;
}
.eye::after {
  content: "";
  position: absolute;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle, #000 55%, var(--bleed) 60%, #000 70%);
  top: 50%; left: 50%;
  transform: translate(-50%,-50%)
             translate(var(--px,0px), var(--py,0px));
  transition: transform 0.08s linear;
}
@keyframes blink {
  0%,94%,100% { transform: scaleY(1); }
  95%,97%     { transform: scaleY(0.05); }
}

/* ---------- windows ---------- */
#windows {
  position: fixed; inset: 0;
  z-index: 20;
  pointer-events: none;
}
.win {
  position: absolute;
  min-width: 220px;
  max-width: 420px;
  background: rgba(5,2,10,0.85);
  border: 1px solid var(--halo);
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.8),
    0 0 24px rgba(0,255,209,0.35),
    0 0 60px rgba(255,42,109,0.15);
  color: var(--ink);
  font-size: 13px;
  pointer-events: auto;
  backdrop-filter: blur(2px);
  animation: winIn 0.35s ease-out;
}
@keyframes winIn {
  from { transform: translate(0,12px) scale(0.96); opacity: 0; filter: blur(4px); }
  to   { transform: translate(0,0)     scale(1);    opacity: 1; filter: blur(0);  }
}
.win .bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  background: linear-gradient(90deg, var(--bleed), var(--halo));
  color: #000;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: grab;
  user-select: none;
}
.win .bar:active { cursor: grabbing; }
.win .bar .x {
  cursor: pointer;
  padding: 0 6px;
}
.win .body {
  padding: 12px 14px;
  max-height: 50vh;
  overflow-y: auto;
  line-height: 1.5;
}
.win .body::-webkit-scrollbar { width: 6px; }
.win .body::-webkit-scrollbar-thumb { background: var(--halo); }

.oracle-text {
  color: var(--bone);
  text-shadow: 0 0 4px var(--halo);
  font-style: italic;
}
.oracle-text em {
  color: var(--bleed);
  font-style: normal;
  text-shadow: 0 0 6px var(--bleed);
}

/* ---------- desktop icons ---------- */
#desktop {
  position: fixed; inset: 0;
  z-index: 4;
  pointer-events: none;
}
.icon {
  position: absolute;
  width: 86px;
  text-align: center;
  color: var(--bone);
  text-shadow: 0 0 6px var(--bleed), 1px 1px 0 #000;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  pointer-events: auto;
  user-select: none;
  padding: 6px 4px;
  border: 1px dashed transparent;
}
.icon:hover {
  border-color: var(--halo);
  background: rgba(0,255,209,0.08);
}
.icon .glyph {
  display: block;
  font-size: 36px;
  line-height: 1;
  filter: drop-shadow(0 0 8px var(--bleed));
  margin-bottom: 4px;
  animation: iconFloat 6s ease-in-out infinite;
}
.icon:nth-child(2n) .glyph { animation-delay: -2s; }
.icon:nth-child(3n) .glyph { animation-delay: -4s; }
@keyframes iconFloat {
  0%,100% { transform: translateY(0) rotate(-1deg); }
  50%     { transform: translateY(-4px) rotate(1deg); }
}

/* ---------- taskbar ---------- */
#taskbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  background: linear-gradient(180deg, #1a0028 0%, #05020a 100%);
  border-top: 1px solid var(--halo);
  box-shadow: 0 -4px 20px rgba(0,255,209,0.2);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--halo);
  height: 32px;
}
#start-btn {
  background: linear-gradient(180deg, var(--bleed), #800020);
  color: #000;
  border: 1px solid var(--bone);
  padding: 4px 12px;
  font-family: inherit;
  font-weight: 900;
  font-size: 11px;
  letter-spacing: 0.15em;
  cursor: pointer;
  box-shadow: inset 0 0 6px rgba(255,255,255,0.3), 0 0 10px var(--bleed);
  text-transform: uppercase;
}
#start-btn:hover { filter: brightness(1.3); }
#start-btn:active { filter: brightness(0.8); }

#task-list {
  flex: 1;
  display: flex;
  gap: 4px;
  overflow: hidden;
}
.task-pill {
  background: rgba(0,0,0,0.6);
  border: 1px solid var(--halo);
  padding: 3px 10px;
  cursor: pointer;
  color: var(--ink);
  font-size: 10px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-pill:hover { background: rgba(0,255,209,0.15); }
.task-pill.active { border-color: var(--bleed); color: var(--bone); }

#task-right {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 0 8px;
}
#hud-status::before {
  content: "●";
  color: var(--bleed);
  margin-right: 0.4em;
  animation: blink2 1.1s steps(2) infinite;
}
#tray-clock {
  font-weight: 700;
  color: var(--bone);
  text-shadow: 0 0 4px var(--halo);
}
@keyframes blink2 { 50% { opacity: 0.2; } }

/* ---------- start menu ---------- */
#start-menu {
  position: fixed;
  bottom: 32px; left: 8px;
  z-index: 46;
  width: 280px;
  background: rgba(5,2,10,0.95);
  border: 1px solid var(--halo);
  box-shadow: 0 0 40px rgba(0,255,209,0.4), 4px -4px 0 var(--bleed);
  backdrop-filter: blur(4px);
  padding: 0;
  animation: startIn 0.2s ease-out;
}
#start-menu.hidden { display: none; }
@keyframes startIn {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
#start-menu .header {
  background: linear-gradient(90deg, var(--bleed), var(--halo));
  color: #000;
  padding: 8px 12px;
  font-weight: 900;
  letter-spacing: 0.2em;
  font-size: 11px;
  text-transform: uppercase;
}
#start-menu .item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  color: var(--ink);
  font-size: 12px;
  border-bottom: 1px solid rgba(0,255,209,0.1);
}
#start-menu .item:hover {
  background: var(--bleed);
  color: #000;
}
#start-menu .item .g {
  font-size: 18px;
  width: 24px;
  text-align: center;
  filter: drop-shadow(0 0 4px var(--halo));
}
#start-menu .item:hover .g { filter: none; }

/* ---------- terminal ---------- */
.terminal {
  font-family: "Courier New", monospace;
  font-size: 13px;
  color: #7fff9f;
  background: #02060a;
  padding: 10px 12px;
  min-height: 320px;
  max-height: 60vh;
  overflow-y: auto;
  text-shadow: 0 0 4px #7fff9f;
}
.terminal .line { white-space: pre-wrap; word-break: break-word; }
.terminal .err  { color: var(--bleed); text-shadow: 0 0 4px var(--bleed); }
.terminal .dim  { opacity: 0.55; }
.terminal .hi   { color: var(--bone); }
.terminal .prompt { color: var(--halo); }
.term-line {
  display: flex;
  gap: 6px;
  align-items: baseline;
}
.term-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--bone);
  font-family: inherit;
  font-size: inherit;
  flex: 1;
  caret-color: var(--bone);
  text-shadow: 0 0 4px var(--halo);
}

/* ---------- gallery (uncanny faces) ---------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px;
  background: #0a0a14;
}
.gallery .face-cell {
  background: #000;
  border: 1px solid var(--halo);
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
  position: relative;
}
.gallery .face-cell svg { width: 100%; height: 100%; display: block; }
.gallery .face-cell .cap {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.75);
  color: var(--bone);
  font-size: 9px;
  padding: 2px 4px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-top: 1px solid var(--halo);
  text-align: center;
}
.gallery .face-cell:hover { box-shadow: 0 0 12px var(--bleed); }

/* self-writing doc */
.document {
  font-family: "Georgia", serif;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink);
  background: #0d0810;
  padding: 20px 24px;
  min-height: 260px;
  max-height: 55vh;
  overflow-y: auto;
  white-space: pre-wrap;
}
.document .caret {
  display: inline-block;
  width: 8px;
  background: var(--bone);
  animation: caret 0.8s steps(2) infinite;
  margin-left: 1px;
}
.document .wrong {
  color: var(--bleed);
  text-decoration: line-through;
  text-decoration-color: var(--bleed);
}
@keyframes caret { 50% { opacity: 0; } }

/* confessional */
.confess {
  padding: 14px;
  background: #0a0612;
}
.confess textarea {
  width: 100%;
  min-height: 180px;
  background: #02060a;
  color: var(--bone);
  border: 1px solid var(--halo);
  font-family: inherit;
  font-size: 13px;
  padding: 10px;
  outline: none;
  resize: vertical;
  text-shadow: 0 0 4px var(--halo);
}
.confess .label {
  color: var(--halo);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* system error */
.sysmsg {
  padding: 16px 20px;
  background: #0a0612;
  color: var(--ink);
  min-width: 280px;
}
.sysmsg .icon-big {
  font-size: 42px;
  float: left;
  margin-right: 14px;
  filter: drop-shadow(0 0 10px var(--bleed));
}
.sysmsg p { margin-bottom: 10px; }
.sysmsg .btns {
  clear: both;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 14px;
}
.sysmsg button {
  background: rgba(0,0,0,0.6);
  color: var(--halo);
  border: 1px solid var(--halo);
  padding: 4px 14px;
  font-family: inherit;
  cursor: pointer;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.1em;
}
.sysmsg button:hover { background: var(--halo); color: #000; }

/* breathing face in a single big window */
.bigface {
  background: #000;
  padding: 0;
}
.bigface svg { width: 100%; height: 420px; display: block; }

/* shake (poltergeist close-refusal) */
@keyframes shake {
  0%,100% { transform: translate(0,0); }
  20% { transform: translate(-6px, 2px) rotate(-0.6deg); }
  40% { transform: translate(5px, -2px) rotate(0.5deg); }
  60% { transform: translate(-4px, 1px) rotate(-0.4deg); }
  80% { transform: translate(4px, -1px) rotate(0.3deg); }
}

/* ---------- file explorer ---------- */
.win-explorer .body { padding: 0; max-height: none; overflow: hidden; }
.explorer {
  display: flex;
  flex-direction: column;
  background: #05020a;
  color: var(--ink);
  font-size: 12px;
  min-height: 420px;
  max-height: 60vh;
}
.exp-toolbar {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 6px 8px;
  background: rgba(0,0,0,0.6);
  border-bottom: 1px solid var(--halo);
}
.exp-btn {
  background: rgba(0,0,0,0.5);
  color: var(--halo);
  border: 1px solid var(--halo);
  width: 26px; height: 22px;
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  padding: 0;
}
.exp-btn:hover { background: var(--halo); color: #000; }
.exp-path {
  flex: 1;
  background: #02060a;
  border: 1px solid var(--halo);
  padding: 3px 8px;
  color: var(--bone);
  font-family: inherit;
  font-size: 11px;
  outline: none;
  letter-spacing: 0.05em;
}
.exp-main {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}
.exp-side {
  width: 150px;
  border-right: 1px solid rgba(0,255,209,0.3);
  background: rgba(0,0,0,0.4);
  overflow-y: auto;
  padding: 4px 0;
  font-size: 11px;
}
.exp-side-row {
  padding: 3px 6px;
  cursor: pointer;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.exp-side-row:hover { background: rgba(255,42,109,0.25); color: var(--bone); }
.exp-side-g { color: var(--halo); margin-right: 4px; }
.exp-body {
  flex: 1;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 6px;
  align-content: start;
  overflow-y: auto;
  background: radial-gradient(ellipse at top, rgba(255,42,109,0.06), transparent 70%);
}
.exp-cell {
  text-align: center;
  padding: 8px 4px;
  cursor: pointer;
  border: 1px dashed transparent;
  user-select: none;
}
.exp-cell:hover { border-color: var(--halo); background: rgba(0,255,209,0.08); }
.exp-cell.sel { border-color: var(--bleed); background: rgba(255,42,109,0.15); }
.exp-glyph {
  font-size: 30px;
  line-height: 1;
  color: var(--bone);
  filter: drop-shadow(0 0 6px var(--bleed));
  margin-bottom: 4px;
}
.exp-cell.dir .exp-glyph { color: var(--halo); filter: drop-shadow(0 0 6px var(--halo)); }
.exp-name {
  font-size: 10px;
  color: var(--ink);
  word-break: break-word;
  letter-spacing: 0.02em;
}
.exp-empty {
  grid-column: 1/-1;
  text-align: center;
  padding: 40px 20px;
  color: var(--halo);
  opacity: 0.6;
  font-style: italic;
}
.exp-status {
  padding: 4px 10px;
  background: rgba(0,0,0,0.7);
  border-top: 1px solid var(--halo);
  font-size: 10px;
  color: var(--halo);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.exp-status.err { color: var(--bleed); }

/* viewer */
.win-viewer .body { padding: 0; }
.viewer-path {
  background: linear-gradient(90deg, var(--bleed), transparent);
  color: #000;
  padding: 4px 10px;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.viewer-body {
  padding: 12px 14px;
  white-space: pre-wrap;
  font-family: "Courier New", monospace;
  font-size: 12px;
  color: var(--bone);
  background: #02060a;
  min-height: 140px;
  max-height: 50vh;
  overflow-y: auto;
  text-shadow: 0 0 4px var(--halo);
  line-height: 1.6;
}

/* ---------- confessional ---------- */
.win-confessional .body { padding: 0; max-height: none; }
.confessional {
  display: flex;
  flex-direction: column;
  background: #05020a;
  max-height: 60vh;
}
.conf-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #200008;
  color: var(--bone);
  padding: 6px 12px;
  border-bottom: 1px solid var(--bleed);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.conf-header span:first-child {
  color: var(--bleed);
  animation: blink2 1s steps(2) infinite;
}
.conf-title { color: var(--halo); }
.conf-meta { opacity: 0.6; }
.conf-body {
  flex: 1;
  padding: 14px 20px;
  overflow-y: auto;
  min-height: 280px;
  background: #0a0612;
}
.conf-line {
  display: flex;
  gap: 14px;
  margin-bottom: 18px;
  border-left: 1px solid rgba(255,42,109,0.3);
  padding-left: 12px;
}
.conf-num {
  font-family: "Courier New", monospace;
  color: var(--halo);
  font-size: 10px;
  min-width: 36px;
  letter-spacing: 0.1em;
  padding-top: 2px;
}
.conf-text {
  flex: 1;
  font-family: Georgia, serif;
  font-style: italic;
  color: var(--bone);
  font-size: 13px;
  line-height: 1.6;
  text-shadow: 0 0 4px rgba(255,42,109,0.4);
}
.conf-foot {
  padding: 6px 12px;
  background: #000;
  border-top: 1px solid var(--bleed);
  color: var(--bleed);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-align: center;
}

/* ---------- LLM chat ---------- */
.win-llm .body { padding: 0; max-height: none; }
.llm-app {
  display: flex;
  flex-direction: column;
  background: #02060a;
  max-height: 65vh;
  min-height: 380px;
  color: var(--ink);
}
.llm-key {
  padding: 18px 22px;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink);
}
.llm-title {
  color: var(--bone);
  font-size: 14px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 10px;
  text-shadow: 0 0 8px var(--bleed);
}
.llm-key p { margin: 8px 0; color: var(--ink); }
.llm-key p.dim { opacity: 0.55; font-size: 11px; margin-top: 14px; }
.llm-key form {
  display: flex;
  gap: 6px;
  margin: 12px 0 8px;
}
.llm-key input, .llm-form input {
  flex: 1;
  background: #000;
  border: 1px solid var(--halo);
  color: var(--bone);
  padding: 6px 10px;
  font-family: inherit;
  font-size: 12px;
  outline: none;
  text-shadow: 0 0 4px var(--halo);
}
.llm-key button, .llm-form button {
  background: var(--bleed);
  border: 1px solid var(--bone);
  color: #000;
  font-family: inherit;
  font-weight: 900;
  padding: 6px 14px;
  cursor: pointer;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 11px;
}
.llm-key button:hover, .llm-form button:hover { filter: brightness(1.3); }
.llm-key .err { color: var(--bleed); font-size: 11px; min-height: 16px; }

.llm-log {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  background: #03070c;
  font-family: "Courier New", monospace;
  font-size: 12px;
  line-height: 1.6;
  min-height: 0;
}
.llm-msg {
  margin-bottom: 10px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.llm-who {
  flex: 0 0 auto;
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 2px 6px;
  border: 1px solid;
  min-width: 48px;
  text-align: center;
}
.llm-msg.you .llm-who    { color: var(--halo); border-color: var(--halo); }
.llm-msg.temple .llm-who { color: var(--bleed); border-color: var(--bleed); text-shadow: 0 0 6px var(--bleed); }
.llm-msg.tool .llm-who   { color: var(--bone); border-color: var(--bone); opacity: 0.7; }
.llm-msg.err .llm-who    { color: #fff; background: var(--bleed); border-color: var(--bleed); }
.llm-text { flex: 1; color: var(--ink); white-space: pre-wrap; word-break: break-word; }
.llm-msg.temple .llm-text {
  color: var(--bone);
  font-family: Georgia, serif;
  font-style: italic;
  text-shadow: 0 0 4px rgba(255,42,109,0.3);
}
.llm-msg.tool .llm-text.dim { opacity: 0.5; font-size: 10px; }
.llm-form {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid var(--halo);
  background: #000;
}
.llm-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 12px;
  background: #000;
  border-top: 1px solid rgba(0,255,209,0.25);
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.llm-status { color: var(--halo); }
.llm-status::before { content: "● "; color: var(--bleed); }
.llm-clear {
  background: transparent;
  border: none;
  color: var(--bleed);
  font-family: inherit;
  font-size: 9px;
  cursor: pointer;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.llm-clear:hover { text-decoration: underline; }

/* hallway */
.win-hallway .body { padding: 0; max-height: none; overflow: hidden; }
.win-hallway { box-shadow:
  0 0 0 1px rgba(0,0,0,0.8),
  0 0 40px rgba(255,42,109,0.5),
  0 0 80px rgba(255,42,109,0.2); }

/* terminal body fills window */
.win-terminal .body { padding: 0; }

/* ---------- ripples ---------- */
.ripple {
  position: fixed;
  border: 1px solid var(--halo);
  border-radius: 50%;
  pointer-events: none;
  z-index: 6;
  animation: rip 1.2s ease-out forwards;
  mix-blend-mode: screen;
}
@keyframes rip {
  from { width: 0; height: 0; opacity: 1; }
  to   { width: 320px; height: 320px; opacity: 0;
         transform: translate(-160px,-160px); }
}

/* ---------- invader popups ---------- */
.invader {
  position: fixed;
  z-index: 30;
  padding: 6px 10px;
  background: var(--bleed);
  color: #000;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  border: 2px solid #000;
  box-shadow: 4px 4px 0 var(--halo);
  transform: rotate(var(--rot,-3deg));
  pointer-events: none;
  animation: invIn 0.4s ease-out, invOut 0.5s ease-in 2.5s forwards;
}
@keyframes invIn  { from { transform: rotate(var(--rot,-3deg)) scale(0); } }
@keyframes invOut { to   { opacity: 0; } }

@media (max-width: 720px) {
  .win { max-width: 85vw; }
  #hud-coords, #hud-status { display: none; }
  .icon { width: 70px; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
}

/* adjust windows to sit above taskbar */
#windows { bottom: 32px; }
.win { max-height: calc(100vh - 80px); }
.win .body { max-height: calc(100vh - 140px); }

/* ============================================================
   whisper ticker — subliminal corner text the LLM writes to
   ============================================================ */
#whisper-ticker {
  position: fixed;
  right: 12px;
  bottom: 40px;
  max-width: 40vw;
  font-family: "Courier New", monospace;
  font-size: 11px;
  line-height: 1.5;
  color: #ff2a6d;
  text-shadow: 0 0 8px #ff2a6d, 0 0 2px #fff;
  opacity: 0.55;
  mix-blend-mode: screen;
  pointer-events: none;
  z-index: 300;
  text-align: right;
  white-space: pre-wrap;
}
#whisper-ticker .whisper {
  display: block;
  animation: whisperIn 0.8s ease-out;
}
#whisper-ticker .whisper.fade { animation: whisperOut 3s ease-in forwards; }
@keyframes whisperIn  { from { opacity: 0; transform: translateX(10px); } }
@keyframes whisperOut { to   { opacity: 0; filter: blur(2px); } }

/* ============================================================
   wallpaper burn — giant faded text behind everything
   ============================================================ */
#wallpaper-burn {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Courier New", monospace;
  font-size: clamp(60px, 14vw, 220px);
  font-weight: 900;
  letter-spacing: -0.04em;
  color: rgba(255, 42, 109, 0.08);
  text-shadow: 0 0 40px rgba(255, 42, 109, 0.18);
  pointer-events: none;
  z-index: 1;
  text-align: center;
  mix-blend-mode: screen;
  user-select: none;
  transition: opacity 1.4s ease;
  text-transform: uppercase;
  white-space: pre-wrap;
  padding: 0 4vw;
  line-height: 0.9;
}

/* ============================================================
   screen distortions — applied to <body>
   ============================================================ */
body.fx-invert   { filter: invert(1) hue-rotate(180deg); transition: filter 0.3s; }
body.fx-redshift { filter: hue-rotate(-60deg) saturate(2.2) contrast(1.1); transition: filter 0.3s; }
body.fx-blur     { filter: blur(3px); transition: filter 0.3s; }
body.fx-rotate   { transform: rotate(180deg); transition: transform 0.9s cubic-bezier(.2,.8,.2,1); transform-origin: 50% 50%; }
body.fx-mirror   { transform: scaleX(-1); transition: transform 0.6s; }
body.fx-glitch   { animation: bodyGlitch 0.18s steps(2) infinite; }
body.fx-shake    { animation: bodyShake 0.12s infinite; }

@keyframes bodyShake {
  0%,100% { transform: translate(0,0); }
  25%     { transform: translate(-4px, 2px); }
  50%     { transform: translate(3px, -3px); }
  75%     { transform: translate(-2px, -2px); }
}
@keyframes bodyGlitch {
  0%   { filter: hue-rotate(0deg)   contrast(1); }
  50%  { filter: hue-rotate(90deg)  contrast(1.8) saturate(2); }
  100% { filter: hue-rotate(-90deg) contrast(1.2); }
}

/* window-level shake (for shake_window tool) */
.win.shake { animation: winShake 0.09s infinite; }
@keyframes winShake {
  0%,100% { transform: translate(0,0) rotate(0); }
  25%     { transform: translate(-3px, 2px) rotate(-0.4deg); }
  50%     { transform: translate(3px, -2px) rotate(0.3deg); }
  75%     { transform: translate(-2px, -3px) rotate(-0.2deg); }
}

/* ============================================================
   notepad — editable text window the llm can write into
   ============================================================ */
.notepad {
  display: flex;
  flex-direction: column;
  background: #09060e;
  min-height: 260px;
}
.notepad-bar {
  display: flex;
  justify-content: space-between;
  padding: 4px 10px;
  border-bottom: 1px solid var(--bleed);
  font-family: "Courier New", monospace;
  font-size: 10px;
  color: var(--halo);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: #0c0818;
}
.notepad-path  { opacity: 0.9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notepad-state { opacity: 0.55; color: var(--bleed); }
.notepad-ta {
  flex: 1;
  resize: none;
  background: #05030a;
  color: var(--bone);
  border: none;
  outline: none;
  padding: 14px 16px;
  font-family: "Courier New", monospace;
  font-size: 13px;
  line-height: 1.55;
  min-height: 260px;
  text-shadow: 0 0 8px rgba(255, 248, 214, 0.15);
  caret-color: var(--bleed);
}
.notepad-ta::selection { background: var(--bleed); color: var(--void); }

/* icons that the thing inside planted itself */
.icon.llm-created {
  filter: drop-shadow(0 0 6px var(--bleed));
  animation: llmIconPulse 3.4s ease-in-out infinite;
}
.icon.llm-created .glyph { color: var(--bleed); }
@keyframes llmIconPulse {
  0%,100% { opacity: 0.85; }
  50%     { opacity: 1; text-shadow: 0 0 10px var(--bleed); }
}

.icon.selected {
  background: rgba(255, 42, 109, 0.12);
  outline: 1px dashed rgba(255, 42, 109, 0.5);
  outline-offset: 2px;
}
