:root {
  --bg: #f3f3f1; --panel: #fff; --raise: #f4f4f2; --raise2: #ebebe8; --line: #e8e7e3;
  --ink: #18191b; --ink2: #5d6066; --ink3: #92959b; --acc: #4f6bed; --acc-ink: #fff; --danger: #d9363e;
  --acc-soft: color-mix(in srgb, var(--acc) 11%, var(--panel)); --acc-line: color-mix(in srgb, var(--acc) 45%, var(--panel));
  --shadow: 0 10px 38px rgba(0, 0, 0, .14), 0 2px 8px rgba(0, 0, 0, .06);
  --r: 12px; --tile: 172px; --row: 46px; --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}
[data-theme=dark] { --bg: #101113; --panel: #18191c; --raise: #202125; --raise2: #2a2b30; --line: #2a2b30; --ink: #ececee; --ink2: #a5a8af; --ink3: #70737a; --shadow: 0 12px 40px rgba(0, 0, 0, .55); color-scheme: dark; }
[data-theme=black] { --bg: #000; --panel: #09090a; --raise: #151517; --raise2: #1f1f22; --line: #1e1e21; --ink: #f0f0f1; --ink2: #a0a3aa; --ink3: #696c73; --shadow: 0 12px 40px rgba(0, 0, 0, .8); color-scheme: dark; }
[data-theme=slate] { --bg: #0e131a; --panel: #141b25; --raise: #1c2532; --raise2: #253143; --line: #232e3e; --ink: #e6ebf2; --ink2: #9aa8ba; --ink3: #65748a; --shadow: 0 12px 40px rgba(0, 0, 0, .55); color-scheme: dark; }
[data-theme=forest] { --bg: #0d1411; --panel: #121c17; --raise: #19261f; --raise2: #22342a; --line: #20302a; --ink: #e4efe9; --ink2: #97ada1; --ink3: #637a6e; --shadow: 0 12px 40px rgba(0, 0, 0, .55); color-scheme: dark; }
[data-theme=sand] { --bg: #eee8dd; --panel: #fbf8f2; --raise: #f2ecdf; --raise2: #e8e0d0; --line: #e4dccb; --ink: #2a251d; --ink2: #6b6252; --ink3: #9a8f7c; }
[data-theme=mist] { --bg: #e9eef3; --panel: #f9fbfd; --raise: #edf2f6; --raise2: #dfe7ee; --line: #dde5ec; --ink: #17202a; --ink2: #566473; --ink3: #8996a4; }
[data-radius=s] { --r: 6px; }
[data-radius=l] { --r: 18px; }
[data-density=compact] { --tile: 136px; --row: 38px; }
[data-density=roomy] { --tile: 216px; --row: 54px; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif; -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; display: block; }
svg.i.fill { fill: currentColor; }
::selection { background: var(--acc-line); }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--raise2); border-radius: 10px; border: 2px solid var(--panel); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.grow { flex: 1; min-width: 0; }
.el { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- shell ---------- */
#app { height: 100dvh; display: grid; grid-template-columns: 78px minmax(0, 1fr); }
.rail { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 0 12px; }
.logo { width: 38px; height: 38px; border-radius: 12px; background: var(--acc); color: var(--acc-ink); display: grid; place-items: center; margin-bottom: 14px; }
.logo svg { width: 22px; height: 22px; }
.nav { width: 64px; padding: 7px 0 6px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--ink2); font-size: 10.5px; font-weight: 550; transition: color .12s; }
.nav span.pill { width: 44px; height: 30px; border-radius: 10px; display: grid; place-items: center; transition: background .12s; }
.nav:hover span.pill { background: var(--raise2); }
.nav.on { color: var(--ink); }
.nav.on span.pill { background: var(--acc-soft); color: var(--acc); }
.nav.dropt span.pill, .crumb.dropt { background: var(--acc); color: var(--acc-ink); }
.meter { width: 44px; margin-top: auto; padding: 8px 0; cursor: default; }
.meter i { display: block; height: 4px; border-radius: 4px; background: var(--raise2); overflow: hidden; }
.meter i b { display: block; height: 100%; background: var(--acc); border-radius: 4px; }
.meter small { display: block; text-align: center; font-size: 10px; color: var(--ink3); margin-top: 5px; }
.av { width: 34px; height: 34px; border-radius: 50%; background: var(--acc-soft); color: var(--acc); display: grid; place-items: center; font-weight: 650; font-size: 13px; overflow: hidden; flex: none; }
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
main { margin: 8px 8px 8px 0; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; display: flex; flex-direction: column; overflow: hidden; min-width: 0; position: relative; }
.top { height: 62px; flex: none; display: flex; align-items: center; gap: 6px; padding: 0 14px 0 22px; }
.crumbs { display: flex; align-items: center; min-width: 0; flex: 1; font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.crumb { padding: 4px 7px; margin-left: -7px; border-radius: 8px; color: var(--ink3); white-space: nowrap; flex: none; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.crumb:hover { background: var(--raise); color: var(--ink); }
.crumb:last-child { color: var(--ink); flex: 0 1 auto; }
.crumbs > svg { color: var(--ink3); width: 15px; height: 15px; margin: 0 5px 0 -2px; }
.search { display: flex; align-items: center; gap: 8px; height: 38px; width: min(300px, 28vw); padding: 0 11px; background: var(--raise); border-radius: 11px; color: var(--ink3); transition: width .18s var(--ease), box-shadow .12s; }
.search:focus-within { box-shadow: 0 0 0 2px var(--acc-line); width: min(380px, 34vw); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--ink); }
.search input::placeholder { color: var(--ink3); }
.search kbd { font: 11px ui-monospace, monospace; border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; }
.ib { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: var(--ink2); flex: none; transition: background .1s; }
.ib:hover { background: var(--raise); color: var(--ink); }
.ib.on { color: var(--acc); }
.btn { height: 38px; padding: 0 15px; border-radius: 11px; font-weight: 600; font-size: 13.5px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: var(--raise); white-space: nowrap; transition: filter .1s, background .1s; }
.btn:hover { background: var(--raise2); }
.btn.pri { background: var(--acc); color: var(--acc-ink); }
.btn.pri:hover { filter: brightness(1.08); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.wide { width: 100%; }
.btn svg.i { width: 18px; height: 18px; }
#view { flex: 1; overflow: auto; padding: 0 22px 110px; outline: 0; overscroll-behavior: contain; }
.sec { font-size: 12px; font-weight: 600; color: var(--ink3); margin: 16px 2px 9px; display: flex; align-items: center; gap: 8px; }
.sec:first-child { margin-top: 4px; }

/* ---------- items ---------- */
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(var(--tile) + 30px), 1fr)); gap: 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(var(--tile) * var(--zoom, 1)), 1fr)); gap: 14px 12px; }
.it { position: relative; user-select: none; -webkit-user-select: none; cursor: pointer; border-radius: var(--r); -webkit-touch-callout: none; }
.fold { display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 10px 0 13px; background: var(--raise); font-weight: 550; transition: background .1s; }
.fold:hover { background: var(--raise2); }
.fold > svg.i:first-child { color: var(--acc); }
.fold .badges { display: flex; gap: 4px; color: var(--ink3); }
.fold .badges svg, .row .badges svg { width: 14px; height: 14px; }
.tile { content-visibility: auto; contain-intrinsic-size: auto 180px; }
.tile .ph { aspect-ratio: 4 / 3; border-radius: var(--r); background: var(--raise); overflow: hidden; display: grid; place-items: center; position: relative; transition: box-shadow .1s, transform .12s var(--ease); }
.tile:hover .ph { box-shadow: 0 0 0 1px var(--line), 0 4px 14px rgba(0, 0, 0, .07); }
.tile .ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .2s; }
.tile .ph img.ok { opacity: 1; }
.tile .ph > svg.i { width: 34px; height: 34px; stroke-width: 1.3; }
.tile .ext { position: absolute; left: 8px; bottom: 8px; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 6px; border-radius: 6px; background: var(--panel); color: var(--ink2); }
.tile .nm { padding: 8px 3px 0; font-size: 13px; font-weight: 500; }
.tile .mt { padding: 1px 3px 0; font-size: 11.5px; color: var(--ink3); }
.tile .badges { position: absolute; right: 7px; top: 7px; display: flex; gap: 4px; }
.tile .badges span { width: 22px; height: 22px; border-radius: 7px; background: var(--panel); display: grid; place-items: center; color: var(--ink2); }
.tile .badges svg { width: 13px; height: 13px; }
.chk { position: absolute; left: 7px; top: 7px; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--ink3); background: var(--panel); display: grid; place-items: center; opacity: 0; transition: opacity .1s; color: transparent; z-index: 1; }
.chk svg { width: 14px; height: 14px; stroke-width: 2.6; }
.fold .chk { position: static; order: 9; }
.it:hover .chk, .selecting .chk { opacity: 1; }
.it.sel .chk { opacity: 1; background: var(--acc); border-color: var(--acc); color: var(--acc-ink); }
.tile.sel .ph { box-shadow: 0 0 0 2px var(--acc); transform: scale(.965); }
.fold.sel, .row.sel { background: var(--acc-soft); }
.it.dropt { box-shadow: 0 0 0 2px var(--acc); background: var(--acc-soft); }
.it.cut { opacity: .45; }
.k-img { color: #8b5cf6; } .k-vid { color: #e64980; } .k-aud { color: #e8890c; } .k-pdf { color: #e03131; } .k-doc { color: #3b82f6; }
.k-sheet { color: #2f9e44; } .k-zip { color: #b0803b; } .k-code { color: #0f9d8a; } .k-art { color: #d6336c; } .k-file { color: var(--ink3); }

.rows { display: flex; flex-direction: column; }
.row, .rhead { display: grid; grid-template-columns: 34px minmax(0, 1fr) 96px 150px 28px; align-items: center; gap: 10px; height: var(--row); padding: 0 8px; }
.row { border-radius: 10px; content-visibility: auto; contain-intrinsic-size: auto 46px; }
.row:hover { background: var(--raise); }
.row .ico { width: 30px; height: 30px; border-radius: 8px; background: var(--raise); display: grid; place-items: center; overflow: hidden; position: relative; }
.row .ico img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.row .ico img.ok { opacity: 1; }
.row .ico svg { width: 18px; height: 18px; }
.row.dir .ico { color: var(--acc); background: none; }
.row .nm { font-weight: 500; display: flex; align-items: center; gap: 8px; min-width: 0; }
.row .nm small { color: var(--ink3); font-weight: 400; flex: none; max-width: 40%; }
.row .badges { display: flex; gap: 5px; color: var(--ink3); flex: none; }
.row .c { color: var(--ink3); font-size: 12.5px; white-space: nowrap; }
.row .chk { position: static; opacity: 0; }
.row:hover .chk, .selecting .row .chk, .row.sel .chk { opacity: 1; }
.rhead { height: 34px; color: var(--ink3); font-size: 12px; font-weight: 600; position: sticky; top: 0; background: var(--panel); z-index: 2; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.rhead button { display: inline-flex; align-items: center; gap: 4px; color: inherit; font-weight: 600; }
.rhead button svg { width: 12px; height: 12px; }
.rhead button.on { color: var(--ink); }

.empty { height: 70%; min-height: 260px; display: grid; place-items: center; text-align: center; color: var(--ink3); }
.empty svg.i { width: 54px; height: 54px; stroke-width: 1.1; margin: 0 auto 12px; color: var(--raise2); }
.empty b { display: block; color: var(--ink2); font-weight: 600; font-size: 15px; }
.skel { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(var(--tile) * var(--zoom, 1)), 1fr)); gap: 14px 12px; padding-top: 8px; }
.skel i { aspect-ratio: 4 / 3; border-radius: var(--r); background: var(--raise); animation: pulse 1.1s ease-in-out infinite alternate; }
@keyframes pulse { to { opacity: .45; } }

/* ---------- floating pieces ---------- */
.selbar { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; align-items: center; gap: 2px; padding: 6px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); z-index: 30; animation: rise .16s var(--ease); max-width: calc(100vw - 16px); }
.selbar .n { min-width: 30px; height: 30px; padding: 0 9px; margin: 0 6px 0 2px; border-radius: 10px; background: var(--acc); color: var(--acc-ink); display: grid; place-items: center; font-weight: 650; font-variant-numeric: tabular-nums; }
.selbar .ib { color: var(--ink2); }
.selbar .ib:hover { background: var(--raise); color: var(--ink); }
.selbar .ib:last-child { color: var(--ink3); margin-left: 4px; }
[data-tip] { position: relative; }
[data-tip]::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 12px); transform: translate(-50%, 4px); padding: 5px 10px; border-radius: 8px; background: var(--ink); color: var(--panel); font-size: 12px; font-weight: 550; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s, transform .12s var(--ease); z-index: 5; }
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
@media (hover: none) { [data-tip]::after { display: none; } }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 10px); } }
.menu { position: fixed; min-width: 208px; max-width: 300px; padding: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); z-index: 60; animation: pop .1s var(--ease); max-height: 80vh; overflow: auto; }
@keyframes pop { from { opacity: 0; transform: scale(.97); } }
.mi { display: flex; align-items: center; gap: 11px; width: 100%; height: 36px; padding: 0 10px; border-radius: 9px; text-align: left; font-weight: 500; }
.mi:hover { background: var(--raise); }
.mi svg.i { width: 18px; height: 18px; color: var(--ink2); }
.mi.danger, .mi.danger svg.i { color: var(--danger); }
.mi kbd { margin-left: auto; font: 11px ui-monospace, monospace; color: var(--ink3); }
.msep { height: 1px; background: var(--line); margin: 5px 4px; }
.mhead { padding: 6px 10px 8px; display: flex; align-items: center; gap: 10px; font-weight: 600; min-width: 0; }
.back { position: fixed; inset: 0; z-index: 50; }
.back.dim { background: rgba(0, 0, 0, .42); animation: fade .15s; display: grid; place-items: center; padding: 16px; }
@keyframes fade { from { opacity: 0; } }
.dlg { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 20px; box-shadow: var(--shadow); animation: pop .14s var(--ease); max-height: 90dvh; overflow: auto; }
.dlg h2 { margin: 0 0 14px; font-size: 16px; font-weight: 650; display: flex; align-items: center; gap: 10px; min-width: 0; }
.dlg .acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.dlg p { margin: 0 0 6px; color: var(--ink2); }
.inp { width: 100%; height: 42px; padding: 0 13px; border-radius: 11px; border: 1px solid var(--line); background: var(--panel); outline: 0; transition: border-color .1s, box-shadow .1s; }
.inp:focus { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); }
textarea.inp { height: auto; padding: 10px 13px; resize: vertical; }
select.inp { appearance: none; padding-right: 28px; background-image: linear-gradient(45deg, transparent 50%, var(--ink3) 50%), linear-gradient(135deg, var(--ink3) 50%, transparent 50%); background-position: calc(100% - 15px) 18px, calc(100% - 10px) 18px; background-size: 5px 5px; background-repeat: no-repeat; }
.field { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.field > svg.i { color: var(--ink3); }
.err { color: var(--danger); font-size: 12.5px; min-height: 18px; margin-top: 8px; }
.sw { width: 40px; height: 24px; border-radius: 12px; background: var(--raise2); position: relative; flex: none; transition: background .15s; }
.sw::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s var(--ease); }
.sw.on { background: var(--acc); }
.sw.on::after { transform: translateX(16px); }
.linkrow { display: flex; gap: 6px; margin-top: 10px; }
.linkrow .inp { font: 12.5px ui-monospace, monospace; color: var(--ink2); background: var(--raise); border-color: transparent; }
.opt { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.opt label, .opt .lab { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 9px; border-radius: 11px; background: var(--raise); color: var(--ink3); min-width: 0; }
.opt label svg, .opt .lab > svg { width: 16px; height: 16px; }
.opt input, .opt select { flex: 1; min-width: 0; width: 100%; border: 0; outline: 0; background: none; font-size: 13px; color: var(--ink); appearance: none; }
.sline { display: flex; align-items: center; gap: 10px; padding: 10px 0 0; font-weight: 550; }
.choice { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border-radius: 12px; text-align: left; border: 1px solid var(--line); margin-top: 8px; transition: border-color .1s, background .1s; }
.choice:hover { border-color: var(--acc); background: var(--acc-soft); }
.choice svg.i { color: var(--acc); }
.choice b { display: block; font-weight: 600; }
.choice small { color: var(--ink3); }
.toasts { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; z-index: 90; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--ink); color: var(--panel); border-radius: 12px; box-shadow: var(--shadow); font-weight: 500; animation: pop .14s var(--ease); max-width: 90vw; }
.toast button { color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.tray { position: fixed; right: 22px; bottom: 22px; width: 320px; max-width: calc(100vw - 24px); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); z-index: 40; overflow: hidden; animation: pop .14s var(--ease); }
.tray .hd { display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tray .hd small { color: var(--ink3); font-weight: 500; }
.tray .hd .ib { width: 30px; height: 30px; }
.tray .bar { height: 3px; background: var(--raise2); }
.tray .bar b { display: block; height: 100%; width: 0; background: var(--acc); transition: width .25s; }
.tray ul { list-style: none; margin: 0; padding: 4px 6px 6px; max-height: 220px; overflow: auto; }
.tray li { display: flex; align-items: center; gap: 9px; height: 32px; padding: 0 8px; font-size: 12.5px; color: var(--ink2); }
.tray li svg { width: 15px; height: 15px; }
.tray li .ok { color: #2f9e44; } .tray li .bad { color: var(--danger); }
.tray li em { font-style: normal; color: var(--ink3); font-variant-numeric: tabular-nums; }
.spin { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--raise2); border-top-color: var(--acc); animation: spin .7s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.dropz { position: fixed; inset: 10px; border: 2px dashed var(--acc); border-radius: 22px; background: color-mix(in srgb, var(--acc) 14%, transparent); backdrop-filter: blur(3px); z-index: 80; display: grid; place-items: center; pointer-events: none; color: var(--acc); }
.dropz svg { width: 56px; height: 56px; stroke-width: 1.3; }

/* ---------- viewer ---------- */
.viewer { position: fixed; inset: 0; z-index: 70; background: #0a0a0c; color: #f2f2f3; display: flex; flex-direction: column; animation: fade .14s; color-scheme: dark; }
.vbar { height: 58px; flex: none; display: flex; align-items: center; gap: 4px; padding: 0 10px; }
.vbar .ib { color: #d6d6d9; }
.vbar .ib:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.vbar .ib.on { color: #ffd43b; }
.vbar .t { flex: 1; min-width: 0; padding: 0 8px; }
.vbar .t b { display: block; font-weight: 600; }
.vbar .t small { color: #8f9198; font-size: 12px; }
.stage { flex: 1; min-height: 0; display: grid; place-items: center; position: relative; padding: 0 12px 16px; overflow: hidden; }
.stage img, .stage video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; min-height: 0; }
.stage img { background-size: contain; background-position: center; background-repeat: no-repeat; }
.stage iframe { width: min(1100px, 100%); height: 100%; border: 0; border-radius: 10px; background: #fff; }
.stage textarea { width: min(980px, 100%); height: 100%; resize: none; border: 0; outline: 0; border-radius: 12px; padding: 18px 20px; background: #151517; color: #e6e6e8; font: 13.5px/1.6 ui-monospace, "Cascadia Code", Menlo, monospace; tab-size: 4; }
.stage .card { text-align: center; }
.stage .card > svg.i { width: 72px; height: 72px; stroke-width: 1; margin: 0 auto 14px; }
.stage .card .btn { margin-top: 18px; }
.stage audio { width: min(460px, 90vw); margin-top: 22px; }
.vnav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; background: rgba(255, 255, 255, .08); display: grid; place-items: center; color: #fff; z-index: 2; }
.vnav:hover { background: rgba(255, 255, 255, .18); }
.vnav.l { left: 14px; } .vnav.r { right: 14px; }

/* ---------- settings ---------- */
.set { max-width: 620px; margin: 0 auto; padding-top: 6px; }
.card { border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 14px; }
.card h3 { margin: 0 0 12px; font-size: 12px; font-weight: 600; color: var(--ink3); }
.line { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.line + .line { border-top: 1px solid var(--line); }
.line > span { color: var(--ink2); flex: 1; min-width: 0; }
.prof { display: flex; align-items: center; gap: 16px; }
.prof .av { width: 72px; height: 72px; font-size: 26px; cursor: pointer; position: relative; }
.prof .av::after { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--panel), 0 0 0 2px var(--acc); opacity: 0; transition: opacity .12s; }
.prof .av:hover::after { opacity: 1; }
.prof .inp + .inp { margin-top: 8px; }
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.th { border-radius: 12px; border: 2px solid transparent; padding: 3px; text-align: center; font-size: 11px; color: var(--ink3); }
.th i { display: block; height: 46px; border-radius: 8px; border: 1px solid var(--line); margin-bottom: 4px; position: relative; overflow: hidden; }
.th i::before { content: ""; position: absolute; left: 22%; top: 18%; right: 0; bottom: 0; border-radius: 6px 0 0 0; background: var(--p); }
.th.on { border-color: var(--acc); color: var(--ink); }
.dots { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dot { width: 28px; height: 28px; border-radius: 50%; background: var(--c); display: grid; place-items: center; color: #fff; position: relative; overflow: hidden; }
.dot svg { width: 15px; height: 15px; stroke-width: 2.6; }
.dot input { position: absolute; inset: -6px; width: 40px; height: 40px; opacity: 0; cursor: pointer; }
.dot.any { background: conic-gradient(#e03131, #e8890c, #2f9e44, #0f9d8a, #4f6bed, #7c4dff, #d6336c, #e03131); }
.seg { display: inline-flex; background: var(--raise); border-radius: 10px; padding: 3px; }
.seg button { height: 30px; padding: 0 12px; border-radius: 8px; color: var(--ink2); font-weight: 550; font-size: 12.5px; }
.seg button.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.ubar { height: 6px; border-radius: 6px; background: var(--raise2); overflow: hidden; margin: 6px 0; }
.ubar b { display: block; height: 100%; background: var(--acc); border-radius: 6px; }
.urow { display: flex; align-items: center; gap: 12px; padding: 9px 0; }
.urow + .urow { border-top: 1px solid var(--line); }
.urow small { color: var(--ink3); display: block; }
.urow select { height: 32px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); padding: 0 8px; }
.urow.off { opacity: .5; }
.uctl { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tag { font-size: 12.5px; color: var(--ink3); padding: 0 10px; font-weight: 550; }
.temp { font: 600 22px ui-monospace, "Cascadia Code", monospace; letter-spacing: .08em; text-align: center; padding: 20px 10px; border-radius: 12px; background: var(--raise); user-select: all; -webkit-user-select: all; word-break: break-all; }
code.code { font: 12.5px ui-monospace, monospace; letter-spacing: .04em; }

/* ---------- auth + public share ---------- */
.auth { height: 100dvh; display: grid; place-items: center; padding: 20px; overflow: auto; grid-column: 1 / -1; }
.auth .box { width: min(360px, 100%); }
.auth .logo { width: 52px; height: 52px; border-radius: 16px; margin: 0 auto 26px; }
.auth .logo svg { width: 30px; height: 30px; }
.auth .inp { height: 46px; margin-bottom: 10px; }
.auth .btn { height: 46px; margin-top: 4px; }
.btn:active { transform: scale(.97); }
.auth { position: relative; isolation: isolate; --e: 0; }
.aura { position: absolute; inset: 0; overflow: hidden; z-index: -1; pointer-events: none; }
.aura i { position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%; filter: blur(90px); background: var(--acc); opacity: calc(.09 + var(--e) * .26); animation: drift 18s ease-in-out infinite alternate; }
.aura i:first-child { left: -14vmax; top: -18vmax; }
.aura i:last-child { right: -16vmax; bottom: -20vmax; animation-duration: 24s; animation-direction: alternate-reverse; background: color-mix(in srgb, var(--acc) 55%, #8b5cf6); }
@keyframes drift { to { transform: translate(9vmax, 7vmax) scale(1.18); } }
.auth .box { animation: authIn .45s var(--ease); }
@keyframes authIn { from { opacity: 0; transform: translateY(14px); } }
.auth .box.shake { animation: shake .42s; }
@keyframes shake { 20% { transform: translateX(-9px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(2px); } }
.auth .box.leave { transition: opacity .32s, transform .32s var(--ease); opacity: 0; transform: scale(1.05); }
.auth .logo { position: relative; transform: scale(calc(1 + var(--e) * .12)); box-shadow: 0 10px 30px color-mix(in srgb, var(--acc) 38%, transparent); animation: float 5s ease-in-out infinite; }
.auth .logo::after { content: ""; position: absolute; inset: -9px; border-radius: 23px; border: 2px solid var(--acc); opacity: calc(var(--e) * .9); transform: scale(calc(1 + var(--e) * .16)); }
@keyframes float { 50% { translate: 0 -5px; } }
.auth .inp { background: color-mix(in srgb, var(--panel) 82%, transparent); backdrop-filter: blur(8px); }
.pw { position: relative; }
.pw i { position: absolute; left: 14px; bottom: 10px; height: 2px; width: 0; max-width: calc(100% - 28px); border-radius: 2px; background: var(--acc); box-shadow: 0 0 10px var(--acc); transition: width .2s var(--ease); pointer-events: none; }
.auth .btn.pri { box-shadow: 0 8px 22px color-mix(in srgb, var(--acc) 38%, transparent); transition: transform .09s, filter .1s, box-shadow .15s, background-color .25s; }
.auth .btn.pri:active { transform: scale(.965) translateY(2px); filter: brightness(.9); box-shadow: 0 2px 6px color-mix(in srgb, var(--acc) 40%, transparent), inset 0 2px 6px rgba(0, 0, 0, .25); }
.auth .btn.busy { pointer-events: none; background-image: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .28) 50%, transparent 70%); background-size: 220% 100%; animation: sheen 1s linear infinite; }
@keyframes sheen { from { background-position: 120% 0; } to { background-position: -100% 0; } }
.auth .btn.busy .spin { width: 18px; height: 18px; border-color: color-mix(in srgb, var(--acc-ink) 30%, transparent); border-top-color: var(--acc-ink); }
.auth .btn.done { background-color: #2f9e44; background-image: none; animation: none; box-shadow: 0 8px 22px rgba(47, 158, 68, .4); }
.auth .btn.done svg.i { width: 22px; height: 22px; stroke-width: 2.6; animation: pop .25s var(--ease); }
.auth .alt { display: block; margin: 16px auto 0; color: var(--ink3); font-size: 13px; }
.auth .alt:hover { color: var(--ink); }
.pub { grid-column: 1 / -1; height: 100dvh; display: flex; flex-direction: column; }
.pub main { margin: 8px; flex: 1; }
.pubcard { margin: auto; width: min(400px, 100%); text-align: center; padding: 20px; }
.pubcard .ph { width: 100%; aspect-ratio: 4 / 3; border-radius: 18px; background: var(--raise); display: grid; place-items: center; overflow: hidden; margin-bottom: 18px; cursor: pointer; }
.pubcard .ph img { width: 100%; height: 100%; object-fit: cover; }
.pubcard .ph > svg.i { width: 64px; height: 64px; stroke-width: 1; }
.pubcard b { display: block; font-size: 16px; font-weight: 650; word-break: break-word; }
.pubcard small { color: var(--ink3); }
.pubcard .btn { margin-top: 18px; }
.pubcard .who { display: inline-flex; align-items: center; gap: 8px; color: var(--ink2); margin-bottom: 18px; font-weight: 550; }
.pubcard .who .av { width: 26px; height: 26px; font-size: 11px; }
.dz { border: 2px dashed var(--line); border-radius: 18px; padding: 38px 16px; color: var(--ink3); cursor: pointer; transition: border-color .12s, background .12s; }
.dz:hover, .dz.over { border-color: var(--acc); background: var(--acc-soft); color: var(--acc); }
.dz svg.i { width: 40px; height: 40px; stroke-width: 1.3; margin: 0 auto; }

.menu.zoom { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-width: 250px; color: var(--ink3); }
.menu.zoom svg.i:first-child { width: 13px; height: 13px; }
.menu.zoom svg.i:last-child { width: 21px; height: 21px; }
.rng { flex: 1; min-width: 0; height: 22px; margin: 0; appearance: none; -webkit-appearance: none; background: none; cursor: pointer; outline: 0; --p: 50%; }
.rng::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: linear-gradient(to right, var(--acc) var(--p), var(--raise2) var(--p)); }
.rng::-moz-range-track { height: 6px; border-radius: 6px; background: linear-gradient(to right, var(--acc) var(--p), var(--raise2) var(--p)); }
.rng::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -7px; border-radius: 50%; background: var(--panel); border: 2px solid var(--acc); box-shadow: 0 2px 6px rgba(0, 0, 0, .25); transition: transform .12s var(--ease), box-shadow .12s; }
.rng::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--panel); border: 2px solid var(--acc); box-shadow: 0 2px 6px rgba(0, 0, 0, .25); }
.rng:hover::-webkit-slider-thumb { transform: scale(1.12); }
.rng:active::-webkit-slider-thumb, .rng:focus-visible::-webkit-slider-thumb { transform: scale(1.12); box-shadow: 0 0 0 6px color-mix(in srgb, var(--acc) 22%, transparent); }
.dd { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; text-align: left; font-size: 13px; color: var(--ink); }
.dd svg.i { width: 14px; height: 14px; color: var(--ink3); }
.dd.chip { flex: none; font-size: 12.5px; color: var(--ink2); padding-right: 9px; }
.dd.chip.on { color: var(--acc); }
.dd.box { flex: none; height: 32px; padding: 0 8px 0 11px; border: 1px solid var(--line); border-radius: 9px; }
.dd.box:hover { background: var(--raise); }
select option { background: var(--panel); color: var(--ink); }
.stage .card img.pv { display: block; max-width: min(460px, 82vw); max-height: 52vh; border-radius: 12px; margin: 0 auto 18px; background: #fff; }
.xls, .paper { max-width: min(1100px, 100%); max-height: 100%; overflow: auto; background: #fff; color: #23262b; border-radius: 10px; }
.xls table { border-collapse: collapse; font-size: 12.5px; }
.xls td { border: 1px solid #e3e5e8; padding: 4px 9px; white-space: nowrap; max-width: 340px; overflow: hidden; text-overflow: ellipsis; height: 26px; }
.xls tr:first-child td { position: sticky; top: 0; background: #f4f5f7; font-weight: 600; }
.paper { width: min(820px, 100%); padding: 34px 42px; line-height: 1.65; font-size: 14.5px; }
.paper p { margin: 0 0 .8em; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0 6px; }
.chip { height: 32px; padding: 0 12px 0 10px; border-radius: 16px; background: var(--raise); color: var(--ink2); display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 550; border: 0; white-space: nowrap; }
.chip:hover { background: var(--raise2); }
.chip svg.i { width: 15px; height: 15px; }
.chip.on { background: var(--acc-soft); color: var(--acc); }
.qr { width: 184px; margin: 8px auto 12px; background: #fff; padding: 8px; border-radius: 12px; }
.qr svg { display: block; width: 100%; height: auto; }
pre.codes { margin: 10px 0 0; padding: 14px; border-radius: 12px; background: var(--raise); font: 14px/1.9 ui-monospace, monospace; letter-spacing: .06em; columns: 2; text-align: center; }
.sline.person { font-weight: 500; padding-top: 8px; }
.sline.person .av { width: 26px; height: 26px; font-size: 11px; }
.tabs, .fab, .only-m { display: none; }

/* ---------- phone ---------- */
@media (max-width: 760px) {
  :root { --tile: 104px; --row: 54px; }
  [data-density=compact] { --tile: 84px; --row: 46px; }
  [data-density=roomy] { --tile: 150px; --row: 60px; }
  #app { grid-template-columns: minmax(0, 1fr); }
  .rail, .only-d { display: none; }
  .only-m { display: grid; }
  main, .pub main { margin: 0; border: 0; border-radius: 0; background: var(--bg); }
  .top { height: 56px; padding: 0 6px 0 16px; }
  .crumbs { font-size: 18px; }
  .crumbs .crumb:not(:last-child), .crumbs > svg { display: none; }
  .crumbs .crumb { max-width: none; }
  .search { position: absolute; left: 8px; right: 8px; top: 9px; width: auto !important; z-index: 5; display: none; background: var(--panel); box-shadow: 0 0 0 2px var(--acc-line); }
  .search.open { display: flex; }
  .search kbd { display: none; }
  #view { padding: 0 12px calc(150px + env(safe-area-inset-bottom)); }
  .fgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .fold { background: var(--panel); }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -12px; padding: 4px 12px 8px; scrollbar-width: none; }
  .chip { background: var(--panel); flex: none; }
  .grid { gap: 12px 8px; }
  .tile .ph { background: var(--panel); }
  .chk { display: none; }
  .selecting .chk, .it.sel .chk { display: grid; opacity: 1; }
  .row, .rhead { grid-template-columns: 38px minmax(0, 1fr) 30px; padding: 0 4px; }
  .row .c, .rhead .c { display: none; }
  .row .ico { width: 38px; height: 38px; border-radius: 10px; background: var(--panel); }
  .rhead { background: var(--bg); }
  .tabs { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: calc(60px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--panel); border-top: 1px solid var(--line); z-index: 20; }
  .tabs .nav { flex: 1; width: auto; border-radius: 0; justify-content: center; }
  .tabs .av { width: 26px; height: 26px; font-size: 11px; }
  .fab { display: grid; place-items: center; position: fixed; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 18px; background: var(--acc); color: var(--acc-ink); box-shadow: 0 6px 20px color-mix(in srgb, var(--acc) 45%, transparent); z-index: 21; }
  .fab svg { width: 24px; height: 24px; }
  .selbar { bottom: calc(10px + env(safe-area-inset-bottom)); }
  .selecting .tabs, .selecting .fab { display: none; }
  .tray { right: 12px; bottom: calc(72px + env(safe-area-inset-bottom)); }
  .toasts { bottom: calc(140px + env(safe-area-inset-bottom)); }
  .back.sheet { background: rgba(0, 0, 0, .42); animation: fade .15s; }
  .menu { left: 0 !important; right: 0; top: auto !important; bottom: 0; max-width: none; border-radius: 22px 22px 0 0; border-width: 1px 0 0; padding: 10px 10px calc(12px + env(safe-area-inset-bottom)); animation: sheet .2s var(--ease); }
  .menu::before { content: ""; display: block; width: 36px; height: 4px; border-radius: 4px; background: var(--raise2); margin: 0 auto 8px; }
  .mi { height: 48px; font-size: 15px; gap: 14px; }
  .mi kbd { display: none; }
  .back.dim { padding: 0; place-items: end center; }
  .dlg { width: 100%; border-radius: 22px 22px 0 0; border-width: 1px 0 0; padding: 20px 16px calc(18px + env(safe-area-inset-bottom)); animation: sheet .2s var(--ease); }
  @keyframes sheet { from { transform: translateY(40px); opacity: 0; } }
  .dlg .acts .btn { flex: 1; height: 46px; }
  .vnav { display: none; }
  .urow { flex-wrap: wrap; }
  .uctl { width: 100%; justify-content: flex-start; padding-left: 46px; }
  .paper { padding: 20px 18px; border-radius: 0; }
  .xls { border-radius: 0; }
  .menu.zoom { padding: 22px 18px calc(26px + env(safe-area-inset-bottom)); }
  .stage { padding: 0 0 8px; }
  .stage img, .stage video { border-radius: 0; }
  .card { background: var(--panel); }
  .opt { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
