@font-face {
  font-family: "BestTen CRT";
  src: url("./assets/fonts/BestTen-CRT.otf") format("opentype");
  font-display: swap;
}

@font-face {
  font-family: "LanaPixel";
  src: url("./assets/fonts/LanaPixel.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Madou Futo Maru Gothic";
  src: url("./assets/fonts/Madou-Futo-Maru-Gothic.ttf") format("truetype");
  font-display: swap;
}

:root {
  --room: #080808;
  --room-panel: #141414;
  --case: #181818;
  --case-hi: #2b2b2b;
  --case-low: #070707;
  --lcd-bg: #9c9c91;
  --lcd-deep: #6d6d65;
  --lcd-ink: #141512;
  --lcd-dim: #383a34;
  --lcd-faint: #595b53;
  --lcd-hot: #050505;
  --line: #343434;
  --line-bright: #6a6a64;
  --danger: #d6d0c2;
  --shadow: rgba(0, 0, 0, 0.48);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(0deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px) 0 0 / 24px 24px,
    radial-gradient(circle at 20% 0%, rgba(190, 190, 178, 0.12), transparent 34rem),
    var(--room);
  color: #e8e8df;
  font-family: "LanaPixel", "BestTen CRT", "Madou Futo Maru Gothic", "Cascadia Mono", "SFMono-Regular", "Courier New", monospace;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.simulator-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 34px;
}

.simulator-topline {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: #aaa99f;
  font-size: 12px;
}

h1 {
  margin: 0;
  color: #f1f1e9;
  font-size: clamp(26px, 4vw, 44px);
  font-weight: 700;
}

.signal-pill {
  min-width: 136px;
  border: 1px solid var(--line-bright);
  padding: 9px 12px;
  color: #f1f1e9;
  background: #1e1e1d;
  text-align: center;
  font-size: 12px;
}

.signal-pill--muted {
  color: #aaa99f;
}

.signal-pill--bad {
  border-color: #8c8577;
  color: var(--danger);
  background: #221f1b;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 22px;
  align-items: start;
}

.device-frame {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  align-self: start;
  min-height: 680px;
  border: 1px solid #3a3a36;
  border-radius: 8px;
  padding: 42px 34px 30px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.05), transparent 42%),
    linear-gradient(180deg, var(--case-hi), var(--case));
  box-shadow: 0 28px 70px var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.screw {
  position: absolute;
  width: 14px;
  aspect-ratio: 1;
  border: 1px solid #64645d;
  border-radius: 50%;
  background: radial-gradient(circle, #585852 0 30%, #111111 32% 100%);
}

.screw--tl {
  top: 18px;
  left: 18px;
}

.screw--tr {
  top: 18px;
  right: 18px;
}

.screw--bl {
  bottom: 18px;
  left: 18px;
}

.screw--br {
  bottom: 18px;
  right: 18px;
}

.lcd-screen {
  position: relative;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  min-height: 465px;
  border: 12px solid var(--case-low);
  border-radius: 6px;
  padding: 18px;
  overflow: hidden;
  outline: none;
  color: var(--lcd-ink);
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 50%, rgba(0, 0, 0, 0.06) 50%) 0 0 / 100% 4px,
    radial-gradient(circle at 50% 18%, rgba(255, 255, 245, 0.18), transparent 22rem),
    linear-gradient(180deg, #bebeb2, var(--lcd-bg) 50%, var(--lcd-deep));
  box-shadow:
    inset 0 0 0 1px rgba(32, 32, 28, 0.28),
    inset 0 0 42px rgba(4, 4, 4, 0.85),
    0 18px 35px rgba(0, 0, 0, 0.5);
  text-shadow: 0 1px 0 rgba(255, 255, 245, 0.14);
}

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

.lcd-screen::before {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.03), transparent 18%, rgba(255, 255, 255, 0.025) 54%, transparent),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.12) 0 1px, transparent 1px 3px);
  mix-blend-mode: screen;
}

.lcd-screen::after {
  border: 1px solid rgba(28, 28, 24, 0.24);
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.7);
}

.lcd-screen.is-flashing {
  animation: lcdPulse 160ms linear 2;
}

@keyframes lcdPulse {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.32);
  }
}

.lcd-topline,
.lcd-title,
.lcd-footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--lcd-faint);
  padding-bottom: 10px;
  color: var(--lcd-hot);
  font-size: 13px;
}

.lcd-title {
  align-items: end;
  margin-top: 14px;
  padding-bottom: 14px;
}

#artworkTitle {
  font-size: clamp(24px, 4vw, 40px);
  font-weight: 800;
  line-height: 1;
}

#artworkMeta {
  max-width: 46%;
  color: var(--lcd-dim);
  text-align: right;
  font-size: 12px;
  line-height: 1.45;
}

.lcd-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 188px minmax(0, 1fr);
  gap: 16px;
  min-height: 0;
  padding: 16px 0;
}

.mode-list {
  display: grid;
  align-content: start;
  gap: 9px;
}

.mode-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  min-height: 44px;
  border: 1px solid var(--lcd-faint);
  padding: 10px 9px;
  background: rgba(30, 30, 26, 0.3);
  color: var(--lcd-dim);
  font-size: 13px;
}

.mode-item.is-selected {
  border-color: var(--lcd-ink);
  color: var(--lcd-hot);
  background: rgba(0, 0, 0, 0.14);
}

.mode-pointer {
  color: var(--lcd-hot);
}

.mode-label {
  min-width: 0;
}

.mode-label strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.mode-label span {
  display: block;
  margin-top: 4px;
  color: var(--lcd-dim);
  font-size: 11px;
}

.lcd-main {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  min-height: 290px;
  border: 1px solid var(--lcd-faint);
  padding: 14px;
  background: rgba(28, 28, 24, 0.34);
}

.content-kicker {
  margin-bottom: 12px;
  color: var(--lcd-dim);
  font-size: 12px;
}

.content-text {
  min-width: 0;
  color: var(--lcd-hot);
  font-size: clamp(18px, 2.5vw, 30px);
  font-weight: 700;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.content-text.is-small {
  font-size: clamp(15px, 1.8vw, 20px);
  font-weight: 600;
}

.lcd-progress {
  height: 10px;
  border: 1px solid var(--lcd-faint);
  margin-top: 14px;
  background: rgba(20, 20, 18, 0.6);
}

.lcd-progress__bar {
  width: 0%;
  height: 100%;
  background: var(--lcd-ink);
  box-shadow: none;
  transition: width 220ms linear;
}

.lcd-footer {
  border-top: 1px solid var(--lcd-faint);
  border-bottom: 0;
  padding: 10px 0 0;
  color: var(--lcd-dim);
}

.lcd-footer span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.noise-chip {
  color: var(--lcd-hot);
}

.control-deck {
  display: grid;
  grid-template-columns: repeat(4, minmax(72px, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.control-button {
  min-height: 60px;
  border: 1px solid #494944;
  border-radius: 6px;
  color: #ecece4;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent),
    #141414;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.35), 0 12px 22px rgba(0, 0, 0, 0.3);
  outline: none;
}

.control-button:hover {
  border-color: #8f8f86;
}

.control-button:focus-visible {
  border-color: #d8d8cf;
  box-shadow:
    inset 0 -3px 0 rgba(0, 0, 0, 0.35),
    0 0 0 3px rgba(216, 216, 207, 0.16),
    0 12px 22px rgba(0, 0, 0, 0.3);
}

.control-button:active,
.control-button.is-active {
  transform: translateY(2px);
  box-shadow: inset 0 3px 0 rgba(0, 0, 0, 0.35);
}

.operator-panel {
  display: grid;
  gap: 14px;
  align-self: start;
  align-content: start;
}

.panel-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: rgba(18, 18, 17, 0.92);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.22);
}

.panel-section--compact {
  padding-bottom: 10px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  color: #f1f1e9;
  font-weight: 700;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
  color: #aaa99f;
  font-size: 12px;
}

.field input {
  width: 100%;
  border: 1px solid #484842;
  border-radius: 6px;
  padding: 10px 11px;
  color: #f1f1e9;
  background: #090909;
  outline: none;
}

.field input:focus {
  border-color: #aaa99f;
  box-shadow: 0 0 0 3px rgba(170, 169, 159, 0.14);
}

.primary-button,
.text-button {
  border: 1px solid #73736d;
  border-radius: 6px;
  color: #f1f1e9;
  background: #272727;
}

.primary-button {
  width: 100%;
  padding: 11px 12px;
}

.text-button {
  padding: 6px 8px;
  font-size: 12px;
}

.readouts {
  display: grid;
  gap: 10px;
  margin: 0;
}

.readouts div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.readouts dt {
  color: #aaa99f;
}

.readouts dd {
  margin: 0;
  color: #f1f1e9;
  text-align: right;
}

.event-log {
  display: grid;
  gap: 8px;
  max-height: 270px;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: auto;
}

.event-log li {
  border-left: 3px solid #787870;
  padding: 8px 9px;
  color: #e2e2d9;
  background: #0f0f0e;
  font-size: 12px;
  line-height: 1.45;
}

.event-log li.is-error {
  border-left-color: var(--danger);
  color: #ece6d8;
}

@media (max-width: 980px) {
  .workbench {
    grid-template-columns: 1fr;
  }

  .device-frame {
    min-height: auto;
  }
}

@media (max-width: 680px) {
  .simulator-shell {
    width: min(100vw - 18px, 1180px);
    padding-top: 14px;
  }

  .simulator-topline {
    display: grid;
    align-items: start;
  }

  .device-frame {
    padding: 34px 16px 22px;
  }

  .lcd-screen {
    min-height: 540px;
    padding: 14px;
  }

  .lcd-title {
    display: grid;
  }

  #artworkMeta {
    max-width: none;
    text-align: left;
  }

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

  .control-deck {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
