/*
######################################
# Application : Cuvry en Balade
# Dépôt GIT   : URL_DU_DEPOT
# Auteur      : NOM_AUTEUR
# E-Mail      : EMAIL_AUTEUR
# Version     : 2026-05-001
######################################
*/
:root {
  --blue: #0a8bd6;
  --ink: #122033;
  --gold: #d7a63f;
  --green: #1d8b62;
  --paper: #f8fbff;
  --line: #dbe5ef;
  --muted: #607087;
  --danger: #b42318;
  --deep-blue: #102f4f;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.55;
}
a { color: inherit; }
img, video { max-width: 100%; display: block; }
.protected-media {
  -webkit-user-drag: none;
  user-select: none;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: .8rem clamp(1rem, 4vw, 3rem);
  background: rgba(248, 251, 255, .94);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-weight: 800;
  text-decoration: none;
  color: var(--blue);
}
.topnav { display: flex; gap: .8rem; flex-wrap: wrap; }
.topnav a { text-decoration: none; font-weight: 700; font-size: .95rem; }
.hero {
  min-height: 72vh;
  display: flex;
  align-items: end;
  padding: clamp(2rem, 7vw, 5rem);
  background-image: linear-gradient(180deg, rgba(18,32,51,.15), rgba(18,32,51,.72)), url("/static/css/hero-cuvry.svg");
  background-position: center;
  background-size: cover;
  color: white;
}
.hero__content { max-width: 760px; }
.hero h1 {
  margin: .2rem 0;
  font-size: clamp(2.5rem, 8vw, 5.4rem);
  line-height: 1;
}
.hero p { font-size: 1.16rem; max-width: 660px; }
.hero__actions, .section__title, .detail-head, .action-column, .inline-form {
  display: flex;
  gap: .8rem;
  flex-wrap: wrap;
  align-items: center;
}
.detail-head, .section__title { justify-content: space-between; }
.section { width: min(1120px, calc(100% - 2rem)); margin: 0 auto; padding: 2rem 0; }
.narrow { max-width: 760px; }
.eyebrow, .tag {
  margin: 0 0 .5rem;
  color: var(--gold);
  font-weight: 800;
  text-transform: uppercase;
  font-size: .78rem;
}
.muted { color: var(--muted); }
[hidden] { display: none !important; }
.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: .65rem 1rem;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.button--primary { background: var(--blue); color: white; border-color: var(--blue); }
.button--danger { background: var(--danger); color: white; border-color: var(--danger); }
.button--small { min-height: 36px; padding: .45rem .75rem; }
.scenario-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.card, .row-card, .tile, .login-card, .riddle {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 1rem;
}
.scenario-card { display: grid; gap: 1rem; }
.scenario-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; }
.timeline { padding-left: 1.2rem; }
.timeline li { margin: .75rem 0; padding-left: .25rem; }
.timeline span { display: block; color: var(--muted); }
.answer-review-list { display: grid; gap: 1rem; margin: 1rem 0; }
.answer-review {
  scroll-margin-top: 5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 1rem;
}
.answer-review h3 { margin-top: 0; }
.answer-review .success-media { max-width: 320px; }
.answer-review audio { width: 100%; margin-top: .5rem; }
.step-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; }
.home-back { display: block; text-align: center; font-size: .82rem; color: var(--muted, #8592a3); padding: .75rem 0 .25rem; text-decoration: none; }
.home-back:hover { text-decoration: underline; }
.home-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  padding: .45rem 1rem;
  font-size: .78rem;
  color: var(--muted);
  background: rgba(248,251,255,.92);
  border-top: 1px solid var(--line);
  z-index: 5;
}
.home-footer a { color: var(--muted); text-decoration: underline; }
.step-main {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
.step-image { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.step-title-band {
  display: grid;
  gap: .25rem;
  padding: 1rem clamp(1rem, 4vw, 1.4rem);
  background: var(--deep-blue);
  color: white;
  text-align: center;
}
.step-title-band h1 {
  margin: 0;
  font-size: clamp(1.45rem, 5vw, 2.2rem);
  line-height: 1.15;
}
.step-kicker {
  margin: 0;
  font-size: .74rem;
  font-weight: 800;
  text-transform: uppercase;
  opacity: .82;
}
.step-content {
  padding: 1.15rem clamp(1rem, 4vw, 1.4rem) 1.25rem;
}
.step-description { margin-top: 0; }
.step-content .riddle {
  margin-top: 1rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.step-content .riddle p:first-child { margin-top: 0; }
.step-content .riddle button { margin-top: .7rem; }
.riddle { margin-top: 1rem; }
label { display: grid; gap: .35rem; font-weight: 700; }
input, textarea, select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .65rem .75rem;
  font: inherit;
}
textarea { min-height: 96px; resize: vertical; }
.feedback { min-height: 1.5rem; font-weight: 800; }
.segmented { display: flex; gap: .75rem; flex-wrap: wrap; }
.segmented label {
  display: flex;
  align-items: center;
  gap: .4rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .55rem .8rem;
  background: white;
}
.segmented input { width: auto; min-height: auto; }
.progress { height: 10px; background: #e9f1f8; border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--green); }
.step-list { list-style: none; padding: 0; }
.step-list li { padding: .45rem 0; border-bottom: 1px solid var(--line); }
.step-list .done a { color: var(--green); font-weight: 800; }
.locked { opacity: .55; }
.locked a, a[aria-disabled="true"] { cursor: not-allowed; text-decoration: none; color: var(--muted); }
.next-step-box { border-color: var(--green); background: #f1fbf6; }
.step-main .next-step-box {
  margin: 0;
  background: white;
}
.step-main .next-step-box:not([hidden]) {
  display: grid;
  gap: 1rem;
}
.step-main .next-step-box p {
  margin: 0;
}
.success-response {
  display: grid;
  grid-template-columns: minmax(150px, 210px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
.success-media { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.success-media[hidden] { display: none; }
.next-step-box audio { width: 100%; margin: .5rem 0; }
.audio-start { margin-top: .7rem; }
.map-shell a.locked .map-marker { fill: var(--muted); }
.scanner video { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: #122033; }
.manual-scan { display: flex; gap: .8rem; align-items: end; flex-wrap: wrap; margin-top: 1rem; }
.manual-scan label { flex: 1 1 200px; }
.map-shell { background: #eef7f5; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.map-shell svg { width: 100%; min-height: 360px; }
.google-map-shell {
  width: 100%;
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #eef7f5;
}
.google-map-shell iframe {
  width: 100%;
  height: 420px;
  border: 0;
  display: block;
}
.map-preview-fallback {
  display: grid;
  place-items: center;
  padding: 1.2rem;
  text-align: center;
}
.map-road { fill: none; stroke: var(--gold); stroke-width: 2.5; stroke-linecap: round; }
.map-marker { fill: var(--blue); stroke: white; stroke-width: 1.5; }
.map-shell text { fill: var(--ink); font-size: 4px; font-weight: 800; text-anchor: middle; }
.connectivity { position: fixed; left: 1rem; right: 1rem; bottom: 1rem; padding: .8rem; background: var(--ink); color: white; border-radius: 8px; text-align: center; }
.admin-body { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.admin-sidebar { background: #10253d; color: white; padding: 1rem; display: flex; flex-direction: column; gap: 1rem; }
.admin-sidebar nav { display: grid; gap: .3rem; }
.admin-sidebar a { color: white; text-decoration: none; padding: .55rem; border-radius: 6px; }
.admin-sidebar a:hover { background: rgba(255,255,255,.12); }
.admin-main { padding: 1.5rem; overflow: auto; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; }
.tile { text-decoration: none; }
.tile strong { display: block; font-size: 2rem; color: var(--blue); }
.admin-form { display: grid; gap: .7rem; margin: 1rem 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .7rem; }
.form-section-label {
  margin: .25rem 0 -.25rem;
  color: var(--blue);
  font-weight: 800;
}
.admin-fieldset {
  display: grid;
  gap: .7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
}
.admin-fieldset legend { font-weight: 800; color: var(--blue); padding: 0 .35rem; }
.scenario-switcher { margin-bottom: 1rem; justify-content: flex-start; }
.scenario-switcher label { min-width: min(420px, 100%); }
.preview-toolbar { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1rem 0; }
.mobile-preview-layout {
  display: grid;
  grid-template-columns: minmax(380px, 470px) minmax(240px, 1fr);
  gap: 1.2rem;
  align-items: start;
}
.phone-frame {
  width: min(470px, 100%);
  max-width: 100%;
  height: min(900px, calc(100vh - 180px));
  min-height: 680px;
  padding: 12px 8px 14px;
  border: 8px solid #111827;
  border-radius: 24px;
  background: #111827;
  box-shadow: 0 16px 40px rgba(18, 32, 51, .24);
}
.phone-speaker {
  width: 76px;
  height: 6px;
  margin: 0 auto 9px;
  border-radius: 999px;
  background: #2d3748;
}
.phone-frame iframe {
  width: 430px;
  height: calc((100% - 15px) / .96);
  border: 0;
  border-radius: 14px;
  background: white;
  transform: scale(.96);
  transform-origin: top left;
}
.check { display: flex; align-items: center; gap: .5rem; }
.check input { width: auto; min-height: auto; }
.button-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: .7rem; }
.admin-media-row {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
.admin-preview {
  display: grid;
  place-items: center;
  min-height: 130px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f7fafc;
  color: var(--muted);
  overflow: hidden;
}
.admin-preview--wide { min-height: 180px; }
.admin-preview img {
  width: 100%;
  height: 100%;
  min-height: 130px;
  object-fit: cover;
}
.admin-preview--wide img { min-height: 180px; }
.drag-handle { cursor: grab; padding: 0 .5rem 0 0; color: var(--muted); font-size: 1.1rem; user-select: none; display: inline-block; }
.drag-handle:active { cursor: grabbing; }
.row-card.dragging { opacity: .35; }
.drag-placeholder { height: 3px; background: var(--blue); border-radius: 2px; margin: 2px 0; }
.alert { padding: .8rem 1rem; border-radius: 8px; background: #fff2d6; border: 1px solid var(--gold); margin-bottom: 1rem; }
.alert--success { background: #e9f9f1; border-color: var(--green); }
.alert--error { background: #fff0ee; border-color: var(--danger); }
.error { color: var(--danger); font-weight: 800; }
.media-library { display: grid; gap: .7rem; margin: 1rem 0; }
.media-item {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: .8rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: .7rem;
}
.media-item img { width: 120px; height: 78px; object-fit: cover; border-radius: 6px; }
.media-item audio { width: 120px; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-card { width: min(420px, 100%); display: grid; gap: .9rem; }
code { overflow-wrap: anywhere; }

/* ── Puzzle taquin ── */
.puzzle-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  aspect-ratio: 1;
  width: 100%;
  max-width: 320px;
  margin: 1rem auto;
  border-radius: 6px;
  overflow: hidden;
}
.puzzle-tile {
  aspect-ratio: 1;
  border: none;
  cursor: pointer;
  padding: 0;
  background: var(--subtle, #f0f4f8);
  background-repeat: no-repeat;
  transition: opacity .1s;
  -webkit-tap-highlight-color: transparent;
}
.puzzle-tile:hover { opacity: .82; }
.puzzle-selected { outline: 3px solid var(--blue, #0a8bd6); outline-offset: -3px; transform: scale(.94); z-index: 1; }
.puzzle-solved { outline: 3px solid var(--green, #2f9e44); border-radius: 6px; pointer-events: none; }

/* ── Memory / appairage ── */
.memory-board {
  display: grid;
  grid-template-columns: repeat(var(--memory-cols, 4), 1fr);
  gap: .45rem;
  margin: 1rem auto;
  max-width: 360px;
}
.memory-card {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 2px solid var(--line, #dde3ea);
  background: var(--subtle, #f0f4f8);
  cursor: pointer;
  overflow: hidden;
  padding: 0;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .2s, transform .15s;
  -webkit-tap-highlight-color: transparent;
}
.memory-card:not(.memory-card--revealed):not(:disabled)::before { content: "?"; color: var(--muted, #8592a3); }
.memory-card img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; user-select: none; display: block; }
.memory-card--matched { border-color: var(--green, #2f9e44); cursor: default; }
.memory-solved { pointer-events: none; }

/* ── Vue Avant/Après ── */
.before-after {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  user-select: none;
  touch-action: pan-y;
  margin: 1rem 0;
  --ba-pos: 50%;
}
.before-after__after {
  width: 100%;
  display: block;
  pointer-events: none;
}
.before-after__before {
  position: absolute;
  inset: 0;
  clip-path: inset(0 calc(100% - var(--ba-pos)) 0 0);
}
.before-after__before img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  display: block;
}
.before-after__handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--ba-pos);
  transform: translateX(-50%);
  width: 44px;
  cursor: ew-resize;
  display: flex;
  align-items: center;
  justify-content: center;
}
.before-after__handle::after {
  content: "";
  position: absolute;
  width: 3px;
  top: 0;
  bottom: 0;
  background: white;
  box-shadow: 0 0 6px rgba(0,0,0,.35);
}
.before-after__knob {
  position: relative;
  z-index: 1;
  width: 38px;
  height: 38px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,.28);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  letter-spacing: -.1em;
}
.before-after__label {
  position: absolute;
  bottom: .5rem;
  background: rgba(0,0,0,.52);
  color: white;
  font-size: .72rem;
  font-weight: 600;
  padding: .15rem .5rem;
  border-radius: 4px;
  pointer-events: none;
}
.before-after__label--before { left: .5rem; }
.before-after__label--after { right: .5rem; }
.before-after__continue {
  position: absolute;
  bottom: .75rem;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

/* ── Audio riddle ── */
.audio-riddle audio { width: 100%; margin-bottom: .75rem; }

/* ── Tableau QR Codes ── */
.qr-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem; margin-bottom: .5rem; }
.qr-header h1 { margin: 0; }
.qr-scenario { margin: 1.5rem 0; }
.qr-scenario-title { margin: 0 0 .75rem; color: var(--deep-blue); font-size: 1.1rem; }
.qr-table { width: 100%; border-collapse: collapse; background: white; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.qr-table th { text-align: left; padding: .6rem .75rem; background: #f7fafc; border-bottom: 2px solid var(--line); font-weight: 800; font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.qr-table td { padding: .5rem .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.qr-table tr:last-child td { border-bottom: 0; }
.qr-table tr:hover td { background: #f7fafc; }
.qr-td-num { width: 3rem; color: var(--muted); font-weight: 800; }
.qr-td-img { width: 100px; }
.qr-thumb { width: 80px; height: 80px; border-radius: 4px; display: block; }
.qr-td-code { font-family: monospace; }
.qr-code-badge { display: inline-block; background: var(--deep-blue); color: white; padding: .25rem .6rem; border-radius: 6px; font-size: 1.1rem; font-weight: 800; letter-spacing: .1em; }
@media print {
  .no-print { display: none !important; }
  .admin-sidebar { display: none !important; }
  .admin-main { padding: 0 !important; }
  .admin-body { display: block !important; }
  .qr-table { page-break-inside: avoid; }
  .qr-thumb { width: 65px !important; height: 65px !important; }
  .qr-scenario { page-break-inside: avoid; margin: 1rem 0; }
}

/* ── Widget admin ── */
[data-wtype] { padding: .6rem 0 .3rem; border-top: 1px solid var(--line, #dde3ea); margin-top: .3rem; }
[data-widget-success] { padding: .6rem 0 .3rem; border-top: 1px solid var(--line, #dde3ea); margin-top: .3rem; }
@media (max-width: 780px) {
  .topbar, .detail-head { align-items: flex-start; }
  .step-layout, .admin-body, .admin-media-row, .mobile-preview-layout { grid-template-columns: 1fr; }
  body:has(.step-screen) {
    background: white;
  }
  body:has(.step-screen) .topbar {
    display: none;
  }
  .step-screen.section {
    width: 100%;
    padding: 0 0 1.25rem;
  }
  .step-screen {
    gap: 0;
  }
  .step-main {
    border: 0;
    border-radius: 0;
  }
  .step-image {
    min-height: 190px;
    max-height: 38vh;
    aspect-ratio: 16 / 9;
  }
  .step-title-band {
    min-height: 62px;
    place-content: center;
    padding: 1rem;
    background: var(--blue);
  }
  .step-title-band h1 {
    font-size: 1.25rem;
  }
  .step-kicker {
    display: none;
  }
  .step-content {
    padding: 1.35rem 1.1rem 1.4rem;
    color: #4d596b;
    font-size: .98rem;
  }
  .step-content .riddle {
    display: grid;
    gap: .65rem;
  }
  .step-content .riddle label {
    color: var(--ink);
  }
  .step-content .riddle .button--primary,
  .step-main .next-step-box .button--primary {
    width: min(100%, 320px);
    min-height: 52px;
    justify-self: center;
    border-radius: 999px;
  }
  .success-response { grid-template-columns: 1fr; }
  .success-media { max-width: 260px; }
  .phone-frame { height: 760px; min-height: 620px; }
  .admin-sidebar { position: static; }
  .hero { min-height: 64vh; padding: 2rem 1rem; }
}
