* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  background: #050505;
}

body {
  font-family: "Courier New", Courier, monospace;
  color: #d0d0d0;
  overflow: hidden;
}

/* ARTWORK NAVIGATION */

.artwork-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 46px;
  padding: 0 24px;

  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;

  background: #050505;
  border-bottom: 1px solid #222;
  z-index: 20000;

  color: #999990;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.artwork-nav > a:last-child {
  justify-self: end;
}

.artwork-nav-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #666660;
  white-space: nowrap;
}

.artwork-nav a {
  color: #999990;
  text-decoration: none;
}

.artwork-nav a:hover {
  color: #ffffff;
}

/* MAIN SCREEN */

#screen {
  height: calc(100vh - 46px);
  margin-top: 46px;
  display: flex;
  flex-direction: column;
  padding: 24px;
  position: relative;
}

/* SCANLINES */

#screen::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.015),
      rgba(255, 255, 255, 0.015) 1px,
      transparent 1px,
      transparent 4px
    );
}

/* HEADER */

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid #444;
  padding-bottom: 14px;
  margin-bottom: 18px;
}

.system-name {
  font-size: 24px;
  letter-spacing: 3px;
}

.presented-by {
  margin-top: 6px;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  opacity: 0.85;
}

.system-subtitle {
  opacity: 0.4;
  font-size: 12px;
  margin-top: 4px;
  letter-spacing: 2px;
}

.system-state {
  font-size: 13px;
  letter-spacing: 1px;
}

/* METRICS */

.metrics {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.metric {
  border: 1px solid #333;
  padding: 12px;
  min-height: 82px;
}

.metric-label {
  display: block;
  font-size: 11px;
  opacity: 0.5;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.metric-value {
  font-size: 19px;
}

.bar {
  width: 100%;
  height: 4px;
  background: #222;
  margin-top: 12px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 100%;
  background: currentColor;
  transition: width 0.5s ease;
}

/* MAIN AREA */

.main-grid {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: 16px;
}

.terminal-panel,
.queue-panel {
  border: 1px solid #333;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.panel-title {
  font-size: 11px;
  letter-spacing: 2px;
  opacity: 0.5;
  border-bottom: 1px solid #333;
  padding: 10px 14px;
}

/* TERMINAL */

#terminal {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  font-size: 14px;
  line-height: 1.55;
  scrollbar-width: none;
}

#terminal::-webkit-scrollbar {
  display: none;
}

.log-line {
  white-space: pre-wrap;
}

.info {
  opacity: 0.8;
}

.sys {
  opacity: 0.45;
}

.ai {
  font-style: italic;
  opacity: 0.9;
}

.user,
.warn,
.error,
.fatal {
  font-weight: bold;
}

.fatal {
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ACTIVE PROCESS QUEUE */

#process-list {
  overflow: hidden;
  padding: 10px;
}

.process {
  border-bottom: 1px solid #222;
  padding: 10px 5px;
  font-size: 12px;
  line-height: 1.4;
}

.process-type {
  opacity: 0.4;
  display: block;
  font-size: 10px;
  margin-bottom: 3px;
}

/* FOOTER */

footer {
  display: flex;
  justify-content: space-between;
  margin-top: 15px;
  border-top: 1px solid #333;
  padding-top: 10px;
  font-size: 10px;
  opacity: 0.35;
  letter-spacing: 1px;
}

/* CURSOR */

.cursor {
  display: inline-block;
  animation: blink 1s infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* SYSTEM DEGRADATION */

.stressed {
  animation: subtleFlicker 3s infinite;
}

.critical {
  animation: criticalFlicker 0.7s infinite;
}

.failure {
  animation: failureShake 0.12s infinite;
}

@keyframes subtleFlicker {
  0%,
  97%,
  100% {
    opacity: 1;
  }

  98% {
    opacity: 0.92;
  }
}

@keyframes criticalFlicker {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.86;
  }
}

@keyframes failureShake {
  0% {
    transform: translate(0, 0);
  }

  25% {
    transform: translate(1px, 0);
  }

  50% {
    transform: translate(-1px, 1px);
  }

  75% {
    transform: translate(0, -1px);
  }
}

/* GAU MODE */

#red-alert {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: rgba(180, 0, 0, 0);
  z-index: 9999;
  display: none;
}

#red-alert.active {
  display: block;
  animation: redAlertFlash 0.8s infinite;
}

@keyframes redAlertFlash {
  0% {
    background: rgba(180, 0, 0, 0.05);
  }

  50% {
    background: rgba(255, 0, 0, 0.58);
  }

  100% {
    background: rgba(180, 0, 0, 0.05);
  }
}

/* GAU SCREEN EFFECT */

#screen.gau {
  animation: gauScreen 0.8s infinite;
}

@keyframes gauScreen {
  0% {
    filter: brightness(1);
  }

  50% {
    filter: brightness(1.6) contrast(1.6);
  }

  100% {
    filter: brightness(1);
  }
}

/* FINAL MESSAGE */

#meltdown-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  text-align: center;
  z-index: 10000;

  font-family: "Courier New", Courier, monospace;
  font-size: clamp(36px, 6vw, 100px);
  font-weight: bold;
  letter-spacing: 6px;
  color: white;
  opacity: 0;
  pointer-events: none;
}

#meltdown-message.active {
  opacity: 1;
  animation: meltdownText 0.8s infinite;
}

@keyframes meltdownText {
  0% {
    opacity: 0.25;
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: 0.25;
  }
}

/* RESPONSIVE */

@media (max-width: 900px) {
  .metrics {
    grid-template-columns: repeat(3, 1fr);
  }

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

  .queue-panel {
    display: none;
  }
}

@media (max-width: 700px) {
  .artwork-nav {
    grid-template-columns: 1fr auto 1fr;
    gap: 8px;
    padding: 0 10px;
    font-size: 8px;
    letter-spacing: 0.06em;
  }

  .artwork-nav-center {
    gap: 5px;
  }
}

@media (max-width: 600px) {
  .artwork-nav {
    height: 42px;
  }

  #screen {
    height: calc(100vh - 42px);
    margin-top: 42px;
    padding: 14px;
  }

  .header {
    flex-direction: column;
    gap: 12px;
  }

  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
}