:root {
  --ink: #113039;
  --paper: #fffaf1;
  --white: #ffffff;
  --aqua: #00a7b7;
  --coral: #ff5a63;
  --pink: #e8398f;
  --sun: #ffd447;
  --leaf: #2e9c67;
  --violet: #7d3a86;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  --hero-image: url("assets/gisele-70-hero.png");
}

@supports (background-image: image-set(url("assets/gisele-70-hero.webp") type("image/webp"))) {
  :root {
    --hero-image: image-set(
      url("assets/gisele-70-hero.webp") type("image/webp"),
      url("assets/gisele-70-hero.png") type("image/png")
    );
  }
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  min-width: 320px;
  min-height: 100svh;
  margin: 0;
  color: var(--white);
  background:
    linear-gradient(180deg, rgba(5, 34, 43, 0.18), rgba(5, 34, 43, 0.9)),
    var(--hero-image) center / cover no-repeat fixed,
    #0b4e58;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.5;
  letter-spacing: 0;
}

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

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

#confetti-canvas {
  position: fixed;
  inset: 0;
  z-index: 8;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.mystery-page {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 100svh;
  padding: clamp(18px, 4vw, 44px);
}

.mystery-stage {
  position: relative;
  display: grid;
  width: min(100%, 1180px);
  min-height: calc(100svh - clamp(36px, 8vw, 88px));
  align-content: center;
  gap: clamp(18px, 3vw, 30px);
  margin: auto;
  isolation: isolate;
}

.mystery-stage::before {
  position: absolute;
  inset: -24px;
  z-index: -2;
  content: "";
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(3, 27, 35, 0.12), rgba(3, 27, 35, 0.46)),
    rgba(3, 27, 35, 0.1);
  backdrop-filter: blur(2px);
}

.idea-cloud {
  position: relative;
  display: flex;
  min-height: clamp(180px, 30vh, 330px);
  align-content: center;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 8px clamp(4px, 2vw, 26px);
}

.idea-cloud:empty::before {
  display: block;
  width: min(100%, 620px);
  content: "";
}

.idea-note {
  --note-color: var(--sun);
  position: relative;
  display: inline-flex;
  max-width: min(340px, 86vw);
  min-height: 42px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 8px;
  padding: 9px 32px 9px 14px;
  background: color-mix(in srgb, var(--note-color) 86%, white 14%);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.18);
  color: var(--ink);
  font-size: 17px;
  font-weight: 850;
  overflow-wrap: anywhere;
  transform: rotate(var(--tilt));
  animation: note-arrival 420ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.idea-note__text {
  display: block;
}

.idea-note__delete {
  position: absolute;
  top: -8px;
  right: -8px;
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  padding: 0;
  background: rgba(17, 48, 57, 0.92);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.24);
  color: #ffffff;
  font-size: 13px;
  font-weight: 950;
  line-height: 1;
  cursor: pointer;
}

.idea-note__delete:hover {
  background: var(--coral);
}

.idea-note__delete:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 2px;
}

.idea-note__delete:disabled {
  cursor: wait;
  opacity: 0.6;
}

.idea-note:nth-child(3n) {
  margin-top: 20px;
}

.idea-note:nth-child(4n) {
  margin-bottom: 18px;
}

.idea-note:nth-child(5n) {
  font-size: 20px;
}

.countdown-panel {
  display: grid;
  justify-items: center;
}

.countdown {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  width: min(100%, 760px);
  gap: 12px;
}

.countdown__item {
  display: grid;
  min-height: 118px;
  align-content: center;
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  padding: 14px 12px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  color: var(--ink);
  text-align: center;
  backdrop-filter: blur(16px);
}

.countdown__item--accent {
  background: rgba(255, 212, 71, 0.96);
}

.countdown__value {
  display: block;
  min-height: 56px;
  font-variant-numeric: tabular-nums;
  font-size: 56px;
  font-weight: 950;
  line-height: 1;
}

.countdown__label {
  color: #36525a;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.idea-box {
  position: relative;
  display: grid;
  width: min(100%, 520px);
  gap: 12px;
  margin: 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  padding: 16px;
  background: rgba(5, 34, 43, 0.62);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(18px);
}

.idea-box::before {
  display: block;
  width: 118px;
  height: 11px;
  margin: 0 auto 2px;
  border-radius: 999px;
  content: "";
  background: linear-gradient(90deg, var(--sun), var(--coral), var(--aqua));
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.2),
    0 12px 24px rgba(0, 0, 0, 0.16);
}

.idea-box__row {
  display: grid;
  grid-template-columns: 1fr 56px;
  gap: 10px;
}

.idea-box input {
  min-width: 0;
  min-height: 50px;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  font-size: 16px;
  font-weight: 750;
  outline: 0;
}

.idea-box input:focus {
  border-color: var(--sun);
  box-shadow: 0 0 0 3px rgba(255, 212, 71, 0.28);
}

.idea-box input::placeholder {
  color: rgba(17, 48, 57, 0.54);
}

.button {
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  padding: 12px 18px;
  background: var(--coral);
  box-shadow: 0 16px 34px rgba(255, 90, 99, 0.34);
  color: #ffffff;
  font-size: 30px;
  font-weight: 900;
  line-height: 1.1;
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.button:hover {
  background: #ff4653;
  transform: translateY(-2px);
}

.button:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
}

.button:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 3px;
}

body.is-finished .countdown__item--accent {
  background: rgba(255, 90, 99, 0.96);
  color: #ffffff;
}

@keyframes note-arrival {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.9) rotate(var(--tilt));
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(var(--tilt));
  }
}

@media (max-width: 760px) {
  body {
    background:
      linear-gradient(180deg, rgba(5, 34, 43, 0.1), rgba(5, 34, 43, 0.92) 48%),
      var(--hero-image) center top / auto 48vh no-repeat fixed,
      linear-gradient(180deg, #0aa4b2, #113039);
  }

  .mystery-page {
    padding: 14px;
  }

  .mystery-stage {
    min-height: calc(100svh - 28px);
    align-content: end;
  }

  .mystery-stage::before {
    inset: -14px;
    border-radius: 14px;
  }

  .idea-cloud {
    min-height: 210px;
    align-content: end;
    gap: 8px;
    padding: 90px 0 0;
  }

  .idea-note {
    max-width: 100%;
    min-height: 36px;
    padding: 8px 30px 8px 11px;
    font-size: 13px;
  }

  .idea-note__delete {
    width: 24px;
    height: 24px;
    font-size: 14px;
  }

  .countdown {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .countdown__item {
    min-height: 92px;
    padding: 10px 8px;
  }

  .countdown__value {
    min-height: 42px;
    font-size: 36px;
  }

  .countdown__label {
    font-size: 11px;
  }

  .idea-box {
    padding: 14px;
  }

  .idea-box__row {
    grid-template-columns: 1fr;
  }

  .button,
  .idea-box input {
    width: 100%;
  }
}

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

  #confetti-canvas {
    display: none;
  }
}
