#app { min-height: 100vh; min-height: 100dvh; }
.sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--sidebar); padding: calc(18px + var(--safe-t)) 14px 18px; overflow-y: auto; background: var(--surface); border-inline-end: 1px solid var(--line); display: none; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.2rem; color: var(--ink); padding: 4px 10px 14px; }
.nav-label { font-size: .78rem; color: var(--mute); margin: 14px 10px 4px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--r-sm); color: var(--ink); }
.nav-item:hover { background: var(--surface-2); } .nav-item[aria-current=page] { background: var(--accent); color: var(--on-accent); }
.content { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: calc(10px + var(--safe-t)) 14px 10px; border-bottom: 1px solid var(--line); }
.search { flex: 1; display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: 999px; padding: 0 14px; color: var(--mute); max-width: 560px; }
.search input { border: 0; background: transparent; min-height: 38px; padding: 0; outline: none; } .search:focus-within { box-shadow: 0 0 0 3px var(--accent); }
.icon-btn.lang { display: inline-flex; align-items: center; justify-content: center; flex-wrap: nowrap; white-space: nowrap; width: auto; border-radius: 999px; padding: 0 10px; gap: 4px; font-size: .8rem; font-weight: 600; }
@media (max-width: 899px) { [data-t=import-btn] { display: none; } }
.menu-wrap { position: relative; } .popover { position: absolute; inset-inline-end: 0; top: 46px; min-width: 200px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: 0 12px 40px rgba(0,0,0,.25); padding: 8px; display: grid; z-index: 30; }
.popover a { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 8px; color: var(--ink); } .popover a:hover { background: var(--surface-2); } .pop-name { padding: 8px 10px; }
.mobile-only { display: inline-flex; color: var(--ink); }
.main { padding: 18px 14px calc(96px + var(--safe-b)); outline: 0; max-width: 1400px; }
.bottomnav { position: fixed; inset-inline: 0; bottom: 0; z-index: 25; display: flex; justify-content: space-around; padding: 6px 4px calc(6px + var(--safe-b)); border-top: 1px solid var(--line); }
.tab { flex: 1; display: grid; justify-items: center; gap: 2px; padding: 4px 0; font-size: .7rem; color: var(--mute); } .tab[aria-current=page] { color: var(--accent); }
@media (min-width: 900px) {
  .sidebar { display: block; } .content { margin-inline-start: var(--sidebar); } .bottomnav, .mobile-only { display: none; } .main { padding: 28px 32px 48px; }
}
@media (max-width: 560px) { .upload-btn .label { display: none; } .upload-btn { padding: 0 12px; } .stat.wide { grid-column: span 2; } }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 6px; }
.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 4px 0 16px; }
.empty { text-align: center; padding: 56px 16px; max-width: 460px; margin: 0 auto; } .empty-icon { display: inline-grid; place-items: center; width: 76px; height: 76px; border-radius: 50%; background: var(--surface-2); color: var(--mute); }
.home-row { margin-top: 8px; } .rowscroll { overflow-x: auto; padding-bottom: 6px; }
.rowscroll .tiles { display: grid !important; grid-auto-flow: column; grid-auto-columns: var(--size); grid-template-columns: none !important; columns: auto !important; }

.tiles.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--size, 170px), 1fr)); gap: 4px; }
.tiles.masonry { columns: var(--size, 170px); column-gap: 6px; } .tiles.masonry .tile { margin-bottom: 6px; display: block; break-inside: avoid; }
.grp h3 { margin: 1.4rem 0 .5rem; }
.tile { position: relative; padding: 0; border: 0; background: var(--surface-2); border-radius: 8px; overflow: hidden; cursor: pointer; aspect-ratio: 1; width: 100%; -webkit-touch-callout: none; user-select: none; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; } .tiles.masonry .tile { width: 100%; }
.tile.nothumb::after { content: ""; position: absolute; inset: 0; background: var(--surface-2); }
.tile .badge { position: absolute; display: inline-flex; align-items: center; gap: 3px; color: #fff; font-size: .72rem; font-weight: 600; text-shadow: 0 1px 3px rgba(0,0,0,.6); z-index: 2; }
.badge.dur { inset-inline-end: 8px; bottom: 6px; } .badge.fav { inset-inline-start: 8px; bottom: 6px; color: #fff; }
.check { position: absolute; top: 8px; inset-inline-start: 8px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; background: rgba(0,0,0,.25); display: grid; place-items: center; color: transparent; z-index: 3; }
.tile.is-selected { outline: 3px solid var(--accent); outline-offset: -3px; } .tile.is-selected .check { background: var(--accent); color: #fff; border-color: var(--accent); }
.tile.is-selected img { transform: scale(.92); border-radius: 6px; } .tile img { transition: transform .15s; }
.tile.dragging { opacity: .4; } .tile.drop-target { outline: 3px dashed var(--accent); outline-offset: -3px; }
body.drop-active::after { content: ""; position: fixed; inset: 8px; border: 3px dashed var(--accent); border-radius: 22px; z-index: 90; pointer-events: none; background: color-mix(in srgb, var(--accent) 8%, transparent); }

.selbar { position: sticky; top: calc(60px + var(--safe-t)); z-index: 15; display: flex; align-items: center; gap: 6px; padding: 6px 10px; margin: 0 0 12px; border-radius: var(--r-md); border: 1px solid var(--line); flex-wrap: wrap; }
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 18px 14px; } .album-grid.small { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.album-card { display: grid; gap: 8px; color: var(--ink); } .album-cover { aspect-ratio: 1; border-radius: var(--r-md); background: var(--surface-2); overflow: hidden; display: grid; place-items: center; color: var(--mute); }
.album-cover img { width: 100%; height: 100%; object-fit: cover; } .album-meta { display: grid; gap: 1px; }

.modal { border: 0; padding: 0; border-radius: var(--r-lg); background: var(--surface); color: var(--ink); width: min(440px, calc(100vw - 28px)); max-height: 86dvh; box-shadow: 0 24px 80px rgba(0,0,0,.4); }
.modal.wide { width: min(760px, calc(100vw - 28px)); } .modal::backdrop { background: var(--shade); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.modal-body { padding: 20px 20px 8px; overflow: auto; max-height: calc(86dvh - 80px); } .modal-body h2 { margin: 0 0 12px; } .modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; }
.pick-list { display: grid; gap: 6px; margin-bottom: 12px; max-height: 40dvh; overflow: auto; } .pick { display: flex; justify-content: space-between; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; }
.pick-grid { max-height: 54dvh; overflow: auto; }
.toasts { position: fixed; z-index: 120; inset-inline: 0; bottom: calc(86px + var(--safe-b)); display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 12px; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 14px; background: #2c2c2e; color: #fff; padding: 11px 18px; border-radius: 999px; box-shadow: 0 8px 30px rgba(0,0,0,.35); max-width: 520px; } .toast-error { background: #b3261e; }
.toast-action { background: none; border: 0; color: #64b5ff; font-weight: 600; cursor: pointer; }
@media (min-width: 900px) { .toasts { bottom: 24px; } }
.import-card { position: fixed; z-index: 110; inset-inline: 14px; bottom: calc(90px + var(--safe-b)); max-width: 420px; margin-inline: auto; padding: 14px 16px; border-radius: var(--r-md); border: 1px solid var(--line); box-shadow: 0 10px 40px rgba(0,0,0,.25); }

.viewer { position: fixed; inset: 0; z-index: 100; background: #000; color: #fff; display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; }
.viewer .glass { background: rgba(28,28,30,.72); } .viewer .icon-btn:hover { background: rgba(255,255,255,.14); } .viewer .btn { background: rgba(255,255,255,.14); color: #fff; }
.v-top { grid-row: 1; display: flex; align-items: center; gap: 6px; padding: calc(8px + var(--safe-t)) 10px 8px; z-index: 3; } .v-count { font-size: .85rem; opacity: .8; } .v-title { flex: 1; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 8px; }
.v-stage { grid-row: 2; position: relative; display: grid; place-items: center; min-height: 0; touch-action: none; overflow: hidden; }
.v-media { display: grid; place-items: center; width: 100%; height: 100%; } .v-media img { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform .12s ease-out; will-change: transform; user-select: none; -webkit-user-drag: none; }
.v-media video { max-width: 100%; max-height: 100%; background: #000; }
.v-nav { position: absolute; top: 50%; translate: 0 -50%; z-index: 4; width: 46px; height: 46px; border-radius: 50%; border: 0; color: #fff; background: rgba(40,40,42,.6); cursor: pointer; display: grid; place-items: center; } .v-nav-left { left: 12px; } .v-nav-right { right: 12px; }
.v-bar { grid-row: 3; display: flex; align-items: center; justify-content: center; gap: 4px; padding: 8px 10px calc(8px + var(--safe-b)); flex-wrap: wrap; z-index: 3; } .v-sep { width: 1px; height: 24px; background: rgba(255,255,255,.25); margin: 0 6px; }
.zoom-label { min-width: 48px; text-align: center; font-size: .85rem; } .speed { display: inline-flex; gap: 8px; align-items: center; font-size: .9rem; } .speed select { background: rgba(255,255,255,.14); color: #fff; border: 0; }
.v-info { position: absolute; z-index: 5; inset-block: 0; inset-inline-end: 0; width: min(340px, 100%); padding: calc(64px + var(--safe-t)) 16px 16px; overflow: auto; transform: translateX(110%); transition: transform .22s; } [dir=rtl] .v-info { transform: translateX(-110%); } .v-info.open { transform: none !important; }
.v-info input, .v-info textarea { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.2); margin-bottom: 8px; } .v-info dl { margin: 14px 0 0; } .kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,.12); font-size: .9rem; } .kv dt { opacity: .65; } .kv dd { margin: 0; text-align: end; word-break: break-word; }
@media (max-width: 640px) { .v-info { inset-block: auto 0; inset-inline: 0; width: 100%; max-height: 60%; padding-top: 16px; transform: translateY(110%) !important; border-radius: 18px 18px 0 0; } .v-info.open { transform: none !important; } .v-nav { width: 40px; height: 40px; } .v-title { display: none; } .v-count { flex: 1; } }

.chip-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: .8rem; white-space: nowrap; }
.chip-btn[data-state=synced] { color: #1a8f3c; } .chip-btn[data-state=syncing] { color: var(--accent); } .chip-btn[data-state=pending] { color: var(--mute); } .chip-btn[data-state=failed] { color: var(--danger); border-color: var(--danger); } .chip-btn[data-state=offline] { color: var(--mute); }
@media (max-width: 560px) { .chip-label { display: none; } .chip-btn { padding: 0 9px; } }
