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

html,
body {
  margin: 0;
  min-height: 100%;
  background: #151515;
  color: #eee;
  overscroll-behavior: none;
}

body {
  min-height: 100dvh;
  overflow: hidden;
}

#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  background: #151515;
}

#loading-screen[hidden] {
  display: none;
}

.loading-content {
  width: min(100%, 480px);
}

.loading-content h1 {
  margin: 0 0 22px;
  font-size: 22px;
  line-height: 1.25;
  text-align: center;
}

#loading-progress {
  width: 100%;
  height: 12px;
  overflow: hidden;
  background: #353535;
  border: 1px solid #555;
}

#loading-progress-fill {
  display: block;
  width: 0;
  height: 100%;
  background: #f1a62e;
  transition: width 120ms linear;
}

.loading-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  min-height: 20px;
  margin-top: 8px;
  color: #ddd;
  font-size: 13px;
}

#loading-detail {
  min-height: 20px;
  margin: 16px 0 0;
  color: #bbb;
  font-size: 14px;
  line-height: 20px;
  text-align: center;
}

#retry-button {
  display: block;
  min-width: 96px;
  min-height: 40px;
  margin: 16px auto 0;
  border: 1px solid #777;
  border-radius: 4px;
  background: #262626;
  color: #fff;
  font: inherit;
}

#retry-button[hidden] {
  display: none;
}

main {
  box-sizing: border-box;
  min-height: 100dvh;
  padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#ruffle-status {
  min-height: 20px;
  margin: 0 0 6px;
  font-size: 13px;
  line-height: 20px;
}

#player-container {
  width: min(100%, 640px, calc((100dvh - 50px) * 4 / 3));
  aspect-ratio: 4 / 3;
  background: #000;
}

#player-container ruffle-player {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
