:root {
  --ui-paper: #f3ead6;  --ui-paper-2: #e9dec4;  --ui-ink: #2a221c;  --ui-ink-2: #5a4c3f;
  --ui-line: rgba(70, 52, 34, .24);  --ui-brass: #b8945c;  --ui-brass-2: #896538;
  --ui-green: #2f4a3a;  --ui-oxblood: #6a2328;  --ui-shadow: 0 14px 40px rgba(18, 10, 4, .38);
  --ui-serif: 'Cormorant Garamond', Georgia, serif;
  --ui-type: 'Courier Prime', 'Courier New', monospace;
  --ui-radius: 10px;
  --chrome-ink: #efe4c8;           /* text drawn straight over the scene */
  --chrome-ink-2: rgba(239, 228, 200, .62);
  --capsule: rgba(20, 13, 8, .46);
  --paper-noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .25 0 0 0 0 .15 0 0 0 .08 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body.mood-morning {
  --chrome-ink: #2a221c;
  --chrome-ink-2: rgba(42, 34, 28, .66);
  --capsule: rgba(243, 234, 214, .62);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1a120c; color: var(--ui-ink); }
body { font-family: var(--ui-type); -webkit-font-smoothing: antialiased; touch-action: manipulation; }
body.mood-morning { background: #b9b0a2; }
body.mood-midnight { background: #07070a; }
button { font: inherit; color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

#stage { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; outline: none; cursor: default; }
#stage.can-pick { cursor: pointer; }
.vignette { position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 75% 70% at 50% 46%, transparent 55%, rgba(10, 6, 3, .42) 100%); }
body.mood-morning .vignette { background: radial-gradient(ellipse 80% 75% at 50% 46%, transparent 60%, rgba(60, 45, 30, .22) 100%); }

/* the hidden input that receives typing (and opens the keyboard on phones) */
.keys-input { position: fixed; left: 50%; bottom: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0;
  resize: none; font-size: 16px; caret-color: transparent; pointer-events: none; }

/* ---------------------------------------------------------------- brand + modes */
.brand { position: fixed; top: 18px; left: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 5; }
.wordmark { font-family: var(--ui-serif); font-style: italic; font-weight: 600; font-size: 38px; line-height: 1;
  color: var(--chrome-ink); letter-spacing: .01em; text-shadow: 0 2px 10px rgba(0, 0, 0, .35); position: relative; padding-bottom: 6px; }
.wordmark::after { content: ''; position: absolute; left: 2px; bottom: 0; width: 64px; height: 1.5px;
  background: linear-gradient(90deg, var(--ui-brass), transparent); }
body.mood-morning .wordmark { text-shadow: none; }
.modes { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--capsule);
  box-shadow: inset 0 0 0 1px rgba(176, 141, 87, .45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.modes button { border: 0; background: transparent; color: var(--chrome-ink-2); padding: 6px 16px; border-radius: 999px;
  font-size: 13px; letter-spacing: .08em; text-transform: uppercase; cursor: pointer; transition: color .2s, background .2s; }
.modes button[aria-selected="true"] { background: var(--ui-paper); color: var(--ui-ink); box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 2px 6px rgba(0,0,0,.25); }
.modes button:hover { color: var(--chrome-ink); }
.modes button[aria-selected="true"]:hover { color: var(--ui-ink); }

/* ---------------------------------------------------------------- tool keys (look like glass-top keys) */
.tools { position: fixed; top: 18px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 5; align-items: center; }
.tool { width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center;
  color: var(--ui-ink);
  background: radial-gradient(circle at 50% 38%, #fbf5e6 0 45%, #eadfc4 72%, #d8c9a7 100%);
  box-shadow: 0 0 0 2px #c9a466, 0 0 0 3px #7a5c2e, 0 4px 10px rgba(0, 0, 0, .45), inset 0 -3px 6px rgba(120, 90, 50, .25);
  transition: transform .08s ease, box-shadow .15s; }
.tool:hover { transform: translateY(-1px); }
.tool:active { transform: translateY(2px); box-shadow: 0 0 0 2px #c9a466, 0 0 0 3px #7a5c2e, 0 1px 3px rgba(0,0,0,.45), inset 0 -1px 3px rgba(120,90,50,.25); }
.tool[aria-pressed="true"], .tool.on { background: radial-gradient(circle at 50% 38%, #3f5f4d 0 45%, #2f4a3a 72%, #22372b 100%); color: #f3ead6; }
.tool:focus-visible, .btn:focus-visible, .modes button:focus-visible { outline: 2px solid #e8c78a; outline-offset: 3px; }
.tool-sep { width: 18px; height: 1px; background: rgba(176, 141, 87, .6); margin: 2px 0; }

/* ---------------------------------------------------------------- drawer */
.drawer { position: fixed; top: 14px; right: 80px; bottom: 14px; width: min(360px, calc(100vw - 100px)); z-index: 6;
  background: var(--paper-noise), linear-gradient(180deg, #f6eedc, var(--ui-paper) 30%, #efe4cc);
  border-radius: var(--ui-radius); box-shadow: var(--ui-shadow), inset 0 0 0 1px rgba(176, 141, 87, .45);
  display: flex; flex-direction: column; transform: translateX(24px); opacity: 0; pointer-events: none;
  transition: transform .28s cubic-bezier(.2, .8, .2, 1), opacity .2s; }
.drawer.open { transform: none; opacity: 1; pointer-events: auto; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 8px; border-bottom: 1px solid var(--ui-line); }
.drawer-head h2 { margin: 0; font-family: var(--ui-serif); font-weight: 600; font-size: 26px; letter-spacing: .01em; }
.x { border: 0; background: transparent; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; color: var(--ui-ink-2); }
.x:hover { background: rgba(70, 52, 34, .08); color: var(--ui-ink); }
.drawer-body { overflow-y: auto; padding: 6px 18px 22px; scrollbar-width: thin; scrollbar-color: rgba(140, 107, 60, .5) transparent; }

.sec { padding: 14px 0 6px; border-bottom: 1px dashed rgba(70, 52, 34, .18); }
.sec:last-child { border-bottom: 0; }
.sec h3 { margin: 0 0 10px; font: 700 11px/1 var(--ui-type); letter-spacing: .16em; text-transform: uppercase; color: var(--ui-ink-2); display: flex; justify-content: space-between; }
.sec h3 em { font-style: normal; font-weight: 400; letter-spacing: .04em; text-transform: none; color: var(--ui-ink); font-size: 12px; }
.sec p.note { margin: 6px 0 4px; font-size: 12px; color: var(--ui-ink-2); line-height: 1.45; }

.swatches { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px 8px; }
.sw { border: 0; background: none; padding: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.sw i { width: 40px; height: 40px; border-radius: 50%; display: block; position: relative;
  box-shadow: inset 0 -6px 10px rgba(0,0,0,.28), inset 0 5px 8px rgba(255,255,255,.28), 0 2px 4px rgba(0,0,0,.25); }
.sw i::after { content: ''; position: absolute; left: 22%; top: 14%; width: 34%; height: 18%; border-radius: 50%; background: rgba(255,255,255,.45); filter: blur(1.5px); }
.sw span { font-size: 10px; line-height: 1.15; text-align: center; color: var(--ui-ink-2); max-width: 64px; }
.sw[aria-checked="true"] i { box-shadow: 0 0 0 2px var(--ui-paper), 0 0 0 3.5px var(--ui-brass-2), inset 0 -6px 10px rgba(0,0,0,.28), inset 0 5px 8px rgba(255,255,255,.28); }
.sw[aria-checked="true"] span { color: var(--ui-ink); font-weight: 700; }
.swatches.paper .sw i { border-radius: 4px; width: 34px; height: 44px; box-shadow: 0 2px 5px rgba(0,0,0,.25), inset 0 0 0 1px rgba(0,0,0,.08); }
.swatches.paper .sw i::after { display: none; }
.swatches.paper .sw[aria-checked="true"] i { box-shadow: 0 0 0 2px var(--ui-paper), 0 0 0 3.5px var(--ui-brass-2), 0 2px 5px rgba(0,0,0,.25); }
.swatches.paper { grid-template-columns: repeat(6, 1fr); }

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { flex: 1 1 auto; min-width: 0; border: 1px solid rgba(140, 107, 60, .55); background: rgba(255, 255, 255, .35); border-radius: 7px;
  padding: 7px 9px; font-size: 12.5px; cursor: pointer; color: var(--ui-ink); transition: background .15s, color .15s; }
.seg button:hover { background: rgba(255, 255, 255, .7); }
.seg button[aria-checked="true"] { background: var(--ui-green); border-color: var(--ui-green); color: #f3ead6; }
.seg.fonts button { font-size: 17px; padding: 8px 6px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.seg.fonts button small { font: 10px var(--ui-type); letter-spacing: .08em; text-transform: uppercase; opacity: .7; }

.ribbons { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.rb { border: 0; background: none; cursor: pointer; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 10px; color: var(--ui-ink-2); }
.rb i { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle, #d9d6d0 0 22%, #8c8a86 24% 27%, var(--a) 29% 62%, var(--b) 62% 96%, transparent 98%);
  box-shadow: 0 2px 4px rgba(0,0,0,.3); }
.rb[aria-checked="true"] i { box-shadow: 0 0 0 2px var(--ui-paper), 0 0 0 3.5px var(--ui-brass-2); }
.rb[aria-checked="true"] { color: var(--ui-ink); font-weight: 700; }

.range { display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--ui-ink-2); }
.range input { flex: 1; accent-color: var(--ui-green); }
input[type=range] { -webkit-appearance: none; appearance: none; height: 22px; background: transparent; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--ui-brass-2), #d8c39b); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #fbf5e6, #d8c9a7); box-shadow: 0 0 0 1.5px var(--ui-brass-2), 0 2px 4px rgba(0,0,0,.3); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--ui-brass-2), #d8c39b); }
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; border: 0;
  background: radial-gradient(circle at 50% 35%, #fbf5e6, #d8c9a7); box-shadow: 0 0 0 1.5px var(--ui-brass-2), 0 2px 4px rgba(0,0,0,.3); }

.toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; padding: 4px 0; cursor: pointer; }
.toggle input { display: none; }
.toggle b { width: 40px; height: 22px; border-radius: 11px; background: #cbbd9c; position: relative; flex: none; transition: background .2s; box-shadow: inset 0 1px 2px rgba(0,0,0,.2); }
.toggle b::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fbf5e6; box-shadow: 0 1px 3px rgba(0,0,0,.35); transition: transform .2s; }
.toggle input:checked + b { background: var(--ui-green); }
.toggle input:checked + b::after { transform: translateX(18px); }

.stepper { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.stepper label { flex: 1; }
.stepper button { width: 28px; height: 28px; border-radius: 50%; border: 1px solid rgba(140, 107, 60, .55); background: rgba(255,255,255,.4); cursor: pointer; }
.stepper output { min-width: 28px; text-align: center; font-weight: 700; }

.btn { display: block; width: 100%; text-align: left; border: 1px solid rgba(140, 107, 60, .5); background: rgba(255, 255, 255, .4);
  border-radius: 8px; padding: 9px 12px; margin: 6px 0; cursor: pointer; font-size: 13px; color: var(--ui-ink); transition: background .15s; }
.btn:hover { background: rgba(255, 255, 255, .75); }
.btn.primary { background: var(--ui-green); color: #f3ead6; border-color: var(--ui-green); text-align: center; }
.btn.primary:hover { background: #3a5a48; }
.btn.danger { color: var(--ui-oxblood); }
.btn.ghost { border-color: transparent; background: transparent; text-align: center; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; }

.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding-top: 4px; }
.thumb { border: 0; padding: 0; background: none; cursor: pointer; display: flex; flex-direction: column; gap: 4px; align-items: center; font-size: 11px; color: var(--ui-ink-2); }
.thumb canvas { width: 100%; aspect-ratio: 85 / 110; display: block; border-radius: 2px; box-shadow: 0 2px 6px rgba(0,0,0,.28), 0 0 0 1px rgba(0,0,0,.06); transition: transform .15s; }
.thumb:hover canvas { transform: translateY(-2px) rotate(-.6deg); }
.thumb.current span { color: var(--ui-green); font-weight: 700; }

.keys-help { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.keys-help td { padding: 5px 0; border-bottom: 1px dotted rgba(70,52,34,.2); vertical-align: top; }
.keys-help td:first-child { white-space: nowrap; padding-right: 12px; }
kbd { font: 700 11px var(--ui-type); padding: 2px 6px; border-radius: 4px; background: #fbf5e6; box-shadow: 0 0 0 1px rgba(140,107,60,.55), 0 2px 0 rgba(140,107,60,.4); }

/* ---------------------------------------------------------------- status */
.status { position: fixed; left: 20px; bottom: 16px; display: flex; align-items: center; gap: 14px; z-index: 4; font-size: 12px;
  color: var(--chrome-ink-2); padding: 7px 14px; border-radius: 999px; background: var(--capsule);
  box-shadow: inset 0 0 0 1px rgba(176, 141, 87, .3); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); max-width: calc(100vw - 40px); }
.status .st-words { color: var(--chrome-ink); }
.hint { color: var(--chrome-ink); opacity: 0; transition: opacity .4s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hint.show { opacity: .95; }
.ribbon-lever { display: inline-flex; flex-direction: column; width: 16px; height: 20px; padding: 0; border: 0; border-radius: 3px; overflow: hidden; cursor: pointer;
  box-shadow: 0 0 0 1.5px rgba(176,141,87,.8); }
.ribbon-lever i { flex: 1; background: #1b1a1a; transition: flex .2s; }
.ribbon-lever i + i { background: #a3201b; }
.ribbon-lever.red i:first-child { flex: .35; } .ribbon-lever:not(.red) i + i { flex: .35; }

/* ---------------------------------------------------------------- draw bar */
.drawbar { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 4; display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: 14px; background: var(--paper-noise), var(--ui-paper);
  box-shadow: var(--ui-shadow), inset 0 0 0 1px rgba(176, 141, 87, .5); font-size: 12.5px; max-width: calc(100vw - 24px); overflow-x: auto; scrollbar-width: none; }
.drawbar[hidden] { display: none; }
.db-main { display: flex; align-items: center; gap: 8px; border: 0; cursor: pointer; padding: 8px 14px; border-radius: 10px; background: var(--ui-green); color: #f3ead6; white-space: nowrap; }
.db-main:hover { background: #3a5a48; }
.db-sep { width: 1px; align-self: stretch; background: var(--ui-line); margin: 0 2px; }
.db-label { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ui-ink-2); }
.db-t, .db-seg button { border: 1px solid rgba(140, 107, 60, .5); background: rgba(255, 255, 255, .35); border-radius: 8px; padding: 6px 10px; cursor: pointer; white-space: nowrap; }
.db-t[aria-pressed="true"], .db-seg button.on { background: var(--ui-ink); color: #f3ead6; border-color: var(--ui-ink); }
.db-seg { display: flex; gap: 4px; }
.db-stop { border: 0; border-radius: 8px; padding: 7px 12px; background: var(--ui-oxblood); color: #f3ead6; cursor: pointer; }

.progress { position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%); z-index: 4; display: flex; align-items: center; gap: 12px;
  padding: 8px 10px 8px 16px; border-radius: 999px; background: var(--capsule); color: var(--chrome-ink); font-size: 12px;
  box-shadow: inset 0 0 0 1px rgba(176, 141, 87, .4); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.progress[hidden] { display: none; }
.progress .bar { width: 160px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.18); overflow: hidden; }
.progress .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--ui-brass), #e7c98e); }
.progress button { border: 0; border-radius: 999px; padding: 5px 12px; background: var(--ui-oxblood); color: #f3ead6; cursor: pointer; font-size: 12px; }

/* ---------------------------------------------------------------- reading view */
.modal { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; gap: 28px; padding: 28px;
  background: rgba(14, 9, 5, .78); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); opacity: 0; pointer-events: none; transition: opacity .25s; }
.modal.open { opacity: 1; pointer-events: auto; }
.reader-sheet { height: 100%; max-height: calc(100vh - 56px); aspect-ratio: 2040 / 2640; max-width: calc(100vw - 340px); overflow: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6); border-radius: 2px; background: #f3ecdc; }
.reader-sheet canvas { width: 100%; display: block; }
.reader-sheet.zoomed { aspect-ratio: auto; }
.reader-sheet.zoomed canvas { width: 200%; }
.reader-side { width: 240px; flex: none; padding: 18px; border-radius: var(--ui-radius); background: var(--paper-noise), var(--ui-paper);
  box-shadow: var(--ui-shadow), inset 0 0 0 1px rgba(176, 141, 87, .45); }
.reader-side h2 { margin: 0 0 2px; font-family: var(--ui-serif); font-size: 28px; font-weight: 600; }
.reader-meta { margin: 0 0 12px; font-size: 12px; color: var(--ui-ink-2); }

/* ---------------------------------------------------------------- welcome, toast, loader */
.welcome { position: fixed; inset: 0; z-index: 15; display: grid; place-items: center; padding: 20px; background: rgba(14, 9, 5, .38); }
.welcome[hidden] { display: none; }
.welcome .card { width: min(440px, 100%); padding: 30px 32px 22px; border-radius: 4px; transform: rotate(-.8deg);
  background: var(--paper-noise), linear-gradient(180deg, #f8f1e1, #efe5cd); box-shadow: 0 24px 60px rgba(0,0,0,.5), 0 2px 0 rgba(255,255,255,.6) inset;
  font-family: 'Special Elite', var(--ui-type); color: #2a221c; }
.welcome .w-kicker { margin: 0; font-family: var(--ui-type); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--ui-ink-2); }
.welcome h1 { margin: 2px 0 12px; font-family: var(--ui-serif); font-style: italic; font-weight: 600; font-size: 56px; line-height: 1; color: var(--ui-green); }
.welcome p { font-size: 15px; line-height: 1.55; margin: 0 0 12px; }
.welcome b { font-weight: normal; background: linear-gradient(transparent 62%, rgba(176, 141, 87, .38) 62%); }
.welcome .btn.primary { margin-top: 18px; padding: 12px; font-family: var(--ui-type); font-size: 14px; letter-spacing: .06em; }
.welcome .w-small { font-family: var(--ui-type); font-size: 11px; color: var(--ui-ink-2); text-align: center; margin: 10px 0 0; }

.toast { position: fixed; left: 50%; top: 22px; transform: translate(-50%, -10px); z-index: 30; padding: 9px 16px; border-radius: 999px; font-size: 13px;
  background: var(--ui-paper); color: var(--ui-ink); box-shadow: var(--ui-shadow), inset 0 0 0 1px rgba(176,141,87,.5); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.loader { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: #1a120c; color: #e9dcbc; font-size: 13px; letter-spacing: .1em;
  transition: opacity .6s; }
.loader span::after { content: ''; display: inline-block; width: 7px; height: 14px; margin-left: 4px; vertical-align: -2px; background: currentColor; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
body:not(.loading) .loader { opacity: 0; pointer-events: none; }

.kbd-btn { position: fixed; right: 18px; bottom: 16px; z-index: 5; width: 52px; height: 52px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center;
  color: var(--ui-ink); background: radial-gradient(circle at 50% 38%, #fbf5e6 0 45%, #eadfc4 72%, #d8c9a7 100%);
  box-shadow: 0 0 0 2px #c9a466, 0 0 0 3px #7a5c2e, 0 4px 10px rgba(0,0,0,.45); }
.kbd-btn svg { width: 24px; height: 24px; }
.kbd-btn[hidden] { display: none; }

/* hide chrome in focus mode */
body.focus .brand, body.focus .tools, body.focus .status, body.focus .drawbar { opacity: 0; pointer-events: none; transition: opacity .6s; }
.brand, .tools, .status, .drawbar { transition: opacity .4s; }

/* ---------------------------------------------------------------- small screens */
@media (max-width: 720px) {
  .brand { top: 12px; left: 14px; gap: 8px; }
  .wordmark { font-size: 30px; }
  .tools { top: auto; bottom: 74px; right: 12px; gap: 9px; }
  .tool { width: 40px; height: 40px; }
  .tools [data-panel="help"], .tools #btnFull, .tool-sep { display: none; }
  .drawer { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 72vh; transform: translateY(24px); }
  .status { left: 12px; bottom: 14px; gap: 10px; font-size: 11px; max-width: calc(100vw - 90px); }
  .status .hint { display: none; }
  .drawbar { bottom: 70px; }
  .modal { flex-direction: column; gap: 12px; padding: 12px; }
  .reader-sheet { max-width: 100%; height: auto; width: 100%; max-height: 60vh; }
  .reader-side { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; padding: 12px; }
  .reader-side h2, .reader-side p { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  .drawer, .modal, .toast { transition-duration: .01s; }
}
@media print {
  body * { visibility: hidden; }
}

/* ---------------------------------------------------------------- calm chrome: quiet glass controls */
:root { --glass: rgba(16, 11, 8, .34); --glass-hi: rgba(26, 19, 14, .62); --glass-ring: rgba(201, 164, 102, .4); --glass-ink: #eadfc5; }
body.mood-morning { --glass: rgba(246, 240, 228, .5); --glass-hi: rgba(250, 246, 238, .82); --glass-ring: rgba(140, 107, 60, .45); --glass-ink: #2a221c; }
.wordmark { font-size: 31px; font-weight: 500; opacity: .9; text-shadow: 0 2px 14px rgba(0, 0, 0, .3); }
.wordmark::after { width: 46px; height: 1px; }
.modes { padding: 2px; background: var(--glass); box-shadow: inset 0 0 0 1px var(--glass-ring); }
.modes button { padding: 5px 14px; font-size: 11px; letter-spacing: .16em; color: rgba(234, 223, 197, .62); }
body.mood-morning .modes button { color: rgba(42, 34, 28, .62); }
.modes button[aria-selected="true"] { background: rgba(239, 228, 200, .9); color: #2a221c; box-shadow: none; }
.tools { gap: 8px; right: 18px; }
.tool { width: 38px; height: 38px; color: var(--glass-ink); background: var(--glass); box-shadow: inset 0 0 0 1px var(--glass-ring);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: background .25s, color .25s, box-shadow .25s, transform .1s; }
.tool svg { width: 18px; height: 18px; stroke-width: 1.4; }
.tool:hover { transform: none; background: var(--glass-hi); box-shadow: inset 0 0 0 1px rgba(214, 180, 120, .85); }
.tool:active { transform: scale(.95); box-shadow: inset 0 0 0 1px rgba(214, 180, 120, .85); }
.tool[aria-pressed="true"], .tool.on { background: rgba(239, 228, 200, .92); color: #2a221c; box-shadow: none; }
.tool-sep { width: 12px; background: var(--glass-ring); }
.status { font-size: 11.5px; padding: 6px 13px; gap: 12px; background: var(--glass); box-shadow: inset 0 0 0 1px rgba(201, 164, 102, .2); color: rgba(234, 223, 197, .6); }
.status .st-words { color: rgba(234, 223, 197, .85); }
body.mood-morning .status { color: rgba(42, 34, 28, .65); }
body.mood-morning .status .st-words { color: #2a221c; }
.drawbar { background: var(--glass-hi); color: var(--glass-ink); box-shadow: inset 0 0 0 1px var(--glass-ring), 0 10px 30px rgba(0, 0, 0, .25);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.db-label { color: rgba(234, 223, 197, .55); }
body.mood-morning .db-label { color: rgba(42, 34, 28, .6); }
.db-sep { background: var(--glass-ring); }
.db-t, .db-seg button { border-color: rgba(201, 164, 102, .35); background: transparent; color: var(--glass-ink); }
.db-t:hover, .db-seg button:hover { background: rgba(255, 255, 255, .07); }
.db-t[aria-pressed="true"], .db-seg button.on { background: rgba(239, 228, 200, .92); color: #2a221c; border-color: transparent; }
.db-main { background: #2a4335; box-shadow: inset 0 0 0 1px rgba(201, 164, 102, .5); }
.db-main:hover { background: #33503f; }
.kbd-btn { color: var(--glass-ink); background: var(--glass-hi); box-shadow: inset 0 0 0 1px var(--glass-ring); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.progress { background: var(--glass-hi); }
.progress button { background: rgba(239, 228, 200, .92); color: #2a221c; }
.progress button.ghost { background: transparent; color: var(--glass-ink); box-shadow: inset 0 0 0 1px var(--glass-ring); }
.grain { position: fixed; inset: 0; pointer-events: none; z-index: 2; opacity: .07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E"); }
/* the chrome steps back while you type; moving the pointer brings it back */
.brand, .tools, .status, .drawbar { transition: opacity 1.4s ease; }
body.typing .brand, body.typing .tools, body.typing .status, body.typing .drawbar { opacity: .14; }
body.typing .brand:hover, body.typing .tools:hover, body.typing .status:hover, body.typing .drawbar:hover { opacity: 1; transition-duration: .2s; }
.ribbon-lever[hidden] { display: none; }
.db-guide { display: inline-flex; align-items: center; gap: 6px; }
.db-guide svg { width: 16px; height: 16px; }

/* ---------------------------------------------------------------- save as image */
.ex-preview { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-width: 0; }
.ex-stage { display: grid; place-items: center; border-radius: 3px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); overflow: hidden; background: #2a221c; }
.ex-stage.checker { background: repeating-conic-gradient(#d9d2c4 0 25%, #f3eee4 0 50%) 0 0 / 22px 22px; }
.ex-stage canvas { display: block; width: auto; height: auto; max-width: calc(100vw - 360px); max-height: calc(100vh - 110px); }
.ex-meta { margin: 0; font-size: 12px; color: rgba(234, 223, 197, .72); letter-spacing: .04em; }
.ex-side .sec { padding: 10px 0 6px; }
.ex-side .btn.primary { margin-top: 14px; }
.seg button[disabled] { opacity: .35; cursor: default; }
.ex-busy { opacity: .6; pointer-events: none; }
@media (max-width: 720px) {
  .ex-stage canvas { max-width: calc(100vw - 24px); max-height: 46vh; }
  .ex-side .sec, .ex-side .btn { grid-column: 1 / -1; }
}
@media (max-width: 720px) { #exporter { justify-content: flex-start; overflow-y: auto; } }
.kbd-btn[aria-pressed="true"] { background: rgba(239, 228, 200, .92); color: #2a221c; box-shadow: none; }
#stage { touch-action: none; }

/* Finition éditoriale : panneaux plus chaleureux, sans quitter l'ambiance d'un bureau d'écrivain. */
.drawer { border: 1px solid rgba(176,141,87,.35); }
.sec h3 { color: #725638; }
.btn, .seg button, .stepper button { transition: background .16s ease, border-color .16s ease, transform .12s ease; }
.btn:active, .seg button:active { transform: translateY(1px); }
::selection { background: rgba(105, 47, 45, .22); }

/* L'Atelier — identité originale des panneaux : reliure sombre, laiton et papier d'archive */
.drawer {
  width: min(390px, calc(100vw - 96px));
  right: 76px; top: 12px; bottom: 12px;
  color: #eadfc8;
  background: linear-gradient(155deg, #26382d 0%, #18271f 54%, #101b16 100%);
  border: 1px solid rgba(195, 157, 94, .78);
  border-radius: 5px 16px 16px 5px;
  box-shadow: 0 22px 65px rgba(0,0,0,.55), inset 5px 0 0 rgba(194,154,87,.12), inset 0 0 0 4px rgba(245,224,177,.035);
}
.drawer::before { content: ''; position: absolute; left: 12px; top: 14px; bottom: 14px; width: 1px; background: linear-gradient(transparent, rgba(199,163,103,.5), transparent); pointer-events:none; }
.drawer-head { padding: 20px 18px 14px 26px; border-bottom: 1px solid rgba(202,166,105,.38); }
.drawer-head h2 { color: #f0dfb8; font-family: var(--ui-serif); font-size: 30px; font-weight: 500; letter-spacing: .015em; }
.drawer-head h2::after { content: '  /  CARNET DE BORD'; display: block; margin-top: 4px; color: #c4a46c; font: 9px var(--ui-type); letter-spacing: .2em; }
.drawer .x { color: #e6d3aa; border: 1px solid rgba(201,164,102,.35); border-radius: 3px; }
.drawer .x:hover { color: #fff2d4; background: rgba(201,164,102,.14); }
.drawer-body { padding: 8px 16px 24px 26px; scrollbar-color: #9b7949 transparent; }
.drawer .sec { margin: 7px 0 0; padding: 15px 13px 12px; border: 1px solid rgba(200,165,108,.28); border-left: 2px solid #a9814c; background: linear-gradient(135deg, rgba(248,231,194,.075), rgba(0,0,0,.08)); }
.drawer .sec + .sec { margin-top: 10px; }
.drawer .sec h3 { color: #c9a86e; font-size: 10px; letter-spacing: .19em; }
.drawer .sec h3 em { color: #f0dfbf; }
.drawer .sec p.note { color: #c7bda6; }
.drawer .seg button, .drawer .stepper button, .drawer .btn, .drawer .db-t { color: #efe2c8; border-color: rgba(204,169,111,.5); background: rgba(6,13,9,.36); border-radius: 3px; }
.drawer .seg button:hover, .drawer .btn:hover, .drawer .stepper button:hover { background: rgba(203,165,102,.18); }
.drawer .seg button[aria-checked="true"], .drawer .btn.primary { background: #c19a5e; border-color: #d4b578; color: #1e291f; font-weight: 700; }
.drawer .btn.danger { color: #f0aaa0; }
.drawer .sw span, .drawer .rb { color: #d1c4a8; }
.drawer .sw[aria-checked="true"] span, .drawer .rb[aria-checked="true"] { color: #f6e5c0; }
.drawer .range { color: #d3c5a8; }
.drawer .range input { accent-color: #c39a5c; }
.drawer .toggle { color: #eee0c4; }
.drawer .toggle b { background: #596352; }
.drawer .toggle input:checked + b { background: #c39a5c; }
.drawer .toggle input:checked + b::after { background: #fff0cf; }
.drawer .thumb.current span { color: #e4c17e; }
.drawer .keys-help td { border-bottom-color: rgba(207,172,112,.22); }
.drawer kbd { color: #243127; background: #ead9b4; box-shadow: 0 0 0 1px #b18a50, 0 2px 0 #80603a; }
.drawer .sw[aria-checked="true"] i, .drawer .rb[aria-checked="true"] i { box-shadow: 0 0 0 2px #26382d, 0 0 0 3.5px #d1ad70; }
@media (max-width: 560px) { .drawer { right: 8px; width: calc(100vw - 16px); } }

/* Marges faciles à comprendre : presets + aperçu de la feuille + curseurs */
.margin-intro { margin: 0 0 12px; color: #e1d3b7; font: 13px/1.5 var(--ui-type); }
.margin-presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 10px 0 14px; }
.margin-preset { min-width: 0; min-height: 61px; padding: 9px 5px 7px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; text-align: left; color: #e9ddc5; background: rgba(5,12,8,.38); border: 1px solid rgba(204,169,111,.38); border-radius: 3px; cursor: pointer; }
.margin-preset strong { font: 600 12px var(--ui-type); }
.margin-preset small { font: 10px/1.3 var(--ui-type); color: #bfb39b; }
.margin-preset:hover { border-color: #d5b779; background: rgba(203,165,102,.12); }
.margin-preset.active { border-color: #e0bc76; background: rgba(193,154,94,.22); box-shadow: inset 0 -2px #c19a5e; }
.margin-preset.active strong { color: #ffe5ae; }
.margin-preview-wrap { padding: 10px 0 4px; }
.margin-preview-paper { position: relative; width: min(100%, 220px); aspect-ratio: 8.5 / 11; margin: 0 auto; overflow: hidden; background: #f5eedc; border: 1px solid #d5c6a7; box-shadow: 0 5px 13px rgba(0,0,0,.28); }
.margin-zone { position: absolute; top: 0; bottom: 0; background: rgba(170,91,66,.18); border-color: rgba(145,66,48,.42); }
.margin-zone-left { left: 0; border-right: 1px dashed rgba(145,66,48,.7); }
.margin-zone-right { right: 0; border-left: 1px dashed rgba(145,66,48,.7); }
.margin-writing-area { position: absolute; top: 18%; bottom: 12%; display: flex; flex-direction: column; justify-content: flex-start; gap: 9%; padding-top: 2%; }
.margin-line { display: block; height: 2px; flex: 0 0 2px; background: rgba(48,60,46,.62); width: 100%; }
.margin-line.short { width: 52%; }
.margin-line.medium { width: 76%; }
.margin-edge-label { position: absolute; bottom: 4px; color: #8b4635; font: 700 7px var(--ui-type); letter-spacing: .08em; }
.margin-left-label { left: 3px; }
.margin-right-label { right: 3px; }
.margin-preview-caption { margin: 8px 0 0; text-align: center; color: #bfb39b; font: 10px/1.4 var(--ui-type); }
.margin-settings { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 14px; }
.margin-setting { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 7px 10px; }
.margin-setting label { color: #f0e3c8; font: 600 13px var(--ui-type); }
.margin-value { color: #f0c985; font: 700 13px var(--ui-type); font-variant-numeric: tabular-nums; }
.margin-setting input[type="range"] { grid-column: 1 / -1; width: 100%; margin: 1px 0; accent-color: #c39a5c; cursor: ew-resize; }
.margin-help { grid-column: 1 / -1; margin: -2px 0 0; color: #bfb39b; font: 11px/1.4 var(--ui-type); }
@media (max-width: 420px) { .margin-presets { grid-template-columns: 1fr; } .margin-preset { min-height: 48px; } }

/* V17 — réglages de marges inspirés des traitements de texte, adaptés à la machine */
.margin-settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
.margin-setting-number { min-width: 0; grid-template-columns: 1fr; gap: 6px; padding: 11px; border: 1px solid rgba(205,177,122,.25); border-radius: 8px; background: rgba(8,17,13,.34); }
.margin-setting-number label { font-size: 12px; }
.margin-number-wrap { display: flex; align-items: center; gap: 7px; }
.margin-number-wrap input { box-sizing: border-box; width: 100%; min-width: 0; padding: 8px 7px; color: #f7e8c7; background: #111b15; border: 1px solid #8b7046; border-radius: 5px; font: 700 15px var(--ui-type); font-variant-numeric: tabular-nums; }
.margin-number-wrap input:focus { outline: 2px solid #d9b574; outline-offset: 1px; }
.margin-number-wrap span { color: #d8bd84; font: 600 12px var(--ui-type); }
.margin-setting-number .margin-help { margin: 0; font-size: 10px; }
.margin-zone-top, .margin-zone-bottom { left: 0; right: 0; }
.margin-zone-top { top: 0; border-bottom: 1px dashed rgba(145,66,48,.7); }
.margin-zone-bottom { bottom: 0; border-top: 1px dashed rgba(145,66,48,.7); }
.margin-writing-area { gap: 5%; padding-top: 0; }
.margin-top-label { top: 2px; left: 4px; bottom: auto; }
.margin-bottom-label { bottom: 2px; left: 4px; }
@media (max-width: 420px) { .margin-settings-grid { grid-template-columns: 1fr; } }
.margin-zone-top { bottom: auto; }
.margin-zone-bottom { top: auto; }

/* V19 — finition éditoriale chic : ivoire, vert profond et laiton discret */
.drawer {
  width: min(410px, calc(100vw - 96px));
  color: #26372d;
  background: linear-gradient(155deg, #f8f3e8 0%, #eee5d2 100%);
  border: 1px solid rgba(165, 126, 66, .72);
  border-radius: 8px 18px 18px 8px;
  box-shadow: 0 24px 70px rgba(0,0,0,.42), inset 0 0 0 4px rgba(255,255,255,.45);
}
.drawer::before { left: 9px; top: 14px; bottom: 14px; background: linear-gradient(transparent, rgba(164,126,67,.42), transparent); }
.drawer-head { padding: 23px 20px 17px 27px; border-bottom: 1px solid rgba(122,94,54,.22); }
.drawer-head h2 { color: #233a2d; font-size: 31px; letter-spacing: -.015em; }
.drawer-head h2::after { color: #927344; margin-top: 7px; font-size: 9px; letter-spacing: .24em; }
.drawer .x { color: #405344; border: 1px solid rgba(95,112,90,.28); background: rgba(255,255,255,.42); border-radius: 50%; width: 32px; height: 32px; }
.drawer .x:hover { color: #18271f; background: #e8dcc3; }
.drawer-body { padding: 12px 17px 28px 25px; scrollbar-color: #bca77f transparent; }
.drawer .sec { margin: 9px 0 0; padding: 17px 15px 14px; border: 1px solid rgba(103,91,65,.14); border-left: 2px solid #b99a62; border-radius: 7px; background: rgba(255,253,247,.76); box-shadow: 0 3px 12px rgba(54,43,26,.035); }
.drawer .sec + .sec { margin-top: 12px; }
.drawer .sec h3 { color: #8b7045; font-size: 10px; letter-spacing: .17em; margin-bottom: 12px; }
.drawer .sec h3 em { color: #304435; font: 500 13px var(--ui-serif); letter-spacing: 0; }
.drawer .sec p.note { color: #74705f; font-size: 12px; line-height: 1.55; }
.drawer .seg { gap: 7px; }
.drawer .seg button, .drawer .stepper button, .drawer .btn, .drawer .db-t {
  color: #344537; border: 1px solid #d6cbb4; background: #fbf8f0; border-radius: 5px;
  box-shadow: 0 1px 1px rgba(54,43,26,.04); transition: background .16s, border-color .16s, box-shadow .16s, transform .16s;
}
.drawer .seg button { padding: 9px 10px; }
.drawer .seg button:hover, .drawer .btn:hover, .drawer .stepper button:hover { background: #f0e8d8; border-color: #b99a62; }
.drawer .seg button[aria-checked="true"], .drawer .btn.primary { background: #2e4838; border-color: #2e4838; color: #f7f0df; box-shadow: 0 2px 5px rgba(32,52,39,.14); }
.drawer .btn.primary:hover { background: #3a5946; }
.drawer .btn.danger { color: #914c42; border-color: #d8b9ad; }
.drawer .sw span, .drawer .rb { color: #6e6a5c; }
.drawer .sw[aria-checked="true"] span, .drawer .rb[aria-checked="true"] { color: #253b2e; }
.drawer .range { color: #77705f; }
.drawer .range input { accent-color: #526c53; }
.drawer .toggle { color: #344537; }
.drawer .toggle b { background: #d5cbb6; }
.drawer .toggle input:checked + b { background: #526c53; }
.drawer .toggle input:checked + b::after { background: #fffaf0; }
.drawer .thumb.current span { color: #8b6c3b; }
.drawer .keys-help td { border-bottom-color: rgba(122,94,54,.18); }
.drawer kbd { color: #f7f0df; background: #344a3a; box-shadow: 0 1px 0 #1e3024; border: 1px solid #536b55; }
.drawer .sw[aria-checked="true"] i, .drawer .rb[aria-checked="true"] i { box-shadow: 0 0 0 2px #f8f3e8, 0 0 0 3.5px #b99a62; }

/* Marges : champs de formulaire nets et aperçu intégré au panneau éditorial */
.margin-intro { color: #666b5c; font: 13px/1.6 var(--ui-type); }
.margin-presets { gap: 8px; margin: 12px 0 17px; }
.margin-preset { min-height: 72px; padding: 11px 9px; color: #344537; background: rgba(255,253,247,.85); border: 1px solid #d9cfba; border-radius: 6px; box-shadow: 0 2px 5px rgba(54,43,26,.025); }
.margin-preset strong { color: #2e4032; font: 600 13px var(--ui-serif); }
.margin-preset small { color: #77715f; font: 10px/1.4 var(--ui-type); }
.margin-preset:hover { border-color: #b99a62; background: #fffdf7; }
.margin-preset.active { border-color: #a88950; background: #eee5d2; box-shadow: inset 0 -2px #a88950; }
.margin-preset.active strong { color: #263c2e; }
.margin-preview-wrap { padding: 14px 0 7px; }
.margin-preview-paper { width: min(100%, 224px); background: #fffdf6; border: 1px solid #d8cdb5; box-shadow: 0 8px 20px rgba(53,43,27,.12), 0 1px 2px rgba(53,43,27,.08); }
.margin-zone { background: rgba(183,147,88,.18); border-color: rgba(145,108,52,.48); }
.margin-zone-left { border-right-color: rgba(145,108,52,.58); }
.margin-zone-right { border-left-color: rgba(145,108,52,.58); }
.margin-zone-top { border-bottom-color: rgba(145,108,52,.58); }
.margin-zone-bottom { border-top-color: rgba(145,108,52,.58); }
.margin-writing-area .margin-line { background: rgba(47,68,51,.54); }
.margin-edge-label { color: #8b7045; }
.margin-preview-caption { color: #77715f; font: 11px/1.5 var(--ui-type); }
.margin-settings-grid { gap: 12px; }
.margin-setting-number { padding: 13px; border: 1px solid #ded4c0; border-radius: 7px; background: rgba(255,253,247,.92); box-shadow: 0 2px 6px rgba(54,43,26,.025); }
.margin-setting-number label { color: #334638; font: 600 13px var(--ui-serif); }
.margin-number-wrap { gap: 8px; }
.margin-number-wrap input { padding: 10px 9px; color: #26382c; background: #fffdf8; border: 1px solid #cfc3aa; border-radius: 4px; font: 600 16px var(--ui-type); box-shadow: inset 0 1px 2px rgba(55,43,25,.035); }
.margin-number-wrap input:hover { border-color: #a68a56; }
.margin-number-wrap input:focus { outline: 2px solid rgba(169,136,76,.42); outline-offset: 1px; border-color: #a68a56; }
.margin-number-wrap span { color: #8b7045; font: 600 12px var(--ui-type); }
.margin-setting-number .margin-help { color: #77715f; font: 10px/1.5 var(--ui-type); }
.drawer input[type="number"], .drawer input[type="text"], .drawer select, .drawer textarea { color: #26382c; }
.drawer button:focus-visible, .drawer input:focus-visible, .drawer select:focus-visible { outline: 2px solid #a88950; outline-offset: 2px; }
@media (max-width: 560px) {
  .drawer { background: linear-gradient(155deg, #f8f3e8 0%, #eee5d2 100%); }
  .drawer-head { padding: 18px 15px 13px 23px; }
  .drawer-body { padding: 9px 12px 22px 21px; }
  .drawer .sec { padding: 14px 12px 12px; }
  .margin-setting-number { padding: 10px; }
}

/* V20 — ébénisterie classique : noyer sombre, cuir patiné et laiton brossé */
.drawer {
  color: #eadcc0;
  background:
    repeating-linear-gradient(3deg, rgba(255,220,163,.025) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(91deg, rgba(25,10,4,.10) 0 2px, transparent 2px 17px),
    linear-gradient(110deg, transparent 0 24%, rgba(238,190,120,.055) 25%, transparent 27% 63%, rgba(15,6,3,.13) 64%, transparent 67%),
    linear-gradient(135deg, #4a2b1b 0%, #2d1a12 28%, #573522 54%, #321d13 78%, #21130d 100%);
  border: 1px solid #b28a4d;
  border-radius: 5px 11px 11px 5px;
  box-shadow: 0 24px 65px rgba(0,0,0,.58), inset 0 0 0 2px rgba(211,171,105,.22), inset 0 0 0 7px rgba(19,10,6,.18), inset 0 1px 0 rgba(255,230,179,.15);
}
.drawer::before {
  left: 13px; top: 12px; bottom: 12px; width: 2px;
  background: linear-gradient(180deg, transparent, #b88e4f 9%, #76512e 50%, #b88e4f 91%, transparent);
  opacity: .85;
}
.drawer-head {
  padding: 23px 20px 17px 30px;
  border-bottom: 1px solid rgba(202,160,91,.56);
  box-shadow: 0 2px 0 rgba(12,6,3,.22);
  background: linear-gradient(180deg, rgba(255,222,165,.045), transparent);
}
.drawer-head h2 { color: #f3e4c5; font-family: var(--ui-serif); font-size: 30px; font-weight: 500; letter-spacing: .015em; text-shadow: 0 1px 1px #160b06; }
.drawer-head h2::after { content: '  /  ATELIER'; display: block; margin-top: 7px; color: #c5a16a; font: 9px var(--ui-type); letter-spacing: .27em; }
.drawer .x { color: #e4c58e; border: 1px solid rgba(195,151,83,.58); border-radius: 3px; background: linear-gradient(#563823,#342015); box-shadow: inset 0 1px rgba(255,225,172,.12), 0 2px 2px rgba(0,0,0,.2); }
.drawer .x:hover { color: #fff1d3; background: linear-gradient(#6a472b,#422819); }
.drawer-body { padding: 12px 17px 27px 29px; scrollbar-color: #9a7040 transparent; }
.drawer .sec {
  margin: 10px 0 0; padding: 16px 14px 13px;
  border: 1px solid rgba(189,145,79,.55); border-left: 3px solid #b18a4d; border-radius: 3px;
  background: linear-gradient(135deg, rgba(255,222,170,.055), transparent 38%), linear-gradient(155deg, rgba(19,9,5,.26), rgba(8,4,2,.13));
  box-shadow: inset 0 1px rgba(255,224,174,.06), 0 2px 4px rgba(0,0,0,.12);
}
.drawer .sec + .sec { margin-top: 12px; }
.drawer .sec h3 { color: #c9a66e; font-size: 10px; letter-spacing: .2em; margin-bottom: 12px; }
.drawer .sec h3 em { color: #f0dfbd; font: 500 14px var(--ui-serif); letter-spacing: 0; }
.drawer .sec p.note, .drawer .margin-intro { color: #c8b79a; font-size: 12px; line-height: 1.55; }
.drawer .seg { gap: 7px; }
.drawer .seg button, .drawer .stepper button, .drawer .btn, .drawer .db-t {
  color: #ead8b5; border: 1px solid #8d683b;
  background: linear-gradient(180deg, #553722 0%, #382216 100%);
  border-radius: 3px; box-shadow: inset 0 1px rgba(255,226,176,.12), 0 2px 2px rgba(0,0,0,.22);
  transition: background .15s, border-color .15s;
}
.drawer .seg button:hover, .drawer .btn:hover, .drawer .stepper button:hover { background: linear-gradient(180deg,#69472a,#422819); border-color: #c39b5d; }
.drawer .seg button[aria-checked="true"], .drawer .btn.primary { color: #2a1a0e; border-color: #d4b16e; background: linear-gradient(180deg,#e0c184,#b88c4d); box-shadow: inset 0 1px rgba(255,248,222,.65), 0 2px 3px rgba(0,0,0,.2); font-weight: 700; }
.drawer .btn.danger { color: #f0b5a7; border-color: #9b5d4c; }
.drawer .sw span, .drawer .rb, .drawer .range { color: #c9b89c; }
.drawer .sw[aria-checked="true"] span, .drawer .rb[aria-checked="true"] { color: #f5e5c7; }
.drawer .range input { accent-color: #c8a05e; }
.drawer .toggle { color: #ead9b8; }
.drawer .toggle b { background: #65472e; border: 1px solid #9c7545; }
.drawer .toggle input:checked + b { background: #b18a4d; }
.drawer .toggle input:checked + b::after { background: #fff0ce; }
.drawer .thumb.current span { color: #e1bf7e; }
.drawer .keys-help td { border-bottom-color: rgba(196,153,88,.25); color: #d8c7a9; }
.drawer kbd { color: #2d1c10; background: linear-gradient(#f1dfb7,#c7a46a); border: 1px solid #a47b40; box-shadow: inset 0 1px rgba(255,255,255,.55), 0 2px 0 #6e4b28; }
.drawer .sw[aria-checked="true"] i, .drawer .rb[aria-checked="true"] i { box-shadow: 0 0 0 2px #3b2417, 0 0 0 3.5px #d2ad6b; }
/* Préréglages et champs : finition cuir et papier, plutôt que cartes modernes */
.margin-preset { color: #ead9b9; background: linear-gradient(145deg,rgba(255,223,171,.08),rgba(0,0,0,.18)),#382317; border: 1px solid #8d683c; border-radius: 3px; box-shadow: inset 0 1px rgba(255,229,182,.08), 0 2px 3px rgba(0,0,0,.2); }
.margin-preset strong { color: #f0dfbd; font: 600 13px var(--ui-serif); }
.margin-preset small { color: #c5b293; }
.margin-preset:hover { border-color: #d0ab68; background: linear-gradient(145deg,rgba(255,223,171,.13),rgba(0,0,0,.13)),#49301e; }
.margin-preset.active { border-color: #d8b573; background: linear-gradient(180deg,#74502e,#51351f); box-shadow: inset 0 1px rgba(255,235,195,.2), inset 0 -2px #c6a05e, 0 2px 3px rgba(0,0,0,.2); }
.margin-preset.active strong { color: #ffebc3; }
.margin-preview-paper { background: #f2e7ce; border: 1px solid #b9a17a; box-shadow: 0 8px 18px rgba(0,0,0,.35), 0 0 0 4px rgba(179,137,72,.12); }
.margin-zone { background: rgba(162,105,55,.17); border-color: rgba(137,78,40,.52); }
.margin-zone-left, .margin-zone-right, .margin-zone-top, .margin-zone-bottom { border-color: rgba(137,78,40,.65); }
.margin-writing-area .margin-line { background: rgba(49,58,42,.58); }
.margin-edge-label { color: #83502e; }
.margin-preview-caption { color: #c7b495; }
.margin-setting-number { padding: 12px; border: 1px solid rgba(184,139,73,.62); border-radius: 3px; background: linear-gradient(145deg,rgba(255,222,170,.06),rgba(0,0,0,.13)),#382317; box-shadow: inset 0 1px rgba(255,229,182,.07), 0 2px 3px rgba(0,0,0,.16); }
.margin-setting-number label { color: #f0dfbd; font: 600 13px var(--ui-serif); }
.margin-number-wrap input { color: #302013; background: linear-gradient(180deg,#fff5dd,#e9d6b1); border: 1px solid #a9844e; border-radius: 2px; box-shadow: inset 0 1px 3px rgba(72,42,16,.12), 0 1px rgba(255,224,174,.08); }
.margin-number-wrap input:hover { border-color: #e0bd78; }
.margin-number-wrap input:focus { outline: 2px solid #d2ad6b; outline-offset: 2px; border-color: #e0bd78; }
.margin-number-wrap span { color: #d6b77d; }
.margin-setting-number .margin-help { color: #c5b293; }
.drawer input[type="number"], .drawer input[type="text"], .drawer select, .drawer textarea { color: #302013; }
.drawer button:focus-visible, .drawer input:focus-visible, .drawer select:focus-visible { outline: 2px solid #e0bd78; outline-offset: 2px; }
@media (max-width: 560px) {
  .drawer { background: repeating-linear-gradient(3deg,rgba(255,220,163,.025) 0 1px,transparent 1px 7px), linear-gradient(135deg,#4a2b1b,#2d1a12 48%,#573522 70%,#21130d); }
  .drawer-head { padding: 18px 15px 13px 25px; }
  .drawer-body { padding: 9px 12px 22px 24px; }
}
