/* FRAGMENTS — feuille de style
 * Direction : « dossier sous la lampe ». Bureau d'acier olive, papiers vieillis, voyants ambrés.
 * Chaque scénario repeint le bureau (data-theme sur <body>).
 */
@font-face { font-family: 'Stencil'; src: url('../fonts/big-shoulders-stencil-display-latin-900-normal.woff2') format('woff2'); font-weight: 900; font-display: swap; }
@font-face { font-family: 'Stencil'; src: url('../fonts/big-shoulders-stencil-display-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Shoulders'; src: url('../fonts/big-shoulders-text-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Shoulders'; src: url('../fonts/big-shoulders-text-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Shoulders'; src: url('../fonts/big-shoulders-text-latin-800-normal.woff2') format('woff2'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'Typewriter'; src: url('../fonts/courier-prime-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Typewriter'; src: url('../fonts/courier-prime-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Typewriter'; src: url('../fonts/courier-prime-latin-400-italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Hand'; src: url('../fonts/caveat-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Hand'; src: url('../fonts/caveat-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --desk: #1b211a;
  --desk-2: #252c22;
  --desk-3: #323b2e;
  --rule: #48543f;
  --chalk: #e4e6d6;
  --chalk-dim: #a7ad97;
  --glow: #ffb24a;
  --glow-dim: #5e4520;
  --glow-ghost: rgba(255, 178, 74, 0.08);
  --paper: #e8dec6;
  --paper-2: #d9cba9;
  --ink: #26211a;
  --ink-soft: #5b5244;
  --red: #b8322a;
  --ok: #8fd18a;
  --blue: #1e4a73;
  --blue-line: #cfe3f2;
  --f-stencil: 'Stencil', 'Impact', sans-serif;
  --f-ui: 'Shoulders', 'Arial Narrow', sans-serif;
  --f-type: 'Typewriter', 'Courier New', monospace;
  --f-hand: 'Hand', 'Segoe Print', cursive;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
body[data-theme='train'] {
  --desk: #22151a; --desk-2: #301d24; --desk-3: #40272f; --rule: #5c3a44;
  --chalk: #f0e3d4; --chalk-dim: #bca596;
  --glow: #e8c07a; --glow-dim: #5f4a2b; --glow-ghost: rgba(232, 192, 122, 0.08);
}
body[data-theme='manoir'] {
  --desk: #19141f; --desk-2: #241c2c; --desk-3: #33283d; --rule: #4f3f5c;
  --chalk: #ece4f0; --chalk-dim: #ab9db6;
  --glow: #f3d38a; --glow-dim: #5b4a2a; --glow-ghost: rgba(243, 211, 138, 0.08);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background-color: var(--desk);
  background-image:
    radial-gradient(120% 70% at 50% -10%, rgba(255, 220, 160, 0.10), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
  color: var(--chalk);
  font-family: var(--f-ui);
  font-size: 18px;
  line-height: 1.4;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.6s;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; }
:focus-visible { outline: 2px solid var(--glow); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

#app { min-height: 100%; display: flex; flex-direction: column; }
.screen { flex: 1; display: flex; flex-direction: column; padding: calc(14px + var(--safe-t)) 18px calc(18px + var(--safe-b)); max-width: 560px; width: 100%; margin: 0 auto; }

/* ---------- barre du haut ---------- */
.topbar { display: flex; align-items: center; gap: 10px; min-height: 44px; margin-bottom: 10px; }
.topbar h2 { margin: 0; font-family: var(--f-stencil); font-weight: 700; font-size: 26px; letter-spacing: 0.04em; flex: 1; }
.iconbtn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--chalk-dim); }
.iconbtn:active { background: var(--desk-3); }
.iconbtn svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- accueil ---------- */
.home { justify-content: space-between; }
.lamp { position: fixed; inset: 0 0 auto 0; height: 60vh; pointer-events: none; background: radial-gradient(60% 55% at 50% 0%, rgba(255, 214, 150, 0.13), transparent 70%); animation: lamp 7s infinite; z-index: 0; }
@keyframes lamp { 0%, 91%, 100% { opacity: 1; } 92% { opacity: 0.35; } 93% { opacity: 1; } 95% { opacity: 0.6; } 96% { opacity: 1; } }
.home > * { position: relative; z-index: 1; }
.title-wrap { margin-top: 6vh; text-align: center; }
.scraps { display: flex; justify-content: center; gap: 2px; perspective: 600px; }
.scrap {
  display: inline-block; font-family: var(--f-stencil); font-weight: 900; font-size: clamp(44px, 13.4vw, 66px); line-height: 1;
  color: var(--ink); background: var(--paper); padding: 10px 3px 6px; min-width: 0.62em; text-align: center;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25), 0 10px 18px -8px rgba(0, 0, 0, 0.6);
  transform: translate(var(--dx), var(--dy)) rotate(var(--r));
  animation: scrap-in 0.9s cubic-bezier(.2, .9, .25, 1.1) backwards; animation-delay: var(--d);
}
.scrap:nth-child(3n) { background: var(--paper-2); }
.scrap.red { background: var(--red); color: var(--paper); }
@keyframes scrap-in { from { transform: translate(calc(var(--dx) * 9), calc(var(--dy) * 9 - 60px)) rotate(calc(var(--r) * 8)); opacity: 0; } }
.subtitle { margin: 18px auto 0; max-width: 30ch; color: var(--chalk-dim); font-size: 19px; }

.folders { display: grid; gap: 14px; margin: 26px 0 8px; }
.folder {
  position: relative; text-align: left; padding: 18px 20px 18px; border-radius: 4px 14px 14px 14px;
  background: linear-gradient(180deg, #d8bf8a, #c9ab70); color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 12px 24px -12px rgba(0, 0, 0, .8);
  margin-top: 14px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px;
}
.folder::before { content: ''; position: absolute; left: 0; top: -14px; width: 42%; height: 16px; background: inherit; border-radius: 6px 10px 0 0; clip-path: polygon(0 0, 88% 0, 100% 100%, 0 100%); }
.folder b { font-family: var(--f-stencil); font-weight: 900; font-size: 30px; letter-spacing: .02em; line-height: 1; }
.folder span { grid-column: 1; font-size: 16px; color: #4a3d2d; }
.folder svg { grid-row: 1 / 3; grid-column: 2; width: 34px; height: 34px; stroke: var(--ink); fill: none; stroke-width: 2.2; }
.folder.alt { background: linear-gradient(180deg, #a9b59a, #95a285); }
.folder:active { transform: translateY(2px); }
.minor { display: flex; justify-content: space-between; gap: 6px; margin-top: 10px; }
.minor button { flex: 1; padding: 12px 6px; color: var(--chalk-dim); font-weight: 600; font-size: 17px; display: flex; flex-direction: column; align-items: center; gap: 6px; border-radius: 10px; }
.minor button:active { background: var(--desk-3); }
.minor svg { width: 26px; height: 26px; stroke: var(--glow); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- formulaires / boutons ---------- */
.btn {
  display: flex; width: 100%; align-items: center; justify-content: center; gap: 10px; min-height: 56px; padding: 0 22px; border-radius: 12px;
  font-weight: 800; font-size: 21px; letter-spacing: .02em;
  background: var(--glow); color: #241a08;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .25), 0 0 24px -6px var(--glow);
}
.btn svg { width: 22px; height: 22px; flex: none; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.btn:active { transform: translateY(2px); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .25); }
.btn.ghost { background: transparent; color: var(--chalk); box-shadow: inset 0 0 0 1.5px var(--rule); }
.btn.danger { background: transparent; color: #ff8f84; box-shadow: inset 0 0 0 1.5px #6b2a26; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.stack { display: grid; gap: 12px; }
.label { font-size: 16px; color: var(--chalk-dim); font-weight: 600; margin: 18px 0 8px; }
.grow { flex: 1; }
