/* --- MODE SMARTPHONE / MOBILE --- */
@media (max-width: 768px) {
  :root {
    --text-xs: 0.75rem;
    --text-sm: 0.85rem;
    --text-base: 0.95rem;
    --text-lg: 1.05rem;
    --text-xl: 1.4rem;
    --text-2xl: 1.8rem;
    --text-3xl: 2.2rem;

    --space-1: 0.25rem;
    --space-2: 0.4rem;
    --space-3: 0.6rem;
    --space-4: 0.8rem;
    --space-5: 1rem;
    --space-6: 1.25rem;
    --space-8: 1.75rem;
    --space-10: 2.1rem;
    --space-12: 2.5rem;
    --space-16: 3rem;
  }

  body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .screen {
    position: relative;
    inset: auto;
    min-height: 100dvh;
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
  }

  /* --- ACCUEIL --- */
  .screen-welcome {
    padding-top: calc(var(--space-8) + env(safe-area-inset-top, 0px));
    padding-bottom: calc(var(--space-8) + env(safe-area-inset-bottom, 0px));
  }

  .welcome-card {
    max-width: 100%;
    width: 100%;
    padding: var(--space-6);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
  }

  .wedding-title {
    font-size: var(--text-2xl);
  }

  .subtitle {
    font-size: var(--text-base);
    margin-top: var(--space-3);
  }

  .welcome-desc {
    font-size: var(--text-sm);
    margin-top: var(--space-4);
    line-height: 1.5;
  }

  .btn-start {
    width: 100%;
    margin-top: var(--space-6);
    min-height: 64px;
    font-size: var(--text-lg);
    padding-inline: var(--space-4);
  }

  .btn-back.btn-back-large {
    width: 100%;
    justify-content: center;
    margin-top: var(--space-4);
  }

  #connectBtn {
    margin-top: var(--space-4);
    width: 100%;
  }

  /* --- CHOIX DU MODE --- */
  .screen-mode {
    padding-top: calc(var(--space-6) + env(safe-area-inset-top, 0px));
  }

  .mode-title {
    font-size: var(--text-xl);
    margin-bottom: var(--space-4);
  }

  .mode-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .mode-card {
    padding: var(--space-5);
    min-height: 0;
  }

  .mode-icon {
    font-size: 2.4rem;
  }

  .mode-label {
    font-size: var(--text-lg);
  }

  .mode-desc {
    font-size: var(--text-sm);
  }

  .screen-mode .btn-back {
    margin-top: var(--space-4);
    width: 100%;
    justify-content: center;
  }

  /* --- CAMERA --- */
  .screen-camera {
    padding: 0;
    background: #000;
  }

  .camera-wrapper {
    width: 100%;
    height: 100dvh;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  #video-preview {
    width: 100%;
    height: auto;
    flex: 1 1 auto;
    object-fit: cover;
  }

  .camera-header {
    position: absolute;
    top: env(safe-area-inset-top, 0px);
    left: 0;
    right: 0;
    padding: var(--space-3) var(--space-4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
  }

  .camera-header .btn-back {
    padding-inline: var(--space-3);
    min-height: 40px;
    font-size: var(--text-sm);
  }

  .camera-header .mode-badge {
    font-size: var(--text-xs);
    padding: var(--space-1) var(--space-2);
    white-space: nowrap;
  }

  .viewfinder-frame {
    width: 85vw;
    height: auto;
    aspect-ratio: 3 / 4;
  }

  .camera-controls {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(env(safe-area-inset-bottom, 0px));
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
  }

  .strip-preview {
    order: 1;
    width: 100%;
    justify-content: center;
    gap: var(--space-2);
  }

  .strip-thumb {
    width: 48px;
    height: 48px;
  }

  .btn-shutter {
    order: 2;
    width: 88px;
    height: 88px;
  }

  .filters-row {
    order: 3;
    width: 100%;
    padding-inline: var(--space-3);
    bottom: auto;
    position: static;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .filter-btn {
    min-width: 64px;
  }

  .filter-preview {
    width: 44px;
    height: 32px;
  }

  /* --- RESULTAT / STRIP --- */
  .screen-result {
    padding: var(--space-4);
    padding-top: calc(var(--space-6) + env(safe-area-inset-top, 0px));
    padding-bottom: calc(var(--space-6) + env(safe-area-inset-bottom, 0px));
    justify-content: flex-start;
    align-items: stretch;
    overflow-y: auto;
  }

  .result-title {
    font-size: var(--text-xl);
    margin-bottom: var(--space-4);
  }

  .result-shell {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    width: 100%;
  }

  .strip-container {
    max-width: 100%;
    margin: 0 auto;
  }

  .result-side {
    width: 100%;
    align-items: center;
  }

  .qr-wrap {
    width: 100%;
    align-items: center;
  }

  .qr-box {
    min-width: 220px;
    min-height: 220px;
  }

  .result-actions {
    flex-direction: column;
    width: 100%;
  }

  .btn-action {
    width: 100%;
    justify-content: center;
  }

  /* --- GALERIE --- */
  .screen-gallery {
    padding: var(--space-4);
    padding-top: calc(var(--space-6) + env(safe-area-inset-top, 0px));
    padding-bottom: calc(var(--space-6) + env(safe-area-inset-bottom, 0px));
  }

  .gallery-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }

  .gallery-title {
    font-size: var(--text-xl);
  }

  .gallery-grid {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .gallery-item {
    aspect-ratio: 3 / 4;
  }

  .btn-back {
    min-height: 44px;
    font-size: var(--text-sm);
  }

  /* --- TOAST & CONFETTI --- */
  .toast {
    bottom: calc(var(--space-6) + env(safe-area-inset-bottom, 0px));
    font-size: var(--text-sm);
  }
}