:root {
  --ps-bg: #090a0c;
  --ps-machine: #202226;
  --ps-panel: #15171a;
  --ps-panel-2: #292c31;
  --ps-line: #454950;
  --ps-text: #f4f2e9;
  --ps-muted: #9b9da2;
  --ps-green: #8cff6b;
  --ps-cyan: #5ce4e4;
  --ps-yellow: #ffe04b;
  --ps-pink: #ff3d79;
  --ps-red: #ff5a4f;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--ps-bg);
  letter-spacing: 0;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(#0c0d0f 1px, transparent 1px),
    linear-gradient(90deg, #0c0d0f 1px, transparent 1px),
    var(--ps-bg);
  background-size: 28px 28px;
  color: var(--ps-text);
  font-family: Arial, "Helvetica Neue", sans-serif;
}

button,
input {
  font: inherit;
}

button,
label {
  -webkit-tap-highlight-color: transparent;
}

.ps-topbar {
  display: grid;
  min-height: 58px;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: stretch;
  border-bottom: 1px solid #2e3034;
  background: #0c0d0f;
}

.ps-topbar a {
  color: var(--ps-text);
  text-decoration: none;
}

.ps-topbar__back {
  display: grid;
  place-items: center;
  border-right: 1px solid #2e3034;
  font-size: 30px;
}

.ps-topbar__logo {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
}

.ps-topbar__logo img {
  width: 112px;
  height: auto;
}

.ps-topbar__logo span {
  color: var(--ps-pink);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 900;
}

.ps-topbar__nav {
  display: flex;
  align-items: stretch;
}

.ps-topbar__nav a {
  display: grid;
  min-width: 108px;
  place-items: center;
  border-left: 1px solid #2e3034;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 800;
}

.ps-topbar__nav a:hover,
.ps-topbar__nav a:focus-visible,
.ps-topbar__back:hover,
.ps-topbar__back:focus-visible {
  color: var(--ps-cyan);
  outline: 0;
}

.ps-shell {
  width: min(1380px, calc(100% - 36px));
  margin: 0 auto;
  padding: 32px 0 52px;
}

.ps-machine {
  overflow: hidden;
  border: 1px solid #555960;
  background: var(--ps-machine);
  box-shadow: 0 22px 70px rgb(0 0 0 / 44%);
}

.ps-machine__head {
  display: flex;
  min-height: 102px;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--ps-line);
  padding: 19px 24px 18px;
  background: #292b30;
}

.ps-machine__head p {
  margin: 0 0 6px;
  color: var(--ps-cyan);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  font-weight: 800;
}

.ps-machine__head h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 58px);
  line-height: 0.88;
}

.ps-machine__meter {
  position: relative;
  overflow: hidden;
  width: min(320px, 34vw);
  height: 16px;
  border: 1px solid #0b0c0e;
  background:
    repeating-linear-gradient(90deg, transparent 0 9px, #101114 9px 12px),
    linear-gradient(90deg, var(--ps-green) 0 68%, var(--ps-yellow) 68% 86%, var(--ps-red) 86%);
}

.ps-machine__meter span {
  position: absolute;
  inset: 0;
  background: #101114;
  transform: translateX(0);
  transition: transform 80ms linear;
}

.ps-layout {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
}

.ps-controls {
  min-width: 0;
  border-right: 1px solid var(--ps-line);
  background: #181a1e;
}

.ps-display {
  display: grid;
  min-height: 112px;
  grid-template-columns: 86px minmax(0, 1fr);
  align-items: center;
  border-bottom: 1px solid var(--ps-line);
  background: #07130e;
  color: var(--ps-green);
}

.ps-display__number {
  display: grid;
  min-height: 112px;
  place-items: center;
  border-right: 1px solid #25412d;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 43px;
  font-weight: 900;
}

.ps-display__copy {
  min-width: 0;
  padding: 14px;
}

.ps-display__copy small,
.ps-display__copy span {
  display: block;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  font-weight: 800;
}

.ps-display__copy strong {
  display: block;
  overflow: hidden;
  margin: 7px 0;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 18px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ps-display__copy span {
  color: #6eaa7d;
}

.ps-load,
.ps-pad-setup,
.ps-master {
  border-bottom: 1px solid var(--ps-line);
  padding: 15px;
}

.ps-section-head,
.ps-performance__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 11px;
}

.ps-section-head h2,
.ps-performance__head h2 {
  margin: 0;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.ps-section-head span,
.ps-performance__head span {
  color: var(--ps-muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 8px;
  font-weight: 800;
}

.ps-load__buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.ps-auto-assign {
  display: grid;
  min-height: 38px;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  margin-top: 7px;
  border: 1px solid var(--ps-line);
  padding: 0 10px;
  color: var(--ps-text);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 8px;
  font-weight: 800;
  cursor: pointer;
}

.ps-auto-assign span {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ps-auto-assign small {
  overflow: hidden;
  color: var(--ps-muted);
  font-size: 7px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ps-auto-assign input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--ps-pink);
}

.ps-auto-assign strong {
  min-width: 18px;
  color: var(--ps-green);
  font-size: 9px;
  text-align: right;
}

.ps-auto-assign:has(input:not(:checked)) strong {
  color: var(--ps-muted);
}

.ps-action,
.ps-mode button,
.ps-fx-grid button,
.ps-performance__head button {
  min-height: 38px;
  border: 1px solid #555a62;
  border-radius: 1px;
  background: var(--ps-panel-2);
  color: var(--ps-text);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  font-weight: 900;
  cursor: pointer;
}

.ps-action {
  display: grid;
  position: relative;
  place-items: center;
}

.ps-action input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.ps-action--load {
  border-color: var(--ps-cyan);
  color: var(--ps-cyan);
}

.ps-action--clear {
  width: 100%;
  margin-top: 7px;
  color: #b8bac0;
}

.ps-action:hover,
.ps-action:focus-within,
.ps-action:focus-visible,
.ps-mode button:hover,
.ps-mode button:focus-visible,
.ps-fx-grid button:hover,
.ps-fx-grid button:focus-visible,
.ps-performance__head button:hover,
.ps-performance__head button:focus-visible {
  border-color: var(--ps-cyan);
  color: var(--ps-cyan);
  outline: 0;
}

.ps-mode {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin-bottom: 14px;
}

.ps-mode button.is-active,
.ps-fx-grid button.is-active {
  border-color: var(--ps-yellow);
  background: var(--ps-yellow);
  color: #141518;
}

.ps-slider {
  display: block;
  margin-top: 11px;
}

.ps-slider span {
  display: flex;
  justify-content: space-between;
  color: #b7b9be;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  font-weight: 800;
}

.ps-slider output {
  color: var(--ps-cyan);
}

.ps-slider input {
  width: 100%;
  margin: 9px 0 0;
  accent-color: var(--ps-pink);
}

.ps-fx-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.ps-fx-grid button {
  display: flex;
  min-height: 49px;
  align-items: center;
  justify-content: space-between;
  padding: 0 11px;
}

.ps-fx-grid small {
  color: var(--ps-pink);
  font-size: 8px;
}

.ps-fx-grid button.is-active small {
  color: #141518;
}

.ps-status {
  min-height: 52px;
  margin: 0;
  padding: 12px 15px;
  color: #aeb0b5;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
}

.ps-performance {
  min-width: 0;
  padding: 20px;
  background:
    radial-gradient(circle at 88% 12%, rgb(92 228 228 / 8%), transparent 28%),
    #222429;
}

.ps-performance__head {
  min-height: 40px;
  margin-bottom: 14px;
}

.ps-performance__head > div {
  display: grid;
  gap: 4px;
}

.ps-performance__head button {
  min-width: 108px;
  color: var(--ps-red);
}

.ps-pad-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(7px, 1.2vw, 14px);
}

.ps-pad {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 1.12 / 1;
  border: 1px solid #555a61;
  border-bottom-width: 5px;
  border-radius: 3px;
  background:
    linear-gradient(145deg, #41454c, #25282d 65%);
  color: var(--ps-text);
  cursor: pointer;
  touch-action: manipulation;
}

.ps-pad::after {
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  content: "";
  pointer-events: none;
}

.ps-pad.is-selected::after {
  border-color: var(--pad-color);
}

.ps-pad.is-loaded {
  border-top-color: var(--pad-color);
}

.ps-pad.is-playing {
  border-bottom-width: 1px;
  background: var(--pad-color);
  color: #111216;
  transform: translateY(4px);
}

.ps-pad.is-looping {
  box-shadow: 0 0 0 2px var(--ps-yellow), 0 0 22px rgb(255 224 75 / 28%);
}

.ps-pad.is-drop-target {
  border-color: var(--ps-cyan);
  background: #153538;
}

.ps-pad__key,
.ps-pad__number,
.ps-pad__mode,
.ps-pad__name {
  position: absolute;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-weight: 900;
}

.ps-pad__key {
  top: 10px;
  left: 11px;
  color: var(--pad-color);
  font-size: clamp(12px, 1.5vw, 20px);
}

.ps-pad.is-playing .ps-pad__key {
  color: #111216;
}

.ps-pad__number {
  top: 10px;
  right: 11px;
  color: #a7a9ad;
  font-size: 9px;
}

.ps-pad__mode {
  right: 11px;
  bottom: 10px;
  color: #85888d;
  font-size: 8px;
}

.ps-pad__name {
  right: 11px;
  bottom: 10px;
  left: 11px;
  overflow: hidden;
  max-width: calc(100% - 52px);
  font-size: clamp(9px, 1.1vw, 13px);
  text-align: left;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ps-pad:not(.is-loaded) .ps-pad__name {
  color: #777a80;
}

.ps-pad.is-playing .ps-pad__number,
.ps-pad.is-playing .ps-pad__mode,
.ps-pad.is-playing .ps-pad__name {
  color: #111216;
}

.ps-footer {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid #2c2e32;
  padding: 0 max(18px, calc((100% - 1380px) / 2));
  background: #0b0c0e;
  color: #74777d;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 8px;
  font-weight: 800;
}

.ps-footer nav {
  display: flex;
  gap: 18px;
}

.ps-footer a {
  color: var(--ps-cyan);
  text-decoration: none;
}

html.lab-screenshot-mode body {
  overflow: hidden;
}

html.lab-screenshot-mode .ps-topbar,
html.lab-screenshot-mode .ps-footer {
  display: none;
}

html.lab-screenshot-mode .ps-shell {
  width: min(1180px, calc(100% - 20px));
  padding: 10px 0;
}

html.lab-screenshot-mode .ps-machine__head {
  min-height: 66px;
  padding: 10px 16px;
}

html.lab-screenshot-mode .ps-machine__head h1 {
  font-size: 36px;
}

html.lab-screenshot-mode .ps-machine__head p {
  margin-bottom: 3px;
  font-size: 7px;
}

html.lab-screenshot-mode .ps-layout {
  grid-template-columns: 300px minmax(0, 1fr);
}

html.lab-screenshot-mode .ps-display,
html.lab-screenshot-mode .ps-display__number {
  min-height: 74px;
}

html.lab-screenshot-mode .ps-display {
  grid-template-columns: 68px minmax(0, 1fr);
}

html.lab-screenshot-mode .ps-display__number {
  font-size: 32px;
}

html.lab-screenshot-mode .ps-display__copy {
  padding: 9px 11px;
}

html.lab-screenshot-mode .ps-display__copy strong {
  margin: 4px 0;
  font-size: 14px;
}

html.lab-screenshot-mode .ps-load,
html.lab-screenshot-mode .ps-pad-setup,
html.lab-screenshot-mode .ps-master {
  padding: 9px 11px;
}

html.lab-screenshot-mode .ps-section-head {
  margin-bottom: 6px;
}

html.lab-screenshot-mode .ps-action,
html.lab-screenshot-mode .ps-mode button {
  min-height: 28px;
  font-size: 7px;
}

html.lab-screenshot-mode .ps-action--clear {
  margin-top: 5px;
}

html.lab-screenshot-mode .ps-mode {
  gap: 4px;
  margin-bottom: 7px;
}

html.lab-screenshot-mode .ps-slider {
  margin-top: 6px;
}

html.lab-screenshot-mode .ps-slider input {
  margin-top: 4px;
}

html.lab-screenshot-mode .ps-fx-grid {
  gap: 5px;
}

html.lab-screenshot-mode .ps-fx-grid button {
  min-height: 34px;
  font-size: 7px;
}

html.lab-screenshot-mode .ps-status {
  display: none;
}

html.lab-screenshot-mode .ps-performance {
  padding: 11px;
}

html.lab-screenshot-mode .ps-performance__head {
  min-height: 28px;
  margin-bottom: 7px;
}

html.lab-screenshot-mode .ps-performance__head button {
  min-height: 30px;
}

html.lab-screenshot-mode .ps-pad-grid {
  gap: 7px;
}

html.lab-screenshot-mode .ps-pad {
  aspect-ratio: 1.72 / 1;
  border-bottom-width: 3px;
}

html.lab-screenshot-mode .ps-pad__key {
  top: 7px;
  left: 8px;
  font-size: 13px;
}

html.lab-screenshot-mode .ps-pad__number {
  top: 7px;
  right: 8px;
  font-size: 7px;
}

html.lab-screenshot-mode .ps-pad__name {
  right: 8px;
  bottom: 7px;
  left: 8px;
  font-size: 9px;
}

html.lab-screenshot-mode .ps-pad__mode {
  right: 8px;
  bottom: 7px;
  font-size: 6px;
}

@media (max-width: 900px) {
  .ps-layout {
    grid-template-columns: 1fr;
  }

  .ps-controls {
    border-right: 0;
    border-bottom: 1px solid var(--ps-line);
  }

  .ps-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ps-display,
  .ps-status {
    grid-column: 1 / -1;
  }

  .ps-load,
  .ps-pad-setup {
    border-right: 1px solid var(--ps-line);
  }
}

@media (max-width: 640px) {
  .ps-topbar {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .ps-topbar__nav {
    display: none;
  }

  .ps-shell {
    width: min(100% - 16px, 1380px);
    padding: 12px 0 32px;
  }

  .ps-machine__head {
    min-height: 84px;
    padding: 15px;
  }

  .ps-machine__head h1 {
    font-size: 30px;
  }

  .ps-machine__meter {
    width: 92px;
  }

  .ps-controls {
    display: block;
  }

  .ps-load,
  .ps-pad-setup {
    border-right: 0;
  }

  .ps-performance {
    padding: 10px;
  }

  .ps-pad-grid {
    gap: 6px;
  }

  .ps-pad {
    border-bottom-width: 3px;
  }

  .ps-pad__key {
    top: 7px;
    left: 7px;
    font-size: 12px;
  }

  .ps-pad__number {
    top: 7px;
    right: 7px;
    font-size: 7px;
  }

  .ps-pad__name {
    right: 7px;
    bottom: 7px;
    left: 7px;
    max-width: calc(100% - 38px);
    font-size: 8px;
  }

  .ps-pad__mode {
    right: 7px;
    bottom: 7px;
    font-size: 6px;
  }
}

@media (max-width: 390px) {
  .ps-machine__meter {
    display: none;
  }

  .ps-performance__head button {
    min-width: 88px;
    padding-inline: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ps-pad,
  .ps-machine__meter span {
    transition: none;
  }
}
