/* Облако — web interface */
@font-face {
  font-family: "Oblako Serif";
  src: url("/assets/fonts/oblako-serif.woff?v=1.0.0-7f337a9f") format("woff");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --ink: #1b2140;
  --ink-2: #5a6285;
  --ink-3: #8a91b0;
  --paper: #ffffff;
  --mist: #eef1f9;
  --mist-2: #e3e8f5;
  --line: #dce1ef;
  --brand: #3b4fe0;
  --brand-ink: #ffffff;
  --brand-soft: #e7eafe;
  --brand-line: #b9c3fb;
  --danger: #d23a4b;
  --danger-soft: #fdecee;
  --ok: #1f9d63;
  --sky: linear-gradient(135deg, #5b8cff 0%, #3a3fd9 100%);
  --folder-body: #c9d2ff;
  --folder-tab: #a7b5ff;
  --shadow: 0 12px 32px -8px rgba(27, 33, 64, .22), 0 2px 6px rgba(27, 33, 64, .08);
  --sel-danger: #ff8f9a;
  --sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "SF Pro Text", Roboto, "Noto Sans", Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  --serif: "Oblako Serif", Georgia, "Times New Roman", serif;
  --r-tile: 14px;
  --r-btn: 10px;
  --r-dialog: 18px;
  --side: 248px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --ink: #e7eaf6;
  --ink-2: #a2aacb;
  --ink-3: #6f7799;
  --paper: #141933;
  --mist: #0d1126;
  --mist-2: #1b2142;
  --line: #262d50;
  --brand: #8b9dff;
  --brand-ink: #0d1126;
  --brand-soft: #222b5c;
  --brand-line: #3d4a96;
  --danger: #ff6b78;
  --danger-soft: #3a1b26;
  --ok: #4cc98d;
  --folder-body: #34408a;
  --folder-tab: #4a58b0;
  --shadow: 0 16px 40px -8px rgba(0, 0, 0, .6), 0 2px 8px rgba(0, 0, 0, .4);
  --sel-danger: #c42537;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e7eaf6;
    --ink-2: #a2aacb;
    --ink-3: #6f7799;
    --paper: #141933;
    --mist: #0d1126;
    --mist-2: #1b2142;
    --line: #262d50;
    --brand: #8b9dff;
    --brand-ink: #0d1126;
    --brand-soft: #222b5c;
    --brand-line: #3d4a96;
    --danger: #ff6b78;
    --danger-soft: #3a1b26;
    --ok: #4cc98d;
    --folder-body: #34408a;
    --folder-tab: #4a58b0;
    --shadow: 0 16px 40px -8px rgba(0, 0, 0, .6), 0 2px 8px rgba(0, 0, 0, .4);
    --sel-danger: #c42537;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--mist);
  color: var(--ink);
  font: 400 14px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--brand-soft); }

.boot { display: grid; place-items: center; height: 100vh; }
.boot img { animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(.92); opacity: .7; } }

.ico { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ico.sm { width: 16px; height: 16px; }
.ico.lg { width: 28px; height: 28px; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--r-btn); background: var(--paper);
  cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--mist); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--mist-2); }
.btn.icon { width: 38px; padding: 0; justify-content: center; }
.btn.small { height: 32px; padding: 0 10px; font-size: 13px; }
.btn.block { width: 100%; justify-content: center; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; color: var(--ink-2); }
.field small { color: var(--ink-3); font-size: 12px; }
.input, select.input, textarea.input {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-btn);
  background: var(--paper); outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; margin: 6px 0 12px; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.err { color: var(--danger); font-size: 13px; min-height: 18px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; height: 100vh; height: 100dvh; }
.side {
  display: flex; flex-direction: column; gap: 4px; padding: 16px 12px; overflow-y: auto;
  background: var(--mist);
}
.brandline { display: flex; align-items: center; gap: 10px; padding: 4px 10px 16px; color: var(--ink); }
.brandline img { width: 30px; height: 30px; }
.brandline b { font: 600 18px/1.2 var(--serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .upload-btn { margin: 0 4px 12px; height: 44px; justify-content: center; font-size: 15px; }
.nav a {
  display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 10px;
  color: var(--ink); text-decoration: none;
}
.nav a:hover { background: var(--mist-2); }
.nav a.on { background: var(--paper); color: var(--brand); font-weight: 600; box-shadow: 0 1px 2px rgba(27,33,64,.06); }
.nav .sep { height: 1px; background: var(--line); margin: 10px 12px; }
.side-foot { margin-top: auto; padding: 14px 10px 4px; display: grid; gap: 10px; }
.meter { height: 6px; border-radius: 99px; background: var(--mist-2); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--sky); border-radius: 99px; min-width: 4px; transition: width .4s; }
.meter.warn > i { background: linear-gradient(90deg, #f5a524, #e8572b); }
.meter-text { font-size: 12.5px; color: var(--ink-2); }
.linkbtn { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; font-size: 13px; }
.linkbtn:hover { text-decoration: underline; }

.main { display: flex; flex-direction: column; min-width: 0; background: var(--paper); border-radius: 18px 0 0 0; margin-top: 8px; overflow: hidden; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 24px; min-height: 64px; }
.topbar .menu-btn { display: none; }
.search { position: relative; flex: 1 1 auto; min-width: 0; max-width: 560px; }
.topbar .avatar { margin-left: auto; }
.search .ico { position: absolute; left: 12px; top: 10px; color: var(--ink-3); pointer-events: none; }
.search input { padding-left: 40px; background: var(--mist); border-color: transparent; border-radius: 12px; }
.search input:focus { background: var(--paper); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--sky); color: #fff; display: grid; place-items: center;
  font-weight: 700; border: 0; cursor: pointer; flex: none; font-size: 15px;
}
.content { flex: 1; overflow-y: auto; padding: 4px 24px 120px; position: relative; }

/* ---------- page header ---------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-size: 13px; color: var(--ink-2); min-height: 22px; }
.crumbs a { color: var(--ink-2); padding: 2px 4px; border-radius: 6px; }
.crumbs a:hover { color: var(--brand); background: var(--brand-soft); text-decoration: none; }
.crumbs .slash { color: var(--ink-3); }
.crumbs > span:not(.slash) { padding: 2px 4px; } /* the current folder: same spacing as the links */
.crumbs a.drop-target { background: var(--brand-soft); color: var(--brand); }
.headrow { display: flex; align-items: flex-end; gap: 12px; margin: 2px 0 18px; flex-wrap: wrap; }
.title { font: 600 30px/1.15 var(--serif); margin: 0; letter-spacing: -.01em; overflow-wrap: anywhere; }
.headrow .tools { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-btn); overflow: hidden; }
.seg button { border: 0; background: var(--paper); height: 36px; width: 38px; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.seg button.on { background: var(--brand-soft); color: var(--brand); }

.selbar {
  position: fixed; z-index: 45; left: calc(var(--side) + (100vw - var(--side)) / 2); bottom: 24px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 2px; padding: 6px 8px; border-radius: 16px; max-width: calc(100vw - 24px);
  background: var(--ink); color: var(--paper); box-shadow: var(--shadow); overflow-x: auto;
}
.selbar.enter { animation: rise .18s ease-out; }
@keyframes rise { from { transform: translate(-50%, 12px); opacity: 0; } }
.selbar b { margin: 0 10px 0 2px; white-space: nowrap; font-weight: 600; }
.selbar .btn { background: transparent; border-color: transparent; color: inherit; }
.selbar .btn:hover { background: color-mix(in srgb, var(--paper) 16%, transparent); }
.selbar .btn.danger { color: var(--sel-danger); }
body.has-sel .fab { display: none; }

/* ---------- file grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 18px 14px; }
.tile { position: relative; border-radius: var(--r-tile); padding: 6px; cursor: pointer; user-select: none; outline: none; }
.tile:hover { background: var(--mist); }
.tile.sel { background: var(--brand-soft); }
.tile:focus-visible { box-shadow: 0 0 0 2px var(--brand); }
.tile .thumb {
  aspect-ratio: 1; border-radius: 10px; background: var(--mist); overflow: hidden; display: grid; place-items: center;
  position: relative;
}
.tile.sel .thumb { box-shadow: 0 0 0 2px var(--brand); }
.tile .thumb img.pic { width: 100%; height: 100%; object-fit: cover; }
.tile .thumb svg.glyph { width: 62%; height: 62%; }
.tile.dir .thumb { background: transparent; }
.tile.dir .thumb svg.glyph { width: 78%; height: 78%; }
.tile .name {
  margin-top: 8px; font-size: 13px; line-height: 1.3; text-align: center; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tile .meta { font-size: 12px; color: var(--ink-3); text-align: center; margin-top: 2px; }
.tile .pick, .tile .more {
  position: absolute; top: 12px; width: 26px; height: 26px; border-radius: 8px; display: none; place-items: center;
  border: 0; cursor: pointer; background: var(--paper); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.18);
}
.tile .pick { left: 12px; }
.tile .more { right: 12px; }
.tile:hover .pick, .tile:hover .more, .tile.sel .pick, .selecting .tile .pick { display: grid; }
.tile.sel .pick { background: var(--brand); color: var(--brand-ink); }
.tile .badge {
  position: absolute; right: 8px; bottom: 8px; background: rgba(13, 17, 38, .72); color: #fff; border-radius: 6px;
  padding: 1px 6px; font-size: 11px; display: flex; align-items: center; gap: 3px;
}
.tile.drop-target .thumb { box-shadow: 0 0 0 2px var(--brand); background: var(--brand-soft); }
.tile.cut { opacity: .45; }

/* list view */
.list { width: 100%; border-collapse: collapse; }
.list th { text-align: left; font-weight: 500; font-size: 12.5px; color: var(--ink-3); padding: 6px 10px; border-bottom: 1px solid var(--line); }
.list td { padding: 6px 10px; border-bottom: 1px solid var(--line); height: 52px; }
.list tr.item { cursor: pointer; }
.list tr.item:hover td { background: var(--mist); }
.list tr.item.sel td { background: var(--brand-soft); }
.list .cell-name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.list .mini { width: 36px; height: 36px; border-radius: 8px; overflow: hidden; flex: none; display: grid; place-items: center; background: var(--mist); }
.list .mini.dir { background: transparent; }
.list .mini img { width: 100%; height: 100%; object-fit: cover; }
.list .mini svg.glyph { width: 30px; height: 30px; }
.list .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .col-date, .list .col-size { color: var(--ink-2); white-space: nowrap; width: 1%; }
.list .col-act { width: 1%; }
.list tr.drop-target td { background: var(--brand-soft); }

.empty { text-align: center; padding: 72px 20px; color: var(--ink-2); }
.empty > svg { width: 96px; height: 96px; margin: 0 auto 18px; display: block; opacity: .9; }
.empty h3 { font: 600 22px/1.3 var(--serif); color: var(--ink); margin: 0 0 6px; }
.empty p { margin: 0 auto 18px; max-width: 420px; }

.month { font: 600 20px/1.2 var(--serif); margin: 28px 0 12px; }
.month:first-child { margin-top: 4px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 4px; }
.photos .ph { aspect-ratio: 1; background: var(--mist); position: relative; cursor: pointer; overflow: hidden; border-radius: 4px; }
.photos .ph img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.photos .ph:hover img { transform: scale(1.03); }
.photos .ph .badge { position: absolute; right: 6px; bottom: 6px; background: rgba(13,17,38,.72); color: #fff; border-radius: 6px; padding: 1px 6px; font-size: 11px; }
.more-row { text-align: center; padding: 24px; }

/* ---------- generic lists (shares, trash, admin) ---------- */
.rows { border-top: 1px solid var(--line); }
.rowi { display: flex; align-items: center; gap: 14px; padding: 12px 4px; border-bottom: 1px solid var(--line); min-height: 60px; }
.rowi .mini { width: 40px; height: 40px; border-radius: 9px; overflow: hidden; flex: none; display: grid; place-items: center; background: var(--mist); }
.rowi .mini.dir { background: transparent; }
.rowi .mini svg.glyph { width: 32px; height: 32px; }
.rowi .mini img { width: 100%; height: 100%; object-fit: cover; }
.rowi .t { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rowi .s { font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rowi .acts { display: flex; gap: 4px; flex: none; }
.rowi.sel { background: var(--brand-soft); }
.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 12px; background: var(--mist-2); color: var(--ink-2); }
.chip.brand { background: var(--brand-soft); color: var(--brand); }
.chip.danger { background: var(--danger-soft); color: var(--danger); }
.chip.ok { background: rgba(31,157,99,.12); color: var(--ok); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

.panel { max-width: 720px; }
.section { margin: 0 0 32px; }
.section h2 { font: 600 20px/1.3 var(--serif); margin: 0 0 12px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.diskbig { margin: 6px 0 22px; }
.diskbig .meter { height: 14px; }
.diskbig .nums { display: flex; justify-content: space-between; margin-top: 8px; color: var(--ink-2); font-size: 13px; flex-wrap: wrap; gap: 8px; }
.diskbig .nums b { color: var(--ink); font-size: 22px; font-family: var(--serif); font-weight: 600; margin-right: 6px; }
.stats { display: flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-bottom: 26px; }
.stats > div { flex: 1 1 140px; padding: 14px 18px; border-right: 1px solid var(--line); }
.stats > div:last-child { border-right: 0; }
.stats b { display: block; font: 600 24px/1.2 var(--serif); }
.stats span { font-size: 12.5px; color: var(--ink-2); }
.addr { display: flex; align-items: center; gap: 8px; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; }
.userbar { width: 120px; }
.tablewrap { overflow-x: auto; }
table.plain { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.plain th { text-align: left; font-weight: 500; color: var(--ink-3); font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.plain td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.plain td.nowrap { white-space: nowrap; }

/* ---------- overlays ---------- */
.scrim {
  position: fixed; inset: 0; background: rgba(13, 17, 38, .46); z-index: 50; display: grid; place-items: center; padding: 16px;
  animation: fade .14s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.dialog {
  background: var(--paper); border-radius: var(--r-dialog); box-shadow: var(--shadow); width: 100%; max-width: 460px;
  max-height: calc(100vh - 32px); display: flex; flex-direction: column; animation: pop .16s ease-out;
}
.dialog.wide { max-width: 640px; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.dialog header { display: flex; align-items: center; gap: 10px; padding: 18px 20px 6px; }
.dialog header h3 { font: 600 20px/1.3 var(--serif); margin: 0; flex: 1; overflow-wrap: anywhere; }
.dialog .body { padding: 10px 20px; overflow-y: auto; }
.dialog footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; flex-wrap: wrap; }

.menu {
  position: fixed; z-index: 60; min-width: 220px; background: var(--paper); border-radius: 12px; box-shadow: var(--shadow);
  padding: 6px; border: 1px solid var(--line); animation: fade .1s;
}
.menu button {
  display: flex; align-items: center; gap: 12px; width: 100%; height: 38px; padding: 0 12px; border: 0; background: none;
  border-radius: 8px; cursor: pointer; text-align: left;
}
.menu button:hover, .menu button:focus-visible { background: var(--mist); outline: none; }
.menu button.danger { color: var(--danger); }
.menu .sep { height: 1px; background: var(--line); margin: 5px 6px; }

.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast {
  background: #1b2140; color: #fff; padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow); max-width: min(560px, 92vw);
  pointer-events: auto; display: flex; gap: 12px; align-items: center; animation: pop .16s;
}
.toast.error { background: #a32032; }
.toast button { background: none; border: 0; color: #a9b8ff; font-weight: 600; cursor: pointer; padding: 0; }

/* drag & drop: the one loud moment */
.dropsky {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; pointer-events: none;
  background: var(--sky); color: #fff; opacity: 0; transition: opacity .15s ease-out;
}
.dropsky.on { opacity: .94; }
.dropsky .inner { text-align: center; transform: translateY(10px); transition: transform .25s ease-out; padding: 24px; }
.dropsky.on .inner { transform: none; }
.dropsky svg { width: 150px; height: 106px; margin: 0 auto 22px; display: block; }
.dropsky h2 { font: 600 clamp(28px, 4.5vw, 46px)/1.15 var(--serif); margin: 0 0 8px; }
.dropsky p { margin: 0; font-size: 16px; opacity: .9; }

/* upload panel */
.uploads {
  position: fixed; right: 20px; bottom: 20px; width: 380px; max-width: calc(100vw - 24px); background: var(--paper);
  border-radius: 16px; box-shadow: var(--shadow); z-index: 40; overflow: hidden; border: 1px solid var(--line);
}
.uploads header { display: flex; align-items: center; gap: 8px; padding: 12px 10px 12px 16px; border-bottom: 1px solid var(--line); }
.uploads header b { flex: 1; font-weight: 600; }
.uploads .ulist { max-height: 300px; overflow-y: auto; }
.uploads .u { padding: 10px 16px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.uploads .u:last-child { border-bottom: 0; }
.uploads .u .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.uploads .u .st { font-size: 12px; color: var(--ink-2); grid-column: 1 / -1; display: flex; justify-content: space-between; }
.uploads .u .st.err { color: var(--danger); }
.uploads .u .bar { grid-column: 1 / -1; height: 4px; border-radius: 99px; background: var(--mist-2); overflow: hidden; }
.uploads .u .bar i { display: block; height: 100%; background: var(--sky); width: 0; transition: width .2s; }
.uploads .u.done .bar i { background: var(--ok); }
.uploads.min .ulist { display: none; }
.uploads .total { height: 3px; background: var(--mist-2); }
.uploads .total i { display: block; height: 100%; background: var(--sky); width: 0; transition: width .3s; }

/* viewer */
.viewer { position: fixed; inset: 0; z-index: 65; background: #0b0e1e; color: #fff; display: grid; grid-template-rows: auto 1fr; animation: fade .15s; }
.viewer header { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: linear-gradient(#0b0e1e, rgba(11,14,30,.6)); }
.viewer header .t { flex: 1; min-width: 0; }
.viewer header .t b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.viewer header .t span { font-size: 12px; color: #a2aacb; }
.viewer .btn { background: transparent; border-color: transparent; color: #fff; }
.viewer .btn:hover { background: rgba(255,255,255,.1); }
.viewer .stage { position: relative; display: grid; place-items: center; overflow: hidden; min-height: 0; }
.viewer .stage > img, .viewer .stage > video { position: absolute; inset: 0; margin: auto; max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer .stage img { user-select: none; -webkit-user-drag: none; }
.viewer .stage iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.viewer .stage pre { margin: 0; width: min(980px, 100%); height: 100%; overflow: auto; padding: 20px 24px; background: #11152b; color: #dfe3f5; font: 13px/1.55 ui-monospace, "Cascadia Mono", Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.viewer .nav-l, .viewer .nav-r {
  position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 64px; border: 0; border-radius: 12px;
  background: rgba(255,255,255,.08); color: #fff; cursor: pointer; display: grid; place-items: center;
}
.viewer .nav-l { left: 12px; }
.viewer .nav-r { right: 12px; }
.viewer .nav-l:hover, .viewer .nav-r:hover { background: rgba(255,255,255,.18); }
.viewer .nofile { text-align: center; color: #c5cbe6; }
.viewer .nofile svg.glyph { width: 120px; height: 120px; margin: 0 auto 14px; }

/* auth pages */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(320px, 1fr) minmax(360px, 520px); }
.auth .sky {
  background: var(--sky); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.auth .sky::after {
  content: ""; position: absolute; right: -120px; bottom: -80px; width: 520px; height: 300px; border-radius: 300px;
  background: rgba(255,255,255,.08); box-shadow: -180px -60px 0 -30px rgba(255,255,255,.06);
}
.auth .sky .logo { display: flex; align-items: center; gap: 12px; font: 600 20px var(--serif); }
.auth .sky .logo img { width: 40px; height: 40px; border-radius: 10px; }
.auth .sky h1 { font: 600 clamp(32px, 4vw, 52px)/1.1 var(--serif); margin: 0 0 14px; max-width: 520px; position: relative; z-index: 1; }
.auth .sky p { margin: 0; max-width: 460px; opacity: .88; font-size: 15px; position: relative; z-index: 1; }
.auth .form { background: var(--paper); padding: 48px 44px; display: flex; flex-direction: column; justify-content: center; }
.auth .form h2 { font: 600 26px/1.2 var(--serif); margin: 0 0 6px; }
.auth .form .lead { color: var(--ink-2); margin: 0 0 24px; }
.steps { display: flex; gap: 8px; margin-bottom: 18px; }
.steps i { height: 4px; flex: 1; border-radius: 99px; background: var(--mist-2); }
.steps i.on { background: var(--brand); }

/* public share page */
.pub { max-width: 1040px; margin: 0 auto; padding: 20px 20px 60px; }
.pub .top { display: flex; align-items: center; gap: 12px; padding: 6px 0 24px; }
.pub .top img { width: 32px; height: 32px; }
.pub .top b { font: 600 18px var(--serif); }
.pub .card { background: var(--paper); border-radius: 20px; padding: 28px; box-shadow: 0 1px 3px rgba(27,33,64,.06); }
.pub .hero { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.pub .hero .big { width: 220px; aspect-ratio: 1; border-radius: 16px; background: var(--mist); display: grid; place-items: center; overflow: hidden; flex: none; }
.pub .hero .big img { width: 100%; height: 100%; object-fit: cover; }
.pub .hero .big svg.glyph { width: 60%; height: 60%; }
.pub .preview-media { max-width: 100%; max-height: 70vh; border-radius: 14px; margin: 0 auto 20px; background: #000; }
.pub .foot { text-align: center; color: var(--ink-3); font-size: 12.5px; margin-top: 28px; }

.qrbox { display: grid; place-items: center; gap: 12px; padding: 8px 0; }
.qrbox img { width: 240px; height: 240px; border-radius: 12px; background: #fff; padding: 8px; }
.code-big { font: 600 28px/1 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .12em; }
.pick-tree { border: 1px solid var(--line); border-radius: 12px; max-height: 320px; overflow-y: auto; }
.pick-tree .rowi { padding: 8px 12px; min-height: 48px; cursor: pointer; }
.pick-tree .rowi:hover { background: var(--mist); }
.pick-tree .rowi:last-child { border-bottom: 0; }
.notice { background: var(--brand-soft); border-radius: 12px; padding: 12px 14px; font-size: 13px; color: var(--ink); margin: 0 0 16px; }
.notice.warn { background: var(--danger-soft); }
code, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; background: var(--mist); padding: 2px 6px; border-radius: 6px; overflow-wrap: anywhere; }

.fab { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side {
    position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 55; transform: translateX(-102%);
    transition: transform .2s ease-out; box-shadow: var(--shadow); background: var(--mist);
  }
  .side.open { transform: none; }
  .side-scrim { position: fixed; inset: 0; background: rgba(13,17,38,.4); z-index: 54; }
  .main { border-radius: 0; margin-top: 0; }
  .topbar { padding: 10px 12px; min-height: 58px; gap: 8px; }
  .topbar .menu-btn { display: inline-flex; }
  .content { padding: 2px 14px 120px; }
  .title { font-size: 25px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px 6px; }
  .tile { padding: 4px; }
  .tile .pick, .tile .more { top: 8px; }
  .tile .pick { left: 8px; }
  .tile .more { right: 8px; display: grid; }
  .list .col-date { display: none; }
  .photos { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 2px; }
  .fab {
    display: grid; place-items: center; position: fixed; right: 18px; bottom: 22px; width: 58px; height: 58px; border-radius: 18px;
    background: var(--brand); color: var(--brand-ink); border: 0; box-shadow: var(--shadow); z-index: 30; cursor: pointer;
  }
  .uploads { right: 12px; bottom: 90px; }
  .selbar { left: 50%; bottom: 16px; }
  .auth { grid-template-columns: 1fr; }
  .auth .sky { padding: 28px 24px; min-height: 0; }
  .auth .sky h1 { font-size: 30px; margin-top: 28px; }
  .auth .form { padding: 28px 24px 40px; }
  .headrow .tools .label { display: none; }
  .selbar .label { display: none; }
  .pub .hero .big { width: 100%; max-width: 320px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
