/* Hearthstone Cloud — Drive-style interface */
:root {
  --bg: #f8fafd;
  --surface: #ffffff;
  --surface-2: #f0f4f9;
  --surface-3: #e9eef6;
  --hover: rgba(68, 71, 70, .08);
  --press: rgba(68, 71, 70, .12);
  --text: #1f1f1f;
  --text-2: #444746;
  --text-3: #5f6368;
  --line: #e1e3e1;
  --primary: #0b57d0;
  --primary-ink: #ffffff;
  --selected: #c2e7ff;
  --selected-ink: #001d35;
  --chip: #e8f0fe;
  --danger: #b3261e;
  --ok: #146c2e;
  --flame: #e8590c;
  --shadow-1: 0 1px 2px rgba(0,0,0,.3), 0 1px 3px 1px rgba(0,0,0,.15);
  --shadow-2: 0 2px 6px 2px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.3);
  --radius: 16px;
  --font: "Google Sans", "Segoe UI Variable Text", "Segoe UI", Roboto, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --k-folder: #5f6368; --k-image: #d93025; --k-video: #d93025; --k-audio: #8430ce; --k-pdf: #ea4335;
  --k-doc: #1a73e8; --k-sheet: #188038; --k-slides: #f9ab00; --k-archive: #5f6368; --k-code: #00796b; --k-text: #4285f4; --k-file: #5f6368;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1b1b; --surface: #131314; --surface-2: #1e1f20; --surface-3: #282a2c;
    --hover: rgba(227, 227, 227, .08); --press: rgba(227, 227, 227, .12);
    --text: #e3e3e3; --text-2: #c4c7c5; --text-3: #9aa0a6; --line: #3c4043;
    --primary: #a8c7fa; --primary-ink: #062e6f; --selected: #004a77; --selected-ink: #c2e7ff; --chip: #2d3a4f;
    --danger: #f2b8b5; --ok: #6dd58c;
    --k-folder: #c4c7c5; --k-image: #f28b82; --k-video: #f28b82; --k-audio: #d7aefb; --k-pdf: #f28b82;
    --k-doc: #8ab4f8; --k-sheet: #81c995; --k-slides: #fdd663; --k-archive: #c4c7c5; --k-code: #78d9c9; --k-text: #8ab4f8; --k-file: #c4c7c5;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
svg.i { width: 24px; height: 24px; fill: currentColor; flex: none; }
.muted { color: var(--text-3); }
.logo { width: 40px; height: 40px; flex: none; }
[hidden] { display: none !important; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 24px; border-radius: 20px; border: 1px solid var(--line);
  background: transparent; color: var(--primary); font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, box-shadow .15s; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
.btn.primary:hover { box-shadow: var(--shadow-1); filter: brightness(1.05); }
.btn.tonal { background: var(--selected); color: var(--selected-ink); border-color: transparent; }
.btn.danger { color: var(--danger); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; display: inline-grid; place-items: center; cursor: pointer; color: var(--text-2); flex: none; }
.icon-btn:hover { background: var(--hover); }
.icon-btn.on { background: var(--selected); color: var(--selected-ink); }
.link { color: var(--primary); text-decoration: none; font-weight: 500; }

/* ---------- auth pages ---------- */
.auth-wrap { min-height: 100%; display: grid; place-items: center; align-content: center; gap: 16px; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border-radius: 28px; padding: 40px 36px 32px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.auth-card .logo { width: 48px; height: 48px; }
.auth-card h1 { font-size: 30px; font-weight: 400; margin: 16px 0 8px; }
.auth-card .sub { margin: 0 0 24px; color: var(--text-2); font-size: 16px; }
.auth-foot { color: var(--text-3); font-size: 12px; margin: 0; }
.stack { display: grid; gap: 16px; }
.stack label, .field { display: grid; gap: 6px; font-size: 13px; color: var(--text-2); font-weight: 500; }
.stack input:not([type=checkbox]), .field input, .field select, .dialog input:not([type=checkbox]), .dialog select {
  height: 48px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--text-3); background: transparent; font-size: 16px; color: var(--text); outline: none; width: 100%; }
.stack input:focus, .field input:focus, .dialog input:focus, .dialog select:focus { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
label.check { display: flex !important; align-items: center; gap: 10px; font-weight: 400 !important; color: var(--text-2); font-size: 14px !important; }
label.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.code-input { letter-spacing: .3em; font-size: 22px !important; text-align: center; }
.hint { margin: -8px 0 0; font-size: 12px; color: var(--text-3); line-height: 1.5; }
.err { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.checks { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 4px; font-size: 13px; }
.checks .ok { color: var(--ok); } .checks .bad { color: var(--danger); }

/* ---------- app layout ---------- */
body.app { overflow: hidden; }
.shell { display: grid; grid-template-columns: 256px minmax(0, 1fr); grid-template-rows: 64px 1fr; height: 100vh; height: 100dvh; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; padding: 8px 16px 8px 12px; }
.brand { display: flex; align-items: center; gap: 10px; width: 236px; flex: none; text-decoration: none; color: var(--text-2); font-size: 22px; padding-left: 4px; }
.brand span { white-space: nowrap; }
.search { flex: 1; min-width: 0; max-width: 720px; height: 48px; border-radius: 24px; background: var(--surface-3); display: flex; align-items: center; padding: 0 6px 0 4px; transition: background .15s, box-shadow .15s; }
.search:focus-within { background: var(--surface); box-shadow: var(--shadow-1); }
.search input { flex: 1; border: 0; background: transparent; outline: none; font-size: 16px; height: 100%; min-width: 0; }
.search select { border: 0; background: transparent; color: var(--text-2); outline: none; cursor: pointer; padding: 0 6px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--flame); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 14px; border: 0; cursor: pointer; }
.menu-toggle { display: none; }

.sidebar { overflow-y: auto; padding: 8px 12px 16px 0; display: flex; flex-direction: column; }
.new-btn { margin: 4px 0 16px 8px; height: 56px; width: max-content; padding: 0 20px 0 16px; border-radius: 16px; border: 0; background: var(--surface); box-shadow: var(--shadow-1);
  display: flex; align-items: center; gap: 12px; font-weight: 500; cursor: pointer; color: var(--text); font-size: 14px; transition: box-shadow .15s, background .15s; }
.new-btn:hover { box-shadow: var(--shadow-2); background: color-mix(in srgb, var(--primary) 6%, var(--surface)); }
.nav a { display: flex; align-items: center; gap: 14px; height: 32px; padding: 0 12px 0 16px; border-radius: 0 16px 16px 0; color: var(--text); text-decoration: none; margin-bottom: 1px; font-size: 14px; }
.nav a svg.i { width: 20px; height: 20px; color: var(--text-2); }
.nav a:hover { background: var(--hover); }
.nav a.active { background: var(--selected); color: var(--selected-ink); font-weight: 600; }
.nav a.active svg.i { color: var(--selected-ink); }
.nav a .badge { margin-left: auto; background: var(--flame); color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; font-weight: 600; }
.nav hr { border: 0; height: 12px; margin: 0; }
.storage { padding: 12px 16px 0 16px; font-size: 12px; color: var(--text-2); }
.storage .bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; margin: 8px 0 6px; }
.storage .bar i { display: block; height: 100%; background: var(--primary); border-radius: 2px; }
.storage .bar i.warn { background: var(--danger); }

.main { background: var(--surface); border-radius: var(--radius); margin: 0 16px 16px 0; display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; overflow: hidden; }
.main-head { padding: 12px 20px 4px 24px; display: flex; align-items: center; gap: 8px; min-height: 64px; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 0; font-size: 24px; color: var(--text); min-width: 0; flex: 1; }
.crumbs a, .crumbs span.cur { padding: 4px 12px; border-radius: 20px; text-decoration: none; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; }
.crumbs a:hover { background: var(--hover); }
.crumbs a.drop { background: var(--selected); }
.crumbs span.cur { color: var(--text); }
.crumbs svg.i { color: var(--text-3); width: 20px; height: 20px; }
.crumbs a:first-child { margin-left: -12px; }
.view-toggle { display: flex; border: 1px solid var(--text-3); border-radius: 20px; overflow: hidden; height: 32px; }
.view-toggle button { border: 0; background: transparent; width: 48px; display: grid; place-items: center; cursor: pointer; color: var(--text-2); }
.view-toggle button svg.i { width: 18px; height: 18px; }
.view-toggle button.on { background: var(--selected); color: var(--selected-ink); }

.selbar { margin: 4px 16px 0; height: 48px; flex: none; overflow-x: auto; scrollbar-width: none; border-radius: 24px; background: var(--surface-2); display: flex; align-items: center; gap: 2px; padding: 0 8px; }
.selbar .count { font-weight: 500; margin: 0 12px 0 4px; white-space: nowrap; }
.selbar .icon-btn { width: 36px; height: 36px; }
.selbar .icon-btn svg.i { width: 20px; height: 20px; }
.filters { margin: 4px 24px 0; display: flex; gap: 8px; flex-wrap: nowrap; overflow-x: auto; align-items: center; height: 48px; scrollbar-width: none; }
.chip { flex: none; }
.chip { height: 32px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--text-3); background: transparent; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--text-2); font-weight: 500; }
.chip.on { background: var(--selected); color: var(--selected-ink); border-color: transparent; }

.content { flex: 1; overflow-y: auto; padding: 8px 24px 120px; position: relative; outline: none; }
.content.dragover::after { content: ""; position: absolute; inset: 4px; border: 2px solid var(--primary); border-radius: 12px; background: color-mix(in srgb, var(--primary) 6%, transparent); pointer-events: none; }
.section-label { font-size: 14px; font-weight: 500; color: var(--text); margin: 16px 0 12px; display: flex; align-items: center; justify-content: space-between; }
.banner { background: var(--surface-2); border-radius: 12px; padding: 12px 16px; margin: 8px 0 4px; display: flex; gap: 12px; align-items: center; color: var(--text-2); flex-wrap: wrap; }
.banner b { color: var(--text); }
.banner .btn { height: 32px; padding: 0 14px; margin-left: auto; }

/* grid */
.grid-folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.grid-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.folder-tile { height: 48px; border-radius: 12px; background: var(--surface-2); display: flex; align-items: center; gap: 14px; padding: 0 4px 0 16px; cursor: default; user-select: none; position: relative; }
.folder-tile:hover { background: color-mix(in srgb, var(--text) 8%, var(--surface-2)); }
.folder-tile .nm { flex: 1; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card { border-radius: 12px; background: var(--surface-2); padding: 0 8px 8px; cursor: default; user-select: none; display: flex; flex-direction: column; position: relative; }
.card:hover { background: color-mix(in srgb, var(--text) 8%, var(--surface-2)); }
.card .head { display: flex; align-items: center; gap: 12px; height: 48px; padding: 0 0 0 8px; }
.card .head .nm { flex: 1; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .thumb { aspect-ratio: 16 / 10.5; border-radius: 6px; background: var(--surface); display: grid; place-items: center; overflow: hidden; position: relative; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .thumb .ficon.big { width: 64px; height: 64px; }
.card .meta { font-size: 12px; color: var(--text-3); padding: 10px 4px 0; display: flex; justify-content: space-between; gap: 8px; }
.sel, .card.sel, .folder-tile.sel { background: var(--selected) !important; color: var(--selected-ink); }
.drop-target { outline: 2px solid var(--primary); outline-offset: -2px; background: var(--selected) !important; }
.dur { position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.75); color: #fff; font-size: 12px; padding: 2px 6px; border-radius: 4px; font-weight: 500; }
.play-badge { position: absolute; inset: 0; display: grid; place-items: center; }
.play-badge span { width: 48px; height: 48px; border-radius: 50%; background: rgba(0,0,0,.55); display: grid; place-items: center; color: #fff; }
.prog { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255,255,255,.35); }
.prog i { display: block; height: 100%; background: #e8590c; }
.star-mark { color: var(--text-3); width: 16px !important; height: 16px !important; }
.more { width: 32px; height: 32px; opacity: .9; }
.more svg.i { width: 20px; height: 20px; }

/* file icons */
.ficon { width: 24px; height: 24px; display: inline-block; flex: none; background: currentColor; -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; }
.k-folder { color: var(--k-folder); } .k-image { color: var(--k-image); } .k-video { color: var(--k-video); } .k-audio { color: var(--k-audio); } .k-pdf { color: var(--k-pdf); }
.k-doc { color: var(--k-doc); } .k-sheet { color: var(--k-sheet); } .k-slides { color: var(--k-slides); } .k-archive { color: var(--k-archive); } .k-code { color: var(--k-code); }
.k-text { color: var(--k-text); } .k-file { color: var(--k-file); }

/* list */
.list { width: 100%; border-collapse: collapse; table-layout: fixed; }
.list th { text-align: left; font-weight: 500; color: var(--text-2); font-size: 14px; height: 48px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; cursor: pointer; user-select: none; white-space: nowrap; }
.list th.sorted { color: var(--text); }
.list th svg.i { width: 18px; height: 18px; vertical-align: middle; }
.list td { height: 48px; border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); padding-right: 12px; }
.list tr.r { cursor: default; user-select: none; }
.list tr.r:hover td { background: var(--hover); }
.list tr.r.sel td { background: var(--selected); color: var(--selected-ink); }
.list .nmcell { display: flex; align-items: center; gap: 16px; color: var(--text); font-weight: 500; overflow: hidden; }
.list .nmcell span.t { overflow: hidden; text-overflow: ellipsis; }
.list .c-name { width: auto; } .list .c-mod { width: 170px; } .list .c-size { width: 110px; } .list .c-loc { width: 180px; } .list .c-act { width: 52px; }

/* empty */
.empty { text-align: center; padding: 72px 16px; color: var(--text-2); }
.empty .art { width: 180px; height: 140px; margin: 0 auto 20px; }
.empty h2 { font-weight: 400; font-size: 22px; margin: 0 0 8px; color: var(--text); }

/* menus */
.menu { position: fixed; z-index: 50; min-width: 220px; max-width: 320px; background: var(--surface-2); border-radius: 8px; box-shadow: var(--shadow-2); padding: 8px 0; animation: pop .1s ease-out; max-height: 80vh; overflow-y: auto; }
@media (prefers-color-scheme: dark) { .menu { background: var(--surface-3); } }
.menu button { display: flex; width: 100%; align-items: center; gap: 14px; height: 36px; padding: 0 16px; border: 0; background: transparent; cursor: pointer; text-align: left; color: var(--text); font-size: 14px; }
.menu button:hover { background: var(--hover); }
.menu button svg.i { width: 20px; height: 20px; color: var(--text-2); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 8px 0; }
.menu .danger, .menu .danger svg.i { color: var(--danger); }
@keyframes pop { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }

/* dialogs */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 60; display: grid; place-items: center; padding: 16px; animation: fade .12s; }
@keyframes fade { from { opacity: 0; } }
.dialog { background: var(--surface); border-radius: 28px; padding: 24px; width: 100%; max-width: 480px; box-shadow: var(--shadow-2); max-height: 90vh; overflow-y: auto; }
.dialog.wide { max-width: 640px; }
.dialog h2 { font-size: 24px; font-weight: 400; margin: 0 0 16px; }
.dialog p { color: var(--text-2); line-height: 1.5; }
.dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; flex-wrap: wrap; }
.dialog .actions .btn { border: 0; }
.dialog .fields { display: grid; gap: 14px; }
.picker { border: 1px solid var(--line); border-radius: 12px; height: 300px; overflow-y: auto; margin-top: 8px; }
.picker .prow { display: flex; align-items: center; gap: 12px; padding: 0 14px; height: 44px; cursor: pointer; }
.picker .prow:hover { background: var(--hover); }
.picker .prow.dis { opacity: .4; pointer-events: none; }
.picker-crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 15px; }
.picker-crumbs a { cursor: pointer; text-decoration: none; color: var(--text-2); padding: 2px 6px; border-radius: 6px; }
.picker-crumbs a:hover { background: var(--hover); }
.linkbox { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border-radius: 12px; padding: 8px 8px 8px 14px; }
.linkbox code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.share-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 8px; margin-bottom: 8px; }
.share-item .tags { display: flex; gap: 6px; flex-wrap: wrap; font-size: 12px; }
.tag { background: var(--surface-2); padding: 2px 8px; border-radius: 6px; color: var(--text-2); }
.tag.warn { color: var(--danger); }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 10px 16px; font-size: 14px; }
.kv dt { color: var(--text-3); } .kv dd { margin: 0; word-break: break-word; }

/* toast */
.toasts { position: fixed; left: 24px; bottom: 24px; z-index: 80; display: grid; gap: 8px; }
.toast { background: #303030; color: #f2f2f2; padding: 14px 16px; border-radius: 6px; box-shadow: var(--shadow-2); display: flex; align-items: center; gap: 16px; min-width: 280px; max-width: 480px; animation: up .2s ease-out; }
@media (prefers-color-scheme: dark) { .toast { background: #e3e3e3; color: #1f1f1f; } }
.toast button { margin-left: auto; background: transparent; border: 0; color: #a8c7fa; font-weight: 500; cursor: pointer; padding: 4px 8px; }
@media (prefers-color-scheme: dark) { .toast button { color: #0b57d0; } }
@keyframes up { from { transform: translateY(16px); opacity: 0; } }

/* uploads panel */
.uploads { position: fixed; right: 24px; bottom: 0; width: 360px; max-width: calc(100vw - 32px); background: var(--surface); border-radius: 16px 16px 0 0; box-shadow: var(--shadow-2); z-index: 70; overflow: hidden; }
.uploads .uh { background: var(--surface-2); height: 54px; display: flex; align-items: center; padding: 0 8px 0 20px; gap: 4px; font-weight: 500; font-size: 15px; }
.uploads .uh span { flex: 1; }
.uploads .ul { max-height: 300px; overflow-y: auto; }
.uploads.min .ul { display: none; }
.up-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px 10px 20px; border-bottom: 1px solid var(--line); }
.up-row .nm { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-row .sub { font-size: 12px; color: var(--text-3); }
.ring { width: 24px; height: 24px; flex: none; }
.ring circle { fill: none; stroke-width: 3; }
.ring .bg { stroke: var(--line); } .ring .fg { stroke: var(--primary); stroke-linecap: round; transform: rotate(-90deg); transform-origin: center; transition: stroke-dashoffset .2s; }
.up-ok { color: var(--ok); } .up-err { color: var(--danger); }

/* viewer */
.viewer { position: fixed; inset: 0; z-index: 65; background: rgba(12,12,12,.97); display: flex; flex-direction: column; color: #e3e3e3; animation: fade .12s; }
.viewer .vbar { height: 64px; display: flex; align-items: center; gap: 8px; padding: 0 12px; flex: none; background: linear-gradient(rgba(0,0,0,.6), transparent); }
.viewer .vbar .title { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; font-size: 16px; }
.viewer .vbar .title b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer .icon-btn { color: #e3e3e3; }
.viewer .icon-btn:hover { background: rgba(255,255,255,.12); }
.viewer .stage { flex: 1; min-height: 0; display: grid; place-items: center; position: relative; padding: 0 72px 24px; }
.viewer .stage > img, .viewer .stage > video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; background: #000; }
.viewer .stage > video { width: 100%; height: 100%; }
.viewer .stage > iframe { width: min(1000px, 100%); height: 100%; border: 0; background: #fff; border-radius: 4px; }
.viewer .stage > pre { width: min(1000px, 100%); height: 100%; overflow: auto; margin: 0; background: #1e1f20; color: #e3e3e3; padding: 20px; border-radius: 8px; font: 13px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.viewer .stage .audio-card { display: grid; gap: 24px; place-items: center; }
.viewer .stage .audio-card .ficon { width: 120px; height: 120px; }
.viewer .stage .audio-card audio { width: min(520px, 80vw); }
.viewer .nope { text-align: center; display: grid; gap: 16px; place-items: center; }
.viewer .nope .ficon { width: 96px; height: 96px; }
.viewer .nav-l, .viewer .nav-r { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; background: rgba(0,0,0,.5); }
.viewer .nav-l { left: 12px; } .viewer .nav-r { right: 12px; }
.viewer .resume { position: absolute; left: 50%; bottom: 48px; transform: translateX(-50%); background: #303030; padding: 10px 12px 10px 18px; border-radius: 24px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow-2); z-index: 2; }
.viewer .resume .btn { height: 32px; padding: 0 14px; }

/* videos library */
.shelf { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 280px); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.vcard { cursor: pointer; border-radius: 12px; }
.vcard .thumb { aspect-ratio: 16/9; border-radius: 12px; background: #202124; position: relative; overflow: hidden; display: grid; place-items: center; }
.vcard .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.vcard:hover .thumb img { transform: scale(1.03); }
.vcard .thumb .ficon { width: 48px; height: 48px; color: #9aa0a6; }
.vcard .t { font-weight: 500; margin: 10px 2px 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vcard .s { color: var(--text-3); font-size: 12px; margin: 0 2px; }
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px 14px; }

/* settings */
.settings { max-width: 760px; }
.panel { border: 1px solid var(--line); border-radius: 16px; padding: 20px 24px; margin-bottom: 16px; }
.panel h3 { margin: 0 0 4px; font-size: 18px; font-weight: 500; display: flex; align-items: center; gap: 10px; }
.panel h3 svg.i { color: var(--text-2); }
.panel > p { color: var(--text-2); margin: 4px 0 16px; line-height: 1.5; }
.panel .status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; padding: 2px 10px; border-radius: 12px; }
.panel .status.on { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.panel .status.off { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.panel .btnrow { display: flex; gap: 8px; flex-wrap: wrap; }
.panel ol { padding-left: 20px; line-height: 1.7; color: var(--text-2); }
.panel code, .dialog code { background: var(--surface-2); padding: 2px 6px; border-radius: 6px; font-size: 13px; user-select: all; }
.ap-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.ap-row div { flex: 1; } .ap-row small { color: var(--text-3); display: block; }
.audit { width: 100%; border-collapse: collapse; font-size: 13px; }
.audit td { padding: 7px 8px 7px 0; border-top: 1px solid var(--line); color: var(--text-2); vertical-align: top; }
.audit td:first-child { white-space: nowrap; color: var(--text-3); }
.audit .bad { color: var(--danger); }
.qr { background: #fff; padding: 12px; border-radius: 12px; width: max-content; margin: 8px auto; }
.qr img { display: block; width: 180px; height: 180px; image-rendering: pixelated; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; font: 15px ui-monospace, Consolas, monospace; background: var(--surface-2); padding: 16px; border-radius: 12px; user-select: all; }
.secret-box { font: 18px ui-monospace, Consolas, monospace; letter-spacing: .05em; text-align: center; background: var(--surface-2); padding: 12px; border-radius: 12px; user-select: all; word-break: break-all; }

/* share page */
body.share { background: var(--bg); }
.share-top { display: flex; align-items: center; gap: 14px; padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
.share-title { flex: 1; min-width: 0; display: grid; }
.share-title b { font-weight: 500; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.share-title span { color: var(--text-3); font-size: 13px; }
.share-main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 48px; }
.share-preview { display: grid; place-items: center; }
.share-preview video, .share-preview img { max-width: 100%; max-height: 80vh; border-radius: 12px; background: #000; }
.share-preview video { width: 100%; }
.share-preview iframe { width: 100%; height: 82vh; border: 0; border-radius: 12px; background: #fff; }
.share-preview audio { width: min(560px, 100%); margin-top: 40px; }
.share-file { text-align: center; padding: 48px 16px; background: var(--surface); border-radius: 20px; width: 100%; max-width: 420px; display: grid; gap: 12px; place-items: center; }
.ficon.big { width: 80px; height: 80px; }
.share-list { background: var(--surface); border-radius: 16px; overflow: hidden; }
.share-row { display: flex; align-items: center; gap: 16px; padding: 0 20px; height: 52px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); }
.share-row:hover { background: var(--hover); }
.share-row .nm { flex: 1; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .topbar { padding: 8px 8px 8px 4px; gap: 4px; }
  .top-actions .icon-btn { display: none; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 280px; background: var(--bg); z-index: 55; transform: translateX(-100%); transition: transform .2s; padding-top: 16px; box-shadow: var(--shadow-2); }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 54; }
  .menu-toggle { display: inline-grid; }
  .brand { width: auto; }
  .brand span { display: none; }
  .main { margin: 0; border-radius: 16px 16px 0 0; }
  .search select { display: none; }
  .list .c-mod, .list .c-loc { display: none; }
  .viewer .stage { padding: 0 0 12px; }
  .viewer .nav-l, .viewer .nav-r { display: none; }
  .grid-folders, .grid-files { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .content { padding: 8px 12px 120px; }
  .main-head { padding: 8px 12px 4px 16px; }
  .crumbs { font-size: 20px; }
  .fab { position: fixed; right: 16px; bottom: 16px; width: 56px; height: 56px; border-radius: 16px; z-index: 40; border: 0; background: var(--selected); color: var(--selected-ink); box-shadow: var(--shadow-2); display: grid; place-items: center; }
  .uploads { right: 16px; }
  .toasts { left: 16px; right: 16px; bottom: 88px; }
  .toast { min-width: 0; }
  .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 10px; }
}
@media (min-width: 901px) { .fab { display: none; } }

/* file-type icons (masks, so they follow theme colours) */
.ficon.k-folder { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z'/%3E%3C/svg%3E"); }
.ficon.k-image { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z'/%3E%3C/svg%3E"); }
.ficon.k-video { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M18 4l2 4h-3l-2-4h-2l2 4h-3l-2-4H8l2 4H7L5 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4h-4z'/%3E%3C/svg%3E"); }
.ficon.k-audio { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z'/%3E%3C/svg%3E"); }
.ficon.k-pdf { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-8.5 7.5c0 .83-.67 1.5-1.5 1.5H9v2H7.5V7H10c.83 0 1.5.67 1.5 1.5v1zm5 2c0 .83-.67 1.5-1.5 1.5h-2.5V7H15c.83 0 1.5.67 1.5 1.5v3zm4-3H19v1h1.5V11H19v2h-1.5V7h3v1.5zM9 9.5h1v-1H9v1zM4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm10 5.5h1v-3h-1v3z'/%3E%3C/svg%3E"); }
.ficon.k-doc { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-5 14H7v-2h7v2zm3-4H7v-2h10v2zm0-4H7V7h10v2z'/%3E%3C/svg%3E"); }
.ficon.k-sheet { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 2v3H5V5h14zm-9 14H5v-9h5v9zm2 0v-9h7v9h-7z'/%3E%3C/svg%3E"); }
.ficon.k-slides { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 13H5V6h14v10z'/%3E%3C/svg%3E"); }
.ficon.k-archive { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm-2 6h-2v2h2v2h-2v2h-2v-2h2v-2h-2v-2h2v-2h-2V8h2v2h2v2z'/%3E%3C/svg%3E"); }
.ficon.k-code { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z'/%3E%3C/svg%3E"); }
.ficon.k-text { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z'/%3E%3C/svg%3E"); }
.ficon.k-file { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 2c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6H6zm7 7V3.5L18.5 9H13z'/%3E%3C/svg%3E"); }
