:root {
  --bg: #111111;
  --surface: #1a1a1a;
  --line: #2a2a2a;
  --line-strong: #3b3b3b;
  --text: rgb(255 255 255 / 0.9);
  --muted: rgb(255 255 255 / 0.58);
  --faint: rgb(255 255 255 / 0.36);
  --light: #f4f4f4;
  --ok: #3cc46e;
  --bad: #ff8070;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --cell-w: 56px;
  --cell-h: 68px;
  --cell-gap: 8px;
  --group-gap: 14px;
  --digit: 32px;
  --bang: 188px;
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: #3d3d3d;
  color: #ffffff;
}

a {
  color: inherit;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.025em;
  text-decoration: none;
  border-radius: 8px;
}

.mark {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--light);
}

.get {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease), background-color 0.25s var(--ease);
}

.get svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.35s var(--ease);
}

.get:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--surface);
}

.get:hover svg {
  transform: translateY(2px);
}

.short {
  display: none;
}

main {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 16px 16px 72px;
}

.throw {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 440px;
  margin: 0;
}

.label {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
}

.pin {
  position: relative;
}

.pin input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  font-size: 16px;
  caret-color: transparent;
  cursor: text;
}

.cells {
  display: flex;
  gap: var(--cell-gap);
}

.cell {
  display: grid;
  place-items: center;
  width: var(--cell-w);
  height: var(--cell-h);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  font-size: var(--digit);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  transition: border-color 0.25s var(--ease), background-color 0.25s var(--ease);
}

.cell:nth-child(3) {
  margin-right: var(--group-gap);
}

.cell span {
  display: inline-block;
  animation: rise 0.26s var(--ease) both;
}

.pin:focus-within .cell.is-active {
  border-color: rgb(255 255 255 / 0.5);
  background: #1e1e1e;
}

.pin:focus-within .cell.is-active::after {
  content: "";
  width: 2px;
  height: calc(var(--digit) * 0.92);
  border-radius: 2px;
  background: var(--text);
  animation: breathe 1.4s ease-in-out infinite;
}

.pin.is-error .cell {
  border-color: rgb(255 128 112 / 0.5);
}

.status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 24px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.status[data-tone="bad"] {
  color: var(--bad);
}

.status[data-tone="hit"] {
  color: var(--text);
  font-weight: 600;
}

.status.in,
.note.in {
  animation: fade 0.34s var(--ease) both;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--faint);
  transition: background-color 0.4s var(--ease);
}

.dot.on {
  background: var(--ok);
}

.tag {
  padding: 1px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}

.bang {
  width: var(--bang);
  height: var(--bang);
  margin-top: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--light);
  color: #111111;
  font: 600 21px/1 var(--font);
  letter-spacing: -0.015em;
  cursor: pointer;
  box-shadow: 0 30px 70px -22px rgb(255 255 255 / 0.34);
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 0.5s var(--ease),
    box-shadow 0.5s var(--ease),
    background-color 0.45s var(--ease),
    color 0.45s var(--ease);
}

.bang:hover:not(:disabled) {
  transform: scale(1.035);
  box-shadow: 0 34px 84px -20px rgb(255 255 255 / 0.46);
}

.bang:active:not(:disabled),
.bang.is-busy {
  transform: scale(0.965);
  transition-duration: 0.14s;
}

.bang:disabled {
  background: var(--surface);
  color: var(--faint);
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: default;
}

.bang.is-busy {
  cursor: progress;
}

.bang:focus-visible,
.get:focus-visible,
.brand:focus-visible {
  outline: 2px solid var(--light);
  outline-offset: 5px;
}

.note {
  min-height: 24px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 15px;
  text-align: center;
  text-wrap: balance;
}

.flash {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
}

.flash.go {
  animation: boom 1.5s both;
}

@keyframes boom {
  0% {
    opacity: 1;
  }
  20% {
    opacity: 1;
    animation-timing-function: cubic-bezier(0.3, 0, 0.2, 1);
  }
  100% {
    opacity: 0;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
    filter: blur(3px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes breathe {
  0%,
  100% {
    opacity: 0.9;
  }
  50% {
    opacity: 0.2;
  }
}

@media (max-width: 480px) {
  :root {
    --cell-w: 46px;
    --cell-h: 58px;
    --cell-gap: 6px;
    --group-gap: 10px;
    --digit: 27px;
    --bang: 164px;
  }

  .bar {
    padding: 16px;
  }

  .long {
    display: none;
  }

  .short {
    display: inline;
  }

  .cell {
    border-radius: 14px;
  }
}

@media (max-width: 360px) {
  :root {
    --cell-w: 40px;
    --cell-h: 52px;
    --cell-gap: 5px;
    --group-gap: 8px;
    --digit: 24px;
    --bang: 148px;
  }

  .cell {
    border-radius: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .flash {
    display: none;
  }
}
