:root {
  color-scheme: dark;
  color: #f2f2ed;
  background: #101316;
  font-family: system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100svh;
  display: grid;
  place-items: center;
}

.cabinet {
  position: relative;
  width: min(100%, calc(100svh * 16 / 9));
}

.viewport {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #171d1e url('./assets/layers/00_background.webp') center / cover;
}

.viewport canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }

#sound {
  position: absolute;
  top: 12px;
  right: 12px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #ffffff50;
  border-radius: 4px;
  background: #101316cc;
  color: #f2f2ed;
  font: 500 12px/1.2 system-ui, sans-serif;
  cursor: pointer;
  touch-action: manipulation;
}

#sound:focus-visible { outline: 2px solid white; outline-offset: 4px; }
#sound:disabled { opacity: .5; cursor: wait; }

.controls {
  position: absolute;
  inset: auto 10% 3.2%;
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
}

#status {
  margin: 0;
  color: #fff;
  font: 500 12px/1.5 system-ui, sans-serif;
  text-shadow: 0 1px 4px #000;
}

#spin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 112px;
  padding: 8px 18px;
  border: 1px solid #d4d5cf;
  border-radius: 4px;
  color: #171a1b;
  background: #edeee8;
  font: 650 15px/1.2 system-ui, sans-serif;
  cursor: pointer;
  touch-action: manipulation;
}

#spin:enabled:not([aria-disabled="true"]):hover { background: #fff; }
#spin:enabled:not([aria-disabled="true"]):active { background: #d8dad3; }
#spin:focus-visible { outline: 2px solid white; outline-offset: 4px; }
#spin:disabled, #spin[aria-disabled="true"] { opacity: .75; cursor: wait; }

@media (max-height: 500px) and (min-aspect-ratio: 1/1) {
  .controls { inset: auto 4% 5% auto; }
}

@media (orientation: portrait) {
  .cabinet {
    width: 100%;
    height: 100svh;
    display: flex;
    flex-direction: column;
  }

  .viewport { flex: 1; min-height: 0; aspect-ratio: auto; }
  .controls {
    position: static;
    flex: none;
    padding: 10px 12px max(16px, env(safe-area-inset-bottom));
  }
}
