/* javasg — une seule feuille de style, jetons en tête. Le campus surcharge --brand (static/campus/<slug>/theme.css). */
:root {
  --brand: #004d7b;
  --brand-strong: #00395c;
  --brand-soft: #e6f0f7;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --text: #17212b;
  --muted: #5b6b7b;
  --line: #d9e0e8;
  --ok: #1a7f4b;
  --ok-soft: #e3f4ea;
  --warn: #9a6700;
  --warn-soft: #fff4d6;
  --bad: #b3261e;
  --bad-soft: #fde8e6;
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1720; --surface: #17212d; --text: #e8eef4; --muted: #9db0c2; --line: #2a3848;
    --brand-soft: #17324a; --ok-soft: #12301f; --warn-soft: #3a2f10; --bad-soft: #3d1b19;
    --ok: #4cc38a; --warn: #f0b429; --bad: #ff8a80;
  }
  .brand img { background: #fff; border-radius: 6px; }
}
* { box-sizing: border-box; }
html { font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--brand); }
@media (prefers-color-scheme: dark) { a { color: #7fc1ee; } }
code, pre, textarea.code { font-family: var(--mono); }
code { background: var(--brand-soft); padding: .1em .35em; border-radius: 5px; font-size: .92em; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; background: var(--surface); padding: 8px; z-index: 10; }

.topbar { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; padding: .6rem 1.25rem; background: var(--brand); color: #fff; }
.topbar a, .topbar .link { color: #fff; text-decoration: none; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.15rem; }
.brand img { display: block; }
.topbar nav { display: flex; gap: 1rem; flex: 1; }
.topbar nav a { padding: .25rem .1rem; border-bottom: 2px solid transparent; }
.topbar nav a:hover { border-color: #fff; }
.account { display: flex; align-items: center; gap: .9rem; font-size: .92rem; }
.account form { margin: 0; }
button.link { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }

main { width: min(1080px, 100% - 2.5rem); margin: 1.75rem auto; flex: 1; }
footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 1.25rem; }
h1 { font-size: 1.7rem; margin: 0 0 1rem; } h2 { font-size: 1.25rem; margin: 1.6rem 0 .6rem; } h3 { font-size: 1.05rem; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.4rem; }
.narrow { max-width: 440px; margin-inline: auto; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1rem; }
.cards .card { display: flex; flex-direction: column; gap: .5rem; }
.cards .card h2 { margin: 0; }
.hint { color: var(--muted); font-size: .9rem; }
.secret code { font-size: 1.4rem; padding: .4rem .7rem; letter-spacing: .04em; }

input[type=text], input[type=password], input[type=number], input[type=file], select, textarea {
  width: 100%; padding: .55rem .65rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: inherit; font: inherit;
}
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid #4aa3df; outline-offset: 2px; }
label { font-weight: 600; display: block; margin-bottom: .2rem; }
.errorlist { color: var(--bad); list-style: none; padding: 0; margin: .25rem 0; font-size: .92rem; }

.btn { display: inline-block; background: var(--brand); color: #fff; border: 1px solid var(--brand); border-radius: 8px; padding: .55rem 1rem; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--brand-strong); }
.btn.ghost { background: transparent; color: var(--brand); }
@media (prefers-color-scheme: dark) { .btn.ghost { color: #7fc1ee; border-color: #7fc1ee; } }
.btn.small { padding: .25rem .6rem; font-size: .88rem; }

.flash { padding: .7rem 1rem; border-radius: 8px; background: var(--brand-soft); border: 1px solid var(--line); }
.flash.success { background: var(--ok-soft); } .flash.error { background: var(--bad-soft); }

table.grid { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.grid th, table.grid td { text-align: left; padding: .55rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grid th { background: var(--brand-soft); font-size: .88rem; }
.scroll { overflow-x: auto; }

.badge { display: inline-block; font-size: .8rem; font-weight: 700; padding: .1rem .55rem; border-radius: 999px; background: var(--brand-soft); color: var(--brand-strong); }
@media (prefers-color-scheme: dark) { .badge { color: #bfe0f7; } }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.warn { background: var(--warn-soft); color: var(--warn); } .badge.bad { background: var(--bad-soft); color: var(--bad); }
progress { width: 100%; height: 10px; appearance: none; border: 0; border-radius: 999px; overflow: hidden; background: var(--line); accent-color: var(--ok); }
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--ok); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--ok); }
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: .6rem; }

/* contenu pédagogique (HTML maîtrisé par l'équipe, voir apps/learn/content) */
.prose { max-width: 78ch; } .prose img { max-width: 100%; }
.prose pre { background: #0f1720; color: #e8eef4; padding: .9rem 1rem; border-radius: 8px; overflow-x: auto; }
.prose table { border-collapse: collapse; } .prose th, .prose td { border: 1px solid var(--line); padding: .35rem .6rem; }
.callout { border-left: 4px solid var(--brand); background: var(--brand-soft); padding: .6rem .9rem; border-radius: 0 8px 8px 0; }

/* exercices */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }
textarea.code { min-height: 11rem; font-size: .95rem; tab-size: 2; resize: vertical; }
.result { margin-top: 1rem; } .result.ok { border-left: 5px solid var(--ok); } .result.bad { border-left: 5px solid var(--bad); }
.exlist { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.exlist li { display: flex; gap: .8rem; align-items: center; justify-content: space-between; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .55rem .9rem; }

.checks { list-style: none; padding: 0; margin: .6rem 0 0; display: grid; gap: .4rem; }
.checks li { padding: .45rem .7rem; border-radius: 8px; border: 1px solid var(--line); }
.checks li.ok { background: var(--ok-soft); } .checks li.bad { background: var(--bad-soft); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
fieldset.q { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 .9rem; padding: .6rem .9rem; }
fieldset.q legend { font-weight: 600; padding: 0 .3rem; }
.choice { display: block; font-weight: 400; padding: .25rem 0; cursor: pointer; }
.choice input { width: auto; margin-right: .45rem; }
.actions { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; }
.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.5rem; }
.filters { display: flex; gap: .6rem; align-items: end; margin-bottom: 1rem; } .filters label { margin: 0; } .filters select { width: auto; }
main > .card, main > section.card { margin-bottom: 1rem; }
details > summary { cursor: pointer; font-weight: 600; margin: .5rem 0; }

.copyblock { border: 1px solid var(--line); border-radius: 8px; padding: .6rem .9rem; margin: 0 0 .9rem; background: var(--brand-soft); }
.copytext { white-space: pre-wrap; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: .6rem .8rem; margin: .4rem 0; font-family: inherit; }
dl.answers dt { font-weight: 600; margin-top: .6rem; } dl.answers dd { margin: 0; white-space: pre-wrap; }
fieldset.item-check { border: 0; padding: 0; margin: 0 0 .4rem; }

.split.side-nav { grid-template-columns: minmax(12rem, 15rem) minmax(0, 1fr); }
@media (max-width: 860px) { .split.side-nav { grid-template-columns: 1fr; } }
dl.answers dd.rubric { color: var(--muted); font-size: .9rem; }
.prose .scroll, .prose table { max-width: 100%; }
