* {
  box-sizing: border-box;
}

html {
  background: #FFFFFF;
}

@font-face {
  font-family: "Font 3";
  src: url("fonts/font3.otf") format("opentype");
  font-display: swap;
}

@font-face {
  font-family: "Kospix Demo";
  src: url("fonts/KospixDemo-G3xxD.otf") format("opentype");
  font-display: swap;
}

body {
  background: #FFFFFF;
  color: #FF1493;
  font-family: "Font 3", monospace;
  margin: 0;
  min-height: 100dvh;
  padding: 8px clamp(14px, 3vw, 32px);
  display: flex;
  justify-content: center;
}

main {
  width: min(100%, 1400px);
  height: calc(100dvh - 16px);
  margin: auto;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: clamp(2px, 0.6vh, 6px);
  text-align: center;
}

h1 {
  margin: 0;
  color: #FF1493;
  font-family: "Kospix Demo", monospace;
  font-size: clamp(36px, 8.5vw, 110px);
  font-weight: bold;
  line-height: 0.9;
  letter-spacing: -0.07em;
}

.calculator {
  position: relative;
  z-index: 1;
  font-size: 0.875rem;
  line-height: 1.3;
}

.calculator > p,
.calculator h2 {
  margin: 1px 0;
}

.calculator #status:empty {
  display: none;
}

#tax-form {
  display: grid;
  justify-items: center;
  gap: 4px;
}

.visual-questions {
  width: min(100%, 850px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 18px;
  text-align: left;
}

.visual-question {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.visual-question legend {
  margin: 0 0 2px;
  padding: 0;
  font-size: 0.81rem;
  font-weight: bold;
}

.visual-question > label:not(.state-select-label) {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin: 0 8px 0 0;
  font-size: 0.74rem;
  white-space: nowrap;
}

.visual-question input[type="radio"] {
  width: auto;
  margin: 0;
  padding: 0;
  accent-color: #171717;
}

.state-select-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.visual-question select {
  max-width: 100%;
  padding: 2px 6px;
  font: inherit;
  font-size: 0.765rem;
}

.income-entry {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 8px;
}

input,
button,
select,
option {
  color: inherit;
}

input::placeholder {
  color: inherit;
  opacity: 1;
}

input,
button {
  font: inherit;
  padding: 5px 8px;
  margin: 0;
}

input {
  width: 130px;
}

.calculation-results {
  position: relative;
  isolation: isolate;
}

.calculation-results h2,
.calculation-results > p {
  position: relative;
  z-index: 1;
}

.pixel-explosion {
  position: fixed;
  z-index: 0;
  top: var(--explosion-top, 0px);
  left: 50vw;
  width: min(120vw, 1620px);
  aspect-ratio: 580 / 538;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%);
}

.pixel-explosion canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.explosion-preview {
  margin: 0 0 4px;
}

.falling-pixels-preview {
  margin: 0 0 4px 4px;
}

.falling-pixels-overlay {
  position: fixed;
  z-index: 3;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  pointer-events: none;
}

.contribution-message {
  max-width: 60ch;
  margin: 1px auto;
}

.contribution-message.is-visible {
  animation: contribution-fade-in 450ms ease-out both;
}

@keyframes contribution-fade-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#contribution-copy {
  margin: 0;
  font-weight: bold;
}

@media (prefers-reduced-motion: reduce) {
  .contribution-message.is-visible {
    animation: none;
  }

  .pixel-explosion {
    display: none;
  }
}

#bomb-canvas {
  position: relative;
  z-index: 2;
  min-height: 0;
  max-width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

#bomb-canvas canvas {
  display: block;
  background: transparent;
  width: auto !important;
  height: 100% !important;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.poster-footer {
  position: relative;
  z-index: 2;
  align-self: end;
}

.funding-tracker {
  margin: 0;
  padding: 5px 0 0;
  border-top: 1px solid #171717;
  font-size: 0.76rem;
  line-height: 1.3;
}

.funding-tracker h2 {
  margin: 0 0 3px;
  font-size: inherit;
  font-weight: normal;
}

#funding-total {
  color: inherit;
}

.funding-progress {
  box-sizing: border-box;
  width: 100%;
  height: 6px;
  overflow: hidden;
  border: 1px solid #171717;
  background: #fff;
}

.funding-progress-fill {
  width: 0;
  height: 100%;
  background: #748364;
  transition: width 700ms ease-out;
}

.funding-details {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2px 14px;
  margin-top: 4px;
}

.funding-details p {
  margin: 0;
}

.research-placeholder {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 0.695rem;
}

.research-placeholder a {
  color: inherit;
}

@media (prefers-reduced-motion: reduce) {
  .funding-progress-fill {
    transition: none;
  }
}

@media (max-width: 600px) {
  body {
    padding: 14px;
  }

  main {
    height: calc(100dvh - 28px);
    grid-template-rows: auto auto minmax(0, 1fr) auto;
  }

  h1 {
    font-size: min(7.2vw, 43px);
    letter-spacing: -0.06em;
  }

  .visual-questions {
    gap: 6px 10px;
  }

  .visual-question > label:not(.state-select-label) {
    white-space: normal;
  }

  .visual-question legend {
    font-size: 0.74rem;
  }

  .visual-question > label:not(.state-select-label) {
    font-size: 0.675rem;
  }
}

@media (max-height: 650px) {
  body {
    min-height: 100dvh;
  }

  main {
    height: auto;
    min-height: calc(100dvh - 16px);
    grid-template-rows: auto auto minmax(180px, 1fr) auto;
  }
}
