/* The Flight Desk — overlay styling.
   Museum-plate voice: dark engraved plates with brass hairlines, grotesque
   captions and mono figures, matching the machine in the scene. The canvas
   owns the screen; everything else floats on it. */

:root {
  --brass: #c9973f;
  --brass-light: #ffd98a;
  --paper: #e8ded0;
  --paper-dim: #a89a83;
  --plate: rgba(19, 14, 9, 0.88);
  --plate-edge: rgba(201, 151, 63, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #17120d;
}

body {
  font-family: "Inter Variable", system-ui, sans-serif;
  color: var(--paper);
}

[hidden] {
  display: none !important;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  display: block;
  touch-action: none;
  cursor: grab;
}

#scene:active {
  cursor: grabbing;
}

.plate {
  position: fixed;
  z-index: 3;
  background: linear-gradient(180deg, rgba(26, 20, 13, 0.9), var(--plate));
  border: 1px solid var(--plate-edge);
  border-radius: 10px;
  box-shadow:
    inset 0 1px 0 rgba(255, 217, 138, 0.14),
    0 12px 32px rgba(0, 0, 0, 0.5);
  padding: 12px 16px;
}

.plate-machine {
  top: calc(12px + env(safe-area-inset-top));
  left: calc(12px + env(safe-area-inset-left));
  padding: 10px 14px;
  pointer-events: none;
}

.machine-name {
  font-family: "Space Grotesk Variable", sans-serif;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.04em;
  color: var(--paper);
}

.machine-sub {
  margin-top: 2px;
  font-family: "JetBrains Mono Variable", monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--paper-dim);
}

.plate-chapter {
  left: calc(12px + env(safe-area-inset-left));
  bottom: calc(86px + env(safe-area-inset-bottom));
  width: min(438px, calc(100vw - 24px));
  pointer-events: none;
}

.ch-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.ch-num {
  font-family: "JetBrains Mono Variable", monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--brass-light);
}

.ch-title {
  margin: 0;
  font-family: "Space Grotesk Variable", sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.clock {
  margin-left: auto;
  font-family: "JetBrains Mono Variable", monospace;
  font-size: 13px;
  color: var(--paper-dim);
  font-variant-numeric: tabular-nums;
}

.ch-cap {
  margin: 7px 0 11px;
  font-size: 13.5px;
  line-height: 1.45;
  color: #d9cdb8;
}

.telemetry {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  border-top: 1px solid rgba(201, 151, 63, 0.3);
  padding-top: 9px;
}

.tcell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.tlabel {
  font-family: "JetBrains Mono Variable", monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--paper-dim);
}

.tvalue {
  font-family: "JetBrains Mono Variable", monospace;
  font-size: 12.5px;
  color: var(--paper);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tvalue b {
  font-size: 15px;
  font-weight: 700;
}

.bar {
  display: block;
  height: 8px;
  margin-top: 5px;
  border: 1px solid rgba(201, 151, 63, 0.4);
  border-radius: 4px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.45);
}

.bar i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ffb45e, #ff7a2a, #ff4d00);
}

.transport {
  position: fixed;
  z-index: 4;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(12px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 16px);
  padding: 8px 10px;
  background: linear-gradient(180deg, rgba(26, 20, 13, 0.92), rgba(17, 12, 8, 0.92));
  border: 1px solid var(--plate-edge);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.transport button {
  min-height: 44px;
  border: 1px solid rgba(201, 151, 63, 0.55);
  border-radius: 8px;
  background: linear-gradient(180deg, #2c2113, #1a130b);
  color: var(--paper);
  font-family: "Space Grotesk Variable", sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 0 16px;
  cursor: pointer;
}

.transport button:hover {
  border-color: var(--brass-light);
  color: #fff4dd;
}

.dots {
  display: flex;
  gap: 6px;
}

.dots .dot {
  width: 40px;
  min-height: 44px;
  padding: 0;
  font-family: "JetBrains Mono Variable", monospace;
  font-size: 12px;
  border-radius: 50%;
  aspect-ratio: 1;
}

.dots .dot.active {
  background: linear-gradient(180deg, #e9bc63, #b98a34);
  color: #1d1509;
  border-color: var(--brass-light);
}

.crank-label {
  font-family: "JetBrains Mono Variable", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--paper-dim);
}

#crank {
  width: min(260px, 34vw);
  height: 44px;
  accent-color: var(--brass);
  cursor: pointer;
  margin: 0;
}

.sample-note {
  position: fixed;
  z-index: 3;
  right: calc(12px + env(safe-area-inset-right));
  bottom: calc(14px + env(safe-area-inset-bottom));
  margin: 0;
  max-width: 210px;
  font-size: 11px;
  line-height: 1.4;
  color: rgba(232, 222, 208, 0.62);
  text-align: right;
  pointer-events: none;
}

#fallback {
  z-index: 5;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, calc(100vw - 32px));
  font-size: 14px;
  line-height: 1.55;
}

:focus-visible {
  outline: 2px solid var(--brass-light);
  outline-offset: 2px;
}

.capture * {
  transition: none !important;
}

@media (max-width: 700px) {
  .machine-name {
    font-size: 16px;
  }
  .plate-chapter {
    bottom: auto;
    top: calc(84px + env(safe-area-inset-top));
    padding: 10px 12px;
  }
  .ch-title {
    font-size: 17px;
  }
  .ch-cap {
    font-size: 12.5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .telemetry {
    grid-template-columns: repeat(2, 1fr);
  }
  .transport {
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 2px;
    width: calc(100vw - 16px);
  }
  #crank {
    width: min(300px, 52vw);
  }
  .sample-note {
    display: none;
  }
}
