/* Reset, page shell and the layout grid (docs/ui-spec.md § Visuals: Layout). */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--sky-bottom);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font: 15px/1.4 var(--font-ui);
}

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

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid #1a73e8;
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Three columns: player tray, monitor stage, action tray. The page spans the whole viewport (no max
   width; owner, H-6): the trays sit a page-padding from the edges and the monitor takes all the width
   between them, widening up to 4:3 (sky-cloud.css). */
.page {
  display: grid;
  grid-template-columns: var(--tray-width) minmax(0, 1fr) var(--tray-width);
  gap: var(--gap);
  align-content: center;
  min-height: 100vh;
  margin: 0 auto;
  padding: var(--page-pad);
  /* On a phone the cloud is wider than the screen; never let it scroll the page sideways. */
  overflow-x: clip;
}

/* The DOM order is monitor, players, actions (tab order and the stacked layout); beside the
   monitor the players go on the left and the actions on the right. */
.page > .tray-players {
  grid-column: 1;
  grid-row: 1;
}

.page > .stage {
  grid-column: 2;
  grid-row: 1;
}

.page > .tray-actions {
  grid-column: 3;
  grid-row: 1;
}

/* Login view: the same monitor and cloud; the trays are hidden. */
.page[data-view="login"] {
  grid-template-columns: minmax(0, 1fr);
}

.page[data-view="login"] > .stage {
  grid-column: 1;
}

.page[data-view="login"] .tray {
  display: none;
}

/* Below 1100 px the monitor takes the full width and the trays stack underneath. */
@media (max-width: 1099px) {
  .page,
  .page[data-view="login"] {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    row-gap: 16px;
  }

  .page > .tray-players,
  .page > .stage,
  .page > .tray-actions {
    grid-column: 1;
    grid-row: auto;
  }
}
