* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: #162636;
  color: #f8faf7;
  font-family: system-ui, sans-serif;
}

main {
  position: relative;
  display: flex;
  flex-direction: column;
  max-width: 540px;
  min-height: 360px;
  height: 100vh;
  height: 100dvh;
  margin: auto;
  background: #21374a;
}

header,
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

header {
  padding: 12px 16px;
  border-bottom: 4px solid #ffba44;
}

h1 {
  margin: 0;
  font-size: 25px;
}

#zone {
  padding: 4px 10px;
  border-radius: 4px;
  background: #d2e9df;
  color: #24443e;
  font-weight: bold;
}

.scene {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.score {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 8px 12px;
  border-left: 4px solid #ffca55;
  background: #162636ed;
  font-variant-numeric: tabular-nums;
}

.score small {
  display: block;
}

#distance {
  font-size: 30px;
}

#effect {
  position: absolute;
  top: 29%;
  left: 8%;
  font-size: clamp(26px, 9vw, 46px);
  text-shadow: 2px 3px #18314b;
  pointer-events: none;
}

.gauge-panel {
  position: absolute;
  top: 50%;
  right: 12px;
  display: grid;
  grid-template-rows: auto auto 44px;
  justify-items: center;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 6px;
  background: #162636ed;
  transform: translateY(-50%);
}

.gauge {
  position: relative;
  width: 24px;
  height: clamp(48px, 24dvh, 200px);
  border: 2px solid #f8faf7;
  background: #608684;
}

#yellow,
#needle {
  position: absolute;
  transform: translateY(-50%);
}

#yellow {
  inset-inline: 0;
  height: 3%;
  background: #ffe04e;
}

#needle {
  inset-inline: -6px;
  height: 3px;
  background: white;
  box-shadow: 0 0 0 1px #172430;
}

.gauge-panel.locked #needle {
  background: #ffac55;
}

.gauge-panel.perfect #needle {
  background: #ffe04e;
}

#angle,
.tap-guide {
  font-variant-numeric: tabular-nums;
}

footer {
  min-height: 113px;
  padding: 12px 16px max(14px, env(safe-area-inset-bottom));
}

.row {
  margin-bottom: 8px;
  font-size: 14px;
}

.row span {
  color: #ffd47a;
  white-space: nowrap;
}

.tap-guide {
  margin-bottom: 8px;
}

button {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-bottom: 4px solid #af731c;
  border-radius: 6px;
  background: #ffca55;
  color: #172430;
  font: 800 18px system-ui, sans-serif;
  touch-action: manipulation;
  user-select: none;
  cursor: pointer;
}

#stop-angle {
  padding-inline: 8px;
  font-size: 14px;
  white-space: nowrap;
}

.start-screen {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #162636bd;
}

.start-card {
  width: min(100%, 340px);
  padding: 24px;
  border-top: 4px solid #ffca55;
  border-radius: 8px;
  background: #21374a;
}

.start-card h2 {
  margin: 0;
  font-size: 38px;
}

.start-card ol {
  padding-left: 22px;
  line-height: 1.8;
}