/* ============ colors ============ */
:root {
  --panel: rgba(8, 6, 10, 0.92);   /* the dark boxes / tabs */
  --panel-solid: #0a080c;
  --text: #f6eef4;                 /* light text on the dark boxes */
  --dim: #a89aa8;
  --pink: #ff8fc2;
  --lilac: #b9a4ff;
  --line: #3a2f3c;
  --font: "Courier New", Courier, "Lucida Console", monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
}

html {
  background: #000;
}

body {
  color: var(--text);
  font-family: var(--font);
  /* keeps every letter lowercase, always */
  text-transform: lowercase;
  overflow: hidden;
}

button {
  font-family: var(--font);
  text-transform: lowercase;
}

::selection {
  background: var(--pink);
  color: #000;
}

.hidden {
  display: none !important;
}

.invisible {
  visibility: hidden;
}

/* ============ background photo (no filter, exactly as it is) ============ */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: #000 url("bg.png") center / cover no-repeat;
}

/* ============ twinkly sparkles ============ */
.stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.star {
  position: absolute;
  color: #fff;
  text-shadow: 0 0 6px rgba(255, 143, 194, 0.9);
  animation: twinkle ease-in-out infinite;
  user-select: none;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.2; }
  50%      { opacity: 1; }
}

/* ============ screens (one at a time, no long scrolling page) ============ */
.screen {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: none;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* bottom padding leaves room for the music button */
  padding: calc(20px + env(safe-area-inset-top)) 4vw calc(64px + env(safe-area-inset-bottom));
  opacity: 0;
  transition: opacity 0.5s ease;
}

#enterScreen {
  cursor: pointer;
}

.screen.active {
  display: flex;
}

.screen.visible {
  opacity: 1;
}

/* margin:auto centers it, but still lets it scroll if a small phone needs to */
.screen-inner {
  margin: auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ============ retro window (dark) ============ */
.window {
  position: relative;
  width: 100%;
  border: 2px solid var(--pink);
  background: var(--panel);
  box-shadow: 6px 6px 0 var(--pink);
  max-width: 1100px;
}

.window-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #000;
  color: var(--pink);
  padding: 6px 12px;
  font-weight: 700;
  font-size: clamp(0.9rem, 1.6vw, 1.15rem);
  border-bottom: 2px solid var(--pink);
}

.window-btns {
  letter-spacing: 0.1em;
  font-size: 0.85em;
}

.window-body {
  padding: clamp(16px, 3vw, 30px);
}

/* ============ gates (phone / not installed) ============ */
.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

/* phones: all black, just the text */
.gate-mobile {
  background: #000;
  color: #fff;
  font-weight: 700;
  font-size: clamp(1.3rem, 6vw, 2rem);
  line-height: 1.5;
}

.install-icon {
  display: block;
  width: 96px;
  height: 96px;
  margin: 0 auto 18px;
  border: 2px solid var(--pink);
}

.install-title {
  font-weight: 700;
  font-size: clamp(1.2rem, 2.6vw, 1.6rem);
  margin-bottom: 10px;
}

.install-sub {
  color: var(--dim);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 26px;
}

.install-help {
  margin-top: 24px;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.7;
  white-space: pre-line;
  border-top: 1px dashed var(--pink);
  padding-top: 18px;
}

/* ============ intro: tap to enter ============ */
.enter-box {
  background: var(--panel);
  color: var(--text);
  border: 2px solid var(--pink);
  box-shadow: 6px 6px 0 var(--pink);
  padding: clamp(26px, 5vw, 44px) clamp(30px, 7vw, 70px);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: float 2.6s ease-in-out infinite;
}

.enter-box:hover {
  background: var(--pink);
  color: #000;
}

.enter-face {
  color: var(--pink);
  font-size: clamp(1.5rem, 4vw, 2.2rem);
}

.enter-box:hover .enter-face {
  color: #000;
}

.enter-text {
  font-weight: 700;
  font-size: clamp(1.4rem, 4.5vw, 2.4rem);
  animation: blink 1.2s steps(1) infinite;
}

.enter-hint {
  font-size: 0.85rem;
  opacity: 0.7;
}

/* ============ intro windows ============ */
.intro-window {
  max-width: 560px;
}

.intro-body {
  text-align: center;
  padding: clamp(24px, 5vw, 40px) clamp(18px, 4vw, 36px);
}

.typed {
  font-weight: 700;
  font-size: clamp(1.3rem, 4vw, 2rem);
  line-height: 1.5;
  min-height: 3em;
}

.cursor {
  color: var(--pink);
  animation: blink 0.8s steps(1) infinite;
}

.ok-btn {
  margin-top: 26px;
}

.ok-btn.pop-in {
  visibility: visible;
  animation: pop 0.25s steps(3) both;
}

.intro-face {
  color: var(--pink);
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  margin-bottom: 10px;
}

.intro-question {
  font-weight: 700;
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  margin-bottom: 30px;
}

.intro-buttons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  min-height: 60px;
}

.answer-btn {
  font-weight: 700;
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  padding: 12px 28px;
  cursor: pointer;
  border: 2px solid var(--pink);
}

.yes-btn {
  background: var(--pink);
  color: #000;
  box-shadow: 4px 4px 0 #fff;
  transition: transform 0.2s ease;
}

.yes-btn:hover {
  background: #fff;
}

.no-btn {
  background: var(--panel-solid);
  color: var(--text);
  z-index: 60;
}

/* once it starts running away, it's free to fly anywhere on the screen */
.no-btn.running {
  position: fixed;
  margin: 0;
  /* teleports instantly — so it never flies across the yes button */
  transition: none;
}

.yay-img {
  display: block;
  max-width: 100%;
  max-height: 45vh;
  margin: 0 auto 18px;
  animation: pop 0.35s ease both;
}

.yay-text {
  font-weight: 700;
  font-size: clamp(2rem, 7vw, 3.6rem);
  color: var(--pink);
}

.yay-text span {
  display: inline-block;
  animation: wave 1.2s ease-in-out infinite;
}

/* ============ music button ============ */
.music-btn {
  position: fixed;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 40;
  font-weight: 700;
  font-size: 0.85rem;
  background: var(--panel-solid);
  color: var(--pink);
  border: 1px solid var(--pink);
  padding: 8px 12px;
  cursor: pointer;
}

.music-btn:hover {
  background: var(--pink);
  color: #000;
}

/* ============ home: the timer ============ */
.home-inner {
  text-align: center;
}

.cats-sticker {
  display: block;
  height: clamp(120px, 26vh, 290px);
  width: auto;
  max-width: 85vw;
  object-fit: contain;
  margin-bottom: 1.2vh;
  animation: wiggle 2.4s ease-in-out infinite;
  filter: drop-shadow(3px 3px 0 rgba(0, 0, 0, 0.35));
}

@keyframes wiggle {
  0%, 100% { transform: rotate(-4deg); }
  50%      { transform: rotate(4deg); }
}

.timer-title {
  font-weight: 700;
  font-size: clamp(1.1rem, 3vw, 2.4rem);
  color: var(--text);
  letter-spacing: 0.04em;
  margin-bottom: 3vh;
  background: var(--panel);
  border: 2px solid var(--pink);
  box-shadow: 5px 5px 0 var(--pink);
  padding: 8px 20px;
}

.timer-title::after {
  content: "_";
  margin-left: 4px;
  color: var(--pink);
  animation: blink 1s steps(1) infinite;
}

.timer {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 1.5vw;
  width: 100%;
}

.unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

/* white numbers with a dark outline + pink shadow so they read on any photo */
.num {
  font-weight: 700;
  font-size: min(12vw, 19vh);
  line-height: 1;
  color: #fff;
  font-variant-numeric: tabular-nums;
  -webkit-text-stroke: 2px #000;
  paint-order: stroke fill;
  text-shadow: 5px 5px 0 var(--pink);
}

.num.tick {
  animation: tick 0.3s ease;
}

@keyframes tick {
  0%   { transform: translateY(-4px); opacity: 0.7; }
  100% { transform: translateY(0); opacity: 1; }
}

.lbl {
  margin-top: 1.4vh;
  font-size: clamp(0.75rem, 1.3vw, 1.1rem);
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.2em;
  background: var(--panel);
  border: 1px solid var(--pink);
  padding: 3px 10px;
}

.colon {
  font-weight: 700;
  font-size: min(10vw, 16vh);
  line-height: 1;
  color: var(--pink);
  -webkit-text-stroke: 2px #000;
  paint-order: stroke fill;
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  0%, 49%   { opacity: 1; }
  50%, 100% { opacity: 0.2; }
}

.since {
  margin-top: 3vh;
  font-size: clamp(0.8rem, 1.4vw, 1.1rem);
  color: var(--text);
  background: var(--panel);
  padding: 4px 14px;
  border: 1px dashed var(--pink);
}

.milestone {
  margin-top: 10px;
  font-size: clamp(0.9rem, 1.6vw, 1.2rem);
  color: var(--pink);
  font-weight: 700;
  background: var(--panel);
  padding: 4px 14px;
}

.milestone:empty {
  display: none;
}

/* ============ aaaaaaand ============ */
.aaand {
  font-weight: 700;
  font-size: clamp(2rem, min(6vw, 9vh), 5rem);
  color: #fff;
  -webkit-text-stroke: 2px #000;
  paint-order: stroke fill;
  text-shadow: 4px 4px 0 var(--lilac);
  margin-top: 2.5vh;
  line-height: 1.2;
}

.aaand span {
  display: inline-block;
  animation: wave 1.8s ease-in-out infinite;
}

@keyframes wave {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}

.more-btn {
  margin-top: 2.5vh;
  font-weight: 700;
  font-size: clamp(1rem, 2vw, 1.4rem);
  background: var(--panel);
  color: var(--text);
  border: 2px solid var(--pink);
  box-shadow: 5px 5px 0 var(--pink);
  padding: 14px 30px;
  cursor: pointer;
  animation: float 2.6s ease-in-out infinite;
}

.more-btn:hover,
.more-btn:focus-visible {
  background: var(--pink);
  color: #000;
  outline: none;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

/* ============ more screen ============ */
.back-btn {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top));
  left: 14px;
  z-index: 20;
  font-weight: 700;
  font-size: clamp(0.95rem, 1.6vw, 1.15rem);
  background: var(--panel-solid);
  color: var(--pink);
  border: 2px solid var(--pink);
  box-shadow: 3px 3px 0 var(--pink);
  padding: 8px 14px;
  cursor: pointer;
}

.back-btn:hover {
  background: var(--pink);
  color: #000;
}

.more-inner {
  padding-top: 50px;
}

/* ============ read these when cards ============ */
.letters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.letter {
  text-align: center;
  background: #000;
  color: var(--text);
  border: 1px dashed var(--pink);
  padding: 12px;
  cursor: pointer;
  font-size: clamp(0.9rem, 1.4vw, 1.05rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}

.letter-img {
  width: 100%;
  height: clamp(70px, 15vh, 150px);
  object-fit: contain;
}

.letter .label {
  font-weight: 700;
}

.letter .state {
  color: var(--dim);
  font-size: 0.8em;
}

.letter:hover,
.letter:focus-visible {
  background: var(--pink);
  color: #000;
  outline: none;
}

.letter:hover .state,
.letter:focus-visible .state {
  color: #000;
}

.letter.opened {
  border-style: solid;
  border-color: var(--line);
}

/* ============ special letter button ============ */
.special-btn {
  margin-top: 34px;
  background: var(--panel);
  color: var(--text);
  border: 2px solid var(--lilac);
  box-shadow: 6px 6px 0 var(--lilac);
  padding: 18px 36px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  animation: float 2.6s ease-in-out infinite;
}

.special-btn:hover,
.special-btn:focus-visible {
  background: var(--lilac);
  color: #000;
  outline: none;
}

.special-face {
  color: var(--lilac);
  font-size: clamp(0.95rem, 2vw, 1.2rem);
  white-space: nowrap;
}

.special-btn:hover .special-face {
  color: #000;
}

.special-text {
  font-weight: 700;
  font-size: clamp(1.1rem, 2.4vw, 1.6rem);
}

/* ============ footer ============ */
.footer {
  text-align: center;
  color: var(--text);
  font-size: 0.85rem;
  margin-top: 30px;
  background: var(--panel);
  border: 1px dashed var(--pink);
  padding: 6px 14px;
}

/* ============ modals ============ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px 24px;
}

.modal .window {
  background: var(--panel-solid);
}

.modal-window {
  max-width: 560px;
  animation: pop 0.2s steps(3) both;
}

.close-x {
  font-weight: 700;
  background: none;
  border: none;
  color: var(--pink);
  cursor: pointer;
  font-size: 1em;
}

.modal-img {
  display: block;
  max-width: 100%;
  max-height: 30vh;
  margin: 0 auto 16px;
  object-fit: contain;
}

.modal-text {
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  line-height: 1.7;
  white-space: pre-line;
  text-align: center;
}

.retro-btn {
  display: block;
  margin: 22px auto 0;
  font-weight: 700;
  font-size: 1rem;
  background: #000;
  color: var(--pink);
  border: 1px solid var(--pink);
  padding: 10px 18px;
  cursor: pointer;
}

.retro-btn:hover {
  background: var(--pink);
  color: #000;
}

/* ============ the special letter (big, no animations) ============ */
.big-letter-window {
  max-width: 900px;
  height: 100%;
  max-height: 900px;
  display: flex;
  flex-direction: column;
  border-color: var(--lilac);
  box-shadow: 8px 8px 0 var(--lilac);
}

.big-letter-window .window-bar {
  color: var(--lilac);
  border-bottom-color: var(--lilac);
}

.big-letter-window .close-x {
  color: var(--lilac);
}

.big-letter-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* extra room at the bottom so the stickers never cover the words */
  padding-bottom: clamp(110px, 18vh, 190px);
  /* faint notebook lines */
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 31px,
      rgba(185, 164, 255, 0.12) 31px,
      rgba(185, 164, 255, 0.12) 32px
    ),
    var(--panel-solid);
  /* inner dashed frame */
  outline: 1px dashed rgba(255, 143, 194, 0.5);
  outline-offset: -10px;
}

.letter-deco {
  text-align: center;
  color: var(--pink);
  font-size: clamp(0.85rem, 1.6vw, 1rem);
  margin: 6px 0 20px;
  white-space: nowrap;
  overflow: hidden;
}

.big-letter {
  max-width: 720px;
  margin: 0 auto;
}

.big-letter p {
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  line-height: 1.8;
  margin-bottom: 1.2em;
}

.big-letter .greeting {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--pink);
}

.big-letter .signature {
  text-align: right;
  font-weight: 700;
  color: var(--pink);
  margin-bottom: 0.2em;
  margin-top: 1.6em;
}

.big-letter .date {
  text-align: right;
  color: var(--dim);
  font-size: 0.9rem;
}

/* washi tape on the top corners */
.tape {
  position: absolute;
  top: -22px;
  width: 110px;
  height: 26px;
  z-index: 2;
  pointer-events: none;
  background: repeating-linear-gradient(
    45deg,
    rgba(255, 143, 194, 0.85) 0,
    rgba(255, 143, 194, 0.85) 8px,
    rgba(255, 210, 230, 0.85) 8px,
    rgba(255, 210, 230, 0.85) 16px
  );
}

.tape-left {
  left: -62px;
  transform: rotate(-30deg);
}

.tape-right {
  right: -62px;
  transform: rotate(30deg);
  background: repeating-linear-gradient(
    45deg,
    rgba(185, 164, 255, 0.85) 0,
    rgba(185, 164, 255, 0.85) 8px,
    rgba(225, 215, 255, 0.85) 8px,
    rgba(225, 215, 255, 0.85) 16px
  );
}

/* stickers on the bottom corners of the letter */
.letter-sticker {
  position: absolute;
  bottom: -18px;
  width: clamp(90px, 16vw, 180px);
  height: auto;
  z-index: 3;
  pointer-events: none;
  filter: drop-shadow(3px 3px 0 rgba(0, 0, 0, 0.4));
}

.sticker-left {
  left: -18px;
  transform: rotate(-8deg);
}

.sticker-right {
  right: -18px;
  transform: rotate(8deg);
}

@keyframes pop {
  from { transform: scale(0.9); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* ============ phones ============ */
@media (max-width: 700px) {
  .timer {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5vh 4vw;
  }

  .colon {
    display: none;
  }

  .num {
    font-size: min(20vw, 10.5vh);
  }

  .letters {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .letter-img {
    height: clamp(60px, 11vh, 110px);
  }

  .letter-sticker {
    width: 80px;
    bottom: -12px;
  }

  .sticker-left { left: -10px; }
  .sticker-right { right: -10px; }

  .tape {
    width: 70px;
    height: 18px;
    top: -16px;
  }

  .tape-left { left: -34px; }
  .tape-right { right: -34px; }
}

/* hide the sparkles behind the black phone screen */
body.is-mobile .stars,
body.is-mobile .bg {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}