:root {
  --bg: #030303;
  --panel: #050606;
  --panel-2: #08090b;
  --panel-3: #0b0c10;
  --line: #222329;
  --line-soft: #15161a;
  --text: #e5e0da;
  --muted: #8a8782;
  --dim: #5f6269;
  --blue: #73a8ff;
  --blue-soft: #477edb;
  --violet: #5f46b8;
  --violet-2: #8f7bd8;
  --green: #65dc75;
  --danger: #ff6b89;
  --warn: #f0c266;
  --shadow: rgba(0, 0, 0, 0.65);
  --mono: Consolas, "Cascadia Mono", "Courier New", monospace;
  --ui: Inter, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.012) 1px, transparent 1px),
    var(--bg);
  background-size: 24px 24px;
  font-family: var(--ui);
  overflow: hidden;
}

body.booting .app-shell {
  opacity: 0;
  pointer-events: none;
}

.boot-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    #000000;
  background-size: 100% 3px, auto;
  color: #bdb8b1;
  font-family: var(--mono);
}

.boot-overlay.boot-finished {
  opacity: 0;
  pointer-events: none;
  transition: opacity 420ms ease;
}

.boot-topbar {
  height: 29px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  border-bottom: 1px solid #1d1d1f;
  color: #d5d0ca;
  font: 14px/1 var(--mono);
}

.boot-log {
  flex: 1;
  margin: 0;
  padding: 12px 10px 24px;
  overflow: hidden;
  white-space: pre-wrap;
  color: #b9b4ae;
  font: 14px/1.25 var(--mono);
}

.boot-ok {
  color: #65dc75;
  font-weight: 700;
}

.boot-warn {
  color: #f0c266;
}

.boot-user {
  color: #65dc75;
}

.boot-accent {
  color: var(--violet-2);
}

.boot-dim {
  color: #77736d;
}

body.alarm-mode {
  --line: #6a1118;
  --line-soft: #351015;
  --blue: #ff4343;
  --blue-soft: #d61f2c;
  --violet: #c51e2d;
  --violet-2: #ff5a5f;
  --green: #ff4040;
  --danger: #ff1f2f;
  --warn: #ff5a5f;
  animation: alarmBody 0.58s steps(2, end) infinite;
}

@keyframes alarmBody {
  0%,
  100% {
    background-color: #030303;
  }

  50% {
    background-color: #240004;
  }
}

@keyframes alarmPanel {
  0% {
    box-shadow: inset 0 0 0 1px rgba(255, 20, 35, 0.08);
  }

  100% {
    box-shadow: inset 0 0 0 1px rgba(255, 28, 42, 0.5), 0 0 24px rgba(255, 0, 22, 0.3);
  }
}

@keyframes alarmHeader {
  0% {
    color: #ded9d3;
    background-color: rgba(12, 4, 5, 0.92);
  }

  100% {
    color: #ffffff;
    background-color: rgba(110, 8, 18, 0.88);
  }
}

@keyframes impactShake {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }

  18% {
    transform: translate3d(-13px, 4px, 0) rotate(-0.32deg);
  }

  34% {
    transform: translate3d(9px, -2px, 0) rotate(0.22deg);
  }

  55% {
    transform: translate3d(-3px, 1px, 0) rotate(-0.08deg);
  }

  100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
}

@keyframes lilyDissolve {
  0% {
    opacity: 1;
    filter: none;
    transform: translateY(0) scale(1);
  }

  55% {
    opacity: 0.38;
    filter: blur(0.6px) contrast(1.25);
  }

  100% {
    opacity: 0;
    filter: blur(2.4px) contrast(1.6);
    transform: translateY(-5px) scale(0.985);
  }
}

@keyframes tvPowerOff {
  0% {
    opacity: 0;
    background: rgba(0, 0, 0, 0);
  }

  18% {
    opacity: 1;
    background: rgba(0, 0, 0, 0.24);
  }

  55% {
    opacity: 1;
    background: rgba(0, 0, 0, 0.72);
  }

  100% {
    opacity: 1;
    background: #000000;
  }
}

@keyframes tvTubeCollapse {
  0% {
    opacity: 0;
    border-radius: 18% / 12%;
    transform: scale(1.02, 1.02);
    background:
      radial-gradient(ellipse at center, rgba(255, 255, 255, 0.12), rgba(18, 22, 28, 0.2) 42%, rgba(0, 0, 0, 0.82) 76%),
      rgba(0, 0, 0, 0.22);
  }

  16% {
    opacity: 1;
    border-radius: 22% / 16%;
    transform: scale(1, 1);
  }

  48% {
    opacity: 1;
    border-radius: 34% / 26%;
    transform: scale(0.94, 0.68);
    background:
      radial-gradient(ellipse at center, rgba(255, 255, 255, 0.18), rgba(15, 18, 24, 0.5) 38%, rgba(0, 0, 0, 0.92) 72%),
      rgba(0, 0, 0, 0.5);
  }

  68% {
    opacity: 1;
    border-radius: 50%;
    transform: scale(0.82, 0.045);
    background: rgba(255, 255, 255, 0.94);
    box-shadow:
      0 0 22px rgba(255, 255, 255, 0.9),
      0 0 70px rgba(124, 156, 255, 0.45);
  }

  84% {
    opacity: 1;
    transform: scale(0.42, 0.012);
    background: #ffffff;
  }

  100% {
    opacity: 0;
    border-radius: 50%;
    transform: scale(0.02, 0.004);
    background: #ffffff;
  }
}

@keyframes finalFlagReveal {
  0% {
    opacity: 0;
    filter: blur(5px);
    transform: translate(-50%, -48%);
  }

  100% {
    opacity: 1;
    filter: blur(0);
    transform: translate(-50%, -50%);
  }
}

@keyframes tvStaticFlicker {
  0%,
  100% {
    opacity: 0.18;
  }

  50% {
    opacity: 0.32;
  }
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 1px solid var(--violet);
  outline-offset: 1px;
}

.app-shell {
  height: 100vh;
  padding: 1px;
}

.terminal-band {
  height: 100%;
  min-width: 1000px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.96);
  box-shadow: 0 22px 80px var(--shadow);
}

body.impact-shake .terminal-band {
  animation: impactShake 0.22s cubic-bezier(0.08, 0.9, 0.25, 1) both;
  transform-origin: center;
}

body.alarm-mode .terminal-band {
  border-color: #8f1520;
  background:
    linear-gradient(rgba(255, 22, 35, 0.065) 1px, transparent 1px),
    rgba(12, 0, 2, 0.97);
  background-size: 100% 4px, auto;
}

.window-titlebar {
  height: 38px;
  display: grid;
  grid-template-columns: 86px 1fr 86px;
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
  background: #020202;
}

.window-brand {
  width: 24px;
  height: 24px;
  margin-left: 12px;
  display: grid;
  place-items: center;
  color: #ffffff;
  border: 1px solid transparent;
  font: 700 17px/1 var(--mono);
}

.window-title {
  justify-self: center;
  color: #d9d4cd;
  font: 500 16px/1 var(--mono);
  letter-spacing: 0;
  white-space: nowrap;
}

.window-controls {
  display: flex;
  justify-content: flex-end;
  gap: 24px;
  padding-right: 18px;
  color: #bbb7b0;
  font: 17px/1 var(--mono);
}

.menu-row {
  height: 34px;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line-soft);
  background: #030303;
}

.menu-row button,
.menu-row a,
.tool-button,
.character-tabs button,
.quick-commands button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.menu-row button,
.menu-row a {
  padding: 5px 0;
  color: #ddd8d1;
  font: 13px/1 var(--ui);
  text-decoration: none;
}

.menu-row button:hover,
.menu-row a:hover,
.tool-button:hover {
  color: #ffffff;
}

.tool-row {
  height: 45px;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: #050505;
}

.tool-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 0;
  color: #d4d0c9;
  font: 13px/1 var(--ui);
  text-decoration: none;
  white-space: nowrap;
}

.tool-button span {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 1px solid #53565c;
  border-radius: 3px;
  color: #cfcac3;
  font: 12px/1 var(--mono);
}

.tool-icon {
  width: 20px;
  height: 20px;
  justify-content: center;
  border: 1px solid #53565c;
  border-radius: 3px;
  font: 700 12px/1 var(--mono);
}

.game-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(285px, 22vw) minmax(520px, 1fr) minmax(410px, 34vw);
  gap: 10px;
  padding: 10px 12px;
}

.left-stack,
.center-stack,
.right-stack {
  min-height: 0;
  display: grid;
  gap: 10px;
}

.left-stack {
  grid-template-rows: minmax(0, 1fr) 236px;
}

.center-stack {
  grid-template-rows: minmax(0, 1fr);
}

.right-stack {
  grid-template-rows: minmax(0, 1fr) 106px;
}

.panel {
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: linear-gradient(180deg, rgba(8, 9, 11, 0.98), rgba(2, 3, 4, 0.98));
}

body.alarm-mode .panel {
  animation: alarmPanel 0.46s steps(2, end) infinite;
  background: linear-gradient(180deg, rgba(22, 3, 5, 0.98), rgba(5, 0, 1, 0.98));
}

.panel-header {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line-soft);
  color: #ded9d3;
  font: 700 12px/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0;
}

body.alarm-mode .panel-header,
body.alarm-mode .character-tabs {
  animation: alarmHeader 0.46s steps(2, end) infinite;
}

.panel-header > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.icon-button {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #303139;
  border-radius: 4px;
  background: #07080b;
  color: #d7d2ca;
  cursor: pointer;
  font: 15px/1 var(--mono);
}

.icon-button:hover {
  border-color: var(--violet);
  color: #ffffff;
}

.file-panel,
.terminal-panel,
.inspector-panel,
.lily-panel,
.quick-panel {
  display: flex;
  flex-direction: column;
}

.inspector-panel {
  display: none;
}

.file-tree {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px 10px 14px;
  font-family: var(--mono);
}

.file-group {
  margin-bottom: 14px;
}

.file-group-title {
  margin: 0 0 5px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #b8b4ad;
  font: 13px/1.25 var(--mono);
}

.file-group-title::before {
  content: "⌄";
  color: #bdb7b0;
  font-size: 12px;
}

.file-group-title::after {
  content: "";
  width: 14px;
  height: 11px;
  order: -1;
  border: 1px solid #767a82;
  border-top-left-radius: 3px;
  border-top-right-radius: 3px;
  opacity: 0.9;
}

.file-button {
  width: calc(100% - 28px);
  min-height: 31px;
  margin: 4px 0 4px 28px;
  padding: 0 9px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #dcd6cf;
  cursor: pointer;
  text-align: left;
  font: 13px/1 var(--mono);
}

.file-button span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-button span:first-child::before {
  content: "▧";
  margin-right: 8px;
  color: #b9b4ae;
}

.file-button:hover {
  border-color: #2d2447;
  background: rgba(76, 45, 143, 0.18);
}

.file-button.active {
  border-color: #443580;
  background: linear-gradient(90deg, rgba(83, 63, 158, 0.34), rgba(48, 39, 94, 0.22));
  color: #ffffff;
}

body.alarm-mode .file-button.active {
  border-color: #e82b38;
  background: linear-gradient(90deg, rgba(232, 43, 56, 0.5), rgba(104, 6, 17, 0.34));
}

.file-button.locked {
  color: #8a8580;
  cursor: not-allowed;
}

.file-status {
  color: #9b91d2;
  font: 12px/1 var(--mono);
}

.file-button.locked .file-status {
  color: #8a8580;
}

.file-info-panel .panel-header span {
  color: var(--violet-2);
}

.file-info {
  padding: 13px 12px;
  font-family: var(--mono);
}

.file-info p {
  margin: 0 0 14px;
  color: #aaa49c;
  font: 700 12px/1 var(--mono);
}

.file-info dl {
  margin: 0;
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  row-gap: 9px;
  column-gap: 8px;
  font-size: 13px;
}

.file-info dt {
  color: #8f8b84;
}

.file-info dd {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #e4ded6;
}

.terminal-log,
.inspector-content {
  min-height: 0;
  overflow: auto;
  overflow-x: hidden;
  white-space: pre-wrap;
  font: 14px/1.45 var(--mono);
}

.terminal-log {
  flex: 1;
  padding: 18px 20px 10px;
}

.inspector-content {
  flex: 1;
  padding: 0;
}

.log-block {
  margin: 0 0 7px;
  max-width: 100%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.log-system {
  color: var(--blue);
}

body.alarm-mode .log-system,
body.alarm-mode .log-command {
  color: #ff4a4f;
}

body.alarm-mode .scene-ascii,
body.alarm-mode .spectrogram {
  color: #ffd0d0;
}

.log-lily {
  color: #f4eee7;
}

.live-typing {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.log-error {
  color: var(--danger);
}

.log-ok {
  color: var(--green);
}

.log-command {
  color: #c4f47f;
}

.log-muted {
  color: #a5a09a;
}

.scene-ascii {
  display: block;
  margin: 6px 0 10px;
  color: #e7e0d8;
}

.command-form {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) 68px;
  gap: 12px;
  align-items: center;
  padding: 9px 18px 12px;
  border-top: 1px solid var(--line-soft);
  background: #030303;
}

.command-form label {
  color: #c9f879;
  font: 13px/1 var(--mono);
  white-space: nowrap;
}

.command-form input {
  width: 100%;
  min-width: 0;
  height: 34px;
  border: 1px solid var(--violet);
  border-radius: 4px;
  background: #030305;
  color: #e8e3dc;
  padding: 0 13px;
  font-family: var(--mono);
  box-shadow: inset 0 0 0 1px rgba(95, 70, 184, 0.12);
}

body.alarm-mode .command-form input {
  border-color: #ff2938;
  box-shadow: inset 0 0 0 1px rgba(255, 31, 47, 0.24), 0 0 18px rgba(255, 0, 22, 0.28);
}

.command-form input::placeholder {
  color: #777179;
}

.command-form button,
.tab-button,
.quick-commands button {
  border: 1px solid #292a31;
  border-radius: 4px;
  background: #050507;
  color: #e2ddd6;
  cursor: pointer;
}

.command-form button {
  height: 34px;
  font: 700 12px/1 var(--mono);
}

.command-form button:hover,
.tab-button:hover,
.quick-commands button:hover {
  border-color: var(--violet);
  color: #ffffff;
}

.inspector-header {
  display: none;
}

.inspector-tabs {
  height: 38px;
  display: flex;
  gap: 0;
  padding: 0 14px;
  border-bottom: 1px solid var(--line-soft);
  background: #040405;
}

.tab-button {
  min-width: 128px;
  height: 38px;
  padding: 0 16px;
  border-width: 0 0 1px;
  border-radius: 0;
  background: transparent;
  color: #9d9892;
  font: 700 12px/1 var(--mono);
  text-transform: uppercase;
}

.tab-button.active {
  color: var(--violet-2);
  border-color: var(--violet);
}

.file-body {
  margin: 0;
  min-height: 100%;
  padding: 12px 14px 14px;
  border: 0;
  background: #030303;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.file-table-wrap {
  padding: 0 0 12px;
  overflow: auto;
}

.file-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font: 13px/1.4 var(--mono);
}

.file-table th,
.file-table td {
  height: 24px;
  padding: 2px 12px;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-table th {
  color: #bfb8b1;
  font-weight: 700;
}

.file-table td {
  color: #e8e2da;
}

.file-table tr:last-child td {
  color: var(--green);
}

.flag {
  color: #c9f879;
}

.warning {
  color: var(--warn);
}

.spectrogram {
  color: #b8dcff;
}

.character-tabs {
  height: 43px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line-soft);
}

.character-tabs button {
  position: relative;
  color: #d3cdc6;
  border-right: 1px solid var(--line-soft);
  font: 700 12px/1 var(--mono);
}

.character-tabs button:last-child {
  border-right: 0;
}

.character-tabs button.active {
  color: var(--violet-2);
}

.character-tabs button.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--violet);
}

.lily-profile {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(250px, 1fr) auto;
  gap: 10px;
  padding: 22px 34px 17px;
}

.lily-panel {
  transition:
    opacity 240ms ease,
    transform 320ms ease,
    filter 320ms ease;
}

.lily-panel.panel-hidden {
  opacity: 0;
  transform: translateY(12px) scale(0.985);
  filter: blur(6px);
  pointer-events: none;
}

.lily-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.lily-heading h1 {
  margin: 0;
  color: #f3eee7;
  font: 500 25px/1 var(--mono);
  letter-spacing: 4px;
}

.lily-heading p {
  margin: 8px 0 0;
  color: #aaa49d;
  font: 13px/1.3 var(--mono);
}

.online-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 9px;
  color: #aaa49c;
  font: 12px/1 var(--mono);
}

.online-pill i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px rgba(101, 220, 117, 0.8);
}

.online-pill.offline {
  color: #ff6262;
}

.online-pill.offline i {
  background: #ff2d36;
  box-shadow: 0 0 10px rgba(255, 45, 54, 0.8);
}

.model-stage {
  position: relative;
  min-height: 0;
  margin: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 4px;
  background:
    radial-gradient(ellipse at 50% 48%, rgba(27, 34, 56, 0.54), rgba(6, 8, 14, 0.2) 47%, transparent 71%),
    linear-gradient(180deg, rgba(3, 4, 7, 0.04), rgba(0, 0, 0, 0.16));
}

body.alarm-mode .model-stage {
  background:
    radial-gradient(ellipse at 50% 48%, rgba(106, 8, 18, 0.46), rgba(18, 0, 3, 0.34) 47%, transparent 71%),
    linear-gradient(180deg, rgba(32, 0, 4, 0.1), rgba(0, 0, 0, 0.2));
}

body.alarm-mode .model-stage::before {
  background:
    radial-gradient(circle at 16% 21%, rgba(255, 225, 225, 0.42) 0 1px, transparent 1.7px),
    radial-gradient(circle at 83% 18%, rgba(255, 44, 58, 0.45) 0 1px, transparent 1.8px),
    radial-gradient(circle at 25% 74%, rgba(255, 210, 210, 0.3) 0 1px, transparent 1.7px),
    radial-gradient(circle at 78% 71%, rgba(255, 35, 50, 0.38) 0 1px, transparent 1.8px),
    radial-gradient(circle at 51% 34%, rgba(255, 238, 238, 0.28) 0 1px, transparent 1.6px),
    linear-gradient(90deg, transparent 0 18%, rgba(255, 28, 42, 0.13) 30%, transparent 44% 56%, rgba(255, 28, 42, 0.13) 70%, transparent 82%),
    repeating-linear-gradient(90deg, transparent 0 19px, rgba(255, 28, 42, 0.13) 19px 20px, transparent 20px 31px);
}

body.alarm-mode .model-stage::after {
  background:
    repeating-linear-gradient(90deg, transparent 0 24px, rgba(255, 28, 42, 0.25) 24px 25px, transparent 25px 36px),
    repeating-linear-gradient(0deg, transparent 0 12px, rgba(255, 28, 42, 0.08) 12px 13px);
}

body.alarm-mode .lily-portrait {
  text-shadow:
    -1px 0 rgba(255, 70, 78, 0.45),
    1px 0 rgba(255, 0, 22, 0.36);
}

.model-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 16% 21%, rgba(214, 229, 255, 0.52) 0 1px, transparent 1.7px),
    radial-gradient(circle at 83% 18%, rgba(132, 171, 236, 0.42) 0 1px, transparent 1.8px),
    radial-gradient(circle at 25% 74%, rgba(211, 225, 255, 0.36) 0 1px, transparent 1.7px),
    radial-gradient(circle at 78% 71%, rgba(142, 127, 218, 0.36) 0 1px, transparent 1.8px),
    radial-gradient(circle at 51% 34%, rgba(236, 240, 255, 0.34) 0 1px, transparent 1.6px),
    linear-gradient(90deg, transparent 0 18%, rgba(73, 132, 213, 0.08) 30%, transparent 44% 56%, rgba(73, 132, 213, 0.08) 70%, transparent 82%),
    repeating-linear-gradient(90deg, transparent 0 19px, rgba(73, 132, 213, 0.08) 19px 20px, transparent 20px 31px);
  background-size: 210px 170px, 240px 190px, 180px 140px, 220px 170px, 160px 130px, auto, auto;
  mask-image: radial-gradient(ellipse at center, #000 0 42%, rgba(0, 0, 0, 0.7) 58%, transparent 79%);
  opacity: 0.74;
}

.model-stage::after {
  content: "";
  position: absolute;
  inset: 22px 20px 18px;
  background:
    repeating-linear-gradient(90deg, transparent 0 24px, rgba(63, 120, 198, 0.2) 24px 25px, transparent 25px 36px),
    repeating-linear-gradient(0deg, transparent 0 12px, rgba(95, 70, 184, 0.045) 12px 13px);
  mask-image: radial-gradient(ellipse at center, transparent 0 39%, rgba(0, 0, 0, 0.78) 57%, transparent 83%);
  opacity: 0.46;
}

.lily-portrait {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: 100%;
  color: #e9e2db;
  text-shadow:
    -1px 0 rgba(71, 126, 219, 0.52),
    1px 0 rgba(95, 70, 184, 0.32);
  font: 7px/1 "Cascadia Mono", Consolas, monospace;
  white-space: pre;
}

.lily-panel.ending-fade .lily-portrait {
  animation: lilyDissolve 6.8s ease-in forwards;
}

.lily-panel.ending-fade .model-stage::before,
.lily-panel.ending-fade .model-stage::after {
  animation: lilyDissolve 6.8s ease-in forwards;
}

.shutdown-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  background: transparent;
}

.shutdown-overlay::before,
.shutdown-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
}

.shutdown-overlay::before {
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.12) 0 1px, transparent 1px 4px),
    radial-gradient(ellipse at center, rgba(255, 255, 255, 0.16), transparent 58%);
  mix-blend-mode: screen;
}

.shutdown-overlay::after {
  background: radial-gradient(ellipse at center, transparent 0 34%, rgba(0, 0, 0, 0.45) 62%, rgba(0, 0, 0, 0.96) 100%);
}

.shutdown-tube {
  position: absolute;
  inset: 4% 3%;
  z-index: 1;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18% / 12%;
  opacity: 0;
  transform-origin: center;
  box-shadow:
    inset 0 0 48px rgba(0, 0, 0, 0.92),
    0 0 72px rgba(255, 255, 255, 0.12);
}

.shutdown-flag {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  max-width: min(86vw, 920px);
  opacity: 0;
  color: #65dc75;
  text-align: center;
  font: 700 clamp(16px, 2vw, 30px)/1.45 var(--mono);
  text-shadow:
    0 0 12px rgba(101, 220, 117, 0.72),
    0 0 32px rgba(101, 220, 117, 0.24);
  white-space: normal;
}

body.tv-poweroff .shutdown-overlay {
  opacity: 1;
  background: #000000;
  animation: none;
}

body.tv-poweroff .shutdown-overlay::before {
  animation: tvStaticFlicker 0.08s steps(2, end) 12;
}

body.tv-poweroff .shutdown-overlay::after {
  opacity: 1;
  background: #000000;
}

body.tv-poweroff .shutdown-tube {
  animation: tvTubeCollapse 1.75s cubic-bezier(0.18, 0.84, 0.18, 1) forwards;
}

body.tv-poweroff .shutdown-flag {
  animation: finalFlagReveal 0.9s ease-out 1.95s forwards;
}

.lily-line {
  margin: 0;
  color: var(--violet-2);
  font: 15px/1.4 var(--mono);
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.lily-mood {
  margin: 0;
  color: #aaa49d;
  font: 13px/1.55 var(--mono);
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.lily-mood,
.character-notes {
  display: none;
}

.metric-title,
.character-notes span {
  display: block;
  margin-bottom: 11px;
  color: #8e8982;
  font: 700 12px/1 var(--mono);
}

.character-notes {
  min-height: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.character-notes p {
  margin: 0;
  color: #b7b1aa;
  font: 13px/1.55 var(--mono);
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.quick-panel {
  background: #040405;
}

.quick-commands {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px;
}

.quick-commands button {
  height: 31px;
  font: 13px/1 var(--mono);
}

.status-bar {
  height: 37px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 18px;
  border-top: 1px solid var(--line);
  background: #030303;
  color: #b5aea7;
  font: 12px/1 var(--mono);
}

.status-bar span {
  min-width: 0;
  white-space: nowrap;
}

.status-bar span:nth-child(-n + 3) {
  padding-right: 16px;
  border-right: 1px solid var(--line-soft);
}

.status-bar span:nth-child(4) {
  margin-left: auto;
}

.cpu-spark {
  display: inline-block;
  width: 150px;
  height: 18px;
  margin-left: 6px;
  vertical-align: middle;
  background:
    linear-gradient(135deg, transparent 0 11%, var(--violet) 11% 14%, transparent 14% 22%, var(--violet) 22% 25%, transparent 25% 38%, var(--violet) 38% 41%, transparent 41% 58%, var(--violet) 58% 61%, transparent 61% 74%, var(--violet) 74% 77%, transparent 77%),
    linear-gradient(to top, rgba(95, 70, 184, 0.2), transparent);
  border-bottom: 1px solid var(--violet);
}

#statusClock {
  color: #e2dcd4;
  font-style: normal;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: #252630;
  border-radius: 8px;
}

::-webkit-scrollbar-track {
  background: #050506;
}

@media (max-width: 1120px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
  }

  .terminal-band {
    min-width: 0;
    height: auto;
    min-height: 100vh;
  }

  .window-titlebar {
    grid-template-columns: 46px 1fr 76px;
  }

  .window-title {
    font-size: 13px;
  }

  .menu-row,
  .tool-row {
    overflow-x: auto;
  }

  .game-grid {
    grid-template-columns: 1fr;
  }

  .left-stack,
  .center-stack,
  .right-stack {
    grid-template-rows: auto;
  }

  .file-panel,
  .terminal-panel,
  .inspector-panel,
  .lily-panel {
    min-height: 360px;
  }

  .file-info-panel,
  .quick-panel {
    min-height: 180px;
  }

  .command-form {
    grid-template-columns: 1fr 70px;
  }

  .command-form label {
    grid-column: 1 / -1;
  }

  .lily-profile {
    padding: 20px;
  }

  .quick-commands {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .status-bar {
    flex-wrap: wrap;
    height: auto;
    min-height: 37px;
    padding: 10px 14px;
  }

  .status-bar span:nth-child(4) {
    margin-left: 0;
  }
}
