* { box-sizing: border-box; }
:root {
  color-scheme: light;
  --accent: #ff8a3d;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  color: #263c3b;
  background: #254947;
}
body { margin: 0; }
.game {
  position: relative;
  margin-inline: auto;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #d6f1e6;
}
@media (min-aspect-ratio: 4/5) {
  .game { max-width: 56.25vh; max-width: 56.25dvh; }
}
canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.hud {
  position: absolute;
  inset: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) auto max(8px, env(safe-area-inset-left));
  display: flex;
  justify-content: space-between;
  gap: 6px;
  align-items: center;
  pointer-events: none;
}
.hud dl {
  display: flex;
  margin: 0;
  background: #fffdf7;
  border: 1px solid #c6e1d5;
  border-radius: 8px;
}
.hud dl div { padding: 4px 8px; min-width: 49px; }
.hud dl div + div { border-left: 1px solid #daebe4; }
dt { font-size: 11px; color: #486764; }
dd { margin: 1px 0 0; font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
button {
  border: 1px solid #c6e1d5;
  border-radius: 8px;
  padding: 6px 10px;
  min-height: 44px;
  background: #fffdf7;
  color: inherit;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
button:focus-visible { outline: 2px solid #285c55; outline-offset: 2px; }
button:disabled { cursor: wait; opacity: .65; }
#ranking { pointer-events: auto; }
#ranking i { color: #ab480e; }
dialog {
  inset: 0;
  width: min(calc(100% - 28px), 335px);
  max-height: calc(100% - 24px);
  overflow: auto;
  border: 1px solid #c6e1d5;
  border-radius: 8px;
  padding: 18px;
  background: #fffdf7;
  color: inherit;
}
dialog::backdrop { background: #173431a8; }
dialog h2 { margin: 0 0 12px; font-size: 21px; }
dialog p { margin: 0 0 12px; }
dialog button { width: 100%; }
.primary { background: var(--accent); border-color: transparent; color: #392011; }
#restart { margin-top: 8px; }
#ad-status { color: #5e5145; font-size: 13px; margin: 8px 0 0; }
#positions { list-style: none; padding: 0; margin: 0 0 12px; }
#positions li { display: grid; grid-template-columns: 2.5em 1fr auto; gap: 8px; padding: 8px 6px; border-bottom: 1px solid #dcebe4; }
#positions .self { background: #ffe9d7; font-weight: 700; }

.game { container-type: inline-size; }
.hud dl div:first-child { min-width: calc(6ch + 16px); }
dialog { width: min(calc(100cqw - 28px), 335px); }
