/* Structure every theme relies on. Themes in /themes/ supply all of the
   look; this file only holds behaviour that must not change between them. */
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
h1,
h2,
p {
  margin: 0;
}
[hidden] {
  display: none !important;
}

/* Decorations are off unless a theme turns them on. */
.ambient,
.brand-bars,
.tally,
.sleeve,
.record-sheen,
.eq,
.panel-icon,
.help-glyph {
  display: none;
}

/* Answer view: the guessing controls step aside. */
.game.is-revealed .instructions,
.game.is-revealed .clip-control,
.game.is-revealed #guess-form,
.game.is-revealed .guess-history,
.game.is-revealed #give-up {
  display: none;
}

/* Lists that open from a field. suggestion-position.js flips them above the
   field when there is no room below. */
.source-picker,
.guess-field,
#room-guess-form {
  position: relative;
}
.suggestions,
.source-dropdown {
  position: absolute;
  z-index: 25;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.suggestions.above,
#room-suggestions.above {
  top: auto;
  bottom: calc(100% + 6px);
}
.suggestions button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
}
.suggestions .suggestion-title {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

/* Visualiser ring: positioned by visualizer.js around the record, behind it. */
.record-slot,
.room-record-wrap {
  position: relative;
}
/* The ring is resized on the next frame after a layout change; until then
   it must not be able to widen the page. */
.record-scene,
.room-record-wrap {
  overflow-x: clip;
}
.visualizer {
  position: absolute;
  z-index: 0;
  pointer-events: none;
}
.record,
.lobby-record {
  z-index: 1;
}

/* Dark under the cover while it downloads, never a white disc. */
.record-art {
  background: #111;
}

.theme-picker {
  display: inline-flex;
  align-items: center;
}
.theme-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.confetti {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
}

/* Desktop windows tall enough to hold the game: the solo page fits the
   viewport instead of scrolling. Side panels scroll inside themselves and
   the record scales to whatever room its scene is given (themes size it in
   cq units against .record-scene). */
@media (min-width: 1000px) and (min-height: 680px) {
  body:has(.workspace) {
    height: 100dvh;
    min-height: 0;
  }
  body:has(.workspace) .workspace {
    flex: 1 1 0;
    min-height: 0;
  }
  body:has(.workspace) .library,
  body:has(.workspace) .session {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }
  body:has(.workspace) .game {
    min-height: 0;
  }
  body:has(.workspace) .record-scene {
    container-type: size;
    min-height: 140px;
  }
  body:has(.workspace) footer {
    flex: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
