/* built by build.mjs, do not edit: change src/app.css or src/ui.css */
@font-face{font-family:'Inter';font-style:normal;font-weight:400;font-display:swap;src:url(/assets/fonts/inter-latin-400-normal.woff2) format('woff2')}
@font-face{font-family:'Inter';font-style:normal;font-weight:500;font-display:swap;src:url(/assets/fonts/inter-latin-500-normal.woff2) format('woff2')}
@font-face{font-family:'Inter';font-style:normal;font-weight:600;font-display:swap;src:url(/assets/fonts/inter-latin-600-normal.woff2) format('woff2')}
@font-face{font-family:'Inter';font-style:normal;font-weight:700;font-display:swap;src:url(/assets/fonts/inter-latin-700-normal.woff2) format('woff2')}
@font-face{font-family:'Source Serif 4';font-style:normal;font-weight:400;font-display:swap;src:url(/assets/fonts/source-serif-4-latin-400-normal.woff2) format('woff2')}
@font-face{font-family:'Source Serif 4';font-style:normal;font-weight:600;font-display:swap;src:url(/assets/fonts/source-serif-4-latin-600-normal.woff2) format('woff2')}
/* NaguPhoto (NaguSuite): warm paper, ink and clay. Light by default, dark follows the system or the switch. */

:root {
  color-scheme: light;
  --paper: #f4f1ea;
  --stage: #e8e4da;
  --card: #fcfbf8;
  --card-2: #f0ece3;
  --ink: #22201c;
  --ink-2: #5d584f;
  --ink-3: #8a8478;
  --line: #e0dacd;
  --line-2: #cfc8b8;
  --clay: #c4623f;
  --clay-hover: #ad532f;
  --clay-text: #a94f2e;
  --clay-soft: rgba(196, 98, 63, .11);
  --on-clay: #fffaf5;
  --ok: #3b7a4c;
  --ok-soft: rgba(59, 122, 76, .12);
  --warn: #9a6a14;
  --warn-soft: rgba(196, 146, 40, .14);
  --bad: #b23e2c;
  --bad-soft: rgba(178, 62, 44, .1);
  --shadow-sm: 0 1px 2px rgba(60, 45, 25, .08);
  --shadow: 0 1px 0 rgba(255, 255, 255, .7) inset, 0 18px 40px -14px rgba(60, 45, 25, .28), 0 3px 8px rgba(60, 45, 25, .07);
  --serif: 'Source Serif 4', 'Iowan Old Style', Georgia, serif;
  --sans: Inter, system-ui, sans-serif;
  --mast-h: 60px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #1b1a17;
  --stage: #141311;
  --card: #24221f;
  --card-2: #2d2b27;
  --ink: #ede9e0;
  --ink-2: #b4aea2;
  --ink-3: #847e73;
  --line: #34312c;
  --line-2: #45413a;
  --clay: #d97757;
  --clay-hover: #e58a6b;
  --clay-text: #e8957a;
  --clay-soft: rgba(217, 119, 87, .15);
  --on-clay: #1b1a17;
  --ok: #6fbf86;
  --ok-soft: rgba(111, 191, 134, .14);
  --warn: #e0b45c;
  --warn-soft: rgba(224, 180, 92, .13);
  --bad: #ec8a78;
  --bad-soft: rgba(236, 138, 120, .13);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 20px 44px -12px rgba(0, 0, 0, .6), 0 3px 8px rgba(0, 0, 0, .3);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #1b1a17;
    --stage: #141311;
    --card: #24221f;
    --card-2: #2d2b27;
    --ink: #ede9e0;
    --ink-2: #b4aea2;
    --ink-3: #847e73;
    --line: #34312c;
    --line-2: #45413a;
    --clay: #d97757;
    --clay-hover: #e58a6b;
    --clay-text: #e8957a;
    --clay-soft: rgba(217, 119, 87, .15);
    --on-clay: #1b1a17;
    --ok: #6fbf86;
    --ok-soft: rgba(111, 191, 134, .14);
    --warn: #e0b45c;
    --warn-soft: rgba(224, 180, 92, .13);
    --bad: #ec8a78;
    --bad-soft: rgba(236, 138, 120, .13);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 20px 44px -12px rgba(0, 0, 0, .6), 0 3px 8px rgba(0, 0, 0, .3);
  }
}

/* theme switch icon: moon in light, sun in dark */
.theme-dark { display: none; }
:root[data-theme="dark"] .theme-light { display: none; }
:root[data-theme="dark"] .theme-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-light { display: none; }
  :root:not([data-theme="light"]) .theme-dark { display: block; }
}

/* NaguPhoto layout and components. Tokens live in app.css (shared look with NaguScaler and the suite). */

/* checkerboard colours for transparent pixels (read by app.js) */
:root { --check-a: #ffffff; --check-b: #e9e5dc; }
:root[data-theme="dark"] { --check-a: #3a3833; --check-b: #2f2d29; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --check-a: #3a3833; --check-b: #2f2d29; } }

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html, body { height: 100%; }
body {
  background: var(--paper); color: var(--ink); font: 400 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased; display: flex; flex-direction: column; height: 100dvh; overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--clay); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--clay-soft); }
h1, h2, h3 { font-weight: 600; }

.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.ico-sm { width: 14px; height: 14px; }
.fine { font-size: 12px; color: var(--ink-3); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid transparent;
  font: 500 13.5px/1 var(--sans); white-space: nowrap; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s, opacity .15s;
}
.btn:disabled { cursor: not-allowed; opacity: .45; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 15px; border-radius: 12px; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn-clay { background: var(--clay); color: var(--on-clay); font-weight: 600; }
.btn-clay:not(:disabled):hover { background: var(--clay-hover); }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink:not(:disabled):hover { opacity: .88; }
.btn-quiet { background: var(--card); color: var(--ink); border-color: var(--line-2); }
.btn-quiet:not(:disabled):hover { background: var(--card-2); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:not(:disabled):hover { background: var(--card-2); color: var(--ink); }
.btn-danger { background: var(--bad); color: #fff; font-weight: 600; }

.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  color: var(--ink-2); cursor: pointer; transition: background-color .15s, color .15s;
}
.icon-btn:not(:disabled):hover { background: var(--card-2); color: var(--ink); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.icon-btn-sm { width: 28px; height: 28px; border-radius: 8px; }
.icon-btn.is-on { background: var(--clay-soft); color: var(--clay-text); }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--card-2); border: 1px solid var(--line); }
.seg-btn { padding: 5px 11px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.seg-btn:hover { color: var(--ink); }
.seg-btn.is-active { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }

.field { display: grid; gap: 5px; font-size: 12.5px; color: var(--ink-2); }
.input, .select {
  height: 34px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--card);
  color: var(--ink); font-size: 13.5px; min-width: 0;
}
.input:focus, .select:focus { outline: 2px solid var(--clay-soft); border-color: var(--clay); }
.select { padding-right: 8px; cursor: pointer; }
.select option { background: var(--card); color: var(--ink); }
textarea.input { height: auto; min-height: 84px; padding: 8px 10px; resize: vertical; line-height: 1.4; }
.input-num { width: 64px; text-align: right; font-variant-numeric: tabular-nums; }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 20px; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 999px; background: var(--line-2); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 999px; background: var(--line-2); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6.5px; border-radius: 50%; background: var(--card); border: 2px solid var(--clay); box-shadow: var(--shadow-sm); }
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--card); border: 2px solid var(--clay); }

/* ---------- Masthead ---------- */
.mast {
  height: var(--mast-h); flex-shrink: 0; display: flex; align-items: center; gap: 14px;
  padding: 0 16px 0 24px; border-bottom: 1px solid var(--line); background: var(--paper); position: relative; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; flex-shrink: 0; }
.brand-mark { width: 26px; height: 26px; }
.brand-name { font: 600 20px/1 var(--serif); letter-spacing: -.01em; }
.mast-sep { width: 1px; height: 24px; background: var(--line); margin: 0 6px; flex-shrink: 0; }
.doc-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.doc-name {
  width: 220px; min-width: 60px; height: 32px; padding: 0 8px; border-radius: 8px; border: 1px solid transparent;
  background: transparent; font-size: 14px; font-weight: 600; text-overflow: ellipsis;
}
.doc-name:hover { border-color: var(--line); }
.doc-name:focus { border-color: var(--clay); outline: none; background: var(--card); }
.save-state { font-size: 12px; color: var(--ink-3); white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.save-state .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); flex-shrink: 0; }
.save-state.is-busy .dot { background: var(--warn); }
.save-state.is-bad { color: var(--bad); }
.save-state.is-bad .dot { background: var(--bad); }
.mast-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.mast-group { display: flex; align-items: center; gap: 2px; }
body.no-doc .need-doc { display: none !important; }

.menu-wrap { position: relative; }
.menu {
  position: absolute; left: 0; top: calc(100% + 8px); min-width: 230px; padding: 6px; z-index: 60;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  animation: pop-in .14s ease-out;
}
.menu-right { left: auto; right: 0; }
.menu-up { top: auto; bottom: calc(100% + 8px); }
.menu-item {
  display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px;
  font-size: 13.5px; font-weight: 500; cursor: pointer; text-align: left; white-space: nowrap;
}
.menu-item:not(:disabled):hover { background: var(--card-2); }
.menu-item:disabled { opacity: .4; cursor: not-allowed; }
.menu-item .ico { color: var(--ink-3); }
.menu-key { margin-left: auto; padding-left: 16px; font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.menu-sep { height: 1px; background: var(--line); margin: 5px 4px; }
@keyframes pop-in { from { opacity: 0; transform: translateY(4px); } }

/* ---------- Work area ---------- */
.work { position: relative; flex: 1; min-height: 0; background: var(--stage); overflow: hidden; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; }
.work[data-cursor="crosshair"] #view { cursor: crosshair; }
.work[data-cursor="none"] #view { cursor: none; }
.work[data-cursor="move"] #view { cursor: move; }
.work[data-cursor="grab"] #view { cursor: grab; }
.work[data-cursor="grabbing"] #view { cursor: grabbing; }
.work[data-cursor="text"] #view { cursor: text; }
.work[data-cursor="copy"] #view { cursor: copy; }
.work[data-cursor="nwse"] #view { cursor: nwse-resize; }
.work[data-cursor="nesw"] #view { cursor: nesw-resize; }
.drop-cover {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; pointer-events: none;
  background: color-mix(in srgb, var(--paper) 78%, transparent);
}
.drop-cover span {
  padding: 40px 56px; border: 2px dashed var(--clay); border-radius: 20px; background: var(--card);
  font: 600 19px var(--serif); color: var(--clay-text);
}

.float {
  position: absolute; z-index: 10; background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow);
}

/* Tool rail (left) */
.rail { left: 16px; top: 16px; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.tool { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: var(--ink-2); cursor: pointer; flex-shrink: 0; }
.tool:hover { background: var(--card-2); color: var(--ink); }
.tool.is-active { background: var(--clay-soft); color: var(--clay-text); }
.tool .ico { width: 19px; height: 19px; }
.rail-sep { height: 1px; background: var(--line); margin: 4px 6px; flex-shrink: 0; }
.swatch { position: relative; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }
.swatch:hover { background: var(--card-2); }
.swatch-chip { width: 24px; height: 24px; border-radius: 7px; box-shadow: 0 0 0 1px var(--line-2), inset 0 0 0 2px var(--card); }
.swatch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; border: 0; padding: 0; }

/* Tool options (top) */
.opts {
  left: 70px; top: 16px; width: max-content; max-width: calc(100% - 386px);
  min-height: 50px; padding: 7px 10px 7px 14px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.opts-title { font-size: 13px; font-weight: 600; white-space: nowrap; }
.opt { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.opt input[type="range"] { width: 110px; }
.opt output { min-width: 34px; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.opt-hint { font-size: 12.5px; color: var(--ink-3); }
.opts-sep { width: 1px; align-self: stretch; background: var(--line); margin: 4px 0; flex-shrink: 0; }

/* Layers panel (right) */
.layers { right: 16px; top: 16px; width: 268px; max-height: calc(100% - 32px); display: flex; flex-direction: column; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 8px 6px 14px; }
.panel-head h2 { font-size: 13.5px; }
.layer-props { padding: 4px 12px 10px; display: grid; gap: 8px; border-bottom: 1px solid var(--line); }
.layer-prop { display: grid; grid-template-columns: 68px 1fr 40px; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.layer-prop .select { grid-column: 2 / 4; height: 30px; font-size: 12.5px; }
.layer-prop output { font-size: 12px; color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; }
.layer-list { list-style: none; padding: 6px; margin: 0; overflow: auto; flex: 1; min-height: 60px; overscroll-behavior: contain; position: relative; }
.layer {
  position: relative; display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 4px 0 2px;
  border-radius: 10px; cursor: pointer; user-select: none; -webkit-user-select: none;
}
.layer:hover { background: var(--card-2); }
.layer.is-active { background: var(--clay-soft); }
.layer.is-hidden .layer-thumb, .layer.is-hidden .layer-name { opacity: .45; }
.layer.is-dragging { opacity: .45; }
.layer-grip { width: 18px; height: 32px; display: grid; place-items: center; color: var(--ink-3); cursor: grab; touch-action: none; flex-shrink: 0; }
.layer-grip:active { cursor: grabbing; }
.layer-thumb {
  width: 44px; height: 34px; border-radius: 6px; flex-shrink: 0; box-shadow: 0 0 0 1px var(--line-2);
  background: repeating-conic-gradient(var(--check-b) 0 25%, var(--check-a) 0 50%) 0 0 / 8px 8px; display: block;
}
.layer-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer-name-input { flex: 1; min-width: 0; height: 28px; padding: 0 6px; font-size: 13px; border-radius: 7px; border: 1px solid var(--clay); background: var(--card); }
.layer-badge { font-size: 10.5px; font-weight: 600; padding: 1px 5px; border-radius: 5px; background: var(--card-2); color: var(--ink-3); flex-shrink: 0; }
.drop-line { position: absolute; left: 8px; right: 8px; height: 2px; border-radius: 2px; background: var(--clay); pointer-events: none; z-index: 2; }
.panel-foot { display: flex; align-items: center; gap: 2px; padding: 6px 8px; border-top: 1px solid var(--line); }
.panel-foot .grow { flex: 1; }

/* Zoom pill (bottom left) */
.zoom { left: 16px; bottom: 16px; padding: 4px; display: flex; align-items: center; gap: 2px; border-radius: 12px; }
.zoom-level { min-width: 54px; height: 28px; border-radius: 8px; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer; }
.zoom-level:hover { background: var(--card-2); }
.doc-size { font-size: 12px; color: var(--ink-3); padding: 0 8px 0 4px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Text editor pop */
.text-pop { left: 70px; top: 78px; width: 330px; padding: 14px; display: grid; gap: 10px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }
.pop-head { display: flex; align-items: center; justify-content: space-between; }
.pop-head h2 { font-size: 13.5px; }

/* ---------- Start screen ---------- */
.start { position: absolute; inset: 0; overflow: auto; z-index: 20; background: var(--paper); }
.start-inner { max-width: 940px; margin: 0 auto; padding: 56px 24px 48px; }
.start-hero { display: grid; gap: 14px; justify-items: start; }
.start-hero h1 { font: 600 34px/1.15 var(--serif); letter-spacing: -.015em; }
.start-hero p { max-width: 560px; color: var(--ink-2); font-size: 15px; }
.start-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.start-drop {
  margin-top: 28px; border: 1.5px dashed var(--line-2); border-radius: 18px; padding: 24px; text-align: center;
  color: var(--ink-3); font-size: 13.5px; background: var(--card);
}
.section-title { font-size: 14px; margin: 40px 0 12px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }

.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.project {
  position: relative; display: grid; border-radius: 14px; overflow: hidden; background: var(--card);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.project-open { display: grid; cursor: pointer; text-align: left; min-width: 0; }
.project-open:hover .project-thumb { opacity: .9; }
.project-thumb {
  aspect-ratio: 4 / 3; width: 100%; object-fit: contain; display: block;
  background: repeating-conic-gradient(var(--check-b) 0 25%, var(--check-a) 0 50%) 0 0 / 14px 14px;
  border-bottom: 1px solid var(--line);
}
.project-body { padding: 10px 40px 11px 12px; min-width: 0; }
.project-name, .project-meta { display: block; }
.project-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-meta { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-del { position: absolute; right: 6px; bottom: 9px; }
.project.is-current { border-color: var(--clay); }
.empty-note { color: var(--ink-3); font-size: 13.5px; padding: 18px 0; grid-column: 1 / -1; }

/* ---------- Dialogs ---------- */
dialog {
  margin: auto; border: 1px solid var(--line); border-radius: 18px; padding: 0; background: var(--card); color: var(--ink);
  box-shadow: var(--shadow); width: min(420px, calc(100% - 24px)); max-height: calc(100dvh - 32px);
}
dialog.wide { width: min(860px, calc(100% - 24px)); }
dialog::backdrop { background: rgba(20, 16, 10, .35); }
.dlg { display: grid; gap: 16px; padding: 20px; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -4px -6px -4px 0; }
.dlg-head h2 { font: 600 19px/1.2 var(--serif); }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; flex-wrap: wrap; }
.dlg-text { color: var(--ink-2); font-size: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.chip:hover { background: var(--card-2); color: var(--ink); }
.dlg-scroll { max-height: min(60dvh, 560px); overflow: auto; margin: 0 -4px; padding: 2px 4px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; top: calc(var(--mast-h) + 12px); left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; width: min(440px, calc(100% - 24px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--clay); box-shadow: var(--shadow);
  font-size: 13.5px; line-height: 1.45; animation: pop-in .18s ease-out;
}
.toast-bad { border-left-color: var(--bad); }
.toast-ok { border-left-color: var(--ok); }
.toast-msg { flex: 1; }

.sheet-handle { display: none; }
.only-phone { display: none !important; }
.sheet-shade { display: none; }

/* ---------- Narrower screens ---------- */
@media (max-width: 1100px) {
  .save-state-text { display: none; }
  .doc-name { width: 160px; }
}

/* ---------- Phones: tools in a bottom dock, layers in a bottom sheet ---------- */
@media (max-width: 760px) {
  :root { --mast-h: 54px; }
  .mast { padding: 0 8px 0 12px; gap: 4px; }
  .brand-name, .mast-sep, .hide-phone { display: none !important; }
  .only-phone { display: inline-grid !important; }
  .doc-name { width: 30vw; min-width: 40px; }
  .btn-export .btn-label { display: none; }
  .btn-export { width: 36px; padding: 0; }

  .rail {
    left: 8px; right: 8px; top: auto; bottom: calc(8px + env(safe-area-inset-bottom)); flex-direction: row;
    overflow-x: auto; justify-content: space-between; border-radius: 16px; scrollbar-width: none;
  }
  .rail::-webkit-scrollbar { display: none; }
  .rail { padding: 4px; gap: 0; }
  .rail-sep { width: 1px; height: auto; margin: 6px 2px; }
  .tool, .swatch { width: 36px; height: 40px; }

  .opts {
    left: 8px; right: 8px; top: auto; bottom: calc(66px + env(safe-area-inset-bottom)); width: auto; max-width: none;
    min-height: 44px; padding: 5px 10px; gap: 10px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; border-radius: 14px;
  }
  .opts::-webkit-scrollbar { display: none; }
  .opts-title, .opt-hint { display: none; }
  .opt input[type="range"] { width: 84px; }
  .opts:not(:has(> :not(.opts-title):not(.opt-hint))) { display: none; }

  .zoom { left: auto; right: 8px; top: 8px; bottom: auto; }
  .doc-size { display: none; }

  .layers {
    left: 0; right: 0; top: auto; bottom: 0; width: auto; max-height: 64dvh; border-radius: 18px 18px 0 0;
    padding-bottom: env(safe-area-inset-bottom); z-index: 40; transform: translateY(105%); transition: transform .22s ease;
    border-bottom: 0; visibility: hidden;
  }
  body.sheet-open .layers { transform: none; visibility: visible; }
  body.sheet-open .sheet-shade { display: block; position: absolute; inset: 0; z-index: 35; background: rgba(20, 16, 10, .25); }
  .sheet-handle { display: block; width: 38px; height: 4px; border-radius: 4px; background: var(--line-2); margin: 8px auto 0; }
  .layer { height: 52px; }
  .layer-grip { width: 30px; height: 44px; }

  .text-pop { left: 8px; right: 8px; top: 8px; width: auto; }

  .start-inner { padding: 32px 16px 40px; }
  .start-hero h1 { font-size: 27px; }
  .projects { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .toasts { top: auto; bottom: calc(122px + env(safe-area-inset-bottom)); }
  dialog { width: calc(100% - 16px); }
  .menu { min-width: 220px; }
}

