:root {
  color-scheme: dark;
  background: #090c25;
  color: #f4f5ff;
  font-family: system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }

.city {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto auto minmax(8rem, 1fr) auto;
  background: #10142e;
}

.tools, .hud, .actions {
  padding-inline: max(.75rem, env(safe-area-inset-left)) max(.75rem, env(safe-area-inset-right));
}

.tools, .settings, .buttons {
  display: flex;
  flex-wrap: wrap;
  gap: .375rem;
  align-items: center;
}

.tools {
  justify-content: space-between;
  padding-top: max(.375rem, env(safe-area-inset-top));
}

button, .tools a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: .35rem .65rem;
  border: 1px solid #59628a;
  border-radius: .6rem;
  color: #f4f5ff;
  background: #202748;
  font: 700 .875rem/1.2 system-ui, sans-serif;
  touch-action: manipulation;
}

button { cursor: pointer; }
button:disabled { opacity: .65; cursor: default; }
button[aria-pressed="true"] { color: #0b2532; background: #83f3f4; border-color: #83f3f4; }
:where(button, a):focus-visible { outline: 3px solid #ffe08a; outline-offset: 2px; }

.hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: .375rem;
  align-items: center;
  padding-block: .4rem .25rem;
  border-bottom: 1px solid #384064;
}

.counter {
  color: #b8dbe7;
  font-size: .75rem;
  line-height: 1.15;
}

.counter strong {
  display: block;
  color: #fff;
  font-size: clamp(1.25rem, 4vw, 2rem);
  font-variant-numeric: tabular-nums;
}
.best { text-align: right; }
.title { text-align: center; }
.title h1 { margin: 0; color: #83f3f4; font-size: clamp(1.05rem, 4vw, 1.75rem); }
#notes { color: #ff9ddc; font: 700 1rem/1.1 monospace; letter-spacing: .15em; }

.field { position: relative; overflow: hidden; }
canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: manipulation;
  cursor: pointer;
}

.callout {
  position: absolute;
  inset: 8% 0 auto;
  width: max-content;
  max-width: calc(100% - 2rem);
  margin: 0 auto;
  padding: .3rem .7rem;
  border-radius: 1rem;
  background: #1b1738;
  color: #ffdf84;
  font-weight: 750;
  text-align: center;
  pointer-events: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: safe center;
  justify-items: center;
  gap: .7rem;
  overflow: auto;
  padding: 1rem;
  background: #0c1026ea;
  text-align: center;
}
.overlay h2, .overlay p { margin: 0; }
.overlay p, .actions p { color: #cad5ee; }

.actions {
  display: grid;
  justify-items: center;
  gap: .35rem;
  padding-top: .4rem;
  padding-bottom: max(.45rem, env(safe-area-inset-bottom));
  border-top: 1px solid #384064;
  text-align: center;
}
.actions p { margin: 0; font-size: .8rem; }
#stack, #continue { color: #0b1530; background: #83f3f4; border-color: #83f3f4; }
#stack { min-width: 9rem; }
.buttons { justify-content: center; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
