/* SilkFX panel styles */

:root, #app[data-theme="dark"] {
  --bg: #1e1e1e;
  --bg-status: #1a1a1a;
  --surface: #262626;
  --surface-2: #2c2c2c;
  --pill: #2a2a2a;
  --pill-active: #3d3d3d;
  --line: #343434;
  --line-strong: #3d3d3d;
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --text-3: #7c7c80;
  --accent: #0a84ff;
  --accent-rgb: 10, 132, 255;
  --on-accent: #fff;
  --accent-press: #0071e3;
  --track: #4a4a4c;
  --star: #ffcc00;
  --ok: #30d158;
  --err: #ff453a;
  --btn-disabled: #4f4f52;
  --btn-disabled-text: #d1d1d6;
  --scroll: #3e3e40;
  --preview-text: #ffffff;
  --shadow: 0 8px 28px rgba(0, 0, 0, .45);
}

#app[data-theme="light"] {
  --bg: #f5f5f7;
  --bg-status: #ececee;
  --surface: #ffffff;
  --surface-2: #f2f2f4;
  --pill: #e8e8ed;
  --pill-active: #ffffff;
  --line: #dcdce0;
  --line-strong: #d0d0d5;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #8e8e93;
  --accent: #007aff;
  --accent-press: #0063d1;
  --track: #d1d1d6;
  --star: #f5b800;
  --ok: #248a3d;
  --err: #d70015;
  --btn-disabled: #d1d1d6;
  --btn-disabled-text: #8e8e93;
  --scroll: #c7c7cc;
  --preview-text: #1d1d1f;
  --shadow: 0 8px 28px rgba(0, 0, 0, .14);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: #1e1e1e;
  overflow: hidden;
}

body {
  font-family: var(--ui-font, "Inter", "SF Pro Text", -apple-system, "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif);
  font-size: 12px;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

button { font: inherit; color: inherit; cursor: default; }
button:focus { outline: none; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--bg-grad, var(--bg));
  color: var(--text);
}

/* ---------- top bar ---------- */

.topbar {
  position: relative;
  flex: 0 0 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px 4px 8px;
  border-bottom: 1px solid var(--line);
}

.logo-btn {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--pill-active);
  color: var(--text);
  padding: 0;
}
.logo-btn svg { width: 19px; height: 19px; margin-top: -1px; }
.logo-btn:hover { filter: brightness(1.12); }

.tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 42px;
  padding: 0 4px;
  border-radius: 21px;
  background: var(--pill);
  border: 1px solid var(--line-strong);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: 0 0 35px;
  width: 35px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 17px;
  background: transparent;
  color: var(--text-2);
  padding: 0;
  transition: background-color .15s, color .15s;
}
.tab svg { width: 20px; height: 20px; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--pill-active); color: var(--text); }

.round-btn {
  margin-left: auto;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text-2);
  padding: 0;
}
.round-btn svg { width: 16px; height: 16px; }
.round-btn:hover { color: var(--text); }

/* ---------- popover ---------- */

.popover {
  position: absolute;
  z-index: 20;
  top: 44px;
  left: 8px;
  min-width: 210px;
  padding: 10px 6px 6px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}
.pop-title { padding: 0 8px; font-size: 13px; font-weight: 700; }
.pop-title span { color: var(--text-2); font-weight: 500; }
.pop-sub { padding: 2px 8px 8px; color: var(--text-2); font-size: 11px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.pop-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 6px 8px;
  border-radius: 6px;
}
.pop-item:hover { background: var(--accent); color: var(--on-accent); }

/* ---------- main ---------- */

.main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

/* ---------- sidebar ---------- */

.sidebar {
  flex: 0 0 177px;
  width: 177px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  min-height: 0;
}

.side-head {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  padding: 13px 14px 9px 12px;
  color: var(--text-3);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .08em;
}
.side-head #catCount { letter-spacing: 0; font-weight: 500; }
.search { flex: 0 0 auto; padding: 0 10px 8px 8px; }
.search input { width: 100%; height: 26px; padding: 0 9px; border-radius: 7px; border: 1px solid var(--line); background: var(--bg-2, rgba(255,255,255,.05)); color: var(--text); font: inherit; font-size: 11.5px; outline: none; }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .25); }
.search input::placeholder { color: var(--text-3); }
.item-cat { color: var(--accent); font-weight: 600; }
.list-empty { padding: 14px 12px; color: var(--text-3); font-size: 11.5px; line-height: 1.5; }
.pv-bg { position: absolute; inset: 0; border-radius: inherit; }

.list {
  flex: 1 1 auto;
  overflow-y: scroll;
  padding: 0 0 8px 4px;
}

.list::-webkit-scrollbar { width: 8px; }
.list::-webkit-scrollbar-track { background: transparent; }
.list::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 4px; border: 1px solid var(--bg); }
.detail-scroll::-webkit-scrollbar { width: 8px; }
.detail-scroll::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 4px; border: 1px solid var(--bg); }

.item {
  position: relative;
  display: flex;
  align-items: center;
  height: 43px;
  padding: 0 6px 0 22px;
  border-radius: 8px;
}
.item::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 50%;
  width: 5px;
  height: 5px;
  margin-top: -2px;
  border-radius: 50%;
  background: var(--accent);
}
.item:hover { background: var(--surface-2); }
.item.selected { background: var(--accent); }
.item.selected::before { background: var(--on-accent); }

.item-text { flex: 1 1 auto; min-width: 0; }
.item-name {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-desc {
  font-size: 11px;
  line-height: 14px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item.selected .item-name { color: var(--on-accent); }
.item.selected .item-desc { color: var(--on-accent); opacity: .82; }

.star {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--text-3);
  visibility: hidden;
}
.star svg { width: 15px; height: 15px; fill: none; }
.item:hover .star, .item.selected .star { visibility: visible; }
.item.selected .star { color: var(--on-accent); opacity: .75; }
.star.on { visibility: visible; color: var(--star) !important; }
.star.on svg { fill: currentColor; }

.list-sep {
  height: 1px;
  margin: 8px 6px 8px 4px;
  background: var(--line-strong);
}

.list-empty { padding: 12px; color: var(--text-3); }

/* ---------- detail ---------- */

.detail {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.detail-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 14px 18px 16px;
}

.detail-head {
  display: flex;
  align-items: center;
  height: 58px;
  margin-bottom: 16px;
  gap: 8px;
}
.detail-head h1 {
  flex: 1 1 auto;
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 10px 0 11px;
  border-radius: 11px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  font-size: 11.5px;
  font-weight: 500;
}
.pill-btn:hover { background: var(--surface-2); }
.pill-btn:disabled { opacity: .4; }
.replay-ico svg { width: 11px; height: 11px; display: block; }

/* ---------- preview ---------- */

.preview {
  position: relative;
  width: 100%;
  aspect-ratio: 318 / 221;
  min-height: 150px;
  max-height: 340px;
  border-radius: 9px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.pv-text {
  position: relative;
  white-space: pre;
  color: var(--preview-text);
  font-size: 33px;
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.2;
}
.pv-word, .pv-char { display: inline-block; will-change: transform, opacity, filter; }

.pv-card {
  width: 84px;
  height: 84px;
  border-radius: 20px;
  background: var(--accent);
  will-change: transform, opacity, filter;
}

/* The easing graph editor fills the preview: toolbar, big graph, number boxes; the ball track sits on the right. */
.pv-ease { position: absolute; inset: 0; display: flex; align-items: stretch; gap: 14px; padding: 10px 14px; }
.pv-gbox { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.pv-gtools { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 26px; flex: 0 0 auto; }
.pv-gseg { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--surface-2, rgba(128,128,128,.18)); }
.pv-gsegbtn { border: 0; background: transparent; color: var(--text-2); font: inherit; font-size: 11px; font-weight: 600; padding: 3px 12px; border-radius: 6px; cursor: pointer; }
.pv-gsegbtn.on { background: var(--accent); color: var(--on-accent, #fff); }
.pv-gread { font-family: ui-monospace, Consolas, monospace; font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pv-ease svg.graph { flex: 1 1 auto; width: 100%; min-height: 0; overflow: visible; touch-action: none; user-select: none; -webkit-user-select: none; }
.pv-ease .plot { fill: var(--surface, rgba(0,0,0,.2)); stroke: var(--line-strong); stroke-width: 1; }
.pv-ease .grid { stroke: var(--line, rgba(128,128,128,.2)); stroke-width: 1; }
.pv-ease .grid.major { stroke: var(--line-strong); }
.pv-ease .tick { fill: var(--text-3); font-size: 12px; font-family: inherit; }
.pv-ease .tick.dim { opacity: .55; }
.pv-ease .curve { stroke: var(--accent); stroke-width: 3; fill: none; stroke-linejoin: round; stroke-linecap: round; }
.pv-ease .handle { stroke: var(--text-2); stroke-width: 1.6; }
.pv-ease .key { fill: var(--text-2); }
.pv-ease .knob { fill: var(--accent); stroke: var(--surface, #222); stroke-width: 2.5; }
.pv-ease .ball { fill: var(--text); opacity: .85; pointer-events: none; }
.pv-ease svg.graph.editable { cursor: crosshair; }
.pv-ease svg.graph.editable .knob { cursor: grab; }
.pv-ease svg.graph.dragging, .pv-ease svg.graph.dragging .knob { cursor: grabbing; }
.pv-ease svg.graph.dragging .knob { stroke-width: 4; }
.pv-gfields { display: flex; flex-wrap: wrap; gap: 6px 22px; flex: 0 0 auto; align-items: center; }
.pv-gfgroup { display: flex; align-items: center; gap: 10px; }
.pv-gflab { font-size: 11px; font-weight: 700; color: var(--text-2); width: 26px; }
.pv-gfld { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-3); }
.pv-gfinp { width: 54px; padding: 3px 5px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--surface-2, rgba(128,128,128,.12)); color: var(--text); font: inherit; font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
.pv-gfinp:focus { outline: none; border-color: var(--accent); }
.pv-gfunit { color: var(--text-3); width: 10px; }
.pv-track { position: relative; flex: 0 0 22px; width: 22px; height: calc(100% - 64px); margin: 32px 0 32px; }
.pv-track::before { content: ""; position: absolute; left: 10px; top: 0; bottom: 0; width: 2px; border-radius: 1px; background: var(--line-strong); }
.pv-track .dot { position: absolute; left: 0; width: 22px; height: 22px; margin-top: -11px; border-radius: 50%; background: var(--accent); }

.pv-shape svg { display: block; }
.pv-caption {
  position: absolute;
  left: 10px;
  bottom: 8px;
  color: var(--text-3);
  font: 10.5px ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

.pv-code {
  align-self: stretch;
  justify-self: stretch;
  margin: 0;
  padding: 12px 14px;
  overflow: auto;
  color: var(--text);
  font: 11px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
}
.pv-note { padding: 0 24px; text-align: center; color: var(--text-2); line-height: 1.5; }

.pv-vignette { position: absolute; inset: 0; pointer-events: none; }
.pv-sound { display: grid; place-items: center; }
.pv-wave { display: block; }
.pv-ticks { position: absolute; left: 0; right: 0; top: 18px; display: flex; justify-content: center; gap: 15px; }
.pv-tick { display: block; width: 9px; height: 9px; background: var(--accent); transform: rotate(45deg); }
.pv-clip { position: absolute; left: 50%; top: 50%; width: 130px; height: 26px; margin: -13px 0 0 -65px; border-radius: 6px; }
.pv-glass-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 22% 30%, #ff375f 0, rgba(255,55,95,0) 32%),
    radial-gradient(circle at 78% 70%, #0a84ff 0, rgba(10,132,255,0) 36%),
    radial-gradient(circle at 70% 22%, #ffd60a 0, rgba(255,214,10,0) 26%),
    radial-gradient(circle at 30% 80%, #30d158 0, rgba(48,209,88,0) 28%),
    #1b1b22;
}
.pv-glass-under { font-size: 46px; letter-spacing: -.03em; }
.pv-glass { position: absolute; width: 58%; height: 52%; border-radius: 22px; background: rgba(255,255,255,.06); }
.pv-grain { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: overlay; }

/* ---------- controls ---------- */

.controls {
  margin-top: 18px;
  padding: 4px 12px 6px;
  border-radius: 9px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
}
.controls:empty { display: none; }

.ctl { padding: 3px 0 2px; }
.ctl-row { display: flex; align-items: center; min-height: 18px; gap: 8px; }
.ctl.inline { padding: 8px 0 6px; }
.ctl-label { flex: 1 1 auto; font-size: 11.5px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ctl-value {
  display: flex;
  align-items: baseline;
  gap: 0;
  font: 11.5px ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.ctl-value input {
  width: 64px;
  padding: 1px 2px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: right;
  user-select: text;
}
.ctl-value input:hover { border-color: var(--line-strong); }
.ctl-value input:focus { outline: none; border-color: var(--accent); background: var(--bg); }
.ctl-unit { width: 26px; padding-left: 8px; color: var(--text-2); font-size: 11px; }

.ctl-info { min-width: 0; font: 11px ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; user-select: text; }
.ctl.inline .ctl-label { flex: 0 0 auto; }
.ctl.inline .ctl-row > :last-child { margin-left: auto; }

/* slider */
.slider { position: relative; height: 14px; margin-top: 0; touch-action: none; }
.slider-track { position: absolute; left: 0; right: 0; top: 5px; height: 4px; border-radius: 2px; background: var(--track); }
.slider-fill { position: absolute; left: 0; top: 5px; height: 4px; border-radius: 2px; background: var(--accent); }
.slider-thumb {
  position: absolute;
  top: 0;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
}
.slider:hover .slider-thumb, .slider.drag .slider-thumb { filter: brightness(1.12); }

/* segmented */
.segment {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
}
.segment button {
  min-width: 34px;
  height: 20px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
}
.segment button:hover { background: var(--surface-2); }
.segment button.on { background: var(--accent); color: var(--on-accent); }

/* colors */
.swatches { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.swatch {
  width: 16px;
  height: 16px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(128, 128, 128, .45);
}
.swatch.on { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--text); }

/* ---------- action bar ---------- */

.actionbar {
  flex: 0 0 54px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px 0 16px;
  border-top: 1px solid var(--line);
}
.hint {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text-3);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hint.ok { color: var(--ok); }
.hint.err { color: var(--err); }

.apply {
  flex: 0 0 auto;
  min-width: 67px;
  height: 30px;
  padding: 0 16px;
  border: 0;
  border-radius: 15px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 12.5px;
  font-weight: 600;
}
.apply:hover:not(:disabled) { filter: brightness(1.1); }
.apply:active:not(:disabled) { background: var(--accent-press); }
.apply:disabled { background: var(--btn-disabled); color: var(--btn-disabled-text); }
.apply.busy { opacity: .7; }

/* ---------- status bar ---------- */

.statusbar {
  flex: 0 0 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 12px 0 11px;
  background: var(--bg-status);
  border-top: 1px solid var(--line);
  color: var(--text-2);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
}
.statusbar .conn { display: inline-flex; align-items: center; gap: 6px; }
.statusbar .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.statusbar .dot.on { background: var(--ok); }
.statusbar .dot.off { background: var(--err); }
.statusbar .spacer { flex: 1 1 auto; }

/* ---------- narrow panels ---------- */

@media (max-width: 440px) {
  .sidebar { flex-basis: 150px; width: 150px; }
  .topbar { gap: 6px; }
  .tab { flex-basis: 31px; width: 31px; }
  #versionInfo { display: none; }
}

/* ---------- updates ---------- */

.update-pill {
  height: 18px;
  padding: 0 9px;
  border: 0;
  border-radius: 9px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 10.5px;
  font-weight: 600;
}
.update-pill:hover { filter: brightness(1.1); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, .55);
}
.modal[hidden] { display: none; }
.modal-card {
  width: 100%;
  max-width: 360px;
  padding: 18px 18px 16px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}
.modal-card h2 { margin: 0 0 8px; font-size: 15px; font-weight: 700; }
.upd-notes { margin: 0 0 14px; padding-left: 18px; color: var(--text-2); font-size: 11.5px; line-height: 1.5; }
.upd-notes:empty { display: none; }
.upd-label { display: block; margin-bottom: 6px; font-size: 11.5px; font-weight: 600; }
.upd-label span { color: var(--text-3); font-weight: 400; }
.upd-input {
  width: 100%;
  height: 30px;
  padding: 0 9px;
  border-radius: 7px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--text);
  font: 12px ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  user-select: text;
}
.upd-input:focus { outline: none; border-color: var(--accent); }
.upd-status { min-height: 16px; margin: 8px 0 12px; font-size: 11.5px; color: var(--text-2); }
.upd-status.ok { color: var(--ok); }
.upd-status.err { color: var(--err); }
.upd-actions { display: flex; justify-content: flex-end; gap: 8px; align-items: center; }
.upd-actions .pill-btn { height: 30px; border-radius: 15px; padding: 0 14px; }

.upd-actions .spacer { flex: 1 1 auto; }
.link-btn { border: 0; background: transparent; padding: 0; color: var(--accent); font-size: 12px; font-weight: 600; }
.link-btn:hover { text-decoration: underline; }
.upd-intro { margin: 0 0 14px; color: var(--text-2); font-size: 12px; line-height: 1.5; }
#app.locked .main, #app.locked .actionbar { filter: blur(3px); pointer-events: none; }

/* ---------- motion ---------- */

:root { --spring: cubic-bezier(.34, 1.56, .64, 1); --smooth: cubic-bezier(.32, .72, 0, 1); }

/* sliding indicators (positioned by js/motion.js) */
.tabs { position: relative; }
.tab { position: relative; z-index: 1; }
.tab.active { background: transparent; }
.tab-ind { position: absolute; left: 0; top: 0; z-index: 0; border-radius: 17px; background: var(--pill-active); pointer-events: none; }

.list { position: relative; }
.item { z-index: 1; }
.item.selected { background: transparent; }
.item.selected:hover { background: transparent; }
.sel-ind { position: absolute; left: 0; top: 0; z-index: 0; border-radius: 8px; background: var(--accent); pointer-events: none; box-shadow: 0 4px 14px -6px rgba(var(--accent-rgb), .7); }
.item-name, .item-desc, .item::before { transition: color .25s var(--smooth), background-color .25s var(--smooth); }

.segment { position: relative; }
.segment button { position: relative; z-index: 1; transition: color .25s var(--smooth), transform .25s var(--spring); }
.segment button.on { background: transparent; }
.segment button:hover:not(.on) { background: transparent; color: var(--accent); }
.seg-thumb { position: absolute; left: 0; top: 0; z-index: 0; border-radius: 6px; background: var(--accent); pointer-events: none; box-shadow: 0 2px 8px -3px rgba(var(--accent-rgb), .8); }

/* press feedback */
.apply, .pill-btn, .round-btn, .logo-btn, .tab, .swatch, .star, .pop-item, .update-pill, .link-btn {
  transition: transform .28s var(--spring), background-color .2s var(--smooth), color .2s var(--smooth), filter .2s, box-shadow .25s var(--smooth);
}
.apply:active:not(:disabled), .pill-btn:active:not(:disabled), .round-btn:active, .logo-btn:active,
.tab:active, .swatch:active, .star:active, .update-pill:active, .segment button:active { transform: scale(.93); }
.apply:hover:not(:disabled) { box-shadow: 0 6px 18px -8px rgba(var(--accent-rgb), .9); }
.apply.done { background: var(--ok); }
.apply.done::before { content: "\2713"; margin-right: 6px; }
.swatch:hover { transform: scale(1.15); }
.round-btn svg { transition: transform .5s var(--spring); }
.round-btn:hover svg { transform: rotate(35deg); }

/* sliders */
.slider-thumb { transition: transform .25s var(--spring), box-shadow .2s; }
.slider:hover .slider-thumb { transform: scale(1.12); }
.slider.drag .slider-thumb { transform: scale(1.25); box-shadow: 0 0 0 5px rgba(var(--accent-rgb), .18), 0 1px 3px rgba(0,0,0,.35); }

/* theme cross-fade */
#app, .topbar, .sidebar, .detail, .preview, .controls, .actionbar, .statusbar, .tabs, .segment, .round-btn, .logo-btn, .popover, .modal-card, .upd-input, .ctl-value input {
  transition: background-color .4s var(--smooth), border-color .4s var(--smooth), color .4s var(--smooth);
}
.hint { transition: color .3s var(--smooth); }

/* ---------- appearance settings ---------- */

.popover-right { left: auto; right: 8px; width: 270px; padding: 12px 10px 8px; }
.set-label { margin: 12px 4px 7px; color: var(--text-3); font-size: 10.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }
.popover-right .pop-title { padding: 0 4px; }
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.theme-tile {
  display: flex; flex-direction: column; gap: 5px; align-items: stretch;
  padding: 5px 5px 6px; border: 1px solid var(--line-strong); border-radius: 9px; background: transparent;
  font-size: 10.5px; font-weight: 600; color: var(--text-2); text-align: center;
}
.theme-tile:hover { color: var(--text); border-color: var(--text-3); }
.theme-tile.on { border-color: var(--accent); color: var(--text); box-shadow: 0 0 0 2px rgba(var(--accent-rgb), .35); }
.theme-swatch { position: relative; height: 34px; border-radius: 6px; overflow: hidden; border: 1px solid rgba(128,128,128,.25); }
.theme-swatch i { position: absolute; left: 6px; right: 14px; height: 5px; border-radius: 3px; }
.theme-swatch i:nth-child(1) { top: 7px; }
.theme-swatch i:nth-child(2) { top: 16px; right: 24px; }
.theme-swatch b { position: absolute; right: 6px; bottom: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.theme-swatch.ae::after { content: "Ae"; position: absolute; left: 6px; bottom: 3px; font: 700 9px/1 Inter, sans-serif; opacity: .75; }
.theme-tile span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.accent-row { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 4px 6px; align-items: center; }
.accent-dot { width: 20px; height: 20px; padding: 0; border-radius: 50%; border: 1px solid rgba(128,128,128,.4); }
.accent-dot.on { box-shadow: 0 0 0 2px var(--surface-2), 0 0 0 4px var(--text); }
.accent-dot:hover { transform: scale(1.15); }
.accent-custom { position: relative; width: 20px; height: 20px; border-radius: 50%; overflow: hidden; border: 1px solid rgba(128,128,128,.4);
  background: conic-gradient(#ff453a, #ffd60a, #30d158, #64d2ff, #0a84ff, #bf5af2, #ff375f, #ff453a); transition: transform .28s var(--spring); }
.accent-custom:hover { transform: scale(1.15); }
.accent-custom.on { box-shadow: 0 0 0 2px var(--surface-2), 0 0 0 4px var(--text); }
.accent-custom input { position: absolute; inset: -6px; width: 32px; height: 32px; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.popover-right .pop-item { margin-top: 4px; }

/* ---------- editable preview text + draggable graph ---------- */
.preview-wrap { position: relative; }
/* The easing graph editor gets extra height so the handles are easy to reach. */
.preview.tall { aspect-ratio: 318 / 300; max-height: 430px; }
.pv-edit-btn {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  width: 26px; height: 26px; display: grid; place-items: center; padding: 0;
  border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text-2);
  opacity: 0; transition: opacity .2s var(--smooth), transform .28s var(--spring), color .2s;
}
.pv-edit-btn svg { width: 14px; height: 14px; }
.preview-wrap:hover .pv-edit-btn, .pv-edit-btn:focus-visible { opacity: 1; }
.pv-edit-btn:hover { color: var(--text); }
.pv-edit-btn:active { transform: scale(.9); }
.preview .pv-text { cursor: text; }
.pv-edit-input {
  position: absolute; left: 50%; top: 50%; z-index: 4; width: 82%; transform: translate(-50%, -50%);
  padding: 8px 12px; border-radius: 12px; border: 1.5px solid var(--accent);
  background: rgba(0, 0, 0, .55); color: #fff; text-align: center;
  font: 700 26px/1.2 "Inter", "SF Pro Text", -apple-system, "Segoe UI", sans-serif; letter-spacing: -.01em;
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .25), 0 12px 30px -10px rgba(0,0,0,.6);
  user-select: text;
}
.pv-edit-input:focus { outline: none; }
#app[data-theme="light"] .pv-edit-input { background: rgba(255, 255, 255, .85); color: #1d1d1f; }

.pv-readout {
  position: absolute; left: 10px; top: 9px; z-index: 2;
  font: 10.5px ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--text-2);
  padding: 2px 7px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line);
}

.pv-glass-text { color: transparent; -webkit-background-clip: text; background-clip: text; font-size: 54px; }


/* ---------- customize: layout, tabs, motion ---------- */
#appearance { max-height: calc(100vh - 56px); overflow-y: auto; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 3px 4px; font-size: 11.5px; color: var(--text-2); }
.mini-seg { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--bg-2, rgba(128,128,128,.16)); }
.mini-seg button { border: 0; background: transparent; color: var(--text-2); font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 6px; cursor: pointer; }
.mini-seg button.on { background: var(--accent); color: var(--on-accent); }
.set-range { width: 120px; accent-color: var(--accent); }
.switch { position: relative; width: 34px; height: 20px; border-radius: 10px; border: 0; padding: 0; background: var(--line-strong); cursor: pointer; transition: background-color .2s; }
.switch i { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .22s cubic-bezier(.3,1.4,.5,1); }
.switch.on { background: var(--accent); }
.switch.on i { transform: translateX(14px); }
.tab-edit { display: flex; flex-direction: column; gap: 1px; padding: 0 2px 4px; }
.tab-row { display: flex; align-items: center; gap: 8px; padding: 3px 4px; border-radius: 6px; font-size: 11.5px; color: var(--text); }
.tab-row:hover { background: var(--bg-2, rgba(128,128,128,.14)); }
.tab-row.off { color: var(--text-3); }
.tab-row .tab-ico { width: 18px; height: 18px; display: grid; place-items: center; color: var(--text-2); }
.tab-row .tab-ico svg { width: 16px; height: 16px; }
.tab-row .tab-name { flex: 1 1 auto; }
.tab-row input[type=checkbox] { accent-color: var(--accent); margin: 0; }
.tab-row .mv { border: 0; background: transparent; color: var(--text-3); width: 20px; height: 20px; border-radius: 5px; padding: 0; cursor: pointer; font-size: 10px; }
.tab-row .mv:hover:not(:disabled) { background: var(--accent); color: var(--on-accent); }
.tab-row .mv:disabled { opacity: .3; cursor: default; }
.sidebar { position: relative; flex: 0 0 min(var(--side-w, 177px), 42%); width: min(var(--side-w, 177px), 42%); min-width: 118px; }
.side-resizer { position: absolute; top: 0; bottom: 0; right: -4px; width: 9px; z-index: 6; cursor: col-resize; }
.side-resizer::after { content: ""; position: absolute; top: 0; bottom: 0; left: 4px; width: 2px; border-radius: 1px; background: var(--accent); opacity: 0; transition: opacity .15s; }
.side-resizer:hover::after, .side-resizer.drag::after { opacity: .7; }
#app.dense .item { height: 30px; }
#app.dense .item-desc { display: none; }
#app.dense .item::before { margin-top: -2.5px; }
#app.no-motion *, #app.no-motion *::before, #app.no-motion *::after { transition: none !important; animation: none !important; }

/* Narrow (docked) panels: a long option row drops its control onto its own line instead of overflowing. */
.ctl.inline .ctl-row { flex-wrap: wrap; row-gap: 6px; }
.ctl.inline .ctl-label { flex: 0 1 auto; }
.segment { max-width: 100%; }
.segment button { min-width: 0; flex: 0 1 auto; white-space: nowrap; }
.ctl.inline .segment { flex-wrap: wrap; }
.pv-gtools { flex-wrap: wrap; }
.pv-gfgroup { flex-wrap: wrap; row-gap: 4px; }
.pv-ticks { gap: min(15px, 2.2vw); padding: 0 6px; }


/* ---------- custom themes ---------- */
#app.accent-grad .item.selected, #app.accent-grad .apply:not(:disabled):not(.done), #app.accent-grad .seg-thumb, #app.accent-grad .slider-fill,
#app.accent-grad .mini-seg button.on, #app.accent-grad .pv-gsegbtn.on, #app.accent-grad .switch.on { background: var(--accent-grad); }
.theme-tile.new .theme-swatch { display: grid; place-items: center; border-style: dashed; background: transparent; color: var(--text-2); font-size: 20px; font-weight: 300; }
.theme-tile.new .theme-swatch::after { content: "+"; }
.theme-swatch.custom i:nth-child(1) { background: rgba(255,255,255,.55); mix-blend-mode: overlay; }
.theme-editor { margin-top: 10px; padding: 8px 8px 6px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--bg-2, rgba(128,128,128,.08)); }
.te-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; font-size: 11.5px; color: var(--text-2); }
.te-row > span:first-child { flex: 0 0 62px; }
.te-ctl { display: flex; align-items: center; gap: 6px; flex: 1 1 auto; justify-content: flex-end; min-width: 0; }
.te-name { width: 100%; height: 24px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: inherit; font-size: 12px; outline: none; user-select: text; }
.te-name:focus { border-color: var(--accent); }
.te-color { width: 30px; height: 22px; padding: 0; border: 1px solid var(--line-strong); border-radius: 6px; background: transparent; cursor: pointer; }
.te-color::-webkit-color-swatch-wrapper { padding: 2px; }
.te-color::-webkit-color-swatch { border: 0; border-radius: 4px; }
.te-range { width: 100px; accent-color: var(--accent); }
.te-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.te-actions .pill-btn { height: 24px; font-size: 11px; padding: 0 10px; }
.te-actions .danger { color: var(--err); }
.te-note { flex-basis: 100%; font-size: 10.5px; color: var(--text-3); padding: 2px 0 0; }
.accent-row.locked .accent-dot, .accent-row.locked .accent-custom { opacity: .35; pointer-events: none; }
.te-import { margin-top: 8px; }
.te-import .link-btn { font-size: 11px; }
.te-importbox { display: flex; gap: 6px; margin-top: 6px; }
.te-importbox input { flex: 1 1 auto; min-width: 0; height: 24px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: 11px ui-monospace, Consolas, monospace; outline: none; user-select: text; }
.te-importbox .pill-btn { height: 24px; font-size: 11px; padding: 0 10px; }
.te-msg { font-size: 10.5px; color: var(--text-3); padding: 4px 0 0; min-height: 14px; }
.te-msg.err { color: var(--err); }
#app { font-family: var(--ui-font, inherit); }
.popover-right { width: 296px; }
.te-ctl { flex-wrap: wrap; row-gap: 4px; }
.te-row > span:first-child { flex: 0 0 56px; }
.te-warn { font-size: 10.5px; color: var(--err); padding: 4px 2px 0; min-height: 0; }
.te-warn:empty { display: none; }
.popover-right { max-width: calc(100vw - 16px); }

/* =====================================================================
   SilkFX V2 design system. Layered on the theme tokens above, so every
   theme (built-in and custom) keeps its colours; this adds the semantic
   tokens, type scale, surfaces and component states shared everywhere.
   Glass is used only for things that float: popovers, the modal, the tab
   indicator and the selected preset.
   ===================================================================== */

:root, #app[data-theme="dark"] {
  /* V2 default palette: deep charcoal, graphite surfaces */
  --bg: #151517; --bg-status: #121214; --surface: #1c1c1f; --surface-2: #232327;
  --pill: #1c1c1f; --pill-active: #2d2d32; --line: #252529; --line-strong: #2f2f35;
  --text: #f2f2f5; --text-2: #a3a3ab; --text-3: #6f6f78; --track: #38383f; --scroll: #34343a;
  /* semantic layers */
  --hover: rgba(255, 255, 255, .045); --press: rgba(255, 255, 255, .08);
  --hairline: rgba(255, 255, 255, .07); --edge-hi: rgba(255, 255, 255, .06);
  --glass: rgba(30, 30, 34, .92); --glass-line: rgba(255, 255, 255, .1); --glass-hi: rgba(255, 255, 255, .1);
  --field: rgba(0, 0, 0, .22);
  --shadow: 0 18px 40px -12px rgba(0, 0, 0, .6), 0 2px 8px rgba(0, 0, 0, .3);
}
#app[data-theme="light"] {
  --hover: rgba(0, 0, 0, .04); --press: rgba(0, 0, 0, .07);
  --hairline: rgba(0, 0, 0, .07); --edge-hi: rgba(255, 255, 255, .7);
  --glass: rgba(250, 250, 252, .92); --glass-line: rgba(0, 0, 0, .09); --glass-hi: rgba(255, 255, 255, .85);
  --field: rgba(255, 255, 255, .7);
  --shadow: 0 18px 40px -14px rgba(0, 0, 0, .22), 0 2px 8px rgba(0, 0, 0, .08);
}
:root {
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px;
  --fs-xs: 10.5px; --fs-sm: 11px; --fs-md: 11.5px; --fs-lg: 12.5px; --fs-title: 15px;
}
#app {
  --sel: rgba(var(--accent-rgb), .16); --sel-line: rgba(var(--accent-rgb), .45);
  --ring: 0 0 0 3px rgba(var(--accent-rgb), .28);
}
html, body { background: var(--bg); }

/* surfaces: thin hairline + a whisper of top light, no heavy borders */
.topbar { border-bottom-color: var(--hairline); }
.sidebar { border-right-color: var(--hairline); }
.actionbar { border-top-color: var(--hairline); }
.statusbar { border-top-color: var(--hairline); font-size: var(--fs-sm); color: var(--text-3); }
.preview, .controls {
  border-radius: var(--r-lg);
  border-color: var(--hairline);
  box-shadow: inset 0 1px 0 var(--edge-hi);
}
.controls { padding: 6px 12px 8px; }

/* typography scale */
.detail-head h1 { font-size: var(--fs-title); font-weight: 600; letter-spacing: -.015em; }
.item-name { font-size: 12px; font-weight: 600; letter-spacing: -.005em; }
.item-desc { font-size: var(--fs-sm); color: var(--text-3); }
.side-head { font-size: 10px; letter-spacing: .1em; color: var(--text-3); }
.ctl-label { font-size: var(--fs-md); font-weight: 500; color: var(--text-2); }
.ctl-value { font-size: var(--fs-md); font-variant-numeric: tabular-nums; }
.hint { font-size: var(--fs-md); }
.pop-title { font-size: 13px; font-weight: 600; letter-spacing: -.01em; }
.set-label { font-size: 10px; letter-spacing: .09em; }
.modal-card h2 { font-size: var(--fs-title); font-weight: 600; letter-spacing: -.015em; }

/* tab bar: a quiet track; the active tab is a small piece of glass */
.tabs { background: var(--field); border-color: var(--hairline); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .18); }
.tab { color: var(--text-3); }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); }
.tab-ind {
  background: linear-gradient(180deg, var(--glass-hi), rgba(255, 255, 255, 0) 60%), var(--pill-active);
  box-shadow: inset 0 0 0 .5px var(--glass-line), 0 1px 3px rgba(0, 0, 0, .25);
}
.logo-btn, .round-btn { background: var(--surface); border: 1px solid var(--hairline); box-shadow: inset 0 1px 0 var(--edge-hi); }

/* preset list: hover is a soft wash; selection is accent-tinted glass, text stays readable */
.item { border-radius: var(--r-md); }
.item:hover { background: var(--hover); }
.sel-ind {
  border-radius: var(--r-md);
  background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, 0)), var(--sel);
  box-shadow: inset 0 0 0 1px var(--sel-line), 0 6px 16px -10px rgba(var(--accent-rgb), .8);
}
#app .item.selected .item-name { color: var(--text); }
#app .item.selected .item-desc { color: var(--text-2); opacity: 1; }
.item.selected::before { background: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .22); }
.item.selected .star { color: var(--text-2); }
#app.accent-grad .item.selected { background: transparent; }
.list-sep { background: var(--hairline); }
.list-empty { margin: 8px 6px; padding: 14px 12px; border-radius: var(--r-md); border: 1px dashed var(--line-strong); color: var(--text-3); text-align: center; }

/* fields: one look for search, numbers, keys and names */
.search input, .upd-input, .te-name, .te-importbox input {
  border-radius: 7px; border: 1px solid var(--hairline); background: var(--field); color: var(--text);
  transition: border-color .15s var(--smooth), box-shadow .15s var(--smooth);
}
.search input:focus, .upd-input:focus, .te-name:focus, .te-importbox input:focus { border-color: var(--sel-line); box-shadow: var(--ring); }
.ctl-value input { border-radius: 5px; }
.ctl-value input:hover { border-color: var(--hairline); background: var(--field); }
.ctl-value input:focus { border-color: var(--sel-line); background: var(--field); box-shadow: var(--ring); }

/* sliders: accent fill, white thumb with a soft drop like a hardware knob */
.slider-track { height: 3px; top: 5.5px; }
.slider-fill { height: 3px; top: 5.5px; border-radius: 2px; }
.slider-thumb { background: #fff; box-shadow: 0 0 0 .5px rgba(0, 0, 0, .25), 0 1px 3px rgba(0, 0, 0, .4); }
.slider:hover .slider-thumb, .slider.drag .slider-thumb { filter: none; }
.slider.drag .slider-thumb { box-shadow: 0 0 0 5px rgba(var(--accent-rgb), .2), 0 1px 3px rgba(0, 0, 0, .4); }

/* segmented controls share one shape */
.segment, .mini-seg, .pv-gseg { background: var(--field); border: 1px solid var(--hairline); border-radius: var(--r-md); }
.seg-thumb { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 1px 4px -1px rgba(var(--accent-rgb), .7); }
.swatch { border-color: rgba(128, 128, 128, .35); }

/* buttons */
.pill-btn { border-color: var(--hairline); background: var(--hover); }
.pill-btn:hover:not(:disabled) { background: var(--press); }
.apply { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 1px 2px rgba(0, 0, 0, .25); }
.apply:hover:not(:disabled) { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 6px 18px -8px rgba(var(--accent-rgb), .9); }
.apply:disabled { box-shadow: none; }
.update-pill { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22); }

/* floating surfaces: real glass (backdrop blur), thin bright edge, soft depth */
.popover, .modal-card {
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  backdrop-filter: blur(22px) saturate(1.5);
  border: 1px solid var(--glass-line);
  border-radius: var(--r-lg);
  box-shadow: inset 0 1px 0 var(--glass-hi), var(--shadow);
}
.modal { background: rgba(0, 0, 0, .42); }
.pop-item { border-radius: var(--r-sm); }
.pop-item:hover { background: var(--sel); color: var(--text); }
.theme-tile { border-color: var(--hairline); border-radius: 10px; background: var(--hover); }
.theme-tile.on { border-color: var(--sel-line); box-shadow: var(--ring); }
.theme-editor { border-color: var(--hairline); }
.pv-edit-btn, .pv-readout { background: var(--glass); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-color: var(--glass-line); }

/* motion: the panel springs popovers and dialogs open itself (js/motion.js); nothing loops */
@media (prefers-reduced-motion: reduce) { #app *, #app *::before, #app *::after { animation: none !important; } }

/* scrollbars: thin, only as visible as needed */
.list::-webkit-scrollbar, .detail-scroll::-webkit-scrollbar, #appearance::-webkit-scrollbar { width: 7px; }
.list::-webkit-scrollbar-thumb, .detail-scroll::-webkit-scrollbar-thumb, #appearance::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 4px; border: 2px solid transparent; background-clip: padding-box; }

/* focus: one visible ring for keyboard users */
button:focus-visible, .switch:focus-visible { outline: none; box-shadow: var(--ring); }

/* V2: section headings inside the controls card, and the any-colour swatch */
.ctl-section { margin: 12px 0 4px; padding-top: 10px; border-top: 1px solid var(--hairline); color: var(--text-3); font-size: 10px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; }
.swatch-any { position: relative; display: inline-block; overflow: hidden; cursor: pointer;
  background: conic-gradient(#ff453a, #ffd60a, #30d158, #64d2ff, #0a84ff, #bf5af2, #ff375f, #ff453a); }
.swatch-any input { position: absolute; inset: -8px; width: 32px; height: 32px; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.swatch.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--text); }

/* the glass preview always sits on a dark, colourful backdrop: keep its sample text white in every theme */
.pv-glass-under { color: #fff; }

.modal-card { color: var(--text); }
.modal-card h2, .pop-title { color: var(--text); }

/* V2: update / license window */
.modal-card { max-width: 380px; padding: 20px 20px 16px; }
.modal-card h2 { margin-bottom: 10px; }
.upd-notes { margin: 0 0 16px; padding: 0; list-style: none; color: var(--text-2); }
.upd-notes li { position: relative; padding: 0 0 8px 16px; line-height: 1.5; }
.upd-notes li::before { content: ""; position: absolute; left: 2px; top: 7px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.upd-status.ok { display: flex; align-items: center; gap: 6px; }
.upd-status.ok::before { content: "\2713"; display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 10px; font-weight: 700; flex: 0 0 16px; }
.upd-actions .apply { height: 30px; }

/* V2: status bar connection dot glows softly when connected */
.statusbar .dot.on { box-shadow: 0 0 0 3px rgba(48, 209, 88, .18); }
.statusbar .dot.off { box-shadow: 0 0 0 3px rgba(255, 69, 58, .18); }

/* V2: preset descriptions: a touch more air between name and description */
.item-desc { margin-top: 1px; }
.detail-head { margin-bottom: 12px; }


/* ---- 1.9.20: Silk Ribbon logo (gradient tile + satin S, matches the Discord/website icon) ---- */
.logo-btn {
  position: relative;
  overflow: hidden;
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, #0a84ff 0%, #5e5ce6 60%, #9b4dff 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 2px 8px rgba(94, 92, 230, .35);
}
.logo-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 25% 15%, rgba(255, 255, 255, .35), transparent 62%);
  pointer-events: none;
}
.logo-btn svg { position: relative; filter: drop-shadow(.6px .7px 0 #b9c6ff) drop-shadow(0 1.5px 1.5px rgba(22, 10, 92, .45)); }

/* Website demo only: the sheet Apply opens (see demo.js). Uses the panel's theme variables. */

.dm-sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: end center;
  padding: 12px;
  background: rgba(0, 0, 0, .5);
  animation: dm-fade .2s ease-out both;
}
.dm-sheet.dm-out { animation: dm-fade .18s ease-in reverse both; }
.dm-card {
  width: 100%;
  max-width: 440px;
  padding: 14px 16px 14px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  animation: dm-rise .42s cubic-bezier(.2, 1.3, .4, 1) both;
}
.dm-out .dm-card { animation: dm-rise .18s ease-in reverse both; }
.dm-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.dm-kicker { color: var(--accent); font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.dm-x { width: 22px; height: 22px; border: 0; border-radius: 50%; background: transparent; color: var(--text-2); font-size: 17px; line-height: 1; }
.dm-x:hover { background: var(--surface); color: var(--text); }
.dm-card h2 { margin: 0 0 6px; font-size: 15px; font-weight: 700; }
.dm-line { margin: 0 0 12px; color: var(--text-2); font-size: 11.5px; line-height: 1.5; }

/* the After Effects timeline */
.dm-tl { position: relative; overflow: hidden; border-radius: 8px; border: 1px solid var(--line-strong); background: #1b1b1b; color: #c8c8c8; font-size: 10.5px; }
.dm-row, .dm-ruler { display: grid; grid-template-columns: 46% 1fr; height: 22px; border-bottom: 1px solid #111; }
.dm-row:last-of-type { border-bottom: 0; }
.dm-ruler { height: 18px; background: #232323; color: #7d7d7d; font-size: 9.5px; }
.dm-name { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 0 8px; border-right: 1px solid #111; white-space: nowrap; overflow: hidden; }
.dm-name span { overflow: hidden; text-overflow: ellipsis; }
.dm-layer { background: #262626; }
.dm-lbl { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 2px; }
.dm-ico { flex: 0 0 auto; width: 12px; color: #9a9a9a; font-weight: 600; text-align: center; }
.dm-prop { padding-left: 22px; color: #a7a7a7; }
.dm-prop.dm-sub { padding-left: 34px; }
.dm-tag { flex: 0 0 auto; margin-left: auto; padding: 0 5px; border-radius: 4px; background: rgba(var(--accent-rgb), .18); color: var(--accent); font: 600 10px ui-monospace, Consolas, monospace; }
.dm-track { position: relative; }
.dm-ruler .dm-track { display: flex; justify-content: space-between; align-items: center; padding: 0 6px; }

.dm-bar { position: absolute; top: 4px; bottom: 4px; border-radius: 3px; background: color-mix(in srgb, var(--lbl) 55%, #1b1b1b); border: 1px solid color-mix(in srgb, var(--lbl) 80%, #000); }
.dm-audio { background-image: repeating-linear-gradient(90deg, transparent 0 2px, rgba(0, 0, 0, .28) 2px 3px); }
.dm-new .dm-bar, .dm-new .dm-name { animation: dm-new .5s .15s cubic-bezier(.2, 1.4, .4, 1) both; }
.dm-new { box-shadow: inset 2px 0 0 var(--accent); }
.dm-moved { animation: dm-slide .6s .2s cubic-bezier(.2, 1.3, .4, 1) both; }
.dm-key, .dm-mark { position: absolute; top: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; background: var(--accent); transform: rotate(45deg) scale(0); animation: dm-key .38s var(--d, 0ms) cubic-bezier(.2, 1.6, .4, 1) forwards; animation-delay: calc(var(--d, 0ms) + 250ms); }
.dm-eased { border-radius: 50% 0; }
.dm-mark { top: 2px; width: 2px; height: auto; bottom: 2px; margin: 0; background: #e4d84c; transform: scaleY(0); animation-name: dm-mark; }
.dm-ramp { position: absolute; top: 6px; bottom: 6px; border-radius: 2px; background: linear-gradient(90deg, rgba(var(--accent-rgb), .08), rgba(var(--accent-rgb), .55)); transform-origin: 0 50%; animation: dm-grow .5s .3s ease-out both; }
.dm-loop { background: repeating-linear-gradient(90deg, rgba(var(--accent-rgb), .1) 0 10%, rgba(var(--accent-rgb), .5) 5% 20%); }
.dm-spring { position: absolute; top: 50%; height: 8px; margin-top: -4px; border-radius: 4px; background: rgba(var(--accent-rgb), .25); transform-origin: 0 50%; animation: dm-grow .5s .5s ease-out both; }
.dm-head-line { position: absolute; top: 0; bottom: 0; left: 46%; width: 1px; background: #4b8bff; box-shadow: 0 0 6px #4b8bff; animation: dm-scrub 3.2s .6s linear infinite; }

.dm-fine { margin: 10px 0 12px; color: var(--text-2); font-size: 11px; }
.dm-fine b { color: var(--text); font-weight: 600; }
.dm-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dm-buy { display: inline-flex; align-items: center; text-decoration: none; cursor: pointer; }

@keyframes dm-fade { from { opacity: 0; } }
@keyframes dm-rise { from { opacity: 0; transform: translateY(24px) scale(.97); } }
@keyframes dm-key { to { transform: rotate(45deg) scale(1); } }
@keyframes dm-mark { to { transform: scaleY(1); } }
@keyframes dm-grow { from { transform: scaleX(0); } }
@keyframes dm-new { from { opacity: 0; transform: translateX(-12px); } }
@keyframes dm-slide { from { left: 0; opacity: .4; } }
@keyframes dm-scrub { from { left: 46%; } to { left: 100%; } }

@media (prefers-reduced-motion: reduce) {
  .dm-sheet *, .dm-sheet { animation-duration: 1ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; }
  .dm-head-line { display: none; }
}

/* ---------- viewer mode (?viewer): only the preview, filling the frame, nothing to click ---------- */
.dm-viewer .topbar, .dm-viewer .sidebar, .dm-viewer .detail-head, .dm-viewer .controls, .dm-viewer .actionbar, .dm-viewer .statusbar,
.dm-viewer .pv-edit-btn, .dm-viewer .pv-caption { visibility: hidden !important; }
.dm-viewer #preview { position: fixed !important; inset: 0 !important; width: auto !important; height: auto !important; min-height: 0 !important; max-height: none !important;
  aspect-ratio: auto !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important; z-index: 100; pointer-events: none; }
.dm-viewer body, .dm-viewer #app { background: #111 !important; }
