<style>
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  :root {
    --ink: #0d0d0f; --paper: #f5f0e8; --muted: #a09a8c;
    --accent: #c97c3a; --border: rgba(160,154,140,0.25); --glass: rgba(13,13,15,0.82);
  }
  body { background: var(--ink); color: var(--paper); font-family: 'DM Mono', monospace; font-weight: 300; min-height: 100vh; overflow-x: hidden; }

  /* HEADER */
  header { display: flex; align-items: center; justify-content: space-between; padding: 1.5rem 2.5rem; border-bottom: 0.5px solid var(--border); position: sticky; top: 0; background: rgba(13,13,15,0.9); backdrop-filter: blur(12px); z-index: 100; }
  .logo { font-family: 'Cormorant Garamond', serif; font-size: 1.6rem; font-weight: 300; letter-spacing: 0.05em; }
  .logo em { color: var(--accent); font-style: italic; }
  .btn { background: transparent; border: 0.5px solid var(--border); color: var(--muted); font-family: 'DM Mono', monospace; font-size: 0.68rem; letter-spacing: 0.1em; padding: 0.4rem 0.9rem; cursor: pointer; transition: all 0.2s; text-transform: uppercase; }
  .btn:hover { border-color: var(--accent); color: var(--accent); }

  /* SCRABBLE 3D */
  main { padding: 1.5rem 2.5rem 8rem; }
  .gallery-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 0.5px solid var(--border); }
  .photo-count { font-size: 0.68rem; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }

  /* ── Scène & plateau incliné ── */
  #scrWrap {
    display: flex; justify-content: center; align-items: flex-start;
    perspective: 1200px; perspective-origin: 50% 10%;
    padding-bottom: 3rem;
  }
  #scrBoardWrap {
    transform: rotateX(56deg) rotateZ(-3deg);
    transform-origin: center 65%;
    transform-style: preserve-3d;
    transition: transform 0.5s cubic-bezier(.4,0,.2,1);
  }
  #scrWrap:hover #scrBoardWrap { transform: rotateX(30deg) rotateZ(-1deg); }

  #scrBoard {
    display: grid;
    gap: 0;
    background: #080604;
    border: 5px solid #080604;
    box-shadow:
      0 0 0 1px rgba(245,240,232,0.1),
      0 0 0 3px #080604,
      0 32px 100px rgba(0,0,0,0.98);
    transform-style: preserve-3d;
  }

  .scr-cell { position: relative; overflow: hidden; }

  /* Case blanche vide */
  .cell-white {
    background: #EDE8D5;
    outline: 1px solid rgba(60,45,15,0.18);
  }

  /* Case noire */
  .cell-black {
    background: #0D0A07;
    box-shadow: inset 1px 1px 4px rgba(0,0,0,0.7),
                inset -1px -1px 2px rgba(255,255,240,0.02);
  }

  /* Numéro de définition */
  .cell-num {
    position: absolute; top: 2px; left: 2px;
    font-size: 0.32rem; color: rgba(25,15,2,0.6);
    font-family: 'DM Mono', monospace;
    line-height: 1; z-index: 3; font-weight: 300;
    pointer-events: none;
  }

  /* Case photo (case blanche avec image) */
  .scr-tile {
    background: #EDE8D5;
    cursor: pointer;
    outline: 1px solid rgba(60,45,15,0.18);
    transform-style: preserve-3d;
    transition: transform 0.2s cubic-bezier(.2,.8,.3,1), box-shadow 0.2s;
    box-shadow: 0 2px 0 rgba(0,0,0,0.4), 0 3px 10px rgba(0,0,0,0.5);
    overflow: hidden; z-index: 1;
  }
  .scr-tile:hover {
    transform: translateZ(22px) scale(1.1);
    box-shadow: 0 6px 0 rgba(0,0,0,0.45), 0 10px 28px rgba(0,0,0,0.75);
    z-index: 20;
    outline-color: rgba(201,124,58,0.55);
  }
  .tile-photo {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
    filter: brightness(0.9) saturate(0.85);
    transition: filter 0.3s;
  }
  .scr-tile:hover .tile-photo { filter: brightness(1.08) saturate(1.1); }

  .thumb-error { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.3rem; background: rgba(201,124,58,0.08); }
  .thumb-error .err-icon { font-size: 1rem; opacity: 0.3; }
  .thumb-error .err-name { font-size: 0.38rem; color: var(--muted); text-align: center; padding: 0 3px; }


  /* LIGHTBOX */
  #lightbox { display: none; position: fixed; inset: 0; background: rgba(13,13,15,0.96); z-index: 1000; align-items: center; justify-content: center; backdrop-filter: blur(6px); }
  #lightbox.open { display: flex; }
  #lightboxImg { max-width: 88vw; max-height: 82vh; object-fit: contain; animation: fadeIn 0.3s ease; }
  @keyframes fadeIn { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: scale(1); } }
  .lb-nav { position: absolute; top: 50%; transform: translateY(-50%); background: var(--glass); border: 0.5px solid var(--border); color: var(--paper); font-size: 1.4rem; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; }
  .lb-nav:hover { border-color: var(--accent); color: var(--accent); }
  #lbPrev { left: 1.5rem; } #lbNext { right: 1.5rem; }
  #lbClose { position: absolute; top: 1.2rem; right: 1.2rem; transform: none; font-size: 1rem; width: 36px; height: 36px; }
  .lb-caption { position: absolute; bottom: 0; left: 0; right: 0; padding: 1.2rem 5rem; background: linear-gradient(to top, rgba(13,13,15,0.9) 0%, transparent 100%); text-align: center; }
  .lb-caption-title { font-size: 0.65rem; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 0.3rem; }
  .lb-caption-desc { font-family: 'Cormorant Garamond', serif; font-size: 1.1rem; font-style: italic; color: rgba(245,240,232,0.85); font-weight: 300; }

  /* SLIDESHOW */
  #slideshow { display: none; position: fixed; inset: 0; background: var(--ink); z-index: 500; flex-direction: column; align-items: center; justify-content: center; }
  #slideshow.open { display: flex; }
  #ssProgress { position: absolute; top: 0; left: 0; height: 2px; background: var(--accent); transition: width 0.1s linear; }
  #ssImg { max-width: 100vw; max-height: 100vh; object-fit: contain; }
  #ssImg.tr-fade      { animation: trFade      0.9s ease both; }
  #ssImg.tr-zoomin    { animation: trZoomIn    0.9s ease both; }
  #ssImg.tr-zoomout   { animation: trZoomOut   0.9s ease both; }
  #ssImg.tr-slideleft { animation: trSlideLeft 0.75s cubic-bezier(.4,0,.2,1) both; }
  #ssImg.tr-slideup   { animation: trSlideUp   0.75s cubic-bezier(.4,0,.2,1) both; }
  #ssImg.tr-rotatein  { animation: trRotateIn  1s cubic-bezier(.2,.8,.3,1) both; }
  @keyframes trFade      { from { opacity: 0; }                                    to { opacity: 1; } }
  @keyframes trZoomIn    { from { opacity: 0; transform: scale(1.08); }            to { opacity: 1; transform: scale(1); } }
  @keyframes trZoomOut   { from { opacity: 0; transform: scale(0.93); }            to { opacity: 1; transform: scale(1); } }
  @keyframes trSlideLeft { from { opacity: 0; transform: translateX(60px); }       to { opacity: 1; transform: translateX(0); } }
  @keyframes trSlideUp   { from { opacity: 0; transform: translateY(50px); }       to { opacity: 1; transform: translateY(0); } }
  @keyframes trRotateIn  { from { opacity: 0; transform: scale(0.95) rotate(-1.5deg); } to { opacity: 1; transform: scale(1) rotate(0deg); } }
  .ss-counter { position: absolute; top: 1.4rem; right: 1.8rem; font-size: 0.62rem; color: rgba(245,240,232,0.3); letter-spacing: 0.1em; }

  /* Bloc description en bas du diaporama */
  #ssCaptionBlock {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: linear-gradient(to top, rgba(13,13,15,0.92) 0%, rgba(13,13,15,0.6) 60%, transparent 100%);
    padding: 3rem 3rem 5.5rem;
    display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
    text-align: center;
    animation: captionIn 0.6s ease;
  }
  @keyframes captionIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
  #ssTitle {
    font-size: 0.62rem; color: var(--muted); letter-spacing: 0.14em; text-transform: uppercase;
  }
  #ssDesc {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.35rem; font-weight: 300; font-style: italic;
    color: rgba(245,240,232,0.88);
    max-width: 600px; line-height: 1.5;
  }
  #ssDesc:empty { display: none; }

  .ss-controls { position: absolute; bottom: 1.5rem; left: 50%; transform: translateX(-50%); display: flex; gap: 0.8rem; z-index: 10; }

  /* AUDIO BAR */
  #audioBar { position: fixed; bottom: 0; left: 0; right: 0; background: var(--glass); border-top: 0.5px solid var(--border); backdrop-filter: blur(20px); display: flex; align-items: center; gap: 1.2rem; padding: 0.85rem 2.5rem; z-index: 200; }
  .waveform { display: flex; align-items: center; gap: 2px; height: 20px; }
  .wave-bar { width: 2px; background: var(--accent); border-radius: 1px; opacity: 0.55; animation: wavePulse 1.3s ease-in-out infinite; }
  .wave-bar:nth-child(2) { animation-delay: 0.1s; } .wave-bar:nth-child(3) { animation-delay: 0.22s; } .wave-bar:nth-child(4) { animation-delay: 0.32s; } .wave-bar:nth-child(5) { animation-delay: 0.18s; }
  @keyframes wavePulse { 0%,100% { height: 3px; } 50% { height: 18px; } }
  .waveform.paused .wave-bar { animation-play-state: paused; height: 3px; }
  #playBtn { width: 34px; height: 34px; border-radius: 50%; border: 0.5px solid var(--accent); background: rgba(201,124,58,0.1); color: var(--accent); font-size: 0.85rem; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.2s; flex-shrink: 0; }
  #playBtn:hover { background: rgba(201,124,58,0.22); }
  .audio-track { font-size: 0.65rem; color: var(--muted); letter-spacing: 0.08em; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .audio-time { font-size: 0.62rem; color: rgba(160,154,140,0.6); letter-spacing: 0.05em; flex-shrink: 0; }
  #seekBar, #volBar { -webkit-appearance: none; height: 2px; background: var(--border); outline: none; cursor: pointer; border-radius: 1px; }
  #seekBar { flex: 2; min-width: 0; } #volBar { width: 80px; flex-shrink: 0; }
  #seekBar::-webkit-slider-thumb, #volBar::-webkit-slider-thumb { -webkit-appearance: none; width: 11px; height: 11px; border-radius: 50%; background: var(--accent); cursor: pointer; }
  .vol-icon { font-size: 0.78rem; color: var(--muted); flex-shrink: 0; }
  .err-msg { font-size: 0.62rem; color: rgba(160,154,140,0.7); letter-spacing: 0.06em; }
</style>