:root {
  --ink: #171321;
  --paper: #fff9f0;
  --pink: #ff2d75;
  --cyan: #14d6ff;
  --lime: #59f36c;
  --yellow: #ffe34f;
  --violet: #713cff;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100%;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

.hidden {
  display: none !important;
}

.app-shell {
  align-items: center;
  background:
    linear-gradient(135deg, rgba(255, 45, 117, 0.26), transparent 32%),
    linear-gradient(225deg, rgba(20, 214, 255, 0.32), transparent 34%),
    linear-gradient(45deg, rgba(89, 243, 108, 0.24), transparent 42%),
    #fff7ea;
  display: grid;
  min-height: 100svh;
  overflow-x: hidden;
  overflow-y: auto;
  padding:
    max(clamp(16px, 3vw, 36px), env(safe-area-inset-top))
    max(clamp(16px, 3vw, 36px), env(safe-area-inset-right))
    max(clamp(16px, 3vw, 36px), env(safe-area-inset-bottom))
    max(clamp(16px, 3vw, 36px), env(safe-area-inset-left));
}

.chooser-panel {
  background: rgba(255, 253, 247, 0.9);
  border: 3px solid #16121f;
  border-radius: 8px;
  box-shadow: 12px 12px 0 #16121f;
  margin: 0 auto;
  min-height: min(720px, calc(100svh - 72px));
  overflow: hidden;
  position: relative;
  width: min(980px, 100%);
}

.rainbow-scene {
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  position: absolute;
}

.rainbow-arc {
  aspect-ratio: 2 / 1;
  background: radial-gradient(
    ellipse at 50% 100%,
    transparent 0 35%,
    #fff9f0 35.2% 39%,
    #713cff 39.2% 43%,
    #14d6ff 43.2% 47%,
    #59f36c 47.2% 51%,
    #ffe34f 51.2% 55%,
    #ff9b28 55.2% 59%,
    #ff2d75 59.2% 63%,
    transparent 63.2% 100%
  );
  filter: drop-shadow(0 18px 0 rgba(22, 18, 31, 0.14));
  left: 50%;
  opacity: 0.95;
  position: absolute;
  top: -92px;
  transform: translateX(-50%);
  width: min(780px, 118vw);
}

.confetti,
.zigzag {
  border: 2px solid #16121f;
  box-shadow: 4px 4px 0 #16121f;
  position: absolute;
}

.confetti {
  height: 28px;
  transform: rotate(var(--tilt));
  width: 78px;
}

.confetti-one {
  --tilt: -12deg;
  background: var(--pink);
  left: 8%;
  top: 20%;
}

.confetti-two {
  --tilt: 14deg;
  background: var(--cyan);
  right: 9%;
  top: 24%;
}

.confetti-three {
  --tilt: 8deg;
  background: var(--yellow);
  bottom: 18%;
  left: 6%;
}

.confetti-four {
  --tilt: -18deg;
  background: var(--lime);
  bottom: 12%;
  right: 7%;
}

.zigzag {
  background:
    linear-gradient(135deg, transparent 0 42%, #16121f 42% 58%, transparent 58%)
      0 0 / 26px 26px,
    var(--violet);
  height: 38px;
  width: 148px;
}

.zigzag-one {
  left: 16%;
  top: 70%;
  transform: rotate(-8deg);
}

.zigzag-two {
  right: 17%;
  top: 64%;
  transform: rotate(11deg);
}

.chooser-content {
  display: grid;
  gap: clamp(24px, 5vw, 48px);
  grid-template-columns: minmax(0, 1fr);
  min-height: inherit;
  padding: clamp(26px, 5vw, 64px);
  place-content: center;
  position: relative;
  width: 100%;
  z-index: 1;
}

.brand-row {
  align-items: center;
  display: flex;
  gap: 18px;
  max-width: 100%;
}

.brand-mark {
  align-items: center;
  background: var(--yellow);
  border: 3px solid #16121f;
  border-radius: 8px;
  box-shadow: 6px 6px 0 #16121f;
  display: grid;
  flex: 0 0 auto;
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  font-weight: 950;
  height: clamp(58px, 8vw, 82px);
  letter-spacing: 0;
  place-items: center;
  rotate: -4deg;
  width: clamp(58px, 8vw, 82px);
}

.brand-row p {
  font-size: clamp(0.8rem, 1.4vw, 0.95rem);
  font-weight: 900;
  letter-spacing: 0;
  margin: 0 0 2px;
  text-transform: uppercase;
}

.brand-row h1 {
  font-size: clamp(3rem, 10vw, 7.5rem);
  font-weight: 1000;
  letter-spacing: 0;
  line-height: 0.9;
  margin: 0;
}

.control-stack {
  display: grid;
  gap: 18px;
  width: 100%;
}

.color-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.color-card {
  background: #fffdf7;
  border: 3px solid #16121f;
  border-radius: 8px;
  box-shadow: 7px 7px 0 #16121f;
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  position: relative;
}

.color-card::before {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.58), transparent 42%),
    var(--slot-color);
  border: 2px solid #16121f;
  border-radius: 6px;
  content: "";
  display: block;
  height: clamp(72px, 12vw, 118px);
}

.color-card span {
  font-size: 0.88rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.color-card strong {
  background: #16121f;
  border-radius: 6px;
  color: #fffdf7;
  display: block;
  font-size: clamp(0.82rem, 1.6vw, 0.98rem);
  letter-spacing: 0;
  line-height: 1;
  overflow-wrap: anywhere;
  padding: 8px 10px;
  text-align: center;
}

.color-card input[type="color"] {
  appearance: none;
  background: transparent;
  border: 0;
  height: 48px;
  inset: 0;
  opacity: 0;
  position: absolute;
  touch-action: manipulation;
  width: 100%;
}

.seconds-card {
  align-items: center;
  background: #fffdf7;
  border: 3px solid #16121f;
  border-radius: 8px;
  box-shadow: 7px 7px 0 #16121f;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 14px;
}

.seconds-card > span {
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.seconds-input {
  align-items: center;
  background: #14d6ff;
  border: 3px solid #16121f;
  border-radius: 8px;
  display: flex;
  min-width: min(190px, 48vw);
  overflow: hidden;
}

.seconds-input input {
  background: #fffdf7;
  border: 0;
  color: #16121f;
  font-size: 1.6rem;
  font-weight: 950;
  min-width: 0;
  outline: 0;
  padding: 10px 12px;
  text-align: center;
  width: 100%;
}

.seconds-input input::-webkit-outer-spin-button,
.seconds-input input::-webkit-inner-spin-button {
  margin: 0;
}

.seconds-input span {
  color: #16121f;
  font-weight: 950;
  padding: 0 14px;
}

.start-button {
  background:
    linear-gradient(90deg, #ff2d75, #ff9b28, #ffe34f, #59f36c, #14d6ff, #713cff);
  border: 3px solid #16121f;
  border-radius: 8px;
  box-shadow: 8px 8px 0 #16121f;
  color: #16121f;
  font-size: clamp(1.45rem, 4vw, 2.3rem);
  font-weight: 1000;
  letter-spacing: 0;
  min-height: 72px;
  text-transform: uppercase;
  transition:
    box-shadow 150ms ease,
    transform 150ms ease;
}

.start-button:hover {
  box-shadow: 5px 5px 0 #16121f;
  transform: translate(3px, 3px);
}

.start-button:active {
  box-shadow: 2px 2px 0 #16121f;
  transform: translate(6px, 6px);
}

.wake-screen {
  --wake-color: #ff2d75;
  --wake-text: #fffaf6;
  --wake-progress: 0%;
  align-items: center;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.24), transparent 35%),
    var(--wake-color);
  color: var(--wake-text);
  display: grid;
  isolation: isolate;
  min-height: 100svh;
  overflow: hidden;
  padding:
    max(clamp(18px, 3vw, 34px), env(safe-area-inset-top))
    max(clamp(18px, 3vw, 34px), env(safe-area-inset-right))
    max(clamp(18px, 3vw, 34px), env(safe-area-inset-bottom))
    max(clamp(18px, 3vw, 34px), env(safe-area-inset-left));
  position: relative;
}

.wake-screen::before,
.wake-screen::after {
  border: clamp(12px, 2vw, 24px) solid currentColor;
  content: "";
  height: 48vmin;
  opacity: 0.14;
  position: absolute;
  rotate: 12deg;
  width: 48vmin;
  z-index: -1;
}

.wake-screen::before {
  left: -16vmin;
  top: 10vmin;
}

.wake-screen::after {
  bottom: -18vmin;
  right: -12vmin;
  rotate: -18deg;
}

.wake-toolbar {
  align-items: center;
  display: flex;
  font-weight: 950;
  justify-content: space-between;
  left: 0;
  letter-spacing: 0;
  padding: clamp(18px, 3vw, 34px);
  position: absolute;
  right: 0;
  text-transform: uppercase;
  top: 0;
}

.wake-toolbar button {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid currentColor;
  border-radius: 8px;
  color: inherit;
  font-weight: 950;
  min-height: 42px;
  padding: 8px 16px;
  text-transform: uppercase;
}

.wake-focus {
  align-items: center;
  display: grid;
  justify-items: center;
  margin: 0 auto;
  max-width: min(720px, 100%);
  position: relative;
  text-align: center;
}

.wake-ring {
  animation: wake-pulse 1.4s ease-in-out infinite;
  border: clamp(8px, 1.4vw, 16px) solid currentColor;
  border-radius: 999px;
  height: min(64vmin, 520px);
  opacity: 0.18;
  position: absolute;
  width: min(64vmin, 520px);
  z-index: -1;
}

.wake-focus p,
.wake-focus span {
  font-weight: 950;
  letter-spacing: 0;
  margin: 0;
  text-transform: uppercase;
}

.wake-focus strong {
  font-size: clamp(8rem, 32vw, 23rem);
  font-weight: 1000;
  letter-spacing: 0;
  line-height: 0.82;
  margin: clamp(18px, 4vw, 34px) 0;
}

.wake-focus span {
  font-size: clamp(1.1rem, 3vw, 2rem);
}

.wake-progress {
  background: rgba(255, 255, 255, 0.26);
  border: 2px solid currentColor;
  border-radius: 8px;
  bottom: clamp(72px, 10vw, 96px);
  height: 18px;
  left: clamp(18px, 4vw, 56px);
  overflow: hidden;
  position: absolute;
  right: clamp(18px, 4vw, 56px);
}

.wake-progress span {
  background: currentColor;
  display: block;
  height: 100%;
  transition: width 80ms linear;
  width: var(--wake-progress);
}

.wake-dots {
  align-items: center;
  bottom: clamp(22px, 4vw, 38px);
  display: flex;
  gap: 12px;
  justify-content: center;
  left: 0;
  position: absolute;
  right: 0;
}

.wake-dots span {
  background: var(--dot-color);
  border: 2px solid currentColor;
  border-radius: 999px;
  height: 22px;
  opacity: 0.45;
  transition:
    opacity 150ms ease,
    transform 150ms ease;
  width: 22px;
}

.wake-dots span.active {
  opacity: 1;
  transform: scale(1.4);
}

@keyframes wake-pulse {
  0%,
  100% {
    transform: scale(0.96);
  }

  50% {
    transform: scale(1.05);
  }
}

@media (max-width: 760px) {
  .app-shell {
    align-items: start;
    padding:
      max(12px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      max(14px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
  }

  .chooser-panel {
    border-width: 2px;
    box-shadow: 4px 4px 0 #16121f;
    min-height: auto;
    width: min(100%, calc(100vw - 28px));
  }

  .chooser-content {
    gap: 16px;
    min-height: auto;
    padding: clamp(16px, 5vw, 24px);
    place-content: start;
  }

  .brand-row {
    align-items: center;
    gap: 12px;
  }

  .brand-row > div {
    min-width: 0;
  }

  .brand-mark {
    border-width: 2px;
    box-shadow: 4px 4px 0 #16121f;
    font-size: 0.95rem;
    height: clamp(46px, 13vw, 56px);
    width: clamp(46px, 13vw, 56px);
  }

  .brand-row p {
    font-size: 0.74rem;
  }

  .brand-row h1 {
    font-size: clamp(2.05rem, 10vw, 3.4rem);
    line-height: 0.92;
    max-width: 100%;
  }

  .color-grid {
    gap: 8px;
    grid-template-columns: repeat(5, calc((100% - 32px) / 5));
    min-width: 0;
  }

  .color-card {
    border-width: 2px;
    box-shadow: 4px 4px 0 #16121f;
    gap: 7px;
    min-height: 112px;
    overflow: hidden;
    padding: 7px;
    width: 100%;
  }

  .color-card::before {
    border-width: 2px;
    height: clamp(44px, 12vw, 62px);
  }

  .color-card span {
    font-size: clamp(0.6rem, 2.1vw, 0.74rem);
    text-align: center;
  }

  .color-card strong {
    font-size: clamp(0.54rem, 1.8vw, 0.68rem);
    padding: 7px 4px;
    white-space: nowrap;
  }

  .seconds-card {
    border-width: 2px;
    box-shadow: 4px 4px 0 #16121f;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) minmax(112px, 38%);
    padding: 10px;
  }

  .seconds-card > span {
    align-self: center;
    font-size: clamp(0.78rem, 3.1vw, 0.9rem);
    line-height: 1.1;
  }

  .seconds-input {
    border-width: 2px;
    min-width: 100%;
  }

  .seconds-input input {
    font-size: 1.35rem;
    min-height: 50px;
    padding: 8px 6px;
  }

  .seconds-input span {
    padding: 0 9px;
  }

  .start-button {
    border-width: 2px;
    box-shadow: 4px 4px 0 #16121f;
    font-size: clamp(1.35rem, 6vw, 1.8rem);
    min-height: 62px;
  }

  .rainbow-arc {
    top: -34px;
    width: min(520px, 128vw);
  }

  .confetti,
  .zigzag {
    opacity: 0.42;
    scale: 0.72;
  }

  .wake-screen {
    padding:
      max(14px, env(safe-area-inset-top))
      max(14px, env(safe-area-inset-right))
      max(14px, env(safe-area-inset-bottom))
      max(14px, env(safe-area-inset-left));
  }

  .wake-toolbar {
    padding:
      max(14px, env(safe-area-inset-top))
      max(14px, env(safe-area-inset-right))
      0
      max(14px, env(safe-area-inset-left));
  }

  .wake-toolbar button {
    min-height: 46px;
    padding: 8px 14px;
  }

  .wake-ring {
    height: min(74vmin, 360px);
    width: min(74vmin, 360px);
  }

  .wake-focus {
    transform: translateY(-2svh);
  }

  .wake-focus strong {
    font-size: clamp(7rem, 38vw, 12rem);
    margin: 18px 0;
  }

  .wake-progress {
    bottom: max(70px, calc(env(safe-area-inset-bottom) + 54px));
    height: 16px;
    left: 16px;
    right: 16px;
  }

  .wake-dots {
    bottom: max(22px, calc(env(safe-area-inset-bottom) + 18px));
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding:
      max(8px, env(safe-area-inset-top))
      max(8px, env(safe-area-inset-right))
      max(10px, env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left));
  }

  .chooser-panel {
    box-shadow: 3px 3px 0 #16121f;
    justify-self: start;
    margin: 0;
    width: min(100%, calc(100vw - 18px), 372px);
  }

  .chooser-content {
    gap: 12px;
    padding: 10px;
  }

  .brand-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .brand-mark {
    height: 42px;
    width: 42px;
  }

  .brand-row h1 {
    font-size: clamp(2.1rem, 10.4vw, 2.55rem);
  }

  .color-grid {
    gap: 6px;
    grid-template-columns: repeat(5, calc((100% - 24px) / 5));
  }

  .color-card {
    box-shadow: 2px 2px 0 #16121f;
    gap: 4px;
    min-height: 72px;
    padding: 4px;
  }

  .color-card::before {
    height: 34px;
  }

  .color-card span {
    font-size: 0.54rem;
  }

  .color-card strong {
    display: none;
  }

  .seconds-card {
    box-shadow: 3px 3px 0 #16121f;
    grid-template-columns: 1fr;
  }

  .start-button {
    box-shadow: 3px 3px 0 #16121f;
    min-height: 58px;
  }

  .wake-focus strong {
    font-size: clamp(6.5rem, 36vw, 9.2rem);
  }
}

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