/* Card Gallery — quiet mobile workspace. */

:root{
  --black:#ffffff;
  --ink:#ffffff;
  --ink-2:#f2f2f7;
  --silver:#1d1d1f;
  --paper:#ffffff;
  --muted:#6e6e73;
  --dim:#8e8e93;
  --blue:#007aff;
  --red:#ff3b30;

  /* hairlines */
  --line:rgba(0,0,0,.14);
  --line-2:rgba(0,0,0,.08);
  --glass:rgba(255,255,255,.8);
  --glass-strong:rgba(255,255,255,.95);

  /* geometry */
  --r:12px;
  --r-md:18px;
  --r-pill:999px;

  /* type */
  --ui:-apple-system,BlinkMacSystemFont,"SF Pro Display","Segoe UI",sans-serif;
  --mono:ui-monospace,"SF Mono",Menlo,monospace;
  --track-label:.08em;
  --track-nav:.12em;

  /* motion */
  --ease:cubic-bezier(.32,.72,0,1);

  color-scheme:light;
}

*{box-sizing:border-box; -webkit-tap-highlight-color:transparent;}
html,body{height:100%;}
body{
  margin:0;
  background:var(--black);
  color:var(--silver);
  font-family:var(--ui);
  overflow-x:hidden;
  -webkit-font-smoothing:antialiased;
}

/* screens */
[data-screen="editor"] .screen-gallery{ display:none; }
[data-screen="gallery"] .screen-editor{ display:none; }

/* ───────────── shared chrome ───────────── */
.topbar{
  position:sticky; top:0; z-index:30;
  display:flex; align-items:center; justify-content:space-between;
  height:calc(52px + env(safe-area-inset-top)); padding:calc(env(safe-area-inset-top) + 8px) 18px 8px;
  background:rgba(255,255,255,.92); border-bottom:1px solid var(--line-2);
  -webkit-backdrop-filter:blur(18px); backdrop-filter:blur(18px);
}
.wordmark{
  font-size:15px; font-weight:700; letter-spacing:var(--track-nav);
  text-transform:uppercase; color:var(--silver); margin:0;
  flex:1; text-align:center;
}
.topbar .slot{ width:40px; display:flex; align-items:center; }
.topbar .slot.right{ justify-content:flex-end; }
.ver-tag{ font-family:var(--mono); font-size:9px; letter-spacing:.1em; color:var(--dim);
  border:1px solid var(--line); border-radius:var(--r-pill); padding:2px 8px; }

.iconbtn{
  width:40px; height:40px; border:none; background:transparent;
  color:var(--silver); display:grid; place-items:center; cursor:pointer;
  border-radius:var(--r); transition:opacity .15s var(--ease), transform .1s var(--ease);
}
.iconbtn:active{ transform:scale(.9); opacity:.7; }
.iconbtn svg{ width:22px; height:22px; }

/* ───────────── GALLERY ───────────── */
.grid{
  display:grid; grid-template-columns:1fr 1fr; gap:12px;
  padding:12px 12px calc(env(safe-area-inset-bottom) + 104px);
}
.cover{
  position:relative; overflow:hidden; cursor:pointer;
  border-radius:18px; aspect-ratio:4/5;
  background:var(--ink-2);
  border:1px solid var(--line-2);
  display:flex; align-items:flex-end;
  contain:layout paint style;
  content-visibility:auto;
  contain-intrinsic-size:auto 400px;
  transition:transform .18s var(--ease);
}
.cover:active{ transform:scale(.985); }
.cover .art{ position:absolute; inset:0; width:100%; height:100%; object-fit:cover; display:block; background:var(--ink-2); }
.cover .meta{
  position:relative; z-index:2; padding:10px 12px;
  display:flex; justify-content:space-between; width:100%;
  font-family:var(--mono); font-size:10px; letter-spacing:.16em;
  text-transform:uppercase; color:#fff;
  text-shadow:0 1px 8px rgba(0,0,0,.7);
}
.cover .meta .num{ color:rgba(255,255,255,.72); }
.cover .scrim{ position:absolute; inset:0; background:linear-gradient(180deg,transparent 55%, rgba(0,0,0,.45)); pointer-events:none; }
.cover-edit, .cover-revert, .cover-badge{
  position:absolute; z-index:3; top:10px;
  font-family:var(--mono); font-size:10px; letter-spacing:.1em;
  border-radius:var(--r-pill); cursor:pointer; border:1px solid rgba(255,255,255,.5);
  backdrop-filter:blur(8px); -webkit-backdrop-filter:blur(8px);
}
.cover-edit{ left:10px; padding:6px 12px; color:#fff; background:rgba(0,0,0,.35); }
.cover-edit:active{ transform:scale(.94); }
.cover-revert{ right:10px; width:30px; height:30px; display:grid; place-items:center; color:#fff; background:rgba(0,0,0,.35); font-size:14px; }
.cover-revert:active{ transform:scale(.94); }
.cover-badge{ left:50%; transform:translateX(-50%); top:10px; padding:4px 9px; color:#0a0b0c; background:var(--silver); font-weight:700; }
.cover[hidden]{ display:none; }
.cover .cover-edit[hidden], .cover .cover-revert[hidden]{ display:none; }

/* ───────────── SWIPE ───────────── */
.swipe{ position:fixed; inset:0; z-index:20; display:none;
  padding:calc(env(safe-area-inset-top) + 60px) 14px calc(env(safe-area-inset-bottom) + 100px); }
body[data-view="swipe"] .swipe{ display:block; }
body[data-view="swipe"] .grid{ display:none; }
.deck{ position:relative; width:100%; height:100%; max-width:440px; margin:0 auto; }
.scard{
  position:absolute; inset:0; border-radius:22px;
  overflow:hidden; outline:1px solid var(--line); outline-offset:-1px;
  background:var(--ink); will-change:transform; touch-action:none; user-select:none;
  -webkit-touch-callout:none; -webkit-user-drag:none;
  display:flex; align-items:flex-end;
}
.scard .art{ position:absolute; inset:0; width:100%; height:100%; object-fit:cover; display:block; background:var(--ink-2);
  pointer-events:none; -webkit-user-drag:none; }
.scard .meta{ position:relative; z-index:2; padding:16px; width:100%;
  pointer-events:none;
  display:flex; align-items:center; justify-content:space-between;
  font-family:var(--mono); font-size:11px; letter-spacing:.12em; text-transform:uppercase; color:#fff;
  text-shadow:0 1px 10px rgba(0,0,0,.8); }
.scard .tap-hint{ color:var(--blue); font-size:10px; letter-spacing:.14em;
  border:1px solid var(--blue); border-radius:var(--r-pill); padding:5px 10px; opacity:.9; }
.counter{ position:absolute; top:calc(env(safe-area-inset-top) + 20px); left:0; right:0; text-align:center;
  font-family:var(--mono); font-size:11px; letter-spacing:.2em; color:var(--muted); z-index:25; pointer-events:none; }

/* ───────────── DOCK ───────────── */
.dock{ position:fixed; left:0; right:0; bottom:0; z-index:40;
  display:flex; justify-content:center; padding:0 16px calc(env(safe-area-inset-bottom) + 16px); }
.dock-inner{
  display:flex; align-items:center; gap:2px; padding:5px;
  background:var(--glass-strong);
  border:1px solid var(--line);
  border-radius:var(--r-pill);
  box-shadow:0 12px 32px rgba(0,0,0,.12);
  -webkit-backdrop-filter:blur(20px) saturate(140%); backdrop-filter:blur(20px) saturate(140%);
}
.dock .iconbtn{ width:46px; height:46px; border-radius:var(--r-pill); }
.dock .iconbtn.primary{ background:var(--silver); color:var(--black); }
.dock .iconbtn.primary:active{ background:var(--paper); }
.dock .sep{ width:1px; height:22px; background:var(--line); margin:0 3px; }

/* ───────────── EDITOR ───────────── */
.screen-editor{ min-height:100dvh; overflow:hidden; }
.editor-top{ position:relative; z-index:60; display:flex; align-items:center; justify-content:space-between;
  height:calc(52px + env(safe-area-inset-top)); padding:calc(env(safe-area-inset-top) + 8px) 12px 8px; border-bottom:1px solid var(--line-2);
  background:rgba(255,255,255,.96); -webkit-backdrop-filter:blur(18px); backdrop-filter:blur(18px); }
.editor-top .name{ font-family:var(--mono); font-size:11px; letter-spacing:.16em; text-transform:uppercase; color:var(--muted); }
/* aspect selector lives in the top bar (replaces the title) */
.aspect-seg{ display:flex; gap:2px; background:var(--ink-2); border:1px solid var(--line-2); border-radius:var(--r); padding:2px; }
.aspect-seg button{ min-width:44px; height:32px; border:none; background:transparent; color:var(--muted); cursor:pointer;
  font-family:var(--mono); font-size:11px; letter-spacing:.06em; border-radius:2px; }
.aspect-seg button[aria-selected="true"]{ background:var(--silver); color:var(--black); }
.export-btn{ height:34px; padding:0 16px; border:none; border-radius:var(--r);
  background:var(--silver); color:var(--black); font-family:var(--ui);
  font-size:11px; font-weight:800; letter-spacing:.14em; text-transform:uppercase; cursor:pointer; }
.export-btn:active{ transform:scale(.96); }
.tbtn{ height:34px; padding:0 16px; border:1px solid var(--line-2); border-radius:var(--r);
  background:transparent; color:var(--silver); font-family:var(--ui);
  font-size:12px; font-weight:800; letter-spacing:.04em; cursor:pointer; }
.tbtn:active{ transform:scale(.96); }
.tbtn.primary{ background:var(--silver); color:#fff; border-color:var(--silver); }
.tbtn.primary:active{ background:#000; }
.tbtn.active{ background:var(--blue); color:#fff; border-color:var(--blue); }
.tbtn:disabled{ opacity:.4; pointer-events:none; }
.color-row{ display:flex; align-items:center; gap:10px; }
.colorin{ width:48px; height:40px; padding:0; border:1px solid var(--line-2); border-radius:var(--r); background:none; cursor:pointer; }
.colorin::-webkit-color-swatch-wrapper{ padding:4px; }
.colorin::-webkit-color-swatch{ border:none; border-radius:6px; }
.hexin{ flex:1; text-transform:uppercase; }

.stage{ position:fixed; inset:0; display:grid; place-items:center; background:#f5f5f7;
  padding:calc(env(safe-area-inset-top) + 68px) 16px calc(env(safe-area-inset-bottom) + 96px); }
.board{ position:relative; max-width:100%; max-height:100%; aspect-ratio:4/5;
  background:var(--ink); border:1px solid var(--line); border-radius:4px; overflow:hidden;
  box-shadow:0 12px 36px rgba(0,0,0,.1);
  touch-action:none; }  /* Konva canvas must own the gesture — otherwise Safari steals it as sheet scroll */
.board .art{ position:absolute; inset:0; background-size:cover; background-position:center; }

/* Five stable editor destinations. Detailed controls only appear after choosing one. */
.editor-dock{ position:fixed; left:0; right:0; bottom:0; z-index:60;
  display:grid; grid-template-columns:repeat(5,1fr); gap:2px;
  padding:8px 8px max(8px,env(safe-area-inset-bottom));
  background:rgba(255,255,255,.96); border-top:1px solid var(--line-2);
  -webkit-backdrop-filter:blur(18px); backdrop-filter:blur(18px); }
.editor-dock button{ min-width:0; height:54px; border:0; border-radius:12px; background:transparent; color:var(--muted);
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; font:600 10px/1 var(--ui); cursor:pointer; }
.editor-dock svg{ width:21px; height:21px; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.editor-dock button[aria-current="page"]{ color:var(--blue); background:#eef6ff; }
.editor-dock button:active{ transform:scale(.96); }

/* Contextual tray. Libraries switch to a dedicated full-screen browser. */
.sheet{ position:fixed; left:0; right:0; top:var(--sheet-y, 55%); bottom:0; z-index:50;
  display:flex; flex-direction:column; min-height:0;
  background:var(--glass-strong); border-top:1px solid var(--line);
  -webkit-backdrop-filter:blur(24px) saturate(140%); backdrop-filter:blur(24px) saturate(140%);
  border-radius:24px 24px 0 0;
  box-shadow:0 -12px 40px rgba(0,0,0,.08);
  opacity:0; visibility:hidden; pointer-events:none;
  transition:top .35s var(--ease),opacity .2s ease,visibility 0s linear .35s;
  padding-bottom:env(safe-area-inset-bottom);
}
.sheet.is-open{ z-index:70; opacity:1; visibility:visible; pointer-events:auto; transition-delay:0s; }
.sheet[data-mode="library"]{ top:calc(env(safe-area-inset-top) + 52px); border-radius:0; box-shadow:none; }
.sheet[data-mode="library"] .grab{ display:none; }
.sheet[data-mode="library"] .sheet-head{ padding:15px 18px; }
.sheet[data-mode="library"] .sheet-body{ padding-top:8px; }
.sheet[data-mode="mask"]{ top:var(--sheet-y,58%); }
.sheet .grab{ width:36px; height:5px; border-radius:var(--r-pill); background:#d1d1d6;
  margin:10px auto 6px; flex:0 0 auto; touch-action:none; }
.sheet-head{ display:flex; align-items:center; justify-content:space-between; flex:0 0 auto; padding:2px 18px 12px; border-bottom:1px solid var(--line-2); }
.sheet-title{ font-size:11px; font-weight:800; letter-spacing:var(--track-label); text-transform:uppercase; color:var(--silver); }
.sheet-body{ flex:1 1 auto; min-height:0; padding:16px 18px max(24px,env(safe-area-inset-bottom));
  overflow-y:auto; overscroll-behavior:contain; touch-action:pan-y; -webkit-overflow-scrolling:touch; }

/* technical controls */
.ctl{ margin-bottom:20px; }
.ctl-label{ display:flex; justify-content:space-between; align-items:baseline; margin-bottom:9px; }
.ctl-label .k{ font-size:10px; font-weight:700; letter-spacing:.2em; text-transform:uppercase; color:var(--muted); }
.ctl-label .v{ font-family:var(--mono); font-size:11px; color:var(--silver); letter-spacing:.04em; }

input[type=range]{ -webkit-appearance:none; appearance:none; width:100%; height:6px;
  background:var(--ink-2); border:1px solid var(--line-2); border-radius:var(--r-pill); outline:none; }
input[type=range]::-webkit-slider-thumb{ -webkit-appearance:none; width:20px; height:20px; border-radius:50%;
  background:var(--paper); cursor:pointer; border:1px solid var(--line); box-shadow:0 1px 4px rgba(0,0,0,.18); }
input[type=range]::-moz-range-thumb{ width:20px; height:20px; border-radius:50%; background:var(--paper); border:1px solid var(--line); }

.seg{ display:flex; gap:2px; background:var(--ink-2); border:1px solid var(--line-2); border-radius:var(--r); padding:2px; }
.seg button{ flex:1; height:38px; border:none; background:transparent; color:var(--muted);
  font-family:var(--mono); font-size:11px; letter-spacing:.08em; cursor:pointer; border-radius:2px; text-transform:uppercase; }
.seg button[aria-selected="true"]{ background:var(--paper); color:var(--blue); box-shadow:0 1px 3px rgba(0,0,0,.1); }

.insp-actions,.hub-actions{ display:flex; align-items:center; gap:6px; margin-bottom:10px; }
.sheet[data-mode="library"] .insp-actions{ position:sticky; top:-8px; z-index:2; margin:0 -18px 12px; padding:8px 18px; background:rgba(255,255,255,.96); border-bottom:1px solid var(--line-2); }
.marklib{ display:grid; grid-template-columns:repeat(4,1fr); gap:8px; }
.markbtn{ aspect-ratio:1; display:grid; place-items:center; cursor:pointer; overflow:hidden;
  background:var(--ink-2); border:1px solid var(--line-2); border-radius:var(--r); color:var(--silver);
  font-family:var(--mono); font-size:9px; letter-spacing:.04em; padding:0; }
.markbtn svg{ width:24px; height:24px; }
.markbtn img{ width:100%; height:100%; display:block; object-fit:contain; pointer-events:none; }
.markbtn.grain-thumb img{ object-fit:cover; }
.markbtn.on{ box-shadow:0 0 0 2px var(--paper), 0 0 0 4px var(--blue); }
.markbtn:active{ background:var(--ink); }
.markbtn.imgicon{ background-size:contain; background-repeat:no-repeat; background-position:center; background-color:var(--ink-2); }
.toast{ position:fixed; left:50%; bottom:calc(env(safe-area-inset-bottom) + 24px); transform:translate(-50%,20px);
  background:var(--silver); color:var(--black); font-size:13px; font-weight:600; letter-spacing:.02em;
  padding:10px 18px; border-radius:var(--r-pill); z-index:80; opacity:0; pointer-events:none;
  transition:opacity .25s var(--ease), transform .25s var(--ease); }
.toast.show{ opacity:1; transform:translate(-50%,0); }
.iconbtn.danger{ color:var(--red); }
.txtin{ width:100%; background:var(--ink-2); border:1px solid var(--line-2); border-radius:var(--r);
  color:var(--silver); font-family:var(--ui); font-size:14px; padding:10px 12px; resize:vertical; outline:none; }
.txtin:focus{ border-color:var(--blue); }
.selectin{ width:100%; height:44px; padding:0 12px; border:1px solid var(--line-2); border-radius:var(--r);
  background:var(--ink-2); color:var(--silver); font-family:var(--ui); font-size:14px; outline:none; }
.selectin:focus-visible{ border-color:var(--blue); }
.add-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:3px; }
.add-grid button{ min-height:48px; border:1px solid var(--line-2); border-radius:var(--r); background:var(--ink-2);
  color:var(--silver); font:700 10px/1 var(--ui); letter-spacing:.14em; text-transform:uppercase; }
.wide-action{ width:100%; min-height:44px; margin-bottom:20px; border:1px solid var(--line-2); border-radius:var(--r);
  background:var(--ink-2); color:var(--silver); font:700 10px/1 var(--ui); letter-spacing:.14em; text-transform:uppercase; }
.color-input-row input[type=color]{ width:100%; height:44px; padding:4px; border:1px solid var(--line-2); border-radius:var(--r);
  background:var(--ink-2); }
.luts{ display:flex; gap:6px; flex-wrap:wrap; }
.lut{ height:36px; padding:0 12px; border-radius:var(--r); cursor:pointer;
  background:var(--ink-2); border:1px solid var(--line-2); color:var(--muted);
  font-family:var(--mono); font-size:11px; letter-spacing:.04em; }
.lut.on{ background:var(--silver); color:var(--black); border-color:transparent; }
.swatches{ display:flex; gap:8px; flex-wrap:wrap; }
.swatch{ width:34px; height:34px; border-radius:50%; border:1px solid var(--line); cursor:pointer; }
.swatch[aria-selected="true"]{ box-shadow:0 0 0 2px var(--black), 0 0 0 3px var(--blue); }

/* tool rail (no selection) — icon row */
.toolrow{ display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
.tool{ height:76px; border:1px solid var(--line-2); border-radius:14px; background:var(--paper);
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:8px; cursor:pointer; color:var(--silver); }
.tool:active{ background:var(--ink-2); }
.tool svg{ width:22px; height:22px; }
.tool span{ max-width:100%; padding:0 3px; font-size:8px; font-weight:700; letter-spacing:.12em; text-transform:uppercase; color:var(--muted); }
.tool-note{ margin-top:8px; color:var(--muted); font-size:12px; line-height:1.5; }
.design-summary{ display:flex; flex-direction:column; gap:5px; padding:4px 0 24px; }
.design-summary span,.layer-kind{ color:var(--muted); font-size:11px; text-transform:uppercase; letter-spacing:.08em; }
.design-summary strong{ font-size:20px; font-weight:650; letter-spacing:-.02em; }
.danger-action{ color:var(--red); }
.layer-list{ display:flex; flex-direction:column; gap:1px; }
.layer-item{ display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; border-bottom:1px solid var(--line-2); }
.layer-select{ min-width:0; min-height:58px; border:0; background:transparent; text-align:left; display:flex; flex-direction:column; justify-content:center; gap:4px; padding:8px 6px; color:var(--silver); }
.layer-select strong{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:14px; font-weight:600; }
.layer-eye{ min-width:52px; height:40px; border:0; border-radius:10px; background:var(--ink-2); color:var(--muted); font:600 11px/1 var(--ui); }
.empty-note{ color:var(--muted); font-size:14px; text-align:center; padding:40px 0; }
.target-note{ margin:0 0 14px; padding:10px 12px; border-radius:10px; background:#eef6ff;
  color:#0058b0; font-size:12px; font-weight:700; line-height:1.4; text-align:right; direction:rtl; }
.replace-image{ color:var(--blue); border-color:rgba(0,122,255,.22); background:#f3f8ff; }

@media (max-width:899px){
  body[data-panel="open"] .stage{
    bottom:calc(100% - var(--panel-top,68%));
    padding-bottom:12px;
  }
  .sheet .grab{ width:52px; height:6px; margin-top:9px; }
  .sheet-head{ min-height:42px; }
}

@media (max-width:600px){
  .topbar,.editor-top,.dock-inner,.editor-dock{
    -webkit-backdrop-filter:none;
    backdrop-filter:none;
  }
  .topbar,.editor-top,.editor-dock{ background:#fff; }
  .dock-inner{ background:rgba(255,255,255,.98); }
  .editor-top{
    height:calc(96px + env(safe-area-inset-top));
    padding:env(safe-area-inset-top) 8px 8px;
    display:grid;
    grid-template-columns:40px 40px 40px minmax(0,1fr) auto;
    grid-template-rows:40px 36px;
    gap:4px;
    justify-content:normal;
  }
  .editor-top #backBtn{ grid-column:1; grid-row:1; }
  .editor-top #undoBtn{ grid-column:2; grid-row:1; }
  .editor-top #redoBtn{ grid-column:3; grid-row:1; }
  .editor-top #savePresetBtn{ grid-column:4; grid-row:1; justify-self:end; }
  .editor-top #exportBtn{ grid-column:5; grid-row:1; justify-self:end; margin-inline-start:4px; }
  .editor-top #aspectSeg{ grid-column:1 / span 3; grid-row:2; justify-self:start; }
  .editor-top #origBtn{ grid-column:4; grid-row:2; justify-self:end; }
  .editor-top #saveBtn{ grid-column:5; grid-row:2; justify-self:stretch; }
  .editor-top .aspect-seg button{ min-width:36px; height:30px; padding:0 5px; }
  .editor-top .tbtn,.editor-top .export-btn{ height:34px; padding:0 11px; }
  .stage{ padding-top:calc(env(safe-area-inset-top) + 112px); }
  .sheet[data-mode="library"]{ top:calc(env(safe-area-inset-top) + 96px); }
}

@media (min-width:900px){
  .editor-top{ height:60px; padding:8px 16px; }
  .editor-dock{ top:60px; right:auto; bottom:0; width:88px; grid-template-columns:1fr; grid-template-rows:repeat(5,74px);
    align-content:start; gap:4px; padding:14px 8px; border-top:0; border-right:1px solid var(--line-2); }
  .editor-dock button{ height:70px; }
  .stage{ left:88px; padding:84px 40px 28px; transition:right .3s var(--ease); }
  body[data-panel="open"] .stage{ right:360px; }
  .sheet,.sheet[data-mode="library"],.sheet[data-mode="mask"]{ left:auto; right:0; top:60px; bottom:0; width:360px;
    border-radius:0; border-top:0; border-left:1px solid var(--line-2); box-shadow:-16px 0 36px rgba(0,0,0,.06); }
  .sheet[data-mode="library"]{ width:420px; }
  body:has(.sheet[data-mode="library"].is-open) .stage{ right:420px; }
  .sheet .grab{ display:none; }
  .sheet-head,.sheet[data-mode="library"] .sheet-head{ padding:18px 20px; }
  .sheet-body{ padding:18px 20px 28px; }
  .toolrow{ grid-template-columns:repeat(2,1fr); gap:8px; }
  .marklib{ grid-template-columns:repeat(3,1fr); }
  .board{ max-width:min(70vw,760px); max-height:calc(100dvh - 120px); }
}

@media (prefers-reduced-transparency: reduce){
  .dock-inner,.sheet{ background:#fff; backdrop-filter:none; }
  .topbar{ backdrop-filter:none; background:#fff; }
}
@media (prefers-reduced-motion: reduce){
  .sheet{ transition:none; }
  .cover,.iconbtn{ transition:none; }
}
input[type=file]{ display:none; }

/* Phase 2 — unified numeric control */
.ctl-num .num-wrap{ display:flex; align-items:center; gap:4px; }
.ctl-num .num{ width:56px; text-align:right; font:600 12px/1 var(--mono); color:var(--silver);
  background:var(--panel,#fff); border:1px solid var(--line-2); border-radius:8px; padding:5px 7px; }
.ctl-num .unit{ font:600 10px var(--mono); color:var(--muted); }
.ctl-num .mini{ width:26px; height:26px; border:1px solid var(--line-2); background:var(--panel,#fff);
  border-radius:7px; color:var(--muted); font-size:11px; line-height:1; display:flex; align-items:center; justify-content:center; cursor:pointer; padding:0; }
.ctl-num .mini:active{ background:var(--blue); color:#fff; border-color:var(--blue); }
.ctl-num .mini.reset{ font-size:13px; }
.ctl-num .k[data-scrub]{ cursor:ew-resize; user-select:none; }

/* Phase 5 — inspector sections, paired controls, alignment grid, multi-select header */
.section{ margin-bottom:14px; border:1px solid var(--line-2); border-radius:var(--r); overflow:hidden; background:var(--paper); }
.section-head{ width:100%; display:flex; align-items:center; justify-content:space-between;
  padding:12px 14px; background:transparent; border:0; cursor:pointer; color:var(--silver); }
.section-head span:first-child{ font-size:10px; font-weight:800; letter-spacing:.2em; text-transform:uppercase; color:var(--silver); }
.section-head .chev{ font-size:11px; color:var(--muted); transition:transform .2s var(--ease); }
.section[data-open="false"] .section-head .chev{ transform:rotate(-90deg); }
.section-body{ padding:4px 14px 14px; }
.section[data-open="false"] .section-body{ display:none; }

.ctl-pair{ margin-bottom:16px; }
.ctl-pair .ctl-label{ margin-bottom:8px; }
.ctl-pair .pair-cols{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.ctl-pair .pair-col{ min-width:0; }
.ctl-pair .pair-col > .ctl-num{ margin-bottom:0; }
.ctl-pair .pair-col .ctl-label{ margin-bottom:6px; }

.align-grid{ display:grid; grid-template-columns:repeat(3,1fr); grid-template-rows:repeat(5,28px); gap:4px; margin-bottom:8px; }
.align-cell{ border:1px solid var(--line-2); border-radius:8px; background:var(--ink-2); cursor:pointer; padding:0; }
.align-cell:hover{ border-color:var(--blue); background:var(--paper); }
.align-cell:active{ background:var(--blue); }
.align-note{ font-size:10px; letter-spacing:.1em; text-transform:uppercase; color:var(--muted); }
.align-cell.fine{ opacity:.5; }
.align-cell.fine:hover{ opacity:1; }

.multi-head{ padding:2px 0 12px; }
.multi-head strong{ font-size:14px; font-weight:700; color:var(--silver); letter-spacing:.02em; }
