:root {
  --ink: #171717;
  --paper: #f6f0df;
  --rubber: #25232a;
  --red: #ef3340;
  --blue: #36b7e8;
  --green: #21b978;
  --yellow: #ffe682;
  --pink: #ee72c8;
  --violet: #6b4dbd;
  --shadow: 0 24px 70px rgba(10, 10, 10, 0.24);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  background:
    linear-gradient(90deg, rgba(20, 20, 20, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(20, 20, 20, 0.05) 1px, transparent 1px),
    radial-gradient(circle at 25% 10%, #ffffff 0, transparent 28rem),
    var(--paper);
  background-size: 34px 34px, 34px 34px, auto, auto;
}

button,
input {
  font: inherit;
}

button {
  min-height: 38px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 0 14px;
  color: var(--ink);
  background: #fff8df;
  box-shadow: 4px 4px 0 var(--ink);
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

button:hover {
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 var(--ink);
}

button:active,
button.is-held {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--ink);
}

.charge-button {
  --charge: 0%;
  --shake: 0px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.charge-button.is-held {
  animation: chargeShake 80ms linear infinite;
}

.charge-fill {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: -1;
  width: var(--charge);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.28), transparent 70%),
    #13d38a;
  transition: width 40ms linear;
}

.charge-label {
  position: relative;
  z-index: 1;
}

@keyframes chargeShake {
  0% {
    transform: translate(calc(3px - var(--shake)), 3px) rotate(calc(var(--shake) * -0.08deg));
  }
  50% {
    transform: translate(calc(3px + var(--shake)), 3px) rotate(calc(var(--shake) * 0.08deg));
  }
  100% {
    transform: translate(calc(3px - var(--shake)), 3px) rotate(calc(var(--shake) * -0.08deg));
  }
}

.app-shell {
  width: min(980px, calc(100vw - 24px));
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  gap: 18px;
  align-items: center;
  padding: 18px 0;
}

.stage {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 12px;
}

.topbar {
  width: min(610px, 100%);
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
}

.eyebrow {
  margin: 0 0 4px;
  font: 700 12px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 8px;
}

.brand-link {
  display: block;
  flex: 0 0 auto;
}

.brand-logo {
  display: block;
  width: min(210px, 48vw);
  height: auto;
}

.spinner-link {
  color: rgba(23, 23, 23, 0.58);
  font: 700 15px/1.1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
}

.spinner-link:hover {
  text-decoration: underline;
}

h1,
h2 {
  margin: 0;
  line-height: 0.95;
}

h1 {
  max-width: 720px;
  font-size: clamp(30px, 4.2vw, 48px);
  white-space: nowrap;
}

h2 {
  font-size: 26px;
}

.icon-button {
  width: 40px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 21px;
}

.wheel-wrap {
  position: relative;
  width: min(58vh, 58dvh, 610px, calc(100vw - 32px));
  aspect-ratio: 1;
  filter: drop-shadow(var(--shadow));
}

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

.pointer {
  position: absolute;
  z-index: 3;
  top: 50%;
  right: -10px;
  width: 36px;
  height: 56px;
  transform: translateY(-50%) rotate(90deg);
  background: var(--rubber);
  border: 3px solid #0d0d10;
  border-radius: 6px;
}

.pointer::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 6px;
  width: 20px;
  height: 27px;
  transform: translateX(-50%);
  clip-path: polygon(50% 100%, 0 0, 100% 0);
  background: var(--red);
}

.hub {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 124px;
  height: 124px;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 6px solid var(--rubber);
  color: #f8f1dc;
  background: radial-gradient(circle, #414047, #1d1c22);
  text-transform: uppercase;
  pointer-events: none;
}

.hub img {
  width: 92px;
  max-width: 76%;
  height: auto;
  display: block;
}

.result {
  width: min(610px, 100%);
  min-height: 74px;
  padding: 11px 14px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px 16px;
  align-items: center;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: rgba(255, 248, 223, 0.9);
}

.result .label {
  grid-column: 1 / -1;
  font: 700 12px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
}

.result strong {
  min-width: 0;
  font-size: 19px;
  overflow-wrap: anywhere;
}

.controls {
  width: min(610px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.primary {
  background: #19b878;
}

.danger {
  background: var(--red);
  color: white;
}

.settings {
  align-self: stretch;
  max-height: calc(100vh - 36px);
  max-height: calc(100dvh - 36px);
  overflow: auto;
  padding: 16px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: rgba(255, 248, 223, 0.96);
  box-shadow: 6px 6px 0 var(--ink);
}

.settings[aria-hidden="true"] {
  display: none;
}

.site-credit {
  position: fixed;
  right: 14px;
  bottom: 10px;
  z-index: 10;
  display: grid;
  gap: 4px;
  justify-items: end;
  font: 700 12px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
}

.site-credit a {
  color: var(--ink);
  text-decoration: none;
  text-transform: uppercase;
  background: rgba(255, 248, 223, 0.82);
  border: 1px solid rgba(23, 23, 23, 0.32);
  border-radius: 5px;
  padding: 6px 8px;
}

.site-credit a:hover {
  background: #fff8df;
  text-decoration: underline;
}

.site-disclaimer {
  position: fixed;
  left: 14px;
  bottom: 10px;
  z-index: 10;
  max-width: min(360px, calc(100vw - 28px));
  margin: 0;
  padding: 6px 8px;
  color: rgba(23, 23, 23, 0.82);
  background: rgba(255, 248, 223, 0.78);
  border: 1px solid rgba(23, 23, 23, 0.22);
  border-radius: 5px;
  font: 700 10px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
}

.settings-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.field {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

.checkbox-field {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
  font-weight: 700;
}

.checkbox-field input {
  width: 20px;
  min-height: 20px;
  accent-color: var(--green);
}

input {
  width: 100%;
  min-height: 38px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 0 12px;
  background: white;
}

.blacklist-tools {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
  margin-top: 14px;
}

.blacklist {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.blacklist-row {
  display: grid;
  grid-template-columns: 1fr 44px;
  gap: 8px;
}

.blacklist-row button {
  padding: 0;
}

.celebrate {
  animation: pop 420ms ease;
}

@keyframes pop {
  35% {
    transform: scale(1.04);
  }
}

@media (max-width: 930px) {
  .app-shell {
    width: min(660px, calc(100vw - 24px));
    grid-template-columns: 1fr;
    align-items: start;
    padding-bottom: 86px;
  }

  .settings {
    max-height: none;
  }
}

@media (max-width: 620px) {
  button,
  input {
    font-size: 16px;
  }

  button {
    min-height: 42px;
  }

  .app-shell {
    width: min(100% - 18px, 440px);
    padding: 12px 0 120px;
    gap: 12px;
  }

  .stage {
    gap: 10px;
  }

  .topbar {
    align-items: start;
    gap: 10px;
  }

  h1 {
    font-size: clamp(28px, 9vw, 40px);
  }

  .eyebrow {
    font-size: 11px;
  }

  .brand-logo {
    width: min(180px, 42vw);
  }

  .brand-row {
    gap: 10px;
  }

  .spinner-link {
    font-size: 12px;
  }

  .icon-button {
    width: 38px;
    min-width: 38px;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .wheel-wrap {
    width: min(calc(100vw - 32px), 50vh, 50dvh, 390px);
  }

  .pointer {
    right: -8px;
    width: 30px;
    height: 48px;
    border-width: 2px;
  }

  .pointer::after {
    width: 16px;
    height: 23px;
  }

  .result {
    grid-template-columns: 1fr;
    min-height: 66px;
  }

  .result strong {
    font-size: 17px;
  }

  .hub {
    width: clamp(78px, 26vw, 104px);
    height: clamp(78px, 26vw, 104px);
    border-width: 5px;
  }

  .hub img {
    width: min(76px, 74%);
  }

  .blacklist-tools,
  .blacklist-row {
    grid-template-columns: 1fr;
  }

  .site-credit {
    right: 9px;
    bottom: 8px;
    max-width: calc(100vw - 18px);
    font-size: 10px;
  }

  .site-credit a {
    padding: 5px 7px;
  }

  .site-disclaimer {
    left: 9px;
    bottom: 56px;
    max-width: calc(100vw - 18px);
    font-size: 9px;
  }
}

@media (max-width: 380px) {
  .app-shell {
    width: min(100% - 12px, 360px);
  }

  h1 {
    font-size: clamp(25px, 8.2vw, 32px);
  }

  .wheel-wrap {
    width: min(calc(100vw - 26px), 46vh, 46dvh, 340px);
  }

  .hub {
    width: 76px;
    height: 76px;
  }

  .hub img {
    width: 56px;
  }
}

@media (max-height: 760px) and (min-width: 621px) {
  .app-shell {
    padding: 10px 0 42px;
  }

  .stage {
    gap: 8px;
  }

  h1 {
    font-size: clamp(28px, 3.8vw, 40px);
  }

  .wheel-wrap {
    width: min(50vh, 50dvh, 540px, calc(100vw - 32px));
  }

  .result {
    min-height: 62px;
    padding: 9px 12px;
  }
}

@media (min-width: 1440px) {
  .app-shell {
    width: min(1080px, calc(100vw - 72px));
  }
}
