@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #0b1426;
  --panel: rgba(13, 23, 42, .86);
  --gold: #d9b34b;
  --paper: #fffaf0;
  --ink: #352819;
  --env: #173760;
  --env2: #0d2442;
  --seal: #85192f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}

/* SHARED LANGUAGE SWITCH */

.language-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 999px;
  background: rgba(2, 6, 23, .65);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.language-switch button {
  min-width: 44px;
  padding: 8px 11px;
  border: 0;
  border-radius: 999px;
  color: #cbd5e1;
  background: transparent;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: .2s ease;
}

.language-switch button.active {
  color: #211704;
  background: linear-gradient(135deg, #f4df85, #b78318);
  box-shadow: 0 5px 14px rgba(217, 179, 75, .2);
}

/* ADMIN */

.admin-page {
  color: #f8fafc;
  background:
    radial-gradient(circle at 10% 5%, #17365b 0, transparent 30%),
    linear-gradient(135deg, #050914, #111827);
  padding: 28px;
}

.admin-layout {
  width: min(1200px, 100%);
  margin: auto;
  display: grid;
  grid-template-columns: 1.45fr .7fr;
  gap: 26px;
  align-items: start;
}

.panel {
  padding: clamp(24px, 4vw, 44px);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 26px;
  background: var(--panel);
  box-shadow: 0 25px 80px rgba(0, 0, 0, .4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.admin-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 32px;
}

.brand {
  display: flex;
  gap: 17px;
  align-items: center;
  min-width: 0;
}

.brand-logo {
  width: 105px;
  height: 58px;
  flex: 0 0 105px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #1c1406;
  background: linear-gradient(145deg, #ffeaa0, #af7b12);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .34);
  font: 700 21px 'Cormorant Garamond', serif;
  letter-spacing: -.04em;
}

.brand span,
.info > span,
.result > span {
  color: #f7df98;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .18em;
}

.brand h1 {
  margin: 4px 0 0;
  font: 700 clamp(34px, 5vw, 52px)/.95 'Cormorant Garamond', serif;
}

.admin-language-switch {
  flex: 0 0 auto;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.form-grid label,
.nested-grid label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.form-grid .full,
.nested-grid .full {
  grid-column: 1 / -1;
}

.form-grid small,
.nested-grid small,
.content-language-box small {
  color: #94a3b8;
  font-size: 11px;
  font-weight: 400;
}

.form-grid input,
.form-grid textarea,
.form-grid select,
.nested-grid input,
.nested-grid textarea,
.nested-grid select {
  width: 100%;
  padding: 14px;
  color: #fff;
  background: rgba(5, 11, 23, .67);
  border: 1px solid rgba(148, 163, 184, .23);
  border-radius: 13px;
  outline: none;
}

.form-grid input:focus,
.form-grid textarea:focus,
.form-grid select:focus,
.nested-grid input:focus,
.nested-grid textarea:focus,
.nested-grid select:focus {
  border-color: #d9b34b;
  box-shadow: 0 0 0 4px rgba(217, 179, 75, .11);
}

.form-grid textarea,
.nested-grid textarea {
  resize: vertical;
}

.form-grid option,
.nested-grid option {
  background: #0f172a;
}

.content-language-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 1px solid rgba(217, 179, 75, .25);
  border-radius: 16px;
  background: rgba(217, 179, 75, .06);
}

.section-title {
  display: block;
  margin-bottom: 5px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 25px;
  font-weight: 700;
}

.content-tabs {
  display: flex;
  gap: 7px;
  flex: 0 0 auto;
}

.content-tabs button {
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 11px;
  color: #cbd5e1;
  background: rgba(255, 255, 255, .05);
  font-weight: 700;
  cursor: pointer;
}

.content-tabs button.active {
  color: #211704;
  border-color: transparent;
  background: linear-gradient(135deg, #f4df85, #b78318);
}

.language-fields {
  display: none;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 18px;
  background: rgba(2, 6, 23, .3);
}

.language-fields.active {
  display: block;
}

.language-panel-heading {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 19px;
}

.language-panel-heading > b {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #211704;
  background: linear-gradient(145deg, #f4df85, #b78318);
}

.language-panel-heading strong,
.language-panel-heading small {
  display: block;
}

.language-panel-heading small {
  margin-top: 3px;
  color: #94a3b8;
}

.nested-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.logo-preview-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.seal-logo-preview {
  min-height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(217, 179, 75, .25);
  border-radius: 13px;
  color: #f6d09e;
  background: radial-gradient(circle at 30% 25%, #bd3855, #711126 72%);
  font: 700 18px 'Cormorant Garamond', serif;
  letter-spacing: -.04em;
}

.actions {
  display: flex;
  gap: 11px;
}

.actions button,
.copy-row button,
.result a {
  padding: 14px 18px;
  border: 0;
  border-radius: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform .2s ease, filter .2s ease;
}

.actions button:hover,
.copy-row button:hover,
.result a:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.primary,
.copy-row button {
  color: #211704;
  background: linear-gradient(135deg, #f4df85, #b78318);
}

.secondary,
.result a {
  color: #fff;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .09) !important;
}

.info {
  position: sticky;
  top: 28px;
}

.info h2,
.result h2 {
  margin: 8px 0 20px;
  font: 700 38px/1 'Cormorant Garamond', serif;
}

.info ol {
  padding-left: 21px;
  color: #cbd5e1;
  line-height: 1.9;
}

.mini-envelope {
  width: 230px;
  height: 150px;
  margin: 40px auto 0;
  position: relative;
  border-radius: 5px;
  background: linear-gradient(145deg, #173760, #0d2442);
  box-shadow: 0 20px 40px rgba(0, 0, 0, .45);
}

.mini-flap {
  position: absolute;
  inset: 0;
  clip-path: polygon(0 0, 100% 0, 50% 68%);
  background: #1d4779;
}

.mini-envelope b {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 78px;
  height: 78px;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  border: 3px double #e4aa70;
  border-radius: 50%;
  color: #f6d09e;
  background: radial-gradient(circle at 30% 25%, #bd3855, #711126 72%);
  font: 700 15px 'Cormorant Garamond', serif;
  letter-spacing: -.05em;
}

.result {
  margin-top: 26px;
  padding: 22px;
  border: 1px solid rgba(217, 179, 75, .33);
  border-radius: 18px;
  background: rgba(217, 179, 75, .06);
}

.result h2 {
  margin-bottom: 14px;
  font-size: 30px;
}

.copy-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
}

.copy-row input {
  min-width: 0;
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, .11);
  border-radius: 12px;
  color: #e2e8f0;
  background: #040914;
}

.result a {
  display: inline-block;
  margin-top: 12px;
}

.result p {
  margin-bottom: 0;
  color: #94a3b8;
  font-size: 12px;
}

/* INVITATION */

.invite-page {
  --bg: #0b1426;
  --env: #173760;
  --env2: #0d2442;
  --gold: #d9b34b;
  overflow-x: hidden;
  color: #fff;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, .06), transparent 32%),
    linear-gradient(145deg, #050811, var(--bg), #050811);
}

.theme-burgundy {
  --bg: #300c18;
  --env: #76233b;
  --env2: #4a1022;
}

.theme-emerald {
  --bg: #06251e;
  --env: #0d5c4f;
  --env2: #073b34;
}

.theme-ivory {
  --bg: #a68e67;
  --env: #eadfc8;
  --env2: #c9baa0;
  --gold: #805d20;
}

.invitation-language-switch {
  position: fixed;
  z-index: 50;
  top: 20px;
  right: 20px;
}

.stage {
  width: min(1100px, 100%);
  min-height: 100vh;
  margin: auto;
  padding: 42px 18px 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.intro {
  margin-bottom: 28px;
  text-align: center;
  transition: .45s;
}

.intro span {
  color: #f7df98;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .18em;
}

.intro h1 {
  max-width: 800px;
  margin: 6px auto 10px;
  font: 700 clamp(40px, 7vw, 72px)/.95 'Cormorant Garamond', serif;
}

.intro p {
  margin: 0;
  color: #cbd5e1;
}

.scene {
  width: min(760px, 95vw);
  height: min(520px, 68vw);
  min-height: 315px;
  display: grid;
  place-items: end center;
  perspective: 1600px;
}

.envelope {
  width: 100%;
  aspect-ratio: 1.55 / 1;
  position: relative;
  filter: drop-shadow(0 34px 35px rgba(0, 0, 0, .53));
  transform-style: preserve-3d;
}

.back,
.left,
.right,
.bottom,
.flap {
  position: absolute;
  inset: 0;
  border-radius: 7px;
}

.back {
  background: linear-gradient(145deg, var(--env), var(--env2));
}

.left {
  z-index: 5;
  clip-path: polygon(0 0, 52% 52%, 0 100%);
  background: linear-gradient(145deg, var(--env), var(--env2));
}

.right {
  z-index: 5;
  clip-path: polygon(100% 0, 48% 52%, 100% 100%);
  background: linear-gradient(225deg, var(--env), var(--env2));
}

.bottom {
  z-index: 6;
  clip-path: polygon(0 100%, 50% 46%, 100% 100%);
  background: linear-gradient(0deg, var(--env2), var(--env));
}

.flap {
  z-index: 8;
  transform-origin: top;
  clip-path: polygon(0 0, 100% 0, 50% 58%);
  background: linear-gradient(160deg, color-mix(in srgb, var(--env) 84%, white), var(--env));
  transition: transform .95s cubic-bezier(.2, .75, .22, 1), z-index .2s .45s;
  backface-visibility: hidden;
}

.letter {
  position: absolute;
  z-index: 3;
  left: 6%;
  right: 6%;
  bottom: 4%;
  height: 90%;
  overflow: auto;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid #e4d4b3;
  border-radius: 8px;
  box-shadow: 0 15px 35px rgba(67, 42, 15, .29);
  transform: translateY(15%) scale(.96);
  transition: transform 1.1s cubic-bezier(.2, .8, .2, 1) .35s, height .45s;
}

.letter-content {
  min-height: 100%;
  padding: clamp(30px, 6vw, 60px);
  position: relative;
  text-align: center;
}

.letter-content::before,
.letter-content::after {
  content: '';
  position: absolute;
  width: 46px;
  height: 46px;
  border-color: #aa7e26;
}

.letter-content::before {
  left: 17px;
  top: 17px;
  border-top: 2px solid;
  border-left: 2px solid;
}

.letter-content::after {
  right: 17px;
  bottom: 17px;
  border-right: 2px solid;
  border-bottom: 2px solid;
}

.letter-brand {
  position: absolute;
  top: 17px;
  left: 50%;
  transform: translateX(-50%);
  color: #8d6c2e;
  font: 700 15px 'Cormorant Garamond', serif;
  letter-spacing: -.03em;
}

.ornament {
  margin-top: 5px;
  color: #a67a1f;
  font-size: 22px;
}

.event-type {
  display: block;
  margin: 10px 0 4px;
  color: #87631f;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.letter h2 {
  margin: 0;
  font: 700 clamp(40px, 7vw, 68px)/.95 'Cormorant Garamond', serif;
}

.divider {
  width: min(360px, 80%);
  margin: 22px auto;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #9e741e;
}

.divider i {
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, transparent, #b28a3c);
}

.divider i:last-child {
  background: linear-gradient(90deg, #b28a3c, transparent);
}

.letter-content > small {
  color: #8d7754;
  letter-spacing: .2em;
}

.guest-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 10px;
  font: 700 clamp(26px, 4.5vw, 39px)/1.1 'Cormorant Garamond', serif;
}

.guest-list span:not(:last-child)::after {
  content: ' •';
  color: #b68a30;
  font-size: .55em;
  vertical-align: middle;
}

.message {
  max-width: 640px;
  margin: 24px auto;
  color: #4c3e2d;
  font: 500 clamp(21px, 3vw, 27px)/1.42 'Cormorant Garamond', serif;
  white-space: pre-line;
}

.details {
  max-width: 570px;
  margin: 27px auto 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  border: 1px solid #d7c4a1;
  border-radius: 14px;
}

.details > div {
  padding: 14px;
  background: rgba(166, 122, 31, .055);
}

.details > div:nth-child(2) {
  border-left: 1px solid #d7c4a1;
}

.details .wide {
  grid-column: 1 / -1;
  border-top: 1px solid #d7c4a1;
}

.details small {
  display: block;
  margin-bottom: 4px;
  color: #8d7754;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .14em;
}

.details strong {
  font: 600 20px 'Cormorant Garamond', serif;
}

.signature {
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  color: #756247;
}

.signature strong {
  color: #352819;
  font: 700 34px 'Cormorant Garamond', serif;
}

.letter-buttons {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
}

.letter-buttons button {
  padding: 9px 14px;
  border: 1px solid #ccb788;
  border-radius: 999px;
  color: #574323;
  background: rgba(255, 255, 255, .42);
  cursor: pointer;
}

.wax {
  position: absolute;
  z-index: 10;
  left: 50%;
  top: 46%;
  width: clamp(86px, 14vw, 112px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #f5d3a4;
  background:
    radial-gradient(circle at 32% 25%, rgba(255, 255, 255, .22), transparent 25%),
    radial-gradient(circle, #b92f4d, #761126 72%);
  box-shadow:
    inset 0 0 0 5px rgba(78, 8, 23, .25),
    inset 0 0 0 8px rgba(241, 180, 119, .2),
    0 10px 20px rgba(0, 0, 0, .45);
  cursor: pointer;
  transition: .35s;
}

.wax::before,
.wax::after {
  content: '';
  position: absolute;
  inset: 9px;
  border: 2px dotted rgba(248, 214, 170, .53);
  border-radius: 50%;
}

.wax::after {
  inset: 15px;
  border-style: solid;
}

.wax .seal-wordmark {
  position: relative;
  z-index: 2;
  color: #f5d3a4;
  font: 700 clamp(14px, 2.4vw, 20px) 'Cormorant Garamond', serif;
  letter-spacing: -.06em;
  text-shadow: 0 2px 2px rgba(0, 0, 0, .4);
}

.wax:hover {
  transform: translate(-50%, -50%) scale(1.06) rotate(-2deg);
}

.hint {
  margin: 20px 0 0;
  color: #f7df98;
  font-size: 11px;
  letter-spacing: .17em;
  animation: pulse 1.8s infinite;
}

.error {
  max-width: 620px;
  padding: 15px 18px;
  border: 1px solid rgba(248, 113, 113, .33);
  border-radius: 14px;
  color: #fecaca;
  background: rgba(127, 29, 29, .33);
  text-align: center;
}

.envelope.open .flap {
  z-index: 1;
  transform: rotateX(180deg);
}

.envelope.open .wax {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -72%) scale(.5) rotate(18deg);
}

.stage.opened .intro {
  opacity: 0;
  transform: translateY(-18px);
  pointer-events: none;
}

.stage.opened .hint {
  opacity: 0;
}

.invite-page.theme-ivory .intro span,
.invite-page.theme-ivory .hint {
  color: #352819;
}

.invite-page.theme-ivory .intro p {
  color: #40351f;
}

@keyframes pulse {
  50% {
    opacity: .45;
  }
}

/* OPEN CARD FIX */

.invite-page.card-open {
  overflow: hidden;
}

.stage.opened::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(2, 6, 23, .72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.stage.opened .scene {
  perspective: none;
}

.stage.opened .envelope {
  filter: none;
  transform-style: flat;
}

.envelope.open .letter {
  position: fixed;
  z-index: 30;
  left: 50%;
  right: auto;
  top: 50%;
  bottom: auto;
  width: min(700px, calc(100vw - 28px));
  height: auto;
  max-height: calc(100vh - 28px);
  transform: translate(-50%, -50%) scale(1);
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Closed invitation stays fully inside envelope */
.envelope:not(.open) {
  overflow: hidden;
}

@media (max-width: 880px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .info {
    display: none;
  }

  .scene {
    height: min(510px, 79vw);
  }
}

@media (max-width: 680px) {
  .admin-page {
    padding: 16px;
  }

  .admin-topbar {
    flex-direction: column;
  }

  .brand-logo {
    width: 92px;
    height: 52px;
    flex-basis: 92px;
    font-size: 18px;
  }

  .form-grid,
  .nested-grid {
    grid-template-columns: 1fr;
  }

  .form-grid label,
  .nested-grid label,
  .form-grid .full,
  .nested-grid .full {
    grid-column: 1 / -1;
  }

  .content-language-box {
    align-items: flex-start;
    flex-direction: column;
  }

  .content-tabs {
    width: 100%;
  }

  .content-tabs button {
    flex: 1;
  }

  .actions {
    flex-direction: column;
  }

  .copy-row {
    grid-template-columns: 1fr;
  }

  .stage {
    justify-content: flex-start;
    padding-top: 82px;
  }

  .intro {
    margin-bottom: 10px;
  }

  .scene {
    width: 96vw;
    min-height: 300px;
  }

  .invitation-language-switch {
    top: 12px;
    right: 12px;
  }

  .envelope.open .letter {
    left: 50%;
    right: auto;
    top: 50%;
    bottom: auto;
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    transform: translate(-50%, -50%) scale(1);
  }

  .letter-content {
    padding: 42px 23px 38px;
  }

  .details {
    grid-template-columns: 1fr;
  }

  .details > div:nth-child(2) {
    border-top: 1px solid #d7c4a1;
    border-left: 0;
  }

  .details .wide {
    grid-column: auto;
  }
}

@media print {
  body {
    background: #fff !important;
  }

  .intro,
  .back,
  .left,
  .right,
  .bottom,
  .flap,
  .wax,
  .hint,
  .letter-buttons,
  .invitation-language-switch {
    display: none !important;
  }

  .stage,
  .scene,
  .envelope {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    display: block !important;
    padding: 0 !important;
    filter: none !important;
  }

  .letter {
    position: static !important;
    height: auto !important;
    max-height: none !important;
    transform: none !important;
    overflow: visible !important;
    box-shadow: none !important;
  }
}


/* V2: jeden przełącznik języka oraz edytowalna pieczęć */

.single-language-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 1px solid rgba(217, 179, 75, .25);
  border-radius: 16px;
  background: rgba(217, 179, 75, .06);
}

.single-language-notice > strong {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #211704;
  background: linear-gradient(145deg, #f4df85, #b78318);
}

.seal-logo-preview {
  padding: 8px;
  overflow: hidden;
  line-height: .9;
  text-align: center;
  overflow-wrap: anywhere;
}

.mini-envelope b {
  padding: 8px;
  overflow: hidden;
  line-height: .82;
  text-align: center;
  overflow-wrap: anywhere;
}

.wax .seal-wordmark {
  width: 74%;
  line-height: .8;
  text-align: center;
  overflow-wrap: anywhere;
}

@media (max-width: 680px) {
  .single-language-notice {
    align-items: flex-start;
  }
}


/* V3: puste pola podpisu i tekstu pieczęci */

.empty-preview {
  opacity: .55;
  font-family: Inter, sans-serif !important;
  letter-spacing: 0 !important;
}


/* V4: podgląd koloru koperty na żywo */

.live-envelope-preview {
  padding: 20px;
  overflow: hidden;
  border: 1px solid rgba(217, 179, 75, .25);
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, .07), transparent 46%),
    rgba(2, 6, 23, .34);
}

.live-preview-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.live-preview-heading .section-title {
  margin-bottom: 4px;
}

.live-badge {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid rgba(74, 222, 128, .28);
  border-radius: 999px;
  color: #86efac;
  background: rgba(34, 197, 94, .09);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .13em;
}

.editor-envelope-wrap {
  min-height: 270px;
  display: grid;
  place-items: center;
  padding: 28px 10px 8px;
}

.editor-envelope {
  --preview-env: #173760;
  --preview-env-light: #214b7f;
  --preview-env-dark: #0d2442;
  width: min(430px, 88vw);
  aspect-ratio: 1.55 / 1;
  position: relative;
  overflow: hidden;
  border-radius: 7px;
  filter: drop-shadow(0 24px 25px rgba(0, 0, 0, .4));
  transition: filter .25s ease, transform .25s ease;
}

.editor-envelope.preview-changing {
  transform: scale(1.018);
  filter: drop-shadow(0 30px 32px rgba(0, 0, 0, .48)) brightness(1.07);
}

.editor-envelope-back,
.editor-envelope-left,
.editor-envelope-right,
.editor-envelope-bottom,
.editor-envelope-flap {
  position: absolute;
  inset: 0;
  border-radius: 7px;
  transition: background .35s ease;
}

.editor-envelope-back {
  background: linear-gradient(145deg, var(--preview-env), var(--preview-env-dark));
}

.editor-envelope-left {
  z-index: 3;
  clip-path: polygon(0 0, 52% 52%, 0 100%);
  background: linear-gradient(145deg, var(--preview-env), var(--preview-env-dark));
}

.editor-envelope-right {
  z-index: 3;
  clip-path: polygon(100% 0, 48% 52%, 100% 100%);
  background: linear-gradient(225deg, var(--preview-env), var(--preview-env-dark));
}

.editor-envelope-bottom {
  z-index: 4;
  clip-path: polygon(0 100%, 50% 46%, 100% 100%);
  background: linear-gradient(0deg, var(--preview-env-dark), var(--preview-env));
}

.editor-envelope-flap {
  z-index: 5;
  clip-path: polygon(0 0, 100% 0, 50% 58%);
  background: linear-gradient(160deg, var(--preview-env-light), var(--preview-env));
}

.editor-envelope-seal {
  position: absolute;
  z-index: 7;
  left: 50%;
  top: 47%;
  width: 92px;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  padding: 10px;
  overflow: hidden;
  border: 3px double #e5ad77;
  border-radius: 50%;
  color: #f6d3a2;
  background:
    radial-gradient(circle at 31% 25%, rgba(255, 255, 255, .2), transparent 24%),
    radial-gradient(circle, #b92f4d, #761126 72%);
  box-shadow:
    inset 0 0 0 5px rgba(78, 8, 23, .25),
    0 9px 17px rgba(0, 0, 0, .38);
  font: 700 16px/.82 'Cormorant Garamond', serif;
  text-align: center;
  overflow-wrap: anywhere;
  transition: transform .25s ease;
}

.editor-envelope.preview-changing .editor-envelope-seal {
  transform: translate(-50%, -50%) scale(1.06);
}

/* Kolory podglądu */
.preview-theme-navy {
  --preview-env: #173760;
  --preview-env-light: #214b7f;
  --preview-env-dark: #0d2442;
}

.preview-theme-burgundy {
  --preview-env: #76233b;
  --preview-env-light: #96334f;
  --preview-env-dark: #4a1022;
}

.preview-theme-emerald {
  --preview-env: #0d5c4f;
  --preview-env-light: #147768;
  --preview-env-dark: #073b34;
}

.preview-theme-ivory {
  --preview-env: #eadfc8;
  --preview-env-light: #f7eedc;
  --preview-env-dark: #c9baa0;
}

/* Ten sam live kolor dla małej koperty po prawej */
.mini-envelope {
  background: linear-gradient(145deg, var(--preview-env, #173760), var(--preview-env-dark, #0d2442));
  transition: background .35s ease, transform .25s ease, filter .25s ease;
}

.mini-envelope .mini-flap {
  background: linear-gradient(160deg, var(--preview-env-light, #214b7f), var(--preview-env, #173760));
  transition: background .35s ease;
}

.mini-envelope.preview-changing {
  transform: scale(1.025);
  filter: brightness(1.08);
}

@media (max-width: 680px) {
  .live-preview-heading {
    flex-direction: column;
  }

  .editor-envelope-wrap {
    min-height: 220px;
    padding-top: 22px;
  }

  .editor-envelope-seal {
    width: 76px;
  }
}
