/* The physical station screen: 320 × 240 first, pointer input second. */
@font-face {
  font-family: "Golos Text";
  src: url("/fonts/golos-text.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
}

body.device-display {
  --device-font: "Golos Text", Arial, sans-serif;
  --device-ink: #fff5dc;
  --device-muted: #d8bdd5;
  --device-void: #100914;
  --device-panel: #1b1022;
  --device-panel-2: #27132a;
  --device-rule: #70426c;
  --device-cyan: #39fbf2;
  --device-lime: #dbff2b;
  --device-gold: #ffcf3f;
  --device-pink: #ff55c8;
  --device-red: #ff745c;
  min-block-size: 100dvh;
  margin: 0;
  overflow: hidden;
  background: var(--device-void);
}

body.device-display .masthead,
body.device-display .skip,
body.device-display .toast-region {
  display: none;
}

body.device-display #announce {
  clip-path: inset(50%);
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
}

body.device-display #main.workspace {
  display: grid;
  inline-size: 100%;
  min-block-size: 100dvh;
  margin: 0;
  padding: 0;
  max-inline-size: none;
  place-content: center;
  background:
    radial-gradient(circle at 50% 0%, #41153d 0, transparent 51%),
    var(--device-void);
}

#device-panel {
  inline-size: min(320px, 100vw);
  block-size: min(240px, 100dvh);
}

.device-panel,
.device-panel * {
  box-sizing: border-box;
}

.device-panel :is(h1, h2, h3, p, span, strong, b, button, output) {
  font-family: var(--device-font);
}

.device-panel {
  position: relative;
  display: grid;
  grid-template-areas:
    "top"
    "main"
    "notice"
    "footer";
  grid-template-rows: auto minmax(0, 1fr) auto 50px;
  inline-size: 320px;
  block-size: 240px;
  overflow: clip;
  border: 2px solid var(--device-pink);
  border-radius: 8px;
  background:
    linear-gradient(135deg, #ffffff08 25%, transparent 25%) 0 0 / 5px 5px,
    var(--device-panel);
  box-shadow: 4px 5px 0 #050306, 0 0 0 1px #ff55c844;
  color: var(--device-ink);
  font-family: var(--device-font);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: .01em;
  font-variant-numeric: tabular-nums;
  isolation: isolate;
}

.device-panel::after {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  content: "";
  opacity: .16;
  background: repeating-linear-gradient(0deg, transparent 0 3px, #000 3px 4px);
  mix-blend-mode: soft-light;
}

.device-top {
  grid-area: top;
  display: grid;
  grid-template-columns: minmax(0, 1fr) fit-content(34%);
  align-items: center;
  gap: 7px;
  min-inline-size: 0;
  padding: 2px 8px;
  border-block-end: 2px solid var(--device-gold);
  background: #100a16;
}

.device-title {
  position: relative;
  display: flex;
  align-items: center;
  min-block-size: 19px;
  padding-inline-start: 23px;
  color: var(--device-ink);
  font-family: var(--device-font);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.17;
  letter-spacing: .035em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.device-caption {
  color: var(--device-cyan);
  font-family: var(--device-font);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
  overflow-wrap: anywhere;
  text-align: end;
}

.device-caption:empty { display: none; }

.device-main {
  grid-area: main;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 4px;
  min-block-size: 0;
  padding: 5px 7px 4px;
}

.device-main.device-list {
  align-content: start;
  grid-template-rows: none;
  grid-auto-rows: min-content;
}

.device-panel[data-device-screen="generation"] .flavor-slots {
  inline-size: min(100%, 272px);
  justify-self: center;
  align-self: center;
}

.device-panel:is([data-device-screen="weigh"], [data-device-screen="manual"]) .device-main {
  align-content: start;
  grid-template-rows: auto auto auto 6px;
  gap: 5px;
  padding-block-start: 8px;
}

.device-ingredient {
  margin: 0;
  color: var(--device-ink);
  font-family: var(--device-font);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.device-delta, .device-filter-values {
  margin: 0;
  color: var(--device-cyan);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.device-filter-values { font-size: 12px; }
.device-panel[data-tone="danger"] .device-delta { color: var(--device-red); }

.device-scene-art { position: relative; inline-size: 56px; aspect-ratio: 1; align-self: center; justify-self: end; }
.device-meter .device-scene-art { grid-column: 3; grid-row: 1; }
.device-panel[data-device-screen="sync"] .device-scene-art { inline-size: 72px; justify-self: center; }

.device-header-art {
  position: absolute;
  inset: 50% auto auto 0;
  inline-size: 19px;
  block-size: 19px;
  transform: translateY(-50%);
}

.device-header-art > .deck-badge,
.device-header-art > .deck-strength-level,
.device-header-art .deck-strength-level > .deck-badge,
.device-scene-art > .deck-badge {
  display: block;
  inline-size: 100%;
  block-size: 100%;
}

.device-header-art .deck-strength-tag { display: none; }

.device-row b > .deck-badge {
  inline-size: 18px;
  block-size: 18px;
  margin-inline-end: 5px;
  vertical-align: -4px;
}

.device-panel[data-device-screen="menu"] .device-row > b {
  display: flex;
  align-items: center;
  gap: 6px;
}

.device-panel[data-device-screen="menu"] .device-row b > .deck-badge {
  inline-size: 24px;
  block-size: 24px;
  margin-inline-end: 0;
}

.device-copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-inline-size: 0;
  min-block-size: 24px;
  padding: 3px 5px;
  border: 1px solid var(--device-rule);
  border-inline-start: 4px solid var(--device-cyan);
  border-radius: 4px;
  background: #120d19;
  overflow-wrap: anywhere;
}

.device-copy > :not(.station-art) {
  min-inline-size: 0;
  color: var(--device-ink);
  font-size: 14px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.device-copy small,
.device-copy .muted {
  color: var(--device-muted);
  font-size: 11px;
  font-weight: 700;
}

.device-list {
  display: grid;
  align-content: start;
  gap: 3px;
  min-block-size: 0;
  overflow: hidden;
}

.device-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px;
  min-block-size: 28px;
  padding: 3px 5px 3px 3px;
  border: 1px solid #674e68;
  border-radius: 4px;
  background: #211323;
  color: var(--device-ink);
  font-size: 14px;
  font-weight: 750;
}

.device-row > :first-child {
  min-inline-size: 0;
  font-weight: inherit;
  overflow-wrap: anywhere;
}

.device-row > :nth-child(2) {
  max-inline-size: 114px;
  color: var(--device-cyan);
  font-family: var(--device-font);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.08;
  overflow-wrap: anywhere;
  text-align: end;
}

.device-row.is-selected,
.device-row[aria-selected="true"],
.device-row[data-selected="true"] {
  border-color: var(--device-lime);
  background: linear-gradient(90deg, #dfff2630, #25192a 76%);
  box-shadow: inset 3px 0 var(--device-lime), 0 0 0 1px #dfff2644;
  color: #fffde8;
}

.device-row[aria-disabled="true"],
.device-row[data-state="disabled"] {
  opacity: .48;
}

/* Last-resort layout chosen by the renderer only after it has measured the
   current selection. Keep the selected words legible instead of clipping them. */
.device-panel[data-dense-text] .device-row {
  grid-template-columns: 1fr;
  gap: 1px;
  padding-block: 3px;
  font-size: 13px;
  line-height: 1.05;
}

.device-panel[data-dense-text] .device-row > :nth-child(2) {
  justify-self: start;
  max-inline-size: none;
  font-size: 11px;
  text-align: start;
}

.device-panel[data-dense-text]:is([data-device-screen="weigh"], [data-device-screen="manual"]) .device-ingredient {
  grid-column: 1 / -1;
  font-size: 12px;
  line-height: 1.08;
}

.device-panel[data-dense-text]:is([data-device-screen="weigh"], [data-device-screen="manual"]) .device-main {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  gap: 4px;
  padding-block: 3px;
}

.device-panel[data-dense-text]:is([data-device-screen="weigh"], [data-device-screen="manual"]) .device-meter {
  min-block-size: 25px;
  gap: 5px;
  padding-inline: 0;
}

.device-panel[data-dense-text]:is([data-device-screen="weigh"], [data-device-screen="manual"]) .device-meter strong,
.device-panel[data-dense-text]:is([data-device-screen="weigh"], [data-device-screen="manual"]) .device-meter output {
  font-size: 27px;
}

.device-panel[data-dense-text] .device-meter + .device-delta {
  align-self: center;
  max-inline-size: 112px;
}

.device-panel[data-dense-text]:is([data-device-screen="weigh"], [data-device-screen="manual"]) .device-scene-art,
.device-panel[data-dense-text]:is([data-device-screen="weigh"], [data-device-screen="manual"]) .device-progress,
.device-panel[data-dense-text][data-device-screen="sync"] .device-scene-art {
  display: none;
}

.device-panel[data-dense-text] .device-main:has(> .device-copy) {
  align-content: start;
  grid-template-rows: none;
  grid-auto-rows: min-content;
}

.device-panel[data-dense-text] .device-copy,
.device-panel[data-dense-text] .device-notice {
  padding-block: 2px;
  font-size: 12px;
  line-height: 1.12;
}

.device-meter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 7px;
  min-block-size: 29px;
  padding: 2px 5px;
  border-block-start: 1px solid var(--device-rule);
}

.device-meter > span {
  color: var(--device-muted);
  font-size: 14px;
  font-weight: 700;
}

.device-meter strong,
.device-meter output {
  color: var(--device-gold);
  font-family: var(--device-font);
  font-size: 34px;
  font-weight: 850;
  line-height: 1.12;
  letter-spacing: -.07em;
  white-space: nowrap;
}

.device-meter [data-delta],
.device-meter .device-delta {
  color: var(--device-lime);
  font-family: var(--device-font);
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  overflow-wrap: anywhere;
}

.device-panel[data-tone="warn"] .device-copy { border-inline-start-color: var(--device-gold); }
.device-panel[data-tone="danger"] .device-copy { border-inline-start-color: var(--device-red); }
.device-panel[data-tone="danger"] .device-meter strong,
.device-panel[data-tone="danger"] .device-meter output,
.device-panel[data-tone="danger"] .device-meter [data-delta],
.device-panel[data-tone="danger"] .device-meter .device-delta { color: var(--device-red); }
.device-panel[data-tone="good"] .device-copy { border-inline-start-color: var(--device-lime); }
.device-panel[data-tone="offline"] .device-copy { border-inline-start-color: var(--device-pink); }

.device-progress {
  inline-size: 100%;
  block-size: 6px;
  overflow: hidden;
  border: 1px solid var(--device-rule);
  border-radius: 2px;
  background: #0b0710;
  accent-color: var(--device-cyan);
}

.device-progress::-webkit-progress-bar { background: #0b0710; }
.device-progress::-webkit-progress-value { background: var(--device-cyan); }
.device-panel[data-tone="danger"] .device-progress::-webkit-progress-value { background: var(--device-red); }

.device-notice {
  grid-area: notice;
  margin: 0 6px 4px;
  padding: 4px 6px;
  border: 1px solid var(--device-gold);
  border-radius: 4px;
  background: #261813;
  color: #fff3ca;
  font-size: 12px;
  line-height: 1.15;
  overflow-wrap: anywhere;
  box-shadow: 2px 2px 0 #050306;
}

.device-notice[hidden] { display: none; }

.device-pause {
  color: var(--device-pink);
  font-size: 12px;
  font-weight: 900;
}

.device-footer {
  grid-area: footer;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  border-block-start: 2px solid var(--device-gold);
  background: #100a16;
}

.device-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-inline-size: 0;
  padding: 1px 3px;
  border: 0;
  border-inline-end: 1px solid #5c3a5b;
  color: var(--device-muted);
  font-family: var(--device-font);
  text-align: center;
  text-decoration: none;
  user-select: none;
}

button.device-slot {
  appearance: none;
  cursor: pointer;
}

.device-slot:last-child { border-inline-end: 0; }

.device-slot[data-slot="A"] {
  grid-column: 1 / span 2;
  grid-row: 2;
}

.device-slot[data-slot="B"] {
  grid-column: 3 / span 2;
  grid-row: 2;
  border-inline-end: 0;
}

.device-slot > :first-child {
  flex: none;
  color: var(--device-cyan);
  font-family: var(--device-font);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.device-slot > :last-child:not(:first-child) {
  color: var(--device-ink);
  font-family: var(--device-font);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.05;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.device-slot[data-slot="A"] > :last-child:not(:first-child),
.device-slot[data-slot="B"] > :last-child:not(:first-child) {
  font-size: 11px;
  font-weight: 750;
}

.device-slot[data-slot="A"],
.device-slot[data-slot="B"] { background: #271327; }
.device-slot[data-slot="A"] > :first-child { color: var(--device-lime); }
.device-slot[data-slot="B"] > :first-child { color: var(--device-pink); }
.device-slot[data-state="active"],
.device-slot[aria-pressed="true"] { background: #dfff2630; box-shadow: inset 0 -3px var(--device-lime); }
.device-slot[data-state="disabled"],
.device-slot[aria-disabled="true"] { opacity: .42; }

.device-slot:focus-visible,
.device-row:focus-visible {
  position: relative;
  z-index: 7;
  outline: 2px solid var(--device-gold);
  outline-offset: -2px;
}

@media (hover: hover) {
  .device-slot:is(button, a) { cursor: pointer; }
  .device-slot:is(button, a):hover { background: #ff55c82b; }
}

.device-slot:is(button, a):active {
  color: #120914;
  background: var(--device-gold);
  box-shadow: inset 0 2px #5c3a0a;
  transform: translateY(1px);
}

.device-shortcuts {
  display: none;
}

@media (min-width: 520px) and (min-height: 360px) {
  body.device-display #main.workspace {
    grid-template-columns: 320px minmax(180px, 250px);
    gap: 24px;
    place-content: center;
  }

  .device-shortcuts {
    display: grid;
    gap: 9px;
    max-inline-size: 250px;
    padding: 16px;
    border: 1px solid #70426c;
    border-radius: 10px;
    background: #1b1022;
    color: var(--device-ink);
    box-shadow: 4px 5px 0 #050306;
    font: 700 14px/1.35 "Golos Text", Arial, sans-serif;
  }

  .device-shortcuts kbd {
    display: inline-grid;
    min-inline-size: 1.7em;
    padding: .12em .35em;
    border: 1px solid var(--device-cyan);
    border-radius: 3px;
    color: var(--device-cyan);
    font: 800 .86em/1 "Golos Text", Arial, sans-serif;
    text-align: center;
  }
}

@media (max-width: 320px), (max-height: 240px) {
  body.device-display #main.workspace { place-content: start center; }
  .device-panel { border-radius: 0; box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  .device-panel *, .device-panel::after { animation: none !important; transition: none !important; }
}
