/* Appli de quêtes — style Néon (spec §6.1, maquettes v1) */
@font-face { font-family: 'Chakra Petch'; src: url('/fonts/ChakraPetch-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Chakra Petch'; src: url('/fonts/ChakraPetch-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Chakra Petch'; src: url('/fonts/ChakraPetch-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }

:root {
  --nuit: #05060f; --fond: #0d1024; --carte: #151a38; --bord: #2a2f5a; --piste: #262b55; --creux: #10142c;
  --texte: #e6e9ff; --doux: #c5c9f0; --gris: #8b91c7;
  --cyan: #22e1ff; --magenta: #ff3df0; --vert: #7dff6b; --or: #ffd23f; --orange: #ffb020;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--fond); color: var(--texte); font-family: 'Chakra Petch', system-ui, sans-serif; font-size: 15px; }
body { min-height: 100vh; padding: env(safe-area-inset-top) 0 calc(64px + env(safe-area-inset-bottom)); }
body.sans-nav { padding-bottom: env(safe-area-inset-bottom); }
main { max-width: 520px; margin: 0 auto; padding: 16px 16px 24px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* en-têtes */
.vh { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 19px; text-transform: uppercase; letter-spacing: 1px; }
.vh small { font-size: 13px; color: var(--gris); letter-spacing: 0; text-transform: none; font-weight: 500; }
.coin { color: var(--or); font-size: 15px; letter-spacing: 0; }
.sub { font-size: 13px; color: var(--gris); margin-top: 3px; }
.vsec { font-size: 12px; letter-spacing: 3px; font-weight: 600; text-transform: uppercase; color: var(--gris); margin: 16px 0 8px; }
.engrenage { background: none; border: 0; color: var(--gris); font-size: 20px; padding: 0 0 0 12px; text-decoration: none; }

/* personnage */
.avatar { display: flex; gap: 12px; align-items: center; margin-top: 12px; }
.av { width: 58px; height: 58px; border-radius: 14px; background: radial-gradient(circle at 50% 35%, #22e1ff55, var(--fond) 70%); border: 2px solid var(--cyan); display: flex; align-items: center; justify-content: center; font-size: 28px; box-shadow: 0 0 12px #22e1ff88; flex: none; }
.lv { font-size: 13px; color: var(--gris); }
.lv b { font-size: 22px; color: var(--texte); }
.lv em { display: block; font-style: normal; color: var(--magenta); font-size: 13px; letter-spacing: 1px; }
.bar { height: 8px; border-radius: 4px; background: var(--piste); overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; border-radius: 4px; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); transition: width .4s; }
.bar.or i { background: var(--or); box-shadow: 0 0 8px var(--or); }
.bar.mini { height: 5px; }
.bar.mini i { background: var(--magenta); box-shadow: none; }

/* quêtes */
.q { background: var(--carte); border-radius: 12px; padding: 10px 11px; border-left: 3px solid var(--cyan); margin-bottom: 7px; display: flex; gap: 10px; align-items: center; font-size: 15px; }
.q.retard { border-left-color: var(--orange); box-shadow: inset 0 0 0 1px #ffb02044; }
.q .corps { flex: 1; min-width: 0; }
.q .titre { overflow-wrap: anywhere; }
.q small { display: block; color: var(--gris); font-size: 12px; margin-top: 2px; }
.q .gain { color: var(--vert); font-size: 13px; white-space: nowrap; text-align: right; }
.q .gain small { color: var(--or); }
.coche { width: 30px; height: 30px; flex: none; border-radius: 9px; border: 1.5px solid var(--cyan); background: transparent; color: var(--cyan); font-size: 16px; font-weight: 700; }
.coche:active { background: var(--cyan); color: var(--nuit); }
.etape { display: inline-block; margin-top: 3px; font-size: 12px; color: var(--magenta); }
.vide { color: var(--gris); font-size: 14px; padding: 6px 2px; }
.fait.annuler { align-items: center; margin: 10px 0 0; border: 1px solid #22e1ff55; }
.fait.annuler button { background: none; border: 1px solid var(--cyan); border-radius: 8px; color: var(--cyan); font-size: 13px; padding: 4px 10px; }
.fait { display: flex; justify-content: space-between; background: var(--creux); border-radius: 10px; padding: 8px 10px; font-size: 13px; color: var(--doux); margin-top: 6px; }

/* puces, onglets, champs */
.seg { display: flex; gap: 3px; margin: 12px 0 4px; background: var(--carte); border-radius: 10px; padding: 3px; overflow-x: auto; }
.seg button { flex: 1; min-width: max-content; text-align: center; font-size: 12px; padding: 6px 8px; border-radius: 8px; color: var(--gris); background: none; border: 0; }
.seg button.on { background: var(--cyan); color: var(--nuit); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 13px; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--bord); color: var(--doux); background: none; white-space: nowrap; }
.chip.on { background: var(--magenta); border-color: var(--magenta); color: var(--nuit); font-weight: 700; }
.chip.on.c { background: var(--cyan); border-color: var(--cyan); }
.chip.on.g { background: var(--vert); border-color: var(--vert); }
.lbl { font-size: 11px; letter-spacing: 2px; font-weight: 600; text-transform: uppercase; color: var(--gris); margin: 12px 0 6px; }
.in { width: 100%; background: var(--carte); border: 1px solid var(--bord); border-radius: 10px; padding: 10px 11px; font-size: 16px; color: var(--texte); outline: none; }
.in:focus { border-color: var(--cyan); box-shadow: 0 0 8px #22e1ff33; }
.ligne { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-top: 10px; font-size: 14px; }
.ligne .in { width: auto; flex: 1; }
.btn { display: block; width: 100%; margin-top: 14px; text-align: center; padding: 11px; border-radius: 10px; background: var(--cyan); color: var(--nuit); font-weight: 700; font-size: 14px; text-transform: uppercase; letter-spacing: 1px; border: 0; }
.btn.ghost { background: transparent; color: var(--cyan); border: 1px solid var(--cyan); }
.btn.or { background: var(--or); }
.btn:disabled { opacity: .5; }
.lien { background: none; border: 0; color: var(--cyan); font-size: 13px; padding: 8px 0; display: block; margin: 6px auto 0; }
.erreur { color: var(--orange); font-size: 13px; margin-top: 8px; min-height: 1em; }
.note { font-size: 12px; color: var(--gris); margin-top: 8px; line-height: 1.5; }

/* étapes d'une chaîne */
.stp { display: flex; align-items: center; gap: 6px; background: var(--carte); border-radius: 9px; padding: 6px 8px; margin-bottom: 5px; font-size: 14px; }
.stp .num { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--magenta); color: var(--magenta); flex: none; font-size: 11px; display: flex; align-items: center; justify-content: center; }
/* 16 px minimum sur les champs : en dessous, l'iPhone zoome à chaque toucher */
.stp input { flex: 1; min-width: 0; background: none; border: 0; color: var(--texte); font-size: 16px; outline: none; }
.stp select { background: var(--creux); border: 1px solid var(--bord); border-radius: 6px; color: var(--vert); font-size: 16px; padding: 2px; max-width: 108px; }
.stp button { background: none; border: 0; color: var(--gris); font-size: 14px; padding: 2px 4px; }
.total { display: flex; justify-content: space-between; font-size: 13px; margin-top: 8px; color: var(--doux); }
.total b { color: var(--vert); }

/* boutique */
.prz { border-radius: 12px; padding: 9px 11px; background: #ff3df014; border: 1px solid var(--magenta); font-size: 13px; color: var(--doux); margin-top: 12px; }
.rw { background: var(--carte); border-radius: 12px; padding: 10px 11px; margin-bottom: 7px; font-size: 15px; }
.rw .t { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rw .t small { display: block; color: var(--gris); font-size: 12px; }
.rw .p { color: var(--or); font-weight: 700; white-space: nowrap; font-size: 14px; }
.prendre { background: var(--or); color: var(--nuit); font-weight: 700; font-size: 12px; padding: 6px 10px; border-radius: 8px; border: 0; margin-left: 6px; }
.rw.verrou { opacity: .6; }
.accroche { display: block; margin-top: 14px; text-decoration: none; color: inherit; font-size: 14px; }
.rw.verrou .t small { color: var(--orange); }
.hist { font-size: 13px; color: var(--gris); display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #1b2045; }
.calc { display: flex; justify-content: space-between; font-size: 14px; margin-top: 8px; color: var(--doux); }
.calc b { color: var(--or); }

/* feuille (panneau du bas) */
.voile { position: fixed; inset: 0; background: #05060fcc; z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.feuille { width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto; background: var(--carte); border: 1px solid var(--cyan); border-bottom: 0; border-radius: 18px 18px 0 0; padding: 14px 16px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 0 24px #22e1ff33; }
.feuille .h { font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--cyan); margin-bottom: 10px; display: flex; justify-content: space-between; }
.feuille .h button { background: none; border: 0; color: var(--gris); font-size: 18px; padding: 0; }
.feuille.or { border-color: var(--or); box-shadow: 0 0 24px #ffd23f33; }
.feuille.or .h { color: var(--or); }

/* toast */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 30; background: var(--carte); border: 1px solid var(--vert); border-radius: 12px; padding: 10px 14px; display: flex; gap: 14px; align-items: center; font-size: 14px; box-shadow: 0 0 16px #7dff6b44; width: max-content; max-width: 92vw; }
.toast button { background: none; border: 0; color: var(--cyan); font-weight: 700; font-size: 14px; }

/* barre du bas */
nav.barre { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--fond); border-top: 1px solid var(--bord); display: flex; justify-content: space-around; padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); }
nav.barre a { color: var(--gris); text-decoration: none; font-size: 11px; text-align: center; line-height: 1.4; min-width: 64px; }
nav.barre a span { display: block; font-size: 18px; }
nav.barre a.on { color: var(--cyan); }

/* connexion */
.centre { max-width: 360px; margin: 8vh auto 0; }
.logo { text-align: center; font-size: 28px; font-weight: 700; letter-spacing: 4px; color: var(--cyan); text-shadow: 0 0 12px #22e1ff88; margin-bottom: 18px; }
.secret { font-family: monospace; font-size: 15px; letter-spacing: 2px; background: var(--creux); border: 1px dashed var(--bord); border-radius: 8px; padding: 8px; word-break: break-all; text-align: center; }
