:root {
  color-scheme: dark;
  background: #0e172c;
  color: #fff3da;
  font-family: system-ui, sans-serif;
  --panel: #172644;
  --accent: #e9ff60;
}
* { box-sizing: border-box; }
body { margin: 0; }
main { width: min(100% - 24px, 1080px); margin: auto; padding: 12px 0 26px; }
header, .launcher, .launcher > div, #cabinet { display: flex; gap: 10px; align-items: center; }
header { justify-content: space-between; flex-wrap: wrap; }
h1 { margin: 0; font-size: clamp(1.35rem, 4vw, 2.2rem); }
a { color: var(--accent); }
.launcher { flex-wrap: wrap; margin-top: 12px; padding: 10px; border-radius: 8px; background: var(--panel); }
.launcher > div { flex-wrap: wrap; }
.launcher p { margin: 0; flex-basis: 100%; }
button, select, input { font: inherit; max-width: 100%; }
button, select {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid #7a8bb2;
  background: var(--panel);
  color: inherit;
  padding: 4px 10px;
}
button { cursor: pointer; }
.primary, .pad button[data-held] { background: var(--accent); color: #0e172c; font-weight: bold; }
button:focus-visible, a:focus-visible, #screen:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#status, .launcher p, .notes, footer { font-size: .9rem; color: #d3def3; }
#status { min-height: 1.2em; }
#cabinet { flex-direction: column; }
#screen {
  width: 100%;
  height: clamp(210px, 56svh, 580px);
  display: grid;
  place-items: center;
  background: #070c17;
  border: 1px solid #465a82;
  border-radius: 8px;
  overflow: hidden;
}
#poster { display: grid; text-align: center; gap: 5px; }
#poster strong { font-size: 1.6rem; }
.pad { display: flex; gap: 14px; justify-content: space-between; width: min(100%, 510px); }
.pad[hidden] { display: none; }
.direction, .actions { display: grid; gap: 5px; }
.direction { grid-template: auto auto / repeat(3, 1fr); }
.direction button:first-child { grid-column: 2; }
.direction button:nth-child(2) { grid-column: 1; }
.actions { grid-template-columns: repeat(2, 1fr); }
.pad button { min-width: 43px; min-height: 42px; padding: 2px 4px; touch-action: none; user-select: none; }
@media (orientation: landscape) and (max-height: 540px) {
  #cabinet:has(.pad:not([hidden])) { flex-direction: row; }
  #screen { height: max(220px, calc(100svh - 64px)); }
  .pad { width: auto; flex: none; }
  .pad button { min-width: 38px; }
  main:has(.pad:not([hidden])) .launcher { margin-top: 6px; }
}

#cabinet { position: relative; }
#cabinet[hidden], .launch-card[hidden] { display: none; }
.launch-card { text-align: center; padding: 20px; background: var(--panel); border-radius: 10px; }
.launch-card img { width: min(100%, 540px); max-height: 46svh; object-fit: contain; image-rendering: pixelated; }
#fullscreen { align-self: flex-end; }
#cabinet:fullscreen, #cabinet.expanded {
  padding: 10px 12px;
  background: #070c17;
  flex-direction: column;
}
#cabinet.expanded { position: fixed; inset: 0; z-index: 100; overflow: auto; }
#cabinet:fullscreen #screen, #cabinet.expanded #screen { flex: 1; min-height: 0; height: auto; }
@media (orientation: landscape) and (max-height: 540px) {
  #cabinet:has(.pad:not([hidden])) { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  #cabinet:has(.pad:not([hidden])) #fullscreen { grid-column: 1 / -1; justify-self: end; }
  #cabinet:fullscreen, #cabinet.expanded { grid-template-rows: auto minmax(0, 1fr); }
  #cabinet:fullscreen #screen, #cabinet.expanded #screen { height: 100%; }
}
