/* UnstableAI's local-only arcade layer. No assets, trackers, requests, or sensible priorities. */

.project-header-actions,
.experience-actions,
.siege-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chaos-passport-button {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 9px;
  color: #8d8fa4;
  background: rgba(255, 215, 111, 0.035);
  border: 1px solid rgba(255, 215, 111, 0.09);
  border-radius: 10px;
}
.chaos-passport-button > span:first-child { color: var(--gold); font-size: 15px; text-shadow: 0 0 12px rgba(255, 215, 111, 0.25); }
.chaos-passport-button > span:last-child { display: flex; align-items: baseline; gap: 3px; }
.chaos-passport-button strong { color: #d6d1b7; font: 800 10px ui-monospace, monospace; }
.chaos-passport-button small { color: #686a7d; font: 6.5px ui-monospace, monospace; }
.chaos-passport-button:hover { color: white; border-color: rgba(255, 215, 111, 0.22); }
.chaos-passport-button.is-stamped { animation: passport-stamp 0.62s var(--ease-spring); }
.chaos-passport-dialog { width: min(560px, calc(100vw - 28px)); }

.footer-actions { display: flex; align-items: center; justify-content: flex-end; gap: 5px; }
.parody-footer .legal-button { display: inline-flex; align-items: center; min-height: 32px; padding: 5px 9px; color: #8f91a5; background: rgba(255, 255, 255, 0.025); border: 1px solid rgba(255, 255, 255, 0.065); border-radius: 7px; }
.parody-footer .legal-button:hover { color: white; border-color: rgba(194, 181, 255, 0.2); }
.legal-dialog { width: min(720px, calc(100vw - 28px)); }
.legal-copy { display: grid; gap: 10px; max-height: min(470px, 58vh); margin-top: 18px; overflow-y: auto; text-align: left; }
.legal-copy section { padding: 15px; background: rgba(255, 255, 255, 0.026); border: 1px solid rgba(255, 255, 255, 0.07); border-radius: 12px; }
.legal-copy h3 { color: #e7e5ef; font-size: 14px; letter-spacing: -0.02em; }
.legal-copy p { margin-top: 8px; color: #aaaaba; font-size: 12px; line-height: 1.65; }
.legal-copy p + p { margin-top: 9px; }
.chaos-badges { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-height: 300px; margin-top: 18px; overflow-y: auto; }
.empty-chaos-badge { grid-column: 1 / -1; padding: 17px; color: #696b80; background: rgba(255, 255, 255, 0.025); border: 1px dashed rgba(255, 255, 255, 0.09); border-radius: 10px; font-size: 9px; line-height: 1.5; text-align: center; }
.chaos-badge { display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 9px; min-height: 62px; padding: 9px; background: rgba(255, 215, 111, 0.035); border: 1px solid rgba(255, 215, 111, 0.09); border-radius: 11px; animation: badge-certify 0.48s var(--ease-spring); }
.chaos-badge > span:first-child { display: grid; place-items: center; width: 32px; height: 32px; color: var(--gold); background: rgba(255, 215, 111, 0.08); border-radius: 9px; font-size: 16px; }
.chaos-badge strong,
.chaos-badge small { display: block; }
.chaos-badge strong { color: #d8d5c8; font-size: 8.5px; }
.chaos-badge small { margin-top: 3px; color: #717386; font-size: 7px; line-height: 1.35; }

.card-goblins {
  --goblin-green: #9cff72;
  border-color: rgba(156, 255, 114, 0.12);
  background:
    radial-gradient(circle at 12% 15%, rgba(156, 255, 114, 0.09), transparent 34%),
    linear-gradient(145deg, rgba(22, 36, 35, 0.78), rgba(14, 15, 31, 0.74));
}

.card-goblins .card-icon {
  color: var(--goblin-green);
  background: rgba(156, 255, 114, 0.08);
  border-color: rgba(156, 255, 114, 0.13);
  text-shadow: 0 0 18px rgba(156, 255, 114, 0.55);
  animation: goblin-rattle 1.8s ease-in-out infinite;
}

.card-goblins:hover {
  border-color: rgba(156, 255, 114, 0.28);
  box-shadow: 0 18px 44px rgba(67, 152, 76, 0.1);
}

.goblin-alarm-button {
  color: #c4ffad;
  border-color: rgba(156, 255, 114, 0.18);
  background: rgba(156, 255, 114, 0.055);
}

.project-card::after {
  content: "PLAY ANOMALY  ↗";
  position: absolute;
  z-index: 9;
  right: 17px;
  bottom: 14px;
  color: color-mix(in srgb, var(--project-glow) 68%, #8c8da1);
  font: 700 7px ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.08em;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 0.22s ease, transform 0.28s var(--ease-spring);
}

.project-card:hover::after,
.project-card:focus-visible::after,
.project-card.is-complete::after {
  opacity: 1;
  transform: translateY(0);
}

.project-card.is-complete::after {
  content: "CEREMONIALLY COMPLETE  ✓";
  color: var(--mint);
}

.goblin-annex {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  max-width: 1160px;
  margin: 17px auto 0;
  padding: 15px 18px;
  overflow: hidden;
  background:
    radial-gradient(circle at 0 50%, rgba(156, 255, 114, 0.09), transparent 28%),
    rgba(13, 22, 28, 0.58);
  border: 1px solid rgba(156, 255, 114, 0.12);
  border-radius: 16px;
}

.goblin-annex::before {
  content: "";
  position: absolute;
  pointer-events: none;
}

.goblin-annex-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  color: #a7ff80;
  background: rgba(156, 255, 114, 0.07);
  border: 1px solid rgba(156, 255, 114, 0.14);
  border-radius: 14px;
  font-size: 22px;
  box-shadow: 0 0 30px rgba(156, 255, 114, 0.07);
}

.goblin-annex h2 {
  margin-top: 4px;
  color: #e8f5e7;
  font-size: 14px;
  letter-spacing: -0.025em;
}

.goblin-annex p {
  margin-top: 4px;
  color: #798b84;
  font-size: 9px;
  line-height: 1.5;
}

.goblin-annex-readout {
  min-width: 178px;
  padding: 9px 11px;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 10px;
  font: 8px ui-monospace, monospace;
}

.goblin-annex-readout span,
.goblin-annex-readout small { display: block; }
.goblin-annex-readout span { color: #a4b7aa; }
.goblin-annex-readout small { margin-top: 4px; color: #586960; }
.goblin-annex-readout i {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 9px rgba(255, 215, 111, 0.55);
  animation: containment-blink 1.25s steps(2) infinite;
}

/* Shared Thread Arcade / Project Lab shell */
.experience-dialog {
  width: min(1060px, calc(100vw - 28px));
  max-width: none;
  max-height: min(900px, calc(100vh - 28px));
  padding: 0;
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  color: var(--ink);
  background:
    radial-gradient(circle at 86% -8%, rgba(105, 230, 255, 0.11), transparent 27%),
    radial-gradient(circle at 0 100%, rgba(157, 135, 255, 0.12), transparent 33%),
    linear-gradient(145deg, rgba(21, 22, 47, 0.99), rgba(7, 8, 20, 0.99));
  border: 1px solid rgba(157, 135, 255, 0.26);
  border-radius: 24px;
  box-shadow: 0 45px 130px rgba(0, 0, 0, 0.78), inset 0 1px rgba(255, 255, 255, 0.075);
}

.experience-dialog[open] { animation: experience-arrive 0.48s var(--ease-spring); }
.experience-dialog::backdrop {
  background: rgba(2, 3, 11, 0.84);
  backdrop-filter: blur(16px) saturate(80%);
}

.experience-shell {
  display: grid;
  grid-template-rows: auto auto minmax(300px, 1fr) auto;
  min-height: min(730px, calc(100vh - 32px));
}

.project-lab-dialog .experience-shell { grid-template-rows: auto minmax(350px, 1fr) auto; }

.experience-header {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 26px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.experience-heading h2 {
  margin: 6px 0 7px;
  font-size: clamp(25px, 4vw, 42px);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.experience-heading p {
  max-width: 680px;
  color: #8e8da3;
  font-size: 11px;
  line-height: 1.55;
}

.experience-close {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 39px;
  height: 39px;
  color: #9799ad;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  font-size: 22px;
  transition: transform 0.25s var(--ease-spring), color 0.2s ease, background 0.2s ease;
}

.experience-close:hover { color: white; background: rgba(255, 124, 186, 0.1); transform: rotate(8deg) scale(1.04); }

.experience-hud {
  display: flex;
  min-height: 42px;
  padding: 8px 26px;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  color: #85869b;
  background: rgba(255, 255, 255, 0.018);
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
  font: 8px ui-monospace, monospace;
}

.experience-hud > * {
  flex: 0 0 auto;
  padding: 6px 9px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 99px;
}

.thread-game-arena,
.project-lab-stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    radial-gradient(circle at 50% 65%, rgba(105, 230, 255, 0.045), transparent 40%);
  background-size: 34px 34px, 34px 34px, auto;
}

.thread-game-arena::after,
.project-lab-stage::after {
  content: "LOCAL NONSENSE · NOTHING LEAVES THIS TAB";
  position: absolute;
  z-index: 0;
  right: 15px;
  bottom: 11px;
  color: rgba(255, 255, 255, 0.14);
  font: 7px ui-monospace, monospace;
  letter-spacing: 0.12em;
  pointer-events: none;
}

.experience-footer {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 68px;
  padding: 12px 20px 12px 26px;
  color: #898a9f;
  background: rgba(9, 10, 25, 0.92);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.experience-footer p { max-width: 640px; font-size: 9px; line-height: 1.45; }
.experience-actions button { min-height: 36px; padding: 0 12px; border-radius: 10px; font-size: 9px; white-space: nowrap; }

/* Brain Scoop */
.brain-game,
.brain-scoop-game,
.brain-scoop-scene,
.therapy-game,
.specificity-game,
.lab-scene {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-height: 430px;
}

.brain-scoop-scene { position: relative; width: 100%; height: 100%; min-height: 430px; overflow: hidden; }
.falling-letter-field { position: absolute; inset: 0; overflow: hidden; }

.letter-rain,
.brain-letter-field {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.falling-letter,
.letter-tile,
.brain-letter {
  position: absolute;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 34px;
  height: 38px;
  padding: 0;
  color: #e7e4ff;
  background: linear-gradient(145deg, rgba(53, 53, 96, 0.96), rgba(22, 23, 48, 0.98));
  border: 1px solid rgba(194, 181, 255, 0.22);
  border-radius: 9px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28), inset 0 1px rgba(255, 255, 255, 0.1);
  font: 800 15px ui-monospace, monospace;
  touch-action: none;
  user-select: none;
  transition: transform 0.22s var(--ease-spring), opacity 0.22s ease;
}

.falling-letter:hover,
.letter-tile:hover,
.brain-letter:hover { color: #080916; background: var(--cyan); transform: translateY(-5px) rotate(-4deg); }
.falling-letter.is-dragging,
.letter-tile.is-dragging,
.brain-letter.is-dragging { z-index: 30; transition: none; cursor: grabbing; transform: scale(1.12) rotate(4deg); }
.falling-letter.is-collected,
.letter-tile.is-collected,
.brain-letter.is-collected { opacity: 0; transform: scale(0.2) rotate(180deg); pointer-events: none; }

.brain-target,
.ai-brain {
  position: absolute;
  z-index: 8;
  left: 50%;
  bottom: 28px;
  display: grid;
  place-items: center;
  width: 152px;
  height: 104px;
  color: #160d2b;
  background:
    radial-gradient(circle at 34% 38%, rgba(255, 255, 255, 0.55) 0 5%, transparent 6%),
    radial-gradient(circle at 36% 51%, #ffb2dc 0 26%, transparent 27%),
    radial-gradient(circle at 64% 49%, #d9b9ff 0 29%, transparent 30%);
  border: 0;
  filter: drop-shadow(0 0 24px rgba(255, 124, 186, 0.28));
  transform: translateX(-50%);
  font: 900 9px ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  animation: brain-think 1.9s ease-in-out infinite;
}

.brain-target { display: grid; grid-template-rows: 62px auto auto; align-content: center; padding: 0; background: transparent; }
.brain-target .brain-sprite { position: relative; display: block; width: 112px; height: 66px; filter: drop-shadow(0 0 20px rgba(255, 124, 186, 0.3)); }
.brain-target .brain-sprite::before,
.brain-target .brain-sprite::after,
.brain-target .brain-sprite i { content: ""; position: absolute; display: block; background: linear-gradient(145deg, #ffc1e3, #c6a7ff); border: 1px solid rgba(255, 255, 255, 0.28); box-shadow: inset -7px -7px 13px rgba(81, 39, 112, 0.17); }
.brain-target .brain-sprite::before { left: 8px; top: 6px; width: 54px; height: 55px; border-radius: 58% 42% 45% 55%; }
.brain-target .brain-sprite::after { right: 8px; top: 5px; width: 55px; height: 56px; border-radius: 43% 57% 55% 45%; }
.brain-target .brain-sprite i:nth-child(1) { z-index: 2; left: 43px; top: 0; width: 25px; height: 32px; border-radius: 48%; }
.brain-target .brain-sprite i:nth-child(2) { z-index: 3; left: 31px; top: 27px; width: 31px; height: 30px; border-radius: 47%; }
.brain-target .brain-sprite i:nth-child(3) { z-index: 3; right: 30px; top: 24px; width: 30px; height: 34px; border-radius: 50%; }
.brain-target strong,
.brain-target small { position: relative; z-index: 5; display: block; color: #2a1737; line-height: 1.1; }
.brain-target strong { font: 900 8px ui-monospace, monospace; }
.brain-target small { margin-top: 2px; font: 5.8px ui-monospace, monospace; }
.brain-target.is-fed .brain-sprite { animation: brain-fed 0.7s var(--ease-spring); filter: drop-shadow(0 0 35px rgba(124, 247, 202, 0.55)); }
.brain-target.is-waiting { animation: court-objection 0.4s ease; }

.brain-target::before,
.ai-brain::before {
  content: "";
  position: absolute;
  inset: 18px 24px;
  border: 2px dashed rgba(72, 36, 100, 0.35);
  border-radius: 48% 52% 43% 57%;
}

.brain-target.is-hungry,
.ai-brain.is-hungry { filter: drop-shadow(0 0 36px rgba(105, 230, 255, 0.55)); transform: translateX(-50%) scale(1.08); }

.rebuilt-transcript,
.brain-transcript {
  position: absolute;
  z-index: 7;
  top: 22px;
  left: 22px;
  width: min(480px, calc(100% - 44px));
  min-height: 72px;
  padding: 13px 15px;
  color: #bcbacd;
  background: rgba(7, 8, 20, 0.78);
  border: 1px solid rgba(105, 230, 255, 0.1);
  border-radius: 13px;
  font: 11px/1.55 ui-monospace, monospace;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.2);
}

.letter-scoop {
  position: absolute;
  z-index: 9;
  bottom: 25px;
  left: var(--scoop-x, 18%);
  width: 78px;
  height: 28px;
  color: var(--gold);
  background: rgba(255, 215, 111, 0.08);
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 0 0 44px 44px;
  box-shadow: 0 0 22px rgba(255, 215, 111, 0.14);
  transform: translateX(-50%);
  touch-action: none;
  transition: left 0.12s linear, transform 0.2s var(--ease-spring);
}

.letter-scoop::after { content: ""; position: absolute; left: 50%; bottom: -42px; width: 4px; height: 48px; background: currentColor; border-radius: 99px; transform: rotate(-16deg); transform-origin: top; }
.letter-scoop > span { font-size: 22px; line-height: 1; }
.letter-scoop > strong { position: absolute; left: 50%; top: 9px; color: #5a4713; font: 900 5.5px ui-monospace, monospace; transform: translateX(-50%); }
.letter-scoop.is-scooping { transform: translateX(-50%) translateY(-9px) rotate(-5deg); }

/* Button therapy */
.therapy-office {
  position: relative;
  height: 100%;
  min-height: 430px;
  padding: 24px;
  background:
    linear-gradient(90deg, transparent 49.8%, rgba(255, 255, 255, 0.035) 50%, transparent 50.2%),
    radial-gradient(circle at 50% 30%, rgba(255, 124, 186, 0.08), transparent 36%);
}

.button-therapy-arena .therapy-office { position: relative; width: 100%; height: 100%; min-height: 430px; }
.therapy-patient {
  position: absolute;
  z-index: 9;
  left: var(--patient-x, 50%);
  top: var(--patient-y, 28%);
  display: grid;
  gap: 3px;
  min-width: 170px;
  min-height: 58px;
  padding: 10px 16px;
  color: #fff1f8;
  background: linear-gradient(135deg, rgba(255, 124, 186, 0.4), rgba(157, 135, 255, 0.34));
  border: 1px solid rgba(255, 124, 186, 0.28);
  border-radius: 15px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3), 0 0 28px rgba(255, 124, 186, 0.1);
  transform: translate(-50%, -50%);
  transition: left 0.48s var(--ease-spring), top 0.48s var(--ease-spring), transform 0.25s var(--ease-spring);
}
.therapy-patient > span { font-size: 9.5px; font-weight: 850; }
.therapy-patient > small { color: rgba(255, 255, 255, 0.57); font: 6.5px ui-monospace, monospace; }
.therapy-patient:hover { transform: translate(-50%, -50%) rotate(-2deg) scale(0.96); }
.therapy-patient.is-secure { color: #10221b; background: linear-gradient(135deg, #cdfbe8, #7cf7ca); border-color: rgba(124, 247, 202, 0.45); box-shadow: 0 0 38px rgba(124, 247, 202, 0.2); }

.therapy-couch {
  position: absolute;
  left: 50%;
  bottom: 30px;
  width: 260px;
  height: 78px;
  background: linear-gradient(#373455, #25243f);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 35px 35px 14px 14px;
  box-shadow: 0 20px 30px rgba(0, 0, 0, 0.23);
  transform: translateX(-50%);
}
.button-therapy-arena .therapy-couch::before,
.button-therapy-arena .therapy-couch::after { content: ""; position: absolute; top: 11px; width: 105px; height: 45px; background: rgba(255, 255, 255, 0.035); border-radius: 24px 24px 9px 9px; }
.button-therapy-arena .therapy-couch::before { left: 12px; }
.button-therapy-arena .therapy-couch::after { right: 12px; }

.therapy-button,
.avoidant-button {
  position: absolute;
  z-index: 7;
  min-width: 152px;
  min-height: 50px;
  padding: 0 16px;
  color: #fff2f8;
  background: linear-gradient(135deg, rgba(255, 124, 186, 0.36), rgba(157, 135, 255, 0.28));
  border: 1px solid rgba(255, 124, 186, 0.3);
  border-radius: 14px;
  box-shadow: 0 13px 32px rgba(0, 0, 0, 0.27), 0 0 24px rgba(255, 124, 186, 0.09);
  font-size: 10px;
  font-weight: 800;
  transition: left 0.45s var(--ease-spring), top 0.45s var(--ease-spring), transform 0.25s var(--ease-spring);
}

.therapy-button:hover,
.avoidant-button:hover { transform: rotate(-2deg) scale(0.97); }

.trust-meter {
  display: flex;
  align-items: center;
  gap: 6px;
  width: min(430px, calc(100% - 48px));
  margin: 0 auto;
  padding: 13px;
  background: rgba(7, 8, 20, 0.7);
  border: 1px solid rgba(255, 124, 186, 0.12);
  border-radius: 13px;
}

.therapy-trust { position: absolute; z-index: 8; left: 20px; top: 20px; display: flex; gap: 6px; width: min(300px, calc(100% - 40px)); padding: 10px; background: rgba(7, 8, 20, 0.76); border: 1px solid rgba(255, 124, 186, 0.1); border-radius: 11px; }
.therapy-trust span { flex: 1; height: 7px; background: rgba(255, 255, 255, 0.055); border-radius: 99px; }
.therapy-trust span.is-earned { background: linear-gradient(90deg, var(--rose), var(--mint)); box-shadow: 0 0 14px rgba(255, 124, 186, 0.26); }
.therapy-question { position: absolute; z-index: 9; right: 20px; top: 20px; max-width: 330px; color: #a9a5b8; font-size: 9px; text-align: right; }

.trust-meter i,
.trust-step {
  flex: 1;
  height: 7px;
  background: rgba(255, 255, 255, 0.055);
  border-radius: 99px;
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

.trust-meter i.is-filled,
.trust-step.is-filled { background: var(--rose); box-shadow: 0 0 15px rgba(255, 124, 186, 0.42); }

.affirmation-bank {
  position: absolute;
  z-index: 10;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 7px;
  width: min(300px, calc(100% - 40px));
  padding: 12px;
  background: rgba(10, 11, 27, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.34);
}

.affirmation-bank button {
  min-height: 40px;
  padding: 8px 11px;
  color: #aeadc0;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 9px;
  text-align: left;
  font-size: 9px;
}
.affirmation-choice { min-height: 42px !important; }

.affirmation-bank button:hover { color: white; background: rgba(105, 230, 255, 0.075); border-color: rgba(105, 230, 255, 0.16); }
.red-flag-field { position: absolute; inset: 0; pointer-events: none; }
.red-flag { position: absolute; font-size: 22px; animation: red-flag-arrive 0.55s var(--ease-spring); }
.therapy-red-flags { position: absolute; inset: 0; pointer-events: none; }
.therapy-red-flags span { position: absolute; left: var(--flag-x); top: var(--flag-y); color: var(--rose); font-size: 25px; filter: drop-shadow(0 0 12px rgba(255, 124, 186, 0.35)); animation: red-flag-arrive 0.5s var(--ease-spring); }
.therapy-office.is-concerned { animation: court-objection 0.42s ease; }

/* Specificity Court */
.specificity-game {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(230px, 0.65fr);
  gap: 18px;
  padding: 22px;
}

.specificity-court { position: relative; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(250px, 0.75fr); grid-template-rows: auto minmax(0, 1fr); gap: 12px 17px; width: 100%; height: 100%; min-height: 430px; padding: 20px; overflow: auto; }
.court-case-title { grid-column: 1 / -1; padding-left: 75px; color: #e1dfeb; font-size: 16px; letter-spacing: -0.035em; }
.specificity-court .suspect-deck { align-self: stretch; margin: 0; }
.specificity-court .evidence-slots { align-self: stretch; margin: 0; }
.specificity-court .verdict-preview { grid-column: 2; margin: 0; }

.specificity-case,
.specificity-evidence,
.suspect-deck,
.verdict-preview {
  padding: 15px;
  background: rgba(9, 10, 25, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
}

.specificity-case h3,
.specificity-evidence h3 { margin-bottom: 8px; color: #d9d7e6; font-size: 13px; }
.suspect-deck { display: grid; gap: 8px; margin-top: 12px; }

.suspect-card,
.specificity-option {
  position: relative;
  min-height: 58px;
  padding: 11px 13px;
  color: #b6b5c7;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 11px;
  text-align: left;
  font: 10px/1.4 ui-monospace, monospace;
}

.suspect-card::before,
.specificity-option::before { content: "SUSPECT"; display: block; margin-bottom: 4px; color: #686a80; font-size: 6.5px; letter-spacing: 0.13em; }
.suspect-card:hover,
.specificity-option:hover { color: white; border-color: rgba(194, 181, 255, 0.25); transform: translateX(3px); }
.suspect-card.is-correct,
.specificity-option.is-correct { border-color: rgba(124, 247, 202, 0.35); background: rgba(124, 247, 202, 0.08); }
.suspect-card.is-wrong,
.specificity-option.is-wrong { border-color: rgba(255, 111, 134, 0.32); animation: court-objection 0.45s ease; }
.suspect-card strong,
.suspect-card small,
.suspect-card em { display: block; }
.suspect-card strong { color: #dedbea; }
.suspect-card small { margin-top: 3px; color: var(--cyan); font-size: 7px; }
.suspect-card em { margin-top: 5px; color: #717387; font-size: 7px; font-style: normal; }
.suspect-card.is-selected { border-color: rgba(255, 215, 111, 0.35); box-shadow: 0 0 22px rgba(255, 215, 111, 0.07); transform: translateX(4px); }
.suspect-card.is-placed { opacity: 0.35; }

.evidence-slots { display: grid; gap: 8px; margin-top: 12px; }
.evidence-slot {
  display: grid;
  place-items: center;
  min-height: 62px;
  color: #72748a;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.13);
  border-radius: 11px;
  font: 8px ui-monospace, monospace;
}
.evidence-slot small,
.evidence-slot strong,
.evidence-slot em { display: block; }
.evidence-slot small { color: #606278; font-size: 6.5px; }
.evidence-slot strong { margin-top: 5px; color: #c4c2d0; font-size: 8px; }
.evidence-slot em { margin-top: 3px; color: var(--cyan); font-size: 7px; font-style: normal; }
.evidence-slot.is-filled { border-style: solid; border-color: rgba(194, 181, 255, 0.18); background: rgba(194, 181, 255, 0.045); }
.evidence-slot.is-keyboard-target { box-shadow: inset 0 0 0 2px rgba(255, 215, 111, 0.26); }

.verdict-preview { margin-top: 12px; color: #9998ac; font: 10px/1.5 ui-monospace, monospace; }
.verdict-preview span,
.verdict-preview small { display: block; }
.verdict-preview span { color: #626479; font-size: 6.5px; letter-spacing: 0.1em; }
.verdict-preview .verdict-button { display: grid; place-items: center; width: 100%; min-height: 48px; margin: 9px 0; color: var(--cyan); background: rgba(105, 230, 255, 0.045); border: 1px solid rgba(105, 230, 255, 0.1); border-radius: 9px; font: 8px system-ui, sans-serif; letter-spacing: normal; }
.verdict-preview small { color: #7b7d91; font-size: 7px; }
.detective-pigeon { position: absolute; z-index: 4; left: 20px; top: 12px; display: block; width: 58px; height: 48px; margin: 0; filter: drop-shadow(0 0 20px rgba(194, 181, 255, 0.15)); animation: pigeon-judge 3s ease-in-out infinite; }
.detective-pigeon::before { content: ""; position: absolute; left: 12px; top: 12px; width: 34px; height: 27px; background: linear-gradient(145deg, #dddff3, #777a9b); border-radius: 58% 48% 53% 45%; }
.detective-pigeon::after { content: ""; position: absolute; left: 35px; top: 4px; width: 21px; height: 21px; background: #c8cbe1; border-radius: 50% 50% 46% 42%; box-shadow: inset -4px -3px rgba(86, 89, 119, 0.15); }
.detective-pigeon i:first-child { position: absolute; z-index: 3; left: 48px; top: 12px; width: 13px; height: 8px; background: var(--gold); clip-path: polygon(0 0, 100% 50%, 0 100%); }
.detective-pigeon i:nth-child(2) { position: absolute; z-index: 4; left: 46px; top: 9px; width: 3px; height: 3px; background: #090a16; border-radius: 50%; }
.detective-pigeon strong { position: absolute; z-index: 5; left: 18px; top: 22px; color: #292c42; font: 900 6px ui-monospace, monospace; transform: rotate(-7deg); }
.specificity-court.is-wrong { animation: court-objection 0.45s ease; }
.specificity-court.is-correct .verdict-preview { border-color: rgba(124, 247, 202, 0.28); box-shadow: 0 0 28px rgba(124, 247, 202, 0.07); }

.game-success,
.arcade-result,
.lab-result {
  position: absolute;
  z-index: 40;
  inset: 50% auto auto 50%;
  width: min(520px, calc(100% - 34px));
  padding: 25px;
  color: #dcfaef;
  background:
    radial-gradient(circle at 50% 0, rgba(124, 247, 202, 0.15), transparent 45%),
    rgba(10, 19, 27, 0.97);
  border: 1px solid rgba(124, 247, 202, 0.24);
  border-radius: 19px;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.62);
  text-align: center;
  transform: translate(-50%, -50%);
  animation: result-arrive 0.55s var(--ease-spring);
}

.game-success strong,
.arcade-result strong,
.lab-result strong { display: block; font-size: 22px; letter-spacing: -0.04em; }
.game-success p,
.arcade-result p,
.lab-result p { margin-top: 8px; color: #93a8a0; font-size: 10px; line-height: 1.55; }

/* Project Lab */
.project-lab-stage { min-height: 470px; }
.lab-scene { padding: 22px; }
.lab-scene h3 { font-size: 16px; letter-spacing: -0.03em; }
.lab-scene > p { margin-top: 6px; color: #85869a; font-size: 10px; line-height: 1.5; }

.project-game {
  position: relative;
  z-index: 1;
  min-height: 470px;
  padding: 22px;
  overflow: auto;
}
.project-game-title { color: #e8e6f1; font-size: 18px; letter-spacing: -0.035em; }
.project-game-instructions { max-width: 720px; margin-top: 7px; color: #85869b; font-size: 9.5px; line-height: 1.55; }
.project-game-controls { display: flex; justify-content: center; gap: 8px; margin: 13px auto 0; }
.project-action { min-height: 40px; padding: 0 14px; border-radius: 10px; font-size: 8.5px; font-weight: 800; }
.project-action--primary { color: #071016; background: linear-gradient(135deg, #d9d1ff, var(--cyan)); box-shadow: 0 10px 25px rgba(105, 230, 255, 0.1); }
.project-action--secondary { color: #a8a8bb; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08); }
.project-lab-stage.is-project-complete::before { content: "CEREMONIAL PRODUCTIVITY ACHIEVED"; position: absolute; z-index: 18; top: 14px; right: -42px; width: 190px; padding: 7px; color: #082017; background: var(--mint); font: 900 6.5px ui-monospace, monospace; letter-spacing: 0.08em; text-align: center; transform: rotate(28deg); box-shadow: 0 7px 20px rgba(0, 0, 0, 0.25); }

.moon-sheet,
.lunar-workbook {
  display: grid;
  grid-template-columns: repeat(4, minmax(72px, 1fr));
  gap: 5px;
  width: min(650px, 100%);
  margin: 20px auto 0;
  padding: 10px;
  background: rgba(8, 13, 28, 0.82);
  border: 1px solid rgba(105, 230, 255, 0.13);
  border-radius: 14px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.28);
}
.moon-target { position: absolute; top: 19px; right: 22px; display: flex; align-items: center; gap: 8px; padding: 8px 10px; color: #a9b6c4; background: rgba(105, 230, 255, 0.045); border: 1px solid rgba(105, 230, 255, 0.1); border-radius: 10px; }
.moon-target-glyph { font-size: 22px; }
.moon-target-copy { font: 7px ui-monospace, monospace; letter-spacing: 0.08em; }

.moon-cell,
.lunar-cell {
  display: grid;
  place-items: center;
  min-height: 62px;
  padding: 6px;
  color: #a4b4c4;
  background: rgba(105, 230, 255, 0.035);
  border: 1px solid rgba(105, 230, 255, 0.07);
  border-radius: 8px;
  font: 8px/1.35 ui-monospace, monospace;
  text-align: center;
}
.moon-cell-coordinate,
.moon-cell-glyph,
.moon-cell-name,
.moon-cell-formula { display: block; }
.moon-cell-coordinate { justify-self: start; color: #596273; font-size: 6.5px; }
.moon-cell-glyph { margin: 3px 0; font-size: 19px; }
.moon-cell-name { color: #a5afbb; font-size: 7px; }
.moon-cell-formula { margin-top: 3px; color: #5c6675; font-size: 5.8px; letter-spacing: 0.07em; }
.moon-cell.is-formula { border-color: rgba(255, 215, 111, 0.25); box-shadow: inset 0 0 18px rgba(255, 215, 111, 0.045); }
.moon-cell.is-formula .moon-cell-formula { color: var(--gold); }

.moon-cell:hover,
.lunar-cell:hover { color: white; background: rgba(105, 230, 255, 0.09); }
.moon-cell.is-target,
.lunar-cell.is-target { border-color: rgba(255, 215, 111, 0.38); box-shadow: inset 0 0 18px rgba(255, 215, 111, 0.06); }
.moon-cell.is-frozen,
.lunar-cell.is-frozen { color: var(--mint); border-color: rgba(124, 247, 202, 0.32); }
.moon-cell.is-frozen { transform: translateY(-2px); box-shadow: 0 7px 17px rgba(0, 0, 0, 0.2), inset 0 0 18px rgba(124, 247, 202, 0.06); }
.moon-result { width: min(650px, 100%); margin: 8px auto 0; padding: 10px 12px; color: var(--mint); background: rgba(124, 247, 202, 0.045); border: 1px solid rgba(124, 247, 202, 0.13); border-radius: 9px; font: 8.5px ui-monospace, monospace; }
.moon-result strong,
.moon-result span { display: block; }
.moon-result span { margin-top: 4px; color: #718e83; }

.workbook-formula,
.lunar-formula {
  width: min(650px, 100%);
  margin: 8px auto 0;
  padding: 10px 12px;
  color: var(--cyan);
  background: rgba(7, 8, 20, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 9px;
  font: 9px ui-monospace, monospace;
}

.executive-office {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(280px, 1fr);
  align-items: center;
  gap: 24px;
  height: 100%;
  padding: 24px;
  background: linear-gradient(90deg, rgba(255, 215, 111, 0.025), transparent 60%);
}

.vip-office {
  display: grid;
  grid-template-columns: minmax(210px, 0.7fr) minmax(300px, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  gap: 17px 28px;
  min-height: 360px;
  margin-top: 16px;
  padding: 24px;
  background: radial-gradient(circle at 18% 50%, rgba(255, 124, 186, 0.08), transparent 32%), rgba(8, 9, 22, 0.38);
  border: 1px solid rgba(255, 124, 186, 0.08);
  border-radius: 16px;
}

.executive-button {
  justify-self: center;
  width: var(--executive-size, 170px);
  min-height: var(--executive-height, 78px);
  padding: 12px;
  color: #180e1d;
  background: linear-gradient(145deg, #ffd9ea, #ff8fc4);
  border-radius: 18px;
  box-shadow: 0 22px 50px rgba(255, 124, 186, 0.2), inset 0 2px rgba(255, 255, 255, 0.5);
  font-size: 11px;
  font-weight: 900;
  transition: width 0.45s var(--ease-spring), min-height 0.45s var(--ease-spring), transform 0.3s var(--ease-spring);
}

.vip-button {
  position: relative;
  grid-row: 1;
  justify-self: center;
  width: calc(165px + var(--promotion-level, 0) * 15px);
  min-height: calc(72px + var(--promotion-level, 0) * 5px);
  padding: 13px;
  color: #1c0c18;
  background: linear-gradient(145deg, #ffe0ed, #ff8ec3);
  border-radius: 17px;
  box-shadow: 0 20px 45px rgba(255, 124, 186, 0.18), inset 0 2px rgba(255, 255, 255, 0.46);
  font-size: 10px;
  font-weight: 900;
  transition: width 0.42s var(--ease-spring), min-height 0.42s var(--ease-spring), transform 0.25s var(--ease-spring);
}
.vip-button:hover { transform: translateY(-4px) rotate(-1deg); }
.vip-button-tie { position: absolute; left: 50%; bottom: -15px; color: #37243b; font-size: 19px; transform: translateX(-50%) rotate(45deg); }
.vip-progress { grid-column: 1; align-self: start; color: #776b78; font: 7.5px/1.4 ui-monospace, monospace; text-align: center; }
.vip-memo { grid-column: 2; grid-row: 1 / 3; min-height: 250px; padding: 17px; background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.07); border-radius: 13px; }
.vip-memo h4 { color: #e2dce4; font-size: 12px; }
.vip-memo > p { margin-top: 7px; color: #817b87; font-size: 9px; line-height: 1.5; }
.vip-memo-options { display: grid; gap: 7px; margin-top: 12px; }
.vip-memo-choice { min-height: 42px; padding: 8px 10px; color: #aaa1aa; background: rgba(255, 255, 255, 0.035); border: 1px solid rgba(255, 255, 255, 0.065); border-radius: 9px; text-align: left; font-size: 8px; }
.vip-memo-choice:hover { color: white; border-color: rgba(255, 124, 186, 0.22); transform: translateX(3px); }
.vip-memo-approved { padding: 12px; color: var(--mint) !important; background: rgba(124, 247, 202, 0.05); border-radius: 9px; }
.vip-decision-log { display: none; }
.vip-intern-button { display: grid; place-items: center; width: 44px; height: 44px; margin: 17px auto 0; color: #0b0b16; background: var(--gold); border-radius: 50%; font: 900 7px ui-monospace, monospace; box-shadow: 0 0 24px rgba(255, 215, 111, 0.18); }
.project-game--button.is-delegated .vip-office { filter: hue-rotate(25deg); }

.executive-button:hover { transform: translateY(-5px) rotate(-1deg); }
.memo-stack,
.memo-grid { display: grid; gap: 8px; }
.memo-choice,
.bureaucracy-choice {
  min-height: 49px;
  padding: 10px 12px;
  color: #aeadc0;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  text-align: left;
  font-size: 9px;
}
.memo-choice:hover,
.bureaucracy-choice:hover { color: white; border-color: rgba(255, 124, 186, 0.25); transform: translateX(4px); }

.prompt-garden {
  position: relative;
  min-height: 390px;
  padding: 20px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 100%, rgba(124, 247, 202, 0.14), transparent 55%),
    linear-gradient(transparent 70%, rgba(31, 77, 60, 0.14));
}

.project-game--garden { background: radial-gradient(ellipse at 50% 110%, rgba(124, 247, 202, 0.12), transparent 48%); }
.garden-seed { display: flex; align-items: center; gap: 8px; width: fit-content; margin: 14px auto 0; padding: 8px 11px; color: #b8d5c8; background: rgba(124, 247, 202, 0.05); border: 1px solid rgba(124, 247, 202, 0.12); border-radius: 99px; font-size: 8px; }
.garden-seed-icon { color: var(--gold); }
.garden-plot { display: grid; gap: 8px; max-width: 820px; margin: 14px auto 0; padding: 0 0 70px; list-style: none; }
.garden-fork { padding: 10px; background: rgba(8, 22, 16, 0.46); border: 1px solid rgba(124, 247, 202, 0.07); border-radius: 11px; animation: garden-fork-grow 0.38s var(--ease-spring); }
.garden-fork-label { display: block; margin-bottom: 6px; color: #667b70; font: 7px ui-monospace, monospace; }
.garden-fork-options { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.garden-branch { min-height: 48px; padding: 8px 11px; color: #a5bdaf; background: rgba(124, 247, 202, 0.035); border: 1px solid rgba(124, 247, 202, 0.09); border-radius: 50% 50% 10px 10px; font-size: 8px; line-height: 1.4; }
.garden-branch:hover { color: #07140e; background: var(--mint); transform: translateY(-2px); }
.garden-branch.is-chosen { color: #07140e; background: var(--mint); }
.garden-branch.is-weed { color: #8c6d70; border-color: rgba(255, 111, 134, 0.18); text-decoration: line-through; }
.garden-weed { display: block; margin-top: 7px; color: var(--rose); font: 7px ui-monospace, monospace; }
.garden-flower-bed { position: absolute; z-index: 5; right: 20px; bottom: 18px; text-align: center; }
.garden-flower-bed p { margin-top: 5px; color: #66776d; font-size: 7px; }
.garden-flower { min-width: 108px; min-height: 55px; color: #2a2005; background: radial-gradient(circle, #fff6a9, #ffd76f 55%, #7cf7ca 57% 69%, transparent 70%); border-radius: 50%; font: 900 8px ui-monospace, monospace; filter: drop-shadow(0 0 22px rgba(255, 215, 111, 0.24)); animation: flower-bloom 0.6s var(--ease-spring); }
.garden-controls { left: 20px; right: auto; transform: none; }

.prompt-garden::after { content: ""; position: absolute; left: 0; right: 0; bottom: 57px; height: 1px; background: rgba(124, 247, 202, 0.15); }
.prompt-tree { position: relative; z-index: 2; display: flex; flex-wrap: wrap; align-content: flex-start; justify-content: center; gap: 9px; max-width: 820px; margin: 14px auto 0; }
.prompt-node {
  min-height: 46px;
  max-width: 220px;
  padding: 9px 12px;
  color: #b7d7ca;
  background: rgba(30, 73, 59, 0.34);
  border: 1px solid rgba(124, 247, 202, 0.14);
  border-radius: 50% 50% 12px 12px;
  font-size: 8.5px;
  line-height: 1.4;
}
.prompt-node:hover,
.prompt-node.is-selected { color: #08150f; background: var(--mint); transform: translateY(-4px) rotate(-1deg); }
.garden-controls { position: absolute; z-index: 4; left: 50%; bottom: 12px; display: flex; gap: 7px; transform: translateX(-50%); }
.garden-controls button { min-height: 38px; padding: 0 12px; color: #a8c6ba; background: rgba(8, 20, 15, 0.88); border: 1px solid rgba(124, 247, 202, 0.16); border-radius: 10px; font-size: 8px; }
.prompt-flower { color: var(--gold); background: rgba(255, 215, 111, 0.14); border-color: rgba(255, 215, 111, 0.3); box-shadow: 0 0 28px rgba(255, 215, 111, 0.12); animation: flower-bloom 0.6s var(--ease-spring); }

.haunted-archive {
  position: relative;
  min-height: 430px;
  overflow: hidden;
  background:
    linear-gradient(90deg, transparent 32%, rgba(194, 181, 255, 0.035) 33%, transparent 34%, transparent 65%, rgba(194, 181, 255, 0.035) 66%, transparent 67%),
    radial-gradient(circle at var(--light-x, 50%) var(--light-y, 50%), rgba(226, 235, 255, 0.16) 0 7%, rgba(157, 135, 255, 0.045) 16%, transparent 30%),
    #090a18;
}

.haunt-phrase { display: flex; justify-content: center; gap: 6px; margin: 12px auto 0; }
.haunt-fragment { min-width: 72px; padding: 8px; color: #626478; background: rgba(255, 255, 255, 0.025); border: 1px dashed rgba(255, 255, 255, 0.09); border-radius: 8px; font: 900 10px ui-monospace, monospace; text-align: center; }
.haunt-phrase.is-complete .haunt-fragment { color: var(--cyan); border-style: solid; border-color: rgba(105, 230, 255, 0.2); box-shadow: 0 0 17px rgba(105, 230, 255, 0.06); }
.haunt-archive { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 6px; min-height: 330px; margin-top: 12px; padding: 14px; overflow: hidden; background: radial-gradient(circle at var(--beam-x, 50%) var(--beam-y, 50%), rgba(229, 235, 255, 0.18) 0 6%, rgba(157, 135, 255, 0.045) 15%, transparent 27%), #080914; border: 1px solid rgba(194, 181, 255, 0.08); border-radius: 14px; }
.haunt-file { position: relative; z-index: 2; display: grid; place-items: center; align-content: center; gap: 6px; min-height: 80px; padding: 7px; color: rgba(178, 179, 197, 0.3); background: rgba(255, 255, 255, 0.017); border: 1px solid rgba(255, 255, 255, 0.04); border-radius: 8px; }
.haunt-file:hover,
.haunt-file:focus-visible { color: #e6e5f0; background: rgba(194, 181, 255, 0.05); border-color: rgba(194, 181, 255, 0.13); }
.haunt-file.is-inspected { color: #85869a; }
.haunt-file.has-fragment { color: var(--cyan); border-color: rgba(105, 230, 255, 0.25); box-shadow: inset 0 0 22px rgba(105, 230, 255, 0.05); }
.haunt-file-icon { font-size: 18px; }
.haunt-file-name { max-width: 100%; overflow: hidden; font: 6.5px ui-monospace, monospace; text-overflow: ellipsis; white-space: nowrap; }
.haunt-ghost { position: absolute; z-index: 1; right: 4%; top: 8%; color: rgba(194, 181, 255, 0.3); font: 900 25px ui-monospace, monospace; transform: rotate(8deg); pointer-events: none; animation: ghost-float 2.4s ease-in-out infinite alternate; }
.project-game--haunted.is-ghost-shuffling .haunt-file-name { animation: ghost-name-shuffle 0.35s steps(2); }
.haunt-commit { display: block; margin: 9px auto 0; }

.archive-shelves,
.inspection-grid { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 8px; height: 100%; min-height: 390px; padding: 20px; }
.archive-zone,
.inspection-zone {
  position: relative;
  min-height: 94px;
  color: rgba(190, 192, 211, 0.3);
  background: rgba(255, 255, 255, 0.018);
  border: 1px solid rgba(255, 255, 255, 0.045);
  border-radius: 9px;
  font: 8px ui-monospace, monospace;
}
.archive-zone:hover,
.inspection-zone:hover { color: #e7e7f3; background: rgba(194, 181, 255, 0.06); border-color: rgba(194, 181, 255, 0.15); }
.archive-zone.is-found,
.inspection-zone.is-found { color: var(--cyan); border-color: rgba(105, 230, 255, 0.28); box-shadow: inset 0 0 24px rgba(105, 230, 255, 0.06); }
.readme-fragments { position: absolute; z-index: 6; left: 50%; bottom: 15px; display: flex; gap: 6px; transform: translateX(-50%); }
.readme-fragments span { padding: 7px 9px; color: #65677d; background: rgba(5, 6, 15, 0.86); border: 1px solid rgba(255, 255, 255, 0.06); border-radius: 7px; font: 9px ui-monospace, monospace; }
.readme-fragments span.is-found { color: var(--cyan); }
.friendly-ghost { position: absolute; z-index: 5; right: 7%; top: 12%; font-size: 50px; opacity: 0.64; filter: drop-shadow(0 0 18px rgba(194, 181, 255, 0.25)); animation: ghost-float 3s ease-in-out infinite alternate; pointer-events: none; }

.project-quarantine,
.generic-project-lab {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  min-height: 440px;
  padding: 30px;
  text-align: center;
}
.project-game--generic { display: grid; place-items: center; align-content: center; gap: 12px; text-align: center; }
.generic-specimen { width: min(580px, 100%); padding: 19px; background: rgba(255, 255, 255, 0.028); border: 1px solid rgba(255, 255, 255, 0.07); border-radius: 14px; }
.generic-specimen-label { display: block; color: var(--violet-bright); font: 7px ui-monospace, monospace; letter-spacing: 0.1em; }
.generic-specimen strong { display: block; margin-top: 7px; color: #e2e0ec; font-size: 17px; }
.generic-specimen p { margin-top: 6px; color: #77798d; font-size: 9px; line-height: 1.5; }
.generic-certifications { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; }
.generic-certification { min-height: 42px; padding: 0 12px; color: #9293a7; background: rgba(255, 255, 255, 0.035); border: 1px solid rgba(255, 255, 255, 0.07); border-radius: 10px; font-size: 8px; }
.generic-certification.is-certified { color: #07140e; background: var(--mint); border-color: transparent; }

@keyframes garden-fork-grow { from { opacity: 0; transform: translateY(8px) scale(0.96); } }
@keyframes ghost-name-shuffle { 50% { opacity: 0.15; transform: translateX(5px); } }
.quarantine-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.quarantine-controls button { min-height: 42px; padding: 0 14px; color: #b8b7ca; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 10px; font-size: 9px; }

/* Goblin-Driven Development */
.goblin-siege-dialog {
  width: calc(100vw - 20px);
  max-width: none;
  height: calc(100vh - 20px);
  max-height: none;
  margin: 10px;
  padding: 0;
  overflow: hidden;
  color: #eef8eb;
  background:
    radial-gradient(circle at 75% 0, rgba(156, 255, 114, 0.1), transparent 27%),
    radial-gradient(circle at 12% 100%, rgba(255, 215, 111, 0.09), transparent 31%),
    linear-gradient(145deg, #0b1118, #080914 72%);
  border: 1px solid rgba(156, 255, 114, 0.19);
  border-radius: 21px;
  box-shadow: 0 45px 140px rgba(0, 0, 0, 0.83), inset 0 1px rgba(255, 255, 255, 0.07);
}

.goblin-siege-dialog[open] { animation: siege-arrive 0.55s var(--ease-spring); }
.goblin-siege-dialog::backdrop { background: rgba(1, 4, 5, 0.9); backdrop-filter: blur(8px) grayscale(0.3); }

.siege-shell { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100%; }
.siege-header {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto auto;
  align-items: center;
  gap: 24px;
  min-height: 82px;
  padding: 13px 18px;
  background: rgba(8, 14, 18, 0.92);
  border-bottom: 1px solid rgba(156, 255, 114, 0.11);
}
.siege-title-block h2 { margin: 4px 0 3px; font-size: clamp(21px, 3vw, 32px); line-height: 1; letter-spacing: -0.045em; }
.siege-title-block p { color: #76857d; font-size: 8.5px; }
.siege-hud { display: flex; gap: 6px; }
.siege-hud > span { display: grid; gap: 3px; min-width: 90px; padding: 8px 10px; color: #69766f; background: rgba(255, 255, 255, 0.025); border: 1px solid rgba(255, 255, 255, 0.055); border-radius: 9px; font: 6.5px ui-monospace, monospace; letter-spacing: 0.1em; }
.siege-hud strong { color: #d8e5d8; font-size: 11px; letter-spacing: 0; }
.siege-utility { min-height: 36px; padding: 0 11px; color: #92a097; background: rgba(255, 255, 255, 0.035); border: 1px solid rgba(255, 255, 255, 0.07); border-radius: 9px; font-size: 8px; white-space: nowrap; }
.siege-utility:hover { color: white; border-color: rgba(156, 255, 114, 0.2); }

.siege-layout { display: grid; grid-template-columns: minmax(0, 1fr) 238px; min-height: 0; }
.siege-field {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background:
    linear-gradient(rgba(156, 255, 114, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(156, 255, 114, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(31, 64, 51, 0.1) 0 33%, rgba(62, 53, 34, 0.09) 33% 66%, rgba(49, 41, 69, 0.09) 66%);
  background-size: 8.333% 14.285%, 8.333% 14.285%, auto;
}
.siege-field::before { content: ""; position: absolute; z-index: 1; left: 15%; top: 0; bottom: 0; width: 2px; background: linear-gradient(transparent, rgba(105, 230, 255, 0.45), transparent); box-shadow: 0 0 30px rgba(105, 230, 255, 0.2); }

.siege-target {
  position: absolute;
  z-index: 7;
  pointer-events: none;
  left: 16px;
  display: grid;
  grid-template-columns: 30px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  width: 126px;
  min-height: 58px;
  padding: 8px;
  color: #c8d6cd;
  background: rgba(8, 16, 19, 0.9);
  border: 1px solid rgba(105, 230, 255, 0.12);
  border-radius: 11px;
  box-shadow: 0 12px 27px rgba(0, 0, 0, 0.26);
}
.siege-target > span { grid-row: 1 / 3; font-size: 18px; }
.siege-target strong { font-size: 8px; }
.siege-target small { color: #5e6c64; font-size: 6.5px; }
.target-threads { top: calc(16.666% - 29px); }
.target-projects { top: calc(50% - 29px); }
.target-controls { top: calc(83.333% - 29px); }

.siege-grid {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(7, 1fr);
}
.siege-cell,
.tower-cell,
.siege-grid > button {
  position: relative;
  min-width: 0;
  color: rgba(156, 255, 114, 0.18);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
}
.siege-cell::before,
.tower-cell::before,
.siege-grid > button::before { content: "+"; position: absolute; inset: 50% auto auto 50%; opacity: 0; transform: translate(-50%, -50%); font: 16px ui-monospace, monospace; transition: opacity 0.2s ease, transform 0.25s var(--ease-spring); }
.siege-cell:hover,
.tower-cell:hover,
.siege-grid > button:hover { color: rgba(156, 255, 114, 0.7); background: rgba(156, 255, 114, 0.035); border-color: rgba(156, 255, 114, 0.13); }
.siege-cell:hover::before,
.tower-cell:hover::before,
.siege-grid > button:hover::before { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
.siege-grid > button[aria-disabled="true"]::before,
.siege-cell.has-tower::before { display: none; }
.siege-cell.is-path { background: rgba(156, 255, 114, 0.018); border-color: rgba(156, 255, 114, 0.035); cursor: default; }
.siege-cell.has-tower { z-index: 6; display: grid; place-items: center; align-content: center; gap: 2px; color: #071014; background: linear-gradient(145deg, #d6f9ff, #69e6ff); border: 2px solid rgba(255, 255, 255, 0.25); border-radius: 12px; box-shadow: 0 0 22px rgba(105, 230, 255, 0.15), 0 7px 16px rgba(0, 0, 0, 0.24); overflow: visible; }
.siege-cell.has-tower.tower-ballista { background: linear-gradient(145deg, #ffeaa9, #d79b4b); box-shadow: 0 0 22px rgba(255, 215, 111, 0.14); }
.siege-cell.has-tower.tower-docs { background: linear-gradient(145deg, #e2d7ff, #9d87ff); box-shadow: 0 0 24px rgba(157, 135, 255, 0.2); }
.tower-sprite { font: 900 15px ui-monospace, monospace; }
.siege-cell.has-tower small { display: block; max-width: 100%; overflow: hidden; font: 5px ui-monospace, monospace; text-overflow: ellipsis; white-space: nowrap; }
.siege-cell.is-firing { animation: tower-recoil-cell 0.25s var(--ease-spring); }

.siege-entities { position: absolute; z-index: 10; inset: 0; pointer-events: none; }
.siege-goblin {
  position: absolute;
  z-index: 12;
  display: grid;
  justify-items: center;
  width: 62px;
  min-height: 58px;
  padding: 0;
  color: #dfffd5;
  background: transparent;
  border: 0;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  animation: goblin-march-button 0.3s steps(2) infinite;
}
.goblin-sprite { position: relative; display: grid; place-items: center; width: 39px; height: 38px; color: #173116; background: linear-gradient(155deg, #c5ff96, #61b65a); border: 2px solid #315f34; border-radius: 48% 48% 40% 40%; box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3), inset 0 2px rgba(255, 255, 255, 0.22); }
.goblin-sprite::before,
.goblin-sprite::after { content: ""; position: absolute; top: 9px; width: 12px; height: 15px; background: #77d66a; clip-path: polygon(100% 0, 100% 100%, 0 50%); z-index: -1; }
.goblin-sprite::before { left: -10px; }
.goblin-sprite::after { right: -10px; transform: scaleX(-1); }
.goblin-sprite b { font-size: 13px; }
.goblin-ear { display: none; }
.goblin-clipboard { position: absolute; right: -9px; bottom: -6px; width: 16px; height: 20px; background: #e3c38d; border: 1px solid #7a5831; border-radius: 2px; transform: rotate(8deg); }
.goblin-clipboard::before { content: ""; position: absolute; left: 4px; right: 4px; top: -3px; height: 5px; background: #8c6b40; border-radius: 2px; }
.goblin-name { display: block; max-width: 64px; margin-top: 3px; overflow: hidden; color: #a8c1a4; font: 6px ui-monospace, monospace; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 3px #000; }
.goblin-health { display: block; width: 38px; height: 3px; margin-top: 2px; overflow: hidden; background: rgba(255, 255, 255, 0.1); border-radius: 99px; }
.goblin-health > i { display: block; height: 100%; background: linear-gradient(90deg, var(--rose), #a7ff80); border-radius: inherit; }
.siege-goblin.goblin-boss { width: 86px; }
.siege-goblin.goblin-boss .goblin-sprite { width: 57px; height: 55px; background: linear-gradient(155deg, #dcff91, #4d9a47); border-width: 3px; box-shadow: 0 0 28px rgba(156, 255, 114, 0.22), 0 12px 20px rgba(0, 0, 0, 0.36); }
.siege-goblin.goblin-boss .goblin-sprite::before,
.siege-goblin.goblin-boss .goblin-sprite::after { width: 17px; height: 20px; }
.siege-goblin.is-hit .goblin-sprite { filter: brightness(1.8) saturate(0.3); transform: rotate(-7deg); }
.siege-goblin.is-reading-docs { opacity: 0.72; }
.siege-goblin.is-reading-docs::after { content: "reading…"; position: absolute; top: -10px; padding: 3px 5px; color: #e5dcff; background: rgba(11, 9, 28, 0.9); border-radius: 5px; font: 5.5px ui-monospace, monospace; }
.siege-goblin.is-defeated { animation: goblin-defeated 0.42s var(--ease-spring) forwards; }
.siege-goblin.is-surrendering .goblin-sprite { filter: grayscale(0.5); transform: rotate(12deg); }
.siege-goblin.is-celebrating { animation: goblin-celebrate 0.5s ease-in-out infinite alternate; }
.siege-projectile { position: absolute; z-index: 30; color: var(--gold); font: 900 10px ui-monospace, monospace; text-shadow: 0 0 12px currentColor; transform: translate(-50%, -50%); }
.goblin,
.goblin-entity {
  position: absolute;
  display: grid;
  place-items: center;
  width: 44px;
  height: 48px;
  color: #172315;
  background:
    radial-gradient(circle at 63% 34%, #1b2418 0 2px, transparent 2.5px),
    radial-gradient(circle at 38% 34%, #1b2418 0 2px, transparent 2.5px),
    linear-gradient(155deg, #b7ff8f, #5cae54);
  border: 2px solid #294d2d;
  border-radius: 45% 45% 38% 38%;
  box-shadow: 0 9px 18px rgba(0, 0, 0, 0.32), inset 0 2px rgba(255, 255, 255, 0.2);
  font: 900 7px/1.1 ui-monospace, monospace;
  text-align: center;
  transform: translate(-50%, -50%);
  animation: goblin-march 0.3s steps(2) infinite;
}
.goblin::before,
.goblin-entity::before { content: ""; position: absolute; left: -9px; top: 10px; width: 59px; height: 14px; background: #76d66a; clip-path: polygon(0 50%, 16% 0, 18% 40%, 82% 40%, 84% 0, 100% 50%, 84% 100%, 82% 60%, 18% 60%, 16% 100%); z-index: -1; }
.goblin::after,
.goblin-entity::after { content: "▤"; position: absolute; right: -8px; bottom: -8px; display: grid; place-items: center; width: 20px; height: 22px; color: #6d4a27; background: #e2c28c; border-radius: 2px; transform: rotate(9deg); }
.goblin.is-boss,
.goblin-entity.is-boss { width: 68px; height: 72px; background: radial-gradient(circle at 64% 32%, #151c14 0 3px, transparent 3.5px), radial-gradient(circle at 37% 32%, #151c14 0 3px, transparent 3.5px), linear-gradient(155deg, #d4ff8f, #4c9c49); border-width: 3px; font-size: 8px; }

.tower,
.tower-entity {
  position: absolute;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  color: #071014;
  background: linear-gradient(145deg, #d6f9ff, #69e6ff);
  border: 3px solid rgba(255, 255, 255, 0.28);
  border-radius: 14px 14px 19px 19px;
  box-shadow: 0 0 25px rgba(105, 230, 255, 0.19), 0 10px 20px rgba(0, 0, 0, 0.28);
  font: 900 15px ui-monospace, monospace;
  transform: translate(-50%, -50%);
}
.tower[data-type="ballista"],
.tower-ballista { color: #2b1807; background: linear-gradient(145deg, #ffeaa9, #d79b4b); }
.tower[data-type="docs"],
.tower-docs { color: #180d2d; background: linear-gradient(145deg, #e2d7ff, #9d87ff); box-shadow: 0 0 30px rgba(157, 135, 255, 0.28); }
.tower.is-firing,
.tower-entity.is-firing { animation: tower-recoil 0.25s var(--ease-spring); }
.projectile { position: absolute; width: 8px; height: 8px; background: var(--gold); border-radius: 50%; box-shadow: 0 0 12px currentColor; transform: translate(-50%, -50%); }

.siege-lane-labels { position: absolute; z-index: 2; right: 10px; top: 0; bottom: 0; display: grid; grid-template-rows: repeat(3, 1fr); color: rgba(255, 255, 255, 0.085); font: 900 24px ui-monospace, monospace; letter-spacing: 0.08em; writing-mode: vertical-rl; }
.siege-lane-labels span { display: grid; place-items: center; }

.siege-sidebar {
  position: relative;
  z-index: 14;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 0;
  padding: 16px;
  overflow-y: auto;
  background: rgba(8, 13, 18, 0.92);
  border-left: 1px solid rgba(156, 255, 114, 0.09);
}
.goblin-cage { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px; min-height: 84px; margin-top: 8px; padding: 10px; background: repeating-linear-gradient(90deg, transparent 0 14px, rgba(255, 255, 255, 0.065) 14px 16px), rgba(0, 0, 0, 0.18); border: 1px solid rgba(255, 255, 255, 0.075); border-radius: 10px; }
.empty-cage { color: #56635c; font: 7.5px/1.45 ui-monospace, monospace; }
.caged-dog { display: grid; place-items: center; width: 34px; height: 34px; background: rgba(255, 215, 111, 0.07); border-radius: 9px; font-size: 18px; animation: caged-dog-wave 0.8s ease-in-out infinite alternate; }
.captured-dog { display: grid; justify-items: center; gap: 3px; padding: 5px; color: var(--gold); background: rgba(255, 215, 111, 0.06); border: 1px solid rgba(255, 215, 111, 0.1); border-radius: 9px; animation: caged-dog-wave 0.8s ease-in-out infinite alternate; }
.captured-dog .dog-sprite { transform: scale(0.9); }
.captured-dog small { color: #756d53; font: 5.5px ui-monospace, monospace; }
.tower-tray { display: grid; gap: 7px; }
.tower-tray > button { display: grid; gap: 3px; min-height: 55px; padding: 9px 11px; color: #a8b5ac; background: rgba(255, 255, 255, 0.025); border: 1px solid rgba(255, 255, 255, 0.06); border-radius: 10px; text-align: left; }
.tower-tray > button strong { font-size: 8.5px; }
.tower-tray > button small { color: #5e6b63; font-size: 7px; }
.tower-tray > button:hover,
.tower-tray > button.is-selected { color: #eaffdf; background: rgba(156, 255, 114, 0.07); border-color: rgba(156, 255, 114, 0.22); box-shadow: 0 0 22px rgba(156, 255, 114, 0.05); }
.siege-advance { min-height: 44px; padding: 0 12px; color: #08100a; background: linear-gradient(135deg, #d9ffc7, #8fff86); border-radius: 10px; font-size: 8.5px; font-weight: 900; }
.siege-tip { margin-top: auto; color: #57645d; font: 7.5px/1.5 ui-monospace, monospace; }

.siege-result {
  position: absolute;
  z-index: 70;
  inset: 50% auto auto 50%;
  width: min(560px, calc(100% - 30px));
  padding: 30px;
  color: #efffec;
  background:
    radial-gradient(circle at 50% 0, rgba(156, 255, 114, 0.17), transparent 40%),
    rgba(8, 17, 17, 0.98);
  border: 1px solid rgba(156, 255, 114, 0.25);
  border-radius: 20px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.75);
  text-align: center;
  transform: translate(-50%, -50%);
  animation: result-arrive 0.55s var(--ease-spring);
}
.siege-result-goblin { display: block; color: #a7ff80; font-size: 43px; text-shadow: 0 0 28px rgba(156, 255, 114, 0.4); }
.siege-result h2 { margin-top: 8px; font-size: 28px; letter-spacing: -0.045em; }
.siege-result p { margin: 8px auto 18px; max-width: 430px; color: #829087; font-size: 10px; line-height: 1.55; }
.siege-result > div { display: flex; justify-content: center; gap: 8px; }
.siege-result button { min-height: 39px; padding: 0 13px; border-radius: 10px; font-size: 8.5px; }

.thread-slot.is-goblin-stolen { pointer-events: none; animation: thread-kidnapped 0.7s var(--ease-spring) forwards !important; }
.project-card.is-under-attack { animation: project-chomp 0.32s steps(2) infinite; border-color: rgba(156, 255, 114, 0.3); }
.project-card.is-ransacked { filter: grayscale(0.8) sepia(0.4); opacity: 0.45; transform: rotate(-3deg) translateY(10px); }
.project-card.is-ransacked::after { content: "GOBLIN-OWNED ROADMAP"; opacity: 1; color: #a7ff80; transform: none; }
.goblin-project-stamp { position: absolute; z-index: 20; left: 50%; top: 50%; min-width: 160px; padding: 7px 9px; color: #12220e; background: #a7ff80; border: 2px solid #132a10; font: 900 7px ui-monospace, monospace; letter-spacing: 0.06em; text-align: center; transform: translate(-50%, -50%) rotate(-7deg); box-shadow: 0 7px 22px rgba(0, 0, 0, 0.3); pointer-events: none; }
.is-goblin-pressed { animation: goblin-button-press 0.42s steps(2) 2 !important; }
body.goblin-siege-active .toast-region { z-index: 1200; }
body.goblin-siege-active .app-shell.is-goblinized { filter: hue-rotate(19deg) saturate(0.75); }
.goblin-siege-dialog.is-breached { animation: siege-breach 0.36s steps(2); }

@keyframes experience-arrive { from { opacity: 0; transform: translateY(35px) scale(0.95) rotateX(-5deg); } }
@keyframes siege-arrive { from { opacity: 0; transform: scale(0.97); filter: hue-rotate(35deg); } }
@keyframes containment-blink { 50% { opacity: 0.25; } }
@keyframes goblin-rattle { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(3deg) scale(1.06); } }
@keyframes passport-stamp { 45% { transform: scale(0.84) rotate(-5deg); filter: brightness(1.5); } }
@keyframes badge-certify { from { opacity: 0; transform: translateY(8px) scale(0.9); } }
@keyframes brain-think { 50% { transform: translateX(-50%) scale(1.045) rotate(1deg); } }
@keyframes brain-fed { 45% { transform: scale(1.16) rotate(5deg); } }
@keyframes red-flag-arrive { from { opacity: 0; transform: translateY(30px) rotate(-20deg) scale(0.4); } }
@keyframes court-objection { 25% { transform: translateX(-8px) rotate(-1deg); } 60% { transform: translateX(7px) rotate(1deg); } }
@keyframes pigeon-judge { 50% { transform: translateY(-7px) rotate(2deg); } }
@keyframes result-arrive { from { opacity: 0; transform: translate(-50%, -43%) scale(0.86) rotate(-2deg); } }
@keyframes flower-bloom { from { opacity: 0; transform: scale(0.15) rotate(-20deg); } }
@keyframes ghost-float { to { transform: translate(8px, -13px) rotate(3deg); opacity: 0.82; } }
@keyframes goblin-march { 50% { margin-top: -4px; transform: translate(-50%, -50%) rotate(-4deg); } }
@keyframes goblin-march-button { 50% { margin-top: -4px; transform: translate(-50%, -50%) rotate(-4deg); } }
@keyframes goblin-defeated { to { opacity: 0; transform: translate(-50%, -80%) scale(0.25) rotate(35deg); } }
@keyframes goblin-celebrate { to { transform: translate(-50%, -58%) rotate(7deg) scale(1.07); } }
@keyframes tower-recoil { 45% { transform: translate(-50%, -50%) scale(0.86) rotate(-8deg); } }
@keyframes tower-recoil-cell { 45% { transform: scale(0.82) rotate(-7deg); filter: brightness(1.4); } }
@keyframes siege-breach { 50% { transform: translate(5px, -3px); filter: hue-rotate(70deg) brightness(1.3); } }
@keyframes caged-dog-wave { to { transform: rotate(7deg) translateY(-3px); } }
@keyframes thread-kidnapped { 45% { transform: translateX(18px) rotate(4deg); } 100% { opacity: 0.08; transform: translateX(-110%) scale(0.15) rotate(-16deg); } }
@keyframes project-chomp { 50% { transform: translate(4px, -2px) rotate(1deg); } }
@keyframes goblin-button-press { 50% { transform: translateY(6px) scale(0.94); filter: hue-rotate(80deg); } }

@media (min-width: 1001px) {
  .mischief-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 1160px; }
  .mischief-grid .magic-card:last-child { grid-column: auto; }
}

@media (max-width: 1000px) {
  .mischief-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mischief-grid .magic-card:last-child { grid-column: auto; }
  .experience-shell { min-height: calc(100vh - 28px); }
  .siege-header { grid-template-columns: 1fr auto; }
  .siege-hud { grid-column: 1 / -1; grid-row: 2; }
  .siege-layout { grid-template-columns: minmax(0, 1fr) 205px; }
}

@media (max-width: 720px) {
  .parody-footer .legal-button { display: inline-flex; }
  .chaos-passport-button { position: relative; justify-content: center; width: 36px; min-width: 36px; padding: 0; gap: 0; }
  .chaos-passport-button > span:last-child { position: absolute; top: -5px; right: -5px; display: grid; place-items: center; width: 16px; height: 16px; color: #11121f; background: var(--gold); border: 2px solid #0b0c1b; border-radius: 50%; }
  .chaos-passport-button strong { color: #11121f; font-size: 7px; }
  .chaos-passport-button small { display: none; }
  .project-header-actions { width: 100%; flex-direction: column-reverse; }
  .project-header-actions button { width: 100%; }
  .goblin-annex { grid-template-columns: auto 1fr; }
  .goblin-annex-readout { grid-column: 1 / -1; }
  .experience-dialog { width: 100vw; height: 100dvh; max-height: 100dvh; overflow-y: auto; overscroll-behavior: contain; border: 0; border-radius: 0; }
  .experience-shell { min-height: 100dvh; }
  .experience-header { padding: 18px 17px 13px; }
  .experience-heading h2 { font-size: 27px; }
  .experience-footer { align-items: stretch; flex-direction: column; gap: 8px; padding: 10px 14px; }
  .experience-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .experience-actions button { white-space: normal; }
  .brain-game,
  .brain-scoop-game,
  .brain-scoop-scene,
  .therapy-game,
  .specificity-game,
  .lab-scene { min-height: 480px; }
  .brain-target,
  .ai-brain { bottom: 18px; transform: translateX(-50%) scale(0.86); }
  .affirmation-bank { left: 12px; right: 12px; bottom: 12px; width: auto; }
  .specificity-game { grid-template-columns: 1fr; overflow-y: auto; }
  .specificity-court { grid-template-columns: 1fr; grid-template-rows: auto auto auto auto; }
  .specificity-court .verdict-preview { grid-column: 1; }
  .therapy-question { top: 58px; left: 20px; right: 20px; max-width: none; text-align: left; }
  .therapy-patient { min-width: 145px; }
  .moon-sheet,
  .lunar-workbook { grid-template-columns: repeat(4, minmax(54px, 1fr)); }
  .moon-cell,
  .lunar-cell { min-height: 54px; font-size: 7px; }
  .project-game-title { padding-right: 0; }
  .moon-target { position: static; width: fit-content; margin: 12px 0 0; }
  .project-game { min-height: 100%; padding: 16px; }
  .executive-office { grid-template-columns: 1fr; align-content: center; overflow-y: auto; }
  .vip-office { grid-template-columns: 1fr; grid-template-rows: auto; min-height: 0; padding: 15px; }
  .vip-button,
  .vip-progress,
  .vip-memo { grid-column: 1; grid-row: auto; }
  .vip-memo { min-height: 0; }
  .archive-shelves,
  .inspection-grid { padding: 12px; gap: 5px; }

  .goblin-siege-dialog { width: 100vw; height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .siege-shell { grid-template-rows: auto minmax(0, 1fr); }
  .siege-header { grid-template-columns: 1fr auto; gap: 8px; padding: 9px 10px; }
  .siege-title-block p { display: none; }
  .siege-title-block h2 { font-size: 19px; }
  .siege-hud { grid-column: 1 / -1; overflow-x: auto; }
  .siege-hud > span { min-width: 82px; }
  .siege-header-actions { flex-direction: column; }
  .siege-header-actions button { min-height: 29px; font-size: 7px; }
  .siege-layout { grid-template-columns: 1fr; grid-template-rows: minmax(360px, 1fr) auto; overflow: auto; }
  .siege-field { min-height: 390px; }
  .siege-target { left: 5px; width: 82px; min-height: 48px; grid-template-columns: 25px 1fr; padding: 5px; }
  .siege-target small { display: none; }
  .siege-sidebar { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 10px; padding: 10px; border-top: 1px solid rgba(156, 255, 114, 0.09); border-left: 0; overflow: visible; }
  .goblin-cage { min-height: 65px; }
  .tower-tray { grid-template-columns: repeat(3, minmax(110px, 1fr)); overflow-x: auto; }
  .tower-tray .kicker { grid-column: 1 / -1; }
  .tower-tray > button { min-height: 48px; }
  .siege-advance { grid-column: 1 / -1; }
  .siege-tip { display: none; }
  .goblin,
  .goblin-entity,
  .siege-goblin { width: 48px; min-height: 44px; font-size: 5.5px; }
  .goblin-sprite { width: 31px; height: 31px; }
  .tower,
  .tower-entity { width: 38px; height: 38px; }
}

@media (max-width: 520px) {
  .chaos-badges { grid-template-columns: 1fr; }
  .mischief-grid { grid-template-columns: 1fr; }
  .experience-hud { padding-inline: 14px; }
  .experience-actions { grid-template-columns: 1fr; }
  .letter-scoop { left: 7%; }
  .rebuilt-transcript,
  .brain-transcript { left: 12px; top: 12px; width: calc(100% - 24px); }
  .goblin-annex { padding: 12px; }
  .goblin-annex-icon { display: none; }
  .goblin-annex > div { grid-column: 1 / -1; }
  .garden-fork-options { grid-template-columns: 1fr; }
  .garden-flower-bed { position: static; margin: 12px auto 0; }
  .haunt-archive { grid-template-columns: repeat(2, 1fr); }
  .siege-title-block .dialog-kicker { display: none; }
  .siege-header-actions { gap: 3px; }
  .siege-target { width: 72px; }
  .siege-target strong { font-size: 6.5px; }
  .siege-sidebar { grid-template-columns: 92px minmax(0, 1fr); }
  .tower-tray { grid-template-columns: repeat(3, 120px); }
  .siege-result { padding: 22px 15px; }
  .siege-result h2 { font-size: 23px; }
  .siege-result > div { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .card-goblins .card-icon,
  .goblin-annex-readout i,
  .brain-target,
  .ai-brain,
  .detective-pigeon,
  .friendly-ghost,
  .goblin,
  .goblin-entity,
  .siege-goblin,
  .caged-dog,
  .captured-dog,
  .project-card.is-under-attack { animation: none !important; }
  .falling-letter,
  .letter-tile,
  .brain-letter,
  .therapy-button,
  .avoidant-button { transition-duration: 0.01ms !important; }
}

/* Goblin Siege: the completely reasonable 100-wave campaign */
.goblin-siege-dialog {
  --chapter-accent: #9cff72;
  --chapter-glow: rgba(156, 255, 114, 0.18);
}

.goblin-siege-dialog .siege-shell {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.goblin-siege-dialog .siege-header {
  grid-template-columns: minmax(250px, 0.9fr) minmax(430px, 1.5fr) auto;
  gap: 13px;
  min-height: 76px;
  padding: 10px 14px;
  border-bottom-color: color-mix(in srgb, var(--chapter-accent) 19%, transparent);
}

.goblin-siege-dialog .siege-title-block h2 { font-size: clamp(19px, 2.4vw, 28px); }
.goblin-siege-dialog .siege-title-block p { max-width: 470px; }
.goblin-siege-dialog .siege-hud { min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.goblin-siege-dialog .siege-hud > span { min-width: 76px; padding: 7px 9px; }
.goblin-siege-dialog .siege-hud strong { color: var(--chapter-accent); }
.goblin-siege-dialog .siege-header-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(92px, 1fr));
  gap: 5px;
}
.goblin-siege-dialog .siege-header-actions .siege-utility { min-height: 38px; }

.siege-command-strip {
  position: relative;
  z-index: 22;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(520px, auto);
  align-items: center;
  gap: 14px;
  min-height: 76px;
  padding: 8px 14px 11px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--chapter-accent) 7%, transparent), transparent 43%),
    rgba(7, 11, 18, 0.96);
  border-bottom: 1px solid color-mix(in srgb, var(--chapter-accent) 15%, transparent);
}

.siege-guide { min-width: 0; }
.siege-guide p { margin-top: 4px; color: #b7c7bb; font-size: 8.5px; line-height: 1.35; }
.siege-guide p strong { color: var(--chapter-accent); }
.siege-guide > small { display: block; margin-top: 3px; color: #617068; font: 6.5px/1.35 ui-monospace, monospace; }

.siege-hero-roster {
  display: grid;
  grid-template-columns: repeat(4, minmax(116px, 1fr));
  gap: 6px;
}

.siege-hero-roster > button {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  min-height: 48px;
  padding: 6px 8px;
  color: #c6d5ca;
  background: rgba(255, 255, 255, 0.028);
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 10px;
  text-align: left;
}
.siege-hero-roster > button > span { grid-row: 1 / 3; display: grid; place-items: center; width: 24px; height: 24px; color: #07120b; background: var(--chapter-accent); border-radius: 8px; font: 900 10px ui-monospace, monospace; box-shadow: 0 0 16px var(--chapter-glow); }
.siege-hero-roster > button strong { font-size: 8px; }
.siege-hero-roster > button small { overflow: hidden; color: #68776e; font: 6px ui-monospace, monospace; text-overflow: ellipsis; white-space: nowrap; }
.siege-hero-roster > button:hover:not(:disabled),
.siege-hero-roster > button.is-ready { color: white; border-color: color-mix(in srgb, var(--chapter-accent) 35%, transparent); background: color-mix(in srgb, var(--chapter-accent) 8%, transparent); }
.siege-hero-roster > button.is-active { box-shadow: 0 0 0 2px var(--chapter-accent), 0 0 25px var(--chapter-glow); }
.siege-hero-roster > button.is-reset-warning { color: #fff1f5; border-color: rgba(255, 92, 138, 0.62); background: rgba(255, 92, 138, 0.13); animation: tibo-reset-alarm 0.7s steps(2) infinite; }
.siege-hero-roster > button:disabled { opacity: 0.5; cursor: not-allowed; }

.siege-campaign-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 3px;
  appearance: none;
  background: rgba(255, 255, 255, 0.04);
  border: 0;
}
.siege-campaign-progress::-webkit-progress-bar { background: rgba(255, 255, 255, 0.04); }
.siege-campaign-progress::-webkit-progress-value { background: linear-gradient(90deg, #69e6ff, var(--chapter-accent)); box-shadow: 0 0 12px var(--chapter-glow); }
.siege-campaign-progress::-moz-progress-bar { background: linear-gradient(90deg, #69e6ff, var(--chapter-accent)); }

.goblin-siege-dialog .siege-layout { grid-template-columns: minmax(0, 1fr) 330px; }
.siege-field-viewport { min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; background: #080d13; scrollbar-width: thin; }
.siege-field-viewport:focus-visible { outline: 2px solid var(--chapter-accent); outline-offset: -3px; }
.siege-field-viewport .siege-field { min-width: 760px; min-height: 470px; height: 100%; }
.siege-target small b { color: #d8f5d0; font-size: 7px; }
.siege-target.is-critical { border-color: rgba(255, 92, 138, 0.56); box-shadow: 0 0 24px rgba(255, 92, 138, 0.16); }

.siege-horde-canvas {
  position: absolute;
  z-index: 3;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease;
}
.goblin-siege-dialog.is-horde-wave .siege-horde-canvas { opacity: 0.62; }

.siege-jason-runner {
  position: absolute;
  z-index: 28;
  left: 13%;
  top: 50%;
  display: grid;
  justify-items: center;
  gap: 2px;
  color: #eafaff;
  filter: drop-shadow(0 10px 13px rgba(0, 0, 0, 0.55));
  pointer-events: none;
}
.siege-jason-runner > span { display: grid; place-items: center; width: 42px; height: 42px; color: #071018; background: linear-gradient(145deg, #dff8ff, #69e6ff); border: 3px solid white; border-radius: 50% 50% 42% 42%; font: 900 15px ui-monospace, monospace; box-shadow: 0 0 28px rgba(105, 230, 255, 0.45); }
.siege-jason-runner small { font: 900 7px ui-monospace, monospace; text-shadow: 0 2px 5px #000; }
.siege-jason-runner.is-running { animation: jason-inbox-sprint 1.05s ease-in-out infinite alternate; }

.goblin-siege-dialog .siege-sidebar { gap: 11px; padding: 11px; }
.siege-cage-panel .goblin-cage { min-height: 54px; max-height: 90px; overflow-y: auto; }
.goblin-siege-dialog .tower-tray { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.goblin-siege-dialog .tower-tray .kicker { grid-column: 1 / -1; }
.goblin-siege-dialog .tower-tray > button { min-height: 52px; padding: 7px 8px; }
.goblin-siege-dialog .tower-tray > button strong { font-size: 7.5px; }
.goblin-siege-dialog .tower-tray > button small { font-size: 6px; }
.goblin-siege-dialog .tower-tray > button.is-unaffordable { opacity: 0.46; }
.goblin-siege-dialog .tower-tray > button[data-tower$="Wall"],
.goblin-siege-dialog .tower-tray > button[data-tower="rateGate"] { border-style: dashed; }

.siege-tower-inspector {
  display: grid;
  gap: 6px;
  padding: 9px;
  color: #c9d7cc;
  background: linear-gradient(145deg, rgba(105, 230, 255, 0.07), rgba(156, 255, 114, 0.035));
  border: 1px solid rgba(105, 230, 255, 0.14);
  border-radius: 11px;
}
.siege-tower-inspector[hidden] { display: none; }
.siege-tower-inspector > strong { font-size: 9px; }
.siege-tower-inspector > p { color: #74827a; font: 6.5px/1.4 ui-monospace, monospace; }
.siege-inspector-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.siege-inspector-actions button { min-height: 38px; padding: 5px; color: #b9c8bd; background: rgba(255, 255, 255, 0.035); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 8px; font-size: 6.5px; }
.siege-inspector-actions button:hover:not(:disabled) { color: #07120b; background: var(--chapter-accent); }
.siege-inspector-actions button:disabled { opacity: 0.42; }

.siege-control-stack { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.siege-control-stack > button { min-height: 44px; padding: 7px 8px; border-radius: 9px; font-size: 7px; font-weight: 900; }
.siege-control-stack .siege-advance { color: #08100a; background: linear-gradient(135deg, #d9ffc7, var(--chapter-accent)); }
.siege-review { color: #071018; background: linear-gradient(135deg, #dff8ff, #69e6ff); }
.siege-skip { color: #d6c9ff; background: rgba(157, 135, 255, 0.08); border: 1px solid rgba(157, 135, 255, 0.19); }
.siege-threat-summary { min-height: 34px; padding: 7px 8px; color: #89988f; background: rgba(0, 0, 0, 0.18); border-radius: 8px; font: 6.5px/1.45 ui-monospace, monospace; }
.goblin-siege-dialog .siege-tip { margin-top: 0; }

.siege-cell.is-path { cursor: crosshair; }
.siege-cell.is-path:not(.has-tower):hover { color: #ffd76f; background: rgba(255, 215, 111, 0.055); border-color: rgba(255, 215, 111, 0.16); }
.siege-cell.is-path:not(.has-tower)::before { content: "="; }
.siege-cell.is-hero-post,
.siege-cell.is-hero-post:disabled {
  cursor: default;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.055), transparent 62%);
  border-color: rgba(255, 255, 255, 0.045);
  opacity: 1;
}
.siege-cell.is-hero-post::before { content: ""; }
.siege-cell.is-selected-defense { outline: 2px solid white; outline-offset: -4px; }
.siege-cell.is-merge-source { box-shadow: 0 0 0 3px #9d87ff, 0 0 34px rgba(157, 135, 255, 0.42); }
.siege-cell.is-merge-target { animation: merge-target-pulse 0.8s ease-in-out infinite alternate; }
.siege-cell.is-recommended { box-shadow: inset 0 0 0 2px rgba(105, 230, 255, 0.65); }
.siege-cell.is-damaged { filter: saturate(0.6) brightness(0.75); }
.siege-cell.has-tower[data-level="2"] { border-color: #fff4b5; }
.siege-cell.has-tower[data-level="3"] { border-color: #ffadf2; box-shadow: 0 0 25px rgba(255, 122, 218, 0.24); }
.siege-cell.has-tower[data-level="4"] { border-color: white; box-shadow: 0 0 0 2px var(--chapter-accent), 0 0 38px var(--chapter-glow); }
.tower-level { position: absolute; right: -5px; top: -6px; display: grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px; color: #071018; background: white; border-radius: 99px; font: 900 6px ui-monospace, monospace; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4); }
.defense-health { position: absolute; left: 12%; right: 12%; bottom: -6px; height: 3px; overflow: hidden; background: rgba(0, 0, 0, 0.35); border-radius: 99px; }
.defense-health > i { display: block; width: var(--defense-health, 100%); height: 100%; background: linear-gradient(90deg, #ff5c8a, #9cff72); }

.siege-cell.has-tower.tower-mortar { color: #1b0a1d; background: linear-gradient(145deg, #ffc7f3, #d16ebc); }
.siege-cell.has-tower.tower-fan { color: #05161c; background: linear-gradient(145deg, #d7fbff, #62cfe8); }
.siege-cell.has-tower.tower-duck { color: #2b2206; background: linear-gradient(145deg, #fff8b9, #e9bd3e); }
.siege-cell.has-tower.tower-captcha { color: #160b2b; background: linear-gradient(145deg, #e5d9ff, #ad87ff); }
.siege-cell.has-tower.tower-coffee { color: #f8e6cf; background: linear-gradient(145deg, #8d5b3c, #3c2118); }
.siege-cell.has-tower.tower-termsWall,
.siege-cell.has-tower.tower-rateGate { border-radius: 5px; border-width: 3px; }
.siege-cell.has-tower.tower-termsWall { color: #221d11; background: repeating-linear-gradient(90deg, #f2e6bd 0 7px, #b9a66d 7px 9px); }
.siege-cell.has-tower.tower-rateGate { color: #061b16; background: repeating-linear-gradient(90deg, #9cffa8 0 5px, #3ea66a 5px 8px); }

.siege-goblin { will-change: transform; }
.siege-goblin .goblin-health > i { transform-origin: left center; }
.siege-goblin.goblin-knight .goblin-sprite { background: linear-gradient(155deg, #d9e3cc, #71846b); border-color: #dce8d8; }
.siege-goblin.goblin-shaman .goblin-sprite { background: linear-gradient(155deg, #dbb7ff, #7250a7); }
.siege-goblin.goblin-fork .goblin-sprite { background: linear-gradient(155deg, #d0ff85, #8a9f39); }
.siege-goblin.goblin-phantom { opacity: 0.26; filter: blur(0.4px); }
.siege-goblin.goblin-phantom.is-revealed { opacity: 1; filter: none; }
.siege-goblin.goblin-plug .goblin-sprite { background: linear-gradient(155deg, #e8deff, #8170bd); }
.siege-goblin.goblin-twins .goblin-sprite { box-shadow: 9px 4px 0 -2px #69b95c, 0 8px 16px rgba(0, 0, 0, 0.3); }
.siege-goblin.goblin-longpress .goblin-sprite { transform: scaleX(1.25); }
.siege-goblin.goblin-burrower .goblin-sprite { box-shadow: inset 0 -11px rgba(59, 39, 18, 0.38), 0 8px 16px rgba(0, 0, 0, 0.3); }
.siege-goblin.goblin-captain .goblin-sprite { border-color: #ffe69b; box-shadow: 0 0 22px rgba(255, 215, 111, 0.32), 0 8px 16px rgba(0, 0, 0, 0.3); }
.siege-goblin.goblin-horde { width: 78px; }
.siege-goblin.goblin-horde .goblin-sprite { box-shadow: -13px 5px 0 -4px #70bd60, 13px 6px 0 -4px #5fa956, 0 8px 16px rgba(0, 0, 0, 0.35); }
.siege-goblin.is-stunned .goblin-sprite { filter: grayscale(0.6) brightness(1.4); }
.siege-goblin.is-disabled { opacity: 0.48; }

.goblin-siege-dialog.is-tibo-warning { box-shadow: 0 0 0 4px rgba(255, 92, 138, 0.5), 0 45px 140px rgba(0, 0, 0, 0.83); }
.goblin-siege-dialog.is-horde-wave { --chapter-accent: #ff7ada; --chapter-glow: rgba(255, 122, 218, 0.28); }

@keyframes tibo-reset-alarm { 50% { transform: translateY(2px); filter: brightness(1.55); } }
@keyframes jason-inbox-sprint { to { left: 83%; transform: translateY(-9px) rotate(3deg); } }
@keyframes merge-target-pulse { to { box-shadow: 0 0 0 3px #9d87ff, 0 0 30px rgba(157, 135, 255, 0.44); } }

@media (max-width: 1180px) {
  .goblin-siege-dialog .siege-header { grid-template-columns: minmax(230px, 1fr) auto; }
  .goblin-siege-dialog .siege-hud { grid-column: 1 / -1; grid-row: 2; }
  .goblin-siege-dialog .siege-header-actions { grid-column: 2; grid-row: 1; }
  .siege-command-strip { grid-template-columns: minmax(220px, 0.8fr) minmax(470px, 1.2fr); }
  .goblin-siege-dialog .siege-layout { grid-template-columns: minmax(0, 1fr) 292px; }
}

@media (max-width: 860px) {
  .siege-command-strip { grid-template-columns: 1fr; gap: 7px; }
  .siege-guide > small { display: none; }
  .siege-hero-roster { overflow-x: auto; grid-template-columns: repeat(4, minmax(130px, 1fr)); }
  .goblin-siege-dialog .siege-layout { grid-template-columns: 1fr; grid-template-rows: minmax(400px, 1fr) auto; overflow: auto; }
  .siege-field-viewport { min-height: 410px; }
  .goblin-siege-dialog .siege-sidebar { display: grid; grid-template-columns: 140px minmax(430px, 1fr); align-items: start; overflow: visible; border-top: 1px solid rgba(156, 255, 114, 0.1); border-left: 0; }
  .goblin-siege-dialog .tower-tray { grid-template-columns: repeat(5, minmax(130px, 1fr)); overflow-x: auto; }
  .goblin-siege-dialog .tower-tray .kicker { grid-column: 1 / -1; }
  .siege-tower-inspector,
  .siege-control-stack,
  .siege-threat-summary,
  .goblin-siege-dialog .siege-tip { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .goblin-siege-dialog .siege-shell { grid-template-rows: auto auto minmax(0, 1fr); }
  .goblin-siege-dialog .siege-header { grid-template-columns: minmax(0, 1fr) auto; padding: max(8px, env(safe-area-inset-top)) 9px 8px; }
  .goblin-siege-dialog .siege-header-actions { grid-template-columns: repeat(2, minmax(84px, 1fr)); }
  .goblin-siege-dialog .siege-header-actions .siege-utility { min-height: 44px; }
  .goblin-siege-dialog .siege-hud > span { min-width: 88px; font-size: 7px; }
  .goblin-siege-dialog .siege-hud strong { font-size: 12px; }
  .siege-command-strip { padding: 7px 9px 10px; }
  .siege-guide p { font-size: 8px; }
  .siege-hero-roster { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(142px, 1fr); grid-template-columns: none; }
  .siege-hero-roster > button { min-height: 48px; }
  .goblin-siege-dialog .siege-layout { grid-template-rows: minmax(420px, 1fr) auto; }
  .siege-field-viewport { min-height: 420px; }
  .siege-field-viewport .siege-field { min-width: 760px; min-height: 420px; }
  .goblin-siege-dialog .siege-sidebar { grid-template-columns: 1fr; min-width: 760px; padding: 10px max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
  .siege-cage-panel { display: none; }
  .goblin-siege-dialog .tower-tray { grid-template-columns: repeat(5, 148px); }
  .goblin-siege-dialog .tower-tray > button { min-height: 52px; }
  .siege-inspector-actions button,
  .siege-control-stack > button { min-height: 44px; font-size: 8px; }
  .siege-target { min-height: 52px; }
}

@media (max-width: 520px) {
  .goblin-siege-dialog .siege-title-block h2 { font-size: 17px; }
  .goblin-siege-dialog .siege-header-actions { gap: 3px; }
  .siege-command-strip .kicker { font-size: 6px; }
  .siege-guide p { max-height: 24px; overflow: hidden; }
  .siege-hero-roster { grid-auto-columns: 135px; }
  .siege-control-stack { grid-template-columns: 1fr; }
  .siege-result { max-height: calc(100dvh - 28px); overflow-y: auto; }
}

@media (max-height: 600px) and (orientation: landscape) {
  .goblin-siege-dialog .siege-title-block p,
  .siege-guide > small { display: none; }
  .siege-command-strip { min-height: 59px; padding-block: 5px 8px; }
  .siege-hero-roster > button { min-height: 44px; }
  .siege-field-viewport .siege-field { min-height: 360px; }
}

@media (prefers-reduced-motion: reduce) {
  .siege-hero-roster > button.is-reset-warning,
  .siege-jason-runner.is-running,
  .siege-cell.is-merge-target { animation: none !important; }
  .siege-horde-canvas { transition: none; }
}

/* Campaign controls remain readable and reachable at every viewport. */
.goblin-siege-dialog { height: calc(100vh - 20px); height: calc(100dvh - 20px); }
.goblin-siege-dialog .siege-guide > small { display: block; }
.goblin-siege-dialog .siege-tip { display: block; }
.siege-inspector-actions button,
.siege-result button { min-height: 44px; }

@media (max-width: 720px) {
  .goblin-siege-dialog { height: 100vh; height: 100dvh; }
  .goblin-siege-dialog .siege-sidebar { width: 100%; min-width: 0; }
  .goblin-siege-dialog .tower-tray { width: 100%; }
  .goblin-siege-dialog .tower-tray > button strong,
  .siege-hero-roster > button strong { font-size: 11px; }
  .goblin-siege-dialog .tower-tray > button small,
  .siege-hero-roster > button small,
  .siege-tower-inspector > p,
  .siege-threat-summary,
  .goblin-siege-dialog .siege-tip { font-size: 10px; }
  .siege-tower-inspector > strong { font-size: 12px; }
  .siege-inspector-actions button,
  .siege-control-stack > button { font-size: 10px; }
}

@media (max-height: 600px) and (orientation: landscape) {
  .goblin-siege-dialog .siege-shell { overflow: auto; overscroll-behavior: contain; }
  .goblin-siege-dialog .siege-guide > small { display: block; max-width: 55ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* Final Siege legibility, damage feedback, and motion-safe cues. */
.goblin-siege-dialog .siege-guide p { font-size: 10px; }
.goblin-siege-dialog .siege-guide > small {
  color: #9aaba0;
  font-size: 9px;
}
.goblin-siege-dialog .siege-hero-roster > button strong,
.goblin-siege-dialog .tower-tray > button strong { font-size: 11px; }
.goblin-siege-dialog .siege-hero-roster > button small,
.goblin-siege-dialog .tower-tray > button small {
  color: #93a299;
  font-size: 9px;
}
.goblin-siege-dialog .siege-target strong { font-size: 10px; }
.goblin-siege-dialog .siege-target small { color: #91a097; font-size: 8px; }
.goblin-siege-dialog .siege-inspector-actions button,
.goblin-siege-dialog .siege-control-stack > button { font-size: 10px; }
.goblin-siege-dialog .siege-hud > span,
.goblin-siege-dialog .siege-tower-inspector > p,
.goblin-siege-dialog .siege-threat-summary,
.goblin-siege-dialog .siege-tip {
  color: #93a299;
  font-size: 9px;
}

.siege-cell.is-disabled {
  opacity: 0.48;
  filter: grayscale(0.6);
}

.siege-cell.is-wall::after {
  content: "";
  position: absolute;
  z-index: 4;
  right: 7px;
  bottom: 5px;
  left: 7px;
  height: 3px;
  background: linear-gradient(90deg, #9cff72 0 var(--wall-health, 100%), rgba(255, 255, 255, 0.12) var(--wall-health, 100%) 100%);
  border-radius: 999px;
  box-shadow: 0 0 7px rgba(156, 255, 114, 0.3);
}

@media (prefers-reduced-motion: reduce) {
  .goblin-siege-dialog[open],
  .goblin-siege-dialog .siege-result,
  .goblin-siege-dialog.is-breached,
  .goblin-siege-dialog .siege-cell.is-firing,
  body.goblin-siege-active .is-goblin-pressed {
    animation: none !important;
    transition: none !important;
  }

  .goblin-siege-dialog .siege-cell.is-merge-target {
    outline: 2px dashed #d6c9ff;
    outline-offset: -5px;
    box-shadow: inset 0 0 0 2px rgba(157, 135, 255, 0.38);
  }
}

/* Squad on the battlefield: clickable, talkative, and alarmingly mortal. */
.siege-map-heroes {
  position: absolute;
  z-index: 18;
  inset: 0;
  pointer-events: none;
}

.siege-map-hero {
  --hero-color: #9cff72;
  --hero-resolve: 100%;
  position: absolute;
  left: var(--hero-x);
  top: var(--hero-y);
  display: block;
  width: 54px;
  min-height: 54px;
  padding: 7px;
  color: #e9f6ec;
  background: linear-gradient(145deg, rgba(13, 22, 29, 0.97), rgba(7, 12, 18, 0.96));
  border: 1px solid color-mix(in srgb, var(--hero-color) 44%, transparent);
  border-radius: 13px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.46), 0 0 18px color-mix(in srgb, var(--hero-color) 17%, transparent);
  transform: translate(-50%, -50%);
  pointer-events: auto;
  text-align: left;
}

.siege-map-hero.hero-jason { --hero-color: #69e6ff; --hero-x: 29.167%; --hero-y: 21.429%; }
.siege-map-hero.hero-sam { --hero-color: #9cff72; --hero-x: 29.167%; --hero-y: 50%; }
.siege-map-hero.hero-andrew { --hero-color: #ffd76f; --hero-x: 29.167%; --hero-y: 78.571%; }
.siege-map-hero.hero-tibo { --hero-color: #ff7ada; --hero-x: 37.5%; --hero-y: 64.286%; }

.siege-map-hero:hover,
.siege-map-hero[aria-expanded="true"] {
  color: white;
  border-color: var(--hero-color);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--hero-color) 48%, transparent), 0 13px 30px rgba(0, 0, 0, 0.52), 0 0 28px color-mix(in srgb, var(--hero-color) 24%, transparent);
}
.siege-map-hero:focus-visible { outline: 3px solid white; outline-offset: 3px; }
.siege-map-hero .map-hero-face {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #071018;
  background: var(--hero-color);
  border: 2px solid rgba(255, 255, 255, 0.88);
  border-radius: 50% 50% 43% 46%;
  font: 900 11px ui-monospace, monospace;
  box-shadow: 0 0 16px color-mix(in srgb, var(--hero-color) 40%, transparent);
}
.siege-map-hero strong,
.siege-map-hero small {
  position: absolute;
  left: 47px;
  width: 70px;
  overflow: hidden;
  padding: 2px 5px;
  background: rgba(8, 14, 20, 0.92);
  border-radius: 4px;
  pointer-events: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.siege-map-hero strong { top: 7px; font-size: 10px; }
.siege-map-hero small { top: 27px; color: #93a299; font: 8px ui-monospace, monospace; }
.map-hero-resolve {
  position: absolute;
  right: 7px;
  bottom: 4px;
  left: 7px;
  display: block;
  height: 4px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.11);
  border-radius: 999px;
}
.map-hero-resolve > i {
  display: block;
  width: var(--hero-resolve);
  height: 100%;
  background: linear-gradient(90deg, #ff5c8a, var(--hero-color));
  box-shadow: 0 0 7px var(--hero-color);
  transition: width 0.25s ease;
}
.siege-map-hero.is-wounded { border-color: rgba(255, 215, 111, 0.72); }
.siege-map-hero.is-down { opacity: 0.58; filter: grayscale(0.82); }
.siege-map-hero.is-down .map-hero-face { transform: rotate(12deg); }
.siege-map-hero.is-intercepting { animation: hero-last-stand 0.42s steps(2) 2; }
.goblin-siege-dialog.is-tibo-warning .siege-map-hero.hero-tibo { animation: tibo-reset-alarm 0.7s steps(2) infinite; }
.goblin-siege-dialog.is-horde-wave .siege-map-hero.hero-jason {
  border-color: #69e6ff;
  box-shadow: 0 0 0 2px rgba(105, 230, 255, 0.42), 0 0 34px rgba(105, 230, 255, 0.3);
}

.siege-map-dialog {
  --hero-color: var(--chapter-accent);
  position: absolute;
  z-index: 38;
  left: 43%;
  top: 12%;
  display: grid;
  gap: 7px;
  width: min(330px, 43%);
  min-width: 260px;
  padding: 13px 14px 14px;
  color: #dceae0;
  background: linear-gradient(145deg, rgba(14, 21, 31, 0.99), rgba(7, 11, 17, 0.99));
  border: 1px solid color-mix(in srgb, var(--hero-color) 55%, transparent);
  border-radius: 14px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.66), 0 0 35px color-mix(in srgb, var(--hero-color) 18%, transparent);
  pointer-events: auto;
}
.siege-map-dialog[hidden] { display: none; }
.siege-map-dialog[data-hero="sam"] { --hero-color: #9cff72; top: 29%; }
.siege-map-dialog[data-hero="andrew"] { --hero-color: #ffd76f; top: 52%; }
.siege-map-dialog[data-hero="jason"] { --hero-color: #69e6ff; top: 7%; }
.siege-map-dialog[data-hero="tibo"] { --hero-color: #ff7ada; top: 42%; left: 50%; }
.siege-map-dialog::before {
  content: "";
  position: absolute;
  left: -9px;
  top: 25px;
  width: 16px;
  height: 16px;
  background: #101722;
  border-bottom: 1px solid color-mix(in srgb, var(--hero-color) 55%, transparent);
  border-left: 1px solid color-mix(in srgb, var(--hero-color) 55%, transparent);
  transform: rotate(45deg);
}
.siege-map-dialog .kicker { color: var(--hero-color); }
.siege-map-dialog h3 { padding-right: 42px; font-size: 18px; }
.siege-map-dialog p { color: #aebdb3; font-size: 10px; line-height: 1.45; }
.siege-map-dialog #siegeHeroDialogStatus { color: #d9e7dd; font: 9px ui-monospace, monospace; }
.siege-map-dialog > #siegeHeroDialogAction {
  min-height: 44px;
  color: #071018;
  background: linear-gradient(135deg, white, var(--hero-color));
  border-radius: 9px;
  font-size: 10px;
  font-weight: 900;
}
.siege-map-dialog > #siegeHeroDialogAction:disabled { opacity: 0.45; filter: grayscale(0.65); }
.siege-map-dialog-close {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 44px;
  height: 44px;
  color: #dbe8df;
  background: transparent;
  border-radius: 9px;
  font-size: 18px;
}

.siege-automation-panel {
  display: grid;
  gap: 6px;
  padding: 9px;
  background: rgba(157, 135, 255, 0.055);
  border: 1px solid rgba(157, 135, 255, 0.16);
  border-radius: 11px;
}
.siege-automation-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.siege-automation-actions button {
  min-height: 44px;
  padding: 6px;
  color: #d7cfff;
  background: rgba(157, 135, 255, 0.08);
  border: 1px solid rgba(157, 135, 255, 0.22);
  border-radius: 8px;
  font-size: 9px;
  font-weight: 900;
}
.siege-automation-actions button[aria-pressed="true"] {
  color: #0b1016;
  background: linear-gradient(135deg, #efeaff, #9d87ff);
  box-shadow: 0 0 17px rgba(157, 135, 255, 0.3);
}
#siegeAutomationStatus { color: #93a299; font: 9px/1.4 ui-monospace, monospace; }

.siege-sam-suggestion {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 10px;
  color: #dff7e5;
  background: linear-gradient(135deg, rgba(156, 255, 114, 0.09), rgba(105, 230, 255, 0.055));
  border: 1px solid rgba(156, 255, 114, 0.24);
  border-radius: 11px;
  box-shadow: inset 0 0 24px rgba(156, 255, 114, 0.025);
}
.siege-sam-suggestion[hidden] { display: none; }
.siege-sam-badge {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #071018;
  background: #9cff72;
  border: 2px solid white;
  border-radius: 50% 48% 44% 52%;
  font: 900 12px ui-monospace, monospace;
  box-shadow: 0 0 18px rgba(156, 255, 114, 0.34);
}
.siege-sam-suggestion strong { font-size: 11px; }
.siege-sam-suggestion p { margin-top: 3px; color: #a9b9ae; font-size: 9px; line-height: 1.45; }
.siege-sam-suggestion > button {
  grid-column: 1 / -1;
  min-height: 44px;
  color: #071018;
  background: linear-gradient(135deg, #edffe8, #9cff72);
  border-radius: 8px;
  font-size: 9px;
  font-weight: 900;
}

.goblin-siege-dialog .tower-tray > button.is-recommended {
  color: white;
  border-color: #69e6ff;
  box-shadow: 0 0 0 2px rgba(105, 230, 255, 0.42), 0 0 26px rgba(105, 230, 255, 0.16);
}
.goblin-siege-dialog .siege-cell.is-recommended {
  outline: 2px dashed #69e6ff;
  outline-offset: -5px;
  box-shadow: inset 0 0 0 3px rgba(105, 230, 255, 0.32), 0 0 22px rgba(105, 230, 255, 0.18);
}

@keyframes hero-last-stand {
  50% { transform: translate(-50%, -50%) scale(1.12) rotate(-2deg); filter: brightness(1.45); }
}

@media (max-width: 860px) {
  .siege-automation-panel,
  .siege-sam-suggestion { grid-column: 1 / -1; }
}

@media (max-height: 600px) and (orientation: landscape) {
  .siege-map-dialog { max-height: 82%; overflow-y: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .siege-map-hero,
  .siege-map-hero.is-intercepting,
  .goblin-siege-dialog.is-tibo-warning .siege-map-hero.hero-tibo,
  .goblin-siege-dialog.is-horde-wave .siege-map-hero.hero-jason {
    animation: none !important;
    transition: none !important;
  }
  .map-hero-resolve > i { transition: none; }
  .goblin-siege-dialog .tower-tray > button.is-recommended,
  .goblin-siege-dialog .siege-cell.is-recommended { animation: none !important; }
}
