:root {
  --c-bg: #FFF6F8;
  --c-surface: #FFFFFF;
  --c-text: #2B1A20;
  --c-muted: #7A6670;
  --c-accent: #C2185B;
  --c-accent-light: #FCE4EC;
  --c-border: #EBD9DF;
  --c-error: #C62828;
  --c-ok: #2E7D32;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --c-bg: #1A1215;
    --c-surface: #261B1F;
    --c-text: #F5E9ED;
    --c-muted: #B8A3AB;
    --c-accent: #F06292;
    --c-accent-light: #3A2229;
    --c-border: #3D2D33;
    --c-error: #EF9A9A;
    --c-ok: #A5D6A7;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  padding: env(safe-area-inset-top) 16px calc(24px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
.hidden { display: none !important; }
h1 { font-size: 24px; margin: 8px 0; }
h2 { font-size: 18px; margin: 0 0 12px; }
.muted { color: var(--c-muted); }
.small { font-size: 13px; }
.error { color: var(--c-error); min-height: 1.2em; }
.status { min-height: 1.2em; font-size: 14px; margin: 8px 0 0; }
.status.ok { color: var(--c-ok); }
.status.err { color: var(--c-error); }
.label { font-weight: 600; margin: 12px 0 6px; }

.view { max-width: 560px; margin: 0 auto; }
.center-card { text-align: center; padding-top: 12vh; }
.logo { width: 72px; height: 72px; border-radius: 18px; }

input[type=text], input[type=password], textarea {
  width: 100%;
  font: inherit;
  font-size: 17px;
  padding: 12px 14px;
  border: 1.5px solid var(--c-border);
  border-radius: 12px;
  background: var(--c-surface);
  color: var(--c-text);
}
textarea { resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--c-accent); outline-offset: 1px; }

button { font: inherit; cursor: pointer; }
.btn-primary, .btn-secondary {
  display: inline-block;
  border: none;
  border-radius: 12px;
  padding: 13px 18px;
  font-weight: 700;
  font-size: 16px;
}
.btn-primary { width: 100%; margin-top: 12px; background: var(--c-accent); color: #fff; }
.btn-primary:disabled { opacity: 0.5; }
.btn-secondary { background: var(--c-accent-light); color: var(--c-accent); }
.link { background: none; border: none; color: var(--c-accent); padding: 6px 0; font-weight: 600; }
.link.danger { color: var(--c-error); margin-top: 8px; }

#form-login { display: flex; flex-direction: column; gap: 4px; max-width: 320px; margin: 24px auto 0; }
.inline-form { display: flex; gap: 8px; margin-top: 12px; }
.inline-form input { flex: 1; min-width: 0; }
.inline-form button { flex-shrink: 0; }

.who-list { display: flex; flex-direction: column; gap: 8px; margin: 20px 0; }
.who-list button {
  padding: 16px;
  border-radius: 12px;
  border: 1.5px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: 18px;
  font-weight: 700;
}

.top { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; }

.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.send-to { margin-bottom: 12px; font-weight: 600; }
.send-to select {
  font: inherit;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1.5px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text);
}

.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tab, .tool, .choice {
  border: 1.5px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text);
  border-radius: 10px;
  padding: 9px 10px;
  font-weight: 600;
  font-size: 14px;
}
.tab { flex: 1; }
.tab.active, .tool.active, .choice.active {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: #fff;
}

/* Cadre qui imite l'écran e-ink (800×480, ou 480×800 en portrait).
   Le ratio est porté par l'image elle-même : sur le cadre, la bordure
   le faussait et rognait le bas de l'aperçu. */
.screen-frame {
  margin: 10px auto 0;
  border: 6px solid #222;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.screen-frame.portrait { max-width: 62%; }
.screen-frame img, .screen-frame canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 5 / 3;
  image-rendering: pixelated;
}
.screen-frame.portrait img, .screen-frame.portrait canvas { aspect-ratio: 3 / 5; }
.orientation { display: flex; gap: 6px; margin-bottom: 12px; }
.orientation .tool { flex: 1; }
#draw-canvas { touch-action: none; }

.tools, .choices { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.file-btn { display: block; text-align: center; }
.slider { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 14px; }
.slider input { flex: 1; }
