/* The interface is drawn on one canvas (js/engine). This sheet only pins the
   canvas to the window and keeps its invisible semantic twins out of sight. */

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #131426;
  color: #f6f3ee;
  font-synthesis: none;
  font-variant-numeric: tabular-nums;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

#stage {
  position: fixed;
  inset: 0;
  display: block;
  width: 100vw;
  height: 100vh;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  outline: none;
}

/* Before any script runs, the only visible DOM: the logo and the loading bar
   exactly where the canvas draws them from its first frame (js/ui/loader.js,
   LOADER: the logo centred 40px above the middle, the 6px bar 46px below it,
   at most 260px wide), which removes this. The bar's Persimmon breathes
   (30 % to 85 % and back, 3.2 s), the logo leans 6° each way; neither moves under reduced
   motion. */
.boot {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.boot-mark {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 64px;
  height: 64px;
  margin: -72px 0 0 -32px;
  animation: boot-lean 2.1s ease-in-out infinite;
}

.boot-bar {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(260px, calc(100vw - 80px));
  height: 6px;
  margin-top: 43px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  transform: translateX(-50%);
}

.boot-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: #f57868;
  opacity: 0.3;
  animation: boot-breathe 1.6s ease-in-out infinite alternate;
}

@keyframes boot-breathe {
  from { opacity: 0.3; }
  to { opacity: 0.85; }
}

@keyframes boot-lean {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(6deg); }
  75% { transform: rotate(-6deg); }
}

@media (prefers-reduced-motion: reduce) {
  .boot-mark { animation: none; }
  .boot-bar::after { opacity: 0.7; animation: none; }
}

/* Semantic layer: same box as the canvas. Its nodes are positioned over what
   the canvas draws for them, never visible, never in the way of the pointer. */
.semantics {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
  contain: strict;
}

.semantics > *,
.semantics form > *,
.semantics nav > * {
  position: absolute;
  left: 0;
  top: 0;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  opacity: 0;
  background: transparent;
  color: transparent;
  font: 500 16px/1 "M PLUS Rounded 1c", system-ui, sans-serif;
  white-space: nowrap;
}

/* A form, a named navigation (engine/semantics.js): the layer's own box, so
   that their twins stand over their drawing like the others. */
.semantics form,
.semantics nav {
  position: absolute;
  inset: 0;
  opacity: 1;
  overflow: visible;
  pointer-events: none;
}

/* Text fields stay real and reachable by the pointer, but transparent: the
   canvas draws their text, caret and selection. */
.semantics input,
.semantics select {
  opacity: 1;
  pointer-events: auto;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 0;
  color: transparent;
  -webkit-text-fill-color: transparent;
  caret-color: transparent;
  background: transparent;
  box-shadow: none;
  text-overflow: clip;
}

.semantics select {
  opacity: 0;
  cursor: pointer;
}

.semantics select option {
  color: #1b1722;
  -webkit-text-fill-color: #1b1722;
  background: #ffffff;
}

.semantics input::selection {
  background: transparent;
  color: transparent;
}

.semantics input::placeholder {
  color: transparent;
}

.semantics input:-webkit-autofill,
.semantics input:-webkit-autofill:hover,
.semantics input:-webkit-autofill:focus {
  -webkit-text-fill-color: transparent;
  caret-color: transparent;
  transition: background-color 9999999s ease-out 0s, color 9999999s ease-out 0s;
}

.live {
  position: fixed;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* What the page is, for readers without JavaScript (web/index.html's #intro):
   text extractors, search and AI fetchers, a screen reader without scripts.
   Never painted; the canvas's first frame removes it with #boot. */
.intro {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Read once to learn the device's safe-area insets (notches, home bar). */
/* The quiet anti-bot check's host (lib/verification.js): laid out so that the
   widget runs, never seen nor reachable; a challenge needing a human is removed
   and asked in the dialog instead. */
.bot-quiet {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 300px;
  height: 65px;
  overflow: hidden;
  pointer-events: none;
}

.safe-area {
  position: fixed;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  visibility: hidden;
  pointer-events: none;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}

.noscript-panel {
  position: fixed;
  inset: 0;
  z-index: 3;
  overflow: auto;
  padding: 24px;
  background: #131426;
}
.noscript {
  max-width: 44rem;
  margin: 0 auto 24px;
  text-align: center;
  font: 700 18px/1.5 system-ui, sans-serif;
}

.noscript a { display: inline-block; min-height: 44px; color: #ffb4a4; text-underline-offset: .2em; }
.noscript a:focus-visible { outline: 3px solid #f6f3ee; outline-offset: 4px; }

/* The only visible DOM panel: Cloudflare's cross-origin widget cannot be drawn
   on the canvas. Native modal/inert/focus handling also works before app boot. */
.bot-dialog {
  box-sizing: border-box;
  width: min(420px, calc(100% - 24px));
  max-height: calc(100% - 32px);
  padding: 24px;
  overflow: auto;
  border: 1px solid #3b3c5c;
  border-radius: 22px;
  background: #1f1f36;
  color: #f6f3ee;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  font-family: "M PLUS Rounded 1c", system-ui, sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
}
.bot-dialog::backdrop { background: rgba(15, 16, 31, 0.72); }
.bot-dialog h2 { margin: 0 0 16px; font-size: 1.625rem; }
.bot-dialog p { margin: 12px 0; }
.bot-widget { display: flex; justify-content: center; }
.bot-note, .bot-privacy { color: #c4bfd2; font-size: 14px; }
.bot-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.bot-actions button {
  min-height: 44px;
  padding: 8px 18px;
  border: 1px solid #aeacbf;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
#bot-retry { background: #f57868; color: #170d0d; }
.bot-dialog a { color: inherit; text-underline-offset: 3px; }
.bot-dialog :focus-visible { outline: 2px solid #f6f3ee; outline-offset: 4px; }
@media (max-width: 380px) { .bot-dialog { padding: 18px; } }

/* "Donner mon avis" (lot 25): the same native dialog, wider for a form, in
   rem so the browser's text size scales it; it scrolls rather than clips. */
.feedback-dialog { width: min(34rem, calc(100% - 24px)); font-size: 1rem; overflow-wrap: break-word; }
.feedback-dialog p { margin: 0.5rem 0; }
.feedback-terms { margin: 0.75rem 0 1rem; padding: 0.625rem 0.875rem; border: 1px solid #3b3c5c; border-radius: 14px; background: #131426; }
.feedback-terms p { margin: 0.25rem 0; }
.feedback-form fieldset { min-width: 0; margin: 0 0 1rem; padding: 0; border: 0; }
.feedback-form legend, .feedback-form label[for] { display: block; margin: 0 0 0.5rem; padding: 0; font-weight: 700; }
.feedback-choice { display: flex; align-items: center; gap: 0.625rem; min-height: 44px; margin: 0 0 0.5rem; padding: 0.5rem 0.75rem; border: 1px solid #3b3c5c; border-radius: 14px; cursor: pointer; }
.feedback-choice span { min-width: 0; overflow-wrap: anywhere; }
.feedback-choice input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: #f57868; }
.feedback-choice:has(input:checked) { border-color: #f57868; background: #2a2b45; box-shadow: inset 0 0 0 1px #f57868; }
.feedback-choice:has(input:focus-visible) { outline: 2px solid #f6f3ee; outline-offset: 2px; }
.feedback-form textarea { box-sizing: border-box; display: block; width: 100%; min-height: 9rem; margin: 0; padding: 0.75rem 0.875rem; border: 1px solid #aeacbf; border-radius: 14px; background: #131426; color: inherit; font: inherit; line-height: 1.5; resize: vertical; }
.feedback-form textarea[aria-invalid="true"] { border-color: #ff9d94; }
.feedback-hint, .feedback-count { color: #c4bfd2; font-size: 0.875rem; }
.feedback-count { text-align: right; font-variant-numeric: tabular-nums; }
.feedback-error, .feedback-alert { color: #ff9d94; font-weight: 700; }
.feedback-alert:empty { display: none; }
.feedback-context { margin: 0 0 1rem; }
.feedback-context summary { display: flex; align-items: center; min-height: 44px; font-weight: 700; cursor: pointer; }
.feedback-context ul { margin: 0.25rem 0 0.5rem; padding-left: 1.25rem; }
.feedback-diagnostic-data { max-height: 18rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.875rem; line-height: 1.5; }
.feedback-diagnostics { margin-block: 1rem; }
.feedback-actions .feedback-send { border-color: #f57868; background: #f57868; color: #170d0d; }
.feedback-actions button:disabled { opacity: 0.6; cursor: progress; }
.feedback-done:focus { outline: none; }
.feedback-thanks p:first-child { font-size: 1.25rem; font-weight: 800; }
