/* Happy Triangle Video Playground, phone layout (assets/js/waaavesMobile.js).
   The monitor is fixed to the top and the control sheet to the bottom; the page shows between them.
   The panel's own classes (.waaavesApp__tab, .wp, ...) come from waaaves.css and are only enlarged here. */

.wm {
  position: fixed;
  inset: 0;
  z-index: 8000; /* below the grab frames (9000) and the raised video modals (9999) */
  pointer-events: none; /* the page between the two panels stays usable */
  font-size: 15px;
}

.wm__monitor,
.wm__sheet {
  position: absolute;
  left: 0;
  right: 0;
  box-sizing: border-box;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  border: 1px solid lime;
  box-shadow: 0px 0px 24px var(--wm-glow, #ff6347);
  color: #000000;
  animation: morphFromInverse 180s infinite; /* the same shifting color as the site's other windows */
  touch-action: manipulation;
}

/* ---- output monitor ---- */
.wm__monitor {
  top: 0;
}

.wm__bar {
  display: flex;
  gap: 4px;
  padding: 4px;
  overflow-x: auto;
  flex: 0 0 auto;
}

.wm .waaavesApp__btn {
  flex: 0 0 auto;
  min-height: 40px;
  min-width: 44px;
  padding: 4px 12px;
  font-size: 1rem;
  white-space: nowrap;
}

.wm__close {
  margin-right: 6px;
}

.wm__view {
  position: relative;
  height: 36vh;
  max-height: 340px;
  padding: 0 4px 4px;
  display: flex;
  flex: 0 0 auto;
}

.wm .waaavesApp__canvasHost {
  flex: 1 1 auto;
  margin: 0;
  min-width: 0;
}

.wm .waaavesApp__fps {
  position: absolute;
  right: 10px;
  bottom: 8px;
  min-width: 0;
  margin: 0;
  padding: 0 4px;
  background: rgba(0, 0, 0, 0.55);
  color: lime;
  font-size: 0.8rem;
}

/* camera and source messages sit over the bottom of the picture, and disappear when empty */
.wm .waaavesApp__status {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 28px;
  padding: 4px 6px;
  background: rgba(0, 0, 0, 0.75);
  color: #ffffff;
  font-size: 0.85rem;
  line-height: 1.3;
  pointer-events: none;
}

.wm .waaavesApp__status:empty {
  display: none;
}

/* ---- control sheet ---- */
.wm__sheet {
  bottom: 0;
  height: 44vh;
}

.wm.is-folded .wm__sheet {
  height: auto;
}

.wm.is-folded .wm__sheetBody {
  display: none;
}

.wm__handle {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-bottom: 1px solid lime;
  background: transparent;
  color: inherit;
  font-family: "MingLiU", serif;
  font-style: italic;
  font-weight: bold;
  font-size: 1.05rem;
  text-transform: uppercase;
  text-align: left;
}

.wm__title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wm__sheetBody {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 6px;
}

.wm .waaavesApp__panel {
  flex: 1 1 auto;
}

/* tabs: one scrolling row */
.wm .waaavesApp__tabs {
  flex-wrap: nowrap;
  overflow-x: auto;
  flex: 0 0 auto;
}

.wm .waaavesApp__tab {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 4px 14px;
}

.wm .waaavesApp__body {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* each control: its name on its own line, the slider (or menu) full width below it */
.wm .wp__main {
  flex-wrap: wrap;
  gap: 2px 8px;
  padding: 4px 0;
}

.wm .wp__label {
  flex: 1 0 100%;
}

.wm .wp__main input[type="range"],
.wm .wp__sub input[type="range"] {
  min-height: 32px;
}

.wm .wp__select {
  flex: 1 0 100%;
  min-height: 38px;
  font-size: 16px; /* 16px stops the browser zooming into the page when a menu is used */
}

.wm .wp__main input[type="checkbox"] {
  width: 26px;
  height: 26px;
}

.wm .wp__tilde {
  min-height: 32px;
  width: 36px;
}

.wm .wp__sub {
  min-height: 34px;
}

.wm .wp__sub > input[type="number"] {
  font-size: 16px;
  min-height: 34px;
}

/* ---- phone held sideways: monitor on the left, controls on the right ---- */
@media (orientation: landscape) and (max-height: 520px) {
  .wm__monitor {
    top: 0;
    bottom: 0;
    right: auto;
    width: 46%;
  }

  .wm__view {
    flex: 1 1 auto;
    height: auto;
    max-height: none;
    min-height: 0;
  }

  .wm__sheet {
    top: 0;
    bottom: 0;
    left: auto;
    width: 54%;
    height: auto;
  }

  .wm.is-folded .wm__sheet {
    bottom: auto;
  }
}

/* touch screens: the frames' labels are shorter, so two neighbouring frames' labels don't run together */
@media (pointer: coarse) {
  .waaavesGrab__bar {
    font-size: 0.8rem;
    padding: 4px 8px;
  }

  .waaavesGrab__size {
    display: none;
  }

  .waaavesGrab__resize {
    width: 26px;
    height: 26px;
  }
}
