:root {
  --page-bg:
    radial-gradient(circle at top, rgba(76, 104, 191, 0.18), transparent 30%),
    linear-gradient(180deg, #d8d1ca 0%, #cbc3bc 100%);
  --trim: #c4bbb3;
  --trim-dark: #968b83;
  --trim-border: #847a73;
  --bezel: #2d313b;
  --screen-frame: #6373bd;
  --screen-blue: #334095;
  --screen-text: #91a5eb;
  --screen-bright: #dce5ff;
}

* {
  box-sizing: border-box;
}

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

body {
  overflow: hidden;
  background: var(--page-bg);
  font-family: "Lucida Console", Monaco, monospace;
}

.machine-page {
  width: 100%;
  height: 100%;
  padding: 0.8rem;
}

.crt-shell {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0.45rem;
  padding: 0.55rem;
  border: 1px solid var(--trim-border);
  border-radius: 1rem;
  background: linear-gradient(180deg, #cdc3bc 0%, var(--trim) 100%);
}

.crt-screen {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 0.4rem solid var(--bezel);
  border-radius: 1.2rem;
  background: var(--screen-frame);
  outline: none;
}

.crt-glass {
  position: absolute;
  inset: 0.45rem;
  overflow: hidden;
  border-radius: 1rem;
  background: var(--screen-blue);
}

.crt-glass::before,
.crt-glass::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.crt-glass::before {
  opacity: 0.14;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0) 58%, rgba(0, 0, 0, 0.18) 100%),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 18%, rgba(0, 0, 0, 0) 36%, rgba(0, 0, 0, 0) 100%);
}

.crt-glass::after {
  opacity: 0.07;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.18) 0px,
    rgba(255, 255, 255, 0.18) 1px,
    transparent 2px,
    transparent 4px
  );
}

.console-grid {
  position: absolute;
  inset: 2.2%;
  color: var(--screen-text);
  font-family: "Lucida Console", Monaco, monospace;
  font-size: clamp(12px, 1vw + 0.3rem, 21px);
  line-height: 1.28;
  letter-spacing: 0;
  text-shadow: 0 0 8px rgba(145, 165, 235, 0.26);
  user-select: text;
}

@media (pointer: coarse) {
  .console-grid {
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
  }
}

.console-output {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding-right: 0.3ch;
  padding-bottom: 1.6em;
}

.console-line {
  margin: 0;
  min-height: 1.28em;
  white-space: pre;
}

.line-bright,
.line-user,
.line-prompt {
  color: var(--screen-bright);
}

.line-dim {
  opacity: 0.78;
}

.console-cursor {
  display: inline-block;
  width: 1ch;
  height: 1em;
  margin-left: 0;
  vertical-align: baseline;
  background: var(--screen-bright);
  animation: cursor-blink 0.6s steps(1) infinite;
}

.console-input-capture {
  position: absolute;
  left: 0;
  top: 0;
  min-width: 56px;
  min-height: 34px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  font: inherit;
  font-size: 16px;
  line-height: 1;
  opacity: 0.01;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.crt-trim {
  min-height: 2.12rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.9rem;
  border-top: 1px solid rgba(80, 67, 57, 0.28);
  color: #504843;
}

.trim-filler {
  min-width: 0;
}

.trim-power-cluster {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  justify-self: end;
}

.trim-power {
  width: 0.42rem;
  height: 0.16rem;
  background: #86bf4d;
  box-shadow: 0 0 5px rgba(134, 191, 77, 0.24);
}

.trim-power-label,
.trim-brand,
.trim-model-label,
.trim-model-name {
  color: #504843;
  font-family: Arial, sans-serif;
  font-weight: 700;
  text-transform: uppercase;
}

.trim-power-label {
  color: #f0eee7;
  font-size: 0.34rem;
  letter-spacing: 0.09em;
}

.trim-badge {
  justify-self: center;
}

.trim-badge-panel {
  display: inline-flex;
  align-items: center;
  gap: 0.48rem;
  padding: 0.23rem 0.62rem;
  border: 1px solid rgba(104, 95, 84, 0.45);
  background: #35392f;
}

.trim-commodore-lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.26rem;
}

.trim-commodore-mark {
  position: relative;
  width: 0.88rem;
  height: 0.66rem;
  flex: 0 0 auto;
}

.trim-commodore-loop {
  position: absolute;
  left: 0;
  top: 50%;
  width: 65%;
  height: 92%;
  border: 2px solid #f0efeb;
  border-radius: 999px;
  transform: translateY(-50%);
}

.trim-commodore-bar {
  position: absolute;
  right: 0;
  top: 50%;
  width: 45%;
  height: 22%;
  background: #f0efeb;
  transform: translateY(-50%);
}

.trim-brand {
  color: #f0eee7;
  font-size: 0.44rem;
  letter-spacing: 0.02em;
  text-transform: lowercase;
}

.trim-rainbow {
  display: inline-flex;
  align-items: stretch;
  gap: 1px;
}

.trim-rainbow .stripe {
  width: 0.3rem;
  height: 0.1rem;
}

.trim-rainbow .red {
  background: #e84b3b;
}

.trim-rainbow .orange {
  background: #dc7e2f;
}

.trim-rainbow .yellow {
  background: #d7bb44;
}

.trim-rainbow .green {
  background: #7fad4a;
}

.trim-rainbow .blue {
  background: #3596cf;
}

.trim-model-zone {
  justify-self: end;
}

.trim-model-copy {
  display: inline-flex;
  flex-direction: column;
  gap: 0.02rem;
  min-width: 7rem;
  padding: 0.18rem 0.54rem 0.15rem;
  border: 1px solid rgba(126, 115, 108, 0.92);
  color: #504843;
  background: rgba(202, 192, 184, 0.2);
}

.trim-model-label,
.trim-model-name {
  font-size: 0.37rem;
  letter-spacing: 0.08em;
  line-height: 1.08;
}

@keyframes cursor-blink {
  0%,
  49% {
    opacity: 1;
  }

  50%,
  100% {
    opacity: 0;
  }
}

@media (max-width: 900px) {
  .machine-page {
    padding: 0.35rem;
  }

  .crt-shell {
    padding: 0.35rem;
    border-radius: 0.7rem;
  }

  .crt-screen {
    border-width: 0.22rem;
    border-radius: 0.8rem;
  }

  .crt-glass {
    inset: 0.24rem;
    border-radius: 0.64rem;
  }

  .console-grid {
    inset: 1.8%;
    font-size: clamp(11px, 1.7vw + 0.15rem, 17px);
  }

  .crt-trim {
    min-height: 1.45rem;
    padding: 0 0.55rem;
    gap: 0.22rem;
  }

  .trim-badge-panel {
    gap: 0.26rem;
    padding: 0.14rem 0.32rem;
  }

  .trim-brand {
    font-size: 0.33rem;
  }

  .trim-power-label {
    font-size: 0.28rem;
  }

  .trim-commodore-mark {
    width: 0.66rem;
    height: 0.48rem;
  }

  .trim-rainbow .stripe {
    width: 0.2rem;
    height: 0.08rem;
  }

  .trim-model-copy {
    min-width: 4.9rem;
    padding: 0.12rem 0.34rem;
  }

  .trim-model-label,
  .trim-model-name {
    font-size: 0.29rem;
  }
}
