/* Garmin WF — studio UI. Mobile-first; refined, tactile, premium.
   The watch face is drawn on <canvas>; everything here is chrome around it. */
:root {
  --bg: #07080b;
  --bg-2: #0c0e12;
  --panel: #111319;
  --panel-2: #171a21;
  --line: #20242c;
  --line-2: #2b303a;
  --txt: #f1f3f7;
  --txt-2: #9aa2b1;
  --txt-3: #666e7d;
  --accent: #ffffff;         /* UI highlight / active — monochrome */
  --accent-2: #c9ced6;       /* dimmed highlight for icons/text on dark */
  --on-accent: #0b0c10;      /* text/icon colour on a white accent fill */
  --danger: #e5484d;
  --panel-glass: rgba(15,17,23,.96); /* floating tool panel */
  --rail-bg: rgba(18,20,27,.74);     /* glassy nav rail */
  --glass-brd: rgba(255,255,255,.1);
  --glass-hi: rgba(255,255,255,.08);
  --focus-ring: rgba(255,255,255,.14);
  --r: 6px; --r-sm: 5px;     /* squared, technical — Swiss/Garmin, not rounded */
  --shadow: 0 12px 34px rgba(0,0,0,.5);
  /* ── control system: one scale for every input, both themes ── */
  --ctl-h: 34px;             /* height of selects / number fields */
  --ctl-r: 9px;              /* radius of inputs */
  --lbl-w: 62px;             /* inspector label column */
  --nav-btn: 40px;           /* nav touch target (mobile) */
  --nav-ico: 20px;           /* nav icon size */
  /* icon scale — one system: inline chips → controls → nav */
  --ico-xs: 14px;            /* small chips (layer type, list keys) */
  --ico-sm: 16px;            /* standard control icons (menu, mini-btn, list, actions, info) */
  --ico-md: 20px;            /* feature-tile icons (Add element, shape gallery) */
  font-synthesis: none;
}
:root[data-theme="light"] {
  --bg: #f4f1ec;             /* warm light — a white watch reads against it */
  --bg-2: #ece7df;
  --panel: #fffdfa;
  --panel-2: #f3efe8;
  --line: #e7e1d7;
  --line-2: #d8d1c4;
  --txt: #1b1813;
  --txt-2: #6b6459;
  --txt-3: #9c9486;
  --accent: #14171c;         /* dark accent on a light UI */
  --accent-2: #3c434f;
  --on-accent: #ffffff;
  --panel-glass: rgba(255,253,250,.92);
  --rail-bg: rgba(255,253,250,.82);
  --glass-brd: rgba(0,0,0,.06);
  --glass-hi: rgba(255,255,255,.65);
  --focus-ring: rgba(20,23,28,.13);
  --shadow: 0 12px 34px rgba(20,23,28,.14);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--txt);
  font: 13px/1.45 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
button { font-family: inherit; cursor: pointer; color: inherit; border: none; background: none; }
button:disabled { opacity: .35; cursor: default; }
i.ph, i[class^="ph-"], i[class*=" ph-"] { font-size: 1.05em; line-height: 1; vertical-align: -0.08em; }

.wf-logo { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: 15px; letter-spacing: -.04em; text-indent: -.02em; flex: none; }

/* ── Loader ─────────────────────────────────────────── */
.loader { position: fixed; inset: 0; z-index: 999; background: radial-gradient(600px 400px at 50% 40%, #0f1620, #05060a); display: flex; align-items: center; justify-content: center; transition: opacity .45s ease; }
.loader.gone { opacity: 0; pointer-events: none; }
.loader-inner { text-align: center; }
.loader-mark { font-weight: 800; font-size: 30px; letter-spacing: .06em; display: inline-flex; gap: 10px; align-items: center; }
.loader-mark .lm-g { color: #fff; }
.loader-mark .lm-wf { display: inline-flex; align-items: center; justify-content: center; width: 1.55em; height: 1.55em; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: .8em; }
.loader-bar { width: 190px; height: 3px; border-radius: 3px; background: rgba(255,255,255,.1); margin: 20px auto 10px; overflow: hidden; }
.loader-bar span { display: block; height: 100%; width: 40%; border-radius: 3px; background: linear-gradient(90deg, transparent, var(--accent-2), transparent); animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-120%); } 100% { transform: translateX(360%); } }
.loader-sub { color: var(--txt-3); font-size: 12px; letter-spacing: .04em; }

.app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: 40px; z-index: 50; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: var(--shadow); padding: 6px; width: 180px; display: flex; flex-direction: column; }
.menu.hidden { display: none; }
.menu button { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 8px; color: var(--txt); font-size: 12.5px; text-align: left; }
.menu button:hover { background: var(--panel-2); }
.menu button.on::after { content: '\2713'; margin-left: auto; font-size: 12px; color: var(--accent-2); }
.menu i { color: var(--txt-2); font-size: var(--ico-sm); }
/* menu rows with a toggle switch (grid / safe zones / theme) */
.menu-toggle > span:not(.mtog) { flex: 1; }
.menu button.menu-toggle.on::after { content: none; }        /* switch replaces the checkmark */
.mtog { flex: none; width: 34px; height: 20px; border-radius: 999px; background: var(--line-2); position: relative; transition: background .15s; }
.mtog::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--panel); box-shadow: 0 1px 2px rgba(0,0,0,.35); transition: left .15s; }
.menu-toggle.on .mtog { background: var(--accent); }
.menu-toggle.on .mtog::after { left: 16px; background: var(--on-accent); }
.menu-label { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--txt-3); padding: 6px 10px 3px; }
.menu-sep { height: 1px; background: var(--line); margin: 5px 6px; }
.menu-legal { font-size: 9.5px; line-height: 1.45; color: var(--txt-3); padding: 2px 10px 4px; margin: 0; }
.menu-brand { padding: 6px 10px 5px; }
.menu-wordmark { display: block; font-weight: 800; font-size: 13px; letter-spacing: .01em; text-transform: uppercase; color: var(--txt); }
.menu-brand-tag { display: block; font-size: 11px; color: var(--txt-3); margin-top: 3px; letter-spacing: .01em; }

/* ── Full-bleed canvas · ONE floating nav · overlay panels ── */
.workspace { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px 24px 96px;
  background: radial-gradient(620px 460px at 50% 42%, var(--bg-2), var(--bg));
  transition: background .24s ease; }
/* mobile: when a bottom-sheet panel is open, lift + shrink ONLY the watch (not the stage bg,
   which would scale into a weird box), and float the glow up to sit behind it */
.watch-frame { transition: transform .18s cubic-bezier(.4,0,.2,1); transform-origin: center; transform: scale(var(--zoom, 1)); }
.workspace.sheet-open .watch-frame { transform: translateY(-14vh) scale(calc(.66 * var(--zoom, 1))); }
.workspace.sheet-open .stage { background: radial-gradient(460px 380px at 50% 24%, var(--bg-2), var(--bg)); }
.float-brand { position: absolute; top: 16px; left: 18px; z-index: 15; opacity: .96; pointer-events: none; }
/* zoom indicator (click to reset to 100%) */
.zoom-badge { position: fixed; top: 14px; right: 14px; z-index: 22; height: 30px; padding: 0 12px; display: inline-flex; align-items: center; border-radius: 999px; background: var(--rail-bg); border: 1px solid var(--glass-brd); color: var(--txt); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; backdrop-filter: blur(16px) saturate(160%); -webkit-backdrop-filter: blur(16px) saturate(160%); box-shadow: var(--shadow); }
.zoom-badge:hover { background: var(--panel-2); }
.zoom-badge.hidden { display: none; }
@media (min-width: 960px) { .zoom-badge { top: 18px; right: 18px; } }

/* overlay panel — mobile: a bottom sheet above the nav bar */
.tool-panel { position: fixed; z-index: 30; left: 10px; right: 10px; bottom: 74px; top: auto; max-height: 54vh;
  display: flex; flex-direction: column;
  background: var(--panel-glass); backdrop-filter: blur(22px) saturate(160%); -webkit-backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid var(--glass-brd); border-radius: 18px; box-shadow: var(--shadow), inset 0 1px 0 var(--glass-hi);
  overflow: hidden;
  opacity: 0; visibility: hidden; transform: translateY(16px); transition: opacity .18s, transform .18s, visibility .18s; }
.tool-panel.open { opacity: 1; visibility: visible; transform: none; }
/* mobile bottom-sheet grab handle */
.tool-panel::before { content: ''; position: absolute; top: 7px; left: 50%; transform: translateX(-50%); width: 40px; height: 4px; border-radius: 999px; background: var(--line-2); z-index: 2; }
.panel-head { display: flex; align-items: center; gap: 6px; height: 50px; padding: 6px 8px 0 16px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 14px; flex: none; }
.panel-close { margin-left: auto; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; color: var(--txt-3); font-size: var(--ico-sm); }
.panel-close:hover { background: var(--panel-2); color: var(--txt); }
.panel-body { flex: 0 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 14px; }
.panel-sec { display: none; }
.panel-sec.on { display: block; }
.panel-sec .inspector { padding: 0; }

/* the single floating navigation — mobile: same floating pill, at the bottom */
.nav-rail { position: fixed; z-index: 40; left: 10px; right: 10px; bottom: 12px;
  display: flex; flex-direction: row; align-items: center; justify-content: space-around; gap: 1px; padding: 6px;
  background: var(--rail-bg); backdrop-filter: blur(26px) saturate(160%); -webkit-backdrop-filter: blur(26px) saturate(160%);
  border: 1px solid var(--glass-brd); border-radius: 999px;
  box-shadow: 0 14px 40px rgba(0,0,0,.32), inset 0 1px 0 var(--glass-hi); }
.nav-div { flex: none; align-self: center; width: 1px; height: 20px; margin: 0 4px; background: var(--glass-brd); }
.nav-btn { position: relative; width: var(--nav-btn); height: var(--nav-btn); display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--txt-2); font-size: var(--nav-ico); transition: color .14s, background .14s, box-shadow .18s; }
.nav-btn:hover:not(:disabled) { color: var(--txt); background: var(--panel-2); }
.nav-btn:disabled { opacity: .3; }
.nav-btn.on { color: var(--on-accent); background: var(--accent); }
/* preview is a mode, not a panel tab — show it as a ring so it doesn't read as a second selection */
#previewBtn.on { color: var(--txt); background: transparent; box-shadow: inset 0 0 0 2px var(--accent); }
#previewBtn.on:hover { background: var(--panel-2); }
.nav-badge { position: absolute; top: 1px; right: 3px; font-size: 9.5px; font-weight: 700; color: var(--txt-2); }
.nav-btn.on .nav-badge { color: rgba(11,12,16,.7); }
.nav-btn.nav-accent { color: var(--accent-2); }
.nav-btn.nav-accent:hover:not(:disabled) { color: var(--on-accent); background: var(--accent); }
.menu button.on { color: var(--accent-2); }
.menu button.menu-cta { color: var(--on-accent); background: var(--accent); font-weight: 700; }
.menu button.menu-cta i { color: var(--on-accent); }
.menu button.menu-cta:hover { background: var(--accent); filter: brightness(1.06); }
/* responsive show/hide — base is mobile-first */
.desktop-only { display: none !important; }
.nav-rail .menu { top: auto; bottom: 56px; right: 6px; }   /* same gap above the bar as a tool panel (bottom:74px) */
/* instant hover tooltips (from aria-label) — mobile: above the icon */
.nav-btn[aria-label]::after { content: attr(aria-label); position: absolute; bottom: calc(100% + 9px); left: 50%; transform: translateX(-50%) translateY(4px);
  background: #04060a; color: #fff; font-size: 11px; font-weight: 600; padding: 4px 9px; border-radius: 7px; white-space: nowrap;
  border: 1px solid var(--line-2); box-shadow: 0 6px 18px rgba(0,0,0,.5); pointer-events: none; opacity: 0; transition: opacity .12s ease, transform .12s ease; z-index: 60; }
.nav-btn[aria-label]:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Face */
.select { height: var(--ctl-h); border: 1px solid var(--line); background: var(--panel); color: var(--txt); border-radius: var(--ctl-r); padding: 0 34px 0 12px; font-size: 12.5px; outline: none; transition: border-color .14s, box-shadow .14s;
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b93a1' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 12px; }
.select:hover { border-color: var(--line-2); }
.select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.select.full { width: 100%; }
.font-select { text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.popover.font-pop { border-radius: 12px; padding: 6px; gap: 0; }
.font-list { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.font-list::-webkit-scrollbar { width: 7px; }
.font-list::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
.font-item { text-align: left; padding: 8px 12px; border-radius: 7px; color: var(--txt-2); font-size: 16px; line-height: 1.15; white-space: nowrap; transition: background .1s, color .1s; }
.font-item:hover { background: var(--panel-2); color: var(--txt); }
.font-item.on { background: var(--accent); color: var(--on-accent); }
.tpl-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.tpl-tile { display: flex; flex-direction: column; gap: 6px; padding: 0; border: none; background: none; }
.tpl-thumb { width: 100%; aspect-ratio: 1; border-radius: 50%; background: #0a0b0e center/cover no-repeat; border: 1px solid var(--line); transition: .14s; }
.tpl-thumb.rect { border-radius: 8px; }
.tpl-tile:hover .tpl-thumb { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(255,255,255,.22); }
.tpl-name { font-size: 10.5px; color: var(--txt-2); text-align: center; }
.tpl-tile:hover .tpl-name { color: var(--txt); }

/* Elements */
.add-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.add-btn { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 13px 6px; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; color: var(--txt-2); transition: .14s; }
.add-btn i { font-size: var(--ico-md); color: var(--txt); }
.add-btn span { font-size: 11.5px; }
.add-btn:hover { border-color: var(--accent); color: var(--txt); transform: translateY(-1px); }

/* Layers */
.layer-list { display: flex; flex-direction: column; gap: 3px; }
.layer-item { display: flex; align-items: center; gap: 4px; border: 1px solid transparent; border-radius: var(--r-sm); padding: 2px 4px 2px 2px; }
.layer-item.on { border-color: var(--accent); background: rgba(255,255,255,.07); }
.layer-item:hover { background: var(--panel); }
.layer-item.hidden-layer .layer-txt { opacity: .4; text-decoration: line-through; }
.layer-name { display: flex; align-items: center; gap: 9px; flex: 1; padding: 7px 6px; text-align: left; font-size: 12.5px; color: var(--txt); overflow: hidden; }
.layer-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-ico { display: inline-flex; width: 24px; height: 24px; align-items: center; justify-content: center; border-radius: 6px; background: var(--panel-2); color: var(--txt-2); font-size: var(--ico-xs); flex: none; }
.layer-item.on .layer-ico { background: var(--accent); color: var(--on-accent); }
.layer-grip { display: inline-flex; align-items: center; color: var(--txt-3); font-size: var(--ico-xs); cursor: grab; opacity: .5; margin-right: -2px; }
.layer-item:hover .layer-grip { opacity: .8; }
.layer-item.dragging { opacity: .4; }
.layer-item.drop-target { box-shadow: inset 0 2px 0 var(--accent); }
.layer-tools { display: flex; gap: 0; }
.mini-btn { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; color: var(--txt-3); font-size: var(--ico-xs); }
.mini-btn:hover { background: var(--panel-2); color: var(--txt); }
.mini-btn.danger:hover { color: var(--danger); }

.bg-controls { display: flex; flex-direction: column; gap: 10px; }

/* ── Stage / watch ──────────────────────────────────── */
.watch-frame { position: relative; overflow: hidden; }
.watch-frame.previewing { overflow: visible; }
#face { display: block; touch-action: none; box-shadow: 0 16px 44px rgba(0,0,0,.55), 0 0 0 7px #0a0b0e, 0 0 0 8px #2b2f38; border-radius: inherit; }
.preview3d-canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; border-radius: inherit; cursor: grab; filter: drop-shadow(0 18px 30px rgba(0,0,0,.16)); }

/* ── Inspector ──────────────────────────────────────── */
.inspector { padding: 15px 14px 44px; display: flex; flex-direction: column; gap: 11px; }
.insp-empty { text-align: center; color: var(--txt-3); padding: 40px 16px; }
.insp-empty i { font-size: 30px; opacity: .5; }
.insp-empty p { margin: 12px 0 4px; font-size: 12.5px; }
.dim { color: var(--txt-3); font-size: 11.5px; }
.insp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.insp-type { font-weight: 700; font-size: 13.5px; text-transform: capitalize; }
.insp-acts { display: flex; gap: 6px; }
.act-btn { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; color: var(--txt-2); font-size: 11.5px; font-weight: 550; }
.act-btn i { font-size: var(--ico-sm); }
.insp-acts { display: flex; gap: 4px; }
.ico-btn { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; color: var(--txt-3); font-size: var(--ico-sm); transition: color .14s, background .14s; }
.ico-btn:hover { color: var(--txt); background: var(--panel-2); }
.ico-btn.danger:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.act-btn:hover { color: var(--txt); border-color: var(--line-2); }
.insp-note { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--txt-2); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.insp-note i { color: var(--accent-2); }

.ctl-row { display: flex; align-items: center; gap: 8px; min-height: 34px; }
.ctl-lbl { width: var(--lbl-w); flex: none; font-size: 11.5px; color: var(--txt-2); font-weight: 500; }
.ctl-row > .slider, .ctl-row > .seg, .ctl-row > .select, .ctl-row > .text-input, .ctl-row > .pk-swrow, .ctl-row > .slider-wrap { flex: 1; }
.slider-wrap { display: flex; align-items: center; gap: 9px; }
.slider-wrap .slider { flex: 1; }
.slider-val { min-width: 26px; text-align: right; font-size: 11.5px; color: var(--txt); font-variant-numeric: tabular-nums; }

.slider { -webkit-appearance: none; appearance: none; height: 6px; border-radius: 999px; outline: none; cursor: pointer;
  background: linear-gradient(to right, var(--accent) 0, var(--accent) var(--val, 50%), var(--line-2) var(--val, 50%), var(--line-2) 100%); }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); border: 3px solid var(--panel-2); box-shadow: 0 1px 4px rgba(0,0,0,.35); cursor: grab; transition: transform .1s; }
.slider::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.12); }
.slider::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--accent); border: 3px solid var(--panel-2); box-shadow: 0 1px 4px rgba(0,0,0,.35); cursor: grab; }
.slider:focus-visible { box-shadow: 0 0 0 3px var(--focus-ring); }

.seg { display: flex; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 3px; gap: 3px; }
.seg button { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; height: calc(var(--ctl-h) - 8px); display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; color: var(--txt-2); font-size: 12px; font-weight: 600; }   /* seg total = --ctl-h, aligns with selects */
.seg button i { font-size: var(--ico-sm); }
.seg-fit button { flex: 0 0 auto; padding: 0 14px; }   /* size to content (e.g. "Universal 1080²") instead of equal-width squeeze */
.seg button.on { background: var(--accent); color: var(--on-accent); }
.seg button:hover:not(.on) { color: var(--txt); }

.text-input { min-width: 0; border: 1px solid var(--line); background: var(--panel); color: var(--txt); border-radius: var(--ctl-r); padding: 8px 10px; font-size: 12.5px; outline: none; resize: vertical; font-family: inherit; transition: border-color .14s, box-shadow .14s; }
.text-input:hover { border-color: var(--line-2); }
.text-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }

.toggle { width: 40px; height: 23px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel); position: relative; transition: .15s; flex: none; }
.toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: var(--txt-3); transition: .15s; }
.toggle.on { background: var(--accent); border-color: var(--accent); }
.toggle.on::after { left: 19px; background: var(--on-accent); }

.btn { height: var(--ctl-h); display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); background: var(--panel); color: var(--txt); border-radius: var(--ctl-r); font-weight: 600; font-size: 12.5px; padding: 0 14px; transition: border-color .14s, background .14s; }
.btn:hover { border-color: var(--line-2); background: var(--panel-2); }
.btn:active { transform: translateY(0.5px); }
.btn.full { width: 100%; }
.btn.ghost { background: none; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn.btn-primary:hover { filter: brightness(1.06); background: var(--accent); }

/* numeric fields + anchor grid (inspector) */
.num-input { width: 100%; min-width: 0; height: var(--ctl-h); border: 1px solid var(--line); background: var(--panel); color: var(--txt); border-radius: var(--ctl-r); padding: 0 8px; font-size: 12.5px; font-variant-numeric: tabular-nums; outline: none; -moz-appearance: textfield; }
.num-input::-webkit-outer-spin-button, .num-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num-input:focus { border-color: var(--accent); }
.ctl-row > .xy-row { flex: 1; display: flex; gap: 8px; }
.xy-field { flex: 1; height: var(--ctl-h); box-sizing: border-box; display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); border-radius: var(--ctl-r); padding-left: 9px; transition: border-color .14s, box-shadow .14s; }
.xy-field:hover { border-color: var(--line-2); }
.xy-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.xy-field .num-input { border: none; background: none; padding-left: 2px; height: 30px; }
.xy-lbl { font-size: 11px; color: var(--txt-3); font-weight: 600; }
/* shape gallery (Add › Shape) */
.shape-pop { width: 264px; }
.shape-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.shape-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; height: 58px; border: 1px solid var(--line); border-radius: 10px; color: var(--txt-2); background: var(--panel); transition: border-color .12s, color .12s, background .12s; }
.shape-tile:hover { border-color: var(--accent); color: var(--txt); background: var(--panel-2); }
.shape-ico { font-size: var(--ico-md); }
.shape-lbl { font-size: 9.5px; font-weight: 600; letter-spacing: .01em; }
.ctl-row > .align-merged { flex: 1; display: flex; gap: 6px; min-width: 0; }
.align-merged .seg { flex: 1; min-width: 0; }
.ctl-row > .anchor-grid { flex: none; display: grid; grid-template-columns: repeat(3, 16px); grid-template-rows: repeat(3, 16px); gap: 3px; padding: 4px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); }
.anchor-cell { width: 16px; height: 16px; border-radius: 3px; background: var(--panel-2); border: 1px solid transparent; }
.anchor-cell:hover { background: var(--line-2); }
.anchor-cell.on { background: var(--accent); }

/* ── Color picker + list popovers ───────────────────── */
.popover { position: fixed; z-index: 300; width: 264px; max-height: calc(100dvh - 16px); overflow-y: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow); padding: 14px; display: flex; flex-direction: column; gap: 12px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.popover::-webkit-scrollbar { width: 7px; }
.popover::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
.popover.hidden { display: none; }
.pk-tabs { display: flex; gap: 3px; background: var(--panel-2); border-radius: 9px; padding: 3px; }
.pk-tab { flex: 1; height: 28px; border-radius: 6px; color: var(--txt-2); font-weight: 600; font-size: 12px; transition: background .12s, color .12s; }
.pk-tab.on { background: var(--panel); color: var(--txt); box-shadow: 0 1px 3px rgba(0,0,0,.14); }
.pk-square { position: relative; width: 100%; height: 156px; border-radius: 12px; cursor: crosshair; box-shadow: inset 0 0 0 1px var(--glass-brd); }
.pk-thumb { position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid #fff; transform: translate(-50%,-50%); box-shadow: 0 0 0 1px rgba(0,0,0,.4), 0 1px 3px rgba(0,0,0,.4); pointer-events: none; }
.pk-hue { position: relative; height: 14px; border-radius: 999px; cursor: pointer; background: linear-gradient(to right, #f00, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00); box-shadow: inset 0 0 0 1px var(--glass-brd); }
.pk-hthumb { position: absolute; top: 50%; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid #fff; transform: translate(-50%,-50%); box-shadow: 0 0 0 1px rgba(0,0,0,.4), 0 1px 3px rgba(0,0,0,.4); pointer-events: none; }
.pk-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pk-hex { flex: 1; min-width: 0; height: var(--ctl-h); border: 1px solid var(--line); background: var(--panel); color: var(--txt); border-radius: var(--ctl-r); padding: 0 10px; font-family: 'JetBrains Mono', monospace; font-size: 12.5px; letter-spacing: .04em; text-transform: uppercase; outline: none; transition: border-color .14s, box-shadow .14s; }
.pk-hex:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.pk-star { width: var(--ctl-h); height: var(--ctl-h); flex: none; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); background: var(--panel); border-radius: var(--ctl-r); color: var(--txt-2); font-size: var(--ico-sm); transition: border-color .14s, color .14s, background .14s; }
.pk-star:hover { color: var(--txt); background: var(--panel-2); }
.pk-star.on { color: #f5b301; border-color: #f5b30155; background: #f5b3010f; }
.pk-grad { display: flex; flex-direction: column; gap: 9px; }
.pk-grad.hidden { display: none; }
.pk-seg { display: flex; gap: 3px; background: var(--panel-2); border-radius: 8px; padding: 3px; }
.pk-seg button { flex: 1; height: 26px; border-radius: 6px; color: var(--txt-2); font-size: 11.5px; font-weight: 600; }
.pk-seg button.on { background: var(--accent); color: var(--on-accent); }
.pk-range { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 999px; cursor: pointer;
  background: linear-gradient(to right, var(--accent) 0, var(--accent) var(--val, 50%), var(--line-2) var(--val, 50%), var(--line-2) 100%); }
.pk-range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); border: 3px solid var(--panel); box-shadow: 0 1px 4px rgba(0,0,0,.35); cursor: grab; }
.pk-range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--accent); border: 3px solid var(--panel); box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.pk-labrow { display: flex; align-items: center; gap: 8px; }
.pk-mini { flex: none; width: 46px; font-size: 10.5px; font-weight: 600; color: var(--txt-3); text-transform: uppercase; letter-spacing: .05em; }
.pk-val { flex: none; width: 34px; text-align: right; font-size: 11px; font-weight: 600; color: var(--txt-2); font-variant-numeric: tabular-nums; }
.pk-dial { position: relative; width: 40px; height: 40px; flex: none; border-radius: 50%; border: 1px solid var(--line-2); background: radial-gradient(circle at 50% 50%, var(--panel-2), var(--panel)); cursor: grab; touch-action: none; }
.pk-dial:active { cursor: grabbing; }
.pk-dial-h { position: absolute; top: 50%; left: 50%; width: 46%; height: 2px; border-radius: 2px; background: var(--accent); transform-origin: 0 50%; transform: rotate(var(--a, 0deg)); }
.pk-dial-h::after { content: ''; position: absolute; right: -3px; top: 50%; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); transform: translateY(-50%); box-shadow: 0 0 0 2px var(--panel); }
/* interactive gradient track: draggable stop handles, click to add */
.pk-gradtrack { position: relative; height: 20px; margin: 2px 9px 4px; }
.pk-gradbar { position: absolute; inset: 0; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--glass-brd); cursor: copy; }
.pk-stop { position: absolute; top: 50%; width: 16px; height: 16px; padding: 0; transform: translate(-50%,-50%); border-radius: 50%; border: 2.5px solid #fff; background: var(--c); box-shadow: 0 0 0 1px rgba(0,0,0,.5), 0 1px 4px rgba(0,0,0,.45); cursor: grab; touch-action: none; }
.pk-stop.on { width: 19px; height: 19px; border-color: var(--accent); box-shadow: 0 0 0 1.5px var(--accent), 0 1px 6px rgba(0,0,0,.5); z-index: 2; }
.pk-stop:active { cursor: grabbing; }
.pk-del { width: var(--ctl-h); height: 26px; flex: none; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; color: var(--txt-3); font-size: var(--ico-sm); transition: color .12s, background .12s, border-color .12s; }
.pk-del:hover { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.pk-strips { display: flex; flex-direction: column; gap: 11px; }   /* the whole popover scrolls (see .popover), so no nested scroll here */
.pk-strip-label { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--txt-3); margin-bottom: 6px; }
.pk-swrow { display: flex; flex-wrap: wrap; gap: 6px; }
.pk-sw { width: 22px; height: 22px; border-radius: 7px; box-shadow: inset 0 0 0 1px var(--glass-brd); transition: transform .1s; }
.pk-sw:hover { transform: scale(1.14); box-shadow: inset 0 0 0 1px var(--glass-brd), 0 2px 6px rgba(0,0,0,.25); }
.pk-empty { color: var(--txt-3); font-size: 11.5px; padding: 3px 0; }
.pk-pals { display: flex; flex-direction: column; gap: 4px; }
.pk-pal { display: flex; gap: 4px; }
.pk-pal .pk-sw { flex: 1; height: 16px; border-radius: 5px; }
.pk-pal .pk-sw:hover { transform: none; box-shadow: inset 0 0 0 1px var(--glass-brd), 0 0 0 2px var(--accent); }

.list-pop { position: fixed; z-index: 300; width: 250px; max-height: 62vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: var(--shadow); padding: 10px; }
.list-title { font-weight: 700; font-size: 12.5px; margin-bottom: 8px; }
.list-body { display: flex; flex-direction: column; gap: 2px; }
.list-header { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--txt-3); padding: 9px 4px 3px; }
.list-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; padding: 8px; border-radius: 7px; color: var(--txt); font-size: 12.5px; }
.list-item:hover { background: var(--panel-2); }
.list-item em { color: var(--txt-3); font-style: normal; font-size: 11px; font-family: 'JetBrains Mono', monospace; }
.list-pop { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.list-pop::-webkit-scrollbar { width: 8px; }
.list-pop::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
/* sticker library — searchable grid */
.sticker-pop { position: fixed; z-index: 300; width: 300px; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: var(--shadow); padding: 10px; }
.sticker-search { width: 100%; height: var(--ctl-h); border: 1px solid var(--line); background: var(--panel-2); color: var(--txt); border-radius: 8px; padding: 0 10px; font-size: 12.5px; outline: none; margin-bottom: 6px; }
.sticker-search::placeholder { color: var(--txt-3); }
.sticker-search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.sticker-scroll { max-height: 300px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.sticker-scroll::-webkit-scrollbar { width: 8px; }
.sticker-scroll::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
.sticker-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin-bottom: 4px; }
.sticker-tile { height: 42px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; font-size: 22px; line-height: 1; color: var(--txt); background: var(--panel-2); border: 1px solid transparent; transition: background .12s, border-color .12s, transform .1s; }
.sticker-tile:hover { background: var(--panel); border-color: var(--accent); transform: translateY(-1px); }
.sticker-empty { font-size: 12px; color: var(--txt-2); padding: 14px 4px; text-align: center; }
.sticker-upload { width: 100%; height: 34px; margin-top: 8px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px dashed var(--line-2); border-radius: 8px; color: var(--txt-2); font-size: 12px; font-weight: 600; }
.sticker-upload:hover { color: var(--txt); border-color: var(--accent); }
.sticker-upload i { font-size: var(--ico-sm); }
/* effect sub-panels (shadow etc.) */
.fx-sub { margin: 2px 0 4px; padding: 8px 10px 6px; border-left: 2px solid var(--line-2); background: rgba(127,127,127,.05); border-radius: 0 8px 8px 0; display: flex; flex-direction: column; gap: 2px; }
/* metric / plain dropdown rows — roomier, chip icon + key pill */
.list-body .list-item { padding: 9px 10px; border-radius: 9px; }
.list-body .li-ico { background: var(--panel-2); border-radius: 7px; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; font-size: var(--ico-sm); }
.list-body .list-item em { background: var(--panel-2); padding: 3px 8px; border-radius: 999px; color: var(--txt-2); font-size: 10.5px; }
.list-body .list-item:hover em { color: var(--txt); }
/* bezel colour bar (3D preview) */
.bezel-bar { position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%); z-index: 25; display: flex; align-items: center; gap: 9px; padding: 9px 12px; background: var(--rail-bg); border: 1px solid var(--glass-brd); border-radius: 999px; box-shadow: var(--shadow); backdrop-filter: blur(22px) saturate(160%); -webkit-backdrop-filter: blur(22px) saturate(160%); }
.bezel-sw { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid rgba(128,128,128,.28); flex: none; transition: transform .12s; }
.bezel-sw:hover { transform: scale(1.12); }
.bezel-sw.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--bg); }
.bezel-custom { background: conic-gradient(from 90deg, #ff3b30, #ff9500, #ffcc00, #34c759, #5ac8fa, #007aff, #5856d6, #af52de, #ff3b30); }
@media (min-width: 960px) { .bezel-bar { bottom: 28px; } }

/* ── Modals ─────────────────────────────────────────── */
.modal-back { position: fixed; inset: 0; z-index: 400; background: rgba(4,5,8,.7); backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { width: 560px; max-width: 100%; background: var(--panel); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--shadow); padding: 22px; max-height: 92vh; overflow-y: auto; }
.modal-title { font-size: 17px; font-weight: 800; }
.modal-sub { color: var(--txt-2); font-size: 12.5px; margin: 6px 0 16px; line-height: 1.55; }
.exp-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.exp-row label { font-size: 12px; color: var(--txt-2); width: 60px; }
.exp-row .select { flex: 1; }
.exp-check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--txt-2); margin-bottom: 16px; }
.exp-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--txt); margin: 4px 0 4px; }
.exp-head i { font-size: var(--ico-sm); color: var(--txt-2); }
.exp-subtle { font-size: 12px; color: var(--txt-2); margin: 0 0 12px; }
.exp-soon { font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--txt-3); border: 1px solid var(--line-2); border-radius: 999px; padding: 2px 8px; margin-left: auto; }
.exp-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.exp-cards.one { grid-template-columns: 1fr; }
.exp-card { border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 11px; background: var(--bg-2); }
.exp-thumb { width: 150px; height: 150px; border-radius: 50%; background: #000; box-shadow: 0 0 0 6px #050609; }
.exp-thumb.rect { border-radius: 22px; }
.exp-cap { display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 12px; color: var(--txt-2); }
.exp-cap b { color: var(--txt); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.exp-card.rec { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.exp-badge { font-style: normal; font-size: 9.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--on-accent); background: var(--accent); padding: 2px 6px; border-radius: 999px; }
.exp-note { display: flex; gap: 8px; align-items: flex-start; font-size: 11.5px; line-height: 1.5; color: var(--txt-2); background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; margin-bottom: 12px; }
.exp-note i { color: var(--accent-2); margin-top: 1px; flex: none; }
.exp-divider { height: 1px; background: var(--line); margin: 14px 0 12px; }
.exp-file { display: flex; gap: 10px; margin-bottom: 12px; }
.exp-file .btn { flex: 1; }
.exp-legal { font-size: 10.5px; line-height: 1.5; color: var(--txt-3, var(--txt-2)); opacity: .8; margin: 4px 0 14px; }
.modal-close { width: 100%; }

/* ── Inspector groups + circular swatches ───────────── */
.insp-group { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--txt-2); margin: 11px 0 6px; padding-top: 9px; border-top: 1px solid var(--line); }
.insp-group:first-of-type { border-top: none; padding-top: 0; margin-top: 2px; }
.swatch-dot { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--line-2); box-shadow: inset 0 0 0 2px var(--bg-2); cursor: pointer; flex: none; }
.swatch-dot:hover { border-color: var(--txt-2); }
.swatch-dot.off { border-style: dashed; background: repeating-conic-gradient(var(--line-2) 0% 25%, var(--panel) 0% 50%) 50%/10px 10px; box-shadow: none; }
.label-row { display: flex; align-items: center; gap: 8px; flex: 1; }
.label-row .text-input { flex: 1; }

/* ── Info dots, field icons ─────────────────────────── */
.info-i { font-size: var(--ico-sm) !important; color: var(--txt-3); cursor: help; margin-left: 4px; vertical-align: 0; }
.info-i:hover { color: var(--accent-2); }
.seg-full { width: 100%; }
.li-ico { font-size: 16px; color: var(--txt-2); width: 20px; text-align: center; flex: none; }
.list-item { gap: 9px; }
.li-label { flex: 1; }

/* ── Desktop ────────────────────────────────────────── */
@media (min-width: 960px) {
  .desktop-only { display: inline-flex !important; }
  .mobile-only { display: none !important; }
  .workspace.sheet-open .watch-frame { transform: translateX(calc(-1 * var(--watch-shift, 0px))) scale(calc(var(--watch-scale, 1) * var(--zoom, 1))); }  /* shift/shrink only as much as needed to clear the panel (JS-computed) */
  .workspace.sheet-open .stage { background: radial-gradient(620px 460px at 50% 42%, var(--bg-2), var(--bg)); }
  .tool-panel::before { display: none; }                   /* no grab handle on the desktop side panel */
  .panel-head { height: 46px; padding: 0 8px 0 16px; cursor: grab; }
  .panel-head.dragging { cursor: grabbing; }
  .panel-close { cursor: pointer; }                          /* the close button isn't a drag handle */
  .stage { padding: 40px; }                                /* watch stays put */
  .float-brand { top: 20px; left: 24px; }
  /* right nav rail + a panel that expands right next to it (content-height, no shift) */
  .tool-panel { left: auto; right: 80px; top: 16px; bottom: auto; width: 322px; max-height: calc(100vh - 32px);   /* sit beside the rail, same small gap as the More menu (was tucking under it) */
    border: 1px solid var(--glass-brd); border-radius: 18px; box-shadow: 0 24px 64px rgba(0,0,0,.5), inset 0 1px 0 var(--glass-hi); transform: translateX(10px); }
  .tool-panel.open { transform: none; }
  .nav-rail { left: auto; right: 16px; bottom: auto; top: 50%; transform: translateY(-50%);
    flex-direction: column; justify-content: center; gap: 3px; padding: 6px;
    border: 1px solid var(--glass-brd); border-radius: 999px; background: var(--rail-bg);
    box-shadow: 0 14px 40px rgba(0,0,0,.32), inset 0 1px 0 var(--glass-hi); }
  .nav-div { width: 22px; height: 1px; margin: 5px 0; }     /* horizontal divider on the vertical rail */
  .nav-rail { --nav-btn: 46px; --nav-ico: 21px; }
  .nav-rail .menu { top: auto; bottom: 0; right: calc(100% + 10px); }
  /* right rail → tooltip to the left of the icon */
  .nav-btn[aria-label]::after { bottom: auto; top: 50%; left: auto; right: calc(100% + 10px); transform: translateY(-50%) translateX(4px); }
  .nav-btn[aria-label]:hover::after { transform: translateY(-50%) translateX(0); }
}
