@font-face {
  font-family: "Caveat";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/studio/caveat-700.woff2?v=20261117") format("woff2");
}

@font-face {
  font-family: "Satoshi";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/studio/Satoshi-Regular.woff2?v=20261118c") format("woff2");
}

@font-face {
  font-family: "Satoshi";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/studio/Satoshi-Medium.woff2?v=20261118c") format("woff2");
}

@font-face {
  font-family: "Satoshi";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/studio/Satoshi-Bold.woff2?v=20261118c") format("woff2");
}

:root {
  --bg: #f4f4f0;
  --ink: #211c37;
  --muted: #77718c;
  --pink: #f06a9a;
  --pink-deep: #d94d7e;
  --violet: #6c5ce7;
  --card: #ffffff;
  --line: rgba(33, 28, 55, 0.1);
  --shadow: 0 30px 80px -28px rgba(33, 28, 55, 0.35);
  --radius: 22px;
  --paper: #fffbf2;
  --paper-line: rgba(165, 125, 70, 0.16);
  --paper-accent: rgba(228, 138, 166, 0.28);
  --ink-color: #2b2419;
  --letter-font: "Satoshi", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --hand: "Caveat", "Segoe Script", "Bradley Hand", cursive;
  --white: #ffffff;
  --black: #000000;
  --primary: #f12850;
  --black-hover: #1a1a1a;
  --gray-medium: #e5e1dc;
  --surface-hover: #e8e8e2;
  --surface-subtle: #fafaf8;
  --surface-placeholder: #f0ede8;
  --border: rgba(0, 0, 0, 0.08);
  --text-primary: #000000;
  --text-secondary: #595959;
  --text-muted: #737373;
  --text-placeholder: #8c8c8c;
  --font-main: "Satoshi", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-accent: "Caveat", cursive;
  --type-metadata: 12px;
  --type-metadata-lh: 1.2;
  --type-lead: clamp(17px, 2.6vw, 26px);
  --type-lead-lh: 1.45;
  --type-lead-tracking: -0.01em;
  --type-h1-lh: 1.1;
  --type-h1-tracking: -0.03em;
  --type-body-lh: 1.55;
  --type-body-small: 14px;
  --type-body-small-lh: 1.5;
  --type-label: 14px;
  --type-label-lh: 1.4;
  --type-caption: 13px;
  --type-btn: 16px;
  --radius-input: 12px;
  --safe-x: max(20px, env(safe-area-inset-left, 20px), env(safe-area-inset-right, 20px));
  --ease-premium: cubic-bezier(0.23, 1, 0.32, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Satoshi", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

[hidden] { display: none !important; }

button, input, a { font: inherit; }

/* ---------- background ---------- */

.bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(90% 60% at 12% 0%, rgba(255, 199, 221, 0.55) 0%, rgba(255,199,221,0) 60%),
    radial-gradient(80% 60% at 92% 12%, rgba(188, 175, 246, 0.45) 0%, rgba(188,175,246,0) 62%),
    radial-gradient(120% 90% at 50% -10%, #ffffff 0%, rgba(255,255,255,0) 55%),
    linear-gradient(180deg, #fff9fb 0%, #f4f1fb 55%, #eef1fb 100%);
}
.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.22;
  background-image: radial-gradient(#2b2140 1px, transparent 1px);
  background-size: 26px 26px;
  mix-blend-mode: multiply;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
  animation: drift 18s ease-in-out infinite alternate;
}

.orb-a {
  width: 42vw;
  height: 42vw;
  min-width: 260px;
  min-height: 260px;
  left: -12vw;
  top: -8vw;
  background: radial-gradient(circle at 35% 35%, rgba(240, 106, 154, 0.55), rgba(240, 106, 154, 0) 68%);
}

.orb-b {
  width: 46vw;
  height: 46vw;
  min-width: 280px;
  min-height: 280px;
  right: -16vw;
  bottom: -12vw;
  background: radial-gradient(circle at 60% 60%, rgba(108, 92, 231, 0.42), rgba(108, 92, 231, 0) 70%);
  animation-delay: -7s;
}

.grain {
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(4vw, 3vh, 0) scale(1.08); }
}

/* ---------- shell ---------- */

#app {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding: max(14px, env(safe-area-inset-top)) clamp(16px, 4vw, 34px) max(22px, env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: relative;
  z-index: 2;
  padding: 6px 2px 4px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(145deg, #f78db0, #ef5b90 55%, #6c5ce7 140%);
  box-shadow: 0 8px 18px -8px rgba(217, 77, 126, 0.7);
}

.brand-mark svg { width: 21px; height: 21px; }

.brand-text {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.brand-text strong { font-weight: 800; }
.brand-text em { font-style: normal; color: var(--muted); font-weight: 600; }

.topbar-pill {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6d6585;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(33, 28, 55, 0.08);
  border-radius: 999px;
  padding: 8px 13px;
  backdrop-filter: blur(10px);
}

#stage {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: clamp(14px, 3vh, 40px) 0 clamp(10px, 2vh, 26px);
}

.screen {
  width: 100%;
  max-width: 760px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.fade-in { animation: fade-up 0.7s cubic-bezier(0.22, 1, 0.36, 1) both; width: 100%; display: flex; flex-direction: column; align-items: center; }

.letter-screen .fade-in {
  perspective: 1200px;
  transform-origin: top center;
  animation: unfold-letter 0.95s cubic-bezier(0.2, 0.85, 0.25, 1) both;
}

@keyframes unfold-letter {
  0% { opacity: 0; transform: rotateX(-74deg) translateY(34px) scale(0.97); }
  62% { opacity: 1; transform: rotateX(7deg) translateY(0) scale(1); }
  100% { opacity: 1; transform: rotateX(0); }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- loading / missing ---------- */

.loading-screen p { color: var(--muted); font-weight: 600; margin: 18px 0 0; }

.loader { display: inline-flex; gap: 8px; }
.loader span {
  width: 10px; height: 10px; border-radius: 50%;
  background: linear-gradient(140deg, var(--pink), var(--violet));
  animation: bounce 1.05s ease-in-out infinite;
}
.loader span:nth-child(2) { animation-delay: 0.12s; }
.loader span:nth-child(3) { animation-delay: 0.24s; }

@keyframes bounce {
  0%, 65%, 100% { transform: translateY(0); opacity: 0.45; }
  32% { transform: translateY(-9px); opacity: 1; }
}

.missing-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(28px, 5vw, 46px);
  max-width: 460px;
  border: 1px solid rgba(255,255,255,0.7);
}

.missing-icon {
  width: 62px; height: 62px; margin: 0 auto 16px;
  display: grid; place-items: center;
  color: var(--pink-deep);
  background: #fff0f5;
  border-radius: 20px;
}
.missing-icon svg { width: 30px; height: 30px; }

.missing-card h1 { font-size: clamp(22px, 4vw, 28px); margin: 0 0 8px; letter-spacing: -0.03em; }
.missing-card p { color: var(--muted); line-height: 1.55; margin: 0 0 22px; font-size: 15px; }

/* ---------- shared bits ---------- */

.eyebrow {
  margin: 0 0 6px;
  color: #8a829e;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.dot { color: var(--pink); }

.btn {
  --btn-bg: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 0 22px;
  border: 2px solid #2b2140;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 800;
  font-size: 14.5px;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 4px 4px 0 #2b2140;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 #2b2140; }

.btn svg { width: 18px; height: 18px; flex: none; }
.btn:active { transform: scale(0.97); }

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #f47ba4 0%, #ef5b90 55%, #e2497f 100%);
}
.btn-primary:hover { filter: brightness(1.04); }

.btn-ghost {
  background: #fff;
  box-shadow: 4px 4px 0 #2b2140;
}

.btn-quiet {
  background: transparent;
  color: #6f6885;
  padding: 0 14px;
  border-color: transparent;
  box-shadow: none;
}
.btn-quiet:active { transform: none; box-shadow: none; }

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: clamp(18px, 3vh, 28px);
}

/* ---------- envelope ---------- */

.envelope-screen { justify-content: center; }

.envelope-title,
.cassette-heading {
  margin: 0;
  font-size: clamp(34px, 7vw, 56px);
  line-height: 1.02;
  letter-spacing: -0.045em;
  font-weight: 800;
}

.envelope {
  position: relative;
  width: min(86vw, 420px, 78svh);
  aspect-ratio: 1.47;
  margin: clamp(18px, 4.5vh, 42px) 0 clamp(12px, 2.5vh, 22px);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  perspective: 1000px;
  -webkit-tap-highlight-color: transparent;
}

.env-shadow { display: none; }

.env-body {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  border-radius: 20px;
  border: 2.5px solid #2b2140;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(150deg, var(--env-1, #ffe6f0) 0%, var(--env-2, #ffc9de) 54%, var(--env-3, #f7aecd) 100%);
  box-shadow: none;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.envelope:hover .env-body { transform: translateY(-5px) rotate(-.7deg); }
.envelope:active .env-body { transform: translateY(0) scale(0.985); }

.env-body::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: 17px;
  background:
    radial-gradient(115% 78% at 16% 0%, rgba(255,255,255,0.78), transparent 58%),
    linear-gradient(205deg, transparent 42%, rgba(255,255,255,0.18) 72%, transparent 90%);
  pointer-events: none;
}

.env-flap,
.env-peek,
.env-seal,
.env-stamp,
.env-postmark { position: absolute; display: block; }

.env-flap {
  left: 0; right: 0; top: 0;
  height: 47%;
  z-index: 1;
  background: none;
  transform-origin: top center;
  transition: transform 0.8s cubic-bezier(0.45, -0.15, 0.25, 1.25) 0.1s;
  backface-visibility: hidden;
}
.env-flap::before,
.env-flap::after {
  content: "";
  position: absolute;
  inset: 0;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.env-flap::before {
  background: #2b2140;
  transform: translateY(2px) scale(1.003);
}
.env-flap::after {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.58), transparent 64%),
    linear-gradient(118deg, rgba(255,255,255,0.2) 0 46%, transparent 47%),
    linear-gradient(178deg, var(--env-flap-top, #fff7fb) 0%, var(--env-flap-mid, #ffd3e5) 56%, var(--env-flap-bottom, #f9b7d5) 100%);
}

.env-peek {
  left: 7%;
  right: 7%;
  top: 38%;
  bottom: 9%;
  height: auto;
  z-index: 3;
  border-radius: 15px;
  border: 2.5px solid #2b2140;
  background: #fffdf6;
  box-shadow: none;
  transform: rotate(-0.9deg);
  transform-origin: 50% 92%;
  transition: transform 0.85s cubic-bezier(0.2, 0.9, 0.25, 1.15) 0.26s;
  padding: clamp(12px, 2.8vw, 20px) clamp(13px, 3vw, 22px) clamp(10px, 2.4vw, 15px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
}
.env-peek::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: clamp(14px, 4.2vw, 24px);
  z-index: 1;
  width: 1px;
  background: rgba(220, 130, 162, 0.42);
  pointer-events: none;
}
.env-peek::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}
.env-hint {
  position: relative;
  z-index: 3;
  align-self: center;
  display: inline-block;
  text-align: center;
  color: #6c6482;
  font-size: clamp(12px, 3.1vw, 13.5px);
  font-weight: 800;
  letter-spacing: 0.01em;
  padding: 7px 15px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(43, 33, 64, 0.1);
}

.env-seal {
  left: 50%;
  top: 37%;
  width: 21.5%;
  aspect-ratio: 1;
  height: auto;
  z-index: 6;
  transform: translate(-50%, -50%);
  transition: opacity 0.32s ease, transform 0.42s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.env-seal svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.env-stamp {
  right: 5%;
  top: 7%;
  z-index: 4;
  width: 11.5%;
  height: auto;
  overflow: visible;
  transform: rotate(9deg);
}

.env-postmark {
  right: 14.5%;
  top: 12%;
  z-index: 4;
  width: 58px;
  color: rgba(91, 71, 110, 0.65);
  transform: rotate(-7deg);
}
.env-postmark svg { display: block; width: 100%; height: auto; }

.envelope.is-open .env-seal {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.35) rotate(45deg);
}
.envelope.is-open .env-flap { transform: rotateX(162deg); z-index: 1; }
.envelope.is-open .env-peek { transform: translateY(-6%) rotate(0.3deg) scale(1.012); z-index: 5; }
.envelope.is-open .env-hint { opacity: 0; transition: opacity 0.2s ease; }

/* ---------- letter ---------- */

.letter-screen { max-width: 900px; }

.letter-sheet {
  position: relative;
  width: min(100%, 700px);
  margin: 0 auto;
  padding: clamp(26px, 5vw, 58px) clamp(24px, 5vw, 62px);
  text-align: left;
  border-radius: 10px;
  background:
    linear-gradient(180deg, transparent 0 32.7%, rgba(43, 36, 25, 0.055) 33%, rgba(255, 255, 255, 0.5) 33.4%, transparent 34.2%),
    linear-gradient(180deg, transparent 0 65.7%, rgba(43, 36, 25, 0.055) 66%, rgba(255, 255, 255, 0.5) 66.4%, transparent 67.2%),
    var(--paper);
  color: var(--ink-color);
  box-shadow: 0 1px 0 #fff inset, 0 32px 70px -34px rgba(61, 46, 72, 0.55);
  border: 2px solid rgba(43, 36, 25, 0.58);
  overflow: hidden;
  font-family: var(--letter-font);
}

.letter-sheet::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(90% 60% at 50% 0%, rgba(255,255,255,0.6), rgba(255,255,255,0) 60%),
    linear-gradient(180deg, rgba(0,0,0,0.035), rgba(0,0,0,0) 12%);
}

.letter-lines {
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(180deg, transparent 0 33px, var(--paper-line) 33px 34px);
  mask-image: linear-gradient(180deg, transparent 0 92px, #000 150px, #000 88%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0 92px, #000 150px, #000 88%, transparent 100%);
  pointer-events: none;
  opacity: 0.8;
}

.letter-lines::after {
  content: "";
  position: absolute;
  left: clamp(24px, 5vw, 62px);
  top: 0; bottom: 0;
  width: 1px;
  background: var(--paper-accent);
}

.letter-head { position: relative; z-index: 1; }

.letter-to {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
  padding-right: 90px;
  font-family: var(--hand);
  font-size: clamp(25px, 4vw, 34px);
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.letter-date {
  position: absolute;
  right: 0;
  top: 4px;
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.55;
  font-family: "Satoshi", system-ui, sans-serif;
  font-weight: 700;
  max-width: 45%;
  text-align: right;
  overflow-wrap: anywhere;
}

.letter-body {
  position: relative;
  z-index: 1;
  margin: clamp(16px, 3vw, 26px) 0 0;
  font-size: clamp(17px, 2.7vw, 21px);
  line-height: 1.72;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
  min-height: 3.4em;
}

.letter-body.is-hand { font-family: var(--hand); font-weight: 700; }

.letter-photos {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: clamp(12px, 2.4vw, 22px);
  margin-top: clamp(20px, 3.4vw, 30px);
  padding: 6px 6px 4px;
}

.polaroid {
  --r: 0deg;
  position: relative;
  width: clamp(112px, 21vw, 168px);
  margin: 0;
  padding: 8px 8px 30px;
  background: #fffdf8;
  border-radius: 3px;
  box-shadow: 0 10px 22px -12px rgba(52, 38, 60, 0.55), 0 1px 0 #fff inset;
  transform: rotate(var(--r));
  cursor: zoom-in;
  touch-action: manipulation;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.polaroid:hover { transform: rotate(var(--r)) translateY(-3px); box-shadow: 0 16px 28px -14px rgba(52, 38, 60, 0.6), 0 1px 0 #fff inset; }
.polaroid:focus-visible { outline: 3px solid var(--pink); outline-offset: 4px; }
.polaroid img { pointer-events: none; }
.polaroid-zoom {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(33, 28, 55, 0.84);
  box-shadow: 0 4px 10px rgba(33, 28, 55, 0.25);
  pointer-events: none;
}
.polaroid-zoom svg { width: 15px; height: 15px; }

.polaroid img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 2px;
  background: linear-gradient(100deg, #efe9de 30%, #f8f2e8 50%, #efe9de 70%) 0 0 / 220% 100%;
  animation: photo-shimmer 1.6s linear infinite;
}

@keyframes photo-shimmer {
  to { background-position: -220% 0; }
}

.letter-stickers {
  position: relative;
  z-index: 1;
  margin-top: 18px;
  font-size: clamp(22px, 4vw, 30px);
  letter-spacing: 0.18em;
}

.letter-foot {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 14px;
  margin-top: clamp(24px, 4vw, 38px);
}

.letter-sign {
  min-width: 0;
  max-width: 100%;
  font-family: var(--hand);
  font-size: clamp(23px, 4.4vw, 34px);
  line-height: 1.08;
  font-weight: 700;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.letter-sign small {
  display: block;
  font-family: "Satoshi", system-ui, sans-serif;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.5;
  margin-bottom: 2px;
}

.letter-postmark {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 2px dashed var(--ink-color);
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.55;
  transform: rotate(-9deg);
  flex: none;
}

.letter-postmark span { max-width: 52px; line-height: 1.35; }

/* ---------- cassette ---------- */

.cassette-screen { max-width: 720px; }

.cassette-heading { margin-bottom: clamp(18px, 3vh, 28px); }

.cassette-stage {
  position: relative;
  width: min(90vw, 520px);
  margin: 0 auto;
  padding: 12px 0 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.music-notes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
}
.note {
  position: absolute;
  font-size: 22px;
  font-weight: 800;
  color: var(--pink-deep);
  opacity: 0;
}
.note-a { left: 14%; top: 30%; }
.note-b { right: 16%; top: 18%; font-size: 18px; color: var(--violet); }
.note-c { left: 24%; bottom: 8%; font-size: 16px; }
.cassette-stage.is-playing .note-a { animation: float-note 2s ease-out infinite; }
.cassette-stage.is-playing .note-b { animation: float-note 2.4s ease-out 0.5s infinite; }
.cassette-stage.is-playing .note-c { animation: float-note 2.2s ease-out 1s infinite; }
@keyframes float-note {
  0% { opacity: 0; transform: translateY(12px) scale(0.6) rotate(-12deg); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-46px) scale(1.1) rotate(14deg); }
}

.cassette {
  position: relative;
  width: 100%;
  aspect-ratio: 1.55;
  border-radius: 20px;
  background: linear-gradient(150deg, var(--c1) 0%, var(--c2) 52%, var(--c3) 100%);
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.55) inset,
    0 -6px 0 rgba(0, 0, 0, 0.12) inset,
    9px 9px 0 rgba(43, 33, 64, 0.2),
    0 30px 50px -22px rgba(37, 26, 58, 0.45);
  border: 2.5px solid #2b2140;
  padding: 7%;
  display: flex;
  flex-direction: column;
  gap: 4%;
  overflow: hidden;
  animation: cassette-drop 0.85s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

@keyframes cassette-drop {
  0% { opacity: 0; transform: translateY(-46px) rotate(-5deg) scale(0.9); }
  62% { opacity: 1; transform: translateY(6px) rotate(1.5deg) scale(1.01); }
  100% { opacity: 1; transform: translateY(0) rotate(0) scale(1); }
}

.cassette-stage.is-playing .cassette { animation: none; }

.cassette::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.18), transparent 18%, transparent 82%, rgba(0,0,0,0.08)),
    radial-gradient(120% 70% at 50% -20%, rgba(255,255,255,0.35), transparent 60%);
  pointer-events: none;
}

.case-screw {
  position: absolute;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f6f4ef, #b9b4ab 70%);
  box-shadow: 0 1px 2px rgba(0,0,0,0.35);
  opacity: 0.7;
}
.s1 { left: 2.4%; top: 4%; }
.s2 { right: 2.4%; top: 4%; }
.s3 { left: 2.4%; bottom: 4%; }
.s4 { right: 2.4%; bottom: 4%; }

.case-label {
  position: relative;
  z-index: 1;
  flex: 1.35;
  display: flex;
  align-items: center;
  gap: 5%;
  padding: 4.5% 5%;
  border-radius: 14px;
  background: linear-gradient(180deg, #fff, #fff4f9);
  box-shadow: 0 2px 0 rgba(255,255,255,0.8) inset, 0 8px 18px -12px rgba(0,0,0,0.5);
  border: 2px solid #2b2140;
  overflow: hidden;
}

.case-label::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--c1), var(--c4), var(--c1));
  opacity: 0.85;
}

.case-cover {
  width: 32%;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: #eee;
  box-shadow: 0 6px 14px -8px rgba(0,0,0,0.6);
  flex: none;
}
.case-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

.case-copy { min-width: 0; flex: 1; text-align: left; color: #2a2434; }

.case-kicker {
  margin: 0 0 3px;
  font-size: clamp(8px, 1.5vw, 10px);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8b7c72;
  overflow-wrap: anywhere;
}

.case-message {
  margin: 0;
  font-size: clamp(17px, 3.6vw, 27px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.12;
  overflow-wrap: anywhere;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.case-message.is-long { font-size: clamp(13px, 2.8vw, 20px); line-height: 1.08; -webkit-line-clamp: 3; }
.case-message.is-very-long { font-size: clamp(11px, 2.3vw, 16px); line-height: 1.06; -webkit-line-clamp: 4; }

.case-meta {
  margin: 4px 0 0;
  font-size: clamp(9px, 1.6vw, 11px);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #7b6c62;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.case-tape-mark {
  position: absolute;
  right: 4%;
  bottom: 7%;
  font-size: 8px;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.42);
}

.case-window {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3%;
  padding: 0 9%;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(18, 15, 28, 0.9), rgba(32, 26, 44, 0.95));
  border: 2px solid #2b2140;
  box-shadow: 0 2px 10px rgba(0,0,0,0.45) inset, 0 1px 0 rgba(255,255,255,0.2);
}

.reel {
  position: relative;
  width: clamp(48px, 12vw, 78px);
  aspect-ratio: 1;
  border-radius: 50%;
  flex: none;
  background:
    repeating-conic-gradient(from 0deg, rgba(255,255,255,0.16) 0deg 14deg, rgba(255,255,255,0.03) 14deg 30deg),
    radial-gradient(circle at 50% 50%, #241f31 0 28%, #4a4258 28% 34%, #17131f 34% 100%);
  box-shadow: 0 0 0 3px #0f0c16, 0 0 0 5px rgba(255,255,255,0.16);
  border: 2px solid #2b2140;
  will-change: transform;
}
.reel-hub {
  position: absolute;
  inset: 38%;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #f6d9e8, #c68cb0 70%);
  box-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

.case-tape {
  position: relative;
  flex: 1;
  height: clamp(12px, 3vw, 20px);
  border-radius: 6px;
  overflow: hidden;
  background: linear-gradient(180deg, #2c2438, #191420);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08) inset;
}
.tape-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
  transform: translateX(-100%);
}
.cassette-stage.is-playing .tape-shine { animation: tape-glide 2.2s linear infinite; }
@keyframes tape-glide { to { transform: translateX(100%); } }

.cassette-stage.is-playing .reel-left { animation: spin 2.8s linear infinite; }
.cassette-stage.is-playing .reel-right { animation: spin 1.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.case-bottom {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: clamp(16px, 4vw, 26px);
}
.case-notch {
  width: 13%;
  height: 54%;
  border-radius: 3px;
  background: rgba(0,0,0,0.28);
  box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset;
}
.case-brand {
  font-size: clamp(7px, 1.4vw, 9px);
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.68);
}

.case-note {
  margin: 14px auto 0;
  max-width: 480px;
  color: var(--muted);
  font-family: var(--hand);
  font-size: clamp(22px, 5vw, 30px);
  line-height: 1.2;
  font-weight: 700;
}

.card {
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid #2b2140;
  border-radius: 20px;
  box-shadow: 6px 6px 0 rgba(43, 33, 64, 0.18), var(--shadow);
}

.player {
  width: min(92vw, 520px);
  margin-top: clamp(20px, 3.4vh, 30px);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px 14px 14px;
  text-align: left;
}

.play-btn {
  width: 56px; height: 56px;
  flex: none;
  border: 2.5px solid #2b2140;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(140deg, #f47ba4, #e2497f 70%);
  box-shadow: 4px 4px 0 #2b2140;
  transition: transform 0.16s ease;
  -webkit-tap-highlight-color: transparent;
}
.play-btn:active { transform: scale(0.94); }
.play-btn svg { width: 24px; height: 24px; }
.play-btn .icon-pause { display: none; }
.play-btn.is-playing .icon-play { display: none; }
.play-btn.is-playing .icon-pause { display: block; }

.player-main { flex: 1; min-width: 0; }
.player-row { display: flex; align-items: center; gap: 10px; }
.player-sub { margin-top: 5px; justify-content: space-between; }

.player-time {
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  min-width: 32px;
}
.player-status {
  font-size: 11.5px;
  font-weight: 700;
  color: #8a829e;
  letter-spacing: 0.01em;
}

.seek, .volume {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pink) var(--progress, 0%), rgba(33,28,55,0.12) var(--progress, 0%));
  outline: none;
  cursor: pointer;
}
.seek { flex: 1; min-width: 0; }
.volume { width: 66px; }
.seek::-webkit-slider-thumb, .volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--pink-deep);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.seek::-moz-range-thumb, .volume::-moz-range-thumb {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--pink-deep);
}
.volume-wrap { display: inline-flex; align-items: center; gap: 7px; color: #8a829e; }
.volume-wrap svg { width: 15px; height: 15px; }

/* ---------- photo viewer ---------- */

body.is-viewing { overflow: hidden; }

.photo-viewer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(80% 60% at 50% 0%, rgba(129, 85, 160, 0.2), transparent 60%),
    rgba(18, 14, 29, 0.95);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  animation: viewer-fade 0.22s ease both;
}
@keyframes viewer-fade { from { opacity: 0; } to { opacity: 1; } }

.viewer-stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: max(70px, env(safe-area-inset-top)) 16px max(116px, calc(env(safe-area-inset-bottom) + 86px));
  touch-action: none;
  cursor: grab;
}
.viewer-stage:active { cursor: grabbing; }

.viewer-image {
  display: block;
  width: auto;
  height: auto;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 186px);
  max-height: calc(100dvh - 186px);
  border-radius: 12px;
  box-shadow: 0 30px 80px -24px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.12);
  transform-origin: center center;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
}

.viewer-close {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: 3;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transition: background 0.18s ease, transform 0.18s ease;
}
.viewer-close:hover { background: rgba(255, 255, 255, 0.24); }
.viewer-close:active { transform: scale(0.94); }
.viewer-close svg { width: 20px; height: 20px; }

.viewer-bar {
  position: absolute;
  left: 50%;
  bottom: max(30px, calc(env(safe-area-inset-bottom) + 24px));
  z-index: 3;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 44px -18px rgba(0, 0, 0, 0.8);
}
.viewer-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #2b2140;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
  transition: transform 0.16s ease, opacity 0.16s ease;
}
.viewer-btn:active { transform: scale(0.94); }
.viewer-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.viewer-btn svg { width: 19px; height: 19px; }
.viewer-zoom {
  min-width: 54px;
  text-align: center;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.viewer-reset {
  height: 42px;
  padding: 0 15px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease;
}
.viewer-reset:hover { background: rgba(255, 255, 255, 0.24); }
.viewer-hint {
  position: absolute;
  left: 50%;
  bottom: max(9px, env(safe-area-inset-bottom));
  z-index: 3;
  transform: translateX(-50%);
  margin: 0;
  color: rgba(255, 255, 255, 0.52);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  pointer-events: none;
}

/* ---------- toast ---------- */

#toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translate(-50%, 18px);
  z-index: 20;
  padding: 12px 20px;
  border-radius: 999px;
  background: rgba(33, 28, 55, 0.94);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: 0 18px 36px -18px rgba(0,0,0,0.7);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  max-width: calc(100vw - 40px);
  text-align: center;
}
#toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */

@media (max-width: 560px) {
  .letter-to { padding-right: 0; }
  .letter-date { position: static; margin-top: 4px; }
  .letter-foot { align-items: flex-end; }
  .letter-postmark { width: 62px; height: 62px; }
  .btn { min-height: 46px; padding: 0 18px; }
  .actions { gap: 8px; }
  .player { gap: 11px; }
  .play-btn { width: 48px; height: 48px; }

  .cassette-heading { font-size: 34px; }
  .cassette-stage { width: 100%; padding: 10px 0 16px; }
  .cassette { border-width: 2px; border-radius: 16px; padding: 6%; box-shadow: 6px 6px 0 rgba(43, 33, 64, 0.18), 0 22px 40px -20px rgba(37, 26, 58, 0.4); }
  .case-label { border-width: 2px; border-radius: 11px; padding: 4% 4%; }
  .case-cover { width: 28%; }
  .case-message { font-size: clamp(16px, 5vw, 22px); }
  .case-window { border-width: 2px; border-radius: 11px; padding: 0 7%; }
  .reel { width: clamp(42px, 14vw, 58px); }
  .player { width: 100%; padding: 12px; gap: 10px; border-radius: 18px; box-shadow: 5px 5px 0 rgba(43, 33, 64, 0.16), var(--shadow); }
  .play-btn { width: 46px; height: 46px; }
  .volume { width: 52px; }
  .actions { width: 100%; gap: 8px; }
  .actions .btn { flex: 1 1 auto; min-width: 0; padding: 0 12px; font-size: 13px; }
  .actions .btn-quiet { flex: 1 1 100%; box-shadow: none; }
}

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