/* Styles propres aux pages de mcpthat, sur le design system (design-system.css) : voir specs/v3-design.md.
   Repris du prototype du projet de design (prototype/mcpthat-proto.html). */

/* --- Polices hébergées par le service (licence SIL Open Font License, voir fonts/) --- */
@font-face { font-family: "Figtree"; font-style: normal; font-weight: 300 900; font-display: swap; src: url("/fonts/figtree-latin.woff2") format("woff2"); }
@font-face { font-family: "Gochi Hand"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/gochi-hand-latin.woff2") format("woff2"); }
@font-face { font-family: "DM Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/dm-mono-400-latin.woff2") format("woff2"); }
@font-face { font-family: "DM Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/dm-mono-500-latin.woff2") format("woff2"); }

/* --- Base --- */
html, body { background: var(--paper); color: var(--ink); }
[hidden] { display: none !important; }
body { margin: 0; padding-inline: clamp(16px, 5vw, 96px); padding-block: 0 96px; font-family: var(--font-body); font-size: 16px; line-height: 1.5; }
.app { max-width: 1248px; margin: 0 auto; }
.col { max-width: 760px; margin: 16px auto 0; display: flex; flex-direction: column; gap: 32px; }
button { font-family: inherit; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.linkbtn:focus-visible { outline: 3px solid var(--violet); outline-offset: 3px; }
.mt-header nav a[aria-current="page"] { font-weight: 800; text-decoration: underline; text-decoration-color: var(--sun); text-decoration-thickness: 3px; text-underline-offset: 6px; }
.mt-header form { display: inline; margin: 0; }
.mono { font-family: var(--font-mono); }
.soft { color: var(--ink-soft); }
.small { margin: 0; font-size: 14px; color: var(--ink-soft); }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition: none !important; } .mt-spinner { animation-duration: 2.4s !important; } }

/* --- Accueil --- */
.home { position: relative; isolation: isolate; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 72px); align-items: center; margin-top: clamp(24px, 6vh, 64px); }
.pitch { position: relative; display: grid; gap: 24px; min-width: 0; }
.pitch h1 { margin: 0; font-weight: 800; font-size: clamp(34px, 3.8vw, 54px); line-height: 1.06; letter-spacing: -1.4px; text-wrap: balance; }
.nowrap { white-space: nowrap; }
.mark { background: linear-gradient(176deg, transparent 54%, rgba(255, 198, 31, .85) 54%, rgba(255, 198, 31, .85) 90%, transparent 90%); padding: 0 6px; margin: 0 -6px; border-radius: 4px; }
.lede { margin: 0; font-size: 19px; color: var(--ink-soft); max-width: 42ch; }
/* Trame de points sur toute la fenêtre (accueil), dégagée derrière le contenu. */
body.dotted { background: transparent; }
body.dotted::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background-image: radial-gradient(rgba(23, 19, 31, .12) 1.2px, transparent 1.6px); background-size: 18px 18px; -webkit-mask-image: radial-gradient(ellipse 75% 80% at 50% 50%, #000 35%, transparent 90%); mask-image: radial-gradient(ellipse 75% 80% at 50% 50%, #000 35%, transparent 90%); }
.home::before { content: ""; position: absolute; inset: -16px -24px -56px; z-index: -1; background: var(--paper); border-radius: 20px; box-shadow: 0 0 28px 22px var(--paper); pointer-events: none; }
.try-arrow { position: absolute; left: calc(100% - 288px); top: calc(100% + 6px); width: 330px; height: 110px; pointer-events: none; }
.try-arrow span { position: absolute; left: 0; top: 60px; font-family: var(--font-hand); font-size: 23px; color: var(--violet); transform: rotate(-3deg); white-space: nowrap; }
.try-arrow svg { position: absolute; inset: 0; overflow: visible; }
.try-arrow path { fill: none; stroke: var(--violet); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
/* Carrousel « Ideal for » : la carte suivante dépasse à droite, estompée. */
.ideal { overflow: hidden; margin: -4px; padding: 4px; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 64px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 64px), transparent); touch-action: pan-y; }
.car-track { display: flex; align-items: flex-start; gap: 28px; transition: transform .5s cubic-bezier(.3, .7, .3, 1); }
.car-slide { box-sizing: border-box; flex: 0 0 calc(100% - 120px); font-size: 19px; line-height: 1.5; color: var(--ink-soft); opacity: .4; transition: opacity .3s; user-select: none; }
.car-slide b { font-weight: 600; color: var(--violet); text-decoration: underline; text-decoration-color: var(--sun); text-decoration-thickness: 3px; text-underline-offset: 5px; text-decoration-skip-ink: none; }
.car-slide.on { opacity: 1; }
.car-slide.next { cursor: pointer; }
.car-slide.next:hover { opacity: .7; }
.car-track.instant, .car-track.instant .car-slide { transition: none; }
.car-slide:focus-visible { outline: 3px solid var(--violet); outline-offset: 3px; border-radius: 6px; }
.try { display: grid; gap: 14px; min-width: 0; }
.examples { margin: 0; font-size: 14px; color: var(--ink-soft); display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 4px 8px; }
.examples b { font-weight: 600; color: var(--ink); }
.examples .linkbtn { font-size: 14px; }
.examples .linkbtn[aria-disabled="true"] { cursor: progress; }
.zone { position: relative; min-height: 400px; box-sizing: border-box; border: 3px dashed var(--ink); border-radius: 28px; background: var(--sheet); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px; min-width: 0; transition: border-color .2s, background .2s; }
.zone.hot { border-color: var(--violet); background: var(--lilac-soft); }
.zone.done { border-style: solid; border-color: var(--line); }
.art { width: min(100%, 230px); transition: width .3s; }
.zone.done .art, .zone.challenge .art { width: min(100%, 150px); }
.art svg { width: 100%; height: auto; display: block; overflow: visible; }
.panel { display: grid; justify-items: center; gap: 12px; text-align: center; width: 100%; max-width: 440px; animation: rise .35s ease both; }
.say { margin: 0; font-family: var(--font-hand); font-size: 36px; line-height: 1; }
.say.violet { color: var(--violet); }
.say.err { color: var(--red); font-size: 32px; }
.status { margin: 0; font-family: var(--font-mono); font-size: 14px; min-height: 1.5em; }
.bar { width: 100%; height: 10px; border-radius: 999px; background: var(--lilac); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--violet); border-radius: inherit; }
.pct { font-family: var(--font-mono); font-size: 13px; color: var(--violet); font-variant-numeric: tabular-nums; }
.creds { width: 100%; display: grid; gap: 8px; text-align: left; }
.limits { font-family: var(--font-mono); font-size: 12px; color: var(--ink-soft); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.turnstile-box { min-height: 65px; display: flex; justify-content: center; }
.turnstile-box.dormant { visibility: hidden; min-height: 0; height: 0; overflow: hidden; }
.error-text { font-size: 15px; max-width: 40ch; }
#v-challenge p { margin: 0; }
/* Mascotte sans animation (GSAP absent) : pose endormie. */
.art:not(.animated) :is(.open, .happy, .m-o, .m-smile, .m-big, .ear, .antenna, .sp) { opacity: 0; }
.art:not(.animated) .body-all { transform: rotate(-5deg); transform-origin: 160px 262px; }

/* Mascotte */
.doc { fill: var(--sheet); stroke: var(--ink); stroke-width: 5; stroke-linejoin: round; }
.ink { fill: none; stroke: var(--ink); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.ear circle { fill: var(--peach); stroke: var(--ink); stroke-width: 5; }
.ear path { fill: none; stroke: var(--ink); stroke-width: 4; stroke-linecap: round; }
.eye-w { fill: var(--sheet); stroke: var(--ink); stroke-width: 4; }
.pupil ellipse { fill: var(--ink); }
.pupil circle { fill: var(--sheet); }
.mouth { fill: var(--ink); }
.tongue { fill: var(--pink); }
.badge rect { fill: var(--ink); }
.badge text { fill: var(--sheet); font: 800 17px var(--font-body); letter-spacing: .04em; text-anchor: middle; }
.grid-l { fill: none; stroke: var(--grid); stroke-width: 2; }
.shadow { fill: var(--lilac); }
.w { fill: none; stroke: var(--violet); stroke-width: 5; stroke-linecap: round; }
.ball { fill: var(--violet); stroke: var(--ink); stroke-width: 4; }
.sp path { fill: none; stroke: var(--sun); stroke-width: 5; stroke-linecap: round; }
.z { fill: none; stroke: var(--violet); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.draw { stroke-dasharray: 1 1; }

/* --- Pages d'un serveur et espace personnel --- */
.stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: 400 15px var(--font-body); padding: 8px 15px; border-radius: var(--radius-pill); display: inline-flex; align-items: center; gap: 8px; border: 1.5px solid var(--violet); background: var(--lilac-soft); color: var(--ink); cursor: pointer; text-align: left; }
.chip:hover { background: var(--lilac); }
.chip svg { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--violet); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chip.copied { border-color: var(--green); background: var(--green-soft); }
.chip.copied svg { stroke: var(--green); }
.banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; padding: 20px 24px; border-radius: var(--radius-lg); background: var(--lilac-soft); border: 2px dashed var(--violet); }
.banner.warn { border-radius: var(--radius-md); background: var(--amber-soft); border: 2px solid var(--amber); }
.banner .t { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 320px; }
.banner b { font-size: 18px; font-weight: 800; }
.banner.warn b { color: var(--amber); font-size: 17px; }
.banner span { color: var(--ink-soft); }
.banner.warn span { color: var(--ink); }
.dataset { display: flex; flex-direction: column; gap: 12px; }
.dataset-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.dataset-h > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.dataset-h svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.preview { font-family: var(--font-mono); font-size: 13px; white-space: nowrap; }
.preview th { font-family: var(--font-mono); }
.endrow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 20px; border-top: 1.5px solid var(--line); }
.endrow > span { color: var(--ink-soft); }
.page-title { display: flex; flex-direction: column; gap: 4px; }
.page-title h1 { margin: 0; font-size: 40px; line-height: 1.1; letter-spacing: -1px; font-weight: 800; overflow-wrap: anywhere; }
.page-title h1.mono { font-family: var(--font-mono); font-weight: 500; letter-spacing: -1.5px; }
.page-title p { margin: 0; color: var(--ink-soft); }
.page-title p .mono { font-size: 14px; color: var(--ink); }
.back { font-size: 15px; color: var(--ink-soft); align-self: flex-start; }
.manage-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; padding: 16px 0; }
.manage-row + .manage-row { border-top: 1px solid var(--line); }
.manage-row.center { align-items: center; }
.manage-row .t { display: flex; flex-direction: column; gap: 2px; flex: 1 1 300px; min-width: 0; }
.manage-row .t b { font-weight: 600; }
.manage-row .t span { color: var(--ink-soft); font-size: 15px; }
.manage-row .mt-field { flex: 1 1 280px; min-width: 0; }
.manage-row .mt-alert { flex-basis: 100%; }
.with-status { display: flex; align-items: center; gap: 12px; }
details > summary { cursor: pointer; font-weight: 600; color: var(--violet); }
details.connect-help { border-top: 1.5px solid var(--line); padding-top: 14px; }
details.connect-help > div { padding-top: 18px; }
.questions { display: flex; flex-direction: column; gap: 12px; }
.tabpanel code { font-family: var(--font-mono); font-size: 13px; background: var(--paper); padding: 2px 6px; border-radius: 6px; overflow-wrap: anywhere; }
.tabpanel pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font-mono); font-size: 13px; background: var(--paper); padding: 10px 12px; border-radius: var(--radius-sm); border: var(--border-hair) solid var(--line); }
.tabpanel li { overflow-wrap: anywhere; }
.mt-copy > label .mt-badge { text-transform: none; letter-spacing: 0; font-family: var(--font-body); }
.fresh code { border-color: var(--green) !important; background: var(--green-soft) !important; }
/* « Copy » : éclair vert immédiat, 0,7 s, puis retour en fondu de 0,6 s ; le libellé ne change pas. */
.mt-copy button { transition: background-color .6s ease-out, border-color .6s ease-out, color .6s ease-out; }
.mt-copy button.done { border-color: var(--green); background: var(--green-soft); color: var(--green); transition: none; }
/* Libellé suivi d'une infobulle ou d'un badge, sur la même ligne. */
/* Hauteur de ligne fixe (celle du badge) : l'apparition du badge ne décale rien. */
.mt-copy.with-extras { grid-template-columns: auto auto 1fr; grid-template-rows: 26px auto; align-items: center; column-gap: 6px; }
.mt-copy.with-extras > div { grid-column: 1 / -1; }
.mt-copy.with-extras > .mt-badge { justify-self: start; text-transform: none; letter-spacing: 0; font-family: var(--font-body); }
.tip { position: relative; display: inline-flex; color: var(--ink-soft); cursor: help; border-radius: 50%; }
.tip svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.tip:hover, .tip:focus-visible { color: var(--ink); outline: none; }
.tip:focus-visible { box-shadow: 0 0 0 3px var(--lilac); }
.tip-b { position: absolute; left: -10px; bottom: calc(100% + 8px); z-index: 5; width: max-content; max-width: 240px; padding: 8px 11px; border-radius: 8px; background: var(--ink); color: var(--sheet); font: 400 13px/1.4 var(--font-body); letter-spacing: 0; text-transform: none; opacity: 0; visibility: hidden; transition: opacity .12s; pointer-events: none; }
.tip:hover .tip-b, .tip:focus-visible .tip-b { opacity: 1; visibility: visible; }
/* Sur un écran étroit, l'infobulle s'aligne sur le champ et n'en dépasse pas (pas de défilement horizontal). */
@media (max-width: 560px) {
  .mt-copy.with-extras { position: relative; }
  .mt-copy.with-extras .tip { position: static; }
  .mt-copy.with-extras .tip-b { left: 0; bottom: auto; top: -6px; transform: translateY(-100%); max-width: 100%; }
}
/* Tutoriels : informations secondaires repliées, blocs copiables, installation en un clic. */
.tabpanel > ol { margin: 0; }
.tabpanel .alt { display: grid; gap: 8px; margin: 14px 0 0; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 14px; color: var(--ink-soft); }
.more > summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px; color: var(--ink-soft); font-weight: 600; }
.more > summary::-webkit-details-marker { display: none; }
.more > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s; margin-right: 2px; }
.more[open] > summary::before { transform: rotate(45deg); }
.more > summary:hover { color: var(--ink); }
.more > summary:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; border-radius: 4px; }
.more > p { margin: 6px 0 0; }
.tabpanel .mt-copy.cmd { margin-top: 6px; }
.tabpanel .mt-copy.cmd code { padding: 10px 12px; border-radius: var(--radius-sm); font-size: 12.5px; }
.tabpanel .mt-copy.cmd code.pre { white-space: pre-wrap; }
.tabpanel .quick { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding-bottom: 14px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.tabpanel .quick span { flex: 1 1 260px; min-width: 0; color: var(--ink-soft); font-size: 15px; }
.tabpanel .quick span b { color: var(--ink); }
.tabpanel .or { margin: 0 0 8px; font-weight: 600; }
.tabpanel .intro { margin: 0 0 8px; }
.tabpanel .facts { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
.tabpanel .opts { margin: 8px 0 0; padding-left: 1.1em; display: grid; gap: 4px; font-size: 14px; color: var(--ink-soft); list-style: disc; }
/* Boutons de la carte « Manage » : l'état de l'action s'affiche dans le bouton, sans changer sa largeur. */
#rename-form button[type="submit"] { min-width: 132px; }
.mt-btn.busy, .mt-btn.ok { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.mt-btn.busy[disabled], .mt-btn.ok[disabled] { opacity: 1; cursor: default; }
.mt-btn.busy .mt-spinner { width: 16px; height: 16px; box-sizing: border-box; }
.mt-btn.ok { border-color: var(--green); background: var(--green-soft); color: var(--green); }
.mt-btn.ok svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.list-h { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.list-h h1 { margin: 0; font-size: 40px; line-height: 1.1; font-weight: 800; letter-spacing: -1px; }
.list-h #count { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.list-tools { display: flex; align-items: center; gap: 16px; }
.list-tools .mt-btn { display: inline-flex; align-items: center; gap: 6px; }
.list-tools .mt-btn:disabled { opacity: .45; cursor: not-allowed; }
.plus { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
/* Fenêtre « New server » : la zone de dépôt de l'accueil. */
dialog.mt-dialog.new-server { box-sizing: border-box; width: min(600px, calc(100% - 32px)); max-width: none; max-height: calc(100dvh - 48px); overflow: auto; margin: clamp(24px, 10vh, 120px) auto 24px; padding: 20px 20px 22px; gap: 14px; }
/* Le design system grise les paragraphes des fenêtres : la zone garde les couleurs de l'accueil. */
dialog.new-server .say { color: var(--ink); }
dialog.new-server .say.violet { color: var(--violet); }
dialog.new-server .say.err { color: var(--red); }
.dialog-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-close { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 999px; background: none; color: var(--ink); cursor: pointer; }
.dialog-close:hover { background: var(--paper); }
.dialog-close:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; }
.dialog-close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.srv-list { display: flex; flex-direction: column; }
.srv-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; padding: 16px 14px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.srv-row:hover { background: var(--sheet); }
.srv-row:last-child { border-bottom: 0; }
.srv-row.just { background: var(--green-soft); border-radius: var(--radius-md); border-bottom-color: transparent; }
.srv-row .l { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.srv-row .l > span:first-child { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.srv-row .l b { font-size: 17px; font-weight: 800; overflow-wrap: anywhere; }
.srv-row .l .f { font-family: var(--font-mono); font-size: 13px; color: var(--ink-soft); overflow-wrap: anywhere; }
.srv-row .r { display: flex; align-items: center; gap: 20px; font-size: 14px; color: var(--ink-soft); }
.srv-row svg { width: 18px; height: 18px; fill: none; stroke: var(--ink-soft); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.signin-box { max-width: 560px; margin: 96px auto 0; display: flex; flex-direction: column; align-items: center; gap: 20px; text-align: center; }
.signin-box h1 { margin: 0; font-size: 34px; font-weight: 800; letter-spacing: -0.8px; }
.signin-box p { margin: 0; color: var(--ink-soft); }
.account-row .mono { font-size: 14px; color: var(--ink); }
.account-row .linkbtn { font-weight: 600; }
#empty { margin: -12px 0 0; }
#create-error { margin-top: -12px; }

/* --- Pages de fin et d'erreur --- */
.end-page { max-width: 560px; margin: 120px auto 0; display: flex; flex-direction: column; align-items: center; gap: 20px; text-align: center; }
.end-page > div { display: flex; flex-direction: column; gap: 8px; }
.end-page h1 { margin: 0; font-size: 34px; font-weight: 800; letter-spacing: -0.8px; }
.end-page p { margin: 0; color: var(--ink-soft); }
.end-page p b, .end-page p .mono { color: var(--ink); }
.end-page svg { fill: none; stroke: var(--ink-soft); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }

/* --- Fenêtres de confirmation --- */
dialog.mt-dialog { width: calc(100% - 32px); color: var(--ink); margin-top: 18vh; }
/* Le design system affiche .mt-dialog en grille : une fenêtre fermée doit rester cachée. */
dialog.mt-dialog:not([open]) { display: none; }
dialog.mt-dialog[open] { animation: rise .2s ease both; }
dialog.mt-dialog::backdrop { background: rgba(23, 19, 31, .45); }
dialog.mt-dialog form { display: contents; }

@media (max-width: 900px) {
  .home { grid-template-columns: minmax(0, 1fr); }
  .zone { min-height: 0; }
  .try { order: -1; }
  .try-arrow { display: none; }
  /* La zone dégagée ne dépasse pas la gouttière (16 px au moins) : pas de défilement horizontal. */
  .home::before { inset: -16px -12px -56px; }
}
@media (max-width: 560px) {
  .page-title h1, .list-h h1 { font-size: 32px; }
}
