/* ═══════════════════════════════════════════════════════
   Birthday Retro — Windows 98 Birthday Card
   Pure CSS design system
═══════════════════════════════════════════════════════ */

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Tokens ── */
:root {
  --desktop:    #008080;
  --gray:       #d4d0c8;
  --white:      #ffffff;
  --black:      #000000;
  --dark:       #808080;
  --shadow:     #404040;
  --blue:       #000082;
  --titlebar:   linear-gradient(90deg, #000082 0%, #1b5fd9 100%);
  --titlebar-party: linear-gradient(90deg, #9b1dea 0%, #ff4da6 50%, #ff8c42 100%);
  --titlebar-error: linear-gradient(90deg, #8b0000 0%, #cc2222 100%);
  --font:       'VT323', 'Courier New', monospace;
  --font-pill:  'Fredoka', 'VT323', sans-serif;

  --raise: inset -1px -1px 0 #808080,
           inset  1px  1px 0 #ffffff,
           inset -2px -2px 0 #404040,
           inset  2px  2px 0 #d4d0c8;
  --sink:  inset  1px  1px 0 #808080,
           inset -1px -1px 0 #ffffff,
           inset  2px  2px 0 #404040,
           inset -2px -2px 0 #d4d0c8;
}

/* ── Body ── */
body {
  background: var(--desktop);
  font-family: var(--font);
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ═══════════════════════════════════════════════
   TASKBAR
═══════════════════════════════════════════════ */
#taskbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 36px;
  background: var(--gray);
  box-shadow: var(--raise);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px;
  z-index: 9999;
  font-family: var(--font);
  font-size: 1.05rem;
}
#start-btn {
  display: flex; align-items: center; gap: 4px;
  background: var(--gray);
  box-shadow: var(--raise);
  border: none;
  padding: 2px 10px 2px 6px;
  font-family: var(--font);
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  height: 26px;
  flex-shrink: 0;
}
#start-btn:active { box-shadow: var(--sink); }

.taskbar-sep {
  width: 2px; height: 26px;
  box-shadow: inset -1px 0 0 #fff, inset 1px 0 0 #808080;
  flex-shrink: 0;
}
.taskbar-win {
  height: 26px;
  padding: 2px 10px;
  background: var(--gray);
  box-shadow: var(--sink);
  border: none;
  font-family: var(--font);
  font-size: 1rem;
  cursor: default;
  white-space: nowrap;
  overflow: hidden;
  max-width: 220px;
  text-overflow: ellipsis;
}
#taskbar-clock {
  margin-left: auto;
  padding: 2px 10px;
  background: var(--gray);
  box-shadow: var(--sink);
  font-family: var(--font);
  font-size: 1rem;
  min-width: 58px; text-align: center;
  height: 26px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════
   STAGES — Full screen containers
═══════════════════════════════════════════════ */
.stage {
  position: fixed;
  inset: 0;
  bottom: 36px; /* above taskbar */
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 10;
  padding: 16px;
  overflow-y: auto;
}
.stage.active {
  display: flex;
}

/* ═══════════════════════════════════════════════
   WINDOWS DIALOG BASE
═══════════════════════════════════════════════ */
.win-dialog {
  background: var(--gray);
  box-shadow: var(--raise), 3px 3px 0 rgba(0,0,0,0.4);
  width: min(480px, 94vw);
  display: flex;
  flex-direction: column;
  user-select: none;
  animation: winOpen 0.2s ease-out;
}

@keyframes winOpen {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.win-titlebar {
  background: var(--titlebar);
  color: #fff;
  font-family: var(--font);
  font-size: 1.1rem;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #000;
  flex-shrink: 0;
}
.win-titlebar-text { flex: 1; white-space: nowrap; overflow: hidden; }
.win-controls {
  font-size: 0.9rem;
  letter-spacing: 2px;
  flex-shrink: 0;
  pointer-events: none;
}

.titlebar-party { background: var(--titlebar-party); }
.titlebar-error { background: var(--titlebar-error); }

.win-menubar {
  background: var(--gray);
  font-family: var(--font);
  font-size: 0.95rem;
  color: var(--black);
  padding: 3px 8px;
  border-bottom: 1px solid #808080;
}

.win-body {
  background: var(--white);
  padding: 20px 24px;
  flex: 1;
}

.win-statusbar {
  background: var(--gray);
  border-top: 2px solid;
  border-color: #808080 #fff #fff #808080;
  font-family: var(--font);
  font-size: 0.85rem;
  color: var(--black);
  padding: 3px 10px;
  display: flex;
  justify-content: space-between;
}

/* ═══════════════════════════════════════════════
   WINDOWS BUTTONS
═══════════════════════════════════════════════ */
.win-btn {
  font-family: var(--font);
  font-size: 1.05rem;
  background: var(--gray);
  color: var(--black);
  border: none;
  box-shadow: var(--raise);
  padding: 4px 20px;
  cursor: pointer;
  letter-spacing: 0.02em;
  min-width: 80px;
  text-align: center;
}
.win-btn:active { box-shadow: var(--sink); padding: 5px 19px 3px 21px; }
.win-btn:focus-visible { outline: 1px dotted #000; outline-offset: -4px; }

.win-btn-pill {
  font-family: var(--font-pill);
  font-weight: 600;
  font-size: 1rem;
  background: var(--white);
  color: var(--black);
  border: 2px solid var(--black);
  border-radius: 999px;
  box-shadow: none;
  padding: 6px 24px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.win-btn-pill:hover { background: #f0f0f0; }
.win-btn-pill:active { transform: scale(0.96); box-shadow: none; padding: 6px 24px; }

.win-btn-accent {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.win-btn-accent:hover { background: #0000a8; }

/* ═══════════════════════════════════════════════
   STAGE 1 — Welcome
═══════════════════════════════════════════════ */
#stage-1 {
  background:
    radial-gradient(2px 2px at 20% 30%, #ffe98a 60%, transparent 100%),
    radial-gradient(2px 2px at 80% 15%, #fff 60%, transparent 100%),
    radial-gradient(1.5px 1.5px at 50% 60%, #ffe98a 60%, transparent 100%),
    radial-gradient(2px 2px at 10% 80%, #fff 60%, transparent 100%),
    radial-gradient(1.5px 1.5px at 90% 70%, #ffe98a 60%, transparent 100%),
    radial-gradient(2px 2px at 35% 90%, #fff 60%, transparent 100%),
    radial-gradient(1px 1px at 65% 45%, #ffe98a 60%, transparent 100%),
    var(--desktop);
}

.stage1-dialog { width: min(440px, 92vw); }

.stage1-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 28px 24px 20px;
  gap: 16px;
}

.stage1-heading {
  font-family: var(--font);
  font-size: 2rem;
  color: var(--black);
  min-height: 2.4em;
  line-height: 1.2;
}

.stage1-character {
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.stage1-character.visible {
  opacity: 1;
  transform: translateY(0);
}

.pixel-cake {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.cake-gif { width: 140px; height: auto; margin-bottom: 8px; }
.cake-sparkle {
  font-size: 1.2rem;
  animation: sparkle 1.5s ease-in-out infinite;
  letter-spacing: 0.3em;
}
@keyframes sparkle {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(1.15); }
}

/* ═══════════════════════════════════════════════
   STAGE 2 — Surprise question
═══════════════════════════════════════════════ */
#stage-2 {
  background:
    radial-gradient(2px 2px at 25% 20%, #ffe98a 60%, transparent 100%),
    radial-gradient(1.5px 1.5px at 75% 40%, #fff 60%, transparent 100%),
    radial-gradient(2px 2px at 45% 85%, #ffe98a 60%, transparent 100%),
    radial-gradient(1.5px 1.5px at 15% 60%, #fff 60%, transparent 100%),
    radial-gradient(2px 2px at 85% 80%, #ffe98a 60%, transparent 100%),
    var(--desktop);
  gap: 16px;
}

.stage2-dialog { width: min(420px, 92vw); }

.stage2-body {
  display: flex;
  gap: 16px;
  padding: 20px;
  align-items: flex-start;
}

.stage2-icon {
  font-size: 2.8rem;
  flex-shrink: 0;
  animation: iconBounce 2s ease-in-out infinite;
}
@keyframes iconBounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

.stage2-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.stage2-question {
  font-family: var(--font);
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--black);
  line-height: 1.4;
  white-space: pre-line;
  min-height: 3em;
}

.stage2-buttons {
  display: flex;
  gap: 10px;
}

.stage2-gif-area {
  display: flex;
  align-items: center;
  justify-content: center;
}

.pixel-bunny {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.bunny-bounce {
  font-size: 4rem;
  animation: bunnyHop 1.8s ease-in-out infinite;
  display: inline-block;
}
@keyframes bunnyHop {
  0%, 100% { transform: translateY(0) rotate(0); }
  25%      { transform: translateY(-14px) rotate(-5deg); }
  75%      { transform: translateY(-14px) rotate(5deg); }
}
.bunny-text {
  font-family: var(--font);
  font-size: 1.1rem;
  color: #fff;
  text-shadow: 1px 1px 0 #000;
}

/* ═══════════════════════════════════════════════
   STAGE 3 — Gift box
═══════════════════════════════════════════════ */
#stage-3 {
  background:
    linear-gradient(135deg, rgba(255,100,150,0.15) 0%, transparent 50%),
    linear-gradient(225deg, rgba(100,150,255,0.15) 0%, transparent 50%),
    var(--desktop);
}
.stage3-bg-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(255,255,255,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.stage3-dialog { width: min(400px, 92vw); z-index: 1; }

.stage3-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 24px 24px;
  gap: 16px;
}

.stage3-instruction {
  font-family: var(--font);
  font-size: 1.1rem;
  color: var(--dark);
}

.stage3-gift-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px;
  transition: transform 0.15s;
}
.stage3-gift-btn:hover { transform: scale(1.08); }
.stage3-gift-btn:active { transform: scale(0.95); }

.gift-box {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.gift-lid {
  font-size: 2.5rem;
  animation: lidWobble 2s ease-in-out infinite;
  transform-origin: center bottom;
}
@keyframes lidWobble {
  0%, 100% { transform: rotate(0); }
  25%      { transform: rotate(-6deg); }
  75%      { transform: rotate(6deg); }
}
.gift-base { font-size: 5rem; line-height: 1; }

.gift-label {
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--blue);
  text-decoration: underline;
}

/* ═══════════════════════════════════════════════
   STAGE 4 — Reveal + confetti
═══════════════════════════════════════════════ */
#stage-4 {
  background:
    linear-gradient(135deg, rgba(155,29,234,0.12) 0%, transparent 50%),
    linear-gradient(225deg, rgba(255,77,166,0.12) 0%, transparent 50%),
    var(--desktop);
}
#confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
}

.stage4-dialog { width: min(420px, 92vw); z-index: 10; }

.stage4-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px;
  gap: 16px;
}

.stage4-title {
  font-family: var(--font);
  font-size: 1.5rem;
  color: var(--black);
  min-height: 1.8em;
}

.stage4-reveal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.reveal-gif {
  width: 140px;
  height: auto;
  animation: revealPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes revealPop {
  from { transform: scale(0) rotate(-20deg); opacity: 0; }
  to   { transform: scale(1) rotate(0);      opacity: 1; }
}
.reveal-sparkle {
  font-size: 1.5rem;
  animation: sparkle 1.2s ease-in-out infinite;
}

/* ═══════════════════════════════════════════════
   STAGE 5 — Birthday wishes (Notepad)
═══════════════════════════════════════════════ */
#stage-5 {
  background:
    radial-gradient(circle at 10% 20%, rgba(255,200,100,0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(100,200,255,0.08) 0%, transparent 40%),
    var(--desktop);
}

.stage5-dialog {
  width: min(560px, 94vw);
  max-height: calc(100% - 60px);
  display: flex;
  flex-direction: column;
  margin: auto 0; /* Keeps it centered but allows scroll from top if too long */
}

.stage5-body {
  padding: 0;
  overflow-y: auto;
  flex: 1;
}

.stage5-notepad {
  font-family: var(--font);
  font-size: 1.25rem;
  line-height: 1.75;
  color: var(--black);
  padding: 14px 18px;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 200px;
}

/* Blinking cursor for notepad typing */
.notepad-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--black);
  vertical-align: text-bottom;
  margin-left: 1px;
  animation: cursorBlink 0.6s step-end infinite;
}
@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

/* ═══════════════════════════════════════════════
   NO THANKS DIALOG
═══════════════════════════════════════════════ */
.no-dialog-box { width: min(360px, 90vw); }

.no-body {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 20px;
}
.no-icon { font-size: 2.5rem; flex-shrink: 0; }
.no-text {
  font-family: var(--font);
  font-size: 1.1rem;
  color: var(--black);
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════
   UTILITIES / ANIMATIONS
═══════════════════════════════════════════════ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in-up {
  animation: fadeInUp 0.4s ease-out forwards;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .stage1-heading  { font-size: 1.5rem; }
  .cake-top        { font-size: 3.5rem; }
  .stage2-question { font-size: 1.2rem; }
  .stage5-notepad  { font-size: 1.1rem; padding: 12px 14px; }
  .win-body        { padding: 14px 16px; }
  
  /* Specifically for stage 5 mobile when long text exists */
  .stage5-dialog   { max-height: 75%; margin-top: 10px; }
  #stage5-secret-btn-wrap { margin-bottom: 20px; }
}

/* ═══════════════════════════════════════════════
   CD PLAYER
═══════════════════════════════════════════════ */
.music-dialog {
  width: min(340px, 90vw);
}
.cdplayer-body {
  padding: 16px;
  background: var(--gray);
}
.cdplayer-top {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}
.cdplayer-lcd {
  background: #000;
  color: #00ff00;
  padding: 8px 12px;
  flex: 1;
  box-shadow: var(--sink);
  font-family: 'Courier New', Courier, monospace;
}
.lcd-track {
  font-size: 0.9rem;
  margin-bottom: 4px;
}
.lcd-time {
  font-size: 2.2rem;
  font-weight: bold;
}
.cdplayer-disc-icon {
  width: 64px;
  height: 64px;
  background: var(--gray);
  box-shadow: var(--sink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}
.spinning-cd {
  animation: spin 3s linear infinite;
}
.spinning-cd.paused {
  animation-play-state: paused;
}
@keyframes spin {
  100% { transform: rotate(360deg); }
}

.cdplayer-controls {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  justify-content: space-between;
}
.cd-btn {
  padding: 4px 0;
  font-size: 1rem;
  min-width: 40px;
  flex: 1;
}

/* Volume control row */
.cdplayer-volume {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  background: var(--gray);
  box-shadow: var(--sink);
  padding: 6px 8px;
}
.vol-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  line-height: 1;
  user-select: none;
  cursor: pointer;
  transition: transform 0.1s;
}
.vol-icon:active { transform: scale(0.88); }
.vol-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  background: #fff;
  box-shadow: var(--sink);
  border: none;
  outline: none;
  cursor: pointer;
}
.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 20px;
  background: var(--gray);
  box-shadow: var(--raise);
  cursor: pointer;
}
.vol-slider::-moz-range-thumb {
  width: 14px;
  height: 20px;
  background: var(--gray);
  box-shadow: var(--raise);
  border: none;
  cursor: pointer;
  border-radius: 0;
}
.vol-pct {
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  color: var(--black);
  min-width: 36px;
  text-align: right;
  flex-shrink: 0;
}

.cdplayer-info {
  background: var(--white);
  box-shadow: var(--sink);
  padding: 6px 10px;
  font-size: 1rem;
  color: var(--black);
  height: 52px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  line-height: 1.4;
}

#stage-music {
  background:
    radial-gradient(2px 2px at 20% 30%, #a8e6cf 60%, transparent 100%),
    radial-gradient(1.5px 1.5px at 80% 15%, #fff 60%, transparent 100%),
    radial-gradient(2px 2px at 50% 60%, #a8e6cf 60%, transparent 100%),
    radial-gradient(1.5px 1.5px at 10% 80%, #fff 60%, transparent 100%),
    radial-gradient(2px 2px at 90% 70%, #a8e6cf 60%, transparent 100%),
    var(--desktop);
  gap: 0;
}
.music-gif-area {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -20px;
}
.pixel-cat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.cat-bounce {
  font-size: 4rem;
  animation: catGroove 1.2s ease-in-out infinite alternate;
  display: inline-block;
  transform-origin: bottom center;
}
@keyframes catGroove {
  0% { transform: scaleY(0.9) rotate(-4deg); }
  100% { transform: scaleY(1.05) rotate(4deg); }
}
.cat-text {
  font-family: var(--font);
  font-size: 1.1rem;
  color: #fff;
  text-shadow: 1px 1px 0 #000;
}

/* Fix close button on secret memory modal for mobile */
#btn-close-memory {
  pointer-events: auto !important;
  cursor: pointer;
  padding: 8px;
  margin: -8px;
  font-size: 1.1rem;
}


