/* ============ Pink Home — base styles (no-scroll rooms) ============ */
:root {
  --blush: #ffe9ee;
  --rose: #f7b6c8;
  --rose-deep: #e98aa6;
  --rose-strong: #d9577f;
  --cream: #fff6f1;
  --gold: #d9b26f;
  --gold-soft: #f1dcae;
  --ink: #6b3a4c;
  --glass: rgba(255, 244, 246, 0.62);
  --glass-border: rgba(255, 255, 255, 0.8);
  --shadow: 0 18px 50px rgba(176, 84, 112, 0.3);
  --script: "Great Vibes", "Snell Roundhand", "Brush Script MT", cursive;
  --serif: "Cormorant Garamond", "Playfair Display", Georgia, serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dock-bottom: max(14px, env(safe-area-inset-bottom, 0px));
  --dock-h: calc(var(--dock-bottom) + 76px);
  --safe-top: env(safe-area-inset-top, 0px);
  --arrow: 56px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--serif);
  color: var(--ink);
  background: linear-gradient(160deg, #ffe9ee, #fff3e8 60%, #ffdfe8);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
img { display: block; max-width: 100%; user-select: none; -webkit-user-drag: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; border: 0; background: none; cursor: pointer; color: inherit; }
:focus-visible { outline: 3px solid #fff; outline-offset: 3px; box-shadow: 0 0 0 6px var(--rose-strong); }

/* ============ Rooms (all three live in one page so music never breaks) ============ */
.room { display: none; }
.room.current { display: block; }

/* ============ Room (one full screen, never scrolls) ============ */
.hero {
  position: relative; width: 100%;
  height: 100vh; height: 100dvh;
  overflow: hidden; isolation: isolate;
}
.hero picture, .hero .hero-img { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero .hero-img {
  object-fit: cover; transform-origin: 50% 60%; will-change: transform;
  /* the soft focus of the Entrance / Dress Up rooms is baked into images/bg/*.jpg (no live blur = smooth) */
}
.hero::after { /* rosy vignette so the foreground pops */
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(255, 240, 245, 0.18) 20%, rgba(233, 138, 166, 0.4) 100%),
    linear-gradient(to bottom, rgba(255, 233, 238, 0.4), transparent 24%, transparent 70%, rgba(255, 233, 238, 0.75));
}
.hero-content {
  position: absolute; z-index: 5; left: 0; right: 0; top: 0;
  padding: calc(clamp(14px, 3.6vh, 40px) + var(--safe-top)) 16px 0; text-align: center; pointer-events: none;
}
.room-title {
  font-family: var(--script); font-weight: 400;
  font-size: clamp(2.8rem, 8.5vw, 5.8rem); line-height: 1.05; color: #fff;
  text-shadow: 0 2px 4px rgba(190, 80, 120, 0.6), 0 6px 34px rgba(233, 138, 166, 0.95);
}
.room-title span { display: inline-block; }

/* ============ Floating nav ============ */
.dock {
  position: fixed; z-index: 60; left: 50%; bottom: var(--dock-bottom);
  transform: translateX(var(--dock-x, -50%)); max-width: calc(100vw - 16px); display: flex; gap: 6px; padding: 8px;
  background: rgba(255, 244, 246, 0.82); border: 1px solid var(--glass-border); border-radius: 999px;
  box-shadow: var(--shadow); animation: dockIn 1.1s var(--ease) 1.6s both;
}
@media (min-width: 821px) and (pointer: fine) {
  .dock { background: var(--glass); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4); }
}
.dock a {
  display: flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: 999px;
  font-size: 1.05rem; font-weight: 700; letter-spacing: .04em; color: var(--ink); white-space: nowrap;
  transition: background .4s var(--ease), color .4s, transform .4s var(--ease);
}
.dock a svg { width: 20px; height: 20px; fill: var(--rose-strong); transition: transform .5s var(--ease), fill .3s; }
.dock a:hover { background: rgba(255, 255, 255, 0.8); transform: translateY(-3px); }
.dock a:hover svg { transform: scale(1.25) rotate(-8deg); }
.dock a.active { background: linear-gradient(135deg, #f59ab5, var(--rose-strong)); color: #fff; }
.dock a.active svg { fill: #fff; }

/* ============ Entrance: door buttons on a frosted stage ============ */
.stage {
  --gap: clamp(26px, 4vw, 56px);
  position: absolute; z-index: 6; left: 50%; top: 52%;
  transform: translate(-50%, -50%);
  display: flex; gap: var(--gap); max-width: calc(100vw - 16px);
  padding: clamp(16px, 2.6vw, 30px) clamp(16px, 2.6vw, 34px) clamp(34px, 4vw, 46px);
  border-radius: 44px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.7), rgba(255, 224, 235, 0.58));
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 30px 80px rgba(176, 84, 112, 0.45), inset 0 0 40px rgba(255, 255, 255, 0.6);
}
.door {
  --w: clamp(128px, min(24vw, 36vh), 280px);
  position: relative; width: var(--w); flex: 0 0 var(--w); display: block;
  transition: scale .6s var(--ease), filter .6s;
}
.door-art {
  display: block; position: relative; width: 100%; aspect-ratio: 3 / 4; overflow: hidden;
  border-radius: calc(var(--w) / 2) calc(var(--w) / 2) 22px 22px;
  border: 4px solid #fff;
  box-shadow: 0 0 0 3px var(--gold), 0 18px 40px rgba(176, 84, 112, 0.5);
}
.door-art img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease); }
.door-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(217, 87, 127, 0.45), transparent 45%); }
.door::before { /* pulsing "knock" ring */
  content: ""; position: absolute; z-index: 0; inset: -9px -9px 0 -9px; bottom: 0;
  border: 3px solid #fff; border-radius: calc(var(--w) / 2 + 9px) calc(var(--w) / 2 + 9px) 30px 30px;
  animation: ring 2.6s ease-out infinite; pointer-events: none;
}
.door:nth-child(2)::before { animation-delay: 1.3s; }
.door-label {
  /* text scales with the door, so it never gets squeezed or collides with its neighbour */
  font-size: clamp(.82rem, calc(var(--w) * .085), 1.3rem);
  position: absolute; z-index: 3; left: 50%; bottom: 0; transform: translate(-50%, 50%);
  display: inline-flex; align-items: center; gap: .45em; white-space: nowrap;
  padding: .6em 1.15em; border-radius: 999px;
  background: linear-gradient(135deg, #f59ab5, var(--rose-strong));
  border: 2px solid #fff; box-shadow: 0 8px 22px rgba(176, 84, 112, 0.55);
  color: #fff; font-weight: 700; letter-spacing: .05em; line-height: 1.1;
  transition: transform .5s var(--ease), box-shadow .5s;
}
.door-label svg { width: 1.05em; height: 1.05em; flex: none; fill: #fff; animation: heartbeat 1.4s ease-in-out infinite; }
.door:hover, .door:focus-visible { scale: 1.07; filter: brightness(1.05); }
.door:hover .door-art img { transform: scale(1.15); }
.door:hover .door-label { transform: translate(-50%, 50%) scale(1.08); box-shadow: 0 12px 30px rgba(217, 87, 127, 0.8); }

/* ============ Dress-up slideshow ============ */
.show {
  position: absolute; z-index: 10; left: 0; right: 0;
  top: calc(clamp(70px, 14vh, 130px) + var(--safe-top)); bottom: calc(var(--dock-h) + 40px);
  perspective: 1400px;
}
.slide {
  --dir: 1; --in: translateX(calc(var(--dir) * 14%)) scale(.88) rotate(calc(var(--dir) * 3deg));
  --out: translateX(calc(var(--dir) * -14%)) scale(.88) rotate(calc(var(--dir) * -3deg));
  position: absolute; inset: 0; display: grid; place-items: center; margin: 0;
  grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr);
  /* side room reserved for the arrows, so a wide picture can never sit under a button */
  padding: 14px calc(var(--arrow) + clamp(8px, 2vw, 28px) + 14px);
  opacity: 0; visibility: hidden; transform: var(--in);
  transition: opacity .9s var(--ease), transform 1.1s var(--ease), visibility 0s 1.1s;
  pointer-events: none;
}
.slide[data-fx="1"] { --in: scale(1.3); --out: scale(.78); }
.slide[data-fx="2"] {
  --in: rotateY(calc(var(--dir) * 70deg)) scale(.9);
  --out: rotateY(calc(var(--dir) * -70deg)) scale(.9);
}
.slide.active { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; pointer-events: auto; }
.slide.active, .slide.leaving { will-change: transform, opacity; }
.slide.leaving { opacity: 0; visibility: visible; transform: var(--out); }
/* the picture keeps its own proportions — any aspect ratio fits */
.slide img {
  width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain;
  min-height: 0; min-width: 0;
  border: 6px solid #fff; border-radius: 26px; background: #fff;
  outline: 2px solid var(--gold); outline-offset: 6px;
  box-shadow: 0 24px 60px rgba(176, 84, 112, 0.5), 0 0 44px rgba(255, 255, 255, 0.6);
}

.arrow {
  position: absolute; z-index: 12; top: 50%; width: var(--arrow); height: var(--arrow); margin-top: calc(var(--arrow) / -2);
  border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, #fff, #ffe3ec); border: 2px solid var(--gold);
  box-shadow: 0 10px 26px rgba(176, 84, 112, 0.5);
  transition: transform .4s var(--ease), background .3s;
}
.arrow svg { width: 46%; height: 46%; fill: none; stroke: var(--rose-strong); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.arrow:hover { transform: scale(1.14); background: #fff; }
.arrow:active { transform: scale(.92); }
.arrow.prev { left: max(clamp(8px, 2vw, 28px), env(safe-area-inset-left, 0px)); }
.arrow.next { right: max(clamp(8px, 2vw, 28px), env(safe-area-inset-right, 0px)); }

.dots {
  position: absolute; z-index: 12; left: 0; right: 0; bottom: calc(var(--dock-h) + 6px);
  display: flex; justify-content: center; align-items: center; gap: 10px; padding: 0 12px;
}
.dots button {
  position: relative; flex: none; width: 12px; height: 12px; border-radius: 999px; overflow: hidden;
  background: rgba(255, 255, 255, 0.85); border: 2px solid var(--rose-strong);
  transition: width .6s var(--ease), background .4s;
}
.dots button.active { width: 46px; background: #fff; }
.dots button.active::after {
  content: ""; position: absolute; inset: 0; transform-origin: left; background: var(--rose-strong);
  animation: fillBar var(--dur, 5s) linear forwards;
}
.show.paused .dots button.active::after { animation-play-state: paused; }
/* many pictures: dots would overflow, so show "3 / 24" with a timer bar instead */
.dots .counter {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 18px; border-radius: 999px; font-weight: 700; letter-spacing: .06em; font-size: 1rem;
  background: rgba(255, 255, 255, 0.9); border: 2px solid var(--rose-strong); color: var(--rose-strong);
}
.dots .counter i { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; transform-origin: left; background: var(--rose-strong); animation: fillBar var(--dur, 5s) linear forwards; }
.show.paused ~ .dots .counter i, .dots.paused .counter i { animation-play-state: paused; }
.show-empty {
  position: absolute; inset: 0; display: none; place-items: center; text-align: center; padding: 24px;
  font-size: 1.2rem; font-weight: 600; color: #fff; text-shadow: 0 2px 10px rgba(190, 80, 120, .8);
}
.show.is-empty .show-empty { display: grid; }
.show.is-empty .arrow, .show.is-empty ~ .dots { display: none; }
.show.single .arrow, .show.single ~ .dots { display: none; }

/* ============ Music button ============ */
.music-btn {
  position: fixed; z-index: 70; top: max(14px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right));
  width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, #fff, #ffe3ec); border: 3px solid var(--gold);
  box-shadow: 0 10px 28px rgba(176, 84, 112, 0.55);
  animation: dockIn2 1s var(--ease) 1.8s both;
  transition: transform .4s var(--ease), background .4s;
}
.music-btn:hover { transform: scale(1.1); }
.music-btn:active { transform: scale(.94); }
.music-btn .ico { grid-area: 1 / 1; width: 28px; height: 28px; fill: var(--rose-strong); transition: opacity .3s, transform .5s var(--ease); }
.music-btn .slash {
  grid-area: 1 / 1; width: 36px; height: 4px; border-radius: 4px; background: var(--rose-strong);
  border: 1px solid #fff; transform: rotate(-45deg); transition: opacity .3s, transform .5s var(--ease);
}
.music-btn .eq { grid-area: 1 / 1; display: flex; align-items: flex-end; gap: 4px; height: 28px; opacity: 0; transform: scale(.5); transition: opacity .3s, transform .5s var(--ease); }
.music-btn .eq i { width: 5px; border-radius: 3px; background: #fff; height: 30%; animation: eq 1s ease-in-out infinite; }
.music-btn .eq i:nth-child(2) { animation-delay: -.3s; } .music-btn .eq i:nth-child(3) { animation-delay: -.6s; } .music-btn .eq i:nth-child(4) { animation-delay: -.15s; }
.music-btn.on { background: linear-gradient(135deg, #f59ab5, var(--rose-strong)); }
.music-btn.on .ico, .music-btn.on .slash { opacity: 0; transform: scale(.4); }
.music-btn.on .eq { opacity: 1; transform: none; }
.music-btn::before {
  content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 3px solid #fff; opacity: 0; pointer-events: none;
}
.music-btn.on::before { animation: ring 2s ease-out infinite; }
.note { position: fixed; z-index: 69; pointer-events: none; color: #fff; font-size: 22px; text-shadow: 0 2px 8px rgba(217, 87, 127, 0.9); animation: noteUp 3.2s ease-out forwards; }

/* ============ Group chat page (room.html): a scrollable area for your own code ============ */
.room-slot {
  position: absolute; z-index: 10; left: 0; right: 0;
  top: calc(clamp(70px, 14vh, 130px) + var(--safe-top)); bottom: calc(var(--dock-h) + 8px);
  padding: 0 clamp(12px, 4vw, 48px); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}
.room-slot-note {
  max-width: 560px; margin: 4vh auto 0; padding: 22px 26px; text-align: center; font-size: 1.25rem; font-weight: 600;
  background: rgba(255, 244, 246, .8); border: 1px solid var(--glass-border); border-radius: 28px; box-shadow: var(--shadow);
}
body[data-room="group"] .room-slot { opacity: 0; }
body.ready[data-room="group"] .room-slot { animation: fadeIn 1s ease 1.1s forwards; }
@media (max-height: 560px) { .room-slot { top: calc(56px + var(--safe-top)); bottom: calc(var(--dock-h) + 4px); } }

/* ============ Chat widget (Chatwee) — styled to match the rooms ============ */
.chat-adopt { z-index: 8500 !important; filter: drop-shadow(0 10px 22px rgba(176, 84, 112, 0.5)); }
.chat-adopt.chat-bubble { animation: chatGlow 3.2s ease-in-out infinite alternate; }

/* ============ Canvases / sparkles ============ */
#petals { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
.sparkle {
  position: fixed; z-index: 300; pointer-events: none; width: 14px; height: 14px;
  background: radial-gradient(circle, #fff, var(--rose) 60%, transparent 70%);
  border-radius: 50%; animation: spark .9s ease-out forwards;
}

/* ============ Phones, small tablets (and phones turned sideways): the nav pill sits bottom-left,
   the chat bubble sits bottom-right on the very same row, so nothing overlaps ============ */
@media (max-width: 820px) {
  :root { --dock-x: 0px; --chat-gap: 76px; }
  .dock {
    left: max(12px, env(safe-area-inset-left, 0px)); right: auto;
    max-width: calc(100vw - 12px - var(--chat-gap) - env(safe-area-inset-left, 0px));
    padding: 6px; gap: 2px;
  }
  .dock a { padding: 11px 13px; font-size: 1rem; }
  .dock a span { display: none; }
  .dock a.active { padding: 11px 16px; }
  .dock a.active span { display: inline; }
  .chat-adopt.chat-bubble {
    right: max(12px, env(safe-area-inset-right, 0px)) !important; left: auto !important;
    bottom: var(--dock-bottom) !important; top: auto !important; margin: 0 !important;
  }
}
/* ============ Small / short screens ============ */
@media (max-width: 600px) {
  :root { --arrow: 46px; }
  .stage { --gap: 22px; border-radius: 34px; padding: 14px 14px 34px; }
  .door { --w: min(40vw, 30vh); }
  .music-btn { width: 54px; height: 54px; }
}
@media (max-width: 340px) {
  .dock a.active span { display: none; }
  .dock a.active { padding: 11px 15px; }
  .stage { --gap: 18px; padding: 12px 12px 32px; }
  .door-label svg { display: none; }
}

/* Phones & tablets held upright: arrows leave the picture and sit in a row beneath it */
@media (max-aspect-ratio: 1/1) {
  :root { --arrow: 46px; }
  .show { bottom: calc(var(--dock-h) + 62px); }
  .slide { padding: 14px; }
  .arrow { top: 100%; margin-top: 10px; }
  .arrow.prev { left: max(16px, env(safe-area-inset-left, 0px)); }
  .arrow.next { right: max(16px, env(safe-area-inset-right, 0px)); }
  .dots {
    left: calc(var(--arrow) + 26px); right: calc(var(--arrow) + 26px); padding: 0;
    bottom: calc(var(--dock-h) + 8px + (var(--arrow) - 12px) / 2);
    flex-wrap: wrap; gap: 8px; row-gap: 6px; align-content: center; max-height: var(--arrow);
  }
  .dots button.active { width: 34px; }
}

/* Short landscape screens (phones turned sideways) */
@media (max-height: 560px) {
  :root { --arrow: 46px; --dock-h: calc(var(--dock-bottom) + 62px); }
  .room-title { font-size: clamp(2.2rem, 7vh, 3.4rem); }
  .hero-content { padding-top: calc(8px + var(--safe-top)); }
  .stage { --gap: max(30px, 4vw); top: 54%; padding: 12px 20px 28px; }
  .door { --w: 26vh; }
  .door-label svg { display: none; }
  .show { top: calc(56px + var(--safe-top)); bottom: calc(var(--dock-h) + 34px); }
  .dots { bottom: calc(var(--dock-h) + 2px); }
  .dots .counter { padding: 3px 14px; font-size: .85rem; }
  .dock { padding: 5px; }
  .dock a { padding: 8px 14px; font-size: .95rem; }
}
@media (max-height: 560px) and (max-aspect-ratio: 1/1) {
  /* tiny portrait screens: keep the compact controls row */
  .show { bottom: calc(var(--dock-h) + 58px); }
  .dots { bottom: calc(var(--dock-h) + 8px + (var(--arrow) - 12px) / 2); }
}
