:root {
  --ink:        #251515;
  --muted: #86401b;
  --paper:      #fff8ef;
  --paper-deep: #f6dfc9;
  --rose:       #b73f55;
  --wine:       #671d2c;
  --mint:       #2f7f6f;
  --sky:        #8cc7d4;
  --gold:       #d89a42;
  --shadow-sm:  0 8px 32px rgba(58,23,19,0.12);
  --shadow:     0 24px 80px rgba(58,23,19,0.22);
  --radius:     8px;
  --radius-lg:  16px;
  --transition: 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  overflow-x: clip;
  width: 100%;
}

body {
  min-width: 320px;
  margin: 0;
  font-family: "Manrope", sans-serif;
  font-size: 16px;
  color: var(--ink);
  background-color: var(--paper);
  background-image: url("/images/my-bg1.jpeg");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  overflow-x: clip;
  width: 100%;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
          radial-gradient(ellipse at 15% 15%, rgba(255,248,239,0.62) 0%, transparent 55%),
          radial-gradient(ellipse at 85% 10%, rgba(255,248,239,0.52) 0%, transparent 45%),
          linear-gradient(160deg, rgba(255,248,239,0.72) 0%, rgba(253,238,228,0.52) 50%, rgba(255,244,236,0.62) 100%);
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }
img, video {
  display: block;
  max-width: 100%;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  user-drag: none;
}

.photo-frame img,
.carousel-slide img,
.lightbox img,
.lightbox-slide img,
.surprise-photo img,
.video-preview {
  pointer-events: none;
}

.page-shell {
  position: relative;
}

/* Плавный fade при смене языка (RTL/LTR зеркалирование grid происходит
   мгновенно и без этого выглядит как прыжок) — класс навешивается/снимается
   в main.js вокруг re-render при событии localechange. */
.page-shell.is-locale-switching {
  opacity: 0;
  transition: opacity 0.18s ease;
}

.page-shell::before,
.page-shell::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

.page-shell::before {
  width: 600px; height: 600px;
  top: -100px; right: -150px;
  background: radial-gradient(circle, rgba(216,154,66,0.08), transparent 70%);
  animation: blobFloat 12s ease-in-out infinite alternate;
}

.page-shell::after {
  width: 500px; height: 500px;
  bottom: -100px; left: -100px;
  background: radial-gradient(circle, rgba(140,199,212,0.1), transparent 70%);
  animation: blobFloat 10s ease-in-out 2s infinite alternate-reverse;
}

h1, h2, h3 {
  color: var(--ink);
  font-family: "Cormorant Garamond", serif;
  line-height: 0.94;
}
h1 { max-width: 760px; margin: 0; font-size: clamp(58px, 10vw, 128px); }
h2 { margin: 0; font-size: clamp(42px, 6vw, 76px); }
h3 { margin: 10px 0 18px; font-size: clamp(36px, 5vw, 64px); }

.overline {
  margin: 0 0 10px;
  color: var(--wine);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.section-heading {
  max-width: 760px;
  margin: 0 auto 34px;
}

.loading-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 32px;
  text-align: center;
  gap: 16px;
}

.loading-screen h1 {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(42px, 9vw, 84px);
  margin: 0;
}

.loading-mark {
  width: 48px; height: 48px;
  border: 3px solid rgba(103,29,44,0.15);
  border-top-color: var(--wine);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.gift-content { display: none; }

.gift-content.is-visible {
  display: block;
  animation: fadeIn 0.8s ease both;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  border: 0;
  border-radius: 999px;
  padding: 0 28px;
  background: var(--wine);
  color: white;
  font-weight: 800;
  font-size: 15px;
  box-shadow: 0 16px 36px rgba(103,29,44,0.24);
  transition: transform var(--transition), box-shadow var(--transition);
}

.primary-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 48px rgba(103,29,44,0.32);
}

.confetti-layer {
  position: fixed; inset: 0;
  z-index: 60; pointer-events: none; overflow: hidden;
}

.confetti-layer span {
  position: absolute;
  top: -20px; left: var(--x);
  width: 9px; height: 16px;
  border-radius: 2px;
  animation: confettiDrop 3.2s ease-in var(--delay) forwards;
  transform: rotate(var(--spin));
}

.letter-section,
.story-section,
.gallery-section,
.video-section {
  position: relative;
  z-index: 1;
  padding: clamp(58px, 8vw, 110px) clamp(20px, 5vw, 72px);
}

.uploader-section {
  position: relative; z-index: 1;
  padding: clamp(58px, 8vw, 110px) clamp(20px, 5vw, 72px);
}

.uploader-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  max-width: 1120px;
  margin: 0 auto 36px;
}

.upload-zone {
  border: 2px dashed rgba(103,29,44,0.25);
  border-radius: var(--radius-lg);
  background: var(--upload-zone-bg);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-zone:hover,
.upload-zone.is-dragging {
  border-color: var(--rose);
  background: var(--upload-zone-hover);
  transform: scale(1.01);
}

.upload-zone-inner {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; padding: 32px; text-align: center;
}

.upload-icon { font-size: 40px; }

.upload-title {
  font-family: "Cormorant Garamond", serif;
  font-size: 22px; font-weight: 700;
  color: var(--wine); margin: 0;
}

.upload-sub   { color: var(--muted); font-size: 14px; margin: 0; }

.upload-formats {
  font-size: 11px; color: var(--muted);
  opacity: 0.7; margin: 4px 0 0;
}

.upload-input-hidden {
  position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0;
}

.upload-queue {
  display: flex; flex-direction: column; gap: 10px;
  overflow-y: auto; max-height: 260px;
}

.upload-item {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid rgba(103,29,44,0.1);
  box-shadow: var(--shadow-sm);
  display: grid; gap: 6px;
  animation: fadeIn 0.3s ease both;
}

.upload-item.is-done { border-color: rgba(47,127,111,0.3); }

.upload-item-info  { display: flex; justify-content: space-between; align-items: baseline; }
.upload-item-name  { font-size: 13px; font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.upload-item-size  { font-size: 11px; color: var(--muted); flex-shrink: 0; }
.upload-item-bar   { height: 4px; border-radius: 2px; background: rgba(103,29,44,0.1); overflow: hidden; }
.upload-item-progress { height: 100%; background: var(--rose); border-radius: 2px; transition: width 0.2s ease; }
.upload-item-status { font-size: 11px; color: var(--muted); }

.upload-library {
  max-width: 1120px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid rgba(103,29,44,0.1);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.upload-library-tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid rgba(103,29,44,0.1);
}

.ulib-tab {
  flex: 1; min-height: 44px;
  border: 0; background: transparent;
  color: var(--muted); font-size: 13px; font-weight: 700;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.ulib-tab:hover     { color: var(--wine); background: rgba(103,29,44,0.04); }
.ulib-tab.is-active { color: var(--wine); border-bottom-color: var(--rose); background: var(--surface-solid); }

.ulib-content { padding: 20px; min-height: 180px; }
.ulib-loading, .ulib-empty { text-align: center; color: var(--muted); padding: 40px; font-size: 14px; }

.ulib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.ulib-grid--photos {
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
}

.ulib-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-alt);
  border: 1px solid rgba(103,29,44,0.08);
  transition: box-shadow var(--transition), transform var(--transition);
}

.ulib-item:hover { box-shadow: var(--shadow-sm); transform: translateY(-2px); }

.ulib-item img,
.ulib-item .ulib-video-thumb {
  width: 100%; aspect-ratio: 1;
  object-fit: cover; display: block;
}

.ulib-audio-icon {
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 1; font-size: 32px;
  background: linear-gradient(135deg, rgba(103,29,44,0.08), rgba(216,154,66,0.12));
}

.ulib-item-name {
  font-size: 10px; color: var(--muted);
  padding: 4px 6px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}

.ulib-item-url { display: none; }

.ulib-copy, .ulib-delete {
  position: absolute; top: 4px;
  width: 26px; height: 26px;
  border: 0; border-radius: 6px;
  font-size: 13px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity var(--transition), background var(--transition);
  cursor: pointer;
}

.ulib-item:hover .ulib-copy,
.ulib-item:hover .ulib-delete { opacity: 1; }

.ulib-copy   { right: 32px; background: var(--surface-solid); }
.ulib-delete { right: 4px;  background: var(--surface-solid); }
.ulib-delete:hover { background: var(--rose); }

@media (max-width: 900px) {
  .uploader-grid { grid-template-columns: 1fr; }
}

.roaming-char {
  position: fixed;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.5) translateY(20px);
  transition: opacity 0.9s cubic-bezier(0.2,0.8,0.2,1),
  transform 0.9s cubic-bezier(0.2,1.2,0.3,1);
  will-change: opacity, transform;
}

.roaming-char.is-visible {
  opacity: 1;
  transform: scale(1) translateY(0) rotate(-3deg);
}

.roaming-lottie {
  width: 92px;
  height: 92px;
  filter: drop-shadow(0 4px 16px rgba(183,63,85,0.35));
}

.roaming-bubble {
  position: relative;
  max-width: 230px;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(255,248,239,0.98);
  border: 1px solid rgba(183,63,85,0.22);
  box-shadow: 0 8px 32px rgba(103,29,44,0.22);
  font-family: "Cormorant Garamond", serif;
  font-size: 17px;
  font-style: italic;
  font-weight: 600;
  color: var(--wine);
  text-align: center;
  line-height: 1.45;
  white-space: normal;
  backdrop-filter: blur(8px);
}

.roaming-bubble::after {
  content: "";
  position: absolute;
  bottom: -8px;
  width: 14px; height: 14px;
  background: rgba(255,248,239,0.97);
  border-right: 1px solid rgba(183,63,85,0.2);
  border-bottom: 1px solid rgba(183,63,85,0.2);
  transform: rotate(45deg);
}

.roaming-bubble.bubble-right::after { left: 20px; }
.roaming-bubble.bubble-left::after  { right: 20px; }

@media (max-width: 620px) {
  .roaming-lottie  { width: 58px; height: 58px; }
  .roaming-bubble  { font-size: 13px; max-width: 160px; padding: 8px 12px; }
}