:root {
  --ok: #16a34a;
  --bad: #dc2626;
  --line: #ffffff;
  --th: #fbbf24;
  --stage-padding: clamp(4px, 1.5vmin, 16px);
  --stage-gap: clamp(2px, 1vmin, 12px);
  --button-radius: clamp(20px, 5.5vmin, 40px);
  --button-font: clamp(96px, 15vmin, 220px);
  --meter-radius: clamp(18px, 5vmin, 32px);
  --meter-border: clamp(4px, 0.6vmin, 8px);
  --line-thickness: clamp(6px, 0.8vmin, 12px);
  --line-thickness-threshold: clamp(8px, 1.1vmin, 16px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  color: #fff;
  background: var(--ok);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: var(--stage-padding);
  padding-top: calc(var(--stage-padding) + env(safe-area-inset-top, 0px));
  padding-bottom: calc(var(--stage-padding) + env(safe-area-inset-bottom, 0px));
  padding-left: calc(var(--stage-padding) + env(safe-area-inset-left, 0px));
  padding-right: calc(var(--stage-padding) + env(safe-area-inset-right, 0px));
  overflow: hidden;
}

.stage {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(220px, 30vw, 420px) minmax(0, 1fr);
  grid-template-areas: "down meter up";
  align-items: stretch;
  justify-items: stretch;
  gap: var(--stage-gap);
  max-width: 1200px;
  width: 100%;
  min-height: 0;
}

.btn {
  border: none;
  border-radius: var(--button-radius);
  background: rgba(0, 0, 0, 0.18);
  color: inherit;
  display: grid;
  place-items: center;
  font-size: var(--button-font);
  line-height: 1;
  cursor: pointer;
  transition: transform 120ms ease, background 160ms ease, box-shadow 160ms ease;
  touch-action: none;
  height: 100%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.btn:hover {
  background: rgba(0, 0, 0, 0.26);
}

.btn:active {
  transform: scale(0.97);
  background: rgba(0, 0, 0, 0.32);
}

.btn:focus-visible {
  outline: 4px solid rgba(255, 255, 255, 0.65);
  outline-offset: -6px;
}

.btn--down {
  grid-area: down;
}

.btn--up {
  grid-area: up;
}

.meter {
  grid-area: meter;
  position: relative;
  height: 100%;
  width: 100%;
  border-radius: var(--button-radius);
  background: rgba(0, 0, 0, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.hline {
  position: absolute;
  left: 8%;
  right: 8%;
  height: var(--line-thickness);
  border-radius: 999px;
  transform: translateY(-50%);
  background: var(--line);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.hline.th {
  height: var(--line-thickness-threshold);
  background: var(--th);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 960px) {
  :root {
    --button-font: clamp(104px, 20vmin, 210px);
  }
}

@media (max-width: 720px) {
  :root {
    --stage-gap: clamp(2px, 1.5vmin, 10px);
    --button-font: clamp(104px, 26vmin, 210px);
  }

  body {
    padding: clamp(4px, 3vmin, 16px);
    padding-top: calc(clamp(4px, 3vmin, 16px) + env(safe-area-inset-top, 0px));
    padding-bottom: calc(clamp(4px, 3vmin, 16px) + env(safe-area-inset-bottom, 0px));
    padding-left: calc(clamp(4px, 3vmin, 16px) + env(safe-area-inset-left, 0px));
    padding-right: calc(clamp(4px, 3vmin, 16px) + env(safe-area-inset-right, 0px));
  }

  .stage {
    max-width: min(480px, 100%);
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "up"
      "meter"
      "down";
    align-items: center;
    justify-items: center;
  }

  .btn {
    width: 100%;
    height: clamp(120px, 28vmin, 220px);
  }

  .meter {
    width: 100%;
    height: 100%;
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  :root {
    --stage-gap: clamp(2px, 1vmin, 8px);
    --button-font: clamp(88px, 18vmin, 180px);
  }
}

