:root {
  color-scheme: dark;
  background: #060d17;
  color: #d9edf4;
  font-family: system-ui, sans-serif;
}

html, body, #player {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

#player { position: relative; background: #060d17; }
[hidden] { display: none !important; }

#game {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
}

#fullscreen-corner {
  position: absolute;
  top: 0;
  right: 0;
  width: 9rem;
  height: 48px;
  pointer-events: none;
}

#fullscreen {
  position: absolute;
  top: 6px;
  right: 6px;
  visibility: hidden;
  pointer-events: auto;
  white-space: nowrap;
}

#fullscreen-corner[data-nearby] #fullscreen { visibility: visible; }

button {
  border: 1px solid #437383;
  padding: .4rem .65rem;
  border-radius: .25rem;
  background: #0a1824;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

button:hover { border-color: #55eaff; }

#startup {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  padding: 1.5rem;
  background: #060d17;
}

html[data-mobile] body {
  box-sizing: border-box;
  height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overscroll-behavior: none;
}

html[data-mobile] #player {
  --unit: 0.5px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

html[data-mobile] #fullscreen-corner {
  z-index: 4;
  width: min(17rem, 75vw);
}

html[data-mobile] #fullscreen {
  visibility: visible;
  min-height: 44px;
}

html[data-mobile] #startup { z-index: 3; }

#fullscreen-help {
  position: absolute;
  top: 48px;
  right: 6px;
  border: 1px solid #437383;
  border-radius: .35rem;
  margin: 0;
  padding: .6rem;
  background: #0a1824;
  font-size: .85rem;
}

#rotate-prompt {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: grid;
  place-content: center;
  padding: 1rem;
  text-align: center;
  background: #060d17;
}

#touch-ability {
  --diameter: max(48px, calc(107 * var(--unit)));
  position: absolute;
  z-index: 2;
  right: max(24px, calc(71 * var(--unit)));
  bottom: max(17px, calc(53 * var(--unit)));
  display: grid;
  place-items: center;
  box-sizing: border-box;
  width: var(--diameter);
  height: var(--diameter);
  padding: 0;
  border: 2px solid #ffe49a;
  border-radius: 50%;
  background: linear-gradient(to top, #ffcf57 var(--charge, 0%), #543505 var(--charge, 0%));
  color: #fff2c1;
  font-size: max(13px, calc(26 * var(--unit)));
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  text-shadow: 0 1px 3px #1a0f00, 0 0 4px #321e00;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

#touch-ability[data-down] { border-color: white; }
#touch-ability[data-practice] {
  top: calc(419 * var(--unit));
  right: auto;
  bottom: auto;
  left: calc(50% + 360 * var(--unit));
  transform: translate(-50%, -50%);
}

#touch-ability[data-ring]::after {
  content: "";
  position: absolute;
  inset: -2px;
  box-sizing: border-box;
  border: 2px solid #ffcc4f;
  border-radius: 50%;
  transform: scale(var(--ability-ring));
  pointer-events: none;
}

#touch-pause {
  position: absolute;
  z-index: 1;
  top: 6px;
  left: 6px;
  min-height: 44px;
}

#touch-editor {
  position: absolute;
  z-index: 5;
  display: flex;
  gap: .35rem;
  top: 6px;
  left: 50%;
  width: min(26rem, 92%);
  padding: .35rem;
  box-sizing: border-box;
  transform: translateX(-50%);
  border: 1px solid #437383;
  border-radius: .35rem;
  background: #0a1824;
}

#touch-text {
  min-width: 0;
  flex: 1;
  padding: .4rem;
  font: 16px system-ui, sans-serif;
  user-select: text;
  -webkit-user-select: text;
}
