* { box-sizing: border-box; }
[hidden] { display: none !important; }
:root { font-family: Verdana, Geneva, sans-serif; }
html { min-width: 0; }
body {
  --bar: #1e0bd8; --bar-text: #fff; --paper: #fff8dc; --ink: #211359;
  --accent: #e8ff00; --accent-ink: #20116a; --deep: #12033b; --glint: #ff41aa;
  --accent-two: #53ffb0;
  --scene-ink: var(--ink); --scene-plum: var(--bar); --scene-hot: var(--glint);
  --scene-pop: var(--accent); --scene-paper: var(--paper);
  --scene-window: var(--bar); --scene-window-text: var(--bar-text);
  margin: 0; color: var(--ink); background: var(--deep); min-height: 100svh; isolation: isolate;
}
body[data-theme="1"] {
  --bar: #191012; --bar-text: #ffe775; --paper: #fff2c1; --ink: #371815;
  --accent: #ffd34d; --accent-ink: #2f110a; --deep: #200b1c; --glint: #ffb541;
  --accent-two: #ff82b0;
}
body[data-theme="2"] {
  --bar: #ba0063; --bar-text: #fff7ff; --paper: #ffe9fb; --ink: #411538;
  --accent: #caff48; --accent-ink: #301532; --deep: #b31d72; --glint: #ff2890;
  --accent-two: #a1ffef;
}
body[data-theme="3"] {
  --bar: #260c43; --bar-text: #bbffcb; --paper: #e8ffeb; --ink: #1c2331;
  --accent: #a1ffbf; --accent-ink: #21113e; --deep: #0d031e; --glint: #ad69ff;
  --accent-two: #a5ffc9;
}
body[data-theme="4"] {
  --bar: #ff7121; --bar-text: #1f1632; --paper: #f8e4bf; --ink: #301c23;
  --accent: #183fc2; --accent-ink: #fff; --deep: #33170d; --glint: #ff8339;
  --accent-two: #ffe087;
}
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 3px dashed currentColor; outline-offset: 4px; }
.gift-header {
  position: sticky; top: 0; z-index: 4; display: flex; gap: 12px; align-items: center; justify-content: space-between;
  padding: 9px clamp(10px, 4vw, 48px); color: var(--bar-text); background: var(--bar);
  border-bottom: 3px solid var(--ink); box-shadow: 0 3px 0 var(--accent); min-height: 56px;
}
.wordmark { font: bold clamp(.85rem, 2.6vw, 1.3rem)/1.15 Verdana, sans-serif; overflow-wrap: anywhere; }
.popparcel-wordmark {
  display: inline-flex; align-items: center; flex: 0 1 250px; min-width: 0;
  padding: 5px 7px; background: #2400df; border: 1px solid #ffffff70;
}
.popparcel-wordmark img { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.gift-controls { display: flex; gap: 6px; flex: 0 0 auto; }
.gift-controls button, .viewer-bar button, .viewer-content button {
  min-height: 36px; padding: 5px 8px; color: var(--accent-ink); background: var(--accent);
  border: 2px solid var(--ink); border-right-color: #000; border-bottom-color: #000;
  font-size: .71rem; font-weight: 800;
}
.gift-controls button { min-height: 44px; }
.gift-controls button[aria-pressed="false"] { color: var(--ink); background: var(--paper); }
.wallpaper {
  position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--deep);
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start;
}
.wallpaper img {
  display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: contain;
  background: #1b1530; border: 2px solid #fff4cf; filter: none;
}
.gift-particles { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
#gift { position: relative; z-index: 1; padding-bottom: 54px; }
.load-message {
  width: min(calc(100% - 36px), 480px); padding: 18px; margin: 18vh auto 0; color: var(--ink); background: var(--paper);
  border: 3px solid var(--ink); box-shadow: 5px 5px 0 var(--accent); font-weight: 800; text-align: center;
}
.delivery { position: relative; display: grid; align-items: center; min-height: calc(100svh - 56px); padding: clamp(86px, 15vh, 135px) clamp(18px, 7vw, 110px); }
.window {
  position: relative; border: 3px solid var(--ink); outline: 2px solid var(--accent);
  background: var(--paper); box-shadow: 10px 12px 0 color-mix(in srgb, var(--deep) 87%, transparent);
}
.opener-window { background: #fff9e8; width: min(100%, 640px); margin: auto; }
.window-bar {
  display: flex; justify-content: space-between; gap: 5px; align-items: center;
  min-height: 37px; padding: 5px 10px; font-weight: 800; font-size: .84rem;
  color: var(--bar-text); background: var(--bar); border-bottom: 3px solid var(--ink);
}
.window-bar h2 { font-size: inherit; margin: 0; }
.window-buttons { display: flex; gap: 3px; }
.window-buttons i { font-style: normal; font-size: .78rem; display: grid; place-items: center; width: 19px; height: 19px; background: var(--paper); color: var(--ink); border: 1px solid #222; }
.opener { padding: clamp(21px, 7vw, 44px) 14px; text-align: center; }
.to-label { margin: 0 0 8px; font-size: .69rem; font-weight: 800; letter-spacing: .17em; text-transform: uppercase; }
.opener-from { margin: 11px 0 0; font-size: .76rem; font-weight: 700; overflow-wrap: anywhere; }
.opener-line { margin: 13px auto 0; font: italic 1.13rem/1.4 Georgia, serif; overflow-wrap: anywhere; }
.opener-line::before { content: ""; display: block; width: 58px; height: 4px; margin: 0 auto 12px; background: linear-gradient(90deg, #ff3a78, #fff51e, #00e7ff, #ff37d8); }
.opener h1 { font-family: "Playfair Display", Georgia, serif; font-size: clamp(2.1rem, 8vw, 4.7rem); line-height: 1.03; margin: 0; overflow-wrap: anywhere; }
.parcel { display: flex; justify-content: center; align-items: center; gap: clamp(4px, 4vw, 32px); margin: 12px 0; }
.parcel img { width: clamp(110px, 28vw, 158px); height: auto; object-fit: contain; filter: drop-shadow(4px 8px 0 #14063f30); animation: parcel-bop 2.1s ease-in-out infinite; }
.parcel-star { display: inline-block; font-size: clamp(1.6rem, 5vw, 3rem); color: var(--bar); animation: parcel-bop 1.8s ease-in-out infinite reverse; }
.parcel-star.right { animation-delay: -.7s; }
@keyframes parcel-bop { 50% { transform: translateY(-9px) rotate(-5deg); } }
.big-button {
  display: inline-flex; justify-content: center; align-items: center; column-gap: 5px;
  min-height: 48px; padding: 9px 16px; border: 3px solid var(--ink); text-decoration: none;
  color: var(--accent-ink); background: var(--accent); font-size: clamp(.8rem, 3vw, 1rem);
  box-shadow: 4px 4px 0 var(--ink); font-weight: 800;
}
.big-button:hover { transform: translate(-1px, -2px); }
.big-button:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.stickers { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.sticker { position: absolute; left: var(--x); top: var(--y); width: var(--size); transform: translate(-50%, -50%) rotate(var(--tilt)); }
.sticker img { display: block; width: 100%; height: auto; filter: drop-shadow(3px 5px 1px #160441a0); animation: drift var(--speed) ease-in-out infinite alternate; }
.sticker:nth-child(even) img { animation-direction: alternate-reverse; }
@keyframes drift { to { transform: translateY(-14px) rotate(12deg); } }
.sticker-icon {
  display: grid; place-items: center; aspect-ratio: 1; color: var(--accent); background: var(--deep);
  border: 2px solid var(--accent); border-radius: 45%; font-size: calc(var(--size) * .6); line-height: 1;
  box-shadow: 4px 5px 0 #0b022789; animation: drift var(--speed) ease-in-out infinite alternate;
}
[data-theme="4"] .sticker-icon { border-radius: 3px; color: var(--ink); background: var(--paper); border: 3px dashed var(--bar); }
.scene-status { position: absolute; width: 1px; height: 1px; padding: 0; margin: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sequence-actions { padding: 5px 12px; text-align: center; }
.text-button { display: inline-block; min-height: 44px; padding: 7px 9px; color: var(--ink); background: transparent; border: 0; text-decoration: underline; font-weight: bold; font-size: .78rem; }
.album { width: min(960px, calc(100% - 40px)); margin: 0 auto 12px; scroll-margin-top: 76px; }
.album-body { padding: clamp(16px, 4vw, 34px); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 13px; align-items: start; }
.photo-grid figure { margin: 0; padding: 6px; background: #fff; color: #251933; border: 2px solid var(--ink); box-shadow: 3px 4px 0 var(--ink); }
.photo-grid button { width: 100%; padding: 0; display: block; border: 0; background: var(--deep); cursor: zoom-in; }
.photo-grid img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; }
.photo-grid figcaption { padding: 7px 4px 2px; font-size: .75rem; overflow-wrap: anywhere; white-space: pre-wrap; }
.letter { max-width: 640px; margin: 32px auto 0; padding: clamp(16px, 4vw, 32px); border: 2px solid var(--ink); background: var(--paper); box-shadow: 5px 5px 0 var(--bar); }
.letter h3 { margin: 0 0 12px; font-size: .85rem; }
#letter-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; line-height: 1.62; }
.sender { font-family: "Playfair Display", Georgia, serif; font-style: italic; margin: 18px 0 0; overflow-wrap: anywhere; }
.sender[hidden] { display: none; }
.album-sender { margin: 24px 0 0; text-align: right; font-size: .84rem; overflow-wrap: anywhere; }
#viewer { width: min(100% - 18px, 980px); max-height: calc(100dvh - 18px); border: 3px solid var(--ink); padding: 0; color: var(--bar-text); background: var(--bar); outline: 2px solid var(--accent); }
#viewer::backdrop { background: #10091deb; }
.viewer-bar { display: flex; align-items: center; justify-content: space-between; padding: 3px 8px; font-size: .8rem; }
.viewer-bar button { font-size: 1.35rem; min-width: 44px; }
.viewer-content { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; place-items: center; background: #120d19; }
.viewer-content img { width: 100%; max-height: calc(100dvh - 160px); object-fit: contain; }
.viewer-content button { width: 40px; min-height: 48px; font-size: 1.25rem; }
.viewer-content button:disabled { visibility: hidden; }
#viewer-caption { max-height: 66px; overflow: auto; min-height: 1.2em; padding: 4px 10px; margin: 4px 0; font-size: .78rem; text-align: center; white-space: pre-wrap; overflow-wrap: anywhere; }
.motion-off .parcel img, .motion-off .parcel-star, .motion-off .sticker img, .motion-off .sticker-icon { animation: none; }
.motion-off .big-button:hover { transform: none; }
@media (min-width: 1600px) {
  .wallpaper { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .delivery { padding-inline: 18px; padding-block: 79px; }
  .sticker { width: min(var(--size), 76px); }
  .sticker-icon { font-size: min(calc(var(--size) * .6), 41px); }
  .window { box-shadow: 5px 6px 0 var(--deep); }
  .wordmark { max-width: 170px; }
  .popparcel-wordmark { padding: 4px 5px; }
}
@media (max-width: 340px) {
  .gift-header { gap: 5px; padding-inline: 7px; }
  .gift-controls { gap: 4px; }
  .gift-controls button { padding-inline: 4px; font-size: .66rem; }
}

/* A few visible memories make the package feel like it came from someone. */
.keepsakes { display: none; }
.opener-photos { display: flex; justify-content: center; gap: 12px; margin: 18px 0 9px; }
.opener-photos:empty { display: none; }
.keepsake {
  margin: 0; padding: 5px 5px 12px; border: 3px solid var(--glint);
  background: #fff9e8; box-shadow: 4px 4px 0 var(--accent), 7px 7px 0 var(--ink);
}
.keepsake img { display: block; width: 100%; height: 100%; object-fit: contain; background: #fff9e8; }
.opener-photos .keepsake { width: 86px; height: 74px; transform: rotate(-5deg); }
.opener-photos .keepsake:nth-child(2) { transform: rotate(6deg); border-color: var(--accent-two); }
@media (min-width: 1100px) {
  .opener-window { width: min(52vw, 600px); z-index: 2; }
  .keepsakes { display: block; position: absolute; inset: 0; pointer-events: none; z-index: 1; }
  .keepsakes .keepsake { position: absolute; width: min(17vw, 215px); height: min(15vw, 185px); }
  .keepsakes .keepsake:nth-child(1) { left: 3.2%; top: 19%; transform: rotate(-9deg); }
  .keepsakes .keepsake:nth-child(2) { right: 3%; top: 16%; transform: rotate(8deg); border-color: var(--accent-two); }
  .keepsakes .keepsake:nth-child(3) { left: 4.5%; bottom: 15%; transform: rotate(6deg); border-color: var(--accent-two); }
  .keepsakes .keepsake:nth-child(4) { right: 4.5%; bottom: 13%; transform: rotate(-7deg); }
  .opener-photos { display: none; }
}
@media (max-width: 520px) {
  .opener { padding-block: 22px; }
  .opener-line { font-size: 1rem; }
  .parcel { margin: 9px 0; }
  .parcel img { width: 88px; }
  .opener-photos { margin-top: 13px; gap: 11px; }
  .opener-photos .keepsake { width: 78px; height: 67px; }
}
