:root {
   --bezel: #1C1E24;
   --bezel-2: #26282F;
   --screen-bg: #0000AA;
   --screen-bg-2: #0000C4;
   --fg: #C6C6E6;
   --fg-bright: #FFFFFF;
   --yellow: #FFFF55;
   --cyan: #55FFFF;
   --red: #FF5555;
   --sel-bg: #C6C6C6;
   --sel-fg: #00008B;
}

@media (prefers-color-scheme: light) {
   :root:not([data-theme="dark"]) {
      --screen-bg: #C6C6C6;
      --screen-bg-2: #B6B6B6;
      --fg: #00008B;
      --fg-bright: #000040;
      --yellow: #8A6D00;
      --cyan: #006666;
      --red: #AA0000;
      --sel-bg: #00008B;
      --sel-fg: #FFFFFF;
   }
}

:root[data-theme="light"] {
   --screen-bg: #C6C6C6;
   --screen-bg-2: #B6B6B6;
   --fg: #00008B;
   --fg-bright: #000040;
   --yellow: #8A6D00;
   --cyan: #006666;
   --red: #AA0000;
   --sel-bg: #00008B;
   --sel-fg: #FFFFFF;
}

* {
   box-sizing: border-box;
}

html,
body {
   margin: 0;
   padding: 0;
   min-height: 100%;
   background: var(--bezel);
}

body {
   font-family: 'VT323', monospace;
   display: flex;
   justify-content: center;
   align-items: flex-start;
   padding: 36px 14px 50px;
   color: var(--fg);
}

.monitor {
   width: 100%;
   max-width: 480px;
   background: linear-gradient(160deg, var(--bezel-2), var(--bezel));
   border-radius: 18px;
   padding: 16px 16px 12px;
   box-shadow: 0 24px 50px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.screen-frame {
   background: #000;
   border-radius: 8px;
   padding: 4px;
}

.screen {
   position: relative;
   background: linear-gradient(180deg, var(--screen-bg), var(--screen-bg-2));
   border-radius: 5px;
   padding: 18px 18px 14px;
   min-height: 430px;
   overflow: hidden;
   font-size: 17px;
   line-height: 1.5;
   opacity: 0;
}

.scanlines {
   position: absolute;
   inset: 0;
   background: repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 3px);
   pointer-events: none;
   mix-blend-mode: multiply;
}

.vignette {
   position: absolute;
   inset: 0;
   box-shadow: inset 0 0 70px rgba(0, 0, 0, 0.55);
   pointer-events: none;
}

.flicker {
   animation: flicker .18s steps(2) 2;
}

@keyframes flicker {

   0%,
   100% {
      opacity: 1;
   }

   50% {
      opacity: .82;
   }
}

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

.yellow {
   color: var(--yellow);
}

.cyan {
   color: var(--cyan);
}

.bright {
   color: var(--fg-bright);
}

.red {
   color: var(--red);
}

.dim {
   opacity: .75;
}

.rule {
   border-top: 1px solid rgba(255, 255, 255, 0.25);
   margin: 10px 0;
}

#devices {
   margin-top: 2px;
}

.device-row {
   display: flex;
   align-items: center;
   gap: 10px;
   padding: 5px 8px;
   text-decoration: none;
   color: inherit;
   cursor: pointer;
   outline: none;
}

.device-row .port {
   width: 118px;
   flex-shrink: 0;
   font-size: 15px;
   opacity: .85;
}

.device-row .icon {
   width: 20px;
   text-align: center;
   flex-shrink: 0;
   font-size: 14px;
}

.device-row .name {
   flex: 1;
}

.device-row .sub {
   font-size: 14px;
   opacity: .7;
}

.device-row .status {
   flex-shrink: 0;
}

.device-row.selected {
   background: var(--sel-bg);
   color: var(--sel-fg);
}

.device-row.selected .sub,
.device-row.selected .port {
   color: var(--sel-fg);
   opacity: .75;
}

.prompt {
   margin-top: 12px;
}

.cursor-blk {
   display: inline-block;
   width: 9px;
   height: 15px;
   background: var(--fg-bright);
   vertical-align: middle;
   margin-left: 2px;
   animation: blink 1s steps(1) infinite;
}

@media (prefers-reduced-motion: reduce) {
   .cursor-blk {
      animation: none;
   }

   .flicker {
      animation: none;
   }

   .screen {
      opacity: 1 !important;
   }
}

.statusbar {
   display: flex;
   justify-content: space-between;
   font-size: 14px;
   margin-top: 14px;
   color: var(--fg);
   opacity: .8;
   flex-wrap: wrap;
   gap: 6px;
}

.toast {
   position: absolute;
   left: 18px;
   right: 18px;
   bottom: 14px;
   background: rgba(0, 0, 0, 0.55);
   color: var(--red);
   padding: 6px 10px;
   font-size: 15px;
   opacity: 0;
   pointer-events: none;
   transition: opacity .25s ease;
}

.toast.show {
   opacity: 1;
}

.brand-row {
   display: flex;
   justify-content: space-between;
   align-items: center;
   padding: 8px 6px 2px;
}

.brand {
   font-family: 'JetBrains Mono', monospace;
   font-size: 10px;
   letter-spacing: .1em;
   color: #6B6E78;
}

.led {
   width: 6px;
   height: 6px;
   border-radius: 50%;
   background: #3CE07A;
   box-shadow: 0 0 6px #3CE07A;
}

footer {
   text-align: center;
   margin-top: 14px;
   font-family: 'JetBrains Mono', monospace;
   font-size: 10px;
   color: #6B6E78;
}

footer button {
   background: none;
   border: none;
   color: inherit;
   cursor: pointer;
   text-decoration: underline;
   font-family: inherit;
   font-size: inherit;
   padding: 3px;
}