/* Exposure Pro — instrumentation sobre : clair très lisible au soleil, sombre pour le tournage. */
:root {
  --bg: #f4f2ec; --card: #ffffff; --ink: #0f1316; --mute: #4f575e; --line: #d6d2c8; --field: #fbfaf6; --soft: #ece9e1;
  --accent: #a84b06; --accent-2: #d9771c; --accent-ink: #ffffff; --ok: #17663b; --warn: #9c3a08; --warn-bg: #fff1e3; --info: #1f4f8a; --info-bg: #eaf1fb;
  --focus: #1f6feb; --shadow: 0 1px 2px #0000000f, 0 6px 20px #0000000a; --radius: 14px;
  --sa-t: env(safe-area-inset-top, 0px); --sa-b: env(safe-area-inset-bottom, 0px); --sa-l: env(safe-area-inset-left, 0px); --sa-r: env(safe-area-inset-right, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1013; --card: #161a1f; --ink: #eef1f3; --mute: #9ea7af; --line: #2b323a; --field: #0f1318; --soft: #1f252c;
    --accent: #ffad4a; --accent-2: #ff8f1f; --accent-ink: #1b1104; --ok: #5fd08e; --warn: #ffb37a; --warn-bg: #2d1c10; --info: #8fbaf5; --info-bg: #142133;
    --focus: #7cb2ff; --shadow: 0 1px 2px #0000004d; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1013; --card: #161a1f; --ink: #eef1f3; --mute: #9ea7af; --line: #2b323a; --field: #0f1318; --soft: #1f252c;
  --accent: #ffad4a; --accent-2: #ff8f1f; --accent-ink: #1b1104; --ok: #5fd08e; --warn: #ffb37a; --warn-bg: #2d1c10; --info: #8fbaf5; --info-bg: #142133;
  --focus: #7cb2ff; --shadow: 0 1px 2px #0000004d; color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: manipulation; }
/* Pas de zoom au double-tap (appuis rapides répétés sur −/+), le zoom à deux doigts reste possible. */
button, a, input, select, summary, label, .ctl, .seg, .chips { touch-action: manipulation; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-variant-numeric: tabular-nums; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: calc(8px + var(--sa-l)); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h2 { font-size: 1.02rem; margin: 0; letter-spacing: .01em; }
h3 { font-size: .95rem; margin: 18px 0 8px; }

/* En-tête */
.top { background: var(--card); border-bottom: 1px solid var(--line); padding: calc(8px + var(--sa-t)) calc(12px + var(--sa-r)) 8px calc(12px + var(--sa-l)); }
.top-in { max-width: 1120px; margin: 0 auto; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px 16px; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.12rem; white-space: nowrap; }
.brand b { color: var(--accent); }
.mode-tabs { display: flex; justify-self: center; background: var(--soft); border-radius: 12px; padding: 4px; gap: 4px; }
.mode-tabs button { border: 0; background: transparent; min-height: 44px; padding: 0 16px; border-radius: 9px; font-weight: 650; cursor: pointer; color: var(--mute); }
.mode-tabs button[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.top-actions { display: flex; gap: 4px; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--mute); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--soft); color: var(--ink); }
.help-btn { width: 36px; height: 36px; margin: -6px -6px -6px 0; }

/* Mise en page */
.layout { max-width: 1120px; margin: 0 auto; padding: 14px calc(14px + var(--sa-r)) 8px calc(14px + var(--sa-l)); display: grid; gap: 14px; }
.col-in, .col-out { display: grid; gap: 14px; align-content: start; min-width: 0; }
@media (min-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr); align-items: start; padding-top: 20px; }
  .col-out { position: sticky; top: 14px; }
}
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.note { color: var(--mute); font-size: .86rem; margin: 8px 0 0; }
.note.center, .center { text-align: center; }
.flabel { display: block; font-size: .82rem; font-weight: 650; color: var(--mute); text-transform: uppercase; letter-spacing: .04em; }
.row-seg { display: grid; gap: 6px; margin-bottom: 12px; }
.badge { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 99px; background: var(--warn-bg); color: var(--warn); font-size: .75rem; font-weight: 700; text-transform: none; letter-spacing: 0; }

/* Champs */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px 14px; }
.field { min-width: 0; }
.field > label { display: block; font-size: .82rem; font-weight: 650; color: var(--mute); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 5px; }
.ctl { display: flex; gap: 6px; align-items: stretch; }
.step { flex: none; width: 46px; min-height: 48px; border: 1px solid var(--line); background: var(--field); border-radius: 11px; display: grid; place-items: center; cursor: pointer; color: var(--ink); }
.step:active { background: var(--soft); }
.step.list { color: var(--mute); }
.inp-wrap { flex: 1; min-width: 0; display: flex; align-items: center; border: 1px solid var(--line); background: var(--field); border-radius: 11px; padding: 0 10px; }
.inp-wrap:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.adorn { color: var(--mute); font-weight: 600; font-size: .95rem; padding-right: 4px; }
.adorn.after { padding: 0 0 0 4px; }
.inp { flex: 1; min-width: 0; width: 100%; border: 0; background: transparent; font-size: 1.18rem; font-weight: 650; padding: 10px 0; outline: none; }
.inp[aria-invalid="true"] { color: var(--warn); }
.inp.solo { border: 1px solid var(--line); background: var(--field); border-radius: 11px; padding: 10px 12px; font-size: 1rem; font-weight: 500; min-height: 46px; }
.inp.solo:focus { border-color: var(--focus); }
.msg { min-height: 1.2em; margin: 4px 2px 0; font-size: .82rem; color: var(--mute); }
.msg:empty { min-height: 0; margin: 0; }
.msg.err { color: var(--warn); font-weight: 600; }
.field.out .out-box { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 12px; border-radius: 11px; border: 1px dashed var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--card)); color: var(--accent); }
.out-val { font-size: 1.18rem; font-weight: 750; color: var(--ink); }
.derived { margin: 10px 0 0; font-weight: 650; color: var(--mute); }
.select { width: 100%; min-height: 48px; border: 1px solid var(--line); background: var(--field); border-radius: 11px; padding: 0 12px; font-size: 1rem; }
.filter-field { margin-bottom: 12px; }
.custom-row { display: grid; gap: 8px; margin-top: 8px; }
.adv summary { cursor: pointer; font-weight: 650; min-height: 28px; display: flex; align-items: center; }
.adv-body { margin-top: 12px; }

/* Segments */
.seg { display: flex; flex-wrap: wrap; gap: 4px; background: var(--soft); padding: 4px; border-radius: 12px; }
.seg button { flex: 1 1 auto; min-height: 44px; border: 0; border-radius: 9px; background: transparent; padding: 0 12px; font-weight: 650; color: var(--mute); cursor: pointer; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.seg.solve button.on { background: var(--accent); color: var(--accent-ink); }
.seg.small button { min-height: 40px; font-size: .92rem; }
.seg.solve { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.seg.solve button { padding: 0 4px; }

/* Mode flash */
.sub-h { font-size: .9rem; margin: 4px 0 8px; color: var(--ink); }
.sub-h + .grid { margin-bottom: 12px; }
.grid + .grid, .grid + .row-seg { margin-top: 12px; }
.r-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0 6px; }
.duo { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; background: var(--field); }
.duo-k { display: block; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--mute); }
.duo-v { display: block; font-size: clamp(1.7rem, 7.5vw, 2.4rem); font-weight: 800; line-height: 1.1; }
.duo-v.bad { color: var(--warn); }

/* Résultat */
.result { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); min-height: 230px; }
.r-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.r-kicker { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.r-big { font-size: clamp(2.6rem, 11vw, 3.6rem); font-weight: 800; line-height: 1.05; margin: 6px 0 4px; letter-spacing: -.01em; min-height: 1.05em; overflow-wrap: anywhere; }
.r-big.text { font-size: clamp(1.6rem, 6.5vw, 2.1rem); }
.r-big.dark { color: var(--warn); }
.r-big.pending { color: var(--mute); }
.r-sub { font-size: 1.05rem; font-weight: 650; color: var(--mute); min-height: 1.45em; }
.r-lines, .r-warn, .plain { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.r-lines li { padding-left: 14px; position: relative; }
.r-lines li::before { content: ""; position: absolute; left: 0; top: .62em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-2); }
.r-warn li { font-size: .9rem; padding: 8px 10px; border-radius: 9px; background: var(--info-bg); color: var(--info); }
.r-warn li.warn { background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.r-warn li.note { background: transparent; color: var(--mute); padding: 0; font-size: .84rem; }
.timer-btn { margin-top: 14px; }
.alts { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.alts li { border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; }
.alts li.out { opacity: .72; border-style: dashed; }
.alt-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.alt-val { font-size: 1.2rem; font-weight: 800; }
.alts p { margin: 4px 0 0; font-size: .86rem; color: var(--mute); }
.alts .tag { color: var(--warn); font-weight: 650; }
details#details summary { cursor: pointer; font-weight: 650; min-height: 28px; display: flex; align-items: center; }
table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: .92rem; }
th, td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th[scope="row"] { font-weight: 650; }
td.num { text-align: right; white-space: nowrap; font-weight: 700; }
tfoot th, tfoot td { border-bottom: 0; border-top: 2px solid var(--ink); }
.equiv tr.cur td { font-weight: 800; color: var(--accent); }
.equiv tr.out td { color: var(--mute); }
.tools { display: flex; flex-wrap: wrap; gap: 8px; }
.tools .btn { flex: 1 1 140px; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 46px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--line); background: var(--card); font-weight: 650; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { background: var(--warn); border-color: var(--warn); color: var(--card); }
.btn.ghost:hover { background: var(--soft); }
.btn.small { min-height: 40px; padding: 0 12px; font-size: .92rem; }
.btn.big { min-height: 56px; padding: 0 30px; font-size: 1.1rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn-row.center { justify-content: center; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 44px; min-width: 56px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--field); font-weight: 650; cursor: pointer; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip.dim { opacity: .45; }

/* Aperçu compact (téléphone) */
.peek { position: fixed; z-index: 20; left: calc(10px + var(--sa-l)); right: calc(10px + var(--sa-r)); bottom: calc(10px + var(--sa-b)); min-height: 52px; padding: 8px 16px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--line)); background: var(--card); color: var(--ink); box-shadow: 0 -2px 24px #00000030; font-weight: 750; font-size: 1.05rem; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; transform: translateY(calc(100% + 20px + var(--sa-b))); transition: transform .2s ease; visibility: hidden; }
.peek.show { transform: none; visibility: visible; }
@media (min-width: 900px) { .peek { display: none; } }

/* Modales */
dialog.modal { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px - var(--sa-t) - var(--sa-b)); padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--ink); box-shadow: 0 20px 60px #00000055; display: flex; flex-direction: column; }
dialog.modal:not([open]) { display: none; }
dialog.modal.wide { width: min(760px, calc(100vw - 24px)); }
dialog::backdrop { background: #0a0d10a8; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 8px 6px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 1.1rem; }
.modal-body { padding: 14px 18px; overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.modal-body > p:first-child, .modal-body > div > p:first-child { margin-top: 0; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 10px 18px calc(12px); border-top: 1px solid var(--line); }
.chips.pick .chip { min-width: 72px; }
.steps { padding-left: 1.3em; margin: 6px 0; display: grid; gap: 6px; }
.gloss dt { font-weight: 700; margin-top: 10px; }
.gloss dd { margin: 2px 0 0; color: var(--mute); }
.set-row { display: grid; gap: 6px; margin: 10px 0 14px; }
.inline { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.entries { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 8px; }
.entries li { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; }
.entries li.active { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--accent); }
.entries li.off { opacity: .6; }
.entry-text { display: grid; gap: 2px; min-width: 0; flex: 1 1 260px; }
.entry-text span { font-size: .9rem; }
.entry-text small { color: var(--mute); }
.entry-act { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.switch { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 6px; font-size: .9rem; cursor: pointer; }
.switch input { width: 22px; height: 22px; accent-color: var(--accent); }
.empty { color: var(--mute); }
.form { display: grid; gap: 12px; }
.frow { display: grid; gap: 6px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.copy-area { width: 100%; font: 15px/1.4 ui-monospace, Menlo, monospace; border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--field); }

/* Minuteur */
.timer .clock { font-size: clamp(3.4rem, 18vw, 5.5rem); font-weight: 800; text-align: center; letter-spacing: .02em; margin: 6px 0; }
.tbar { height: 8px; border-radius: 4px; background: var(--soft); overflow: hidden; }
.tbar span { display: block; height: 100%; width: 0; background: var(--accent); }
.timer.done .clock { color: var(--ok); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.toast { position: fixed; z-index: 2147483000; left: 50%; bottom: calc(16px + var(--sa-b)); transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); background: var(--ink); color: var(--card); padding: 12px 16px; border-radius: 12px; font-weight: 600; box-shadow: 0 10px 30px #00000040; }
.foot { max-width: 1120px; margin: 8px auto 0; padding: 8px calc(16px + var(--sa-r)) calc(18px + var(--sa-b)) calc(16px + var(--sa-l)); color: var(--mute); font-size: .84rem; }
.foot p { margin: 4px 0; }
.mute { opacity: .85; }
.noscript { padding: 20px; }

/* Téléphone */
@media (max-width: 720px) {
  .top-in { grid-template-columns: 1fr auto; }
  .mode-tabs { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; }
  .mode-tabs button { flex: 1; padding: 0 4px; font-size: .9rem; line-height: 1.1; }
  .layout { padding-top: 12px; gap: 12px; }
  .card { padding: 12px; }
  .grid { grid-template-columns: 1fr; gap: 8px; }
  .grid .field { display: grid; grid-template-columns: 84px minmax(0, 1fr); align-items: center; column-gap: 8px; }
  .grid .field > label { margin: 0; font-size: .74rem; line-height: 1.2; }
  .grid .field > .msg { grid-column: 1 / -1; }
  .step { width: 44px; }
  body { padding-bottom: 70px; }
  .seg.solve button { font-size: .86rem; }
  .tools .btn { flex: 1 1 100px; padding: 0 8px; font-size: .9rem; }
}
@media (max-width: 360px) { .step { width: 42px; } .step.list { display: none; } }
/* Paysage sur téléphone : deux colonnes de champs */
@media (max-height: 500px) and (orientation: landscape) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .r-big { font-size: 2.4rem; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
@media print { .top, .peek, .tools, .toast { display: none; } .card { box-shadow: none; } }
