/* =========================================================
   Media Studio — Utility Hub visual language
   Dark default · cool-stone light mode
   ========================================================= */
:root {
  --bg: #0b0f17;
  --card: #131926;
  --card-2: #182031;
  --card-3: #1e2738;
  --input: #0e131e;
  --line: #222b3c;
  --line-2: #2c3750;
  --text: #e7ecf5;
  --text-2: #b7c1d3;
  --muted: #8592a8;
  --accent: #4f8cff;
  --accent-2: #22d3ee;
  --accent-soft: rgba(79, 140, 255, .14);
  --ok: #34d399;
  --bad: #f87171;
  --warn: #fbbf24;
  --shadow: 0 12px 34px rgba(0, 0, 0, .38);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, .25);
  --glass: rgba(19, 25, 38, .72);
  --scrim: rgba(5, 8, 14, .62);
  --checker-a: #1a2131;
  --checker-b: #111723;
  --r-lg: 22px;
  --r: 14px;
  --r-sm: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #e8edf4;
  --card: #f8fafc;
  --card-2: #eff3f8;
  --card-3: #e5ebf3;
  --input: #ffffff;
  --line: #d4dce7;
  --line-2: #c3cede;
  --text: #1a2333;
  --text-2: #3a475c;
  --muted: #5d6b81;
  --accent: #3b78f0;
  --accent-2: #0ea5c4;
  --accent-soft: rgba(59, 120, 240, .12);
  --ok: #059669;
  --bad: #dc2626;
  --warn: #b45309;
  --shadow: 0 10px 28px rgba(31, 45, 70, .10);
  --shadow-sm: 0 3px 10px rgba(31, 45, 70, .08);
  --glass: rgba(248, 250, 252, .78);
  --scrim: rgba(40, 52, 72, .28);
  --checker-a: #e3e8ef;
  --checker-b: #f6f8fb;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 15px/1.5 var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}
body.locked { overflow: hidden; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 99; background: var(--accent); color: #fff; padding: 6px 10px; border-radius: 8px; }
.skip:focus { left: 8px; }
.noscript { text-align: center; padding: 20px; }

/* ---------- Header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  height: 60px; padding: 0 clamp(14px, 3vw, 28px);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark svg { width: 30px; height: 30px; filter: drop-shadow(0 4px 10px rgba(79, 140, 255, .35)); }
.brand-text { font-size: 17px; }
.brand-text b { font-weight: 700; background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }

.switcher { display: flex; padding: 3px; gap: 2px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; }
.switcher a { padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--muted); }
.switcher a:hover { color: var(--text); text-decoration: none; }
.switcher a.active { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent); }

.search { position: relative; flex: 1; max-width: 460px; margin-left: auto; }
.search-ico { position: absolute; left: 12px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.search input {
  width: 100%; height: 38px; padding: 0 40px 0 38px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 11px var(--mono); color: var(--muted); border: 1px solid var(--line-2); border-radius: 6px; padding: 1px 6px; pointer-events: none; }
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 40;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
  padding: 6px; max-height: min(70vh, 460px); overflow: auto;
}
.sr-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 10px; text-align: left; cursor: pointer; }
.sr-item .app-ico { width: 34px; height: 34px; border-radius: 10px; }
.sr-item .app-ico svg { width: 18px; height: 18px; }
.sr-item b { display: block; font-weight: 600; font-size: 14px; }
.sr-item small { color: var(--muted); font-size: 12px; }
.sr-item.active, .sr-item:hover { background: var(--accent-soft); }
.sr-empty { padding: 14px; color: var(--muted); text-align: center; font-size: 14px; }

.icon-btn { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 12px; border: 1px solid var(--line); background: var(--card); cursor: pointer; transition: border-color .15s, transform .1s; }
.icon-btn:hover { border-color: var(--line-2); }
.icon-btn:active { transform: scale(.96); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[data-theme="dark"] .icon-btn .moon, [data-theme="light"] .icon-btn .sun { display: none; }

/* ---------- Home ---------- */
.home { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(16px, 3vh, 30px); padding: clamp(14px, 3vh, 34px) clamp(14px, 3vw, 28px); width: 100%; max-width: 1180px; margin: 0 auto; }
.hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.hero h1 { margin: 0; font-size: clamp(24px, 3.3vw, 38px); line-height: 1.15; letter-spacing: -.025em; font-weight: 750; }
.hero .dash { color: var(--muted); font-weight: 400; }
.hero .grad { background: linear-gradient(92deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.caps { list-style: none; margin: 0; padding: 4px; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; font-size: 12.5px; }
.caps li { display: flex; align-items: center; gap: 7px; padding: 4px 11px; border-radius: 999px; color: var(--text-2); white-space: nowrap; }
.caps li .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.caps li.off .dot { background: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 22%, transparent); }
.caps li.privacy { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); font-weight: 600; }
.caps li.privacy svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.folders { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(12px, 2vw, 22px); width: 100%; }
.folder {
  position: relative; display: flex; align-items: center; gap: 16px; text-align: left;
  padding: 14px; border: 1px solid var(--line); border-radius: 26px; background: var(--card);
  cursor: pointer; box-shadow: var(--shadow-sm);
  transition: transform .18s cubic-bezier(.3, .7, .4, 1), border-color .18s, box-shadow .18s;
}
.folder:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--c1) 45%, var(--line)); box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb, var(--c1) 20%, transparent); }
.folder:active { transform: scale(.985); }
.folder-glass {
  position: relative; flex: none; width: clamp(96px, 9.6vw, 116px); aspect-ratio: 1;
  padding: 11px; border-radius: 26px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--c1) 26%, var(--card-2)), color-mix(in srgb, var(--c2) 14%, var(--card-2)));
  border: 1px solid color-mix(in srgb, var(--c1) 22%, var(--line));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}
.folder-icons { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, auto); gap: 7px; height: 100%; align-content: center; }
.folder-icons .app-ico { width: 100%; height: auto; aspect-ratio: 1; border-radius: 8px; box-shadow: 0 2px 5px rgba(0, 0, 0, .22); }
.folder-icons .app-ico svg { width: 62%; height: 62%; stroke-width: 2.4; }
.badge { position: absolute; top: -7px; right: -7px; min-width: 24px; height: 24px; padding: 0 7px; display: grid; place-items: center; border-radius: 999px; font-size: 12px; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--c1), var(--c2)); box-shadow: 0 3px 10px color-mix(in srgb, var(--c1) 45%, transparent), 0 0 0 3px var(--card); }
.folder-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.folder-name { font-size: 16.5px; font-weight: 650; letter-spacing: -.01em; }
.folder-sub { font-size: 13px; color: var(--muted); line-height: 1.4; }
.folder-count { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.folder-count::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: linear-gradient(135deg, var(--c1), var(--c2)); }

/* app icon */
.app-ico { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 15px; color: #fff; background: linear-gradient(140deg, var(--c1), var(--c2)); flex: none; }
.app-ico svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Footer ---------- */
.footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; padding: 14px 18px 18px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); }
.footer i { font-style: normal; opacity: .6; }

/* ---------- Folder overlay ---------- */
.folder-overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: var(--scrim); backdrop-filter: blur(14px) saturate(120%); -webkit-backdrop-filter: blur(14px) saturate(120%); animation: fade .18s ease; }
.folder-panel { width: min(720px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: 22px 22px 26px; border-radius: 30px; background: var(--glass); border: 1px solid var(--line); box-shadow: var(--shadow); animation: pop .24s cubic-bezier(.2, .8, .3, 1.15); }
.folder-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.folder-panel h2 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.folder-panel-sub { margin: 4px 0 18px; color: var(--muted); font-size: 14px; }
.folder-apps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.app-tile { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 9px; padding: 16px 10px 14px; border-radius: 20px; border: 1px solid transparent; background: transparent; cursor: pointer; transition: background .15s, border-color .15s, transform .15s; animation: rise .3s both; }
.app-tile:hover, .app-tile:focus-visible { background: var(--card); border-color: var(--line); transform: translateY(-2px); }
.app-tile .app-ico { width: 60px; height: 60px; border-radius: 18px; box-shadow: 0 8px 18px color-mix(in srgb, var(--c1) 30%, transparent); }
.app-tile .app-ico svg { width: 28px; height: 28px; }
.app-tile b { font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.app-tile small { font-size: 12px; color: var(--muted); line-height: 1.35; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.92); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Tool view ---------- */
.tool-view { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; background: var(--bg); animation: fade .15s ease; }
.tool-head { display: flex; align-items: center; gap: 16px; padding: 10px clamp(12px, 3vw, 26px); min-height: 66px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--card) 60%, var(--bg)); }
.back-btn { display: flex; align-items: center; gap: 4px; height: 36px; padding: 0 12px 0 8px; border-radius: 11px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 13.5px; color: var(--text-2); white-space: nowrap; }
.back-btn:hover { border-color: var(--line-2); color: var(--text); }
.back-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.tool-titles { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.tool-ico .app-ico { width: 40px; height: 40px; border-radius: 12px; }
.tool-ico .app-ico svg { width: 21px; height: 21px; }
.tool-titles h2 { margin: 0; font-size: 17px; letter-spacing: -.01em; line-height: 1.25; }
.tool-titles p { margin: 1px 0 0; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.local-pill { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ok); padding: 5px 11px; border-radius: 999px; background: color-mix(in srgb, var(--ok) 11%, transparent); white-space: nowrap; }
.local-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.tool-body { flex: 1; overflow: auto; padding: clamp(12px, 2.4vw, 24px); }

.layout { display: grid; grid-template-columns: minmax(290px, 340px) 1fr; gap: 18px; max-width: 1400px; margin: 0 auto; align-items: start; }
.layout.wide-side { grid-template-columns: minmax(320px, 400px) 1fr; }
.layout.single { grid-template-columns: 1fr; max-width: 1000px; }
.side { display: flex; flex-direction: column; gap: 14px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.panel h3 { margin: 0; font-size: 12px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.stage { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; min-height: 360px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.stage-center { flex: 1; display: grid; place-items: center; min-height: 300px; position: relative; }
.empty { color: var(--muted); text-align: center; font-size: 14px; display: grid; place-items: center; gap: 10px; padding: 30px; }
.empty svg { width: 46px; height: 46px; fill: none; stroke: currentColor; stroke-width: 1.4; opacity: .6; stroke-linecap: round; stroke-linejoin: round; }

.checker { background-color: var(--checker-b); background-image: conic-gradient(var(--checker-a) 25%, transparent 0 50%, var(--checker-a) 0 75%, transparent 0); background-size: 18px 18px; }
.preview { max-width: 100%; max-height: min(68vh, 760px); height: auto; border-radius: 8px; box-shadow: var(--shadow-sm); display: block; }
canvas.preview, img.preview { object-fit: contain; }
.pix { image-rendering: pixelated; }

/* ---------- Form controls ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .lbl { font-size: 13px; color: var(--text-2); display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.field > label output, .lbl output { font: 12px var(--mono); color: var(--accent); }
.hint { font-size: 12px; color: var(--muted); line-height: 1.45; margin: 0; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row > .field { flex: 1 1 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
input[type="text"], input[type="number"], input[type="search"]:not(#search), select, textarea {
  width: 100%; min-width: 0; height: 38px; padding: 0 11px; border-radius: var(--r-sm);
  background: var(--input); border: 1px solid var(--line); outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 110px; padding: 10px 11px; font: 12.5px/1.5 var(--mono); resize: vertical; word-break: break-all; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select { appearance: none; -webkit-appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 16px, calc(100% - 11px) 16px; background-size: 5px 5px; background-repeat: no-repeat; cursor: pointer; }
input[type="color"] { width: 44px; height: 38px; padding: 3px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--input); cursor: pointer; flex: none; }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 6px; }
.color-field { display: flex; gap: 8px; }
.color-field input[type="text"] { font-family: var(--mono); text-transform: lowercase; }

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

.check { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--text-2); cursor: pointer; user-select: none; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); margin: 0; flex: none; }

.seg { display: flex; flex-wrap: wrap; gap: 3px; padding: 3px; background: var(--input); border: 1px solid var(--line); border-radius: 12px; }
.seg button { flex: 1 1 auto; min-width: 0; padding: 6px 10px; border: 0; border-radius: 9px; background: transparent; color: var(--text-2); font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background .12s, color .12s; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--accent); color: #fff; box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 40%, transparent); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--card-2); color: var(--text); font-weight: 550; font-size: 14px; cursor: pointer; white-space: nowrap; transition: border-color .15s, background .15s, transform .08s, opacity .15s; }
.btn:hover { border-color: var(--line-2); background: var(--card-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { border: 0; color: #fff; background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--accent-2))); box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 30%, transparent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.btns > .btn { flex: 1 1 auto; }

/* dropzone */
.drop { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 20px 14px; min-height: 120px; text-align: center; border: 1.5px dashed var(--line-2); border-radius: var(--r); background: var(--input); cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop svg { width: 28px; height: 28px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.drop b { font-size: 14px; font-weight: 600; }
.drop small { font-size: 12px; color: var(--muted); }
.drop .drop-info { font-size: 12px; color: var(--accent); font-family: var(--mono); word-break: break-all; }
.drop input { display: none; }
.drop.compact { min-height: 72px; padding: 12px; flex-direction: row; gap: 10px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.stat { background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; min-width: 0; }
.stat span { display: block; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat b { display: block; font-size: 16px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat b.ok { color: var(--ok); } .stat b.bad { color: var(--bad); } .stat b.warn { color: var(--warn); }

.note { font-size: 12.5px; line-height: 1.5; padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); color: var(--text-2); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); }
.note.warn { background: color-mix(in srgb, var(--warn) 12%, transparent); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.note.ok { background: color-mix(in srgb, var(--ok) 11%, transparent); border-color: color-mix(in srgb, var(--ok) 28%, transparent); }

/* tables / lists */
.tbl-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--r); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: var(--card-2); position: sticky; top: 0; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.mono { font-family: var(--mono); font-size: 12px; word-break: break-all; }
.tbl .sec td { background: var(--card-2); font-weight: 650; color: var(--accent); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.tbl tr.sel td { background: var(--accent-soft); }
.tbl tr.clickable { cursor: pointer; }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; background: var(--card-2); display: block; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--card-3); color: var(--text-2); }
.tag.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.tag.bad { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.tag.warn { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }

/* specific tool widgets */
.crop-wrap { position: relative; display: inline-block; touch-action: none; user-select: none; }
.crop-wrap canvas { display: block; border-radius: 6px; cursor: move; max-width: 100%; }
.paint-wrap { position: relative; display: inline-block; touch-action: none; line-height: 0; max-width: 100%; }
.paint-wrap canvas { max-width: 100%; height: auto; border-radius: 6px; }
.paint-wrap canvas.overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.paint-wrap canvas.work { cursor: crosshair; }
.icon-grid { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; justify-content: center; }
.icon-grid figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; font: 11px var(--mono); color: var(--muted); }
.icon-grid canvas { box-shadow: var(--shadow-sm); border-radius: 3px; }

.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.swatch { border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--card-2); cursor: pointer; text-align: left; padding: 0; transition: transform .12s; }
.swatch:hover { transform: translateY(-2px); }
.swatch .chip { height: 74px; }
.swatch .meta { padding: 8px 10px; font: 12px/1.45 var(--mono); }
.swatch .meta b { display: block; font-size: 13px; font-family: var(--mono); }
.swatch .meta span { color: var(--muted); }
.palette-bar { display: flex; height: 46px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.palette-bar div { flex: 1; }

.loupe { position: fixed; z-index: 80; pointer-events: none; width: 154px; border-radius: 16px; overflow: hidden; background: var(--card); border: 1px solid var(--line-2); box-shadow: var(--shadow); }
.loupe canvas { display: block; width: 154px; height: 154px; image-rendering: pixelated; }
.loupe div { padding: 6px 9px; font: 12px var(--mono); display: flex; align-items: center; gap: 7px; }
.loupe div i { width: 14px; height: 14px; border-radius: 4px; border: 1px solid rgba(255, 255, 255, .3); }
.pin-list { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow: auto; }
.pin { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; background: var(--card-2); font: 12.5px var(--mono); }
.pin i { width: 26px; height: 26px; border-radius: 7px; flex: none; border: 1px solid var(--line); }
.pin span { flex: 1; }
.pin button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 3px 6px; border-radius: 6px; }
.pin button:hover { color: var(--text); background: var(--card-3); }

.big-swatch { height: 150px; border-radius: 18px; border: 1px solid var(--line); display: grid; place-items: center; font: 600 20px var(--mono); }
.shade-row { display: flex; height: 42px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.shade-row button { flex: 1; border: 0; cursor: pointer; padding: 0; }
.shade-row button:hover { transform: scaleY(1.12); }
.code-out { display: flex; gap: 8px; align-items: stretch; }
.code-out input { font-family: var(--mono); font-size: 13px; }

.ratio-big { font-size: clamp(42px, 7vw, 68px); font-weight: 750; letter-spacing: -.03em; line-height: 1; }
.wcag-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.wcag-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--card-2); border: 1px solid var(--line); font-size: 13px; }
.wcag-preview { border-radius: 18px; padding: 24px; border: 1px solid var(--line); }
.wcag-preview .lg { font-size: 26px; font-weight: 700; margin: 0 0 8px; line-height: 1.2; }
.wcag-preview p { margin: 0 0 8px; }
.wcag-preview .btn-demo { display: inline-block; margin-top: 6px; padding: 8px 16px; border-radius: 10px; border: 2px solid currentColor; font-weight: 600; font-size: 14px; }

.grad-preview { height: clamp(220px, 40vh, 420px); border-radius: 20px; border: 1px solid var(--line); }
.stop-row { display: grid; grid-template-columns: auto 1fr 52px auto; gap: 8px; align-items: center; }
.stop-row output { font: 12px var(--mono); color: var(--muted); text-align: right; }
.stop-row button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 4px 6px; border-radius: 6px; }
.stop-row button:hover:not(:disabled) { color: var(--bad); background: var(--card-3); }
.stop-row button:disabled { opacity: .3; cursor: default; }

.cb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.cb-grid figure { margin: 0; background: var(--card-2); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.cb-grid canvas { width: 100%; height: auto; display: block; }
.cb-grid figcaption { padding: 7px 10px; font-size: 12.5px; color: var(--text-2); display: flex; justify-content: space-between; gap: 10px; }
.cb-grid figcaption span { color: var(--muted); text-align: right; }

.compare { position: relative; display: inline-block; max-width: 100%; user-select: none; touch-action: none; line-height: 0; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow-sm); cursor: ew-resize; }
.compare.vert { cursor: ns-resize; }
.compare img { display: block; max-width: 100%; max-height: 70vh; pointer-events: none; }
.compare .after { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; max-height: none; }
.compare .handle { position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1.5px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25), 0 0 12px rgba(0, 0, 0, .35); }
.compare.vert .handle { top: auto; bottom: auto; left: 0 !important; right: 0; width: auto; height: 3px; margin: -1.5px 0 0; }
.compare .knob { position: absolute; top: 50%; left: 50%; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%; background: #fff; color: #111; display: grid; place-items: center; box-shadow: 0 2px 10px rgba(0, 0, 0, .4); font: 700 14px var(--font); }
.compare .lab { position: absolute; top: 10px; padding: 3px 9px; border-radius: 8px; background: rgba(0, 0, 0, .55); color: #fff; font: 600 12px/1.6 var(--font); }
.compare .lab.l { left: 10px; } .compare .lab.r { right: 10px; }
.compare.vert .lab.r { right: auto; left: 10px; top: auto; bottom: 10px; }

.wave-wrap { position: relative; border-radius: 14px; overflow: hidden; background: var(--input); border: 1px solid var(--line); touch-action: none; }
.wave-wrap canvas { display: block; width: 100%; height: 190px; cursor: text; }
.wave-wrap.small canvas { height: 110px; cursor: default; }
.time-row { display: flex; justify-content: space-between; font: 12px var(--mono); color: var(--muted); }
.transport { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.big-time { font: 600 34px var(--mono); letter-spacing: -.02em; }
.meter { height: 12px; border-radius: 999px; background: var(--input); border: 1px solid var(--line); overflow: hidden; }
.meter div { height: 100%; width: 0; background: linear-gradient(90deg, var(--ok), var(--warn) 75%, var(--bad)); transition: width .06s linear; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--bad); display: inline-block; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.rec-list { display: flex; flex-direction: column; gap: 10px; }
.rec-item { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; padding: 12px; border-radius: 14px; background: var(--card-2); border: 1px solid var(--line); }
.rec-item audio { width: 100%; height: 36px; grid-column: 1 / -1; }
.rec-item b { font-size: 14px; }
.rec-item small { color: var(--muted); font-size: 12px; display: block; }
.freq-big { font: 700 clamp(34px, 6vw, 54px) var(--mono); letter-spacing: -.03em; text-align: center; }
.freq-sub { text-align: center; color: var(--muted); font-size: 13px; }

.file-list { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow: auto; }
.file-chip { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; background: var(--card-2); font-size: 12.5px; }
.file-chip img { width: 34px; height: 34px; object-fit: cover; border-radius: 7px; flex: none; }
.file-chip span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip small { color: var(--muted); font-family: var(--mono); }
.file-chip button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 16px; padding: 2px 6px; }
.file-chip button:hover { color: var(--bad); }

.pos-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; width: 108px; }
.pos-grid button { height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--input); cursor: pointer; display: grid; place-items: center; }
.pos-grid button::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.pos-grid button.on { border-color: var(--accent); background: var(--accent-soft); }
.pos-grid button.on::after { background: var(--accent); }

.tabs-inline { display: flex; gap: 6px; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 2px 0; width: 100%; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: var(--mono); font-size: 12.5px; text-align: right; }

/* toasts */
.toasts { position: fixed; z-index: 100; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { padding: 10px 16px; border-radius: 12px; background: var(--card); color: var(--text); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 13.5px; animation: rise .2s ease; max-width: min(92vw, 520px); }
.toast.ok { border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); }
.toast.bad { border-color: color-mix(in srgb, var(--bad) 60%, var(--line)); }
.toast.out { opacity: 0; transform: translateY(6px); transition: .25s; }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .folder { flex-direction: column; align-items: flex-start; }
  .folder-glass { width: 100%; max-width: 150px; }
}
@media (max-width: 920px) {
  .layout, .layout.wide-side { grid-template-columns: 1fr; }
  .folders { grid-template-columns: repeat(2, 1fr); }
  .switcher { display: none; }
  .local-pill { display: none; }
}
@media (max-width: 640px) {
  .topbar { gap: 10px; }
  .brand-text { display: none; }
  .search-kbd { display: none; }
  .folder-apps { grid-template-columns: repeat(2, 1fr); }
  .folder { padding: 12px; border-radius: 22px; }
  .folder-sub { display: none; }
  .grid4 { grid-template-columns: repeat(2, 1fr); }
  .tool-titles p { display: none; }
  .caps li.cap-extra { display: none; }
}
@media (max-height: 760px) and (min-width: 921px) {
  .home { gap: 14px; padding-top: 12px; padding-bottom: 12px; }
  .folder-glass { width: 92px; }
  .folder { padding: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
}
@media print {
  .topbar, .footer { display: none; }
}
