@font-face { font-family: "Abril Fatface"; src: url(../fonts/abril-fatface.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Libre Franklin"; src: url(../fonts/libre-franklin.woff2) format("woff2"); font-weight: 400 700; font-display: swap; }

/* Kodachrome, le thème par défaut. Les autres ne redéfinissent que leurs couleurs. */
:root {
  --ink: #0e3a3f;
  --ink-2: #17525a;
  --ink-3: #17525a;
  --paper: #fbf0da;
  --muted: #a7cbc4;
  --brass: #f08a24;
  --brass-ink: #14211f;
  --good: #e8c547;
  --good-ink: #14211f;
  --danger: #ef8a73;
  --glass: var(--ink);
  --line: rgba(167, 203, 196, .34);
  --title: #e8c547;
  --mount: #fbf0da;
  --mount-ink: #0e3a3f;
  --cam: #0a2a2e;
  --corner: #e8c547;
  --top: env(safe-area-inset-top, 0px);
  --bottom: env(safe-area-inset-bottom, 0px);
  --left: env(safe-area-inset-left, 0px);
  --right: env(safe-area-inset-right, 0px);
}
[data-theme="moutarde"] {
  --ink: #e6ad24;
  --ink-2: #f0c251;
  --ink-3: #f0c251;
  --paper: #2a1a0e;
  --muted: #5f4412;
  --brass: #b5301a;
  --brass-ink: #fff4dc;
  --good: #1f6b6b;
  --good-ink: #fff4dc;
  --danger: #b5301a;
  --line: rgba(42, 26, 14, .32);
  --title: #2a1a0e;
  --mount: #fff4dc;
  --mount-ink: #2a1a0e;
  --cam: #2a1a0e;
  --corner: #fff4dc;
}
[data-theme="avocat"] {
  --ink: #474c22;
  --ink-2: #5b622e;
  --ink-3: #5b622e;
  --paper: #f4e8cb;
  --muted: #c9c79b;
  --brass: #ea7c28;
  --brass-ink: #231f0b;
  --good: #e8c547;
  --good-ink: #231f0b;
  --line: rgba(201, 199, 155, .34);
  --title: #e8c547;
  --mount: #f4e8cb;
  --mount-ink: #3a3e1b;
  --cam: #23260f;
  --corner: #e8c547;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; background: var(--ink); color: var(--paper); }
body { font: 16px/1.4 "Libre Franklin", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overscroll-behavior: none; }
#app { height: 100dvh; }
.view { height: 100%; }
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2 { font-family: "Abril Fatface", Georgia, serif; font-weight: 400; margin: 0; }
p { margin: 0; }
[hidden] { display: none !important; }
.icon { display: block; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 20px; border-radius: 999px;
  background: none; color: var(--paper); text-decoration: none; cursor: pointer; font-weight: 600;
  border: 1.5px solid var(--muted);
}
.btn.primary { background: var(--brass); color: var(--brass-ink); border-color: transparent; font-weight: 700; }
.btn.danger { background: var(--danger); color: #2c0d06; border-color: transparent; font-weight: 600; }
.btn.big { min-height: 64px; width: 100%; font-size: 17px; justify-content: space-between; flex-direction: row-reverse; padding: 0 26px; }
.btn:disabled { opacity: .45; }
.icon-btn { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; flex: none; }
.icon-btn.small { width: 38px; height: 38px; color: var(--muted); }
.icon-btn.glass { background: var(--glass); }
.icon-btn.on { background: var(--brass); color: var(--brass-ink); }
.link { display: inline-flex; gap: 8px; align-items: center; color: var(--muted); padding: 12px 0; text-decoration: none; }
.chip { display: inline-block; white-space: nowrap; padding: 6px 12px; border-radius: 999px; background: var(--ink-3); font-size: 14px; color: var(--paper); text-decoration: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* Accueil */
.home { max-width: 720px; margin: 0 auto; height: 100%; overflow-y: auto; padding: calc(var(--top) + 8px) calc(var(--right) + 20px) calc(var(--bottom) + 24px) calc(var(--left) + 20px); display: flex; flex-direction: column; gap: 14px; }
.brand-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand h1 { font-size: clamp(92px, 31vw, 124px); line-height: .86; letter-spacing: -.02em; color: var(--title); margin-left: -5px; }
.brand p { margin-top: 16px; font-size: 17px; line-height: 1.3; font-weight: 500; max-width: 15.5em; }
.lang { display: flex; justify-content: flex-end; gap: 2px; margin-right: 2px; }
.lang button { min-width: 42px; min-height: 36px; font-size: 13px; font-weight: 600; letter-spacing: .06em; color: var(--muted); }
.lang button[aria-pressed="true"] { color: var(--paper); box-shadow: inset 0 -2px var(--paper); font-weight: 700; }
/* Le choix du thème : un cercle par thème, à droite du titre. */
.themes { display: flex; flex-direction: column; gap: 2px; flex: none; }
.theme { width: 44px; height: 38px; display: grid; place-items: center; }
.theme i { display: block; width: 30px; height: 30px; border-radius: 50%; background: var(--swatch); box-shadow: 0 0 0 1.5px var(--paper); }
.theme[aria-checked="true"] i { box-shadow: 0 0 0 2px var(--ink), 0 0 0 4.5px var(--paper); }
.home-actions { display: grid; gap: 10px; margin-top: 10px; }
.projects { display: grid; gap: 10px; margin-top: 12px; }
.projects h2 { font-size: 28px; line-height: 1; border-top: 3px solid var(--paper); padding-top: 9px; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
/* Chaque projet est une diapositive : carton clair, fenêtre arrondie, légende dans le cadre. */
.project { min-width: 0; background: var(--mount); color: var(--mount-ink); padding: 9px 9px 4px; border-radius: 5px; box-shadow: 0 1px 0 rgba(0, 0, 0, .25); }
.project-open { display: block; width: 100%; text-align: left; color: inherit; }
.project-images { display: flex; aspect-ratio: 1; border-radius: 11px; overflow: hidden; background: var(--ink-2); }
.project img { flex: 1; min-width: 0; height: 100%; object-fit: cover; display: block; }
.project-rename { display: flex; align-items: center; gap: 6px; width: 100%; min-height: 34px; margin-top: 2px; text-align: left; color: inherit; }
.project-name { flex: 0 1 auto; min-width: 0; font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-rename .icon { opacity: .6; }
.project-tools { display: flex; align-items: center; justify-content: space-between; min-height: 32px; }
.project-tools [data-camera]:not([hidden]) { margin-left: auto; }
.project-tools .chip { background: none; color: inherit; padding: 0; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; white-space: normal; }
.project-tools .icon-btn { color: inherit; width: 32px; height: 32px; }
.project-tools [data-camera][hidden] + [data-delete] { margin-left: auto; }

/* Feuilles */
.sheet-veil { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .5); display: flex; align-items: flex-end; justify-content: center; animation: fade .18s; }
.sheet-veil.leaving { opacity: 0; transition: opacity .18s; }
.sheet-veil.top { align-items: flex-start; }
.sheet-veil.top .sheet { border-radius: 0 0 18px 18px; padding-top: var(--top); padding-bottom: 0; animation: drop .22s ease-out; }
@keyframes drop { from { transform: translateY(-100%); } }
.sheet { width: 100%; max-width: 640px; max-height: 88dvh; background: var(--ink-2); border-radius: 18px 18px 0 0; display: flex; flex-direction: column; animation: rise .22s ease-out; padding-bottom: var(--bottom); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 8px 4px 20px; }
.sheet-head h2 { font-size: 22px; }
.sheet-body { padding: 8px 20px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.sheet-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.sheet-actions .btn { flex: 1 1 auto; }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

.aid { display: flex; gap: 14px; align-items: center; text-align: left; padding: 12px; border-radius: 12px; background: var(--ink); width: 100%; border: 1px solid transparent; }
.aid .icon { color: var(--brass); }
.export-preview { flex: none; width: 92px; height: 70px; object-fit: contain; border-radius: 4px; }
.aid strong { display: block; font-weight: 600; }
.aid small { display: block; color: var(--muted); font-size: 14px; }
.aid.on { border-color: var(--brass); }
.aid:disabled { opacity: .6; }

.tips { margin: 0; padding: 0 0 0 22px; display: grid; gap: 14px; }
.tips li::marker { color: var(--brass); font-family: "Abril Fatface", serif; }
.tips p { color: var(--muted); font-size: 15px; margin-top: 2px; }

/* Recherche */
.search-row { display: flex; gap: 8px; }
.search-row.grow { flex: 1; min-width: 0; }
.search-row input { flex: 1; min-width: 0; height: 46px; padding: 0 14px; border-radius: 12px; background: var(--ink); border: 1px solid var(--line); font-size: 16px; }
.search-row .btn { padding: 0 14px; }
.result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.result { text-align: left; min-width: 0; }
.result img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; display: block; background: var(--ink-3); }
.result-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; margin-top: 6px; }
.result-date { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.archives { display: grid; gap: 8px; }

.busy { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(0, 0, 0, .72); animation: fade .15s; }
.busy-card { width: min(100%, 340px); display: grid; justify-items: center; gap: 18px; padding: 24px 20px; border-radius: 18px; background: var(--ink-2); border: 1px solid var(--line); animation: rise .2s ease-out; }
.spinner { display: inline-block; flex: none; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--brass); animation: spin .8s linear infinite; }
.spinner.big { width: 46px; height: 46px; border-width: 4px; }
.busy.finished .spinner.big { animation-play-state: paused; border-color: var(--good); }
@keyframes spin { to { transform: rotate(360deg); } }
.steps { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; gap: 10px; }
.steps li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; transition: opacity .2s, color .2s; }
.steps li[data-state="todo"] { opacity: .4; }
.steps li[data-state="now"] strong { color: var(--brass); }
.steps strong { display: block; font-weight: 500; }
.steps small { display: block; color: var(--muted); font-size: 13px; }
.steps small:empty { display: none; }
.step-mark { flex: none; display: grid; place-items: center; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%; border: 1.5px solid var(--line); color: transparent; }
.steps li[data-state="now"] .step-mark { border-color: var(--line); border-top-color: var(--brass); animation: spin .8s linear infinite; }
.steps li[data-state="done"] .step-mark { background: var(--good); border-color: var(--good); color: var(--good-ink); }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }

#toasts { position: fixed; z-index: 60; left: 16px; right: 16px; bottom: calc(var(--bottom) + 310px); display: grid; justify-items: center; gap: 8px; pointer-events: none; }
.toast { background: rgba(0, 0, 0, .86); color: #fff; border-radius: 10px; padding: 9px 14px; font-size: 15px; text-align: center; max-width: 420px; animation: rise .2s; }
.toast.leaving { opacity: 0; transition: opacity .3s; }

/* Caméra */
.cam { position: relative; height: 100%; background: var(--cam); display: grid; grid-template-rows: 1fr auto; overflow: hidden; }
.cam-stage { grid-row: 1; grid-column: 1; position: relative; min-height: 0; overflow: hidden; touch-action: none; }
#reset { grid-row: 1; grid-column: 1; justify-self: end; align-self: end; z-index: 4; margin: 0 calc(var(--right) + 10px) 10px 0; }
.vf { position: absolute; overflow: hidden; transform-origin: center; transition: transform .2s; }
.vf video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; background: #0b0a08; transform-origin: center; }
.ov { position: absolute; --opacity: .5; --edge-color: var(--brass); pointer-events: none; outline: 1px solid rgba(255, 255, 255, .35); }
.ov canvas { width: 100%; height: 100%; display: block; opacity: var(--opacity); }
.ov.no-color canvas, .ov.no-color .ov-edges { visibility: hidden; }
.ov-edges { position: absolute; inset: 0; display: none; background: var(--edge-color); opacity: var(--opacity); -webkit-mask: var(--edges) center/100% 100% no-repeat; mask: var(--edges) center/100% 100% no-repeat; }
.ov[data-mode="edges"] canvas { display: none; }
.ov[data-mode="edges"] .ov-edges { display: block; }
.ov[data-mode="diff"] { mix-blend-mode: difference; }
.ov[data-mode="diff"].all-colors canvas { filter: grayscale(1); }
@keyframes blink { 50% { opacity: 0; } }
.hud { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.flash.go { animation: flash .35s ease-out; }
@keyframes flash { from { opacity: .85; } }

.cam-top { position: absolute; z-index: 5; top: 0; left: 0; right: 0; display: flex; gap: 8px; align-items: flex-start; padding: calc(var(--top) + 10px) calc(var(--right) + 10px) 0 calc(var(--left) + 10px); pointer-events: none; }
.cam-top > * { pointer-events: auto; }
.guide { flex: 1; min-width: 0; min-height: 58px; display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 24px; background: var(--glass); transition: background .2s; }
.guide.done { background: var(--good); color: var(--good-ink); }
.guide-icon { color: var(--brass); flex: none; }
.guide-icon svg { transition: transform .25s; }
.guide.done .guide-icon { color: inherit; }
.guide-text { flex: 1; min-width: 0; }
.guide-text strong { display: block; font-size: 18px; line-height: 1.2; font-weight: 600; }
.guide-text small { display: block; font-size: 13px; line-height: 1.25; opacity: .8; }
.score { --score: 0deg; flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--brass) var(--score), var(--line) 0); }
.score b { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 50%; background: var(--ink); color: var(--paper); font-size: 14px; }
.guide.done .score { background: conic-gradient(var(--good-ink) var(--score), rgba(0, 0, 0, .2) 0); }

.cam-bottom { background: var(--ink); padding: 8px calc(var(--right) + 14px) calc(var(--bottom) + 12px) calc(var(--left) + 14px); display: grid; gap: 6px; }
.modes { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; }
.modes::-webkit-scrollbar { display: none; }
.mode { flex: 1 1 auto; min-height: 38px; padding: 0 6px; font-size: 13.5px; font-weight: 500; color: var(--muted); }
.mode[aria-selected="true"] { color: var(--paper); box-shadow: inset 0 -3px var(--brass); font-weight: 700; }
.slider { display: grid; grid-template-columns: 78px 1fr 48px; align-items: center; gap: 8px; min-height: 36px; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; font-weight: 600; color: var(--muted); }
.channels { display: flex; gap: 8px; }
.channel { width: 40px; height: 28px; border-radius: 999px; font-weight: 700; font-size: 14px; border: 1.5px solid; background: none; color: var(--muted); opacity: .55; }
.channel.r { border-color: #ff6a5e; }
.channel.g { border-color: #63dd80; }
.channel.b { border-color: #6ca8ff; }
.channel[aria-pressed="true"] { opacity: 1; color: #10100e; }
.channel.r[aria-pressed="true"] { background: #ff6a5e; }
.channel.g[aria-pressed="true"] { background: #63dd80; }
.channel.b[aria-pressed="true"] { background: #6ca8ff; }
.slider output { text-align: right; color: var(--paper); font-size: 13px; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.slider.light { grid-template-columns: 78px 1fr; padding: 0 16px; }
.cam-bottom .slider:has(.channels), .fit-tools .slider { grid-template-columns: 78px 1fr; }
input[type="range"] { width: 100%; height: 32px; margin: 0; background: none; accent-color: var(--brass); }
.cam-actions { display: grid; grid-template-columns: repeat(2, 46px) 1fr repeat(2, 46px); align-items: center; justify-items: center; }
.cam-actions .shutter { grid-column: 3; }
.cam-actions #importShot { grid-column: 4; }
.cam-actions #shots { grid-column: 5; }
.cam-actions #lens { grid-column: 1; }
.cam-actions #loupe { grid-column: 2; }
.shutter { width: 78px; height: 78px; border-radius: 50%; border: 3px solid var(--paper); display: grid; place-items: center; }
.shutter i { display: block; width: 62px; height: 62px; border-radius: 50%; background: #fff; transition: transform .1s; }
.shutter:active i { transform: scale(.88); }

@media (orientation: landscape) and (max-height: 560px) {
  .cam { grid-template-rows: 1fr; grid-template-columns: 1fr 250px; }
  .cam-bottom { align-content: center; padding-top: var(--top); padding-left: 12px; height: 100dvh; overflow-y: auto; }
  .modes { flex-wrap: wrap; }
  .mode { flex: 1 0 40%; min-height: 32px; }
  .cam-top { right: 250px; padding-right: 10px; }
  .slider { grid-template-columns: 70px 1fr 40px; }
  .cam-actions { grid-template-columns: repeat(2, 42px) 1fr repeat(2, 42px); }
  .cam-actions .icon-btn { width: 42px; height: 42px; }
  .shutter { width: 64px; height: 64px; }
  .shutter i { width: 50px; height: 50px; }
  #toasts { bottom: calc(var(--bottom) + 20px); right: 266px; }
}

/* Écrans classiques */
.bar { display: flex; align-items: center; gap: 4px; padding: calc(var(--top) + 6px) calc(var(--right) + 8px) 6px calc(var(--left) + 8px); }
.bar h1 { font-size: 23px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-title { flex: 1; min-width: 0; min-height: 46px; display: flex; align-items: center; gap: 8px; text-align: left; }
.bar-title h1 { flex: 0 1 auto; }
.bar-title .icon { opacity: .6; }

.result-screen { height: 100%; display: flex; flex-direction: column; }
.compare-wrap { flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; }
.compare { position: relative; touch-action: none; user-select: none; overflow: hidden; cursor: ew-resize; background: #000; }
.compare canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.handle { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 8px rgba(0, 0, 0, .55); pointer-events: none; }
.handle i { position: absolute; top: 50%; left: 50%; width: 44px; height: 44px; margin: -22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 8px rgba(0, 0, 0, .45); }
.handle i::before, .handle i::after { content: ""; position: absolute; top: 15px; width: 12px; height: 12px; border: solid #2a2318; border-width: 0 0 2.5px 2.5px; }
.handle i::before { left: 11px; transform: rotate(45deg); }
.handle i::after { right: 11px; transform: rotate(225deg); }
.tag { position: absolute; bottom: 8px; padding: 3px 8px; border-radius: 3px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; background: var(--mount); color: var(--mount-ink); pointer-events: none; }
.tag.left { left: 8px; }
.tag.right { right: 8px; }
.compare[data-view="fade"] { cursor: default; }
.compare[data-view="fade"] .handle, .compare[data-view="fade"] .tag { display: none; }
.compare[data-view="side"] { cursor: default; display: flex; gap: 6px; flex-direction: column; width: 100%; height: 100%; background: none; align-items: center; justify-content: center; touch-action: auto; }
.compare[data-view="side"] canvas { position: static; flex: 0 1 auto; width: auto; height: auto; max-width: 100%; max-height: calc(50% - 3px); order: 1; }
.compare[data-view="side"] #before { order: 0; }
.compare[data-view="side"] .handle, .compare[data-view="side"] .tag { display: none; }
@media (orientation: landscape) {
  .compare[data-view="side"] { flex-direction: row; }
  .compare[data-view="side"] canvas { max-width: calc(50% - 3px); max-height: 100%; }
}
.compare.fitting { overflow: visible; cursor: move; }
.result-screen.fitting .compare-wrap { touch-action: none; }
.fit { position: absolute; inset: 0; pointer-events: none; }
.corner { position: absolute; width: 44px; height: 44px; margin: -22px; border-radius: 50%; border: 3px solid var(--corner); background: rgba(0, 0, 0, .28); box-shadow: 0 0 0 1.5px rgba(0, 0, 0, .55); pointer-events: none; }
.corner::after { content: ""; position: absolute; top: 50%; left: 50%; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: var(--corner); }

.segmented { display: flex; margin: 10px 12px 0; box-shadow: inset 0 -1.5px var(--line); }
.segmented button { flex: 1; min-height: 40px; font-weight: 500; color: var(--muted); font-size: 15px; }
.segmented button[aria-selected="true"] { color: var(--paper); box-shadow: inset 0 -3px var(--brass); font-weight: 700; }
.strip { display: flex; gap: 8px; overflow-x: auto; padding: 10px 12px 0; }
.thumb-box { position: relative; flex: none; }
.thumb { display: block; width: 58px; height: 44px; border-radius: 6px; overflow: hidden; opacity: .6; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.thumb-trash { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 6px; background: rgba(0, 0, 0, .68); color: #fff; }
.thumb[aria-current="true"] { opacity: 1; outline: 2px solid var(--brass); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.tools { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); padding: 10px 4px calc(var(--bottom) + 10px); }
.tools button { display: grid; justify-items: center; align-content: start; gap: 4px; min-height: 58px; padding: 4px 1px; font-size: 12px; line-height: 1.15; text-align: center; color: var(--paper); }
.tools .accent { font-weight: 700; }
.fit-tools { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 8px 14px calc(var(--bottom) + 12px); }
.fit-tools .segmented { margin: 0; }
.fit-tools .segmented button { min-height: 34px; font-size: 14px; }
.fit-tools .btn { min-height: 42px; padding: 0 12px; }
/* Réglage précis : une croix pour déplacer, à côté des boutons Tourner et Taille. */
.nudges { display: flex; gap: 10px; align-items: flex-end; justify-content: space-between; }
.nudges button { display: grid; place-items: center; background: var(--ink-3); color: var(--paper); font-size: 26px; font-weight: 500; touch-action: none; user-select: none; }
.nudges button:active { background: var(--brass); color: var(--brass-ink); }
.cross { flex: none; display: grid; grid-template: repeat(3, 50px) / repeat(3, 50px); }
.cross [data-nudge="up"] { grid-area: 1 / 2; border-radius: 14px 14px 0 0; }
.cross [data-nudge="left"] { grid-area: 2 / 1; border-radius: 14px 0 0 14px; }
.cross [data-nudge="right"] { grid-area: 2 / 3; border-radius: 0 14px 14px 0; }
.cross [data-nudge="down"] { grid-area: 3 / 2; border-radius: 0 0 14px 14px; }
.stick { grid-area: 2 / 2; display: grid; place-items: center; background: var(--ink-3); touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.stick i { width: 30px; height: 30px; border-radius: 50%; background: var(--brass); box-shadow: inset 0 -3px rgba(0, 0, 0, .22), 0 2px 5px rgba(0, 0, 0, .35); transform: translate(var(--x, 0), var(--y, 0)); transition: transform .14s ease-out; }
.stick.held i { transition: none; }
.dial-box, .sizes { display: grid; justify-items: center; gap: 6px; }
.dial-box span, .sizes span { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; font-weight: 600; color: var(--muted); }
.dial-box { flex: 1; min-width: 0; }
/* La roulette : l'anneau cranté tourne sous le doigt, le repère reste en haut. */
.dial { position: relative; width: min(100%, 124px); aspect-ratio: 1; border-radius: 50%; background: var(--ink-3); touch-action: none; user-select: none; cursor: grab; display: grid; place-items: center; }
.dial::before { content: ""; position: absolute; z-index: 1; top: -3px; left: 50%; margin-left: -6px; border: 6px solid transparent; border-top: 9px solid var(--brass); border-bottom: 0; }
.dial.turning { cursor: grabbing; box-shadow: 0 0 0 2px var(--brass); }
.dial svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.dial path { fill: none; stroke: var(--paper); stroke-width: 1.3; stroke-linecap: round; transform-origin: 50% 50%; }
.dial output { display: grid; place-items: center; width: 60%; aspect-ratio: 1; border-radius: 50%; background: var(--ink); color: var(--paper); font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sizes { flex: none; }
.sizes button { width: 50px; height: 50px; border-radius: 50%; }
.tools button.pending { color: var(--brass); position: relative; }
.tools button.pending::after { content: ""; position: absolute; top: 6px; left: calc(50% + 10px); width: 8px; height: 8px; border-radius: 50%; background: var(--brass); }
.compare[data-fit="blink"] #before { animation: blink 1.1s steps(1) infinite; }
.compare[data-fit="diff"] #before { mix-blend-mode: difference; }
.compare[data-fit="curtain"] .handle { display: block; }
.compare[data-fit="curtain"] .handle i { display: none; }
@media (orientation: landscape) and (max-height: 560px) {
  .result-screen.fitting { display: grid; grid-template-columns: 1fr 320px; grid-template-rows: auto 1fr; }
  .result-screen.fitting .bar { grid-column: 1; }
  .result-screen.fitting .compare-wrap { grid-column: 1; grid-row: 2; }
  .result-screen.fitting .fit-tools { grid-column: 2; grid-row: 1 / 3; overflow-y: auto; align-content: start; padding-top: calc(var(--top) + 8px); }
  .result-screen.fitting .channel { width: 36px; }
  .result-screen.fitting .nudges { gap: 6px; }
  .result-screen.fitting .cross { grid-template: repeat(3, 40px) / repeat(3, 40px); }
  .result-screen.fitting .sizes button { width: 44px; height: 44px; }
}

.lines-screen, .map-screen { height: 100%; display: flex; flex-direction: column; }
.lines-wrap { flex: 1; min-height: 0; display: grid; place-items: center; touch-action: none; }
.lines-box { position: relative; touch-action: none; }
.lines-box img, .lines-box canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
body:has(.result-screen.fitting) #toasts { bottom: calc(var(--bottom) + 440px); }
.lines-panel { padding: 12px 16px calc(var(--bottom) + 12px); display: grid; gap: 10px; }
.result-line { min-height: 44px; color: var(--brass); font-size: 15px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--brass); }

/* Une pile à elle : sinon les calques de Leaflet (z-index 400 et plus) passent devant les feuilles. */
.map { flex: 1; min-height: 0; background: var(--ink-2); position: relative; z-index: 0; }
.map-panel { padding: 0 12px calc(var(--bottom) + 12px); display: grid; gap: 10px; }
.map-panel .segmented { margin: 10px 0 0; }
.map-dot { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; font-weight: 700; border: 3px solid #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, .5); }
.map-dot.spot { background: var(--brass); color: var(--brass-ink); }
.map-dot.subject { background: #7cc7ff; color: #06263d; }
/* Leaflet, chargé après, remet ses icônes en display: block : le chiffre se centre lui-même. */
.map-dot > span { display: grid; place-items: center; width: 100%; height: 100%; }
.map-dot.step { background: var(--mount); color: var(--mount-ink); }
.map-dot.step.done { background: var(--good); color: var(--good-ink); }

/* Parcours */
.scan { position: relative; width: 100%; aspect-ratio: 1; max-height: 46dvh; border-radius: 14px; overflow: hidden; background: #000; }
.scan video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 16%; border: 3px solid var(--brass); border-radius: 14px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .38); }
.tour-screen { height: 100%; display: flex; flex-direction: column; }
.tour-map { flex: 0 0 42%; }
.map-state { padding: 12px calc(var(--right) + 16px) calc(var(--bottom) + 14px) calc(var(--left) + 16px); }
.tour-list { flex: 1; min-height: 0; overflow-y: auto; padding: 14px calc(var(--right) + 16px) calc(var(--bottom) + 16px) calc(var(--left) + 16px); display: grid; gap: 10px; align-content: start; }
.tour-by { font-weight: 600; }
.tour-progress { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; font-weight: 600; color: var(--brass); }
.tour-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tour-step { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px; border-radius: 12px; background: var(--ink-2); text-align: left; }
.tour-num { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--mount); color: var(--mount-ink); font-weight: 700; font-size: 14px; }
.tour-num.done { background: var(--good); color: var(--good-ink); }
.tour-step img { flex: none; width: 64px; height: 48px; object-fit: cover; border-radius: 6px; background: var(--ink-3); }
.tour-step-text { flex: 1; min-width: 0; }
.tour-step-text strong { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tour-step-text small { display: block; color: var(--muted); font-size: 13px; }
.tour-photo { width: 100%; max-height: 42dvh; object-fit: contain; border-radius: 8px; background: #000; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  /* La roue reste le seul signe que le travail continue : on la garde. */
  .spinner, .steps li[data-state="now"] .step-mark { animation-duration: 1.6s !important; }
}

/* Fête d'une étape de parcours : la carte surgit, l'anneau se remplit, des étincelles partent. */
.cheer-veil { position: fixed; inset: 0; z-index: 55; display: grid; place-items: center; padding: 20px; background: rgba(0, 0, 0, .62); animation: fade .2s; }
.cheer-veil.leaving { opacity: 0; transition: opacity .2s; }
.cheer { width: min(100%, 340px); display: grid; justify-items: center; gap: 10px; padding: 26px 22px 20px; border-radius: 24px; background: var(--ink-2); border: 1px solid var(--line); text-align: center; animation: pop .55s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { from { transform: scale(.55); opacity: 0; } 60% { opacity: 1; } }
.cheer h2 { font-size: 30px; line-height: 1.05; color: var(--title); }
.cheer-sub { color: var(--muted); font-size: 15px; }
.cheer-ring { position: relative; width: 168px; height: 168px; margin-bottom: 4px; }
.cheer-ring svg { width: 100%; height: 100%; display: block; }
.cheer-track { fill: none; stroke: var(--line); stroke-width: 12; }
.cheer-fill { fill: none; stroke: var(--brass); stroke-width: 12; stroke-linecap: round; }
.cheer-veil.finished .cheer-fill { stroke: var(--good); }
.cheer-percent { position: absolute; inset: 0; display: grid; place-items: center; font: 400 44px/1 "Abril Fatface", Georgia, serif; color: var(--paper); font-variant-numeric: tabular-nums; }
.cheer-veil.full .cheer-ring { animation: thump .35s ease-out; }
@keyframes thump { 50% { transform: scale(1.08); } }
.cheer-spark { position: absolute; top: 50%; left: 50%; width: 10px; height: 10px; margin: -5px; border-radius: 3px; background: var(--brass); opacity: 0; }
.cheer-spark:nth-child(odd) { background: var(--good); border-radius: 50%; }
.cheer-veil.full .cheer-spark { animation: spark .7s ease-out forwards; }
.s1 { --x: -92px; --y: -58px; } .s2 { --x: 94px; --y: -64px; } .s3 { --x: -100px; --y: 40px; }
.s4 { --x: 98px; --y: 46px; } .s5 { --x: -18px; --y: -104px; } .s6 { --x: 22px; --y: 102px; }
@keyframes spark { 0% { opacity: 1; transform: translate(0, 0) scale(.6) rotate(0); } 100% { opacity: 0; transform: translate(var(--x), var(--y)) scale(1.2) rotate(200deg); } }
.cheer-actions { display: flex; gap: 10px; width: 100%; margin-top: 8px; }
.cheer-actions .btn { flex: 1; padding: 0 12px; }
