:root {
  color-scheme: light dark;
  --bg: #f5f4f1;
  --surface: #ffffff;
  --surface-2: #efeee9;
  --raised: #ffffff;
  --line: rgba(24, 22, 18, 0.09);
  --line-2: rgba(24, 22, 18, 0.16);
  --text: #17161a;
  --text-2: #6c6a70;
  --text-3: #9a989e;
  --accent: #5b55e8;
  --accent-hover: #4c46d6;
  --accent-soft: rgba(91, 85, 232, 0.12);
  --accent-ink: #ffffff;
  --ok: #1f9d55;
  --stage: #e8e6e1;
  --glass: rgba(255, 255, 255, 0.82);
  --glass-ink: #17161a;
  --shadow-sm: 0 1px 2px rgba(20, 18, 14, 0.06), 0 1px 1px rgba(20, 18, 14, 0.04);
  --shadow-md: 0 2px 6px rgba(20, 18, 14, 0.06), 0 10px 30px rgba(20, 18, 14, 0.1);
  --shadow-photo: 0 1px 2px rgba(0, 0, 0, 0.1), 0 12px 40px rgba(0, 0, 0, 0.16);
  --r: 12px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e10;
    --surface: #161618;
    --surface-2: #222226;
    --raised: #2e2e33;
    --line: rgba(255, 255, 255, 0.08);
    --line-2: rgba(255, 255, 255, 0.15);
    --text: #f3f2f5;
    --text-2: #a09fa7;
    --text-3: #6f6e76;
    --accent: #7b76ff;
    --accent-hover: #8d89ff;
    --accent-soft: rgba(123, 118, 255, 0.16);
    --ok: #3ccf7a;
    --stage: #0a0a0b;
    --glass: rgba(30, 30, 34, 0.82);
    --glass-ink: #f3f2f5;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.35), 0 12px 32px rgba(0, 0, 0, 0.45);
    --shadow-photo: 0 1px 2px rgba(0, 0, 0, 0.5), 0 16px 48px rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme="dark"] {
  --bg: #0e0e10; --surface: #161618; --surface-2: #222226; --raised: #2e2e33;
  --line: rgba(255,255,255,.08); --line-2: rgba(255,255,255,.15);
  --text: #f3f2f5; --text-2: #a09fa7; --text-3: #6f6e76;
  --accent: #7b76ff; --accent-hover: #8d89ff; --accent-soft: rgba(123,118,255,.16);
  --ok: #3ccf7a; --stage: #0a0a0b; --glass: rgba(30,30,34,.82); --glass-ink: #f3f2f5;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  overscroll-behavior: none;
}
.defs { position: absolute; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.i {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.i .fill, .i use { fill: inherit; }
#i-compare .fill { fill: currentColor; stroke: none; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 14px;
  border: 0; border-radius: 10px;
  font-size: 14px; font-weight: 600; letter-spacing: -0.005em;
  background: transparent;
  transition: background-color .15s, color .15s, transform .1s, opacity .15s;
  white-space: nowrap;
  user-select: none; -webkit-user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 1px 0 rgba(255,255,255,.15) inset, 0 1px 2px rgba(0,0,0,.12); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn.ghost { color: var(--text); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn.square { width: 38px; padding: 0; }
.btn.sm { height: 30px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.sm.square { width: 30px; padding: 0; }
.btn.xl { height: 50px; padding: 0 24px; font-size: 16px; border-radius: 14px; }
.btn.xl .i { width: 20px; height: 20px; }
.link { border: 0; background: none; padding: 4px 6px; font-weight: 600; font-size: 13px; color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* ---------------------------------------------------------------- shell */
#app {
  height: 100vh; height: 100dvh;
  display: grid; grid-template-rows: auto 1fr;
}
.bar {
  height: 56px; padding: 0 12px 0 16px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: relative; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 16px; letter-spacing: -0.02em; }
.mark { width: 26px; height: 26px; }
.mk-bg { fill: var(--accent); }
.mk-sun { fill: #fff; }
.mk-shade { fill: rgba(16, 12, 60, 0.42); }
.bar-mid { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; justify-content: center; }
.counter { font-size: 13px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.fname { font-size: 13px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-end { display: flex; align-items: center; gap: 4px; }
[data-view="empty"] .bar-mid, [data-view="empty"] .bar-end { visibility: hidden; }
[data-view="empty"] .bar { border-bottom-color: transparent; background: transparent; }
[data-view="empty"] .editor, [data-view="editor"] .empty { display: none; }

/* ---------------------------------------------------------------- empty */
.empty { overflow-y: auto; display: grid; place-items: center; padding: 8px 20px calc(32px + var(--safe-b)); }
.hero { max-width: 540px; width: 100%; text-align: center; display: flex; flex-direction: column; align-items: center; }
.hero h1 { margin: 26px 0 10px; font-size: clamp(26px, 6.4vw, 36px); line-height: 1.1; letter-spacing: -0.035em; font-weight: 750; text-wrap: balance; }
.lede { margin: 0; color: var(--text-2); font-size: 16px; max-width: 460px; text-wrap: pretty; }
.cta { margin: 28px 0 0; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.or { font-size: 13px; color: var(--text-3); }
.steps { list-style: none; padding: 0; margin: 34px 0 0; display: flex; gap: 8px; width: 100%; }
.steps li {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 8px; border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-sm);
  font-size: 13px; color: var(--text-2); line-height: 1.3;
}
.steps b { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: var(--accent-soft); color: var(--accent); }
.tip { margin: 22px 0 0; font-size: 13px; color: var(--text-2); max-width: 440px; }
.tip b { color: var(--text); font-weight: 600; }
.privacy { margin: 14px 0 0; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-3); }
.privacy .i { width: 14px; height: 14px; }

/* the demo photocard */
@property --p { syntax: "<percentage>"; inherits: true; initial-value: 0%; }
.demo { padding-top: 12px; }
.pc {
  --p: 0%;
  position: relative; width: 150px; height: 232px; border-radius: 12px; overflow: hidden;
  transform: rotate(-4deg); box-shadow: var(--shadow-md);
  background: #fbf8f4; padding: 7px;
  animation: wipe 6s cubic-bezier(.6,0,.3,1) infinite;
}
.pc-art { position: relative; height: 100%; border-radius: 7px; overflow: hidden; background: linear-gradient(170deg, #ffd9e8 0%, #e7dcff 55%, #cfe4ff 100%); }
.pc-sky { position: absolute; inset: 14% 18% auto auto; width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.75); }
.pc-head { position: absolute; left: 50%; top: 34%; width: 46px; height: 54px; transform: translateX(-50%); border-radius: 46% 46% 44% 44%; background: #f3c9b8; box-shadow: 0 -10px 0 4px #3b2b3f; }
.pc-body { position: absolute; left: 50%; bottom: -14%; width: 112px; height: 98px; transform: translateX(-50%); border-radius: 50% 50% 0 0; background: #fff; box-shadow: inset 0 18px 0 #f6f1fa; }
.pc-shade {
  position: absolute; inset: 0;
  background: linear-gradient(118deg, rgba(36, 28, 64, .58) 0%, rgba(36, 28, 64, .46) 48%, rgba(36, 28, 64, 0) 78%);
  -webkit-mask-image: linear-gradient(100deg, transparent calc(var(--p) - 22%), #000 var(--p));
  mask-image: linear-gradient(100deg, transparent calc(var(--p) - 22%), #000 var(--p));
  animation: shadeFade 6s linear infinite;
}
.pc-ring {
  position: absolute; width: 58px; height: 58px; border-radius: 50%;
  border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.2), inset 0 0 0 1px rgba(0,0,0,.12);
  left: calc(var(--p) * 1.1 - 40px); top: calc(40% + (var(--p) - 50%) * .3);
  opacity: 0; animation: ringFade 6s linear infinite;
}
@keyframes wipe { 0%, 14% { --p: 0%; } 58%, 100% { --p: 125%; } }
@keyframes shadeFade { 0%, 86% { opacity: 1; } 92% { opacity: 0; } 97%, 100% { opacity: 1; } }
@keyframes ringFade { 0%, 10% { opacity: 0; } 16%, 54% { opacity: 1; } 60%, 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pc, .pc-shade, .pc-ring { animation: none; } .pc { --p: 60%; } }

/* ---------------------------------------------------------------- editor */
.editor {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  grid-template-areas: "stage" "strip" "panel";
}
.stage {
  grid-area: stage; position: relative; overflow: hidden;
  background: var(--stage);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  display: grid; place-items: center;
  cursor: none;
}
.stage[data-tool="pick"] { cursor: crosshair; }
.stage.panning { cursor: grabbing; }
.wrap { position: relative; transform-origin: 50% 50%; will-change: transform; }
.wrap canvas { display: block; border-radius: 2px; box-shadow: var(--shadow-photo); background: #fff; }

.cursor {
  position: absolute; left: 0; top: 0; pointer-events: none; z-index: 3;
  border-radius: 50%; border: 1.5px solid rgba(255,255,255,.95);
  box-shadow: 0 0 0 1px rgba(0,0,0,.35), inset 0 0 0 1px rgba(0,0,0,.25);
  transform: translate(-50%, -50%); opacity: 0; transition: opacity .15s;
}
.cursor::after {
  content: ""; position: absolute; inset: 0; margin: auto; border-radius: 50%;
  width: var(--core, 30%); height: var(--core, 30%);
  border: 1px dashed rgba(255,255,255,.7);
}
.cursor.on { opacity: 1; }

.hint, .pickbar, .suggest, .tag, .zoom {
  position: absolute; z-index: 4; display: flex; align-items: center; gap: 8px;
  background: var(--glass); color: var(--glass-ink);
  -webkit-backdrop-filter: blur(16px) saturate(1.6); backdrop-filter: blur(16px) saturate(1.6);
  box-shadow: var(--shadow-md); border-radius: 999px;
  font-size: 13.5px; font-weight: 550;
  transition: opacity .25s, transform .25s;
}
.hint { bottom: 18px; left: 50%; transform: translateX(-50%); padding: 10px 16px; pointer-events: none; }
.hint .i { color: var(--accent); }
.hint.off { opacity: 0; transform: translate(-50%, 6px); }
.pickbar { top: 14px; left: 50%; transform: translate(-50%, -8px); padding: 6px 8px 6px 14px; opacity: 0; pointer-events: none; max-width: calc(100% - 24px); }
.pickbar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pickbar .i { color: var(--accent); }
.stage[data-tool="pick"] .pickbar { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.suggest {
  bottom: 16px; left: 50%; transform: translate(-50%, 10px); padding: 6px 6px 6px 14px;
  opacity: 0; pointer-events: none; border-radius: 14px; max-width: calc(100% - 24px);
}
.suggest > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest .i { color: var(--accent); }
.suggest.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.tag { top: 14px; left: 14px; padding: 6px 12px; font-size: 12.5px; opacity: 0; pointer-events: none; }
.tag.on { opacity: 1; }
.zoom { bottom: 14px; right: 14px; padding: 4px 4px 4px 12px; font-size: 12.5px; font-variant-numeric: tabular-nums; opacity: 0; pointer-events: none; }
.zoom.on { opacity: 1; pointer-events: auto; }
.suggest.on ~ .zoom { bottom: 66px; }
.spinner {
  position: absolute; width: 28px; height: 28px; border-radius: 50%;
  border: 2.5px solid var(--line-2); border-top-color: var(--accent);
  animation: spin .8s linear infinite; opacity: 0; transition: opacity .2s; pointer-events: none;
}
.stage.loading .spinner { opacity: 1; }
.stage.loading .wrap { opacity: .35; transition: opacity .2s; }
@keyframes spin { to { transform: rotate(360deg); } }

/* strip */
.strip {
  grid-area: strip;
  display: flex; gap: 8px; padding: 10px 16px; overflow-x: auto; scrollbar-width: none;
  background: var(--surface); border-top: 1px solid var(--line);
  scroll-padding: 16px;
}
.strip::-webkit-scrollbar { display: none; }
.th {
  position: relative; flex: none; width: 52px; height: 52px; padding: 0; border: 0; border-radius: 10px;
  background: var(--surface-2); overflow: visible;
}
.th img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; display: block; transition: opacity .2s; }
.th[aria-current="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.th:not([aria-current="true"]) img { opacity: .72; }
.th:hover img { opacity: 1; }
.th .badge {
  position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center; border: 2px solid var(--surface);
}
.th .badge.edited { background: var(--accent); width: 12px; height: 12px; right: -2px; bottom: -2px; }
.th .badge.saved { background: var(--ok); color: #fff; }
.th .badge .i { width: 10px; height: 10px; stroke-width: 3.2; }
.th .rm {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--surface);
  background: var(--text); color: var(--surface); display: none; place-items: center; padding: 0;
}
.th .rm .i { width: 11px; height: 11px; stroke-width: 2.8; }
.th[aria-current="true"] .rm { display: grid; }
.th.add { border: 1.5px dashed var(--line-2); background: transparent; color: var(--text-2); display: grid; place-items: center; }
.th.add:hover { color: var(--accent); border-color: var(--accent); }
.th.bad img { filter: grayscale(1); opacity: .4; }

/* panel */
.panel {
  grid-area: panel; position: relative;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 10px 16px calc(12px + var(--safe-b));
  display: flex; flex-direction: column; gap: 10px;
}
.p-tools { display: flex; align-items: center; gap: 8px; }
.acts { margin-left: auto; display: flex; gap: 2px; }
.seg {
  display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--surface-2);
}
.seg button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent;
  font-size: 13.5px; font-weight: 600; color: var(--text-2);
  transition: background-color .15s, color .15s, box-shadow .15s;
}
.seg button[aria-checked="true"] { background: var(--raised); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 .5px var(--line); }
.seg.sm button { height: 30px; font-size: 13px; }
.seg.sm .i { width: 15px; height: 15px; }
.tone-chip {
  display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 8px 0 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  font-size: 13px; font-weight: 600;
}
.tone-chip .i { width: 14px; height: 14px; color: var(--text-3); }
.swatch { width: 18px; height: 18px; border-radius: 6px; background: #ccc2ad; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); flex: none; }
.swatch.lg { width: 26px; height: 26px; border-radius: 8px; }

/* sliders */
.tabs { display: flex; gap: 4px; }
.tabs button {
  flex: 1; height: 30px; border: 0; border-radius: 8px; background: transparent;
  font-size: 12.5px; font-weight: 600; color: var(--text-3);
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
}
.tabs b { font-weight: 600; font-variant-numeric: tabular-nums; color: inherit; opacity: .8; }
.p-sliders[data-tab="size"] .tabs [data-tab="size"],
.p-sliders[data-tab="strength"] .tabs [data-tab="strength"],
.p-sliders[data-tab="soft"] .tabs [data-tab="soft"] { color: var(--text); background: var(--surface-2); }
.slider { display: block; }
.s-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); margin-bottom: 2px; }
.s-head b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }

input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 30px; margin: 0; background: transparent; cursor: pointer;
  --pct: 50%;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent) var(--pct), var(--line-2) var(--pct));
}
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--line-2); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%;
  background: #fff; border: 0; box-shadow: 0 0 0 .5px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.22);
  transition: transform .12s;
}
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.12); }
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 .5px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.22); }

/* tone */
.p-tone { display: flex; flex-direction: column; gap: 10px; }
.t-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 600; }
.p-tone .seg { width: 100%; }
.p-tone .seg button { flex: 1; }
.hex {
  display: flex; align-items: center; height: 38px; padding: 0 12px; gap: 2px;
  border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface);
  font-family: var(--mono); font-size: 14px; color: var(--text-3);
}
.hex:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hex input { border: 0; outline: 0; background: transparent; width: 100%; font-family: var(--mono); font-size: 14px; color: var(--text); text-transform: uppercase; }
.t-help { margin: 0; font-size: 12.5px; color: var(--text-2); line-height: 1.4; }

.p-foot { display: flex; flex-direction: column; gap: 16px; }
.p-foot > .btn { align-self: flex-start; margin-left: -10px; color: var(--text-2); }
.keys { margin: 0; display: grid; gap: 6px; font-size: 12.5px; }
.keys div { display: flex; justify-content: space-between; gap: 8px; }
.keys dt { font-family: var(--mono); font-size: 11.5px; color: var(--text-2); background: var(--surface-2); padding: 1px 6px; border-radius: 5px; }
.keys dd { margin: 0; color: var(--text-3); }

/* ------------------------------------------- phone layout */
@media (max-width: 959px) {
  .d-only { display: none !important; }
  .slider .s-head { display: none; }
  .p-sliders[data-tab="size"] .slider:not([data-k="size"]),
  .p-sliders[data-tab="strength"] .slider:not([data-k="strength"]),
  .p-sliders[data-tab="soft"] .slider:not([data-k="soft"]) { display: none; }
  .p-sliders { display: flex; flex-direction: column; gap: 2px; }
  .p-tone {
    position: absolute; left: 12px; right: 12px; bottom: calc(100% + 8px); z-index: 20;
    padding: 16px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-md), 0 0 0 .5px var(--line-2);
    opacity: 0; transform: translateY(8px) scale(.98); transform-origin: 30% 100%; pointer-events: none;
    transition: opacity .18s, transform .18s;
  }
  #app[data-tone-open] .p-tone { opacity: 1; transform: none; pointer-events: auto; }
  .bar { height: 52px; padding: 0 8px 0 14px; }
  .bar-mid { justify-content: flex-start; }
  .fname { display: none; }
  .brand span { display: none; }
  [data-view="empty"] .brand span { display: inline; }
}
@media (max-width: 419px) {
  .p-tools .seg span { display: none; }
  .p-tools .seg button { padding: 0 13px; }
  .bar .btn.ghost:not(.square) { padding: 0 10px; }
}

/* ------------------------------------------- desktop layout */
@media (min-width: 960px) {
  .m-only { display: none !important; }
  .editor {
    grid-template-columns: minmax(0, 1fr) 320px;
    grid-template-rows: minmax(0, 1fr) auto;
    grid-template-areas: "stage panel" "strip panel";
  }
  .panel {
    border-top: 0; border-left: 1px solid var(--line);
    padding: 20px; gap: 0; overflow-y: auto;
  }
  .panel > * { padding: 18px 0; border-bottom: 1px solid var(--line); }
  .panel > *:first-child { padding-top: 0; }
  .panel > *:last-child { border-bottom: 0; }
  .p-sliders { display: flex; flex-direction: column; gap: 12px; }
  .p-tools { flex-direction: column; align-items: stretch; gap: 10px; }
  .p-tools .seg button { flex: 1; }
  .acts { margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .acts .btn { width: auto; border: 1px solid var(--line); }
  .strip { padding: 12px 20px; }
  .th { width: 56px; height: 56px; }
}

/* ---------------------------------------------------------------- overlays */
.scrim { position: fixed; inset: 0; z-index: 15; display: none; }
#app[data-tone-open] .scrim { display: block; }

.drop {
  position: fixed; inset: 10px; z-index: 50; border-radius: 20px;
  border: 2px dashed var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: grid; place-items: center; opacity: 0; pointer-events: none; transition: opacity .15s;
}
.drop div { display: flex; gap: 10px; align-items: center; padding: 14px 22px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-md); font-weight: 600; }
.drop.on { opacity: 1; }

.toast {
  position: fixed; top: 66px; left: 50%; z-index: 60;
  transform: translate(-50%, -10px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 8px 8px 8px 16px; max-width: calc(100vw - 24px);
  border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-md);
  font-size: 13.5px; font-weight: 550; transition: opacity .2s, transform .2s;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast .t-msg { padding-right: 8px; }
.toast .t-act { color: var(--accent); filter: brightness(1.25); }
.toast .t-act:empty { display: none; }
.toast .t-bar { width: 72px; height: 4px; border-radius: 4px; background: color-mix(in srgb, var(--bg) 25%, transparent); overflow: hidden; display: none; margin-right: 8px; }
.toast .t-bar i { display: block; height: 100%; width: 0; background: var(--bg); transition: width .15s; }
.toast.progress .t-bar { display: block; }

/* save sheet */
.sheet {
  border: 0; padding: 0; color: var(--text); background: var(--surface);
  width: min(440px, calc(100vw - 24px)); max-height: min(640px, 86dvh);
  border-radius: 20px; box-shadow: var(--shadow-md);
  display: none; flex-direction: column;
}
.sheet:focus { outline: none; }
.sheet[open] { display: flex; animation: sheetIn .22s cubic-bezier(.2,.8,.2,1); }
.sheet::backdrop { background: rgba(10, 10, 14, .38); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
@keyframes sheetIn { from { opacity: 0; transform: translateY(16px) scale(.985); } }
.sh-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 16px 8px 22px; }
.sh-head h2 { margin: 0; font-size: 18px; letter-spacing: -0.02em; }
.sh-head p { margin: 3px 0 0; font-size: 13px; color: var(--text-2); }
.sh-list { list-style: none; margin: 0; padding: 6px 12px; overflow-y: auto; }
.sh-list li { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; }
.sh-list img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex: none; background: var(--surface-2); }
.sh-meta { flex: 1; min-width: 0; }
.sh-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-info { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.ring {
  --v: 0; width: 22px; height: 22px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--accent) calc(var(--v) * 1turn), var(--line-2) 0);
  -webkit-mask: radial-gradient(circle, transparent 7px, #000 7.5px); mask: radial-gradient(circle, transparent 7px, #000 7.5px);
}
.done-dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--ok); color: #fff; flex: none; }
.done-dot .i { width: 12px; height: 12px; stroke-width: 3; }
.sh-foot { display: flex; flex-direction: column; gap: 6px; padding: 12px 16px 18px; }
.sh-foot .btn.xl { width: 100%; }
@media (max-width: 959px) {
  .sheet { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 22px 22px 0 0; padding-bottom: var(--safe-b); }
  @keyframes sheetIn { from { transform: translateY(40px); opacity: 0; } }
}
