:root {
  --entity-primary: #62f6ff;
  --entity-secondary: #ff365d;
  --entity-tertiary: #ffd66b;
  --void: #020104;
  --glass: rgba(7, 4, 11, 0.84);
  --glass-strong: rgba(10, 6, 15, 0.94);
  --wire: rgba(132, 233, 255, 0.19);
  --wire-hot: rgba(132, 233, 255, 0.52);
  --ritual-red: #ff365d;
  --ritual-gold: #ffd66b;
  --ritual-green: #56f4a0;
  background: var(--void);
}

html,
body {
  background: var(--void);
}

body {
  position: relative;
  isolation: isolate;
}

.ritual-canvas {
  position: fixed;
  z-index: -3;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
}

.world-overlay {
  position: fixed;
  z-index: 90;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.world-scanlines,
.world-vignette {
  position: absolute;
  inset: 0;
}

.world-scanlines {
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.018) 0,
    rgba(255, 255, 255, 0.018) 1px,
    transparent 1px,
    transparent 4px
  );
  mix-blend-mode: screen;
  opacity: 0.44;
}

.world-vignette {
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.86), transparent 16%, transparent 84%, rgba(0, 0, 0, 0.86)),
    linear-gradient(0deg, rgba(0, 0, 0, 0.74), transparent 22%, transparent 83%, rgba(0, 0, 0, 0.5));
  opacity: 0.46;
}

.frame-corner {
  position: absolute;
  width: 3.2rem;
  height: 3.2rem;
  border-color: var(--entity-primary);
  border-style: solid;
  opacity: 0.42;
  filter: drop-shadow(0 0 0.5rem color-mix(in srgb, var(--entity-primary) 50%, transparent));
}

.corner-nw { top: 0.55rem; left: 0.55rem; border-width: 1px 0 0 1px; }
.corner-ne { top: 0.55rem; right: 0.55rem; border-width: 1px 1px 0 0; }
.corner-sw { bottom: 0.55rem; left: 0.55rem; border-width: 0 0 1px 1px; }
.corner-se { right: 0.55rem; bottom: 0.55rem; border-width: 0 1px 1px 0; }

.boot-sequence {
  position: fixed;
  z-index: 999;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.7rem;
  background: #020104;
  color: var(--entity-primary);
  pointer-events: none;
  animation: boot-dismiss 2.65s cubic-bezier(0.72, 0, 0.2, 1) forwards;
}

.boot-sequence::before,
.boot-sequence::after {
  content: "";
  position: absolute;
  top: 50%;
  width: calc(50% - 11rem);
  height: 1px;
  background: var(--entity-primary);
  box-shadow: 0 0 1.2rem var(--entity-primary);
  transform: scaleX(0);
  animation: boot-line 1.05s 0.25s ease forwards;
}

.boot-sequence::before { left: 0; transform-origin: right; }
.boot-sequence::after { right: 0; transform-origin: left; }

.boot-sequence span {
  font-family: var(--lab-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.boot-sequence strong {
  color: #fff;
  font-size: clamp(1.4rem, 4vw, 3.6rem);
  font-weight: 280;
  letter-spacing: 0;
  text-shadow:
    0 0 0.8rem color-mix(in srgb, var(--entity-primary) 72%, transparent),
    0 0 2.8rem color-mix(in srgb, var(--entity-secondary) 35%, transparent);
}

.boot-sequence i {
  width: min(28rem, 70vw);
  height: 3px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
}

.boot-sequence i::after {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background: var(--entity-secondary);
  box-shadow: 0 0 1rem var(--entity-secondary);
  transform: translateX(-100%);
  animation: boot-progress 1.55s 0.2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.app-bar {
  z-index: 40;
}

.brand-lockup,
.header-model,
.connection-status,
.settings-panel,
.inspect-panel {
  backdrop-filter: blur(13px) saturate(1.2);
}

.brand-lockup {
  border-right-color: color-mix(in srgb, var(--entity-primary) 36%, transparent);
  border-bottom-color: color-mix(in srgb, var(--entity-primary) 28%, transparent);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--entity-secondary) 9%, transparent), transparent 48%),
    rgba(4, 3, 8, 0.91);
  box-shadow: inset -1px 0 0 color-mix(in srgb, var(--entity-primary) 12%, transparent);
}

.brand-lockup::after {
  content: "ORACLE HIVE CONTROL";
  position: absolute;
  right: 0.75rem;
  bottom: 0.33rem;
  color: color-mix(in srgb, var(--entity-primary) 48%, transparent);
  font-family: var(--lab-mono);
  font-size: 0.42rem;
}

.brand-mark {
  border-color: var(--entity-primary);
  background: color-mix(in srgb, var(--entity-primary) 7%, #08050b);
  box-shadow:
    0 0 1.3rem color-mix(in srgb, var(--entity-primary) 26%, transparent),
    inset 0 0 1rem color-mix(in srgb, var(--entity-secondary) 12%, transparent);
  animation: mark-phase 8s linear infinite;
}

.brand-mark::before {
  background: var(--entity-secondary);
  box-shadow: 0 0 0.5rem var(--entity-secondary);
}

.brand-mark::after {
  background: var(--entity-primary);
  box-shadow: 0 0 0.5rem var(--entity-primary);
}

.brand-lockup h1 {
  color: #fff;
  font-weight: 680;
  text-shadow: 0 0 1.2rem color-mix(in srgb, var(--entity-primary) 28%, transparent);
}

.eyebrow,
.panel-kicker {
  color: var(--entity-primary);
  text-shadow: 0 0 0.8rem color-mix(in srgb, var(--entity-primary) 42%, transparent);
}

.brand-signal i {
  background: var(--entity-secondary);
  box-shadow: 0 0 0.45rem var(--entity-secondary);
}

.header-model {
  min-height: 4.45rem;
  overflow: hidden;
  border-color: color-mix(in srgb, var(--entity-primary) 34%, transparent);
  border-left: 3px solid var(--entity-secondary);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--entity-secondary) 8%, transparent), transparent 32%),
    rgba(3, 2, 7, 0.88);
  box-shadow:
    0 0 2.4rem rgba(0, 0, 0, 0.62),
    inset 0 -1px 0 color-mix(in srgb, var(--entity-primary) 14%, transparent);
  clip-path: polygon(0 0, calc(100% - 1rem) 0, 100% 1rem, 100% 100%, 1rem 100%, 0 calc(100% - 1rem));
}

.header-model::before {
  content: "EXTERNAL INTELLIGENCE";
  position: absolute;
  top: 0.35rem;
  right: 2.5rem;
  color: color-mix(in srgb, var(--entity-tertiary) 54%, transparent);
  font-family: var(--lab-mono);
  font-size: 0.45rem;
  pointer-events: none;
}

.header-model::after {
  content: "";
  position: absolute;
  right: -2rem;
  bottom: 0.4rem;
  width: 10rem;
  height: 1px;
  background: var(--entity-primary);
  box-shadow: 0 0 1rem var(--entity-primary);
  opacity: 0.52;
  transform: rotate(-8deg);
}

.header-model:hover {
  border-color: var(--entity-primary);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--entity-secondary) 14%, transparent), color-mix(in srgb, var(--entity-primary) 5%, transparent)),
    rgba(4, 2, 9, 0.94);
  box-shadow: 0 0 2rem color-mix(in srgb, var(--entity-primary) 16%, transparent);
}

.model-launcher-kicker {
  color: var(--entity-secondary);
  text-shadow: 0 0 0.65rem color-mix(in srgb, var(--entity-secondary) 65%, transparent);
}

.header-model strong {
  color: #fff;
  font-size: 1.2rem;
  font-weight: 610;
  text-shadow: 0 0 1rem color-mix(in srgb, var(--entity-primary) 28%, transparent);
}

.model-launcher-meta {
  border-color: color-mix(in srgb, var(--entity-tertiary) 46%, transparent);
  background: color-mix(in srgb, var(--entity-tertiary) 7%, transparent);
  color: var(--entity-tertiary);
  box-shadow: inset 0 0 0.7rem color-mix(in srgb, var(--entity-tertiary) 9%, transparent);
}

.model-launcher-arrow {
  color: var(--entity-primary);
}

.connection-status {
  overflow: hidden;
  border-color: color-mix(in srgb, var(--entity-secondary) 30%, transparent);
  border-right: 3px solid var(--entity-secondary);
  background: rgba(4, 2, 8, 0.9);
  clip-path: polygon(0.7rem 0, 100% 0, 100% 100%, 0 100%, 0 0.7rem);
}

.connection-status::after {
  content: "LINK / 01";
  margin-left: auto;
  color: color-mix(in srgb, var(--entity-primary) 44%, transparent);
  font-size: 0.45rem;
}

.status-dot {
  box-shadow: 0 0 0.8rem currentColor;
}

.connection-status[data-state="ready"] .status-dot {
  background: var(--ritual-green);
  box-shadow: 0 0 0.9rem var(--ritual-green);
}

.connection-status[data-state="running"] .status-dot,
.connection-status[data-state="loading"] .status-dot {
  background: var(--ritual-gold);
  box-shadow: 0 0 1rem var(--ritual-gold);
}

.connection-status[data-state="error"] .status-dot {
  background: var(--ritual-red);
  box-shadow: 0 0 1rem var(--ritual-red);
}

.workspace {
  position: relative;
  z-index: 4;
  background: transparent;
}

.settings-panel,
.inspect-panel {
  position: relative;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--entity-secondary) 4%, transparent), transparent 35%),
    rgba(4, 3, 8, 0.78);
  box-shadow: inset 0 0 3rem rgba(0, 0, 0, 0.48);
}

.settings-panel {
  border-right: 1px solid color-mix(in srgb, var(--entity-primary) 28%, transparent);
}

.settings-panel::after,
.inspect-panel::before {
  content: "";
  position: fixed;
  z-index: 2;
  top: 7.2rem;
  bottom: 1.1rem;
  width: 1px;
  background: linear-gradient(180deg, transparent, var(--entity-primary) 18%, var(--entity-secondary) 74%, transparent);
  box-shadow: 0 0 0.8rem color-mix(in srgb, var(--entity-primary) 44%, transparent);
  pointer-events: none;
}

.settings-panel::after { left: 17.2rem; }
.inspect-panel::before { right: 21rem; }

.panel-title,
.chat-toolbar {
  position: relative;
  overflow: hidden;
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 7px),
    rgba(6, 3, 10, 0.72);
}

.panel-title::after,
.chat-toolbar::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 42%;
  height: 1px;
  background: var(--entity-secondary);
  box-shadow: 0 0 0.8rem var(--entity-secondary);
  opacity: 0.6;
}

.panel-title h2,
.chat-toolbar h2 {
  color: #fff;
  font-weight: 680;
  text-shadow: 0 0 0.8rem color-mix(in srgb, var(--entity-primary) 32%, transparent);
}

.settings-section {
  position: relative;
  border-bottom-color: color-mix(in srgb, var(--entity-primary) 16%, transparent);
}

.settings-section::before {
  content: attr(data-index);
  position: absolute;
  top: 0.5rem;
  right: 0.78rem;
  color: color-mix(in srgb, var(--entity-secondary) 34%, transparent);
  font-family: var(--lab-mono);
  font-size: 0.48rem;
}

.settings-section h3 {
  color: #fff;
  font-weight: 650;
}

.required-label {
  color: var(--ritual-red);
  text-shadow: 0 0 0.7rem var(--ritual-red);
}

label {
  color: color-mix(in srgb, var(--entity-primary) 74%, #fff 26%);
}

input,
select,
textarea {
  border-color: color-mix(in srgb, var(--entity-primary) 24%, transparent);
  background: rgba(2, 2, 6, 0.78);
  color: #fff;
}

input:hover,
select:hover,
textarea:hover {
  border-color: color-mix(in srgb, var(--entity-primary) 48%, transparent);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--entity-primary);
  background: color-mix(in srgb, var(--entity-primary) 4%, rgba(2, 2, 6, 0.92));
  box-shadow:
    0 0 0.9rem color-mix(in srgb, var(--entity-primary) 14%, transparent),
    inset 0 0 1rem color-mix(in srgb, var(--entity-primary) 5%, transparent);
}

.key-row {
  border-color: color-mix(in srgb, var(--entity-primary) 28%, transparent);
  background: color-mix(in srgb, var(--entity-primary) 18%, transparent);
  clip-path: polygon(0 0, calc(100% - 0.55rem) 0, 100% 0.55rem, 100% 100%, 0 100%);
}

.quiet-button {
  color: color-mix(in srgb, var(--entity-primary) 68%, #fff 32%);
}

.quiet-button:hover,
.model-picker-close:hover,
.filter-reset:hover {
  border-color: var(--entity-primary);
  background: color-mix(in srgb, var(--entity-primary) 9%, transparent);
  color: #fff;
  box-shadow: 0 0 0.8rem color-mix(in srgb, var(--entity-primary) 13%, transparent);
}

.checkbox-label input {
  accent-color: var(--entity-primary);
}

.credit-widget {
  position: relative;
  overflow: hidden;
  border-top-color: color-mix(in srgb, var(--entity-tertiary) 28%, transparent);
  border-bottom-color: color-mix(in srgb, var(--entity-tertiary) 28%, transparent);
  background:
    linear-gradient(105deg, color-mix(in srgb, var(--entity-tertiary) 8%, transparent), transparent 66%),
    rgba(6, 4, 8, 0.64);
}

.credit-widget::after {
  content: "CREDIT RESERVE";
  position: absolute;
  right: -0.6rem;
  bottom: 0.35rem;
  color: color-mix(in srgb, var(--entity-tertiary) 14%, transparent);
  font-family: var(--lab-mono);
  font-size: 1.1rem;
  font-weight: 800;
  transform: rotate(-8deg);
  pointer-events: none;
}

.credit-balance strong {
  position: relative;
  z-index: 1;
  color: #fff;
  font-size: 2.05rem;
  text-shadow:
    0 0 0.8rem color-mix(in srgb, var(--entity-tertiary) 54%, transparent),
    0 0 2rem color-mix(in srgb, var(--entity-tertiary) 22%, transparent);
}

.credit-balance span,
.credit-usage small {
  color: var(--entity-tertiary);
  text-shadow: 0 0 0.6rem color-mix(in srgb, var(--entity-tertiary) 45%, transparent);
}

.generation-settings input[type="range"]::-webkit-slider-runnable-track {
  background: linear-gradient(90deg, var(--entity-secondary), var(--entity-primary));
  box-shadow: 0 0 0.6rem color-mix(in srgb, var(--entity-primary) 32%, transparent);
}

.generation-settings input[type="range"]::-webkit-slider-thumb {
  border-color: #fff;
  background: var(--entity-primary);
  box-shadow: 0 0 0.9rem var(--entity-primary);
}

.generation-settings output {
  color: var(--entity-tertiary);
  text-shadow: 0 0 0.7rem color-mix(in srgb, var(--entity-tertiary) 55%, transparent);
}

.generation-settings .routing-control {
  border-top-color: color-mix(in srgb, var(--entity-primary) 18%, transparent);
  background: linear-gradient(90deg, color-mix(in srgb, var(--entity-primary) 5%, transparent), transparent);
}

.generation-settings .paid-routing-control {
  background: linear-gradient(90deg, color-mix(in srgb, var(--entity-secondary) 5%, transparent), transparent);
}

.chat-panel {
  position: relative;
  isolation: isolate;
  border-right-color: color-mix(in srgb, var(--entity-secondary) 20%, transparent);
  background: rgba(1, 1, 3, 0.26);
}

.chat-panel::after {
  content: "";
  position: absolute;
  z-index: 8;
  inset: 0;
  border: 1px solid transparent;
  pointer-events: none;
}

.entity-shift .chat-panel::after {
  animation: entity-flash 760ms ease-out;
}

.summoning-chamber {
  position: absolute;
  z-index: -1;
  top: 51%;
  left: 50%;
  width: min(50vw, 39rem);
  aspect-ratio: 1;
  color: var(--entity-primary);
  opacity: 0.48;
  pointer-events: none;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 0 1.8rem color-mix(in srgb, var(--entity-primary) 16%, transparent));
}

.chamber-ring,
.chamber-axis,
.summoning-chamber strong {
  position: absolute;
  top: 50%;
  left: 50%;
}

.chamber-ring {
  border: 1px solid currentColor;
  box-shadow:
    0 0 1.4rem color-mix(in srgb, currentColor 18%, transparent),
    inset 0 0 1rem color-mix(in srgb, currentColor 8%, transparent);
}

.ring-outer {
  width: 74%;
  height: 74%;
  color: var(--entity-primary);
  transform: translate(-50%, -50%) rotate(45deg);
  animation: chamber-spin 34s linear infinite;
}

.ring-middle {
  width: 54%;
  height: 54%;
  color: var(--entity-secondary);
  border-style: dashed;
  transform: translate(-50%, -50%) rotate(16deg);
  animation: chamber-counter 23s linear infinite;
}

.ring-inner {
  width: 31%;
  height: 31%;
  color: var(--entity-tertiary);
  transform: translate(-50%, -50%) rotate(45deg);
  animation: chamber-pulse 3.4s ease-in-out infinite;
}

.chamber-axis {
  background: currentColor;
  box-shadow: 0 0 0.8rem currentColor;
  opacity: 0.3;
}

.axis-x {
  width: 92%;
  height: 1px;
  transform: translate(-50%, -50%);
}

.axis-y {
  width: 1px;
  height: 92%;
  transform: translate(-50%, -50%);
}

.summoning-chamber strong {
  color: transparent;
  font-family: var(--lab-mono);
  font-size: clamp(2.8rem, 6vw, 6.2rem);
  font-weight: 900;
  -webkit-text-stroke: 1px color-mix(in srgb, var(--entity-primary) 58%, transparent);
  text-shadow: 0 0 2rem color-mix(in srgb, var(--entity-secondary) 25%, transparent);
  transform: translate(-50%, -50%);
}

.chat-toolbar {
  z-index: 3;
  border-bottom-color: color-mix(in srgb, var(--entity-primary) 22%, transparent);
  background: rgba(4, 2, 8, 0.77);
  backdrop-filter: blur(12px);
}

.chat-toolbar-actions {
  border-color: color-mix(in srgb, var(--entity-primary) 22%, transparent);
  background: color-mix(in srgb, var(--entity-primary) 15%, transparent);
  clip-path: polygon(0.55rem 0, 100% 0, 100% 100%, 0 100%, 0 0.55rem);
}

.system-drawer {
  position: relative;
  z-index: 3;
  border-bottom-color: color-mix(in srgb, var(--entity-secondary) 24%, transparent);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--entity-secondary) 6%, transparent), transparent 44%),
    rgba(5, 2, 8, 0.76);
  backdrop-filter: blur(10px);
}

.system-drawer summary {
  color: color-mix(in srgb, var(--entity-tertiary) 76%, #fff 24%);
}

.system-drawer summary::before {
  color: var(--entity-secondary);
  text-shadow: 0 0 0.65rem var(--entity-secondary);
}

.system-drawer textarea {
  border-color: color-mix(in srgb, var(--entity-secondary) 30%, transparent);
  border-left: 2px solid var(--entity-secondary);
  background: rgba(2, 1, 4, 0.82);
}

.run-banner {
  position: relative;
  z-index: 3;
  overflow: hidden;
  border-bottom-color: color-mix(in srgb, var(--entity-primary) 18%, transparent);
  background: rgba(3, 2, 6, 0.72);
  backdrop-filter: blur(9px);
}

.run-banner::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 5rem;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--entity-primary) 9%, transparent), transparent);
  animation: status-sweep 3.6s linear infinite;
}

.run-copy strong {
  color: #fff;
  text-shadow: 0 0 0.65rem color-mix(in srgb, var(--entity-primary) 28%, transparent);
}

.run-banner[data-state="streaming"] {
  background: color-mix(in srgb, var(--entity-primary) 7%, rgba(3, 2, 6, 0.82));
  box-shadow: inset 2px 0 0 var(--entity-primary);
}

.run-banner[data-state="complete"] {
  background: color-mix(in srgb, var(--ritual-green) 6%, rgba(3, 2, 6, 0.82));
  box-shadow: inset 2px 0 0 var(--ritual-green);
}

.run-banner[data-state="error"] {
  background: color-mix(in srgb, var(--ritual-red) 8%, rgba(3, 2, 6, 0.82));
  box-shadow: inset 2px 0 0 var(--ritual-red);
}

.messages {
  z-index: 2;
  background: transparent;
}

.empty-mark {
  width: 5rem;
  height: 5rem;
  border-color: color-mix(in srgb, var(--entity-secondary) 58%, transparent);
  background: color-mix(in srgb, var(--entity-primary) 4%, transparent);
  color: var(--entity-primary);
  box-shadow:
    0 0 2rem color-mix(in srgb, var(--entity-primary) 16%, transparent),
    inset 0 0 1.5rem color-mix(in srgb, var(--entity-secondary) 8%, transparent);
  text-shadow: 0 0 0.8rem var(--entity-primary);
}

.empty-state strong {
  color: color-mix(in srgb, var(--entity-primary) 60%, #fff 40%);
  text-shadow: 0 0 0.7rem color-mix(in srgb, var(--entity-primary) 42%, transparent);
}

.message {
  position: relative;
  border-color: color-mix(in srgb, var(--entity-primary) 24%, transparent);
  background: rgba(4, 3, 8, 0.88);
  backdrop-filter: blur(9px);
}

.message::after {
  content: "";
  position: absolute;
  width: 1.15rem;
  height: 1.15rem;
  border-color: currentColor;
  border-style: solid;
  opacity: 0.48;
}

.message.assistant {
  border: 1px solid color-mix(in srgb, var(--entity-primary) 36%, transparent);
  border-left: 3px solid var(--entity-primary);
  background:
    linear-gradient(100deg, color-mix(in srgb, var(--entity-primary) 9%, transparent), transparent 60%),
    rgba(3, 4, 8, 0.9);
  box-shadow:
    -0.5rem 0 1.8rem color-mix(in srgb, var(--entity-primary) 7%, transparent),
    inset 0 0 1.4rem rgba(0, 0, 0, 0.24);
  clip-path: polygon(0 0, calc(100% - 0.8rem) 0, 100% 0.8rem, 100% 100%, 0 100%);
}

.message.assistant::after {
  top: -1px;
  right: -1px;
  border-width: 1px 1px 0 0;
  color: var(--entity-primary);
}

.message.user {
  border: 1px solid color-mix(in srgb, var(--entity-secondary) 40%, transparent);
  border-right: 3px solid var(--entity-secondary);
  background:
    linear-gradient(260deg, color-mix(in srgb, var(--entity-secondary) 11%, transparent), transparent 62%),
    rgba(7, 3, 8, 0.9);
  box-shadow:
    0.5rem 0 1.8rem color-mix(in srgb, var(--entity-secondary) 8%, transparent),
    inset 0 0 1.4rem rgba(0, 0, 0, 0.24);
  clip-path: polygon(0.8rem 0, 100% 0, 100% 100%, 0 100%, 0 0.8rem);
}

.message.user::after {
  top: -1px;
  left: -1px;
  border-width: 1px 0 0 1px;
  color: var(--entity-secondary);
}

.message.status {
  border-color: color-mix(in srgb, var(--entity-tertiary) 28%, transparent);
  background: rgba(2, 2, 5, 0.86);
  box-shadow: 0 0 1.3rem rgba(0, 0, 0, 0.6);
  clip-path: polygon(0.55rem 0, calc(100% - 0.55rem) 0, 100% 50%, calc(100% - 0.55rem) 100%, 0.55rem 100%, 0 50%);
}

.message.status::after {
  display: none;
}

.message.error {
  border-color: color-mix(in srgb, var(--ritual-red) 45%, transparent);
  border-left-color: var(--ritual-red);
  background: color-mix(in srgb, var(--ritual-red) 8%, rgba(4, 2, 6, 0.92));
  box-shadow: 0 0 1.5rem color-mix(in srgb, var(--ritual-red) 10%, transparent);
}

.message-role {
  color: var(--entity-primary);
  text-shadow: 0 0 0.6rem color-mix(in srgb, var(--entity-primary) 50%, transparent);
}

.message.user .message-role {
  color: var(--entity-secondary);
  text-shadow: 0 0 0.6rem color-mix(in srgb, var(--entity-secondary) 50%, transparent);
}

.message-body {
  color: #fff;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.75);
}

.frame-readout {
  color: color-mix(in srgb, var(--entity-primary) 52%, transparent);
}

.frame-readout i {
  background: linear-gradient(90deg, var(--entity-secondary), var(--entity-primary), transparent);
  box-shadow: 0 0 0.75rem color-mix(in srgb, var(--entity-primary) 42%, transparent);
}

.frame-readout b {
  color: var(--entity-tertiary);
  text-shadow: 0 0 0.6rem color-mix(in srgb, var(--entity-tertiary) 52%, transparent);
}

.composer {
  z-index: 5;
  border-top-color: color-mix(in srgb, var(--entity-primary) 24%, transparent);
  background: rgba(3, 2, 7, 0.88);
  backdrop-filter: blur(14px);
}

.composer::before {
  content: "INPUT CHANNEL / ENCRYPTED";
  position: absolute;
  top: 0.25rem;
  right: 1rem;
  color: color-mix(in srgb, var(--entity-secondary) 38%, transparent);
  font-family: var(--lab-mono);
  font-size: 0.43rem;
}

.composer textarea {
  border-color: color-mix(in srgb, var(--entity-primary) 38%, transparent);
  border-left-color: var(--entity-primary);
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 4px),
    rgba(1, 1, 4, 0.9);
  box-shadow:
    0 0 1.4rem rgba(0, 0, 0, 0.62),
    inset 0 0 1.4rem color-mix(in srgb, var(--entity-primary) 4%, transparent);
  clip-path: polygon(0 0, calc(100% - 0.7rem) 0, 100% 0.7rem, 100% 100%, 0 100%);
}

.send-button,
.picker-confirm {
  position: relative;
  overflow: hidden;
  border-color: color-mix(in srgb, var(--entity-secondary) 75%, #fff 25%);
  background:
    linear-gradient(110deg, var(--entity-secondary), color-mix(in srgb, var(--entity-secondary) 64%, #6f1230 36%));
  color: #fff;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
  box-shadow:
    0 0 1.2rem color-mix(in srgb, var(--entity-secondary) 30%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  clip-path: polygon(0.65rem 0, 100% 0, 100% calc(100% - 0.65rem), calc(100% - 0.65rem) 100%, 0 100%, 0 0.65rem);
}

.send-button::before,
.picker-confirm::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -60%;
  width: 35%;
  height: 200%;
  background: rgba(255, 255, 255, 0.28);
  transform: skewX(-25deg);
  transition: left 260ms ease;
}

.send-button:hover,
.picker-confirm:hover {
  border-color: #fff;
  background: var(--entity-secondary);
  color: #fff;
  box-shadow: 0 0 2rem color-mix(in srgb, var(--entity-secondary) 48%, transparent);
}

.send-button:hover::before,
.picker-confirm:hover::before {
  left: 130%;
}

.send-arrow {
  background: rgba(0, 0, 0, 0.16);
  box-shadow: inset 0 0 0.6rem rgba(0, 0, 0, 0.2);
}

.inspect-panel {
  border-left: 1px solid color-mix(in srgb, var(--entity-secondary) 22%, transparent);
}

.metrics-grid {
  border-bottom-color: color-mix(in srgb, var(--entity-primary) 22%, transparent);
  background: color-mix(in srgb, var(--entity-primary) 15%, transparent);
}

.metrics-grid > div {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--entity-primary) 5%, transparent), transparent 62%),
    rgba(5, 3, 9, 0.86);
}

.metrics-grid > div::after {
  content: "";
  position: absolute;
  right: -0.4rem;
  bottom: -0.55rem;
  width: 2rem;
  height: 2rem;
  border: 1px solid color-mix(in srgb, var(--entity-primary) 15%, transparent);
  transform: rotate(45deg);
}

.metrics-grid strong {
  color: #fff;
  text-shadow: 0 0 0.7rem color-mix(in srgb, var(--entity-primary) 35%, transparent);
}

.metrics-grid > div:nth-child(2) strong,
.metrics-grid > div:nth-child(4) strong {
  color: var(--entity-primary);
}

.metrics-grid .cost-metric {
  background:
    repeating-linear-gradient(135deg, rgba(255, 214, 107, 0.025) 0 1px, transparent 1px 7px),
    color-mix(in srgb, var(--entity-tertiary) 7%, rgba(5, 3, 9, 0.9));
  box-shadow: inset 3px 0 0 var(--entity-tertiary);
}

.metrics-grid .cost-metric strong {
  color: #fff;
  font-size: 1.85rem;
  text-shadow:
    0 0 0.7rem color-mix(in srgb, var(--entity-tertiary) 50%, transparent),
    0 0 2rem color-mix(in srgb, var(--entity-tertiary) 18%, transparent);
}

.metrics-grid .cost-metric em {
  color: var(--entity-tertiary);
  text-shadow: 0 0 0.7rem color-mix(in srgb, var(--entity-tertiary) 52%, transparent);
}

.finish-row {
  border-bottom-color: color-mix(in srgb, var(--entity-secondary) 22%, transparent);
  background: color-mix(in srgb, var(--entity-secondary) 4%, transparent);
}

.finish-row strong {
  color: var(--entity-primary);
}

.inspect-tabs {
  border-bottom-color: color-mix(in srgb, var(--entity-primary) 22%, transparent);
  background: color-mix(in srgb, var(--entity-primary) 14%, transparent);
}

.tab-button {
  background: rgba(4, 2, 8, 0.9);
}

.tab-button.active {
  color: #fff;
  background: color-mix(in srgb, var(--entity-primary) 9%, rgba(4, 2, 8, 0.92));
  box-shadow:
    inset 0 -2px 0 var(--entity-primary),
    inset 0 0 1rem color-mix(in srgb, var(--entity-primary) 6%, transparent);
}

.inspector {
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 4px),
    rgba(2, 1, 4, 0.88);
  color: color-mix(in srgb, var(--entity-primary) 70%, #fff 30%);
}

/* Full-screen compendium */
.model-picker {
  border-color: color-mix(in srgb, var(--entity-primary) 52%, transparent);
  border-top: 2px solid var(--entity-secondary);
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.009) 0 1px, transparent 1px 9px),
    rgba(3, 2, 7, 0.96);
  box-shadow:
    0 0 5rem rgba(0, 0, 0, 0.88),
    0 0 2.5rem color-mix(in srgb, var(--entity-secondary) 13%, transparent),
    inset 0 0 3rem color-mix(in srgb, var(--entity-primary) 4%, transparent);
  clip-path: polygon(0.7rem 0, 100% 0, 100% calc(100% - 0.7rem), calc(100% - 0.7rem) 100%, 0 100%, 0 0.7rem);
}

.model-picker::backdrop {
  background: rgba(1, 1, 3, 0.8);
  backdrop-filter: blur(4px) saturate(1.25);
}

.model-picker-header {
  position: relative;
  overflow: hidden;
  border-bottom-color: color-mix(in srgb, var(--entity-secondary) 38%, transparent);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--entity-secondary) 12%, transparent), transparent 42%),
    rgba(4, 2, 8, 0.96);
}

.model-picker-header::after {
  content: "HIVE INDEX // ORACLE SYSTEM // LIVE";
  position: absolute;
  right: 9.5rem;
  bottom: 0.45rem;
  color: color-mix(in srgb, var(--entity-primary) 35%, transparent);
  font-family: var(--lab-mono);
  font-size: 0.45rem;
}

.model-picker-header h2 {
  color: #fff;
  font-size: 1.4rem;
  font-weight: 720;
  text-shadow: 0 0 1rem color-mix(in srgb, var(--entity-secondary) 30%, transparent);
}

.model-picker-header-actions {
  border-color: color-mix(in srgb, var(--entity-primary) 26%, transparent);
  background: color-mix(in srgb, var(--entity-primary) 12%, transparent);
}

.model-picker-header-actions > * {
  background: rgba(4, 2, 8, 0.94);
}

.model-picker-close {
  color: var(--entity-secondary);
}

.model-picker-catalog {
  background: rgba(3, 2, 7, 0.72);
}

.model-picker-toolbar,
.model-picker .filter-heading,
.model-picker .model-filters,
.model-result-heading {
  border-color: color-mix(in srgb, var(--entity-primary) 18%, transparent);
  background: rgba(4, 2, 8, 0.68);
}

.model-picker-toolbar label,
.model-filters label,
.nsfw-filter {
  border-color: color-mix(in srgb, var(--entity-primary) 16%, transparent);
}

.model-picker-toolbar label > span,
.model-filters label > span,
.nsfw-filter legend,
.filter-heading > span,
.model-result-heading > span:first-child {
  color: color-mix(in srgb, var(--entity-primary) 65%, #fff 35%);
}

.segmented-filter {
  border-color: color-mix(in srgb, var(--entity-primary) 25%, transparent);
  background: color-mix(in srgb, var(--entity-primary) 14%, transparent);
}

.segmented-filter button {
  background: rgba(4, 2, 8, 0.95);
}

.segmented-filter button:hover,
.segmented-filter button[aria-pressed="true"] {
  color: #fff;
  background: color-mix(in srgb, var(--entity-primary) 12%, rgba(4, 2, 8, 0.94));
  box-shadow:
    inset 0 -2px 0 var(--entity-primary),
    inset 0 0 1rem color-mix(in srgb, var(--entity-primary) 8%, transparent);
}

.model-result-heading #model-result-count {
  color: var(--entity-tertiary);
  text-shadow: 0 0 0.6rem color-mix(in srgb, var(--entity-tertiary) 48%, transparent);
}

.model-roster {
  background: rgba(2, 1, 4, 0.76);
}

.model-card {
  position: relative;
  border-right-color: color-mix(in srgb, var(--entity-primary) 12%, transparent);
  border-bottom-color: color-mix(in srgb, var(--entity-primary) 12%, transparent);
  background:
    linear-gradient(112deg, color-mix(in srgb, var(--entity-primary) 3%, transparent), transparent 55%),
    rgba(5, 3, 9, 0.84);
}

.model-card::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 1.4rem;
  height: 1.4rem;
  border-top: 1px solid color-mix(in srgb, var(--entity-primary) 28%, transparent);
  border-right: 1px solid color-mix(in srgb, var(--entity-primary) 28%, transparent);
}

.model-card:hover {
  border-color: color-mix(in srgb, var(--entity-primary) 28%, transparent);
  background:
    linear-gradient(112deg, color-mix(in srgb, var(--entity-primary) 10%, transparent), color-mix(in srgb, var(--entity-secondary) 4%, transparent)),
    rgba(6, 3, 11, 0.94);
  box-shadow: inset 0 0 1.4rem color-mix(in srgb, var(--entity-primary) 5%, transparent);
}

.model-card.is-selected {
  border-color: color-mix(in srgb, var(--entity-primary) 42%, transparent);
  background:
    linear-gradient(112deg, color-mix(in srgb, var(--entity-primary) 15%, transparent), color-mix(in srgb, var(--entity-secondary) 7%, transparent)),
    rgba(7, 4, 12, 0.96);
  box-shadow:
    inset 3px 0 0 var(--entity-primary),
    inset 0 0 1.8rem color-mix(in srgb, var(--entity-primary) 7%, transparent),
    0 0 1.4rem color-mix(in srgb, var(--entity-primary) 8%, transparent);
}

.model-card.is-selected::after {
  border-color: var(--entity-secondary);
  filter: drop-shadow(0 0 0.5rem var(--entity-secondary));
}

.model-card-emblem,
.model-emblem {
  border-color: color-mix(in srgb, var(--entity-primary) 62%, transparent);
  background: color-mix(in srgb, var(--entity-primary) 6%, rgba(2, 1, 4, 0.9));
  color: var(--entity-primary);
  box-shadow:
    0 0 0.75rem color-mix(in srgb, var(--entity-primary) 14%, transparent),
    inset 0 0 0.7rem color-mix(in srgb, var(--entity-primary) 8%, transparent);
}

.model-card-rank,
.model-rank,
.model-rank[data-rank] {
  color: var(--entity-tertiary);
  text-shadow: 0 0 0.55rem color-mix(in srgb, var(--entity-tertiary) 48%, transparent);
}

.model-card-price {
  border-color: color-mix(in srgb, var(--entity-secondary) 42%, transparent);
  background: color-mix(in srgb, var(--entity-secondary) 6%, transparent);
  color: #fff;
}

.model-card-name {
  color: #fff;
}

.model-card-stats {
  border-top-color: color-mix(in srgb, var(--entity-primary) 15%, transparent);
  color: color-mix(in srgb, var(--entity-primary) 65%, #fff 35%);
}

.model-card-loadout span,
.model-card-loadout .is-empty {
  color: var(--entity-primary);
}

.model-card-loadout .is-source {
  color: var(--entity-tertiary);
}

.model-card.is-summoning {
  animation: devil-contract 620ms cubic-bezier(0.16, 1, 0.3, 1);
}

.model-picker-preview {
  position: relative;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 22px),
    linear-gradient(180deg, color-mix(in srgb, var(--entity-secondary) 5%, transparent), transparent 42%),
    rgba(3, 2, 7, 0.92);
}

.entity-stage {
  position: relative;
  width: 100%;
  height: 11.5rem;
  margin: 0.6rem 0 0.9rem;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--entity-primary) 34%, transparent);
  border-left: 2px solid var(--entity-secondary);
  background: rgba(1, 1, 3, 0.88);
  box-shadow:
    0 0 1.8rem color-mix(in srgb, var(--entity-primary) 7%, transparent),
    inset 0 0 2rem rgba(0, 0, 0, 0.5);
  clip-path: polygon(0 0, calc(100% - 0.75rem) 0, 100% 0.75rem, 100% 100%, 0.75rem 100%, 0 calc(100% - 0.75rem));
}

.entity-stage canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.entity-stage-code {
  position: absolute;
  top: 0.45rem;
  left: 0.55rem;
  color: color-mix(in srgb, var(--entity-secondary) 72%, #fff 28%);
  font-family: var(--lab-mono);
  font-size: 0.45rem;
  text-shadow: 0 0 0.6rem color-mix(in srgb, var(--entity-secondary) 58%, transparent);
}

.entity-reticle {
  position: absolute;
  width: 1.1rem;
  height: 1.1rem;
  border-color: var(--entity-primary);
  border-style: solid;
  opacity: 0.65;
}

.reticle-a {
  top: 0.45rem;
  right: 0.45rem;
  border-width: 1px 1px 0 0;
}

.reticle-b {
  right: 0.45rem;
  bottom: 0.45rem;
  border-width: 0 1px 1px 0;
}

.model-identity {
  border-bottom-color: color-mix(in srgb, var(--entity-primary) 22%, transparent);
}

.model-picker-preview .model-name {
  color: #fff;
  text-shadow: 0 0 0.7rem color-mix(in srgb, var(--entity-primary) 25%, transparent);
}

.model-description {
  color: rgba(241, 247, 246, 0.66);
}

.model-facts {
  background: color-mix(in srgb, var(--entity-primary) 14%, transparent);
}

.model-facts span {
  background: rgba(4, 2, 8, 0.92);
}

.model-facts #model-manufacturer {
  color: var(--entity-primary);
}

.model-score-visual,
.capability-board {
  border-color: color-mix(in srgb, var(--entity-primary) 22%, transparent);
}

.score-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 0 0.4rem rgba(0, 0, 0, 0.7);
}

.score-track > span,
.score-row[data-score] .score-track > span {
  background: linear-gradient(90deg, var(--entity-secondary), var(--entity-primary));
  box-shadow: 0 0 0.65rem var(--entity-primary);
}

.model-score-visual.is-recalibrating {
  animation: matrix-recalibrate 620ms ease;
}

.capability-grid {
  background: color-mix(in srgb, var(--entity-primary) 13%, transparent);
}

.capability-item {
  background: rgba(4, 2, 8, 0.94);
}

.capability-item[data-active="true"] {
  color: #fff;
  background: color-mix(in srgb, var(--entity-primary) 11%, rgba(4, 2, 8, 0.94));
  box-shadow:
    inset 0 -1px 0 var(--entity-primary),
    inset 0 0 0.8rem color-mix(in srgb, var(--entity-primary) 7%, transparent);
}

.price-board,
.model-picker-preview .price-board {
  border-color: color-mix(in srgb, var(--entity-tertiary) 34%, transparent);
  background: color-mix(in srgb, var(--entity-tertiary) 18%, transparent);
  box-shadow: 0 0 1.3rem color-mix(in srgb, var(--entity-tertiary) 7%, transparent);
}

.price-item,
.input-price,
.output-price {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--entity-tertiary) 8%, transparent), transparent),
    rgba(5, 3, 9, 0.95);
}

.price-item strong {
  color: #fff;
  font-size: 1.55rem;
  text-shadow: 0 0 0.75rem color-mix(in srgb, var(--entity-tertiary) 40%, transparent);
}

.price-item small {
  color: var(--entity-tertiary);
}

.model-picker-footer {
  border-top-color: color-mix(in srgb, var(--entity-secondary) 36%, transparent);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--entity-secondary) 7%, transparent), transparent 45%),
    rgba(3, 2, 7, 0.98);
}

.model-picker-footer strong {
  color: #fff;
  text-shadow: 0 0 0.7rem color-mix(in srgb, var(--entity-primary) 34%, transparent);
}

@media (min-width: 1181px) {
  .workspace {
    grid-template-columns: 17.2rem minmax(0, 1fr) 21rem;
  }

  .brand-lockup {
    width: 17.2rem;
  }

  .header-model {
    left: 18.2rem;
    right: 22rem;
  }

  .connection-status {
    width: 20.28rem;
  }

  .model-picker-body {
    grid-template-columns: minmax(40rem, 1fr) 24rem;
  }

  .model-roster {
    grid-auto-rows: 8.15rem;
  }

  .model-card {
    height: 8.15rem;
  }
}

@media (min-width: 761px) and (max-width: 1180px) {
  .settings-panel::after,
  .inspect-panel::before {
    display: none;
  }

  .model-picker-body {
    grid-template-columns: minmax(28rem, 1fr) 21rem;
  }

  .entity-stage {
    height: 10rem;
  }
}

@media (max-width: 760px) {
  .world-vignette {
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.7), transparent 16%, transparent 86%, rgba(0, 0, 0, 0.55));
  }

  .frame-corner {
    width: 1.6rem;
    height: 1.6rem;
  }

  .app-bar {
    background: rgba(2, 1, 4, 0.82);
    backdrop-filter: blur(12px);
  }

  .brand-lockup,
  .connection-status {
    background: rgba(3, 2, 7, 0.88);
  }

  .header-model {
    clip-path: polygon(0 0, calc(100% - 0.7rem) 0, 100% 0.7rem, 100% 100%, 0.7rem 100%, 0 calc(100% - 0.7rem));
  }

  .settings-panel,
  .inspect-panel {
    background: rgba(3, 2, 7, 0.84);
  }

  .settings-panel::after,
  .inspect-panel::before {
    display: none;
  }

  .summoning-chamber {
    top: 54%;
    width: min(112vw, 31rem);
    opacity: 0.34;
  }

  .messages {
    background: rgba(1, 1, 3, 0.18);
  }

  .model-picker {
    clip-path: none;
  }

  .model-picker-preview {
    background: rgba(3, 2, 7, 0.95);
  }

  .entity-stage {
    height: 13rem;
  }
}

@media (max-width: 520px) {
  .boot-sequence::before,
  .boot-sequence::after {
    width: calc(50% - 7rem);
  }

  .boot-sequence span {
    font-size: 0.48rem;
  }

  .boot-sequence strong {
    font-size: 1.45rem;
  }

  .brand-lockup::after,
  .connection-status::after,
  .header-model::before,
  .model-picker-header::after {
    display: none;
  }

  .header-model strong {
    font-size: 0.94rem;
  }

  .summoning-chamber {
    width: 34rem;
  }

  .message {
    backdrop-filter: blur(6px);
  }

  .entity-stage {
    height: 11.2rem;
  }
}

@keyframes boot-line {
  to { transform: scaleX(1); }
}

@keyframes boot-progress {
  to { transform: translateX(0); }
}

@keyframes boot-dismiss {
  0%, 72% { opacity: 1; visibility: visible; }
  92% { opacity: 0; visibility: visible; }
  100% { opacity: 0; visibility: hidden; }
}

@keyframes mark-phase {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(90deg); }
}

@keyframes chamber-spin {
  to { transform: translate(-50%, -50%) rotate(405deg); }
}

@keyframes chamber-counter {
  to { transform: translate(-50%, -50%) rotate(-344deg); }
}

@keyframes chamber-pulse {
  0%, 100% { opacity: 0.28; transform: translate(-50%, -50%) rotate(45deg) scale(0.92); }
  50% { opacity: 0.9; transform: translate(-50%, -50%) rotate(135deg) scale(1.06); }
}

@keyframes status-sweep {
  from { left: -6rem; }
  to { left: calc(100% + 6rem); }
}

@keyframes entity-flash {
  0% { background: rgba(255, 255, 255, 0.6); border-color: #fff; }
  18% { background: color-mix(in srgb, var(--entity-primary) 22%, transparent); border-color: var(--entity-primary); }
  100% { background: transparent; border-color: transparent; }
}

@keyframes devil-contract {
  0% { opacity: 0.1; filter: brightness(2.6) contrast(1.5); transform: translateX(-8px); }
  18% { opacity: 1; transform: translateX(6px); }
  36% { transform: translateX(-3px); }
  52% { filter: brightness(1.8) contrast(1.25); transform: translateX(2px); }
  100% { filter: none; transform: translateX(0); }
}

@keyframes matrix-recalibrate {
  0%, 100% { opacity: 1; filter: none; }
  30% { opacity: 0.32; filter: brightness(2); }
  58% { opacity: 0.84; filter: hue-rotate(28deg); }
}

@media (prefers-reduced-motion: reduce) {
  .boot-sequence {
    display: none;
  }

  .brand-mark,
  .ring-outer,
  .ring-middle,
  .ring-inner,
  .run-banner::after {
    animation: none !important;
  }
}
