/* Khar9ana CTF : tableau des défis, fenêtre de défi, classement, équipes, joueurs, règlement, administration.
   S'appuie sur les jetons de khar9ana.css (couleurs, espacements, polices). Aucune règle n'est appliquée hors
   des classes ctf-*. */

:root {
    --ctf-edge: rgba(254, 27, 27, .26);
    --ctf-edge-strong: rgba(254, 27, 27, .62);
    --ctf-glow: 0 0 0 1px rgba(254, 27, 27, .28), 0 10px 24px -16px rgba(254, 27, 27, .75);
    --ctf-solved: #2f6b52;
}

/* --- Bandeau d'état ------------------------------------------------------------------------------ */
.ctf-status { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); align-items: baseline; margin: calc(var(--s2) * -1) 0 var(--s5); color: var(--muted); font-size: .9rem; }
.ctf-status strong { color: var(--text); font: 600 1.15rem/1 var(--display); font-variant-numeric: tabular-nums; }
.ctf-status .state { font-size: .85rem; }
.ctf-toolbar { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; justify-content: space-between; margin-bottom: var(--s5); }
.ctf-search { position: relative; flex: 1 1 16rem; max-width: 26rem; }
.ctf-search input { width: 100%; min-height: 2.5rem; padding: .45rem .75rem; color: var(--text); background: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); }
.ctf-search input:focus-visible { border-color: var(--control); outline: 3px solid var(--focus); outline-offset: 2px; }
.ctf-jump { display: flex; flex-wrap: wrap; gap: var(--s2); margin: 0; padding: 0; list-style: none; }
.ctf-jump a { display: inline-flex; align-items: center; gap: .35rem; min-height: 2rem; padding: .2rem .65rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; font-size: .8rem; font-weight: 600; text-decoration: none; }
.ctf-jump a:hover { color: var(--text); border-color: var(--ctf-edge-strong); }
.ctf-jump small { color: var(--control); font-weight: 400; }

/* --- Catégories et cartes ------------------------------------------------------------------------- */
.ctf-category { margin-bottom: var(--s7); scroll-margin-top: var(--s5); }
.ctf-category-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s2) var(--s4); padding-bottom: var(--s3); margin-bottom: var(--s4); border-bottom: 1px solid var(--line); }
.ctf-category-head h2 { display: flex; align-items: center; gap: var(--s3); font-size: 1.35rem; letter-spacing: .01em; }
.ctf-category-head h2::before { content: ""; width: 4px; height: 1.1em; background: var(--brand); border-radius: 2px; }
.ctf-category-head p { color: var(--muted); font-size: .85rem; }
.ctf-progress { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ctf-progress b { color: var(--text); }

.ctf-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s3); margin: 0; padding: 0; list-style: none; }
@media (min-width: 420px) { .ctf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .ctf-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.ctf-card {
    position: relative; display: grid; grid-template-rows: 1fr auto; gap: var(--s2); width: 100%; height: 100%; min-height: 5.4rem;
    padding: .8rem .9rem .75rem; color: var(--text); background: var(--panel); border: 1px solid var(--ctf-edge); border-radius: var(--radius-zone);
    text-align: left; text-decoration: none; font: inherit; cursor: pointer;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease, background-color .18s ease;
}
.ctf-card:hover, .ctf-card:focus-visible { color: var(--text); background: #18202b; border-color: var(--ctf-edge-strong); box-shadow: var(--ctf-glow); transform: translateY(-1px); }
.ctf-card-name { display: -webkit-box; overflow: hidden; font: 600 1rem/1.25 var(--display); -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.ctf-card-meta { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); color: var(--muted); font-size: .78rem; }
.ctf-card-points { color: var(--text); font: 600 1.05rem/1 var(--display); font-variant-numeric: tabular-nums; }
.ctf-card-points small { margin-left: .15rem; color: var(--muted); font: 400 .72rem var(--display); }
.ctf-card-state { position: absolute; top: .55rem; right: .6rem; width: 1.15rem; height: 1.15rem; }
.ctf-card.is-solved { background: #122119; border-color: rgba(111, 211, 162, .38); }
.ctf-card.is-solved:hover, .ctf-card.is-solved:focus-visible { border-color: rgba(111, 211, 162, .7); box-shadow: 0 0 0 1px rgba(111, 211, 162, .25), 0 10px 24px -16px rgba(111, 211, 162, .6); }
.ctf-card.is-solved .ctf-card-state { color: var(--ok); }
.ctf-card.is-solved .ctf-card-name { padding-right: 1.4rem; }
.ctf-card.is-locked { color: var(--muted); background: var(--ink); border-style: dashed; border-color: var(--line); cursor: not-allowed; }
.ctf-card.is-locked:hover { transform: none; box-shadow: none; border-color: var(--control); background: var(--ink); }
.ctf-card.is-locked .ctf-card-state { color: var(--control); }
.ctf-card.is-locked .ctf-card-name { padding-right: 1.4rem; }
.ctf-card.is-filtered { display: none; }

.ctf-diff { display: inline-flex; align-items: center; gap: .3rem; font-size: .74rem; font-weight: 600; letter-spacing: .02em; }
.ctf-diff::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; }
.ctf-diff[data-level="Débutant"] { color: #7fd3a8; }
.ctf-diff[data-level="Facile"] { color: #8fc7ff; }
.ctf-diff[data-level="Moyen"] { color: #eab866; }
.ctf-diff[data-level="Difficile"] { color: #ff8a65; }
.ctf-diff[data-level="Insane"] { color: #ff5a6a; }

/* Afficher plus : les cartes au-delà de la huitième restent masquées tant que la catégorie est repliée. */
.ctf-category:not(.is-expanded) .ctf-extra { display: none; }
.ctf-category.is-expanded .ctf-extra { animation: ctf-reveal .26s ease both; }
.ctf-category.is-expanded .ctf-extra:nth-child(4n + 2) { animation-delay: .03s; }
.ctf-category.is-expanded .ctf-extra:nth-child(4n + 3) { animation-delay: .06s; }
.ctf-category.is-expanded .ctf-extra:nth-child(4n) { animation-delay: .09s; }
@keyframes ctf-reveal { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.ctf-more-wrap { display: flex; justify-content: center; margin-top: var(--s4); }
.ctf-more {
    display: inline-flex; align-items: center; gap: var(--s2); min-height: 2.4rem; padding: .35rem 1.1rem;
    color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 999px; font-size: .85rem; font-weight: 600;
    transition: color .18s ease, border-color .18s ease;
}
.ctf-more:hover { color: var(--text); border-color: var(--ctf-edge-strong); }
.ctf-more .ctf-arrow { transition: transform .2s ease; }
.ctf-category.is-expanded .ctf-more .ctf-arrow { transform: rotate(180deg); }
@media (scripting: none) { .ctf-category:not(.is-expanded) .ctf-extra { display: block; } .ctf-more-wrap { display: none; } }

/* --- Fenêtre modale d'un défi --------------------------------------------------------------------- */
.ctf-modal {
    width: min(48rem, calc(100vw - 1.5rem)); max-height: min(92vh, 60rem); padding: 0; color: var(--text); background: var(--canvas);
    border: 1px solid var(--ctf-edge-strong); border-radius: var(--radius-zone); box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .9), 0 0 0 1px rgba(254, 27, 27, .12);
    overflow: hidden;
}
.ctf-modal[open] { display: flex; flex-direction: column; animation: ctf-pop .2s ease both; }
.ctf-modal::backdrop { background: rgba(4, 6, 10, .72); backdrop-filter: blur(3px); }
@keyframes ctf-pop { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
.ctf-modal-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s2) var(--s3); padding: var(--s4) var(--s5) 0; }
.ctf-modal-head h2 { font-size: clamp(1.3rem, 3vw, 1.65rem); }
.ctf-modal-close { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: var(--radius); }
.ctf-modal-close:hover { color: var(--text); border-color: var(--control); }
.ctf-modal-meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: var(--s2) var(--s3); align-items: center; color: var(--muted); font-size: .82rem; }
.ctf-modal-meta .ctf-points { color: var(--text); font: 600 1.15rem/1 var(--display); }
.ctf-chip { display: inline-flex; align-items: center; min-height: 1.6rem; padding: .1rem .55rem; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; font-size: .75rem; font-weight: 600; }
.ctf-chip.is-red { color: #ffb3b3; border-color: var(--ctf-edge); background: rgba(254, 27, 27, .07); }
.ctf-tabs { display: flex; gap: var(--s1); padding: var(--s3) var(--s5) 0; border-bottom: 1px solid var(--line); }
.ctf-tab { min-height: 2.5rem; padding: 0 var(--s3); color: var(--muted); background: none; border: 0; border-bottom: 2px solid transparent; font-size: .9rem; font-weight: 600; }
.ctf-tab:hover { color: var(--text); }
.ctf-tab[aria-selected="true"] { color: var(--text); border-color: var(--brand); }
.ctf-tab small { margin-left: .25rem; color: var(--control); }
.ctf-modal-body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: var(--s5); }
.ctf-modal-body > * + * { margin-top: var(--s5); }
.ctf-section-title { margin-bottom: var(--s2); color: var(--muted); font: 600 .75rem/1.2 var(--display); letter-spacing: .08em; text-transform: uppercase; }
.ctf-files { display: flex; flex-wrap: wrap; gap: var(--s2); margin: 0; padding: 0; list-style: none; }
.ctf-file { display: inline-flex; align-items: center; gap: .45rem; min-height: 2.25rem; padding: .25rem .7rem; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); font-size: .82rem; font-weight: 600; text-decoration: none; }
.ctf-file:hover { color: var(--text); border-color: var(--ctf-edge-strong); }
.ctf-file small { color: var(--muted); font-weight: 400; }
.ctf-connection { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); padding: .55rem .75rem; background: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); font-family: var(--mono); font-size: .85rem; overflow-wrap: anywhere; }
.ctf-hints { display: grid; gap: var(--s2); }
.ctf-hint { padding: .6rem .8rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); font-size: .9rem; }
.ctf-hint-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2); color: var(--muted); font-size: .82rem; font-weight: 600; }
.ctf-hint .ctf-markdown { margin-top: var(--s2); }
.ctf-submit { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s2); }
.ctf-submit input { min-height: 2.9rem; padding: .55rem .8rem; color: var(--text); background: var(--ink); border: 1px solid var(--control); border-radius: var(--radius); font-family: var(--mono); }
.ctf-submit input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.ctf-submit input[aria-invalid="true"] { border-color: var(--bad); animation: ctf-shake .3s ease; }
@keyframes ctf-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.ctf-feedback { min-height: 1.5rem; margin-top: var(--s2); font-size: .9rem; font-weight: 600; }
.ctf-feedback[data-status="correct"], .ctf-feedback[data-status="already_solved"] { color: var(--ok); }
.ctf-feedback[data-status="incorrect"], .ctf-feedback[data-status="too_many_attempts"], .ctf-feedback[data-status="rate_limited"] { color: var(--bad); }
.ctf-feedback[data-status="unavailable"], .ctf-feedback[data-status="login_required"] { color: var(--warn); }
.ctf-solved-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2); padding: .7rem .9rem; color: var(--ok); background: #11251f; border: 1px solid rgba(111, 211, 162, .4); border-radius: var(--radius); font-weight: 600; }
.ctf-locked-box { padding: var(--s4); color: var(--muted); background: var(--ink); border: 1px dashed var(--control); border-radius: var(--radius); }
.ctf-solves-table { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
.ctf-solves-table :is(th, td) { padding: .55rem .5rem; border-bottom: 1px solid var(--line); text-align: left; }
.ctf-solves-table th { color: var(--muted); font-size: .75rem; font-weight: 600; }
.ctf-solves-table td:last-child, .ctf-solves-table th:last-child { text-align: right; white-space: nowrap; color: var(--muted); }
.ctf-loading { color: var(--muted); font-size: .9rem; }
.ctf-preview-banner { padding: .5rem .8rem; color: #1b1405; background: var(--warn); border-radius: var(--radius); font-size: .85rem; font-weight: 700; }
body.ctf-modal-open { overflow: hidden; }

/* --- Markdown rendu --------------------------------------------------------------------------------- */
.ctf-markdown { color: #dfe4eb; line-height: 1.7; overflow-wrap: anywhere; }
.ctf-markdown > * + * { margin-top: .8em; }
.ctf-markdown :is(h2, h3, h4, h5) { margin-top: 1.3em; color: var(--text); }
.ctf-markdown h2 { font-size: 1.35rem; }
.ctf-markdown h3 { font-size: 1.15rem; }
.ctf-markdown :is(h4, h5) { font-size: 1rem; }
.ctf-markdown :is(ul, ol) { padding-left: 1.35rem; }
.ctf-markdown li + li { margin-top: .25em; }
.ctf-markdown blockquote { margin: 0; padding: .2rem 0 .2rem var(--s4); color: var(--muted); border-left: 3px solid var(--ctf-edge-strong); }
.ctf-markdown hr { border: 0; border-top: 1px solid var(--line); }
.ctf-markdown img { display: block; max-width: 100%; max-height: 28rem; border: 1px solid var(--line); border-radius: var(--radius); }
.ctf-markdown :not(pre) > code { padding: .08rem .35rem; color: #ffd2d2; background: var(--ink); border: 1px solid var(--line); border-radius: 3px; font-size: .88em; }
.ctf-markdown pre { position: relative; margin: 0; padding: var(--s4); overflow-x: auto; color: #d7dde6; background: #07090e; border: 1px solid var(--line); border-radius: var(--radius); font-size: .85rem; line-height: 1.55; tab-size: 4; }
.ctf-markdown pre[data-lang]::after, .ctf-markdown pre code[data-lang]::before { content: none; }
.ctf-markdown pre .ctf-lang { position: absolute; top: .35rem; right: .55rem; color: var(--control); font: 600 .68rem var(--display); letter-spacing: .06em; text-transform: uppercase; }
.tok-k { color: #ff7b72; }
.tok-s { color: #a5d6ff; }
.tok-c { color: #7d8590; font-style: italic; }
.tok-n { color: #ffa657; }
.tok-f { color: #d2a8ff; }

/* --- Classement ---------------------------------------------------------------------------------------- */
.ctf-board-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); }
.ctf-chart { position: relative; padding: var(--s4); margin-bottom: var(--s6); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-zone); }
.ctf-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.ctf-chart .axis text { fill: var(--muted); font-size: 11px; font-family: var(--display); }
.ctf-chart .grid line { stroke: var(--line); stroke-dasharray: 2 4; }
.ctf-chart .series path { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ctf-chart .series.is-dim path { opacity: .18; }
.ctf-chart .series.is-focus path { stroke-width: 3; }
.ctf-chart-tip { position: absolute; z-index: 2; padding: .4rem .6rem; color: var(--text); background: #07090e; border: 1px solid var(--line); border-radius: var(--radius); font-size: .78rem; pointer-events: none; white-space: nowrap; }
.ctf-legend { display: flex; flex-wrap: wrap; gap: .35rem .9rem; margin: var(--s3) 0 0; padding: 0; list-style: none; font-size: .8rem; }
.ctf-legend button { display: inline-flex; align-items: center; gap: .4rem; padding: .1rem 0; color: var(--muted); background: none; border: 0; font-size: inherit; }
.ctf-legend button:hover, .ctf-legend button[aria-pressed="true"] { color: var(--text); }
.ctf-legend i { width: .8rem; height: .2rem; border-radius: 2px; background: currentColor; }
.ctf-rank { color: var(--muted); font: 600 1rem var(--display); font-variant-numeric: tabular-nums; }
.ranking-table tr.is-top .ctf-rank { color: var(--signal); }
.ranking-table tr.is-me { background: rgba(254, 27, 27, .06); }
.ctf-who { display: inline-flex; align-items: center; gap: .55rem; min-width: 0; color: var(--text); font-weight: 600; text-decoration: none; }
.ctf-who:hover { color: var(--signal); }
.ctf-flag { font-size: 1.05rem; line-height: 1; }
.ctf-kind { margin-left: .4rem; color: var(--control); font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.ctf-frozen { display: inline-flex; align-items: center; gap: .4rem; padding: .2rem .65rem; color: #8fc7ff; border: 1px solid rgba(127, 179, 255, .4); border-radius: 999px; font-size: .8rem; font-weight: 600; }
@media (max-width: 640px) { .ctf-hide-sm { display: none; } }

/* --- Équipes, joueurs, profils ---------------------------------------------------------------------- */
.ctf-logo { display: grid; place-items: center; flex: none; width: 2.2rem; height: 2.2rem; overflow: hidden; color: #fff; background: linear-gradient(135deg, #3a1015, #1a1f2a); border: 1px solid var(--ctf-edge); border-radius: var(--radius); font: 600 .85rem var(--display); }
.ctf-logo img { width: 100%; height: 100%; object-fit: cover; }
.ctf-logo.is-large { width: 5rem; height: 5rem; font-size: 1.6rem; border-radius: var(--radius-zone); }
.ctf-profile-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s4); margin-bottom: var(--s6); }
.ctf-profile-head h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); }
.ctf-profile-head p { color: var(--muted); }
.ctf-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: var(--s3); margin-bottom: var(--s6); }
.ctf-kpi { padding: var(--s3) var(--s4); background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: var(--radius); }
.ctf-kpi strong { display: block; font: 600 1.6rem/1.1 var(--display); font-variant-numeric: tabular-nums; }
.ctf-kpi span { color: var(--muted); font-size: .8rem; }
.ctf-two { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s6); }
@media (min-width: 960px) { .ctf-two { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }
.ctf-panel { padding: var(--s4) var(--s5); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-zone); }
.ctf-panel > h2 { margin-bottom: var(--s3); font-size: 1.15rem; }
.ctf-panel + .ctf-panel { margin-top: var(--s4); }
.ctf-list { margin: 0; padding: 0; list-style: none; }
.ctf-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2); padding: .55rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.ctf-list li:last-child { border-bottom: 0; }
.ctf-list small { color: var(--muted); }
.ctf-code { padding: .35rem .6rem; color: #ffd2d2; background: var(--ink); border: 1px dashed var(--ctf-edge-strong); border-radius: var(--radius); font: 600 1rem var(--mono); letter-spacing: .08em; }
.ctf-bars { display: grid; gap: .45rem; }
.ctf-bar { display: grid; grid-template-columns: minmax(6rem, 10rem) minmax(0, 1fr) 2.5rem; align-items: center; gap: var(--s2); font-size: .82rem; }
.ctf-bar meter { width: 100%; height: .5rem; }
.ctf-bar span:last-child { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.ctf-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s3); margin-bottom: var(--s5); }
.ctf-filters .field { flex: 1 1 12rem; }
.ctf-filters .field-select { flex: 0 1 13rem; }

/* --- Règlement ------------------------------------------------------------------------------------------ */
.ctf-rules { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); gap: var(--s4); margin: 0; padding: 0; list-style: none; counter-reset: rule; }
.ctf-rule { position: relative; padding: var(--s5) var(--s5) var(--s4); background: var(--panel); border: 1px solid var(--line); border-top: 2px solid var(--brand); border-radius: var(--radius-zone); counter-increment: rule; }
.ctf-rule::before { content: counter(rule, decimal-leading-zero); position: absolute; top: var(--s4); right: var(--s4); color: rgba(254, 27, 27, .45); font: 600 1.6rem/1 var(--display); }
.ctf-rule h2 { padding-right: 2.5rem; margin-bottom: var(--s2); font-size: 1.1rem; }
.ctf-rule .ctf-markdown { color: var(--muted); font-size: .92rem; }

/* --- Administration ---------------------------------------------------------------------------------------- */
.ctf-admin-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); }
.ctf-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-zone); }
.ctf-table { width: 100%; min-width: 52rem; border-collapse: collapse; font-size: .88rem; font-variant-numeric: tabular-nums; }
.ctf-table :is(th, td) { padding: .6rem .7rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.ctf-table thead th { position: sticky; top: 0; color: var(--muted); background: var(--ink); font-size: .74rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.ctf-table tbody tr:hover { background: rgba(255, 255, 255, .02); }
.ctf-table .num { text-align: right; }
.ctf-table a { font-weight: 600; }
.ctf-row-actions { display: flex; flex-wrap: wrap; gap: .3rem; }
.ctf-row-actions form { display: contents; }
.ctf-row-actions .button.small { min-height: 1.9rem; padding: .15rem .5rem; font-size: .76rem; }
.ctf-badge { display: inline-flex; align-items: center; gap: .35rem; padding: .1rem .5rem; border: 1px solid currentColor; border-radius: 999px; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.ctf-badge[data-status="visible"] { color: var(--ok); }
.ctf-badge[data-status="hidden"] { color: var(--warn); }
.ctf-badge[data-status="draft"] { color: var(--muted); }
.ctf-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); padding: .5rem .75rem; margin-bottom: var(--s3); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); font-size: .85rem; }
.ctf-bulk select { min-height: 2.1rem; padding: .2rem .5rem; color: var(--text); background: var(--ink); border: 1px solid var(--control); border-radius: var(--radius); }
.ctf-steps { display: flex; flex-wrap: wrap; gap: var(--s2); margin: 0 0 var(--s5); padding: 0; list-style: none; counter-reset: step; }
.ctf-steps li { display: inline-flex; align-items: center; gap: .5rem; padding: .35rem .8rem .35rem .4rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; font-size: .82rem; font-weight: 600; counter-increment: step; }
.ctf-steps li::before { content: counter(step); display: grid; place-items: center; width: 1.4rem; height: 1.4rem; color: var(--muted); background: var(--raised); border-radius: 50%; font-size: .75rem; }
.ctf-steps li[aria-current="step"] { color: var(--text); border-color: var(--ctf-edge-strong); }
.ctf-steps li[aria-current="step"]::before { color: #fff; background: var(--action); }
.ctf-steps li.is-done::before { content: "✓"; color: #0d1a14; background: var(--ok); }
.ctf-edit-tabs { display: flex; flex-wrap: wrap; gap: 0 var(--s1); margin-bottom: var(--s5); border-bottom: 1px solid var(--line); }
.ctf-edit-tabs a { display: flex; align-items: center; gap: .35rem; min-height: 2.6rem; padding-inline: var(--s3); color: var(--muted); border-bottom: 3px solid transparent; font-size: .9rem; font-weight: 600; text-decoration: none; }
.ctf-edit-tabs a:hover { color: var(--text); }
.ctf-edit-tabs a[aria-current="page"] { color: var(--text); border-color: var(--brand); }
.ctf-edit-tabs small { padding: 0 .35rem; color: var(--muted); background: var(--raised); border-radius: 999px; font-size: .7rem; }
.ctf-edit-head {
    display: grid; justify-items: center; margin: 0 0 var(--s2); padding: 0;
    text-align: center; background: transparent; border: 0; border-radius: 0; box-shadow: none;
    -webkit-backdrop-filter: none; backdrop-filter: none;
}
.ctf-edit-head h1 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
.main:has(.ctf-edit-head) { padding-top: 0; }
.admin-layout:has(.ctf-edit-head) { margin-top: 0; }
.admin-content:has(.ctf-edit-head) { padding-top: 0; }
.admin-content:has(.ctf-edit-head) .page-header-actions { margin: 0 0 var(--s3); }
.ctf-md-editor { display: grid; gap: var(--s2); }
.ctf-md-editor textarea { min-height: 14rem; font-family: var(--mono); font-size: .88rem; }
.ctf-md-toolbar { display: flex; flex-wrap: wrap; gap: .3rem; }
.ctf-md-toolbar button { min-height: 2rem; padding: 0 .6rem; color: var(--muted); background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius); font-size: .78rem; font-weight: 700; }
.ctf-md-toolbar button:hover, .ctf-md-toolbar button[aria-pressed="true"] { color: var(--text); border-color: var(--control); }
.ctf-md-preview { min-height: 14rem; padding: var(--s4); background: var(--ink); border: 1px solid var(--control); border-radius: var(--radius); }
.ctf-dynamic-fields { padding: var(--s4); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.ctf-inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s3); }
.ctf-inline-form .field { flex: 1 1 12rem; }
.ctf-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: var(--s3); margin-bottom: var(--s5); }
.ctf-stat { padding: var(--s3) var(--s4); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.ctf-stat strong { display: block; font: 600 1.7rem/1.1 var(--display); font-variant-numeric: tabular-nums; }
.ctf-stat span { color: var(--muted); font-size: .8rem; }
.ctf-stat.is-ok strong { color: var(--ok); }
.ctf-stat.is-bad strong { color: var(--bad); }
.ctf-activity svg { display: block; width: 100%; height: auto; }
.ctf-activity .ok { fill: var(--ok); }
.ctf-activity .bad { fill: #b3434b; }
.ctf-activity text { fill: var(--muted); font-size: 10px; font-family: var(--display); }
.ctf-dash { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); }
@media (min-width: 1024px) { .ctf-dash { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ctf-refresh { color: var(--muted); font-size: .78rem; }
.ctf-flag-value { font-family: var(--mono); color: var(--muted); }
.ctf-check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); gap: .25rem var(--s4); max-height: 22rem; padding: var(--s3); overflow-y: auto; background: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); }

/* --- Write-ups (communauté) ---------------------------------------------------------------------------- */
.ctf-writeups { display: grid; gap: var(--s3); margin: 0; padding: 0; list-style: none; }
.ctf-writeup { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s2) var(--s4); padding: var(--s4); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-zone); transition: border-color .18s ease; }
.ctf-writeup:hover { border-color: var(--ctf-edge-strong); }
.ctf-writeup h2 { font-size: 1.15rem; }
.ctf-writeup h2 a { color: var(--text); }
.ctf-writeup h2 a:hover { color: var(--signal); }
.ctf-writeup-meta { display: flex; flex-wrap: wrap; gap: .35rem .6rem; align-items: center; color: var(--muted); font-size: .8rem; }
.ctf-writeup-side { display: grid; justify-items: end; align-content: start; gap: .3rem; color: var(--muted); font-size: .8rem; white-space: nowrap; }
.ctf-like { display: inline-flex; align-items: center; gap: .4rem; min-height: 2.2rem; padding: .2rem .75rem; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 999px; font-size: .85rem; font-weight: 600; }
.ctf-like:hover { color: var(--text); border-color: var(--ctf-edge-strong); }
.ctf-like[aria-pressed="true"] { color: #ffb3b3; border-color: var(--ctf-edge-strong); background: rgba(254, 27, 27, .08); }
.ctf-comments { display: grid; gap: var(--s3); margin: 0 0 var(--s4); padding: 0; list-style: none; }
.ctf-comment { padding: var(--s3) var(--s4); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.ctf-comment header { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s2); margin-bottom: var(--s2); color: var(--muted); font-size: .8rem; }
.ctf-comment header strong { color: var(--text); }
.ctf-inline { display: inline; }
.ctf-resources { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); gap: var(--s3); margin: 0; padding: 0; list-style: none; }
.ctf-resources a { display: grid; gap: .25rem; height: 100%; padding: var(--s4); color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-zone); text-decoration: none; transition: border-color .18s ease; }
.ctf-resources a:hover { border-color: var(--ctf-edge-strong); }
.ctf-resources small { color: var(--muted); font-weight: 400; }

@media (prefers-reduced-motion: reduce) {
    .ctf-card, .ctf-card:hover { transition: none; transform: none; }
    .ctf-category.is-expanded .ctf-extra, .ctf-modal[open], .ctf-submit input[aria-invalid="true"] { animation: none; }
}

/* --- Tableau des défis façon CTFd, dans le thème Khar9ana ------------------------------------------- */
.space-ctf .scene3d { filter: blur(7px) saturate(.8); opacity: .55; }
.ctf-hero { display: grid; justify-items: center; gap: var(--s3); padding: var(--s6) 0 var(--s7); text-align: center; }
.ctf-hero h1 {
    font-size: clamp(2.4rem, 6vw, 3.6rem); font-weight: 500; letter-spacing: .04em; color: #fff;
    text-shadow: 0 0 6px rgba(254, 27, 27, .85), 0 0 18px rgba(254, 27, 27, .45);
}
[data-ctf-board] .ctf-status { justify-content: center; }
[data-ctf-board] .ctf-toolbar { justify-content: center; }
[data-ctf-board] .ctf-category-head { border-bottom: 0; margin-bottom: var(--s3); }
[data-ctf-board] .ctf-category-head h2 {
    font-size: clamp(1.5rem, 3vw, 1.9rem); font-weight: 500; text-transform: uppercase; letter-spacing: .03em; color: #fff;
    text-shadow: 0 0 5px rgba(254, 27, 27, .8), 0 0 14px rgba(254, 27, 27, .35);
}
[data-ctf-board] .ctf-category-head h2::before { content: none; }
[data-ctf-board] .ctf-grid { gap: var(--s3) var(--s5); max-width: 68rem; margin-inline: auto; }
[data-ctf-board] .ctf-card {
    grid-template-rows: auto auto; align-content: center; justify-items: center; gap: var(--s3); min-height: 5.6rem;
    padding: var(--s4) var(--s3); text-align: center; background: rgba(15, 19, 27, .82);
    border: 1px solid rgba(254, 27, 27, .75); border-radius: 8px;
    box-shadow: 0 0 6px rgba(254, 27, 27, .45), inset 0 0 0 1px rgba(254, 27, 27, .08);
}
[data-ctf-board] .ctf-card:hover, [data-ctf-board] .ctf-card:focus-visible {
    background: rgba(24, 18, 22, .9); border-color: #ff3b3b; transform: translateY(-2px);
    box-shadow: 0 0 10px rgba(254, 27, 27, .75), 0 0 22px rgba(254, 27, 27, .3);
}
[data-ctf-board] .ctf-card-name { font: 700 .98rem/1.3 "Segoe UI", system-ui, sans-serif; letter-spacing: .01em; }
[data-ctf-board] .ctf-card-meta { flex-direction: column; justify-content: center; gap: .35rem; }
[data-ctf-board] .ctf-card-points { order: -1; font: 700 1rem/1 "Segoe UI", system-ui, sans-serif; }
[data-ctf-board] .ctf-card-points small { display: none; }
[data-ctf-board] .ctf-diff { font-size: .7rem; opacity: .85; }
[data-ctf-board] .ctf-card.is-solved { background: rgba(14, 33, 25, .85); border-color: rgba(111, 211, 162, .8); box-shadow: 0 0 8px rgba(111, 211, 162, .45); }
[data-ctf-board] .ctf-card.is-locked { border-style: dashed; border-color: var(--control); box-shadow: none; opacity: .7; }
[data-ctf-board] .ctf-card.is-solved .ctf-card-name, [data-ctf-board] .ctf-card.is-locked .ctf-card-name { padding-inline: 1.4rem; }

/* Recherche centrée, puis catégories en onglets discrets. */
[data-ctf-board] .ctf-toolbar { display: flex; justify-content: center; margin-bottom: var(--s4); }
[data-ctf-board] .ctf-search { flex: 0 1 30rem; max-width: 30rem; }
[data-ctf-board] .ctf-search input { min-height: 2.6rem; padding-inline: 1rem; text-align: center; background: rgba(9, 12, 18, .75); border-color: rgba(254, 27, 27, .35); border-radius: 999px; }
[data-ctf-board] .ctf-search input:focus { border-color: rgba(254, 27, 27, .8); box-shadow: 0 0 10px rgba(254, 27, 27, .3); outline: none; }
[data-ctf-board] .ctf-jump { display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem var(--s4); margin: 0 auto var(--s7); padding-bottom: var(--s3); border-bottom: 1px solid var(--line); max-width: 68rem; }
[data-ctf-board] .ctf-jump a { min-height: 2.2rem; padding: .2rem .15rem; color: var(--muted); border: 0; border-bottom: 2px solid transparent; border-radius: 0; font-size: .85rem; letter-spacing: .02em; text-transform: uppercase; }
[data-ctf-board] .ctf-jump a:hover { color: #fff; border-color: var(--brand); text-shadow: 0 0 8px rgba(254, 27, 27, .6); }
[data-ctf-board] .ctf-jump small { margin-left: .35rem; color: var(--control); font-size: .72rem; }
[data-ctf-board] .ctf-status { margin-bottom: var(--s5); }
[data-ctf-board] .ctf-category-head { justify-content: space-between; max-width: 68rem; margin-inline: auto; }

/* --- Fenêtre de défi façon CTFd ---------------------------------------------------------------------- */
.ctf-modal { width: min(40rem, calc(100vw - 1.5rem)); background: #11151d; border-color: rgba(254, 27, 27, .5); }
.ctf-modal-top { display: flex; align-items: flex-end; gap: var(--s3); padding: var(--s4) var(--s4) 0 var(--s5); }
.ctf-modal-top .ctf-tabs { flex: 1; gap: 0; padding: 0; border-bottom: 1px solid rgba(254, 27, 27, .7); }
.ctf-modal-top .ctf-tab { min-height: 2.6rem; padding: 0 var(--s4); margin-bottom: -1px; color: #d7dde6; border: 1px solid transparent; border-radius: 6px 6px 0 0; font-weight: 500; }
.ctf-modal-top .ctf-tab[aria-selected="true"] { color: #fff; background: #11151d; border-color: rgba(254, 27, 27, .7); border-bottom-color: #11151d; }
.ctf-modal-top .ctf-tab:hover { color: #fff; }
.ctf-modal-close { align-self: flex-start; width: 2.2rem; height: 2.2rem; color: var(--brand); border: 0; }
.ctf-modal-close:hover { color: #ff6b6b; background: rgba(254, 27, 27, .08); }
.ctf-modal-head { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: var(--s2); padding: var(--s3) 0 var(--s5); text-align: center; }
.ctf-modal-head h2 { font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 500; letter-spacing: .04em; color: #fff;
    text-shadow: 0 0 6px rgba(254, 27, 27, .85), 0 0 16px rgba(254, 27, 27, .4); }
.ctf-modal-points { color: #fff; font: 500 1.9rem/1 var(--display); font-variant-numeric: tabular-nums; }
.ctf-modal-head .ctf-modal-meta { justify-content: center; gap: .4rem .6rem; }
.ctf-badge-diff { padding: .1rem .5rem; color: #0b0e14; background: #8fc7ff; border-radius: 4px; font-size: .72rem; font-weight: 700; }
.ctf-badge-diff[data-level="Débutant"] { background: #7fd3a8; }
.ctf-badge-diff[data-level="Moyen"] { background: #eab866; }
.ctf-badge-diff[data-level="Difficile"] { background: #ff8a65; }
.ctf-badge-diff[data-level="Insane"] { color: #fff; background: #d33b4a; }
.ctf-modal-content > * + * { margin-top: var(--s5); }
.ctf-modal .ctf-file, .ctf-sheet .ctf-file { min-height: 2.75rem; padding: .5rem 1.1rem; gap: .55rem; background: #263042; border: 1px solid rgba(254, 27, 27, .35); }
.ctf-modal .ctf-file:hover, .ctf-sheet .ctf-file:hover { background: #2f3a50; border-color: rgba(254, 27, 27, .8); }
.ctf-modal .ctf-submit, .ctf-sheet .ctf-submit { gap: var(--s4); }
.ctf-modal .ctf-submit input, .ctf-sheet .ctf-submit input { min-height: 3.1rem; padding-inline: 1rem; background: transparent; border: 1px solid #d7dde6; border-radius: 8px; font-family: inherit; font-size: 1rem; }
.ctf-modal .ctf-submit input:disabled, .ctf-sheet .ctf-submit input:disabled { opacity: .5; }
.ctf-modal .ctf-submit .button, .ctf-sheet .ctf-submit .button { min-height: 3.1rem; padding-inline: 1.4rem; color: #fff; background: transparent; border: 1px solid #d7dde6; border-radius: 4px; }
.ctf-modal .ctf-submit .button:hover, .ctf-sheet .ctf-submit .button:hover { border-color: var(--brand); box-shadow: 0 0 10px rgba(254, 27, 27, .4); }

/* Titres de page CTF : texte centré lumineux, sans encadré. */
.ctf-hero { padding: var(--s5) 0 var(--s6); }
.ctf-hero h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); }
.space-ctf .page-header { display: grid; justify-items: center; min-height: 9rem; gap: 0; padding: clamp(1.5rem, 4vw, 3rem); margin-bottom: var(--s5); text-align: center; background: rgba(12, 16, 24, .55); border: 1px solid var(--glass-line); border-radius: var(--radius-card); box-shadow: none; }
.space-ctf .page-header .kicker, .space-ctf .page-header > div > p:not(.kicker) { display: none; }
.space-ctf .page-header h1 { font-weight: 500; letter-spacing: .04em; color: #fff; text-shadow: 0 0 6px rgba(254, 27, 27, .85), 0 0 18px rgba(254, 27, 27, .45); }
[data-ctf-board] ~ *, .space-ctf .ctf-board-head { justify-content: center; }

/* Titres sans lueur. */
.ctf-hero h1, .space-ctf .page-header h1, [data-ctf-board] .ctf-category-head h2, .ctf-modal-head h2 { text-shadow: none; }

/* Page complète d'un défi : une colonne centrée et lisible. */
.ctf-sheet { width: min(100%, 46rem); margin: 0 auto var(--s7); }
.ctf-sheet-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2); margin-bottom: var(--s3); }
.ctf-sheet-top .back-link { margin: 0; }
.ctf-sheet .ctf-modal-head { padding-top: var(--s4); }
.ctf-sheet .ctf-modal-head h1 { font-size: clamp(1.8rem, 4.5vw, 2.6rem); font-weight: 500; letter-spacing: .03em; color: #fff; }
.ctf-sheet-body { display: grid; gap: var(--s5); padding: var(--s5) var(--s5) var(--s6); background: rgba(17, 21, 29, .88);
    border: 1px solid rgba(254, 27, 27, .45); border-radius: var(--radius-zone); }
.ctf-sheet-body .ctf-markdown { font-size: 1.05rem; }
.ctf-sheet-body .ctf-list li { padding-block: .45rem; }
@media (max-width: 560px) { .ctf-sheet-body { padding: var(--s4); } .ctf-sheet .ctf-submit { grid-template-columns: 1fr; } }

/* Filtre de catégorie actif ; « Afficher plus » discret. */
[data-ctf-board] .ctf-jump a[aria-current="true"] { color: #fff; border-color: var(--brand); }
[data-ctf-board] .ctf-more-wrap { margin-top: var(--s3); }
[data-ctf-board] .ctf-more { min-height: 1.7rem; padding: .1rem .7rem; gap: .3rem; font-size: .72rem; font-weight: 600; color: var(--muted); border-color: var(--line); }
[data-ctf-board] .ctf-more:hover { color: #fff; border-color: rgba(254, 27, 27, .6); }

/* Cartes en verre : le fond animé reste visible, flouté, derrière chaque carte. */
.space-ctf .scene3d { filter: blur(2px) saturate(.92); opacity: .9; }
[data-ctf-board] .ctf-card {
    background: rgba(15, 19, 27, .38);
    -webkit-backdrop-filter: blur(10px) saturate(1.1);
    backdrop-filter: blur(10px) saturate(1.1);
}
[data-ctf-board] .ctf-card:hover, [data-ctf-board] .ctf-card:focus-visible { background: rgba(30, 18, 22, .5); }
[data-ctf-board] .ctf-card.is-solved { background: rgba(14, 33, 25, .45); }

/* « Afficher plus » encore plus discret. */
[data-ctf-board] .ctf-more-wrap { margin-top: var(--s2); }
[data-ctf-board] .ctf-more { min-height: 1.45rem; padding: 0 .6rem; gap: .25rem; font-size: .66rem; font-weight: 600; letter-spacing: .02em; background: transparent; border: 1px solid rgba(255, 255, 255, .08); }

/* Cartes foncées et opaques (sans transparence). */
[data-ctf-board] .ctf-card { background: #0d1118; -webkit-backdrop-filter: none; backdrop-filter: none; }
[data-ctf-board] .ctf-card:hover, [data-ctf-board] .ctf-card:focus-visible { background: #141a24; }
[data-ctf-board] .ctf-card.is-solved { background: #0f1d17; }
[data-ctf-board] .ctf-card.is-locked { background: #0b0e14; }

/* --- Administration : tableaux, menus d'actions, catégories, membres, activité ---------------------------- */
.ctf-admin-table { min-width: 46rem; }
.ctf-admin-table td { white-space: nowrap; }
.ctf-admin-table tbody tr { transition: background-color .15s ease; }
.ctf-admin-table tbody tr:hover { background: rgba(255, 255, 255, .025); }
.ctf-admin-table .ctf-row-actions { flex-wrap: nowrap; align-items: center; justify-content: flex-end; }
.ctf-admin-table .ctf-chip { font-size: .72rem; }

.ctf-menu { position: relative; }
.ctf-menu > summary { list-style: none; min-width: 2.1rem; font-size: 1.05rem; line-height: 1; }
.ctf-menu > summary::-webkit-details-marker { display: none; }
.ctf-menu[open] > summary { color: var(--text); background: var(--raised); }
.ctf-menu-list {
    position: absolute; top: calc(100% + .35rem); right: 0; z-index: 20; display: grid; min-width: 11rem; padding: .35rem;
    background: #10141c; border: 1px solid rgba(255, 255, 255, .12); border-radius: 10px; box-shadow: 0 18px 40px rgba(0, 0, 0, .5);
}
.ctf-menu-list form { display: block; }
.ctf-menu-list a, .ctf-menu-list button {
    display: block; width: 100%; padding: .5rem .7rem; color: var(--text); background: none; border: 0; border-radius: 6px;
    font: inherit; font-size: .85rem; font-weight: 500; text-align: left; text-decoration: none; white-space: nowrap;
}
.ctf-menu-list a:hover, .ctf-menu-list button:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.ctf-menu-list .is-danger { color: var(--bad); }
.ctf-menu-list .is-danger:hover { color: #fff; background: #5a1d22; }
.ctf-table-wrap:has(.ctf-menu[open]) { overflow: visible; }

/* Catégories : une ligne par catégorie (ordre, nom, description, publiés, actions). */
.cat-list { display: grid; gap: .5rem; }
.cat-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .5rem; padding: .55rem .6rem; background: rgba(255, 255, 255, .02); border: 1px solid var(--line); border-radius: 10px; }
.cat-form, .cat-head { display: grid; grid-template-columns: 4.5rem minmax(9rem, 1fr) minmax(10rem, 2fr) 4.5rem auto; align-items: center; gap: .5rem; }
.cat-head { grid-column: 1 / -1; padding: 0 .6rem; background: none; border: 0; color: var(--muted); font-size: .72rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.cat-head > span:last-child { display: none; }
.cat-form input { min-width: 0; min-height: 2.35rem; padding: .35rem .6rem; color: var(--text); background: var(--ink); border: 1px solid var(--line); border-radius: 6px; font-size: .9rem; }
.cat-form input:focus-visible { border-color: var(--control); outline: 2px solid var(--focus); outline-offset: 1px; }
.cat-order { text-align: center; }
.cat-count { color: var(--muted); font-size: .85rem; text-align: center; font-variant-numeric: tabular-nums; }
.cat-count b { color: var(--text); }
.cat-delete { gap: .45rem; min-width: 15rem; padding: .7rem; }
.cat-delete label { color: var(--muted); font-size: .8rem; }
.cat-delete select { min-height: 2.2rem; padding: .25rem .5rem; color: var(--text); background: var(--ink); border: 1px solid var(--control); border-radius: 6px; }
@media (max-width: 760px) {
    .cat-head { display: none; }
    .cat-form { grid-template-columns: 4rem minmax(0, 1fr); }
    .cat-form input[name="description"] { grid-column: 1 / -1; }
}

/* Membres. */
.member-search { align-items: flex-end; }
.member-search .note { align-self: center; margin-left: auto; }
.member-cell { display: flex; align-items: center; gap: .65rem; min-width: 14rem; }
.member-cell .avatar { flex: none; width: 34px; height: 34px; font-size: .85rem; }
.member-cell > span { display: grid; min-width: 0; }
.member-cell a { color: var(--text); font-weight: 600; text-decoration: none; }
.member-cell a:hover { color: var(--signal); }
.member-cell small { color: var(--muted); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; }
.member-table td:first-child { white-space: normal; }
.member-date { color: var(--muted); font-size: .82rem; }
.member-table tr.is-suspended .member-cell { opacity: .6; }
.role-pill { display: inline-flex; padding: .1rem .55rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; font-size: .72rem; font-weight: 700; }
.role-pill.is-admin { color: #c5b6ff; border-color: rgba(197, 182, 255, .45); background: rgba(197, 182, 255, .08); }

/* Activité des 14 derniers jours. */
.activity-chart { position: relative; margin-top: var(--s3); }
.ctf-activity .grid line { stroke: rgba(255, 255, 255, .06); stroke-dasharray: 3 5; }
.ctf-activity .grid .base { stroke: rgba(255, 255, 255, .16); stroke-dasharray: none; }
.ctf-activity .axis { fill: var(--control); font-size: 9px; }
.ctf-activity .hit { fill: transparent; }
.ctf-activity g:hover .hit { fill: rgba(255, 255, 255, .03); }
.activity-empty { position: absolute; inset: 0 0 1.5rem; display: grid; place-items: center; margin: 0; color: var(--muted); font-size: .9rem; }
.activity-legend { display: flex; gap: var(--s4); margin: var(--s2) 0 0; padding: 0; list-style: none; color: var(--muted); font-size: .8rem; }
.activity-legend li { display: inline-flex; align-items: center; gap: .4rem; }
.activity-legend i { width: .7rem; height: .7rem; border-radius: 3px; }
.activity-legend .ok { background: var(--ok); }
.activity-legend .bad { background: #b3434b; }

/* Tableau des défis compact : tient dans la zone d'administration. */
.ctf-admin-table { min-width: 40rem; font-size: .86rem; }
.ctf-admin-table :is(th, td) { padding: .55rem .5rem; }
.ctf-admin-table td:nth-child(3) { min-width: 0; }
.ctf-admin-table td.ch-name { white-space: normal; min-width: 11rem; }
.ch-name small { display: block; color: var(--control); font-size: .7rem; font-variant-numeric: tabular-nums; }
.ch-sub { color: var(--muted); font-size: .78rem; }
.ch-filters { display: grid; grid-template-columns: minmax(10rem, 2fr) repeat(3, minmax(7.5rem, 1fr)) auto; align-items: end; }
.ch-filters .field, .ch-filters .field-select { flex: none; }
@media (max-width: 900px) { .ch-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ch-filters .field:first-child { grid-column: 1 / -1; } }

.ctf-dash { align-items: stretch; }
.ctf-dash .ctf-panel + .ctf-panel { margin-top: 0; }
.cat-form, .cat-head { grid-template-columns: 4rem minmax(12rem, 1.2fr) minmax(10rem, 2fr) 4rem auto; }
.member-search { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: end; }
.member-search .note { margin: 0 0 .7rem; white-space: nowrap; }
.member-table td:last-child { width: 1%; text-align: right; }

/* Tableau de bord : chiffres de tout le site. */
.site-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); gap: var(--s4); }
.site-card { display: grid; align-content: start; gap: var(--s3); margin: 0; }
.ctf-dash .ctf-panel + .ctf-panel, .site-grid .ctf-panel + .ctf-panel { margin-top: 0; }
.site-card h3 { display: flex; align-items: center; gap: .55rem; font-size: 1.05rem; }
.site-card h3 .icon { color: var(--signal); }
.site-card dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin: 0; }
.site-card dl > div { padding: .55rem .7rem; background: rgba(255, 255, 255, .025); border: 1px solid var(--line); border-radius: 8px; }
.site-card dt { color: var(--muted); font-size: .74rem; }
.site-card dd { margin: .1rem 0 0; font: 600 1.25rem/1.2 var(--display); font-variant-numeric: tabular-nums; }
.site-link { justify-self: start; color: var(--signal); font-size: .85rem; font-weight: 700; text-decoration: none; }
.site-link:hover { color: #ff9696; }
@media (min-width: 900px) { .site-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
