:root {
  --wall-h1: #ffe9d9; --wall-h2: #ffd3b0; --wall-h3: #ff8a58;
  --win-bg: #f6f6f8; --win-chrome: #ececec; --win-side: #ebebee;
  --win-head: linear-gradient(180deg, #f9f9fa, #ececec);
  --ink: #111214; --ink-2: #5a5e68; --ink-3: #8c919b;
  --accent: #0a84ff; --accent-soft: rgba(10,132,255,0.14);
  --line: #d9d9de; --line-2: #e9e9ed;
  --red: #ff5f57; --yellow: #febc2e; --green: #28c840;
  --shadow-win: 0 22px 60px rgba(40,20,10,0.22), 0 4px 12px rgba(40,20,10,0.12);
  --shadow-pop: 0 10px 30px rgba(40,20,10,0.18);
  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  --font-mono: var(--font-ui); /* kbd chips render in Inter — it bundles ⌘⇧⌥ glyphs */
}
[data-theme="dark"] {
  --wall-h1: #2b1d18; --wall-h2: #3f2419; --wall-h3: #a33d0b;
  --win-bg: #1e1e20; --win-chrome: #2a2a2c; --win-side: #202023;
  --win-head: linear-gradient(180deg, #2d2d2f, #232325);
  --ink: #f1f2f4; --ink-2: #a8acb4; --ink-3: #70747d;
  --line: #3a3a3e; --line-2: #2c2c30;
  --shadow-win: 0 22px 60px rgba(0,0,0,0.55), 0 4px 12px rgba(0,0,0,0.4);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --wall-h1: #2b1d18; --wall-h2: #3f2419; --wall-h3: #a33d0b;
    --win-bg: #1e1e20; --win-chrome: #2a2a2c; --win-side: #202023;
    --win-head: linear-gradient(180deg, #2d2d2f, #232325);
    --ink: #f1f2f4; --ink-2: #a8acb4; --ink-3: #70747d;
    --line: #3a3a3e; --line-2: #2c2c30;
    --shadow-win: 0 22px 60px rgba(0,0,0,0.55), 0 4px 12px rgba(0,0,0,0.4);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; color: var(--ink); font-family: var(--font-ui); font-size: 13px; }
body {
  background:
    radial-gradient(1600px 900px at 20% 10%, var(--wall-h1) 0%, transparent 55%),
    radial-gradient(1400px 900px at 80% 90%, var(--wall-h3) 0%, transparent 45%),
    linear-gradient(135deg, var(--wall-h1), var(--wall-h2) 50%, var(--wall-h3));
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; border: none; background: none; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
.menubar { position: fixed; top: 0; left: 0; right: 0; height: 26px;
  background: rgba(255,255,255,0.6); backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%); border-bottom: 1px solid rgba(0,0,0,0.08);
  display: flex; align-items: center; padding: 0 14px; font-size: 12.5px; font-weight: 500;
  z-index: 1000; color: #1a1a1a; }
[data-theme="dark"] .menubar { background: rgba(30,30,32,0.7); color: #eee; border-color: rgba(255,255,255,0.1); }
.menubar .apple { font-size: 14px; margin-right: 14px; font-weight: 600; }
.menubar .app-name { font-weight: 700; margin-right: 18px; }
.menu-item { padding: 2px 10px; border-radius: 4px; cursor: default; }
.menu-item:hover { background: var(--accent); color: white; }
.menubar .right { margin-left: auto; display: flex; align-items: center; gap: 14px; font-variant-numeric: tabular-nums; }
.desktop { position: fixed; inset: 26px 0 0 0; overflow: hidden; }
.window { position: absolute; background: var(--win-bg); border-radius: 10px;
  box-shadow: var(--shadow-win); overflow: hidden; display: flex; flex-direction: column; }
.window.inactive .titlebar { filter: saturate(0.4) brightness(0.98); }
.titlebar { height: 28px; background: var(--win-head); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; padding: 0 10px; cursor: grab; user-select: none;
  gap: 8px; position: relative; flex-shrink: 0; }
.titlebar:active { cursor: grabbing; }
.lights { display: flex; gap: 6px; align-items: center; }
.light { width: 12px; height: 12px; border-radius: 50%; border: 0.5px solid rgba(0,0,0,0.15);
  display: grid; place-items: center; font-size: 9px; color: rgba(0,0,0,0.55); line-height: 1; }
.light.red { background: var(--red); } .light.yellow { background: var(--yellow); } .light.green { background: var(--green); }
.lights .light span { opacity: 0; } .lights:hover .light span { opacity: 1; }
.titlebar .title { position: absolute; left: 0; right: 0; text-align: center; font-weight: 600;
  font-size: 12.5px; color: var(--ink); pointer-events: none; padding: 0 90px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.titlebar .title .accent-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 6px; vertical-align: middle; }
.win-body { display: flex; flex: 1; min-height: 0; }
.sidebar { width: 150px; background: var(--win-side); border-right: 1px solid var(--line-2);
  padding: 10px 8px; overflow: auto; flex-shrink: 0; }
.sb-heading { color: var(--ink-3); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 8px 8px 4px; }
.sb-item { display: flex; align-items: center; gap: 7px; padding: 4px 8px; border-radius: 5px; color: var(--ink); font-size: 12.5px; cursor: pointer; }
.sb-item:hover { background: rgba(0,0,0,0.04); }
.sb-item.active { background: var(--accent); color: white; }
.sb-item .ico { width: 14px; height: 14px; flex-shrink: 0; color: var(--accent); }
.sb-item.active .ico { color: white; }
.content { flex: 1; min-width: 0; min-height: 0; overflow: auto; background: var(--win-bg); }
.stage { position: relative; width: 100%; height: 100%;
  container-type: size;
  background-image: linear-gradient(45deg, rgba(0,0,0,0.10) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(0,0,0,0.10) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(0,0,0,0.10) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(0,0,0,0.10) 75%);
  background-size: 26px 26px; background-position: 0 0, 0 13px, 13px -13px, -13px 0;
  background-color: #e7e7ea; overflow: hidden; user-select: none; }
[data-theme="dark"] .stage { background-color: #1c1c1e;
  background-image: linear-gradient(45deg, rgba(255,255,255,0.07) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255,255,255,0.07) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.07) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.07) 75%); }
.folder-wrap { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.folder-wrap svg { width: 100%; height: auto; filter: drop-shadow(0 12px 30px rgba(0,0,0,0.18)); }
.icon-canvas { box-shadow: 0 0 0 1px rgba(0,0,0,0.06), 0 18px 40px rgba(0,0,0,0.12); border-radius: 2px; }
[data-theme="dark"] .icon-canvas { box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 18px 40px rgba(0,0,0,0.4); }
.zoom-hud { position: absolute; bottom: 10px; right: 10px; display: flex; gap: 2px;
  background: var(--win-bg); border: 1px solid var(--line); border-radius: 6px; padding: 2px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08); z-index: 10; }
.zoom-btn { height: 22px; min-width: 22px; padding: 0 6px; border-radius: 4px; display: grid; place-items: center;
  font-size: 11px; font-weight: 500; color: var(--ink); background: transparent; border: none; cursor: pointer; font-variant-numeric: tabular-nums; }
.zoom-btn:hover { background: rgba(0,0,0,0.06); }
[data-theme="dark"] .zoom-btn:hover { background: rgba(255,255,255,0.08); }
.zoom-level { min-width: 42px; }
.layer { position: absolute; transform-origin: center; cursor: grab; display: grid; place-items: center; touch-action: none; }
.layer.selected { outline: 1.5px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.layer img { width: 100%; height: 100%; pointer-events: none; display: block; object-fit: contain; }
.layer svg { width: 100%; height: 100%; pointer-events: none; display: block; }
.layer-text { font-weight: 700; white-space: pre; line-height: 1; text-shadow: 0 1px 0 rgba(0,0,0,0.15); }
.layer-text-edit { background: transparent; border: none; outline: none; padding: 0; margin: 0; width: 100%; text-align: center; cursor: text; }
.handle { position: absolute; width: 10px; height: 10px; background: white; border: 1.5px solid var(--accent); border-radius: 2px; z-index: 2; }
.handle.nw { top: -6px; left: -6px; cursor: nwse-resize; }
.handle.ne { top: -6px; right: -6px; cursor: nesw-resize; }
.handle.sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
.handle.se { bottom: -6px; right: -6px; cursor: nwse-resize; }
.handle.rot { top: -28px; left: 50%; transform: translateX(-50%); border-radius: 50%; cursor: grab; }
.handle.rot::before { content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); width: 1px; height: 16px; background: var(--accent); }
.snap-guide { position: absolute; background: #ff3d6e; pointer-events: none; opacity: 0.9; }
.snap-guide.v { width: 1px; top: 0; bottom: 0; } .snap-guide.h { height: 1px; left: 0; right: 0; }
.paste-empty { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  background: rgba(28, 30, 34, 0.92); color: rgba(255,255,255,0.95);
  padding: 9px 12px 9px 14px; border-radius: 999px;
  font-size: 12px; font-weight: 500; line-height: 1.35;
  box-shadow: 0 6px 24px rgba(0,0,0,0.22), 0 0 0 1px rgba(255,255,255,0.06);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  pointer-events: auto; max-width: calc(100% - 32px); }
.paste-empty .pe-text { color: rgba(255,255,255,0.92); }
.paste-empty .pe-strong { color: white; font-weight: 600; }
.paste-empty .pe-link { color: #5fc0ed; font-weight: 600; text-decoration: none; cursor: pointer;
  background: none; border: none; padding: 0; font: inherit; }
.paste-empty .pe-link:hover { text-decoration: underline; }
.paste-empty .pe-sep { color: rgba(255,255,255,0.3); }
.paste-empty .pe-kbd { display: inline-block; padding: 1px 5px; border-radius: 3px;
  background: rgba(255,255,255,0.13); border: 1px solid rgba(255,255,255,0.18);
  font: 500 10.5px var(--font-mono); color: white; margin: 0 1px; }
.drop-overlay { position: absolute; inset: 6px; background: rgba(10,132,255,0.1); border: 2px dashed var(--accent); border-radius: 8px; display: grid; place-items: center; pointer-events: none; z-index: 20; color: var(--accent); font-weight: 600; }
.list { padding: 6px; }
.list-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; font-size: 12.5px; cursor: pointer; }
.list-row:hover { background: rgba(0,0,0,0.04); }
.list-row.selected { background: var(--accent); color: white; }
.list-row .thumb { width: 26px; height: 26px; border-radius: 5px; background: #f0f0f2; border: 1px solid var(--line); display: grid; place-items: center; flex-shrink: 0; overflow: hidden; }
.list-row.selected .thumb { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.3); }
.list-row .thumb img { width: 80%; height: 80%; object-fit: contain; }
.list-row .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .right-actions { display: flex; gap: 2px; opacity: 0; }
.list-row:hover .right-actions { opacity: 1; }
.tiny { width: 20px; height: 20px; border-radius: 4px; display: grid; place-items: center; color: inherit; }
.tiny:hover { background: rgba(0,0,0,0.08); }
.btn-sm { padding: 5px 10px; border-radius: 6px; font-size: 11.5px; font-weight: 500; border: 1px solid var(--line); background: white; color: var(--ink); cursor: pointer; line-height: 1.2; white-space: nowrap; }
.btn-sm:hover { background: var(--win-chrome); }
[data-theme="dark"] .btn-sm { background: #2a2a2c; }
[data-theme="dark"] .btn-sm:hover { background: #34343a; }
.btn-sm:disabled { opacity: 0.5; cursor: default; }
.list-row.selected .tiny:hover { background: rgba(255,255,255,0.2); }
.section-block { padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
.section-block:last-child { border-bottom: none; }
.section-head { color: var(--ink-3); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; }
.row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.row:last-child { margin-bottom: 0; }
.row label { width: 56px; color: var(--ink-2); font-size: 11.5px; }
.inp { height: 24px; padding: 0 7px; border-radius: 5px; border: 1px solid var(--line); background: white; color: var(--ink); font-size: 12px; outline: none; font-variant-numeric: tabular-nums; }
[data-theme="dark"] .inp { background: #2a2a2c; }
.inp:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.inp.flex1 { flex: 1; min-width: 0; }
.slider { -webkit-appearance: none; appearance: none; flex: 1; height: 4px; background: var(--line); border-radius: 3px; outline: none; }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: white; border: 1px solid rgba(0,0,0,0.3); cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,0.18); }
.sw { aspect-ratio: 1; border-radius: 6px; border: 2px solid transparent; cursor: pointer; transition: transform .1s; }
.sw:hover { transform: scale(1.08); }
.sw.active { border-color: var(--ink); box-shadow: 0 0 0 2px white, 0 0 0 3px var(--accent); }
.seg { display: flex; background: var(--win-chrome); border: 1px solid var(--line); border-radius: 6px; padding: 2px; }
.seg button { flex: 1; padding: 4px 8px; border-radius: 4px; font-size: 11.5px; color: var(--ink-2); font-weight: 500; }
.seg button.active { background: white; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
[data-theme="dark"] .seg button.active { background: #3a3a3e; color: white; }
.tools-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px; }
.tool-tile { aspect-ratio: 1.15; border-radius: 10px; background: white; border: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--ink); font-size: 11.5px; font-weight: 500;
  transition: transform .1s, box-shadow .12s, border-color .12s; }
[data-theme="dark"] .tool-tile { background: #2a2a2c; }
.tool-tile:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(0,0,0,0.1); border-color: var(--accent); }
.tool-tile svg { color: var(--accent); }
.preset-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; padding: 4px 6px 10px; }
.preset-tile { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px;
  background: transparent; border: 1px solid transparent; border-radius: 8px; cursor: pointer; color: var(--ink);
  transition: background .1s, border-color .1s; }
.preset-tile:hover { background: rgba(0,0,0,0.04); }
[data-theme="dark"] .preset-tile:hover { background: rgba(255,255,255,0.06); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .preset-tile:hover { background: rgba(255,255,255,0.06); } }
.preset-tile:active { transform: scale(0.97); }
.preset-ico { position: relative; width: 62px; height: 62px; display: grid; place-items: center; }
.preset-ico svg { width: 100%; height: 100%; }
.preset-sym { position: absolute; left: 50%; top: 55%; transform: translate(-50%, -50%); pointer-events: none;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,0.15)); }
.preset-sym svg { width: 26px; height: 26px; }
.preset-name { font-size: 11.5px; font-weight: 500; text-align: center; letter-spacing: 0.01em;
  max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 1px 6px;
  border-radius: 4px; }
.preset-tile:hover .preset-name { background: var(--accent); color: white; }
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1.5px dashed var(--line); border-radius: 8px; padding: 22px 18px; cursor: pointer;
  background: var(--win-side); transition: border-color .12s, background .12s; text-align: center; min-height: 150px; }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--win-side)); }
.light.disabled { opacity: 0.45; pointer-events: none; }
.sym-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 8px; }
.sym-btn { aspect-ratio: 1; border-radius: 6px; display: grid; place-items: center; color: var(--ink); }
.sym-btn:hover { background: rgba(0,0,0,0.05); }
.sym-cat { grid-column: 1/-1; padding: 6px 8px 2px; font-size: 10.5px; color: var(--ink-3); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.sym-search { padding: 8px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 8px; background: var(--win-chrome); }
.sym-search .inp { flex: 1; background: white; height: 24px; border-radius: 12px; padding: 0 10px; }
.sym-hint { padding: 6px 10px 0; font-size: 10.5px; color: var(--ink-3); line-height: 1.4; }
.sym-empty { grid-column: 1/-1; padding: 24px 10px; text-align: center; color: var(--ink-3); font-size: 12px; }
.sym-grid { grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); }
.tone-body { padding: 12px; }
.tone-presets { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 16px; }
.tone-preset { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 4px; border-radius: 8px; border: 1.5px solid transparent; cursor: pointer; }
.tone-preset:hover { background: rgba(0,0,0,0.03); }
.tone-preset.active { border-color: var(--accent); background: var(--accent-soft); }
.tone-preset .chip { width: 36px; height: 28px; border-radius: 6px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.tone-preset .name { font-size: 10.5px; font-weight: 500; color: var(--ink-2); }
.tone-preset.active .name { color: var(--accent); font-weight: 600; }
.big-btn { width: 100%; padding: 10px 12px; border-radius: 8px; font-weight: 600; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: white; color: var(--ink); }
[data-theme="dark"] .big-btn { background: #2a2a2c; }
.big-btn:hover { background: var(--win-chrome); }
.big-btn.primary { background: var(--accent); color: white; border-color: var(--accent); }
.big-btn.primary:hover { background: #0071e3; }
.big-btn:disabled { opacity: 0.4; pointer-events: none; }
.dock { position: fixed; bottom: 10px; left: 50%; transform: translateX(-50%);
  background: rgba(255,255,255,0.55); backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%); border: 1px solid rgba(255,255,255,0.6);
  border-radius: 18px; padding: 6px 10px; display: flex; gap: 6px; align-items: flex-end;
  z-index: 900; box-shadow: 0 12px 30px rgba(40,20,10,0.2); }
[data-theme="dark"] .dock { background: rgba(40,40,42,0.6); border-color: rgba(255,255,255,0.1); }
.dock-btn { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center;
  background: white; box-shadow: 0 2px 6px rgba(0,0,0,0.12); border: 1px solid rgba(0,0,0,0.05);
  transition: transform .18s; position: relative; color: var(--accent); }
[data-theme="dark"] .dock-btn { background: #2a2a2c; }
.dock-btn:hover { transform: translateY(-6px) scale(1.12); }
.dock-btn .label { position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: rgba(20,20,22,0.9); color: white; padding: 3px 8px; border-radius: 6px; font-size: 11px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .15s; }
.dock-btn:hover .label { opacity: 1; }
.dock-btn .open-dot { position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%); width: 3px; height: 3px; border-radius: 50%; background: rgba(0,0,0,0.5); }
[data-theme="dark"] .dock-btn .open-dot { background: rgba(255,255,255,0.7); }
.dock-sep { width: 1px; align-self: stretch; background: rgba(0,0,0,0.1); margin: 4px 4px; }
.tweaks { position: fixed; bottom: 70px; right: 16px; width: 260px; background: var(--win-bg);
  border-radius: 10px; box-shadow: var(--shadow-pop); border: 1px solid var(--line); overflow: hidden; z-index: 1500; }
.tweaks .titlebar { cursor: default; }
.toast { position: fixed; bottom: 80px; left: 50%; transform: translate(-50%, 10px);
  background: rgba(20,22,28,0.92); color: white; padding: 8px 14px; border-radius: 8px;
  font-size: 12.5px; font-weight: 500; opacity: 0; transition: opacity .2s, transform .2s;
  pointer-events: none; z-index: 2000; }
.kbd { display: inline-block; padding: 0 5px; background: rgba(0,0,0,0.06); border: 1px solid rgba(0,0,0,0.1); border-radius: 4px; font: 500 11px var(--font-mono); margin: 0 1px; }
[data-theme="dark"] .kbd { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.12); }
.mini-folder { width: 26px; height: 20px; position: relative;
  background: linear-gradient(180deg,#7db8ff,#4d91ff); border-radius: 3px; box-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.mini-folder::before { content: ""; position: absolute; top: -4px; left: 2px; width: 10px; height: 5px; background: #7db8ff; border-radius: 2px 2px 0 0; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.35); background-clip: padding-box; border: 2px solid transparent; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .menubar { background: rgba(30,30,32,0.7); color: #eee; border-color: rgba(255,255,255,0.1); }
  :root:not([data-theme="light"]) .stage { background-color: #1c1c1e;
  background-image: linear-gradient(45deg, rgba(255,255,255,0.07) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255,255,255,0.07) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.07) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.07) 75%); }
  :root:not([data-theme="light"]) .inp { background: #2a2a2c; }
  :root:not([data-theme="light"]) .seg button.active { background: #3a3a3e; color: white; }
  :root:not([data-theme="light"]) .tool-tile { background: #2a2a2c; }
  :root:not([data-theme="light"]) .big-btn { background: #2a2a2c; }
  :root:not([data-theme="light"]) .dock { background: rgba(40,40,42,0.6); border-color: rgba(255,255,255,0.1); }
  :root:not([data-theme="light"]) .dock-btn { background: #2a2a2c; }
  :root:not([data-theme="light"]) .dock-btn .open-dot { background: rgba(255,255,255,0.7); }
  :root:not([data-theme="light"]) .kbd { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.12); }
}

.align-btn { position: relative; aspect-ratio: 1; border: 1px solid var(--line); background: var(--win-side); border-radius: 6px; color: var(--ink-3); transition: background 0.12s, color 0.12s, border-color 0.12s; }
.align-btn:hover { background: var(--win-chrome); color: var(--accent); border-color: var(--accent); }
.align-btn:active { background: var(--accent-soft); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .align-btn { background: var(--win-chrome); border-color: var(--line); }
}
[data-theme="dark"] .align-btn { background: var(--win-chrome); border-color: var(--line); }
details.precise summary::marker { color: var(--ink-3); }
details.precise[open] summary { color: var(--ink-2); }
.linklike { color: var(--accent); text-decoration: underline; cursor: pointer; background: none; padding: 0; font-size: inherit; }
.content.with-footer { display: flex; flex-direction: column; }
.content.with-footer .preset-grid { flex: 1; align-content: start; }
.disclaimer { margin-top: auto; padding: 8px 14px 10px; font-size: 10px; line-height: 1.45; color: var(--ink-3); border-top: 1px solid var(--line-2); }
.about-doc { padding: 22px 26px; font-size: 13px; line-height: 1.6; color: var(--ink); overflow-y: auto; }
.about-doc a { color: var(--accent); }

/* ===== Mobile shell ===================================================== */
/* Everything below only applies at phone widths or to coarse pointers; the
   desktop layout above 700px is untouched. */
.pe-mobile { display: none; }

@media (max-width: 700px) {
  .m-root { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
  .m-topbar { height: 44px; flex-shrink: 0; display: flex; align-items: center; gap: 8px;
    padding: 0 12px; background: var(--win-bg); border-bottom: 1px solid var(--line);
    font-size: 13.5px; font-weight: 700; color: var(--ink); }
  .m-topbar .m-count { margin-left: auto; font-weight: 500; font-size: 12px; color: var(--ink-3); }
  .m-stage { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }
  .m-stage > .content { flex: 1; min-height: 0; }
  .m-sheet { flex-shrink: 0; height: 45vh; height: 45dvh; display: flex; flex-direction: column;
    background: var(--win-bg); border-top: 1px solid var(--line);
    box-shadow: 0 -8px 24px rgba(0,0,0,0.12); }
  .m-sheet-head { height: 40px; flex-shrink: 0; display: flex; align-items: center;
    justify-content: space-between; padding: 0 8px 0 14px; border-bottom: 1px solid var(--line-2);
    font-weight: 700; font-size: 13px; color: var(--ink); }
  .m-sheet-close { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center;
    color: var(--ink-2); font-size: 20px; line-height: 1; }
  .m-sheet-close:active { background: rgba(0,0,0,0.08); }
  .m-sheet-body { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
  .m-sheet-body > .content, .m-sheet-body > .win-body { flex: 1; min-height: 0; }
  /* ToolsWindow's sidebar duplicates the mobile nav — presets get the width. */
  .m-sheet .sidebar { display: none; }
  .m-sheet .preset-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
  .m-nav { flex-shrink: 0; display: flex; align-items: stretch; background: var(--win-bg);
    border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    position: relative; z-index: 950; }
  .m-nav-btn { flex: 1; min-width: 0; min-height: 48px; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 2px; color: var(--ink-2);
    font-size: 10px; font-weight: 500; border-radius: 8px; }
  .m-nav-btn.active { color: var(--accent); background: var(--accent-soft); }
  .m-nav-btn svg { width: 22px; height: 22px; }
  .m-more-menu { position: absolute; right: 8px; bottom: calc(100% + 6px); min-width: 180px;
    background: var(--win-bg); border: 1px solid var(--line); border-radius: 10px;
    box-shadow: var(--shadow-pop); padding: 6px; z-index: 1600; display: flex; flex-direction: column; }
  .m-more-menu button { display: flex; align-items: center; gap: 10px; padding: 11px 12px;
    border-radius: 7px; font-size: 13px; color: var(--ink); text-align: left; }
  .m-more-menu button:active { background: var(--accent); color: white; }
  /* Swap the empty-state hint: no ⌘V on a phone. */
  body.mobile .pe-desktop { display: none; }
  body.mobile .pe-mobile { display: inline; }
  body.mobile .paste-empty { flex-direction: column; gap: 4px; border-radius: 14px;
    text-align: center; padding: 10px 14px; }
  /* The " · " between hint and link is a row separator; pointless stacked. */
  body.mobile .paste-empty > .pe-sep { display: none; }
  /* Only the fixed-position modals still use .window on mobile. */
  body.mobile .window { max-width: calc(100vw - 24px); }
  /* 16px stops iOS Safari from zooming the page on input focus. */
  .m-sheet .inp, .m-sheet select, .m-sheet textarea, .sym-search .inp { font-size: 16px; }
  .m-sheet .inp { height: 32px; }
  .m-sheet .row label { width: auto; min-width: 56px; }
}

/* Bigger grab targets for fingers; primary-pointer mice are unaffected. */
@media (pointer: coarse) {
  .titlebar, .handle { touch-action: none; }
  .handle { width: 18px; height: 18px; }
  .handle::after { content: ""; position: absolute; inset: -8px; }
  .handle.nw { top: -10px; left: -10px; }
  .handle.ne { top: -10px; right: -10px; }
  .handle.sw { bottom: -10px; left: -10px; }
  .handle.se { bottom: -10px; right: -10px; }
  .handle.rot { top: -34px; }
}
