:root {
  color-scheme: dark;
  font: 15px/1.4 system-ui, sans-serif;
  background: #111512;
  color: #e9eee9;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  display: flex;
  flex-direction: column;
  overscroll-behavior: none;
}
.toolbar {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
  min-height: 45px;
  padding: 4px 12px;
  border-bottom: 1px solid #2b332d;
}
.title {
  color: inherit;
  font-weight: 760;
  letter-spacing: .025em;
  text-decoration: none;
  white-space: nowrap;
}
#offline-status {
  margin-inline: auto 3px;
  color: #aebcb1;
  font-size: 12px;
  text-align: right;
}
button {
  border: 1px solid #46554a;
  border-radius: 7px;
  padding: 5px 9px;
  background: #222c24;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
button:active, button.active { background: #4a6350; }
button:focus-visible, a:focus-visible { outline: 2px solid #a8e6b8; outline-offset: 2px; }
#stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: #0b0e0c;
}
#game {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 900px;
  height: 600px;
  border: 0;
  background: #000;
  transform: translate(-50%, -50%) scale(var(--game-scale, .01));
}
.rotate { display: none; }
.touch-controls {
  --control: clamp(37px, 6.7vw, 52px);
  position: absolute;
  inset: 0;
  pointer-events: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.stick {
  position: absolute;
  left: 9px;
  bottom: 10px;
  width: clamp(84px, 15vw, 126px);
  aspect-ratio: 1;
  border: 1px solid #87998b;
  border-radius: 50%;
  background: #18261edc;
  pointer-events: auto;
  touch-action: none;
}
.stick span { position: absolute; color: #afc7b4; font-size: 11px; }
.stick-up { left: 50%; top: 4%; transform: translateX(-50%); }
.stick-down { left: 50%; bottom: 4%; transform: translateX(-50%); }
.stick-left { left: 5%; top: 50%; transform: translateY(-50%); }
.stick-right { right: 5%; top: 50%; transform: translateY(-50%); }
#stick-knob {
  left: 50%;
  top: 50%;
  width: 39%;
  aspect-ratio: 1;
  border: 1px solid #a7c3ad;
  border-radius: 50%;
  background: #45634c;
  transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px)));
}
.actions {
  position: absolute;
  right: 9px;
  bottom: 10px;
  display: grid;
  grid-template-columns: repeat(2, var(--control));
  grid-auto-rows: var(--control);
  gap: 5px;
  pointer-events: auto;
}
.actions button {
  background: #18261ee8;
  border-color: #87998b;
  padding: 0;
  font-size: clamp(10px, 1.9vw, 13px);
  font-weight: 650;
  line-height: 1.05;
  touch-action: none;
}
.actions button:active { background: #4a6350; }
dialog {
  width: min(460px, 92vw);
  max-height: 90dvh;
  padding: 18px;
  border: 1px solid #46554a;
  border-radius: 12px;
  background: #18201a;
  color: inherit;
}
dialog::backdrop { background: #0009; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.dialog-heading h1 { font-size: 1.25rem; margin: 0; }
.credits { color: #bac8bd; font-size: .87rem; }
.credits a { color: #bbdec2; }
@media (any-pointer: coarse) {
  .toolbar { min-height: 39px; padding-inline: 8px; }
  .toolbar button { font-size: 12px; min-height: 29px; }
}
@media (any-pointer: coarse) and (orientation: portrait) {
  .rotate {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    gap: 6px;
    text-align: center;
    background: #111512;
    color: #aebcb1;
  }
  .rotate strong { font-size: 1.15rem; color: #e9eee9; }
  #fullscreen { display: none; }
}
