/* Tactique QIA 2 - theme bleu OTAN, mobile-first */
:root {
    --bg: #edf1f7;
    --card: #ffffff;
    --card2: #f2f6fb;
    --inset: #1c2b40;
    --text: #1e2632;
    --muted: #5f6b7d;
    --accent: #2b5f9e;
    --accent2: #1d4273;
    --warn: #c08c10;
    --ko: #c9402e;
    --ok: #2e8b47;
    --border: #d8e1ee;
    --radius: 16px;
    --shadow: 0 10px 34px rgba(25, 45, 80, .10);
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: system-ui, "Segoe UI", Roboto, -apple-system, sans-serif;
    background:
        radial-gradient(900px 420px at 80% -10%, #dbe6f4 0%, transparent 60%),
        radial-gradient(700px 400px at -10% 10%, #e4ecf6 0%, transparent 55%),
        var(--bg);
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 740px; margin: 0 auto; padding: 24px 14px 64px; }
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 26px;
    box-shadow: var(--shadow);
    animation: fadeUp .25s ease;
    margin-bottom: 14px;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

h1 { margin: 0 0 8px; font-size: 1.6rem; color: var(--accent2); font-weight: 700; }
h2 { margin: 0 0 14px; font-size: 1.1rem; color: var(--accent2); font-weight: 700; }
h3 { margin: 18px 0 8px; font-size: .95rem; color: var(--accent2); }
a { color: var(--accent2); }
.muted { color: var(--muted); }
.center { text-align: center; }
.ok { color: var(--ok); } .ko { color: var(--ko); }

/* barre haut */
.topbar {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    padding-bottom: 14px; margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.who { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); text-decoration: none; min-width: 0; }
.who .rtitle { display: block; }
.rtitle { color: var(--muted); font-size: .78rem; font-weight: 500; }
.menu-dd { position: relative; }
.topnav { display: flex; align-items: center; gap: 8px; }
.homebtn {
    text-decoration: none; color: var(--accent2); font-weight: 700;
    border-color: var(--accent); background: #fff;
}
.menu-dd summary {
    list-style: none; cursor: pointer;
    padding: 8px 16px; border-radius: 999px;
    border: 1.5px solid var(--border); background: var(--card);
    font-weight: 600; font-size: .9rem;
}
.menu-dd summary::-webkit-details-marker { display: none; }
.menu-dd[open] summary { border-color: var(--accent); color: var(--accent2); }
.dd {
    position: absolute; right: 0; top: calc(100% + 8px);
    background: var(--card); border: 1.5px solid var(--border);
    border-radius: 13px; box-shadow: var(--shadow);
    padding: 6px; min-width: 200px; z-index: 60;
    animation: fadeUp .15s ease;
}
.dd a { display: block; padding: 10px 14px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: .92rem; font-weight: 600; }
.dd a:hover { background: var(--card2); color: var(--accent2); }

/* formulaires */
label { display: block; margin: 12px 0 6px; color: var(--muted); font-size: .9rem; font-weight: 600; }
input[type=text], input[type=password], input[type=file], textarea, select {
    width: 100%; padding: 13px 15px; font-size: 1rem; font-family: inherit;
    border-radius: 12px; border: 1.5px solid var(--border);
    background: var(--card2); color: var(--text); outline: none;
}
input:focus, textarea:focus { border-color: var(--accent); background: #fff; }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
textarea { resize: vertical; min-height: 70px; }
.inline { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline input { width: auto; flex: 1; min-width: 120px; }
.qform input, .qform textarea { margin-top: 8px; }
.qform select { width: auto; display: inline-block; }

/* boutons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 22px; margin-top: 14px;
    border: 1.5px solid var(--border); border-radius: 999px;
    background: var(--card2); color: var(--text);
    font-size: 1rem; font-weight: 600; cursor: pointer;
    text-decoration: none; text-align: center;
    transition: transform .08s, box-shadow .15s, border-color .15s, filter .15s;
}
.btn:hover { border-color: var(--accent); box-shadow: 0 4px 14px rgba(25,45,80,.14); }
.btn:active { transform: scale(.98); }
.btn.big { font-size: 1.12rem; padding: 14px 24px; background: linear-gradient(160deg, #3f77bd, var(--accent)); border-color: transparent; color: #fff; box-shadow: 0 6px 18px rgba(43, 95, 158, .28); }
.btn.big:hover { filter: brightness(1.07); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.danger { border-color: var(--ko); color: var(--ko); }
.btn.mini, .mini { padding: 5px 12px; margin-top: 0; font-size: .8rem; border-radius: 999px; border: 1.5px solid var(--border); background: var(--card2); cursor: pointer; }
.alert { background: #fdf0ee; border: 1.5px solid var(--ko); color: #8c2b20; padding: 11px 14px; border-radius: 10px; margin: 10px 0; }
.ok-alert { background: #e9f6ec !important; border-color: var(--ok) !important; color: #1f6b37 !important; }

/* menu : progression + chapitres + modes */
.prow { }
.plabel { font-size: 1rem; margin-bottom: 8px; }
.pbar { height: 8px; background: var(--card2); border-radius: 4px; overflow: hidden; border: 1px solid var(--border); }
.pfill { height: 100%; background: linear-gradient(90deg, #5a90d0, var(--accent)); border-radius: 4px; transition: width .35s ease; }
.pnext { color: var(--muted); font-size: .82rem; margin-top: 8px; }
.chead { margin-bottom: 8px; }
.chead label { font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; cursor: pointer; }
.chlist { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; margin-bottom: 8px; }
.chrow { display: flex; align-items: center; gap: 8px; margin: 0; padding: 7px 10px; border-radius: 9px; color: var(--text); font-weight: 500; font-size: .9rem; cursor: pointer; }
.chrow:hover { background: var(--card2); }
.chrow input { accent-color: var(--accent); width: 17px; height: 17px; }
.modes { display: flex; flex-wrap: wrap; gap: 8px; }
.modes .btn { margin-top: 0; }
.foot { margin-top: 20px; text-align: center; color: var(--muted); font-size: .9rem; }

/* question */
.qtop { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.qmeta { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.chip {
    background: var(--card2); border: 1.5px solid var(--border); border-radius: 999px;
    padding: 4px 12px; font-size: .76rem; font-weight: 700; color: var(--muted);
    white-space: nowrap;
}
.qcount { color: var(--muted); font-weight: 700; font-size: .9rem; white-space: nowrap; }
.prompt { font-size: 1.18rem; font-weight: 600; margin: 6px 0 18px; line-height: 1.45; }

/* QCM */
.qcm { display: flex; flex-direction: column; gap: 10px; }
.qcm-opt {
    display: flex; align-items: center; gap: 12px;
    width: 100%; padding: 14px 16px;
    font-size: 1rem; font-weight: 500; text-align: left;
    border: 1.5px solid var(--border); border-radius: 13px;
    background: var(--card2); color: var(--text);
    cursor: pointer; transition: all .15s; font-family: inherit;
}
.qcm-opt:hover { border-color: var(--accent); background: #fff; box-shadow: 0 4px 14px rgba(25,45,80,.12); }
.qcm-opt:active { transform: scale(.99); }
.opt-letter {
    flex: none; width: 30px; height: 30px; border-radius: 50%;
    border: 2px solid var(--border); background: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .85rem; color: var(--muted);
}
.qcm-opt:hover .opt-letter { border-color: var(--accent); color: var(--accent2); }
.opt-txt { flex: 1; line-height: 1.35; }

/* symboles APP-6 */
.symbox { display: flex; justify-content: center; margin: 8px 0 18px; }
.symbox svg { max-width: 100%; height: auto; }
.sym-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sym-opt { flex-direction: column; align-items: center; padding: 10px; }
.sym-opt svg { width: 100%; height: auto; }
.hint { color: var(--muted); font-size: .82rem; margin-top: 12px; font-style: italic; }

/* correction */
.fb-ok { border-left: 5px solid var(--ok); }
.fb-ko { border-left: 5px solid var(--ko); }
.verdict { font-size: 1.15rem; font-weight: 700; margin-bottom: 12px; }
.fb-ok .verdict { color: var(--ok); }
.fb-ko .verdict { color: var(--ko); }
.want { background: var(--card2); border: 1.5px dashed var(--border); border-radius: 10px; padding: 11px 14px; margin: 10px 0; }
.trline { display: flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 600; color: var(--accent2); margin: 10px 0; }
.trline img { width: 19px; height: 19px; }
.explain { background: var(--inset); color: #d9dcd2; border-radius: 12px; padding: 14px 16px; margin: 12px 0; font-size: .93rem; line-height: 1.55; }
.src { color: var(--muted); font-size: .78rem; margin-top: 8px; }
.repform { margin-top: 16px; display: flex; gap: 8px; }
.repform input { flex: 1; }

/* maitrise : icone + pastilles */
.wlvl { width: 21px; height: 21px; vertical-align: middle; }
.pips { color: var(--warn); letter-spacing: 2px; font-size: .75rem; }

/* resultats */
.bigscore { font-size: 2.6rem; font-weight: 800; text-align: center; color: var(--accent2); margin: 10px 0; }
.bigscore small { font-size: 1.1rem; color: var(--muted); font-weight: 600; }
.examnote { text-align: center; font-size: 1.2rem; margin-bottom: 6px; }
.streakline { text-align: center; color: var(--muted); font-size: .9rem; margin-bottom: 14px; }
.recap { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 8px; }
.recap h3 { margin: 0 0 8px; }
.rline { display: flex; align-items: baseline; gap: 8px; font-size: .88rem; margin: 4px 0; }
.rline img { width: 19px; height: 19px; flex: none; transform: translateY(4px); }
.rnames { color: var(--muted); font-size: .8rem; }
.det { margin-top: 14px; }
.det summary { cursor: pointer; font-weight: 700; color: var(--accent2); padding: 6px 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }

/* tables */
.twrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.res { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 0; }
.res th { text-align: left; color: var(--muted); font-weight: 700; font-size: .78rem; text-transform: uppercase; padding: 8px; border-bottom: 2px solid var(--border); white-space: nowrap; }
.res td { padding: 9px 8px; border-bottom: 1px solid var(--card2); vertical-align: middle; }
.res tr.rok td { background: #f0f7ee; }
.res tr.rko td { background: #fbf1ef; }
tr.me td { background: #e9f0fa; }
.pcell { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.pcell .pname { font-weight: 600; }
.pcell .rtitle { display: block; }

/* onglets */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 14px; }
.tab { padding: 7px 14px; border-radius: 999px; border: 1.5px solid var(--border); color: var(--muted); font-size: .84rem; font-weight: 600; text-decoration: none; }
.tab.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* signalements */
.rep { background: var(--card2); border: 1.5px solid var(--border); border-radius: 12px; padding: 13px 15px; margin-bottom: 10px; }
.repmsg { font-weight: 500; }
.reprep { background: #e9f0fb; border-left: 3px solid var(--accent); border-radius: 6px; padding: 8px 12px; margin-top: 8px; font-size: .9rem; }

/* profil */
.phead { display: flex; align-items: center; gap: 16px; margin: 8px 0 14px; }
.pname-lg { font-size: 1.3rem; font-weight: 700; }
.ranklist { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.rk { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; font-size: .87rem; border: 1.5px solid transparent; }
.rk.cur { background: #e9f0fa; border-color: var(--accent); }
.rkav { flex: none; }
.rkth { color: var(--muted); font-size: .8rem; width: 42px; flex: none; font-weight: 700; }
.rkt { flex: 1; }

/* admin */
.qadm { border-bottom: 1px solid var(--card2); padding: 10px 0; }
.qadm-p { font-weight: 600; font-size: .92rem; margin-bottom: 5px; }
.qc { display: inline-block; font-size: .8rem; color: var(--muted); background: var(--card2); border: 1px solid var(--border); border-radius: 8px; padding: 3px 9px; margin: 2px 3px 2px 0; }
.qc.ok { color: var(--ok); border-color: var(--ok); font-weight: 700; background: #eef7ef; }

/* avatar + cadre de rang + couronne */
.avf { position: relative; display: inline-block; line-height: 0; }
.av { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; display: block; }
.av-def { display: flex; align-items: center; justify-content: center; background: var(--accent); color: #fff; font-weight: 700; font-size: 1.05rem; }
.avf.sm .av { width: 28px; height: 28px; }
.avf.sm .av-def { font-size: .8rem; }
.avf.lg .av { width: 96px; height: 96px; }
.avf.lg .av-def { font-size: 2.4rem; }
.avf.f1 .av, .avf.f2 .av { box-shadow: 0 0 0 2px #a8763e; }
.avf.f3 .av { box-shadow: 0 0 0 3px #a8763e; }
.avf.f4 .av { box-shadow: 0 0 0 2px #b9b9c6; }
.avf.f5 .av { box-shadow: 0 0 0 3px #b9b9c6; }
.avf.f6 .av { box-shadow: 0 0 0 2px #d4af37; }
.avf.f7 .av { box-shadow: 0 0 0 3px #d4af37; }
.avf.f8 .av { box-shadow: 0 0 0 3px #d4af37, 0 0 8px rgba(212,175,55,.55); }
.avf.f9 .av { box-shadow: 0 0 0 3px #d4af37, 0 0 14px rgba(212,175,55,.8); }
.avf.f10 .av { box-shadow: 0 0 0 3px #d4af37, 0 0 18px rgba(212,175,55,.9); animation: crownPulse 1.6s infinite alternate; }
@keyframes crownPulse {
    from { box-shadow: 0 0 0 3px #d4af37, 0 0 10px rgba(212,175,55,.5); }
    to { box-shadow: 0 0 0 4px #ffd75e, 0 0 22px rgba(212,175,55,1); }
}
.avcrown { position: absolute; top: -11px; left: 50%; transform: translateX(-50%); width: 22px; height: 22px; }
.avf.sm .avcrown { width: 16px; height: 16px; top: -8px; }
.avf.lg .avcrown { width: 40px; height: 40px; top: -18px; }

/* succes */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; margin: 14px 0; }
.bdg { background: var(--card2); border: 1.5px solid var(--border); border-radius: 13px; padding: 12px 8px; text-align: center; opacity: .45; }
.bdg.on { opacity: 1; border-color: var(--accent); }
.bdg img { width: 48px; height: 48px; display: block; margin: 0 auto 6px; }
.bdg:not(.on) img { filter: grayscale(1); }
.bdg span { font-size: .78rem; font-weight: 700; display: block; }

/* tuto */
.tuto { line-height: 1.7; padding-left: 20px; }
.tuto li { margin-bottom: 6px; }

/* login */
.login { max-width: 420px; margin: 10vh auto 0; text-align: center; }
.login input { margin-top: 10px; }
.login .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.login details { margin-top: 14px; text-align: left; }
.login details summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.login details form { margin-top: 6px; }

/* mobile */
@media (max-width: 560px) {
    .wrap { padding: 14px 10px 50px; }
    .card { padding: 18px; }
    .chlist { grid-template-columns: 1fr; }
    .modes { display: grid; grid-template-columns: 1fr 1fr; }
    .modes .btn { width: 100%; }
    .prompt { font-size: 1.05rem; }
    .qcm-opt { padding: 12px 13px; font-size: .95rem; }
    .opt-letter { width: 26px; height: 26px; font-size: .78rem; }
    .wlvl { width: 18px; height: 18px; }
    .pips { font-size: .62rem; letter-spacing: 1px; }
    .trline img, .rline img { width: 17px; height: 17px; }
    .bigscore { font-size: 2rem; }
    .sym-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .res { font-size: .82rem; }
    .res th, .res td { padding: 7px 6px; }
    .pcell { gap: 6px; }
    .repform { flex-direction: column; }
    .phead { flex-direction: column; text-align: center; gap: 10px; }
    .rk { font-size: .8rem; gap: 7px; }
    .rkth { width: 34px; }
}
