@font-face {
  font-family: "Chivo Mono";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/chivo-mono-latin.woff2") format("woff2");
}

/*
 * CS2 Crosshair Studio, classic skin: the Steam client as Valve shipped it in
 * 2003 — olive panels, one-pixel bevels (light on the top and left edges of a
 * raised part, dark on the bottom and right, swapped for a sunken one), square
 * corners, Tahoma at 11px, yellow headings. Nothing here reads the portfolio's
 * tokens, and nothing in the portfolio reads these.
 */

:root {
  --font-ui: Tahoma, Verdana, "Segoe UI", sans-serif;
  --font-mono: "Chivo Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --olive: #4c5844;        /* window and button face */
  --olive-dark: #3e4637;   /* fields, lists, wells */
  --olive-light: #5a6a50;  /* scrollbar thumb, hover face */
  --edge-light: #8c9284;   /* the lit edge of a bevel */
  --edge-dark: #292c21;    /* the shadowed edge of a bevel */
  --text: #dee5d7;
  --text-muted: #a0aa95;
  --text-disabled: #75806f;
  --yellow: #c4b550;
  --highlight: #958831;    /* a selected menu row */

  --dur: 120ms;

  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: var(--olive);
  color: var(--text);
  font: 11px/15px var(--font-ui);
  -webkit-font-smoothing: none;
  -webkit-tap-highlight-color: transparent;
}

button,
input,
textarea,
output {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 1px dotted var(--text);
  outline-offset: -4px;
}

/* ---------- Bevels ---------- */
/* Every raised and sunken part is one of these two. */

.key,
.select-trigger,
.scrub-thumb,
.switch,
.tab,
.window {
  border: 1px solid;
  border-color: var(--edge-light) var(--edge-dark) var(--edge-dark) var(--edge-light);
}

.lcd,
.panel-scroll,
.scrub-value,
.well-input,
.swatch,
.bezel {
  border: 1px solid;
  border-color: var(--edge-dark) var(--edge-light) var(--edge-light) var(--edge-dark);
}

/* ---------- Window ---------- */

.window {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--olive);
}

.device {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(0, 1fr) clamp(230px, 36%, 340px);
  gap: 10px;
  min-height: 0;
  padding: 10px;
}

.deck,
.panel {
  min-width: 0;
  min-height: 0;
}

.deck {
  display: flex;
  flex-direction: column;
  gap: 8px;
  container-type: inline-size;
}

.deck-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

/* Section headings are the client's yellow capitals ("MY GAMES"). */
.brand-name,
.group-title,
.lcd-label {
  color: var(--yellow);
  font: 11px/1 var(--font-ui);
  letter-spacing: 0;
  text-transform: uppercase;
}

.led {
  width: 6px;
  height: 6px;
  background: var(--edge-dark);
}

.led[data-on] {
  background: var(--yellow);
}

.deck-controls {
  display: flex;
  gap: 6px;
  min-width: 0;
}

/* ---------- Screen ---------- */

.bezel {
  position: relative;
  flex: 1;
  min-height: 0;
  background: var(--edge-dark);
}

.screen {
  position: relative;
  height: 100%;
  overflow: hidden;
  background: #000;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

/* A map that is not the one on screen waits blurred, and the one on screen is
   blurred while the next is loading. */
.screen-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  filter: blur(14px);
  scale: 1.06;
  pointer-events: none;
  -webkit-user-drag: none;
  transition: opacity 200ms linear, filter 200ms linear, scale 200ms linear;
}

.screen-map[data-shown] {
  opacity: 1;
  filter: none;
  scale: 1;
}

.screen[data-loading] .screen-map[data-shown] {
  filter: blur(14px);
  scale: 1.06;
}

.screen[data-loading] .loupe-canvas {
  filter: blur(3px);
}

@media (prefers-reduced-motion: reduce) {
  .screen-map {
    transition: none;
  }
}

.screen-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.screen-glass {
  display: none;
}

.loupe {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 2px;
  background: var(--olive);
  border: 1px solid;
  border-color: var(--edge-light) var(--edge-dark) var(--edge-dark) var(--edge-light);
  pointer-events: none;
}

.loupe-canvas {
  display: block;
  border: 1px solid;
  border-color: var(--edge-dark) var(--edge-light) var(--edge-light) var(--edge-dark);
  image-rendering: pixelated;
}

.loupe-tag {
  position: absolute;
  right: 4px;
  bottom: 4px;
  padding: 0 4px;
  background: var(--olive);
  color: var(--text);
  font: 11px/1.5 var(--font-ui);
}

.screen-tag,
.screen-hint,
.toast {
  position: absolute;
  margin: 0;
  padding: 2px 6px;
  background: var(--olive);
  border: 1px solid;
  border-color: var(--edge-light) var(--edge-dark) var(--edge-dark) var(--edge-light);
  color: var(--text);
  font: 11px/1.4 var(--font-ui);
  pointer-events: none;
}

.screen-tag {
  left: 8px;
  bottom: 8px;
}

.screen-hint {
  right: 8px;
  bottom: 8px;
}

.screen[data-firing] .screen-hint {
  visibility: hidden;
}

.toast {
  left: 10px;
  top: 10px;
  max-width: calc(100% - 190px);
  color: var(--yellow);
  visibility: hidden;
}

.toast[data-shown] {
  visibility: visible;
}

/* ---------- Strip under the screen ---------- */

.strip {
  display: flex;
  align-items: stretch;
  gap: 6px;
  min-width: 0;
}

.lcd {
  background: var(--olive-dark);
}

.code-lcd {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 2px 6px;
}

.lcd-label {
  font-size: 9px;
}

.lcd-code {
  overflow: hidden;
  font: 11px/15px var(--font-mono);
  text-overflow: ellipsis;
  white-space: nowrap;
  -webkit-user-select: all;
  user-select: all;
}

/* ---------- Buttons ---------- */

.key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 24px;
  padding: 0 12px;
  border-radius: 0;
  background: var(--olive);
  color: var(--text);
  white-space: nowrap;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

@media (hover: hover) {
  .key:hover {
    background: var(--olive-light);
  }
}

.key:active,
.key[data-pressed] {
  border-color: var(--edge-dark) var(--edge-light) var(--edge-light) var(--edge-dark);
}

.key:active > * {
  transform: translate(1px, 1px);
}

/* The one button that matters most wears the client's default-button frame:
   a dark line around the raised face. */
.key-accent {
  /* Inside the bevel, so the default button is the same size as the rest. */
  outline: 1px solid var(--edge-dark);
  outline-offset: -2px;
  color: var(--yellow);
}

.key-icon {
  width: 26px;
  padding: 0;
}

.key-icon svg {
  width: 14px;
  height: 14px;
}

.key[aria-pressed="false"] .mute,
.key[aria-pressed="true"] .wave {
  display: inline;
}
.key[aria-pressed="true"] .mute,
.key[aria-pressed="false"] .wave {
  display: none;
}

/* ---------- Panel ---------- */

.panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.panel-head {
  display: flex;
  gap: 4px;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 0;
}

/* Like the client's top menu: every tab is its own raised button, and the
   open one is drawn pressed in, like any other held button. */
.tab {
  position: relative;
  min-height: 22px;
  padding: 0 12px;
  background: var(--olive);
  color: var(--text);
  cursor: pointer;
  transition: color var(--dur) ease-out, background-color var(--dur) ease-out;
}

.tab[aria-selected="true"],
.tab:active {
  border-color: var(--edge-dark) var(--edge-light) var(--edge-light) var(--edge-dark);
}

.tab[aria-selected="true"],
.tab:active {
  padding: 0 11px 2px 13px;
}

@media (hover: hover) {
  .tab:hover {
    color: var(--text);
  }
}

.panel-scroll {
  flex: 1;
  min-height: 0;
  padding: 4px 8px 8px;
  overflow-x: hidden;
  overflow-y: scroll;
  overscroll-behavior: contain;
  background: var(--olive-dark);
}

/* The client's scrollbar: a raised thumb in an olive track, with arrows. */
.panel-scroll::-webkit-scrollbar,
.select-menu::-webkit-scrollbar {
  width: 16px;
}
.panel-scroll::-webkit-scrollbar-track,
.select-menu::-webkit-scrollbar-track {
  background: var(--olive);
}
.panel-scroll::-webkit-scrollbar-thumb,
.select-menu::-webkit-scrollbar-thumb {
  background: var(--olive-light);
  border: 1px solid;
  border-color: var(--edge-light) var(--edge-dark) var(--edge-dark) var(--edge-light);
}
.panel-scroll::-webkit-scrollbar-button:single-button,
.select-menu::-webkit-scrollbar-button:single-button {
  display: block;
  height: 16px;
  background-color: var(--olive);
  background-repeat: no-repeat;
  background-position: center;
  border: 1px solid;
  border-color: var(--edge-light) var(--edge-dark) var(--edge-dark) var(--edge-light);
}
.panel-scroll::-webkit-scrollbar-button:single-button:vertical:decrement,
.select-menu::-webkit-scrollbar-button:single-button:vertical:decrement {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='4'%3E%3Cpath d='M0 4h7L3.5 0z' fill='%23a0aa95'/%3E%3C/svg%3E");
}
.panel-scroll::-webkit-scrollbar-button:single-button:vertical:increment,
.select-menu::-webkit-scrollbar-button:single-button:vertical:increment {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='4'%3E%3Cpath d='M0 0h7L3.5 4z' fill='%23a0aa95'/%3E%3C/svg%3E");
}
@supports not selector(::-webkit-scrollbar) {
  .panel-scroll,
  .select-menu {
    scrollbar-color: var(--olive-light) var(--olive);
  }
}

.group {
  margin: 0;
  padding: 8px 0 10px;
  border: 0;
  min-width: 0;
}

/* An etched separator: a dark line over a light one. */
.group + .group {
  border-top: 1px solid var(--edge-dark);
  box-shadow: inset 0 1px 0 rgb(140 146 132 / 0.45);
}

.group[disabled] {
  color: var(--text-disabled);
}

.group[disabled] .group-title {
  color: var(--text-disabled);
}

.group-title {
  float: left;
  width: 100%;
  margin-bottom: 6px;
  padding: 0;
}

.group-title + * {
  clear: both;
}

.group-unit {
  float: right;
  color: var(--text-muted);
  text-transform: none;
}

.group-sub {
  display: grid;
  margin-top: 4px;
}

.group-sub[hidden] {
  display: none;
}

.note {
  margin: 6px 0 0;
  color: var(--text-muted);
}

.note:empty {
  display: none;
}

/* ---------- Trackbar ---------- */

.scrub {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 6px;
  padding: 3px 0;
}

.scrub-readout {
  display: flex;
  align-items: center;
  gap: 2px;
}

.scrub-step {
  width: 18px;
  min-height: 18px;
  padding: 0;
  font: 700 11px/1 var(--font-ui);
}

.scrub-value {
  width: 44px;
  height: 18px;
  padding: 0 4px;
  background: var(--olive-dark);
  color: var(--text);
  font: 11px/16px var(--font-ui);
  text-align: right;
  cursor: ew-resize;
}

.scrub-value:focus {
  cursor: text;
  outline: none;
  background: var(--edge-dark);
}

.scrub-track {
  --t: 0;
  --thumb: 10px;
  --track: 18px;
  position: relative;
  grid-column: 1 / -1;
  height: var(--track);
  cursor: pointer;
  touch-action: none;
}

/* The groove: a sunken line two pixels tall. */
.scrub-track::before {
  content: "";
  position: absolute;
  top: calc(var(--track) / 2 - 1px);
  left: 0;
  right: 0;
  height: 4px;
  border: 1px solid;
  border-color: var(--edge-dark) var(--edge-light) var(--edge-light) var(--edge-dark);
  background: var(--edge-dark);
}

.scrub-fill {
  position: absolute;
  top: calc(var(--track) / 2);
  left: 1px;
  height: 2px;
  width: calc(var(--t) * (100% - var(--thumb)));
  background: var(--fill, var(--yellow));
}

.scrub[data-tint="red"] { --fill: #c45050; }
.scrub[data-tint="green"] { --fill: #6fae4f; }
.scrub[data-tint="blue"] { --fill: #5a78c4; }

/* The thumb: a small raised block with a point at the bottom, as Windows of
   the time drew it, reduced to a rectangle. */
.scrub-thumb {
  position: absolute;
  top: 2px;
  left: calc(var(--t) * (100% - var(--thumb)));
  width: var(--thumb);
  height: calc(var(--track) - 2px);
  background: var(--olive);
}

@media (hover: hover) {
  .scrub-track:hover .scrub-thumb {
    background: var(--olive-light);
  }
}

.scrub-track[data-dragging] .scrub-thumb {
  background: var(--olive-light);
}

/* ---------- Dropdown ---------- */

.select {
  min-width: 0;
}

.select-wide {
  flex: 1;
}

/* A sunken field holding the value, with a raised arrow box at its end. */
.select-trigger {
  justify-content: space-between;
  width: 100%;
  min-width: 0;
  padding: 0 0 0 6px;
  border-color: var(--edge-dark) var(--edge-light) var(--edge-light) var(--edge-dark);
  background: var(--olive-dark);
}

@media (hover: hover) {
  .select-trigger:hover {
    background: var(--olive-dark);
  }
}

.select-trigger:active {
  border-color: var(--edge-dark) var(--edge-light) var(--edge-light) var(--edge-dark);
}

.select-trigger:active > * {
  transform: none;
}

.deck-controls .select-trigger {
  min-width: 96px;
}

@container (max-width: 520px) {
  .deck-bar {
    flex-wrap: wrap;
    row-gap: 6px;
  }
  .brand,
  .deck-controls {
    width: 100%;
  }
  .deck-controls .select {
    flex: 1;
  }
}

.select-value {
  overflow: hidden;
  text-overflow: ellipsis;
}

.select-chevron {
  flex: none;
  align-self: stretch;
  width: 18px;
  height: auto;
  padding: 0 3px;
  background: var(--olive);
  border-left: 1px solid var(--edge-light);
  box-shadow: inset -1px -1px 0 var(--edge-dark);
  color: var(--text-muted);
}

.select-chevron path {
  fill: currentColor;
  stroke: none;
  d: path("M3 4.5h6L6 8z");
}

/* An open list points its caret up. The caret is turned over about its own
   middle (Safari does not know the "d" property, so the shape cannot be
   swapped for an upward one). The two engines draw the triangle at slightly
   different heights, so the middle differs. */
.select-trigger[aria-expanded="true"] .select-chevron path {
  transform: rotate(180deg);
  transform-box: view-box;
  transform-origin: 6px 6px;
}

@supports (d: path("M0 0")) {
  .select-trigger[aria-expanded="true"] .select-chevron path {
    transform-origin: 6px 6.25px;
  }
}

.select-menu {
  position: fixed;
  inset: auto;
  margin: 0;
  max-height: min(280px, calc(100vh - 16px));
  padding: 1px;
  overflow-y: auto;
  border: 1px solid;
  border-color: var(--edge-light) var(--edge-dark) var(--edge-dark) var(--edge-light);
  border-radius: 0;
  background: var(--olive-dark);
  color: var(--text);
  font: 11px/1.35 var(--font-ui);
}

.select-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 6px;
  white-space: nowrap;
  cursor: pointer;
}

.select-option[data-active] {
  background: var(--highlight);
  color: #fff;
}

.select-option[aria-selected="true"] {
  color: var(--yellow);
}

.select-option[data-active][aria-selected="true"] {
  color: #fff;
}

.option-meta {
  margin-left: auto;
  color: var(--text-muted);
}

.select-option[data-active] .option-meta,
.select-option[data-active] .option-rank {
  color: #fff;
}

.option-rank {
  min-width: 20px;
  color: var(--text-muted);
}

/* ---------- Checkbox ---------- */
/* The switches become the client's square checkboxes, label on the right. */

.switch-row {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 3px 0;
  cursor: default;
}

.switch {
  position: relative;
  flex: none;
  width: 13px;
  height: 13px;
  padding: 0;
  border-color: var(--edge-dark) var(--edge-light) var(--edge-light) var(--edge-dark);
  background: var(--olive-dark);
  cursor: pointer;
}

.switch[aria-checked="true"]::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 0;
  width: 4px;
  height: 8px;
  border: solid var(--text);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ---------- Swatches ---------- */

.swatches {
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
}

.swatch {
  position: relative;
  width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 0;
  background: var(--swatch);
  cursor: pointer;
}

.swatch[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  inset: -4px;
  border: 1px dotted var(--yellow);
}

/* ---------- Import dialog ---------- */

.sheet {
  width: min(420px, calc(100% - 32px));
  padding: 0;
  border: 1px solid;
  border-color: var(--edge-light) var(--edge-dark) var(--edge-dark) var(--edge-light);
  border-radius: 0;
  background: var(--olive);
  color: var(--text);
}

.sheet::backdrop {
  background: rgb(0 0 0 / 0.25);
}

.sheet-body {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.sheet-title {
  margin: 0 0 -4px;
  color: var(--yellow);
  font: 11px/1 var(--font-ui);
  text-transform: uppercase;
}

.well-input {
  width: 100%;
  padding: 4px 6px;
  border-radius: 0;
  background: var(--olive-dark);
  color: var(--text);
  font: 11px/15px var(--font-mono);
  resize: none;
}

.well-input:focus {
  outline: none;
}

/* The error's room is kept whether or not there is one, so the dialog never
   changes height when a message arrives. */
.sheet-error {
  min-height: 15px;
  margin: 0;
  color: #e08a6a;
  line-height: 15px;
}

@media (max-width: 480px) {
  .sheet-error {
    min-height: 30px;
  }
}

.sheet-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.sheet-actions .key {
  min-width: 72px;
}

/* ---------- On a phone, in the gallery ---------- */

/* The preview takes the room it needs and the settings take the rest. */
html[data-touch] .device {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
}

html[data-touch] [data-action="copy-commands"],
html[data-touch] .brand {
  display: none;
}
/* A tile is a display: the preview and nothing else, no controls anywhere. */
html[data-mode="tile"] .device {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) 0;
  row-gap: 0;
}

html[data-mode="tile"] .panel {
  visibility: hidden;
}

/* A tile shows the preview and nothing else. What it hides closes up rather
   than switching off, so opening the project grows the controls in. */
.deck-bar,
.strip {
  overflow: clip;
  overflow-clip-margin: 4px;
  max-height: 120px;
  transition:
    max-height 300ms ease-out,
    margin 300ms ease-out,
    opacity 300ms ease-out;
}

html[data-mode="tile"] .deck-bar {
  max-height: 0;
  margin-bottom: -8px;
  opacity: 0;
  pointer-events: none;
}

html[data-mode="tile"] .strip {
  max-height: 0;
  margin-top: -8px;
  opacity: 0;
  pointer-events: none;
}

html[data-mode="tile"] .screen-hint,
html[data-mode="tile"] .screen-tag {
  opacity: 0;
}

html:not([data-closable]) [data-action="close"] {
  display: none;
}

@media (max-height: 360px) {
  .strip {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .deck-bar,
  .strip {
    transition-duration: 1ms;
  }
}

/* On a phone the colour presets are big enough to hit with a thumb, and sit
   side by side rather than spread across the row. */
html[data-touch] .swatches {
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 12px;
}
html[data-touch] .swatch {
  width: 32px;
  height: 32px;
}

/* On a phone every control is a size a thumb can hit. */
html[data-touch] .key {
  min-height: 34px;
  padding: 0 14px;
}
html[data-touch] .key-icon {
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
}
html[data-touch] .key-icon svg {
  width: 18px;
  height: 18px;
}
html[data-touch] .select-chevron {
  width: 28px;
}
html[data-touch] .tab {
  min-height: 32px;
}
html[data-touch] .scrub {
  padding: 5px 0;
}
html[data-touch] .scrub-step {
  width: 30px;
  min-height: 30px;
}
html[data-touch] .scrub-value {
  width: 56px;
  height: 30px;
  font: 16px/28px var(--font-ui);
}
html[data-touch] .scrub-track {
  --thumb: 16px;
  --track: 30px;
}
html[data-touch] .switch-row {
  padding: 6px 0;
  font-size: 12px;
}
html[data-touch] .switch {
  width: 22px;
  height: 22px;
}
html[data-touch] .switch[aria-checked="true"]::after {
  left: 6px;
  top: 1px;
  width: 6px;
  height: 12px;
}
html[data-touch] .select-option {
  padding: 9px 8px;
}

/* A number that changes by itself rolls: the old reading leaves and the new one
   comes in. The input holds the real value and stays still underneath. */
.scrub-box {
  position: relative;
  display: inline-flex;
}

.scrub-roll {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

.scrub-roll {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.scrub-col {
  position: relative;
  display: inline-block;
  white-space: pre;
}

.scrub-gone {
  position: absolute;
  top: 0;
  right: 0;
}

.scrub[data-rolling] .scrub-value {
  color: transparent;
}

/* On a tablet the close button sits at the right edge of the bar. */
.deck-controls [data-action="close"] {
  margin-left: auto;
}

html[data-touch] .deck-controls {
  width: 100%;
}

/* The description sits close under the title and a little away from the field. */
.sheet-body .note {
  margin: 0 0 4px;
}

/* A static select keeps the width of its widest option. */
.deck-controls .select[data-static] .select-trigger {
  width: var(--static-w, 100%);
  max-width: none;
}

@container (max-width: 520px) {
  .deck-controls .select[data-static] .select-trigger {
    width: 100%;
  }
}

/* The zoom reading rolls when it changes. */
.loupe-tag {
  overflow: hidden;
}

.loupe-num {
  display: inline-block;
}

.loupe-ghost {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

/* On a touch layout the selects always fill the row, whatever its width. */
html[data-touch] .deck-controls {
  width: 100%;
}

html[data-touch] .deck-controls .select {
  flex: 1;
}

html[data-touch] .deck-controls .select[data-static] .select-trigger {
  width: 100%;
  max-width: none;
}

/* The touch size of a key must not put padding back on the drop-down's right,
   where the arrow box sits flush. */
html[data-touch] .select-trigger {
  padding: 0 0 0 6px;
}

/* The text of a select may overhang its first letter by a pixel; the clip that
   gives it an ellipsis must not cut that off. */
.select-value {
  padding: 0 2px;
  margin: 0 -2px;
}

/* On a touch screen a long press holds or drags; it does not select text or
   open the callout. Fields keep their selection, and the share code stays
   selectable. */
html[data-touch] body {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

html[data-touch] input,
html[data-touch] textarea,
html[data-touch] .lcd-code {
  -webkit-user-select: text;
  user-select: text;
}

/* ---------- The zoomed preview on a phone ---------- */

/* The preview is wide rather than tall, so the settings keep their room, and it
   shows the zoomed view alone: the loupe fills the screen and the map and the
   crosshair at their own size are drawn under it, unseen. */
.zoom {
  display: none;
}

html[data-touch]:not([data-mode="tile"]) .deck {
  min-height: 0;
}

html[data-touch]:not([data-mode="tile"]) .bezel {
  flex: none;
}

html[data-touch]:not([data-mode="tile"]) .screen {
  height: auto;
  aspect-ratio: 16 / 9;
}

html[data-touch]:not([data-mode="tile"]) .screen-map,
html[data-touch]:not([data-mode="tile"]) .screen-canvas,
html[data-touch]:not([data-mode="tile"]) .screen-glass,
html[data-touch]:not([data-mode="tile"]) .loupe-tag {
  visibility: hidden;
}

html[data-touch]:not([data-mode="tile"]) .loupe {
  inset: 0;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

html[data-touch]:not([data-mode="tile"]) .loupe-canvas {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  transition: filter var(--dur-slow, 200ms) ease-out, scale var(--dur-slow, 200ms) ease-out;
}

html[data-touch]:not([data-mode="tile"]) .screen[data-loading] .loupe-canvas {
  filter: blur(14px);
  scale: 1.06;
}

html[data-touch]:not([data-mode="tile"]) .zoom {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 0;
}

.zoom-reading {
  box-sizing: border-box;
  width: 34px;
  min-width: 0;
  padding: 3px 0;
  background: var(--olive);
  border: 1px solid;
  border-color: var(--edge-light) var(--edge-dark) var(--edge-dark) var(--edge-light);
  color: var(--text);
  font: 11px/1.2 var(--font-ui);
  text-align: center;
}

.zoom .key:disabled {
  color: var(--text-disabled);
  transform: none;
}

.zoom .key:disabled > * {
  transform: none;
}

.zoom .key {
  touch-action: manipulation;
}

@media (prefers-reduced-motion: reduce) {
  html[data-touch]:not([data-mode="tile"]) .loupe-canvas {
    transition: none;
  }
}

/* A finger takes hold of the slider's thumb and nothing else on the track: the
   thumb's touch area reaches a little past the cap, and the rest of the track
   leaves vertical scrolling to the page. */
html[data-touch] .scrub-track {
  touch-action: pan-y;
}

html[data-touch] .scrub-thumb {
  touch-action: none;
}

html[data-touch] .scrub-thumb::before {
  content: "";
  position: absolute;
  inset: -8px;
}

/* On a touch screen the settings scroll like any other page there: the system's
   own overlay scrollbar instead of a 12px drawn one (which showed as a lighter
   strip with an outline down the right edge and shifted the content off
   centre), and no edge fade, because a mask on a scrolling box is composited
   as its own layer on iOS and shows as a tinted band down the sides. */
html[data-touch] .panel-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  mask-image: none;
  scrollbar-width: none;
}

html[data-touch] .panel-scroll::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

/* iOS Safari zooms the whole page in when a field under 16px is focused, and
   leaves it zoomed and panned afterwards: the page then shows a different
   colour down the left edge and the backdrop down the right and bottom edges.
   So fields are 16px on touch, and the document itself cannot be panned (the
   panel is the only thing that scrolls). */
html[data-touch] input,
html[data-touch] textarea {
  font-size: 16px;
}

html[data-touch],
html[data-touch] body {
  position: fixed;
  inset: 0;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

html[data-touch]:not([data-mode="tile"]) .screen {
  height: round(down, calc((100cqw - 2px) * 9 / 16), 1px);
  aspect-ratio: auto;
}

/* The step buttons' − and + are drawn, not typed: a glyph sits wherever the
   font puts it (about a pixel off the middle of the box, and the − and the +
   a half pixel apart), while a 2px bar centred in an even-sized box is exact. */
.scrub-step {
  position: relative;
  font-size: 0;
  line-height: 0;
}

.scrub-step::before,
.scrub-step::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 8px;
  height: 2px;
  background: currentColor;
}

.scrub-step[data-dir="-1"]::after {
  display: none;
}

.scrub-step[data-dir="1"]::after {
  width: 2px;
  height: 8px;
}

html[data-touch] .scrub-step::before {
  width: 10px;
}

html[data-touch] .scrub-step[data-dir="1"]::after {
  height: 10px;
}

.scrub-value {
  padding-bottom: 2px;
}

/* The face's font sits about a pixel low in a button; the label is lifted so
   its capitals are centred in the face. */
.key:not(.key-icon):not(.scrub-step):not(.select-trigger),
.tab:not([aria-selected="true"]):not(:active) {
  padding-bottom: 2px;
}

/* A select's caret box runs the full height of the field, so its label is
   lifted on its own instead of by padding on the field. */
.select-value {
  padding-bottom: 2px;
}
