:root {
  --paper: #f5f1e9;
  --paper-dark: #e9e3d7;
  --ink: #181715;
  --muted: #77736b;
  --line: #d8d1c5;
  --accent: #a9362c;
  --white: #fffdf8;
  --radius: 2px;
}

/* =========================================================
   BASE
========================================================= */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
}

button,
input,
textarea {
  font: inherit;
}

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

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

/* =========================================================
   HEADER
========================================================= */

.site-header {
  height: 76px;
  padding: 0 5vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.logo {
  font-size: 22px;
  text-decoration: none;
  letter-spacing: -0.03em;
}

.header-note {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* =========================================================
   TYPOGRAPHIE
========================================================= */

.eyebrow {
  margin: 0 0 22px;
  font-family: Arial, sans-serif;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

h1 {
  margin: 0;
  font-weight: 400;
  letter-spacing: -0.045em;
}

/* =========================================================
   BOUTONS
========================================================= */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border: 0;
  border-radius: 6px;
  background: var(--ink);
  color: var(--white);
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    opacity 0.15s ease;
}

.button[hidden] {
  display: none !important;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  opacity: 0.5;
  cursor: wait;
}

.button.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.flip-button[hidden] {
  display: none !important;
}

/* =========================================================
   HOME
========================================================= */

.home-main {
  min-height: calc(100vh - 76px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 8vw;
  padding: 8vw 10vw;
}

.home-copy h1 {
  font-size: clamp(42px, 5vw, 76px);
  line-height: 0.98;
}

.home-description {
  max-width: 460px;
  margin: 30px 0 36px;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.55;
}

.home-card {
  width: min(420px, 80%);
  aspect-ratio: 1.45;
  margin: auto;
  position: relative;
  transform: rotate(-3deg);
}

.home-card-front,
.home-card-back {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--white);
  box-shadow:
    0 28px 55px rgba(0, 0, 0, 0.16),
    0 8px 16px rgba(0, 0, 0, 0.09);
}

.home-card-front {
  z-index: 2;
}

.home-card-back {
  z-index: 1;
  transform: translate(32px, 32px);
}

/* =========================================================
   STUDIO / ÉDITION
========================================================= */

.studio {
  width: min(760px, calc(100% - 40px));
  margin: 0 auto;
  padding: 70px 0 110px;
  display: flex;
  flex-direction: column;
}

.editor {
  width: 100%;
  padding-top: 10px;
}

.editor-intro {
  margin-bottom: 30px;
}

.editor-intro h1 {
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1;
  margin-bottom: 40px;
}

.preview-column {
  width: 100%;
  margin-top: 70px;
}

.preview-label {
  margin-bottom: 20px;
  font-family: Arial, sans-serif;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* =========================================================
   FORMULAIRE
========================================================= */

form {
  margin-top: 0;
}

.field {
  margin-bottom: 20px;
}

.field > label {
  display: block;
  margin-bottom: 10px;
  font-family: Arial, sans-serif;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

input,
textarea {
  width: 100%;
  padding: 15px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  outline: none;
  background: transparent;
  color: var(--ink);
  border-radius: 4px;
}

input:focus,
textarea:focus {
  border-color: var(--ink);
}

textarea {
  resize: vertical;
  line-height: 1.6;
}

.field input,
.field textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 15px;
  background: rgba(255, 255, 255, 0.18);
}

.field input:disabled {
  color: var(--muted);
  cursor: not-allowed;
}

.field textarea {
  resize: vertical;
}

.editor-grid {
  display: grid;
  grid-template-columns:
    minmax(0, 1fr)
    minmax(0, 1fr);
  gap: 30px;
}

.form-footer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 20px;
  margin-top: 0px;
}

.form-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.form-footer p.error {
  color: var(--accent);
}

.advanced-options {
  margin-top: 20px;
}

.advanced-options summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
}

.advanced-options-content {
  margin-top: 14px;
}

.long-story-option {
  flex: 1 1 0;
  min-width: 0;
  max-width: 420px;
}

.long-story-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  cursor: pointer;
  white-space: nowrap;
}

.long-story-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  flex: 0 0 18px;
}

.long-story-help {
  margin: 6px 0 0;
  max-width: 420px;
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 12px;
  line-height: 1.4;
}

.long-story-warning {
  margin-right: 8px;
  color: var(--accent);
  font-size: 11px;
  line-height: 1.4;
}

.field-warning {
  margin-left: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: normal;
  text-transform: none;
  letter-spacing: normal;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 0 0 auto;
  width: auto;
  flex-wrap: wrap;
}

.form-actions .button {
  width: auto;
  margin: 0;
  flex: 0 0 auto;
}

.form-status {
  flex-basis: 100%;
  width: 100%;
  margin: 10px 0 0;
  min-height: 24px;
  text-align: center;
}

.character-count {
  margin-top: 8px;
  text-align: right;
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 10px;
}

/* =========================================================
   UPLOAD
========================================================= */

.upload-zone {
  min-height: 150px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.18);
  cursor: pointer;
  text-align: center;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    transform 0.2s ease;
}

.upload-zone:hover {
  border-color: var(--ink);
  background: rgba(255, 255, 255, 0.4);
}

.upload-zone.dragging {
  border-color: var(--accent);
  background: rgba(169, 54, 44, 0.05);
  transform: scale(1.01);
}

.upload-zone input {
  display: none;
}

.upload-zone.disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.upload-zone.disabled * {
  pointer-events: none;
}

.upload-icon {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-family: Arial, sans-serif;
  font-size: 18px;
  font-weight: 300;
}

.upload-title {
  font-size: 17px;
}

.upload-subtitle {
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 10px;
  line-height: 1.5;
}

.upload-filename {
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 10px;
  line-height: 1.4;
  word-break: break-word;
}

/* =========================================================
   CRÉATION — GRILLE
========================================================= */

.creation-grid {
  display: grid;
  grid-template-columns:
    minmax(0, 0.9fr)
    minmax(0, 1.1fr);
  gap: 20px 30px;
  align-items: start;
}

.creation-photo {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
}

.creation-photo .field {
  height: 100%;
  margin-bottom: 0;
}

.creation-photo .upload-zone {
  height: 220px;
  min-height: 220px;
}

.creation-fields {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}

.creation-fields > .field {
  height: 100%;
  margin-bottom: 0;
}

.creation-fields textarea {
  height: 220px;
  min-height: 220px;
}

.field-sender {
  grid-column: 1;
  grid-row: 2;
  margin: 0;
}

.field-recipient {
  grid-column: 2;
  grid-row: 2;
  margin: 0;
}

.creation-grid > .field-sender,
.creation-grid > .field-recipient {
  margin-bottom: 0;
}

.creation-grid .form-footer {
  grid-column: 1 / -1;
  grid-row: 3;
}

/* =========================================================
   POSTCARD — BASE
========================================================= */

.postcard-scene {
  width: min(760px, 92vw);
  aspect-ratio: 1.48 / 1;
  perspective: 1600px;
  cursor: pointer;
  outline: none;
  margin: 0 auto;
}

.postcard {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.9s cubic-bezier(0.2, 0.75, 0.2, 1);
}

.postcard-scene.is-flipped .postcard {
  transform: rotateY(180deg);
}

.postcard-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: var(--white);
  border: 1px solid #ded6c9;
  box-shadow: 0 25px 80px rgba(30, 25, 18, 0.15);
  overflow: hidden;
}

/* =========================================================
   POSTCARD — RECTO
========================================================= */

.postcard-front {
  padding: 18px;
  transform: rotateY(0deg);
}

.photo-placeholder {
  position: absolute;
  inset: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #d8d0c2, #eee9df);
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
}

.postcard-front .photo-preview {
  position: absolute;
  inset: 18px;
  width: calc(100% - 36px);
  height: calc(100% - 36px);
  object-fit: cover;
  display: none;
}

.postcard-front .photo-preview.visible {
  display: block;
}

.front-caption {
  position: absolute;
  left: 45px;
  bottom: 38px;
  color: white;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
  text-shadow:
    0 1px 3px rgba(0, 0, 0, 0.9),
    0 2px 8px rgba(0, 0, 0, 0.7);
}

/* =========================================================
   POSTCARD — VERSO
========================================================= */

.postcard-back {
  transform: rotateY(180deg);
  padding: 45px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}

.story-preview {
  grid-column: 1;
  display: flex;
  align-items: center;
}

.story-preview p {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.65;
  letter-spacing: 0;
  white-space: pre-wrap;
}

.address {
  grid-column: 2;
  border-left: 1px solid var(--line);
  padding-left: 40px;
}

.address .stamp {
  margin-left: auto;
  margin-bottom: 45px;
  width: 62px;
  height: 62px;
  border: 1px solid #bdb4a6;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 11px;
  color: var(--ink);
  transform: rotate(3deg);
}

.address h3 {
  margin: 0 0 18px;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
}

.address p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: clamp(10px, 1.5vw, 16px);
  line-height: 1.5;
}

/* =========================================================
   FLIP
========================================================= */

.flip-button {
  display: block;
  margin: 18px auto 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* =========================================================
   APERÇU CRÉATION — MOBILE
========================================================= */

@media (max-width: 850px) {
  .preview-column .postcard-back {
    display: grid;
    grid-template-columns:
      minmax(0, 1.15fr)
      minmax(0, 0.85fr);
    gap: 14px;
    padding: 18px;
  }

  .preview-column .story-preview {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    display: flex;
    align-items: center;
  }

  .preview-column .story-preview p {
    font-size: 10px;
    line-height: 1.3;
    white-space: pre-wrap;
    overflow-wrap: break-word;
  }

  .preview-column .address {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    border-left: 1px solid var(--line);
    border-top: 0;
    padding-left: 14px;
    padding-top: 0;
  }

  .preview-column .address h3 {
    font-size: 12px;
    line-height: 1.05;
    margin: 0 0 8px;
  }

  .preview-column .address p {
    font-size: 8px;
    line-height: 1.3;
  }

  .preview-column .address .stamp {
    width: 38px;
    height: 44px;
    margin-bottom: 10px;
    margin-top: -8px;
    font-size: 8px;
  }
}

@media (min-width: 601px) and (max-width: 850px) {
  .preview-column .postcard-back {
    padding: 30px 40px;
    gap: 28px;
  }

  .preview-column .story-preview p {
    font-size: 13px;
    line-height: 1.4;
  }

  .preview-column .address {
    padding-left: 24px;
  }
}

/* =========================================================
   CREATED
========================================================= */

.created {
  min-height: calc(100vh - 76px);
  max-width: 760px;
  margin: auto;
  padding: 12vh 30px;
}

.created h1 {
  font-size: clamp(48px, 7vw, 88px);
  line-height: 0.95;
}

.created > p:not(.eyebrow) {
  margin: 25px 0 50px;
  color: var(--muted);
  font-size: 20px;
}

.share-box {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 30px;
}

.share-box input {
  flex: 1;
  padding: 0 15px;
  border: 1px solid var(--line);
}

.share-box #editButton {
  order: 5;
  margin-top: 4px;
}

.share-box #downloadButton {
  order: 4;
}

.text-link {
  font-size: 13px;
  color: var(--muted);
  text-underline-offset: 4px;
}

.expiration-note {
  margin: 10px 0 35px !important;
  font-family: Arial, sans-serif;
  font-size: 10px !important;
  letter-spacing: 0.02em;
  color: var(--muted);
}

/* =========================================================
   RECEIVER — BASE
========================================================= */

.receiver-main {
  min-height: calc(100vh - 76px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 50px 25px;
}

.receiver-card {
  width: min(900px, 100%);
  --story-size: clamp(10px, 2.2vw, 18px);
  --recipient-size: clamp(14px, 3vw, 28px);
  --secondary-size: clamp(8px, 1.5vw, 14px);
}

.receiver-card .postcard-scene {
  width: 100%;
}

.receiver-card .story-preview p {
  font-size: var(--story-size);
  line-height: 1.5;
}

.receiver-card .address h3 {
  font-size: var(--recipient-size);
  line-height: 1.15;
}

.loading {
  color: var(--muted);
  font-size: 14px;
}

.error-page {
  color: var(--muted);
  text-align: center;
}

/* =========================================================
   RECEIVER — PORTRAIT MOBILE
========================================================= */

@media (max-width: 850px) and (orientation: portrait) {
  .receiver-card {
    --story-size: clamp(9px, 1.9vw, 16px);
  }

  .receiver-card::before {
    content: "La carte préfère le paysage.";
    display: block;
    margin-bottom: 18px;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
  }
}

/* =========================================================
   RECEIVER — MOBILE
   Toujours 2 colonnes au verso
========================================================= */

@media (max-width: 850px) {
  .receiver-card .postcard-back {
    display: grid;
    grid-template-columns:
      minmax(0, 1.15fr)
      minmax(0, 0.85fr);
  }

  .receiver-card .story-preview {
    grid-column: 1;
    grid-row: 1;
  }

  .receiver-card .address {
    grid-column: 2;
    grid-row: 1;
    border-left: 1px solid var(--line);
    border-top: 0;
  }
}

/* =========================================================
   RECEIVER — PETIT MOBILE
========================================================= */

@media (max-width: 600px) {
  .receiver-main {
    padding: 30px 12px 50px;
    align-items: flex-start;
  }

  .receiver-card {
    width: 100%;
  }

  .receiver-card .postcard-scene {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 1.48 / 1;
  }

  .receiver-card .postcard-back {
    padding: 18px;
    gap: 14px;
  }

  .receiver-card .story-preview {
    min-width: 0;
    display: flex;
    align-items: center;
    overflow: hidden;
  }

  .receiver-card .story-preview p {
    margin: 0;
    line-height: 1.3;
    white-space: pre-wrap;
    overflow-wrap: break-word;
  }

  .receiver-card .address {
    min-width: 0;
    padding-left: 14px;
    padding-top: 0;
  }

  .receiver-card .address .stamp {
    width: 42px;
    height: 50px;
    margin-left: auto;
    margin-bottom: 16px;
    font-size: 9px;
  }

  .receiver-card .address h3 {
    margin: 0 0 10px;
    font-size: 14px;
    line-height: 1.05;
  }

  .receiver-card .address p {
    margin: 0 0 9px;
    font-size: clamp(8px, 1.5vw, 13px);
    line-height: 1.3;
  }
}

/* =========================================================
   RECEIVER — FORMAT INTERMÉDIAIRE
========================================================= */

@media (min-width: 601px) and (max-width: 850px) {
  .receiver-card .postcard-back {
    padding: 30px 40px;
    gap: 28px;
    grid-template-columns:
      minmax(0, 1.15fr)
      minmax(0, 0.85fr);
  }

  .receiver-card .story-preview {
    padding-right: 18px;
  }

  .receiver-card .story-preview p {
    font-size: 13px;
    line-height: 1.4;
  }

  .receiver-card .address {
    padding-left: 24px;
  }
}

/* =========================================================
   RECEIVER — DESKTOP
========================================================= */

@media (min-width: 851px) {
  .receiver-card .address h3,
  .receiver-card .address p {
    transform: translateY(20px);
  }
}

/* =========================================================
   RECEIVER — PAYSAGE MOBILE
========================================================= */

@media (max-width: 850px) and (orientation: landscape) {
  .receiver {
    overflow: hidden;
  }

  .receiver-main {
    position: fixed;
    inset: 0;
    width: 100dvw;
    height: 100dvh;
    padding: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .receiver-card {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    --story-size: clamp(9px, 1.9dvh, 14px);
    --recipient-size: clamp(13px, 3dvh, 22px);
    --secondary-size: clamp(8px, 1.5dvh, 12px);
  }

  .receiver .postcard-scene {
    width: min(100dvw, calc(100dvh * 1.48));
    height: min(100dvh, calc(100dvw / 1.48));
    margin: 0;
    aspect-ratio: 1.48 / 1;
  }

  .receiver-card .postcard-back {
    display: grid;
    grid-template-columns:
      minmax(0, 1.15fr)
      minmax(0, 0.85fr);
    gap: 12px;
    padding: 15px 30px;
    margin: 5px;
    align-items: stretch;
  }

  .receiver-card .story-preview {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    align-items: center;
    min-width: 0;
    max-width: 100%;
    padding-right: 18px;
  }

  .receiver-card .story-preview p {
    font-size: var(--story-size);
    line-height: 1.4;
    white-space: pre-wrap;
    overflow-wrap: break-word;
  }

  .receiver-card .address {
    grid-column: 2;
    grid-row: 1;
    align-self: stretch;
    border-left: 1px solid var(--line);
    border-top: 0;
    padding-left: 24px;
    padding-top: 0;
    margin-top: -24px;
    margin-bottom: -24px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .receiver-card .address .stamp {
    position: absolute;
    top: 30px;
    right: -10px;
    width: 38px;
    height: 44px;
    margin: 0;
    font-size: 8px;
  }

  .receiver-card .address h3 {
    font-size: var(--recipient-size);
    line-height: 1.05;
    margin: 0 0 8px;
  }

  .receiver-card .address p {
    font-size: var(--secondary-size);
    line-height: 1.3;
    margin: 0 0 6px;
  }

  .receiver-card .front-caption {
    left: 18px;
    bottom: 18px;
    font-size: 14px;
  }

  .receiver .flip-button {
    display: none;
  }

  .receiver .site-header {
    position: relative;
    z-index: 100;
    pointer-events: none;
    border-bottom: 0;
  }

  .receiver .site-header .logo {
    position: relative;
    z-index: 101;
    pointer-events: auto;
  }
}

/* =========================================================
   TRÈS PETIT MOBILE — CRÉATION
========================================================= */

@media (max-width: 400px) {
  .mobile-scroll-hint {
    display: none;
  }

  .creation-grid {
    grid-template-columns:
      minmax(0, 0.9fr)
      minmax(0, 1.1fr);
    gap: 16px;
  }

  .creation-photo {
    grid-column: 1;
    grid-row: 1;
  }

  .creation-fields {
    grid-column: 2;
    grid-row: 1;
  }

  .field-sender {
    grid-column: 1;
    grid-row: 2;
  }

  .field-recipient {
    grid-column: 2;
    grid-row: 2;
  }

  .creation-grid .form-footer {
    grid-column: 1 / -1;
    grid-row: 3;
  }
}

/* =========================================================
   MOBILE — GÉNÉRAL
========================================================= */

@media (max-width: 850px) {
  .site-header {
    height: 64px;
    padding: 0 20px;
  }

  .header-note {
    display: none;
  }

  .home-main {
    min-height: calc(100vh - 64px);
    grid-template-columns: 1fr;
    padding: 60px 25px;
    gap: 70px;
  }

  .home-card {
    width: 90%;
  }

  .studio {
    width: min(100% - 28px, 760px);
    padding: 70px 0;
  }

  .preview-column {
    margin-top: 75px;
  }

  .postcard-scene {
    width: 100%;
  }

  .postcard-front {
    padding: 9px;
  }

  .photo-placeholder {
    inset: 9px;
  }

  .postcard-front .photo-preview {
    inset: 9px;
    width: calc(100% - 18px);
    height: calc(100% - 18px);
  }

  .front-caption {
    left: 25px;
    bottom: 25px;
    font-size: 19px;
  }

  .postcard-back {
    padding: 25px;
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .story-preview {
    grid-column: 1;
  }

  .story-preview p {
    font-size: 21px;
    line-height: 1.45;
  }

  .address {
    grid-column: 1;
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: 20px;
  }

  .address .stamp {
    width: 52px;
    height: 56px;
    margin-bottom: 20px;
  }

  .editor-grid {
    grid-template-columns:
      minmax(0, 1fr)
      minmax(0, 1fr);
    gap: 16px;
  }

  .form-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
  }

  .long-story-option {
    width: 100%;
    max-width: none;
  }

  .long-story-help {
    max-width: 100%;
  }

  .form-footer .button {
    width: 100%;
  }

  .form-actions {
    flex-direction: column;
    width: 100%;
  }

  .form-actions .button {
    width: 100%;
  }

  .creation-grid {
    grid-template-columns:
      minmax(0, 0.9fr)
      minmax(0, 1.1fr);
    gap: 20px;
  }

  .creation-photo .upload-zone {
    min-height: 220px;
    height: 220px;
    padding: 15px;
  }

  .creation-fields textarea {
    min-height: 220px;
    height: 220px;
  }

  .creation-fields input,
  .creation-fields textarea {
    font-size: 14px;
  }

  .mobile-scroll-hint {
    display: block;
    margin: 12px 0 28px;
    text-align: center;
    color: var(--muted);
    font-family: Arial, sans-serif;
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .upload-zone {
    min-height: 135px;
  }

  .share-box {
    flex-direction: column;
  }

  .share-box .button {
    width: 100%;
  }

  .share-box #shareButton {
    display: block;
    order: 3;
    width: 100%;
    background: var(--ink);
    color: var(--white);
    border: 0;
  }

  .share-box #copyButton {
    order: 4;
    width: 100%;
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--line);
  }

  .share-box #shareUrl {
    order: 5;
    width: 100%;
  }

  .share-box #editButton {
    order: 1;
  }

  .share-box #downloadButton {
    order: 2;
  }
}

/* =========================================================
   ACCESSIBILITÉ
========================================================= */

@media (prefers-reduced-motion: reduce) {
  .postcard {
    transition: none;
  }
}

/* =========================================================
   POSTCARD — SVG / IMPRESSION
========================================================= */

.postcard-back svg {
  width: 100%;
  height: 100%;
  display: block;
}

.postcard-face.postcard-back {
  display: block !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden;
}

.postcard-face.postcard-back svg {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.print-button {
  margin-top: 8px;
  opacity: 0.65;
}

.print-back {
  width: 100%;
  height: auto;
}

.print-back svg {
  display: block;
  width: 100%;
  height: auto;
}

/* =========================================================
   ACTIONS SOUS LA CARTE REÇUE
========================================================= */

.receiver-card .flip-button {
  display: block;
  width: auto;
  margin: 18px auto 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12px;
  line-height: 1.2;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

.receiver-card .flip-button:hover {
  background: transparent;
  border-color: transparent;
  color: var(--ink);
}

.receiver-card .flip-button:active {
  transform: none;
}

.receiver-card .flip-button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* =========================================================
   ACTIONS SECONDAIRES
========================================================= */

.receiver-card .print-button {
  display: inline-block;
  width: auto;
  margin: 12px 6px 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 11px;
  line-height: 1.4;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.receiver-card .print-button:hover {
  background: transparent;
  color: var(--ink);
}

.receiver-card .print-button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

@media (max-width: 850px) and (orientation: landscape) {
  .receiver-card .flip-button {
    display: none;
  }
}

/* =========================================================
   EXEMPLE
========================================================= */

#exampleButton.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  position: relative;
}

#exampleButton.disabled:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  width: max-content;
  max-width: 260px;
  padding: 8px 12px;
  border-radius: 5px;
  background: var(--ink);
  color: var(--white);
  font-size: 13px;
  line-height: 1.3;
  white-space: normal;
  z-index: 20;
  pointer-events: none;
}

#exampleButton[hidden] {
  display: none !important;
}

/* =========================================================
   FOOTER
========================================================= */

.site-footer {
  margin-top: 40px;
  padding: 28px 20px 32px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.site-footer p {
  margin: 0 0 8px;
}

.site-footer a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.site-footer a:hover {
  opacity: 0.7;
}

/* =========================================================
   CRÉATION — PETIT MOBILE
========================================================= */

@media (max-width: 600px) {
  .creation-grid {
    display: flex;
    flex-direction: column;
    width: 100%;
  }

  .creation-photo {
    order: 1;
    width: 100%;
  }

  .creation-fields {
    order: 2;
    width: 100%;
  }

  .field-sender {
    order: 3;
    width: 100%;
  }

  .field-recipient {
    order: 4;
    width: 100%;
  }

  .form-footer {
    order: 5;
    width: 100%;
  }

  .creation-fields textarea {
    min-height: 360px;
  }

  .creation-photo .upload-zone {
    min-height: 110px;
    height: 110px;
    padding: 15px;
  }
}

/* =========================================================
   MENTIONS LÉGALES
========================================================= */

.legal-page {
  width: min(680px, calc(100% - 40px));
  margin: 0 auto;
  padding: 90px 0 110px;
}

.legal-intro {
  margin-bottom: 70px;
}

.legal-intro h1 {
  font-size: clamp(38px, 6vw, 64px);
  line-height: 0.98;
}

.legal-intro > p:last-child {
  max-width: 480px;
  margin-top: 28px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.5;
}

.legal-content section {
  margin-bottom: 52px;
}

.legal-content h2 {
  margin: 0 0 18px;
  font-size: 24px;
  font-weight: 400;
  line-height: 1.15;
}

.legal-content p,
.legal-content li {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.legal-content p {
  margin: 0 0 16px;
}

.legal-content ul {
  margin: 0 0 20px;
  padding-left: 22px;
}

.legal-content strong {
  color: var(--ink);
  font-weight: 400;
}

.legal-content a {
  color: var(--ink);
}

.legal-updated {
  margin-top: 70px !important;
  font-family: Arial, sans-serif;
  font-size: 10px !important;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (max-width: 600px) {
  .legal-page {
    width: calc(100% - 32px);
    padding: 65px 0 80px;
  }

  .legal-intro {
    margin-bottom: 50px;
  }

  .legal-content section {
    margin-bottom: 42px;
  }

  .legal-content h2 {
    font-size: 21px;
  }

  .legal-content p,
  .legal-content li {
    font-size: 14px;
  }
}
