/* Espace animateur */

/* Connexion */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(400px, 100%); display: grid; gap: 18px; }
.login-card h1 { font-size: 2.4rem; font-variation-settings: 'wdth' 85; margin-top: 18px; }

/* Cadre */
.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 28px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 10; }
.head-right { display: flex; align-items: center; gap: 4px; }
.head-left { display: flex; align-items: center; gap: 28px; min-width: 0; }
.nav { display: flex; gap: 4px; }
.nav a { padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 600; }
.nav a:hover { color: var(--ink); background: rgba(23, 24, 43, .05); }
.nav a.on { color: var(--ink); background: rgba(23, 24, 43, .07); }
.head .me-btn { color: var(--ink); max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.head .btn.small { color: var(--muted); }
.head .btn.small:hover { color: var(--ink); }

/* Liste */
.list-view { max-width: 980px; margin: 0 auto; padding: 48px 28px 64px; }
.list-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.list-head h1 { font-size: clamp(2.4rem, 5vw, 3.4rem); font-variation-settings: 'wdth' 82; }
.list-actions { display: flex; gap: 10px; }
.quiz-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; background: var(--line); border-radius: var(--radius-m); overflow: hidden; box-shadow: 0 0 0 1px var(--line); }
.quiz-row { display: flex; align-items: center; gap: 16px; padding: 18px 20px; background: var(--surface); }
.quiz-main { flex: 1; min-width: 0; display: grid; gap: 2px; text-decoration: none; color: inherit; }
.quiz-title { font-size: 1.3rem; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quiz-main:hover .quiz-title { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.quiz-meta { color: var(--muted); font-size: .95rem; }
.quiz-tools { display: flex; align-items: center; gap: 2px; flex: none; }
.quiz-tools .btn.ghost { color: var(--muted); }
.quiz-tools .btn.ghost:hover { color: var(--ink); }
.quiz-tools .btn.danger:hover { color: var(--bad); }
.quiz-tools .btn:not(.ghost) { margin-left: 8px; }
.quiz-tools [data-empty] { opacity: .35; }
.quiz-list .empty { background: var(--surface); padding: 48px 24px; text-align: center; color: var(--muted); display: grid; gap: 4px; }
.quiz-list .empty p:first-child { color: var(--ink); font-weight: 650; font-size: 1.15rem; }
.foot { margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: .9rem; }

/* Mise à jour */
.maj { border: 0; padding: 0; border-radius: var(--radius-l); width: min(520px, calc(100% - 32px)); color: var(--ink); background: var(--surface); box-shadow: 0 30px 80px rgba(23, 24, 43, .25); }
.maj::backdrop { background: rgba(23, 24, 43, .45); }
.maj-box { padding: 28px; display: grid; gap: 18px; }
.maj h2 { font-size: 1.7rem; font-variation-settings: 'wdth' 88; }
.maj-current { color: var(--muted); margin-top: -10px; }
.maj-step { display: grid; gap: 14px; }
.maj-drop { display: grid; gap: 4px; justify-items: center; text-align: center; padding: 28px 18px; border: 1.5px dashed #C7CAD8; border-radius: var(--radius-m); cursor: pointer; transition: .15s; }
.maj-drop span { font-weight: 650; overflow-wrap: anywhere; }
.maj-drop small { color: var(--muted); }
.maj-drop:hover, .maj-drop.over { border-color: var(--ink); background: var(--paper); }
.maj-drop.chosen { border-style: solid; border-color: var(--green); background: #EEF8F2; }
.maj-warn { background: #FFF4E0; color: #7A4B00; padding: 10px 14px; border-radius: var(--radius-s); font-weight: 550; }
.maj-last { color: var(--muted); font-size: .9rem; }
.maj-last:empty { display: none; }
.maj-actions { display: flex; justify-content: flex-end; gap: 8px; }
.maj-bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.maj-bar i { display: block; height: 100%; background: var(--ink); transform-origin: left; transform: scaleX(0); transition: transform .3s; }
.maj-bar i.wait { transform: scaleX(.6); animation: majwait 1.4s ease-in-out infinite alternate; }
@keyframes majwait { to { transform: scaleX(.95); } }
.maj-status { font-weight: 650; }
.maj-note { color: var(--muted); font-size: .9rem; }
.maj-result { font-weight: 650; font-size: 1.1rem; padding: 14px 16px; border-radius: var(--radius-s); }
.maj-result.good { background: #EEF8F2; color: #0B6B35; }
.maj-result.bad { background: #FDECEC; color: #A3262A; }

/* Éditeur */
.editor { display: grid; grid-template-rows: auto 1fr; height: calc(100vh - 67px); }
.ed-head { display: flex; align-items: center; gap: 14px; padding: 12px 28px; border-bottom: 1px solid var(--line); }
.ed-head > .btn.ghost { color: var(--muted); }
.ed-title { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; padding: 6px 8px; border-radius: 8px; outline: none; }
.ed-title:hover { background: rgba(23, 24, 43, .04); }
.ed-title:focus { background: var(--surface); box-shadow: 0 0 0 1.5px var(--ink); }
.ed-title::placeholder { color: #B6B9C8; }
.ed-status { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.ed-status.bad { color: var(--bad); }
.ed-body { display: grid; grid-template-columns: 300px 1fr; min-height: 0; }

.ed-side { border-right: 1px solid var(--line); overflow-y: auto; padding: 16px 12px 24px; display: grid; align-content: start; gap: 12px; }
.q-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.q-item { width: 100%; display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: start; text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: var(--radius-s); cursor: pointer; }
.q-item:hover { background: rgba(23, 24, 43, .05); }
.q-list li.on .q-item { background: var(--ink); color: #fff; }
.q-num { font-weight: 700; color: var(--muted); }
.q-list li.on .q-num { color: #A9ABC2; }
.q-label { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-weight: 550; line-height: 1.3; }
.q-label em { font-style: normal; color: var(--muted); }
.q-list li.on .q-label em { color: #A9ABC2; }
.q-warn { width: 20px; height: 20px; border-radius: 50%; background: var(--yellow); color: var(--ink); font-size: .8rem; font-weight: 800; display: grid; place-items: center; }
.add-q { width: 100%; }

.ed-main { overflow-y: auto; padding: 28px clamp(20px, 4vw, 56px) 48px; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 22px; max-width: 1040px; width: 100%; }
.ed-empty { color: var(--muted); padding: 60px 0; text-align: center; }
.qe-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 4px; background: rgba(23, 24, 43, .06); border-radius: 999px; }
.seg button { border: 0; background: none; padding: 8px 18px; border-radius: 999px; cursor: pointer; font-weight: 600; color: var(--ink-2); }
.seg button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(23, 24, 43, .14); }
.time { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-weight: 550; }
.time .input { min-height: 42px; width: auto; padding: 6px 12px; }

.q-input {
  width: 100%; border: 0; background: transparent; resize: none; outline: none; overflow: hidden;
  font-size: clamp(1.7rem, 3vw, 2.4rem); font-weight: 700; line-height: 1.15; letter-spacing: -0.015em;
  font-variation-settings: 'wdth' 90; padding: 4px 0; border-bottom: 2px solid var(--line);
}
.q-input:focus { border-color: var(--ink); }
.q-input::placeholder { color: #B6B9C8; }

.media-drop { display: grid; justify-items: center; gap: 4px; padding: 26px; border: 1.5px dashed #C7CAD8; border-radius: var(--radius-m); cursor: pointer; text-align: center; transition: .15s; }
.media-drop span { font-weight: 650; }
.media-drop small { color: var(--muted); }
.media-drop:hover, .media-drop.over { border-color: var(--ink); background: var(--surface); }
.media-preview { display: flex; align-items: end; gap: 14px; }
.media-preview img { max-height: 220px; max-width: 70%; border-radius: var(--radius-m); }

.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ans {
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 14px; border-radius: var(--radius-m);
  background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); transition: box-shadow .15s;
}
.ans:focus-within { box-shadow: inset 0 0 0 2px var(--a); }
.ans.is-correct { box-shadow: inset 0 0 0 2.5px var(--a); }
.ans-shape { width: 40px; height: 40px; flex: none; border-radius: 10px; background: var(--a); color: var(--a-ink); display: grid; place-items: center; }
.ans-shape svg { width: 22px; height: 22px; fill: currentColor; }
.ans-input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 1.1rem; font-weight: 550; padding: 10px 0; }
.ans-input::placeholder { color: #B6B9C8; font-weight: 450; }
.ans-fixed { flex: 1; font-size: 1.2rem; font-weight: 650; }
.ans-ok {
  flex: none; display: inline-flex; align-items: center; gap: 6px; border: 0; cursor: pointer; border-radius: 999px;
  padding: 8px 12px; background: rgba(23, 24, 43, .05); color: var(--muted); font-weight: 600; font-size: .85rem;
}
.ans-ok svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.ans-ok:hover { color: var(--ink); }
.ans-ok[aria-pressed="true"] { background: var(--good); color: #fff; }
.qe-issues { color: #A86A00; font-weight: 550; min-height: 1.2em; margin-top: -8px; }
.qe-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 18px; border-top: 1px solid var(--line); }
.qe-foot .btn.ghost { color: var(--muted); }
.qe-foot .btn.ghost:hover { color: var(--ink); }
.qe-foot .btn.danger:hover { color: var(--bad); }

@media (max-width: 900px) {
  .head { padding: 12px 16px; }
  .head .brand small { display: none; }
  .list-view { padding: 28px 16px; }
  .quiz-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .quiz-tools { flex-wrap: wrap; }
  .editor { height: auto; display: block; }
  .ed-head { padding: 10px 12px; gap: 8px; flex-wrap: wrap; }
  .ed-title { order: 3; flex-basis: 100%; }
  .ed-body { display: block; }
  .ed-side { border-right: 0; border-bottom: 1px solid var(--line); max-height: 40vh; }
  .ed-main { padding: 20px 16px 40px; }
  .answers { grid-template-columns: 1fr; }
  .ans-ok span { display: none; }
}

/* Comptes */
.tag { display: inline-block; vertical-align: 2px; margin-left: 6px; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 650; background: rgba(23, 24, 43, .07); color: var(--ink-2); letter-spacing: 0; }
.tag.admin { background: #E8EEFF; color: #1E3FBF; }
.acc-row .quiz-main { cursor: default; }
.acc-note { margin-top: 18px; color: var(--muted); font-size: .92rem; max-width: 70ch; }
.maj .field .seg { justify-self: start; }
.maj .seg button:disabled { cursor: not-allowed; opacity: .6; }
#acc-login:disabled { background: var(--paper); color: var(--muted); }
@media (max-width: 900px) {
  .head-left { gap: 10px; }
  .head .me-btn, .head-right a { display: none; }
}
