/* ==========================================================================
   Pixel Script UI — plan technique, filets 1px
   Palette monochrome + deux teintes d'alerte (orange / rouge) pour les
   dépassements de taille de script.
   ========================================================================== */

:root {
  color-scheme: light;
  --panel: #ffffff;
  --ink: #111111;
  --onink: #ffffff;
  --muted: #555555;
  --faint: #777777;
  --hatch-a: #ffffff;
  --hatch-b: #ececec;
  --check-a: #111111;
  --check-b: #f2f2f2;
  --check-bg: #d8d8d8;
  --dim: #999999;
  --dim-soft: #bbbbbb;
  --stripe-a: #dddddd;
  --stripe-b: #eeeeee;
  --warn: #a25a00;
  --warn-bg: #fbf0dd;
  --danger: #b31414;
  --danger-bg: #fbe4e4;
}

/* Repli si le script d'initialisation du thème n'a pas tourné. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --panel: #0e0e0e;
    --ink: #f0f0f0;
    --onink: #0e0e0e;
    --muted: #9a9a9a;
    --faint: #808080;
    --hatch-a: #131313;
    --hatch-b: #1b1b1b;
    --check-a: #f0f0f0;
    --check-b: #262626;
    --check-bg: #1a1a1a;
    --dim: #666666;
    --dim-soft: #555555;
    --stripe-a: #222222;
    --stripe-b: #2c2c2c;
    --warn: #f0a848;
    --warn-bg: #2a2010;
    --danger: #ff6b6b;
    --danger-bg: #2c1414;
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --panel: #0e0e0e;
  --ink: #f0f0f0;
  --onink: #0e0e0e;
  --muted: #9a9a9a;
  --faint: #808080;
  --hatch-a: #131313;
  --hatch-b: #1b1b1b;
  --check-a: #f0f0f0;
  --check-b: #262626;
  --check-bg: #1a1a1a;
  --dim: #666666;
  --dim-soft: #555555;
  --stripe-a: #222222;
  --stripe-b: #2c2c2c;
  --warn: #f0a848;
  --warn-bg: #2a2010;
  --danger: #ff6b6b;
  --danger-bg: #2c1414;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Les blocs en display:flex/grid ignorent l'attribut hidden sans cette règle. */
[hidden] {
  display: none !important;
}

/* La page occupe toute la fenêtre : pas de marge, pas de fond neutre autour. */
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  color: var(--ink);
  font-family: 'Archivo', Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

/* Étiquette mono réutilisée partout (labels, méta, boutons). */
.subtitle,
.col-head,
.frame-caption,
.dropzone-hint,
.control label,
.control-bounds,
.dims-info,
.export-bar,
.size-warning,
.theme-toggle,
.code-preview,
.page-footer {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---- Panneau principal : occupe toute la hauteur disponible ------------- */
.panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
}

.panel-head {
  position: relative;
  padding: 18px 24px 16px;
  border-bottom: 2px solid var(--ink);
  text-align: center;
}

.panel-head h1 {
  margin: 0;
  font-size: clamp(20px, 2.6vw, 32px);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1;
  text-transform: uppercase;
}

.subtitle {
  margin: 8px auto 0;
  max-width: 560px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Bascule de thème */
.theme-toggle {
  position: absolute;
  top: 14px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--ink);
  background: var(--panel);
  color: var(--ink);
  padding: 6px 12px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  cursor: pointer;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  background: var(--ink);
  color: var(--onink);
}

.theme-toggle-glyph {
  width: 10px;
  height: 10px;
  border: 1px solid currentColor;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}

/* ---- Corps : scène + réglages ------------------------------------------ */
.panel-body {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  border-bottom: 2px solid var(--ink);
  min-height: 0;
}

.stage {
  border-right: 2px solid var(--ink);
  padding: 18px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Zone d'import (état vide) */
.dropzone {
  flex: 1;
  min-height: 190px;
  border: 1px dashed var(--ink);
  background: repeating-linear-gradient(45deg, var(--hatch-a) 0 6px, var(--hatch-b) 6px 12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 20px;
  cursor: pointer;
}

.dropzone:hover,
.dropzone:focus-visible,
.dropzone.dragover {
  border-style: solid;
  outline: none;
  box-shadow: inset 0 0 0 1px var(--ink);
}

.dropzone.dragover {
  background: repeating-linear-gradient(45deg, var(--hatch-b) 0 6px, var(--hatch-a) 6px 12px);
}

.dropzone-mark {
  width: 26px;
  height: 26px;
  border: 2px solid var(--ink);
}

.dropzone strong {
  font-size: clamp(14px, 1.8vw, 17px);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.dropzone-hint {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

/* Aperçus (état rempli) */
.previews {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  min-height: 0;
}

.preview-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.col-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 8px;
}

.col-head-meta {
  color: var(--faint);
}

.frame {
  position: relative;
  flex: 1;
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.frame--original {
  border: 1px dashed var(--ink);
  background: repeating-linear-gradient(45deg, var(--hatch-a) 0 6px, var(--hatch-b) 6px 12px);
}

.frame--pixel {
  border: 1px solid var(--ink);
  background-color: var(--check-bg);
  background-image: repeating-conic-gradient(var(--check-a) 0% 25%, var(--check-b) 0% 50%);
  background-size: 20px 20px;
}

.frame--original img {
  max-width: 100%;
  max-height: 100%;
  display: block;
}

.frame--pixel canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  display: block;
}

.frame-caption {
  margin: 8px 0 0;
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Croix de retrait de l'image */
.clear-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--ink);
  background: var(--panel);
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.clear-btn:hover:not(:disabled),
.clear-btn:focus-visible:not(:disabled) {
  background: var(--ink);
  color: var(--onink);
}

/* Fermeture verrouillée le temps d'une écriture sur la calculatrice. */
.clear-btn:disabled {
  border-color: var(--dim);
  color: var(--dim);
  cursor: not-allowed;
}

/* ---- Réglages ----------------------------------------------------------- */
.settings {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 10px;
}

.control label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.control output {
  font-size: 17px;
  font-weight: 700;
}

.control-bounds {
  margin-top: 5px;
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--faint);
}

.dims-info {
  margin: auto 0 0;
  border-top: 1px solid var(--ink);
  padding-top: 14px;
  font-size: 10px;
  line-height: 1.8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* Sliders : barre pleine + curseur rectangulaire.
   --fill est mis à jour par main.js, --seg donne le nombre de crans. */
.slider {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 14px;
  margin: 8px 0 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.slider:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.slider::-webkit-slider-runnable-track {
  height: 14px;
  border: 1px solid var(--ink);
  background:
    linear-gradient(90deg, var(--ink) 0 var(--fill, 0%), var(--panel) var(--fill, 0%) 100%);
}

.slider::-moz-range-track {
  height: 14px;
  border: 1px solid var(--ink);
  box-sizing: border-box;
  background:
    linear-gradient(90deg, var(--ink) 0 var(--fill, 0%), var(--panel) var(--fill, 0%) 100%);
}

.slider--segmented::-webkit-slider-runnable-track {
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0 calc(100% / var(--seg, 16) - 1px),
      var(--dim) calc(100% / var(--seg, 16) - 1px) calc(100% / var(--seg, 16))
    ),
    linear-gradient(90deg, var(--ink) 0 var(--fill, 0%), var(--panel) var(--fill, 0%) 100%);
}

.slider--segmented::-moz-range-track {
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0 calc(100% / var(--seg, 16) - 1px),
      var(--dim) calc(100% / var(--seg, 16) - 1px) calc(100% / var(--seg, 16))
    ),
    linear-gradient(90deg, var(--ink) 0 var(--fill, 0%), var(--panel) var(--fill, 0%) 100%);
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 14px;
  margin-top: -1px;
  border: 1px solid var(--ink);
  background: var(--panel);
  border-radius: 0;
}

.slider::-moz-range-thumb {
  width: 10px;
  height: 14px;
  border: 1px solid var(--ink);
  background: var(--panel);
  border-radius: 0;
}

/* ---- Barre d'export ----------------------------------------------------- */
.export-bar {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.export-size {
  padding: 13px 18px;
  border-right: 1px solid var(--ink);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.export-size-label {
  color: var(--faint);
}

.size-badge {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--dim);
}

.size-badge--ok {
  color: var(--ink);
}

.size-badge--warn {
  color: var(--warn);
}

.size-badge--danger {
  color: var(--danger);
}

.btn-link {
  padding: 13px 18px;
  border: 0;
  background: transparent;
  color: var(--faint);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  text-align: left;
  cursor: pointer;
}

.btn-link:hover,
.btn-link:focus-visible {
  color: var(--ink);
}

.btn-secondary,
.btn-primary {
  border: 0;
  border-left: 1px solid var(--ink);
  padding: 13px 26px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  cursor: pointer;
}

.btn-secondary {
  margin-left: auto;
  background: var(--panel);
  color: var(--ink);
}

.btn-primary {
  padding: 13px 30px;
  font-weight: 700;
  background: var(--ink);
  color: var(--onink);
}

.btn-secondary:hover:not(:disabled),
.btn-secondary:focus-visible:not(:disabled) {
  background: var(--ink);
  color: var(--onink);
}

.btn-primary:hover:not(:disabled),
.btn-primary:focus-visible:not(:disabled) {
  opacity: 0.75;
}

.btn-secondary:disabled {
  color: var(--dim-soft);
  cursor: not-allowed;
}

.btn-primary:disabled {
  background: repeating-linear-gradient(45deg, var(--stripe-a) 0 4px, var(--stripe-b) 4px 8px);
  color: var(--dim);
  cursor: not-allowed;
}

.btn-secondary--error {
  color: var(--danger);
}

.btn-secondary--error:hover:not(:disabled) {
  background: var(--danger);
  color: var(--panel);
}

/* ---- État de la liaison USB avec la calculatrice ------------------------ */
/* Poussé à droite : c'est lui qui porte le margin-left auto, plus le bouton
   secondaire qui le suivait jusqu'ici. */
.calc-status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px 18px;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--faint);
}

.calc-status + .btn-secondary {
  margin-left: 0;
}

.calc-status-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border: 1px solid currentColor;
}

.calc-status[data-state='connected'] {
  color: var(--ink);
}

.calc-status[data-state='connected'] .calc-status-dot,
.calc-status[data-state='busy'] .calc-status-dot {
  background: currentColor;
}

.calc-status[data-state='connecting'] .calc-status-dot,
.calc-status[data-state='busy'] .calc-status-dot {
  animation: calc-pulse 0.9s steps(1) infinite;
}

@keyframes calc-pulse {
  50% {
    background: transparent;
    opacity: 0.35;
  }
}

@media (prefers-reduced-motion: reduce) {
  .calc-status-dot {
    animation: none !important;
  }
}

/* ---- Fenêtres modales --------------------------------------------------- */
/* position:fixed + inset:0 + margin:auto reproduit le centrage natif de
   <dialog> tout en donnant un bloc de référence à la croix de fermeture. */
.modal {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(420px, calc(100vw - 32px));
  max-width: none;
  height: fit-content;
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 0;
  border: 2px solid var(--ink);
  background: var(--panel);
  color: var(--ink);
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.modal-head {
  border-bottom: 1px solid var(--ink);
  padding: 16px 52px 14px 18px;
}

.modal-head h2 {
  margin: 0;
  font-family: 'Archivo', Helvetica, Arial, sans-serif;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.25;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.modal-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-device {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.modal-device .calc-status-dot {
  background: currentColor;
}

.modal-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.modal-input-row {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--ink);
}

.modal-input-row:focus-within {
  box-shadow: inset 0 0 0 1px var(--ink);
}

.modal-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  padding: 11px 12px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
}

.modal-suffix {
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-left: 1px solid var(--ink);
  font-size: 13px;
  color: var(--faint);
}

.modal-hint {
  margin: -2px 0 0;
  min-height: 2.6em;
  font-size: 10px;
  line-height: 1.7;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.modal-hint--warn {
  color: var(--warn);
}

.modal-hint--danger {
  color: var(--danger);
}

.modal-hint--ok {
  color: var(--ink);
}

.modal-progress {
  height: 10px;
  border: 1px solid var(--ink);
}

.modal-progress-bar {
  height: 100%;
  width: 0;
  background: var(--ink);
  transition: width 0.12s linear;
}

.modal-text {
  margin: 0;
  font-size: 11px;
  line-height: 1.75;
  color: var(--muted);
}

.modal-text strong {
  color: var(--ink);
}

.modal-text--muted {
  font-size: 10px;
  color: var(--faint);
}

/* Le bouton d'envoi occupe toute la largeur, collé au bas de la fenêtre. */
.modal-submit {
  display: block;
  width: 100%;
  border: 0;
  border-top: 1px solid var(--ink);
}

/* ---- Alerte de taille (orange puis rouge) ------------------------------- */
.size-warning {
  margin: 0;
  border-top: 1px solid var(--ink);
  padding: 12px 18px;
  font-size: 10px;
  line-height: 1.7;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.size-warning::before {
  content: '⚠ Attention ';
  font-weight: 700;
  letter-spacing: 0.14em;
}

.size-warning--warn {
  background: var(--warn-bg);
  color: var(--warn);
  box-shadow: inset 6px 0 0 var(--warn);
}

.size-warning--danger {
  background: var(--danger-bg);
  color: var(--danger);
  box-shadow: inset 6px 0 0 var(--danger);
}

/* ---- Code généré -------------------------------------------------------- */
.code-panel {
  border-top: 1px solid var(--ink);
}

.code-preview {
  margin: 0;
  padding: 16px 18px;
  max-height: 220px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre;
  color: var(--ink);
  background: repeating-linear-gradient(
    180deg,
    transparent 0 19.2px,
    color-mix(in srgb, var(--ink) 4%, transparent) 19.2px 38.4px
  );
}

/* ---- Pied de page ------------------------------------------------------- */
.page-footer {
  border-top: 2px solid var(--ink);
  padding: 11px 18px;
  background: var(--panel);
  font-size: 10px;
  line-height: 1.7;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-align: center;
}

.page-footer p {
  margin: 0;
}

.page-footer a {
  color: var(--ink);
  text-underline-offset: 3px;
}

.page-footer a:hover {
  opacity: 0.6;
}

.page-footer code {
  border: 1px solid var(--ink);
  padding: 1px 5px;
}

/* Ligne de copyright, sous le texte principal du pied de page */
.footer-meta {
  margin: 6px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  color: var(--faint);
}

.footer-meta a {
  color: var(--faint);
  text-underline-offset: 3px;
}

.footer-meta a:hover {
  color: var(--ink);
  opacity: 1;
}

.footer-meta-sep {
  color: var(--dim-soft);
}

/* ---- Adaptatif ---------------------------------------------------------- */
@media (max-width: 980px) {
  .panel-body {
    grid-template-columns: 1fr;
  }
  .stage {
    border-right: 0;
    border-bottom: 2px solid var(--ink);
  }
  .settings {
    gap: 16px;
  }
  .dims-info {
    margin-top: 0;
  }
}

@media (max-width: 720px) {
  .panel-head {
    padding: 52px 16px 14px;
  }
  .theme-toggle {
    top: 14px;
    right: 14px;
  }

  /* ---- Réorganisation tactile -------------------------------------------
     Sur bureau, .stage (import + les deux aperçus) occupe la colonne de
     gauche et .settings la colonne de droite. Sur téléphone, on garde
     exactement les mêmes éléments mais on change leur ordre : l'image
     d'origine d'abord, puis les réglages, puis le résultat pixel art juste
     en dessous — pour bouger un curseur et voir l'effet sans grand
     va-et-vient de défilement.
     .stage et #previews n'ont plus de boîte propre (display:contents) :
     leurs enfants deviennent des items directs de la colonne .panel-body,
     repositionnés via `order`. Aucun élément n'est déplacé dans le HTML. */
  .panel-body {
    display: flex;
    flex-direction: column;
  }
  .stage,
  #previews {
    display: contents;
  }

  #dropzone,
  .preview-col--original,
  .settings,
  .preview-col--pixel {
    padding: 14px;
  }
  #dropzone,
  .preview-col--original {
    order: 1;
    border-bottom: 2px solid var(--ink);
  }
  .settings {
    order: 2;
    border-bottom: 2px solid var(--ink);
  }
  .preview-col--pixel {
    order: 3;
  }
  /* Pas d'aperçu pixel art tant qu'aucune image n'est chargée : le filet
     sous .settings ferait alors doublon avec celui de .panel-body. */
  .panel-body:has(#previews[hidden]) .settings {
    border-bottom: 0;
  }

  /* Les cadres suivent la taille de leur image plutôt que d'étirer la
     hauteur restante de l'écran (pertinent seulement dans la colonne pleine
     hauteur du bureau) : plus de grandes zones à hachures vides à faire
     défiler sur mobile. */
  .frame {
    flex: none;
    min-height: 0;
  }
  .frame--original img {
    max-height: 45vh;
  }
  .frame--pixel canvas {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 45vh;
  }

  /* Curseurs : piste et curseur agrandis pour rester faciles à saisir au
     doigt. */
  .slider,
  .slider::-webkit-slider-runnable-track,
  .slider::-moz-range-track {
    height: 24px;
  }
  .slider::-webkit-slider-thumb {
    width: 22px;
    height: 24px;
  }
  .slider::-moz-range-thumb {
    width: 20px;
    height: 24px;
  }

  /* Barre d'export : une action pleine largeur par ligne, la plus
     importante (connecter/envoyer) en premier. */
  .export-bar {
    display: flex;
    flex-direction: column;
  }
  .export-size {
    order: 1;
    border-right: 0;
    border-bottom: 1px solid var(--ink);
  }
  .btn-link {
    order: 2;
    border-bottom: 1px solid var(--ink);
  }
  .calc-status {
    order: 3;
    margin-left: 0;
    justify-content: center;
    border-bottom: 1px solid var(--ink);
  }
  .btn-primary {
    order: 4;
    margin-left: 0;
    padding: 16px 10px;
    text-align: center;
  }
  .btn-secondary {
    order: 5;
    margin-left: 0;
    padding: 14px 10px;
    text-align: center;
    border-left: 0;
    border-top: 1px solid var(--ink);
  }

  /* 16px minimum : en dessous, Safari iOS zoome sur le champ au focus. */
  .modal-input {
    font-size: 16px;
  }
}

/* ---- Pages légères (About / Confidentialité) --------------------------- */
.legal-back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 20px 24px 0;
  padding: 6px 12px;
  border: 1px solid var(--ink);
  background: var(--panel);
  color: var(--ink);
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  text-decoration: none;
}

.legal-back:hover,
.legal-back:focus-visible {
  background: var(--ink);
  color: var(--onink);
}

.legal-body {
  flex: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 28px 24px 48px;
}

.legal-body h1 {
  margin: 0 0 6px;
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-transform: uppercase;
}

.legal-updated {
  margin: 0 0 28px;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}

.legal-body h2 {
  margin: 26px 0 8px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.legal-body p,
.legal-body li {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
}

.legal-body ul {
  margin: 0 0 10px;
  padding-left: 20px;
}

.legal-body strong {
  color: var(--ink);
}

.legal-body a {
  color: var(--ink);
}
