:root {
  --wall: #ddd2c4;
  --wall-deep: #9d8571;
  --ink: #241b16;
  --paper: #fff6df;
  --paper-deep: #e5c995;
  --gold: #b98742;
  --gold-deep: #60411f;
  --shadow: rgba(21, 15, 12, 0.34);
  --chrome: rgba(36, 27, 22, 0.82);
  --white: #fffaf0;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  color: var(--ink);
  background: #15120f;
  font-family: "Cormorant Garamond", Georgia, serif;
  overflow: hidden;
}

button {
  font: inherit;
}

.room {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(92px, 12vh, 116px) clamp(14px, 4vw, 56px) clamp(72px, 10vh, 116px);
  isolation: isolate;
  background:
    linear-gradient(180deg, rgba(255, 252, 243, 0.82), rgba(255, 252, 243, 0.14) 45%, rgba(57, 38, 27, 0.25) 100%),
    radial-gradient(circle at 50% 22%, rgba(255, 245, 218, 0.9), transparent 38%),
    linear-gradient(180deg, #d8cbbb 0%, #bea892 66%, #705744 100%);
}

.wall-texture {
  position: absolute;
  inset: 0 0 18vh;
  background:
    repeating-linear-gradient(90deg, rgba(75, 57, 43, 0.035) 0 1px, transparent 1px 58px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 34px),
    radial-gradient(circle at 22% 30%, rgba(255, 255, 255, 0.24), transparent 22%),
    radial-gradient(circle at 72% 44%, rgba(105, 74, 52, 0.18), transparent 28%);
  mix-blend-mode: multiply;
  opacity: 0.52;
  z-index: -2;
}

.spotlight {
  position: absolute;
  top: -18vh;
  left: 50%;
  width: min(980px, 120vw);
  height: 82vh;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at 50% 6%, rgba(255, 249, 228, 0.82), transparent 68%);
  pointer-events: none;
  z-index: -1;
}

.intro-copy {
  position: absolute;
  top: clamp(18px, 3vh, 28px);
  left: 50%;
  width: min(560px, 90vw);
  transform: translateX(-50%);
  text-align: center;
  z-index: 3;
  pointer-events: none;
}

.intro-copy h1 {
  margin: 0;
  color: rgba(72, 47, 31, 0.86);
  font-family: "Cinzel", Georgia, serif;
  font-size: clamp(26px, 4vw, 46px);
  line-height: 1.1;
  letter-spacing: 0.02em;
  word-break: break-word;
}

.intro-copy p {
  margin: 6px auto 0;
  max-width: 32ch;
  color: rgba(58, 42, 31, 0.68);
  font-size: clamp(15px, 1.8vw, 20px);
  line-height: 1.15;
  word-break: break-word;
}

.gallery-stage {
  position: relative;
  width: min(1060px, 94vw);
  display: grid;
  place-items: center;
  perspective: 1200px;
  margin-bottom: clamp(72px, 10vh, 100px);
}

.wall-rail {
  position: absolute;
  top: -28px;
  left: 50%;
  width: min(860px, 78vw);
  height: 7px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(70, 46, 30, 0.34), transparent);
  box-shadow: 0 8px 18px rgba(72, 52, 36, 0.18);
}

.frame-shadow {
  position: absolute;
  width: min(820px, 86vw);
  aspect-ratio: 16 / 10.8;
  top: clamp(14px, 2vh, 28px);
  border-radius: 8px;
  background: rgba(54, 35, 23, 0.18);
  filter: blur(22px);
  transform: translate(16px, 32px) rotateX(2deg);
}

.artwork {
  position: relative;
  width: min(820px, 86vw);
  aspect-ratio: 16 / 10.8;
  padding: clamp(18px, 2.8vw, 34px);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 237, 166, 0.8), transparent 18%),
    linear-gradient(315deg, rgba(43, 25, 13, 0.42), transparent 22%),
    linear-gradient(90deg, #5a351a, #c6944d 9%, #f0cb77 18%, #875726 31%, #d9a957 46%, #4a2d15 100%);
  box-shadow:
    0 34px 48px rgba(32, 21, 15, 0.34),
    0 7px 0 #332112,
    inset 0 0 0 1px rgba(255, 244, 186, 0.72),
    inset 0 0 0 clamp(8px, 1.2vw, 14px) rgba(67, 38, 18, 0.42);
  transform: rotateX(1.2deg);
  z-index: 2;
}

.artwork::before,
.artwork::after {
  content: "";
  position: absolute;
  left: 50%;
  pointer-events: none;
}

.artwork::before {
  top: -62px;
  width: 1px;
  height: 78px;
  background: linear-gradient(180deg, transparent, rgba(48, 36, 28, 0.58), rgba(48, 36, 28, 0.18));
}

.artwork::after {
  top: -70px;
  width: 14px;
  height: 14px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: #6b5546;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.42), 0 5px 10px rgba(40, 26, 17, 0.25);
}

.frame-top,
.frame-left,
.frame-right,
.frame-bottom {
  position: absolute;
  pointer-events: none;
  z-index: 4;
}

.frame-top,
.frame-bottom {
  left: clamp(15px, 2.1vw, 24px);
  right: clamp(15px, 2.1vw, 24px);
  height: clamp(17px, 2.2vw, 26px);
  background: linear-gradient(180deg, rgba(255, 232, 153, 0.55), rgba(72, 43, 20, 0.34));
}

.frame-top {
  top: clamp(10px, 1.5vw, 18px);
}

.frame-bottom {
  bottom: clamp(10px, 1.5vw, 18px);
  filter: brightness(0.82);
}

.frame-left,
.frame-right {
  top: clamp(15px, 2vw, 24px);
  bottom: clamp(15px, 2vw, 24px);
  width: clamp(17px, 2.2vw, 26px);
  background: linear-gradient(90deg, rgba(255, 231, 151, 0.46), rgba(67, 39, 18, 0.42));
}

.frame-left {
  left: clamp(10px, 1.5vw, 18px);
}

.frame-right {
  right: clamp(10px, 1.5vw, 18px);
  filter: brightness(0.82);
}

.painting-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 4px;
  background: #1d3749;
  cursor: grab;
  touch-action: none;
  box-shadow:
    inset 0 0 0 1px rgba(255, 247, 219, 0.45),
    inset 0 0 34px rgba(25, 22, 17, 0.45);
}

.painting-viewport.dragging {
  cursor: grabbing;
}

.painting-viewport::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.03) 26%, transparent 44%),
    radial-gradient(circle at 5% 90%, rgba(14, 21, 24, 0.38), transparent 36%),
    linear-gradient(180deg, transparent 72%, rgba(13, 22, 20, 0.22));
  mix-blend-mode: soft-light;
  z-index: 20;
}

.painting-scene {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform-origin: center center;
  will-change: transform;
}

.paint-grain {
  position: absolute;
  inset: 0;
  z-index: 19;
  opacity: 0.22;
  pointer-events: none;
  background:
    repeating-linear-gradient(7deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 6px),
    repeating-linear-gradient(99deg, rgba(22, 28, 19, 0.08) 0 1px, transparent 1px 7px);
  mix-blend-mode: overlay;
}

.sky {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, #4f98bd 0%, #8fd4d4 28%, #efd8a5 54%, #d4b470 100%);
}

.dawn-glow {
  position: absolute;
  top: 4%;
  right: 6%;
  width: 44%;
  height: 44%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 244, 188, 0.82), rgba(255, 191, 119, 0.3) 44%, transparent 72%);
  filter: blur(3px);
}

.sun {
  position: absolute;
  top: 13%;
  right: 19%;
  width: clamp(58px, 9vw, 106px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, #fff8cb 0%, #ffd176 50%, rgba(255, 184, 103, 0.04) 72%);
  box-shadow: 0 0 38px rgba(255, 219, 134, 0.52);
}

.cloud {
  position: absolute;
  height: 4.2%;
  border-radius: 999px;
  background: rgba(255, 250, 232, 0.62);
  filter: blur(0.4px);
  animation: drift 26s ease-in-out infinite;
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: inherit;
}

.cloud::before {
  width: 38%;
  height: 95%;
  left: 12%;
  top: -46%;
}

.cloud::after {
  width: 31%;
  height: 78%;
  right: 12%;
  top: -34%;
}

.cloud-a {
  top: 17%;
  left: 7%;
  width: 14%;
}

.cloud-b {
  top: 27%;
  left: 47%;
  width: 10%;
  animation-duration: 32s;
  animation-direction: reverse;
}

.cloud-c {
  top: 11%;
  left: 68%;
  width: 8%;
  opacity: 0.6;
  animation-duration: 38s;
}

.mountain {
  position: absolute;
  bottom: 41%;
  width: 40%;
  height: 43%;
  clip-path: polygon(50% 2%, 100% 100%, 0 100%);
}

.mountain::after {
  content: "";
  position: absolute;
  inset: 0;
  clip-path: polygon(50% 2%, 68% 43%, 58% 37%, 50% 58%, 37% 38%, 31% 50%);
  background: rgba(255, 246, 226, 0.62);
}

.mountain-a {
  left: -9%;
  background: linear-gradient(145deg, #315f75, #5b8790 52%, #2d5368);
}

.mountain-b {
  left: 21%;
  bottom: 39%;
  width: 47%;
  height: 48%;
  background: linear-gradient(145deg, #557b88, #8caeaa 54%, #416979);
}

.mountain-c {
  right: -7%;
  background: linear-gradient(145deg, #284f68, #648c93 55%, #294f65);
}

.mist {
  position: absolute;
  left: -7%;
  right: -7%;
  height: 10%;
  border-radius: 50%;
  background: rgba(237, 242, 220, 0.42);
  filter: blur(9px);
}

.mist-a {
  top: 43%;
}

.mist-b {
  top: 51%;
  opacity: 0.58;
}

.forest {
  position: absolute;
  left: -4%;
  right: -4%;
  bottom: 35%;
  height: 14%;
  background:
    repeating-conic-gradient(from 0deg at 12% 100%, #214b39 0deg 14deg, #345f42 14deg 29deg, transparent 29deg 42deg),
    repeating-conic-gradient(from 0deg at 50% 100%, #244d39 0deg 14deg, #456e49 14deg 28deg, transparent 28deg 41deg),
    repeating-conic-gradient(from 0deg at 85% 100%, #214a37 0deg 14deg, #396542 14deg 28deg, transparent 28deg 42deg);
  opacity: 0.7;
}

.water {
  position: absolute;
  left: -3%;
  right: -3%;
  bottom: 21%;
  height: 29%;
  clip-path: polygon(0 16%, 36% 5%, 66% 13%, 100% 0, 100% 100%, 0 100%);
  background:
    repeating-linear-gradient(-5deg, rgba(255, 247, 201, 0.16) 0 2px, transparent 2px 14px),
    linear-gradient(180deg, rgba(127, 190, 185, 0.82), #326f83 62%, #1f4e66);
}

.reflection {
  position: absolute;
  bottom: 28%;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 246, 197, 0.42);
  filter: blur(0.5px);
}

.reflection-a {
  left: 17%;
  width: 20%;
}

.reflection-b {
  right: 18%;
  width: 28%;
  bottom: 34%;
}

.bank {
  position: absolute;
  bottom: 19%;
  height: 21%;
  background: linear-gradient(180deg, #8eaa5d, #4d7240);
  filter: saturate(0.95);
}

.bank-left {
  left: -5%;
  width: 48%;
  border-radius: 0 70% 0 0;
  clip-path: polygon(0 21%, 100% 0, 88% 100%, 0 100%);
}

.bank-right {
  right: -6%;
  width: 53%;
  border-radius: 70% 0 0 0;
  clip-path: polygon(11% 0, 100% 26%, 100% 100%, 0 100%);
}

.hill {
  position: absolute;
  bottom: 12%;
  border-radius: 55% 45% 0 0;
}

.hill-a {
  left: -10%;
  width: 66%;
  height: 31%;
  background: linear-gradient(180deg, #a4be68, #527943 70%, #315135);
}

.hill-b {
  right: -9%;
  width: 62%;
  height: 28%;
  background: linear-gradient(180deg, #b9c76e, #5c8549 72%, #315438);
}

.path {
  position: absolute;
  left: 42%;
  bottom: 0;
  width: 21%;
  height: 28%;
  background: linear-gradient(180deg, rgba(219, 187, 112, 0.72), rgba(144, 107, 66, 0.62));
  clip-path: polygon(38% 0, 72% 0, 100% 100%, 0 100%);
  opacity: 0.72;
}

.foreground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 23%;
  background:
    radial-gradient(circle at 12% 60%, rgba(255, 226, 145, 0.38), transparent 30%),
    radial-gradient(circle at 68% 44%, rgba(218, 232, 118, 0.18), transparent 28%),
    linear-gradient(180deg, #8bae55 0%, #496f3c 62%, #203b2f 100%);
}

.reeds {
  position: absolute;
  bottom: 17%;
  width: 16%;
  height: 19%;
  background:
    repeating-linear-gradient(82deg, transparent 0 9px, rgba(36, 79, 52, 0.72) 9px 11px, transparent 11px 18px),
    repeating-linear-gradient(98deg, transparent 0 10px, rgba(89, 111, 52, 0.64) 10px 12px, transparent 12px 19px);
}

.reeds-a {
  left: 2%;
}

.reeds-b {
  right: 8%;
  bottom: 18%;
  transform: scaleX(-1);
}

.flower-field {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 5%;
  height: 22%;
  z-index: 12;
}

.flower {
  --size: 22px;
  --petal: #e88975;
  --center: #f8c75b;
  position: absolute;
  width: var(--size);
  height: calc(var(--size) + 26px);
  transform: rotate(var(--lean, 0deg));
}

.flower::before {
  content: "";
  position: absolute;
  left: calc(50% - 1px);
  bottom: 0;
  width: 2px;
  height: 27px;
  border-radius: 999px;
  background: linear-gradient(180deg, #77ad5d, #285d3e);
}

.flower::after {
  content: "";
  position: absolute;
  top: 7px;
  left: calc(50% - var(--size) * 0.19);
  width: calc(var(--size) * 0.38);
  height: calc(var(--size) * 0.38);
  border-radius: 50%;
  background: var(--center);
  box-shadow:
    0 calc(var(--size) * -0.35) 0 calc(var(--size) * 0.17) var(--petal),
    calc(var(--size) * 0.35) 0 0 calc(var(--size) * 0.17) var(--petal),
    0 calc(var(--size) * 0.35) 0 calc(var(--size) * 0.17) var(--petal),
    calc(var(--size) * -0.35) 0 0 calc(var(--size) * 0.17) var(--petal);
}

.f1 { left: 6%; bottom: 8%; --size: 18px; --petal: #eaa96b; --lean: -7deg; }
.f2 { left: 12%; bottom: 22%; --size: 20px; --petal: #d56e62; --lean: 6deg; }
.f3 { left: 18%; bottom: 3%; --size: 23px; --petal: #ee9d75; --lean: -3deg; }
.f4 { left: 24%; bottom: 18%; --size: 18px; --petal: #d97874; --lean: 10deg; }
.f5 { left: 30%; bottom: 7%; --size: 21px; --petal: #f0b05d; --lean: -5deg; }
.f6 { left: 36%; bottom: 23%; --size: 19px; --petal: #cf6f69; --lean: 4deg; }
.f7 { left: 42%; bottom: 9%; --size: 24px; --petal: #e58b69; --lean: -8deg; }
.f8 { left: 48%; bottom: 26%; --size: 18px; --petal: #e3a85f; --lean: 7deg; }
.f9 { left: 54%; bottom: 10%; --size: 20px; --petal: #db746f; --lean: -2deg; }
.f10 { left: 60%; bottom: 4%; --size: 25px; --petal: #ec9a69; --lean: 6deg; }
.f11 { left: 67%; bottom: 22%; --size: 18px; --petal: #e0a560; --lean: -5deg; }
.f12 { left: 72%; bottom: 8%; --size: 23px; --petal: #d87067; --lean: 9deg; }
.f13 { left: 78%; bottom: 25%; --size: 19px; --petal: #eaac66; --lean: -7deg; }
.f14 { left: 83%; bottom: 7%; --size: 22px; --petal: #e38c77; --lean: 5deg; }
.f15 { left: 88%; bottom: 19%; --size: 18px; --petal: #cf706b; --lean: -9deg; }
.f16 { left: 93%; bottom: 6%; --size: 21px; --petal: #ebb367; --lean: 6deg; }
.f17 { left: 3%; bottom: 28%; --size: 17px; --petal: #d97d63; --lean: 4deg; }
.f18 { left: 97%; bottom: 24%; --size: 17px; --petal: #de8f6a; --lean: -7deg; }

.secret-flower {
  left: 41%;
  bottom: 31%;
  --size: 19px;
  --petal: #df9465;
  --center: #f3c85b;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  z-index: 14;
}

.secret-flower::before {
  height: 30px;
}

.secret-flower:focus-visible {
  outline: 2px solid rgba(255, 248, 205, 0.86);
  outline-offset: 8px;
  border-radius: 999px;
}

.secret-flower:hover::after,
.secret-flower:focus-visible::after {
  filter: brightness(1.18) saturate(1.15);
}

.secret-flower.found::after {
  animation: pulsePetal 1.8s ease-in-out infinite;
}

/* Resaltado al acercar zoom */
.secret-flower.highlight::after {
  transform: scale(1.28) translateY(-6px);
  filter: drop-shadow(0 8px 18px rgba(255, 170, 120, 0.25));
  transition: transform 220ms ease, filter 220ms ease;
}

.secret-flower.highlight {
  transform: translateY(-4px) scale(1.06);
  transition: transform 220ms ease;
}

/* Tooltip pequeño sobre la flor */
.flower-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%) translateY(6px);
  background: rgba(255, 250, 237, 0.98);
  color: #5a3a2a;
  padding: 2px 4px;
  border-radius: 3px;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 10px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(16, 10, 7, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
  z-index: 32;
}

.secret-flower.highlight .flower-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Mostrar el texto también sobre los pétalos cuando está resaltada */


.controls {
  position: absolute;
  left: 50%;
  bottom: clamp(-84px, -12vh, -72px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(255, 244, 216, 0.16);
  border-radius: 999px;
  background: var(--chrome);
  color: var(--white);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 36px rgba(23, 15, 10, 0.3);
  z-index: 22;
}

body.mail-open .controls {
  opacity: 0;
  pointer-events: none;
}

.icon-btn,
.reset-btn,
.close-letter {
  display: inline-grid;
  place-items: center;
  border: 0;
  cursor: pointer;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 250, 237, 0.12);
  color: var(--white);
}

.icon-btn svg,
.close-letter svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn:hover,
.reset-btn:hover,
.close-letter:hover {
  background: rgba(255, 250, 237, 0.2);
}

.zoom-readout {
  min-width: 72px;
  display: grid;
  place-items: center;
  gap: 1px;
  font-family: Inter, system-ui, sans-serif;
}

.zoom-readout span {
  font-size: 9px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: rgba(255, 250, 237, 0.65);
}

.zoom-readout strong {
  font-size: 13px;
  line-height: 1.15;
  font-weight: 700;
}

.reset-btn {
  min-height: 38px;
  padding: 0 15px;
  border-radius: 999px;
  background: rgba(255, 250, 237, 0.12);
  color: var(--white);
  font-family: Inter, system-ui, sans-serif;
  font-size: 12px;
  font-weight: 700;
}

.floor {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 18vh;
  background:
    linear-gradient(180deg, rgba(64, 42, 30, 0), rgba(48, 31, 23, 0.24) 20%),
    radial-gradient(ellipse at 50% 0, rgba(255, 230, 190, 0.18), transparent 48%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.045) 0 1px, transparent 1px 112px),
    repeating-linear-gradient(0deg, rgba(49, 30, 19, 0.1) 0 2px, transparent 2px 42px),
    linear-gradient(90deg, #6d4c35, #967052 50%, #60422f);
  transform: skewY(-1deg);
  transform-origin: bottom left;
  z-index: 1;
}

.letter-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 241, 201, 0.25), transparent 24%),
    rgba(17, 11, 8, 0.66);
  opacity: 0;
  pointer-events: none;
  transition: opacity 260ms ease;
  z-index: 30;
}

/* Asegurar centrado absoluto del contenido cuando el modal está abierto */
.letter-modal.open .secret-mail {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}

.letter-modal.open {
  opacity: 1 !important;
  pointer-events: auto;
}

.secret-mail {
  position: relative;
  width: min(760px, 100%);
  display: grid;
  place-items: center;
}

.envelope-stage,
.letter-stage {
  width: 100%;
  display: grid;
  place-items: center;
}

.envelope-stage {
  transition: opacity 240ms ease, transform 240ms ease;
}

   .letter-stage {
     transition: opacity 240ms ease, transform 240ms ease;
     opacity: 0;
     transform: translateY(16px) scale(0.94);
     pointer-events: none;
     position: absolute;
   }
 
   .letter-modal.show-letter .letter-stage {
     opacity: 1;
     transform: translateY(0) scale(1);
     pointer-events: auto;
     position: static;
   }
 
   .letter-modal.show-letter .envelope-stage {
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  pointer-events: none;
  position: absolute;
}

.envelope {
  position: relative;
  width: min(720px, 100%);
  aspect-ratio: 16 / 9.3;
  border: 0;
  padding: 0;
  color: #452816;
  background: transparent;
  cursor: pointer;
  transform: translateY(14px) rotate(-1.5deg) scale(0.98);
  transition: transform 280ms ease, filter 280ms ease;
}

.letter-modal.open .envelope {
  transform: translateY(0) rotate(-1.5deg) scale(1);
}

.envelope:hover {
  filter: brightness(1.04);
  transform: translateY(-2px) rotate(-1.5deg) scale(1.01);
}

.envelope-paper {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 7px;
  background:
    radial-gradient(circle at 20% 32%, rgba(142, 83, 33, 0.2), transparent 4%),
    radial-gradient(circle at 64% 18%, rgba(115, 69, 31, 0.17), transparent 5%),
    radial-gradient(circle at 83% 74%, rgba(116, 67, 32, 0.15), transparent 6%),
    radial-gradient(circle at 14% 80%, rgba(129, 78, 40, 0.18), transparent 7%),
    repeating-linear-gradient(8deg, rgba(76, 44, 20, 0.06) 0 1px, transparent 1px 9px),
    linear-gradient(135deg, #ead1a0, #fbebc7 42%, #d7b57d 100%);
  box-shadow:
    0 28px 70px rgba(7, 5, 4, 0.48),
    inset 0 0 0 1px rgba(88, 48, 18, 0.28),
    inset 0 0 55px rgba(91, 49, 19, 0.26);
  filter: sepia(0.06) saturate(0.95);
}

.envelope-paper::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 0 49.7%, rgba(92, 52, 24, 0.2) 50%, transparent 50.4%),
    linear-gradient(180deg, transparent 0 49.7%, rgba(92, 52, 24, 0.16) 50%, transparent 50.4%);
  mix-blend-mode: multiply;
}

.aged-spot {
  position: absolute;
  border-radius: 50%;
  background: rgba(111, 62, 25, 0.16);
  filter: blur(1px);
}

.spot-a { top: 9%; left: 7%; width: 50px; height: 22px; transform: rotate(-18deg); }
.spot-b { top: 15%; right: 28%; width: 70px; height: 32px; transform: rotate(12deg); }
.spot-c { bottom: 12%; left: 18%; width: 62px; height: 28px; transform: rotate(24deg); }
.spot-d { bottom: 22%; right: 14%; width: 54px; height: 25px; transform: rotate(-9deg); }

.envelope-fold {
  position: absolute;
  left: 0;
  right: 0;
  opacity: 0.28;
}

.fold-top {
  top: 0;
  height: 52%;
  background: linear-gradient(145deg, transparent 49.5%, #7b451e 50%, transparent 50.5%);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.fold-bottom {
  bottom: 0;
  height: 50%;
  background:
    linear-gradient(35deg, transparent 49.5%, #7b451e 50%, transparent 50.5%),
    linear-gradient(145deg, transparent 49.5%, #7b451e 50%, transparent 50.5%);
}

.twine {
  position: absolute;
  z-index: 3;
  background:
    repeating-linear-gradient(90deg, #6c4b2f 0 5px, #c09c6a 5px 8px, #4d321f 8px 12px);
  box-shadow: 0 1px 3px rgba(42, 25, 13, 0.32);
}

.twine-horizontal {
  left: -3%;
  right: -3%;
  top: 52%;
  height: 7px;
  transform: rotate(-1deg);
}

.twine-vertical {
  top: -4%;
  bottom: -4%;
  left: 50.5%;
  width: 7px;
  transform: rotate(1.2deg);
  background:
    repeating-linear-gradient(0deg, #6c4b2f 0 5px, #c09c6a 5px 8px, #4d321f 8px 12px);
}

.wax-heart {
  position: absolute;
  top: calc(52% - 30px);
  left: calc(50.5% - 30px);
  width: 60px;
  height: 54px;
  z-index: 4;
  transform: rotate(-18deg);
}

.wax-heart::before,
.wax-heart::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: #a94a3f;
  box-shadow:
    inset -2px -2px 6px rgba(68, 20, 12, 0.4),
    inset 1px 1px 3px rgba(255, 200, 150, 0.3),
    0 2px 4px rgba(0, 0, 0, 0.3);
}

.wax-heart::before {
  width: 60px;
  height: 60px;
  top: -30px;
  left: 0;
  clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 50% 85%, 18% 100%, 0% 38%);
}

.wax-heart::after {
  width: 60px;
  height: 60px;
  right: -30px;
  top: 0;
  clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 50% 85%, 18% 100%, 0% 38%);
}

.stamp-mark {
  position: absolute;
  right: 8%;
  bottom: 12%;
  padding: 6px 11px;
  border: 2px solid rgba(148, 61, 43, 0.5);
  border-radius: 4px;
  color: rgba(148, 61, 43, 0.7);
  font-family: "Cinzel", Georgia, serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background: rgba(255, 220, 180, 0.15);
  transform: rotate(12deg);
  z-index: 5;
}

.envelope-copy {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 42px 56px;
  pointer-events: none;
}

.script-word {
  display: block;
  color: #5a3a2a;
  font-family: "Cinzel", Georgia, serif;
  font-size: 58px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.address-lines {
  position: absolute;
  left: clamp(28px, 6%, 64px);
  bottom: clamp(24px, 10%, 60px);
  transform: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 0;
  max-width: 30ch;
  color: rgba(80, 50, 35, 0.88);
  font-size: 14px;
  line-height: 1.15;
  text-align: left;
  z-index: 6;
}

.address-lines span {
  display: block;
  font-family: "Cormorant Garamond", Georgia, serif;
  color: rgba(62, 40, 28, 0.94);
  font-size: 14px;
}

.address-lines strong {
  display: inline-block;
  width: 5ch;
  text-align: left;
  margin-right: 8px;
  font-variant: small-caps;
  color: rgba(48, 30, 20, 0.98);
  font-family: "Cinzel", Georgia, serif;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.open-hint {
  position: absolute;
  left: 42px;
  top: 28px;
  color: #4b2f1f;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 13px;
  font-style: italic;
  letter-spacing: 0.04em;
  background: rgba(255, 250, 237, 0.92);
  padding: 6px 10px;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(16, 10, 7, 0.28);
  border: 1px solid rgba(72, 47, 31, 0.06);
  z-index: 6;
}

.letter-card {
  position: relative;
  min-height: 420px;
  padding: 42px 52px;
  border: 1px solid rgba(80, 50, 35, 0.2);
  border-radius: 3px;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 250, 230, 0.8), transparent 20%),
    radial-gradient(circle at 85% 70%, rgba(255, 240, 200, 0.6), transparent 25%),
    linear-gradient(135deg, #fef9f0, #f5ead0 50%, #ede5d0);
  box-shadow:
    0 20px 40px rgba(40, 25, 15, 0.15),
    inset 0 0 0 1px rgba(80, 50, 35, 0.1);
}

.letter-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 3px;
  background:
    repeating-linear-gradient(0deg, rgba(150, 120, 90, 0.03) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(150, 120, 90, 0.02) 0 1px, transparent 1px 4px);
  pointer-events: none;
  mix-blend-mode: multiply;
}

.antique-letter {
  position: relative;
  width: min(660px, 90%);
  min-height: 540px;
  margin: 0 auto;
}

.ink-script {
  display: none; /* ocultar texto decorativo de fondo para evitar solapado */
}

.ink-script.script-layer-two {
  top: 50%;
  opacity: 0.4;
}

.real-letter-text {
  position: relative;
  display: block;
  margin: 12px 0 0 0;
  color: rgba(40, 25, 15, 0.95);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 18px;
  line-height: 1.7;
  letter-spacing: 0.01em;
  z-index: 2;
  max-height: calc(100% - 120px);
  overflow-y: auto;
  padding-right: 6px;
  hyphens: auto;
  word-break: break-word;
}

.letter-card h1 {
  margin: 0 0 18px 0;
  font-family: "Cinzel", Georgia, serif;
  color: #5a3a2a;
  font-size: clamp(20px, 3.6vw, 34px);
  line-height: 1.1;
  letter-spacing: 0.01em;
  text-align: center;
  font-weight: 700;
  z-index: 3;
}

.close-letter {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  background: rgba(80, 50, 35, 0.08);
  color: rgba(80, 50, 35, 0.6);
  z-index: 10;
  transition: all 160ms ease;
}

.close-letter:hover {
  background: rgba(80, 50, 35, 0.15);
  color: rgba(80, 50, 35, 0.8);
}

@keyframes drift {
  0%, 100% { transform: translateX(0) translateY(0); }
  25% { transform: translateX(24px) translateY(-8px); }
  50% { transform: translateX(0) translateY(0); }
  75% { transform: translateX(-20px) translateY(8px); }
}

/* Footer con botón-título y crédito */
.intro-copy h1 { display: block; }

.site-footer {
  position: fixed;
  left: 50%;
  /* dejar el footer justo entre el piso y la pared */
  bottom: calc(18vh + 12px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 8;
  pointer-events: auto;
}

/* Si la pantalla es muy baja, mostrar el footer en la parte superior para no taparse */
@media (max-height: 420px) {
  .site-footer {
    top: 18px;
    bottom: auto;
    transform: translateX(-50%);
  }
}

.footer-btn {
  appearance: none;
  border: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 250, 237, 0.96), rgba(240, 220, 180, 0.96));
  color: rgba(48, 30, 20, 0.98);
  font-family: "Cinzel", Georgia, serif;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 6px 18px rgba(25, 18, 12, 0.22), inset 0 -2px 0 rgba(0,0,0,0.06);
  cursor: pointer;
}

.footer-btn:hover { transform: translateY(-2px); }

.footer-credit {
  font-family: "Cormorant Garamond", Georgia, serif;
  color: rgba(255, 250, 237, 0.95);
  font-size: 13px;
  opacity: 0.95;
  text-shadow: 0 1px 0 rgba(0,0,0,0.18);
}

@keyframes pulsePetal {
  0%, 100% {
    filter: brightness(1) saturate(1);
  }
  50% {
    filter: brightness(1.3) saturate(1.4);
  }
}

@keyframes revealEnvelope {
  from {
    opacity: 0;
    transform: translateY(32px) scale(0.92) rotate(8deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0);
  }
}

@keyframes revealLetter {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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