:root {
  color-scheme: light;
  --ink: #211b4a;
  --midnight: #11103b;
  --midnight-light: #1b1a54;
  --line: #211b4a;
  --cream: #fff8ed;
  --pink: #f4a0bf;
  --coral: #f17e95;
  --mint: #a9e99b;
  --lilac: #afa3ff;
  --cyan: #79e3e9;
  --shadow: #09092b;
  font-family: 'Trebuchet MS', ui-rounded, system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* { box-sizing: border-box; }

html { min-width: 320px; min-height: 100%; background: var(--midnight); }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 50% 39%, rgba(68, 67, 145, .44), transparent 45%),
    linear-gradient(180deg, #12113f 0%, #101039 68%, #0b0a2f 100%);
}

button { font: inherit; }
button:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }

.sky { position: fixed; inset: 0; overflow: hidden; pointer-events: none; color: #d8d1ff; }
.sky-star { position: absolute; font-family: Georgia, serif; opacity: .7; animation: twinkle 3.2s ease-in-out infinite alternate; }
.star-one { top: 11%; left: 12%; font-size: 20px; }
.star-two { top: 19%; right: 13%; font-size: 25px; animation-delay: .8s; }
.star-three { bottom: 18%; left: 17%; font-size: 16px; animation-delay: 1.5s; }
.star-four { bottom: 15%; right: 16%; font-size: 23px; animation-delay: .3s; }
.sky-dot { position: absolute; width: 4px; height: 4px; background: #f9a6cd; box-shadow: 0 0 10px #f9a6cd; }
.dot-one { top: 28%; left: 8%; }
.dot-two { top: 62%; right: 8%; background: #a7e8e4; }
.dot-three { bottom: 27%; left: 27%; background: #ffe6a0; }

.desktop {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
  min-height: 100svh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 36px 24px 28px;
}

.window {
  width: min(100%, 800px);
  overflow: hidden;
  border: 2px solid #504985;
  border-radius: 13px 13px 8px 8px;
  background: var(--midnight);
  box-shadow: 0 0 0 5px rgba(4, 4, 30, .55), 0 24px 85px rgba(4, 4, 35, .48), 0 0 44px rgba(129, 115, 233, .1);
  animation: window-in .65s cubic-bezier(.2,.8,.2,1) both;
}

.titlebar {
  display: flex;
  min-height: 45px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 6px 9px 6px 13px;
  color: #f8edff;
  background: linear-gradient(180deg, #1e1b62, #19164c);
  border-bottom: 1px solid #514b94;
}
.title-cluster { display: flex; min-width: 0; align-items: center; gap: 10px; }
.app-mark {
  display: flex;
  width: 23px;
  height: 23px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1px solid #d9b6fa;
  border-radius: 5px;
  background: #d37cc0;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.25);
}
.app-mark span { width: 3px; height: 8px; background: #fff4ea; image-rendering: pixelated; }
.app-mark span:nth-child(2) { height: 12px; background: #fde895; }
.window-title {
  overflow: hidden;
  color: #eee8ff;
  font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace;
  font-size: clamp(9px, 1.5vw, 12px);
  font-weight: 700;
  letter-spacing: .025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.window-actions { display: flex; flex: 0 0 auto; gap: 5px; }
.window-control { position: relative; display: grid; width: 22px; height: 19px; place-items: center; border: 1px solid #d8b9e8; border-radius: 3px; background: #e9a0bf; box-shadow: inset 1px 1px 0 rgba(255,255,255,.6); }
.window-control i { width: 10px; height: 2px; align-self: end; margin-bottom: 4px; background: #853860; }
.window-control.maximize { background: #9de3d3; }
.window-control.maximize i { width: 9px; height: 8px; margin: 0; align-self: center; border: 1.5px solid #28716c; background: transparent; }
.window-control.close { background: #ee83a2; }
.window-control.close i, .window-control.close b { position: absolute; top: 8px; left: 5px; width: 10px; height: 1.5px; margin: 0; background: #7f2347; transform: rotate(45deg); }
.window-control.close b { transform: rotate(-45deg); }

.browserbar {
  display: flex;
  height: 39px;
  align-items: center;
  gap: 9px;
  padding: 4px 11px;
  border-bottom: 1px solid #3e3a7e;
  background: #17164a;
  color: #d4d1ff;
}
.browser-arrow, .browser-refresh { flex: 0 0 auto; color: #a7a3dd; font-family: Georgia, serif; font-size: 20px; line-height: 1; }
.arrow-forward { color: #6d699d; }
.browser-refresh { font-size: 17px; }
.address-bar {
  display: flex;
  height: 25px;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  overflow: hidden;
  border: 1px solid #54518a;
  border-radius: 5px;
  color: #e5e0fc;
  background: #100f38;
  font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace;
  font-size: clamp(8px, 1.4vw, 10px);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tiny-lock { color: #f7a2c5; font-size: 11px; }
.menu-dots { flex: 0 0 auto; color: #a5a0d8; font-size: 12px; letter-spacing: 1px; }

.screen {
  position: relative;
  display: grid;
  min-height: clamp(420px, 63vh, 550px);
  overflow: hidden;
  place-items: center;
  isolation: isolate;
  background: var(--scene-bg, #fff4e6);
  transition: background-color .35s ease;
}
.screen::before, .screen::after { position: absolute; z-index: -1; content: ''; pointer-events: none; }
.screen::before {
  inset: 0;
  opacity: .55;
  background-image: radial-gradient(rgba(255,255,255,.35) .7px, transparent .7px);
  background-size: 8px 8px;
}
.screen::after {
  width: 270px;
  height: 270px;
  top: -140px;
  right: -90px;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 50%;
  box-shadow: 0 0 0 24px rgba(255,255,255,.035), 0 0 0 50px rgba(255,255,255,.03);
}
.screen[data-scene="welcome"], .screen[data-scene="note"] { --scene-bg: #fff2df; }
.screen[data-scene="gift"], .screen[data-scene="opened"] { --scene-bg: #f2a0bd; }
.screen[data-scene="party"] { --scene-bg: #83e0e7; }
.screen[data-scene="snoopy"] { --scene-bg: #fff1df; }
.screen[data-scene="again"] { --scene-bg: #fff0de; }
.screen[data-scene="second-party"] { --scene-bg: #a8e995; }
.screen[data-scene="friends"] { --scene-bg: #aaa0f6; }
.screen[data-scene="letter"] { --scene-bg: #aaa0f6; }

.scene {
  position: relative;
  display: flex;
  width: min(100%, 680px);
  min-height: inherit;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 30px 36px;
  text-align: center;
  animation: scene-in .42s cubic-bezier(.2,.8,.2,1) both;
}
.scene-copy { max-width: 530px; }
.eyebrow {
  margin: 0 0 12px;
  color: rgba(33,27,74,.63);
  font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.scene h1 {
  max-width: 620px;
  margin: 0 auto;
  color: #211b4a;
  font-size: clamp(27px, 4.5vw, 43px);
  font-weight: 900;
  line-height: 1.14;
  letter-spacing: -.035em;
  text-wrap: balance;
}
.scene h1 .accent { color: #a3366c; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.scene-description {
  max-width: 470px;
  margin: 12px auto 0;
  color: rgba(33,27,74,.82);
  font-size: clamp(14px, 2vw, 17px);
  font-weight: 700;
  line-height: 1.6;
  text-wrap: balance;
}
.scene-art {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 172px;
  min-width: 0;
  margin: 11px 0 4px;
  place-items: center;
  width: min(100%, 620px);
}
.pixel-svg { display: block; width: min(235px, 56vw); max-height: 205px; overflow: visible; image-rendering: pixelated; filter: drop-shadow(0 7px 0 rgba(55,39,75,.08)); }
.snoopy-art { display: block; width: min(235px, 56vw); max-height: 230px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 7px 0 rgba(55,39,75,.08)); }
.gift-art { animation: bob 2.2s ease-in-out infinite; transform-origin: 50% 70%; }
.open-button.is-opening .gift-art { animation: gift-pop .65s cubic-bezier(.16,.8,.25,1) both; }

.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 17px; }
.action-button {
  position: relative;
  display: inline-flex;
  min-height: 47px;
  min-width: 140px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 24px;
  border: 2px solid var(--ink);
  border-radius: 13px;
  color: #211b4a;
  background: #f0a1c1;
  box-shadow: 0 4px 0 var(--ink), inset 0 2px 0 rgba(255,255,255,.52);
  cursor: pointer;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.15;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
  touch-action: manipulation;
}
.action-button:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink), inset 0 2px 0 rgba(255,255,255,.52); background: #f7b3cd; }
.action-button:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink), inset 0 2px 0 rgba(255,255,255,.52); }
.action-button.secondary { background: #fff4df; }
.action-button.mint { background: #a7e6d2; }
.action-button:disabled { opacity: .68; cursor: wait; }
.button-sparkle { color: #7c3976; font-size: 18px; }

.party-decor { position: absolute; z-index: -1; inset: 0; pointer-events: none; }
.balloon {
  position: absolute;
  display: block;
  width: 40px;
  height: 49px;
  border: 2px solid var(--ink);
  border-radius: 50% 50% 47% 47%;
  background: var(--balloon-color, #f58466);
  box-shadow: inset 5px 3px 0 rgba(255,255,255,.28), 3px 4px 0 rgba(39,29,73,.08);
  animation: balloon-float 3.3s ease-in-out infinite;
}
.balloon::before { position: absolute; bottom: -4px; left: 16px; width: 6px; height: 6px; content: ''; background: var(--balloon-color, #f58466); border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(45deg); }
.balloon::after { position: absolute; top: 50px; left: 19px; width: 1px; height: 68px; content: ''; border-left: 1px dashed rgba(33,27,74,.75); }
.balloon.b1 { top: 38%; left: 7%; --balloon-color: #ff8769; }
.balloon.b2 { top: 49%; left: 15%; --balloon-color: #7469e9; animation-delay: .6s; transform: scale(.82); }
.balloon.b3 { top: 41%; right: 8%; --balloon-color: #e14c68; animation-delay: 1s; }
.balloon.b4 { top: 52%; right: 16%; --balloon-color: #f0d94b; animation-delay: .3s; transform: scale(.82); }
.confetti-dot { position: absolute; width: 9px; height: 9px; background: #f3b843; box-shadow: 13px 23px 0 #e96d89, -22px 12px 0 #766ee5; transform: rotate(45deg); }
.confetti-dot.c1 { top: 17%; left: 23%; }
.confetti-dot.c2 { top: 21%; right: 25%; background: #55ad9c; transform: rotate(15deg); }
.confetti-dot.c3 { bottom: 17%; left: 33%; background: #ed7586; }

.cake-button {
  display: grid;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  place-items: center;
  touch-action: manipulation;
  animation: bob 2.4s ease-in-out infinite;
}
.cake-button:hover { transform: translateY(-4px) rotate(-2deg); }
.cake-button .pixel-svg { width: min(165px, 42vw); }
.wish-hint { margin: 3px 0 0; color: rgba(33,27,74,.67); font-family: ui-monospace, monospace; font-size: 11px; font-weight: 800; }
.wish-hint.is-wished { color: #a3366c; }

.friends-pair { display: flex; width: min(100%, 540px); align-items: flex-start; justify-content: space-between; gap: clamp(60px, 10vw, 110px); margin: 0 auto; }
.penguin-card { display: flex; min-width: 0; max-width: 190px; flex: 1 1 0; flex-direction: column; align-items: center; gap: 7px; margin: 0; }
.penguin-card figcaption { color: #211b4a; font-size: clamp(16px, 2.5vw, 21px); font-weight: 900; line-height: 1.15; text-align: center; }
.penguin-art { display: block; width: min(190px, 100%); max-width: 100%; max-height: 245px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 6px 0 rgba(43,35,88,.08)); }
.friend-note {
  width: 100%;
  max-width: 560px;
  margin: 12px auto 0;
  padding-inline: 5px;
  color: #211b4a;
  font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace;
  font-size: clamp(12px, 1.6vw, 15px);
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
  overflow-wrap: anywhere;
  justify-self: center;
  min-width: 0;
}

.letter-card {
  position: relative;
  width: min(100%, 540px);
  margin-top: 10px;
  padding: 22px 27px 21px;
  border: 2px solid #2b2554;
  border-radius: 4px;
  background: #fffaf0;
  box-shadow: 5px 6px 0 rgba(41,31,80,.25);
  text-align: left;
}
.letter-card::before { position: absolute; top: 10px; right: 11px; width: 9px; height: 9px; content: ''; border-radius: 50%; background: #f18cae; box-shadow: -13px 0 #a9dfae, -26px 0 #f5d868; }
.letter-card p { margin: 0; color: #3d315c; font-size: clamp(14px, 1.9vw, 16px); font-weight: 700; line-height: 1.72; }
.letter-card .letter-greeting { margin-bottom: 8px; color: #9a416d; font-size: 17px; font-weight: 900; }
.letter-card .signature { margin-top: 13px; color: #9a416d; font-size: 16px; font-weight: 900; text-align: right; }
.letter-doodle { position: absolute; right: 16px; bottom: -14px; color: #dc6f9c; font-size: 23px; transform: rotate(12deg); }

.pixel-heart { position: absolute; color: #ee628e; font-family: ui-monospace, monospace; font-size: 20px; text-shadow: 2px 2px 0 rgba(58,32,73,.1); animation: heart-float 2.8s ease-in-out infinite; }
.pixel-heart.h1 { top: 15%; left: 15%; }
.pixel-heart.h2 { top: 27%; right: 16%; animation-delay: .7s; color: #fff1a8; }
.pixel-heart.h3 { bottom: 21%; left: 21%; animation-delay: 1.2s; color: #f5f0ff; }

.statusbar {
  display: flex;
  min-height: 30px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 12px;
  color: #dcd8fa;
  background: #17164a;
  border-top: 1px solid #514b94;
  font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace;
  font-size: 10px;
  font-weight: 700;
}
.status-left { display: inline-flex; align-items: center; gap: 7px; }
.status-light { width: 7px; height: 7px; border: 1px solid #c7f1b6; border-radius: 50%; background: #78d67e; box-shadow: 0 0 7px #78d67e; }
.status-heart { color: #f49aba; }

.dock {
  display: flex;
  width: min(100%, 600px);
  min-height: 59px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 20px;
  padding: 9px 13px;
  border: 1px solid #54508c;
  border-radius: 13px;
  background: rgba(23,22,73,.88);
  box-shadow: 0 7px 0 rgba(5,5,28,.58), inset 0 1px 0 rgba(255,255,255,.1);
  backdrop-filter: blur(12px);
}
.dock-button, .dock-app {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 9px;
  color: #211b4a;
  background: #9ecce8;
  box-shadow: inset 1px 2px 0 rgba(255,255,255,.7), 0 2px 0 rgba(0,0,0,.24);
  font-size: 19px;
  font-weight: 900;
}
.dock-button { cursor: pointer; transition: transform .15s ease, background .15s ease; touch-action: manipulation; }
.dock-button:hover:not(:disabled) { transform: translateY(-3px); background: #c8eaf3; }
.dock-button:active:not(:disabled) { transform: translateY(1px); }
.dock-button:disabled { opacity: .42; cursor: default; }
.dock-reset { color: #fff4e7; border-color: #a99de8; background: #746ed5; }
.dock-app { width: 31px; height: 31px; border-radius: 8px; font-size: 16px; }
.app-mail { background: #f2d972; }
.app-flower { background: #f499ba; }
.app-heart { background: #a9e0a0; }
.app-star { background: #a58cec; }
.dock-divider { width: 1px; height: 27px; flex: 0 0 auto; background: #605b99; }
.progress-wrap { display: flex; min-width: 74px; flex: 1; flex-direction: column; gap: 5px; }
.progress-track { height: 8px; overflow: hidden; border: 1px solid #726ca6; border-radius: 99px; background: #0e0d35; }
.progress-track span { display: block; width: 10%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #ed91bc, #f4db8b); transition: width .4s ease; }
.progress-caption { color: #d8d3fb; font-family: ui-monospace, monospace; font-size: 9px; text-align: center; }
.desktop-caption { margin: 18px 0 0; color: #b6b1e1; font-family: ui-monospace, monospace; font-size: 10px; letter-spacing: .09em; }
.desktop-caption span { color: #f0a0c3; }

.confetti-layer { position: fixed; z-index: 10; inset: 0; overflow: hidden; pointer-events: none; }
.confetti-piece { position: absolute; top: -18px; width: 9px; height: 13px; border-radius: 2px; animation: confetti-fall var(--fall-time, 2.4s) cubic-bezier(.14,.65,.4,1) forwards; }

@keyframes window-in { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes scene-in { from { opacity: 0; transform: translateY(9px) scale(.99); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes twinkle { from { opacity: .35; transform: scale(.82) rotate(-8deg); } to { opacity: .95; transform: scale(1.08) rotate(9deg); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes balloon-float { 0%, 100% { margin-top: 0; } 50% { margin-top: -11px; } }
@keyframes heart-float { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-8px) scale(1.12); } }
@keyframes gift-pop { 0% { transform: scale(1) rotate(0); } 36% { transform: scale(1.13) rotate(-5deg); } 70% { transform: scale(.96) rotate(5deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes confetti-fall { 0% { opacity: 1; transform: translate3d(0, -5vh, 0) rotate(0deg); } 100% { opacity: 0; transform: translate3d(var(--drift, 0px), 112vh, 0) rotate(var(--spin, 540deg)); } }

@media (min-width: 1200px) {
  .window { width: min(100%, 860px); }
  .screen { min-height: 550px; }
}

@media (max-width: 600px) {
  .desktop { justify-content: center; padding: max(12px, env(safe-area-inset-top)) 12px max(13px, env(safe-area-inset-bottom)); }
  .window { width: 100%; border-radius: 11px 11px 7px 7px; }
  .titlebar { min-height: 41px; padding-left: 9px; }
  .app-mark { width: 20px; height: 20px; }
  .window-actions { gap: 3px; }
  .window-control { width: 19px; height: 17px; }
  .browserbar { height: 35px; gap: 6px; padding: 4px 8px; }
  .browser-refresh { display: none; }
  .address-bar { padding: 0 7px; font-size: 8px; }
  .screen { min-height: min(64svh, 515px); min-height: clamp(400px, 61svh, 515px); }
  .scene { min-height: inherit; padding: 24px 17px 27px; }
  .scene h1 { font-size: clamp(25px, 7vw, 35px); }
  .scene-art { min-height: 151px; margin-top: 9px; }
  .pixel-svg { width: min(206px, 60vw); max-height: 174px; }
  .snoopy-art { width: min(205px, 58vw); max-height: 183px; }
  .friends-pair { width: 100%; max-width: 100%; min-width: 0; gap: clamp(18px, 7vw, 26px); }
  .penguin-card { max-width: calc(50% - 13px); }
  .penguin-card figcaption { font-size: clamp(13px, 3.8vw, 17px); }
  .penguin-art { width: 100%; max-width: 100%; max-height: 220px; }
  .scene-art { align-self: stretch; width: 100%; max-width: 100%; min-width: 0; }
  .friend-note { width: min(100%, 320px); max-width: 320px; margin: 6px auto 0; padding-inline: 3px; font-size: clamp(10px, 3vw, 11px); line-height: 1.42; text-align: center; }
  .balloon.b1 { left: 2%; transform: scale(.72); }
  .balloon.b2 { left: 8%; transform: scale(.65); }
  .balloon.b3 { right: 2%; transform: scale(.72); }
  .balloon.b4 { right: 8%; transform: scale(.65); }
  .dock { gap: 6px; min-height: 54px; margin-top: 14px; padding: 7px 9px; }
  .dock-button { width: 33px; height: 33px; }
  .dock-app { width: 27px; height: 27px; font-size: 14px; }
  .dock-divider { height: 23px; }
  .progress-caption { font-size: 8px; }
  .desktop-caption { margin-top: 14px; font-size: 9px; }
  .letter-card { padding: 20px 18px; }
  .letter-card p { line-height: 1.62; }
}

@media (max-width: 370px) {
  .desktop { padding-right: 8px; padding-left: 8px; }
  .window-title { font-size: 8px; }
  .dock { gap: 4px; padding-right: 6px; padding-left: 6px; }
  .dock-app { width: 24px; height: 24px; font-size: 12px; }
  .dock-button { width: 30px; height: 30px; }
  .scene { padding-right: 12px; padding-left: 12px; }
}

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