:root {
  --bg: #111215;
  --txt: #fff;
  --muted: #b8bcc4;
  --line: rgba(255, 255, 255, .09);
  --glass: rgba(255, 255, 255, .04);
  --grad: linear-gradient(to right, #12c2e9, #c471ed, #f64f59);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
/* The HTML `hidden` attribute must always win over author display rules
   (e.g. .modal-overlay/.lightbox/.upload-bar set display:flex). */
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg); color: var(--txt);
  font-family: Poppins, system-ui, sans-serif;
  overflow-x: hidden; line-height: 1.6;
  min-height: 100vh; display: flex; flex-direction: column;
}
img { max-width: 100%; }
a { color: inherit; text-decoration: none; }
#net { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; }
.grad {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- navbar ---------- */
.navbar { position: fixed; top: 0; left: 0; right: 0; z-index: 100; transition: background .3s, box-shadow .3s; }
.navbar.scrolled { background: rgba(17, 18, 21, .92); backdrop-filter: blur(8px); box-shadow: 0 2px 18px rgba(0, 0, 0, .4); }
.nav-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; }
.logo img { height: 44px; display: block; }
.nav-links { display: flex; gap: 6px; list-style: none; align-items: center; }
.nav-links > li > a { padding: 10px 16px; font-size: 14px; border-radius: 8px; display: block; color: var(--muted); transition: background .2s, color .2s; }
.nav-links > li > a:hover { background: rgba(255, 255, 255, .06); color: #fff; }

/* ---------- layout ---------- */
/* No z-index here: main must NOT create a stacking context, or fixed overlays
   (modals, lightbox) inside it would be trapped below the navbar/footer.
   The background canvas sits at z-index:-1 so plain main content still covers it. */
main { position: relative; flex: 1; }
.hero { min-height: calc(100vh - 60px); display: flex; align-items: center; justify-content: center; padding: 120px 24px 60px; }
.panel { max-width: 560px; width: 100%; }
.panel-wide { max-width: 720px; }
.tag { text-transform: uppercase; letter-spacing: 6px; font-size: 11px; color: #888; margin-bottom: 14px; display: block; }
h1 { font-size: clamp(34px, 5vw, 52px); font-weight: 800; line-height: 1.15; margin-bottom: 18px; }
h2 { font-size: clamp(26px, 3.6vw, 36px); font-weight: 700; line-height: 1.2; margin-bottom: 14px; }
.panel > p { color: var(--muted); font-size: 16px; margin-bottom: 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block; margin-top: 24px; padding: 13px 34px;
  border: 1px solid rgba(255, 255, 255, .35); border-radius: 30px;
  color: #fff; font-size: 14px; transition: .3s; background: none;
  cursor: pointer; font-family: inherit; text-align: center;
}
.btn:hover { background: var(--grad); border-color: transparent; }
.btn-block { display: block; width: 100%; margin-top: 20px; }
.btn-ghost { border-color: var(--line); }
.btn-copy { margin-top: 0; padding: 12px 22px; white-space: nowrap; }
.btn-copy.copied { background: var(--grad); border-color: transparent; }

/* ---------- alerts ---------- */
.alert { border-radius: 10px; padding: 12px 16px; font-size: 14px; margin: 18px 0 4px; border: 1px solid var(--line); }
.alert-error { background: rgba(220, 53, 69, .12); border-color: rgba(220, 53, 69, .4); color: #ffb3bb; }

/* ---------- upload card ---------- */
.upload-card {
  margin-top: 28px; background: var(--glass); border: 1px solid var(--line);
  border-radius: 16px; padding: 26px; backdrop-filter: blur(6px);
  display: flex; flex-direction: column; gap: 22px;
}
.field { display: flex; flex-direction: column; gap: 10px; }
.field-label { font-size: 14px; font-weight: 600; }
.field-hint { font-weight: 400; color: #888; font-size: 12px; margin-left: 6px; }

/* dropzone */
.dropzone {
  border: 1.5px dashed var(--line); border-radius: 14px; padding: 34px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  text-align: center; cursor: pointer; transition: border-color .25s, background .25s;
}
.dropzone:hover, .dropzone.dragover { border-color: #c471ed; background: rgba(196, 113, 237, .06); }
.dz-icon { color: var(--muted); }
.dz-text strong { display: block; font-size: 15px; }
.dz-text span { font-size: 13px; color: var(--muted); }
.dz-file { font-size: 14px; color: #fff; word-break: break-all; }
.dz-file strong { color: #12c2e9; }

/* lifetime chips */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 16px; border: 1px solid var(--line); border-radius: 30px;
  font-size: 13px; color: var(--muted); cursor: pointer; transition: .25s; user-select: none;
}
.chip:hover { border-color: rgba(255,255,255,.3); color: #fff; }
.chip-active { background: var(--grad); border-color: transparent; color: #fff; }

/* visibility cards */
.vis-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.vis-option {
  border: 1px solid var(--line); border-radius: 12px; padding: 16px;
  cursor: pointer; transition: .25s; background: rgba(255,255,255,.02);
}
.vis-option:hover { border-color: rgba(255,255,255,.25); }
.vis-active { border-color: #c471ed; background: rgba(196, 113, 237, .08); }
.vis-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.vis-head strong { font-size: 14px; }
.vis-option p { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* inputs */
.text-input {
  background: var(--glass); border: 1px solid var(--line); border-radius: 10px;
  padding: 13px 16px; color: #fff; font-family: inherit; font-size: 14px; width: 100%;
}
.text-input:focus { outline: none; border-color: #c471ed; }
.text-input[readonly] { color: var(--muted); }

/* ---------- result card ---------- */
.result-card {
  margin-top: 28px; background: var(--glass); border: 1px solid var(--line);
  border-radius: 16px; padding: 24px; backdrop-filter: blur(6px);
  display: flex; flex-direction: column; gap: 14px;
}
.result-file { display: flex; align-items: center; gap: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.result-file svg { color: #12c2e9; flex-shrink: 0; }
.result-file strong { display: block; font-size: 15px; word-break: break-all; }
.result-file .muted { font-size: 13px; }
.copy-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.copy-row { display: flex; gap: 10px; }
.copy-row .text-input { flex: 1; min-width: 0; }
.pw-reveal { margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.result-meta { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 6px; padding-top: 16px; border-top: 1px solid var(--line); }
.result-meta > div { display: flex; flex-direction: column; gap: 2px; }
.result-meta .muted { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.result-meta strong { font-size: 14px; }

/* ---------- footer ---------- */
footer { position: relative; z-index: 10; background: rgba(17, 18, 21, .88); border-top: 1px solid var(--line); padding: 50px 24px 30px; }
.footer-inner { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 30px; }
.footer-inner h5 { font-size: 15px; margin-bottom: 14px; }
.footer-inner ul { list-style: none; }
.footer-inner li { margin-bottom: 8px; }
.footer-inner a { color: var(--muted); font-size: 14px; }
.footer-inner a:hover { color: #fff; }
.footer-logo img { height: 44px; margin-bottom: 14px; }
.copy { color: #777; font-size: 13px; }

/* ---------- toast ---------- */
.popup-message { position: fixed; top: 80px; left: 50%; transform: translateX(-50%); z-index: 12000; color: #fff; padding: 12px 24px; border-radius: 8px; font-size: 15px; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); transition: opacity .4s ease; opacity: 0; pointer-events: none; background-color: #198754; }
.popup-show { opacity: 1; }

/* ---------- pages (explorer, admin, gallery) ---------- */
.page { position: relative; z-index: 10; max-width: 900px; margin: 0 auto; padding: 120px 24px 80px; }
.page-wide { max-width: 1200px; }
.page h1 { margin-bottom: 10px; }
.grad-line { margin-bottom: 18px; }

/* breadcrumb */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0 22px; font-size: 14px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: #fff; }
.crumb-sep { color: #555; }

/* explorer header + toolbar */
.explorer-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-bottom: 8px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-tool { padding: 9px 16px; border: 1px solid var(--line); border-radius: 30px; background: var(--glass); color: #fff; font-family: inherit; font-size: 13px; cursor: pointer; transition: .25s; }
.btn-tool:hover { border-color: rgba(255,255,255,.35); }
.btn-tool.btn-share:hover { background: var(--grad); border-color: transparent; }

/* badges */
.badge { display: inline-block; font-size: 11px; padding: 3px 10px; border-radius: 20px; border: 1px solid var(--line); color: var(--muted); vertical-align: middle; }
.badge-grad { background: var(--grad); color: #fff; border-color: transparent; }

/* file/folder grid — media-library masonry (same look as the gallery), with the
   explorer's interactive chrome (hover ⋯ menu, drag-to-move/upload). */
.explorer-grid { column-width: 200px; column-gap: 14px; margin-top: 18px; border-radius: 16px; transition: outline .2s; outline: 2px dashed transparent; outline-offset: 8px; }
.explorer-grid.drop-active { outline-color: #c471ed; }
/* folder tile highlighted as the drop target while dragging files from the OS */
.tile-folder.drag-target { border-color: #c471ed; box-shadow: 0 0 0 2px #c471ed inset; }
.tile-folder.drag-target .folder-thumb { background: linear-gradient(160deg, rgba(196,113,237,.34), rgba(18,194,233,.2)); }
/* internal drag-to-move: dragged tile + destination highlight (cyan) */
.tile[draggable="true"] { cursor: grab; }
.tile.dragging { opacity: .45; }
.tile-folder.move-target { border-color: #12c2e9; box-shadow: 0 0 0 2px #12c2e9 inset; }
.tile-folder.move-target .folder-thumb { background: linear-gradient(160deg, rgba(18,194,233,.34), rgba(196,113,237,.2)); }
.crumbs a.move-target { background: rgba(18,194,233,.22); border-radius: 6px; color: #fff; }
.tile { position: relative; display: block; width: 100%; margin: 0 0 14px; break-inside: avoid; -webkit-column-break-inside: avoid; page-break-inside: avoid; background: var(--glass); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; transition: border-color .2s; }
.tile:hover { border-color: rgba(255,255,255,.28); }
.tile-main { display: block; }
/* folders / non-media files / audio use a square card; media keeps its real ratio */
.tile-thumb { position: relative; aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; background: #16171b; overflow: hidden; }
.tile-thumb img, .tile-thumb video { width: 100%; height: 100%; object-fit: cover; }
.tile-file[data-kind="image"] .tile-thumb,
.tile-file[data-kind="video"] .tile-thumb { aspect-ratio: auto; display: block; }
.tile-file[data-kind="image"] .tile-thumb img,
.tile-file[data-kind="video"] .tile-thumb video { width: 100%; height: auto; display: block; }
.tile-thumb img.ph.lazy { min-height: 180px; }
.folder-thumb { color: #c471ed; background: linear-gradient(160deg, rgba(196,113,237,.12), rgba(18,194,233,.08)); }
.thumb-fallback { font-size: 40px; }
.tile-badge { position: absolute; bottom: 8px; right: 8px; font-size: 16px; }
/* order number on folders (sections) */
.tile-num { position: absolute; top: 8px; left: 8px; z-index: 3; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--grad); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(0,0,0,.45); }
.play-badge { position: absolute; inset: 0; margin: auto; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.5); border-radius: 50%; font-size: 16px; color: #fff; pointer-events: none; }
.play-lg { width: 54px; height: 54px; font-size: 20px; }
.tile-name { padding: 10px 12px 2px; font-size: 13px; word-break: break-word; }
.tile-sub { padding: 0 12px 10px; font-size: 11px; }
/* filename overlay shown on hover for media tiles (matches the gallery) */
.tile-cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 10px 8px; font-size: 12px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.72)); opacity: 0; transition: opacity .25s; word-break: break-word; pointer-events: none; }
.tile:hover .tile-cap { opacity: 1; }
.tile-menu { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 8px; border: none; background: rgba(0,0,0,.55); color: #fff; cursor: pointer; font-size: 16px; line-height: 1; opacity: 0; transition: opacity .2s; z-index: 4; }
.tile:hover .tile-menu { opacity: 1; }

/* Direct per-item download buttons on tiles — white icon on solid black */
.tile-dl { position: absolute; top: 8px; right: 42px; width: 28px; height: 28px; border-radius: 8px; background: #000; color: #fff; display: flex; align-items: center; justify-content: center; text-decoration: none; opacity: 0; transition: opacity .2s, background .2s; z-index: 4; box-shadow: 0 0 0 1px rgba(255,255,255,.18); }
.tile:hover .tile-dl { opacity: 1; }
.tile-dl:hover { background: #222; }
.gtile-dl { position: absolute; top: 8px; right: 8px; width: 36px; height: 36px; border-radius: 50%; background: #000; color: #fff; display: flex; align-items: center; justify-content: center; text-decoration: none; opacity: 0; transition: opacity .2s, background .2s; z-index: 3; box-shadow: 0 0 0 1px rgba(255,255,255,.18); }
.gtile:hover .gtile-dl { opacity: 1; }
.gtile-dl:hover { background: #222; }
.tile-dl svg, .gtile-dl svg { display: block; }
@media (hover: none) { .tile-dl, .gtile-dl { opacity: .95; } }   /* touch: always visible */
/* Admin storage overview */
.stat-row { display: flex; gap: 16px; flex-wrap: wrap; margin: 18px 0 8px; }
.stat-card { flex: 1 1 200px; background: var(--glass, #191b20); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.stat-label { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: #9aa0aa; }
.stat-value { font-size: 26px; font-weight: 700; margin: 4px 0 2px; }
.stat-sub { font-size: 12px; }
.quota-bar { height: 8px; border-radius: 6px; background: #2a2d34; overflow: hidden; display: inline-block; width: 140px; vertical-align: middle; margin-right: 8px; }
.quota-fill { height: 100%; background: var(--grad); width: 0; }
.quota-fill.quota-full { background: #f87171; }

.gallery-title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.dl-all { margin: 0; white-space: nowrap; }
/* "Download all / folder" buttons: icon + label, matching the tile icon */
.dl-btn { display: inline-flex; align-items: center; gap: 6px; }
.dl-btn svg { flex: none; }
/* drag-to-reorder insertion indicator (cyan bar on the leading/trailing edge) */
.tile.insert-before::before, .tile.insert-after::after {
  content: ''; position: absolute; top: 6px; bottom: 6px; width: 4px; border-radius: 3px;
  background: #12c2e9; box-shadow: 0 0 8px rgba(18,194,233,.85); z-index: 5; }
.tile.insert-before::before { left: 0; }
.tile.insert-after::after { right: 0; }

/* empty state */
.empty-state { column-span: all; text-align: center; padding: 60px 20px; border: 1.5px dashed var(--line); border-radius: 16px; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.empty-emoji { font-size: 40px; }

/* context menu */
.ctx-menu { position: fixed; z-index: 13000; background: #191b20; border: 1px solid var(--line); border-radius: 12px; padding: 6px; min-width: 180px; box-shadow: 0 18px 50px rgba(0,0,0,.5); }
.ctx-menu button { display: block; width: 100%; text-align: left; background: none; border: none; color: #fff; font-family: inherit; font-size: 13px; padding: 9px 12px; border-radius: 8px; cursor: pointer; }
.ctx-menu button:hover { background: rgba(255,255,255,.07); }
.ctx-menu button.danger { color: #ff7b86; }

/* modals */
.modal-overlay { position: fixed; inset: 0; z-index: 13500; background: rgba(0,0,0,.62); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: #16171b; border: 1px solid var(--line); border-radius: 18px; padding: 26px; width: min(520px, 100%); max-height: 88vh; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.modal-wide { width: min(820px, 100%); }
.note-meta { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
.note-editor { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13.5px; line-height: 1.55; min-height: 240px; resize: vertical; white-space: pre-wrap; overflow-wrap: break-word; }
.note-status { margin-right: auto; align-self: center; }
@media (max-width: 560px) { .note-meta { grid-template-columns: 1fr; } }
.modal h3 { font-size: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.modal-actions .btn { margin-top: 0; }
.switch-row { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.move-tree { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.move-opt { text-align: left; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--glass); color: #fff; font-family: inherit; font-size: 13px; cursor: pointer; }
.move-opt:hover { border-color: rgba(255,255,255,.3); }
.move-opt.sel { background: var(--grad); border-color: transparent; }

/* full-page drag-from-desktop overlay */
.drop-overlay { position: fixed; inset: 0; z-index: 13800; pointer-events: none;
  background: rgba(196, 113, 237, .07);
  border: 3px dashed rgba(196, 113, 237, .65); border-radius: 6px; }
.drop-overlay-card { position: fixed; top: 84px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; padding: 12px 24px;
  background: #191b20; border: 1px solid var(--line); border-radius: 30px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, .55); font-size: 14px; white-space: nowrap; }
.drop-overlay-emoji { font-size: 22px; }

/* upload progress bar */
/* Upload job tray (top-right) */
.upload-jobs { position: fixed; top: 84px; right: 20px; z-index: 14000; width: 330px; max-width: calc(100vw - 32px); background: #191b20; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 40px rgba(0,0,0,.5); overflow: hidden; font-size: 13px; color: #e9eaee; }
.uj-head { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; font-weight: 600; }
.uj-close { background: none; border: 0; color: #9aa0aa; font-size: 20px; line-height: 1; cursor: pointer; padding: 0 2px; }
.uj-close:hover { color: #fff; }
.uj-overall { height: 6px; background: #2a2d34; }
.uj-overall-fill { height: 100%; width: 0; background: var(--grad); transition: width .2s; }
.uj-list { list-style: none; margin: 0; padding: 6px 0; max-height: 46vh; overflow-y: auto; }
.uj-item { padding: 6px 14px; }
.uj-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.uj-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.uj-status { flex: none; font-size: 12px; color: #9aa0aa; }
.uj-status.ok { color: #4ade80; }
.uj-status.err { color: #f87171; }
.uj-bar { height: 4px; border-radius: 4px; background: #2a2d34; margin-top: 4px; overflow: hidden; }
.uj-bar-fill { height: 100%; width: 0; background: var(--grad); transition: width .15s; }
.uj-item.err .uj-bar-fill { background: #f87171; }

/* admin & shares tables */
.panel-card { background: var(--glass); border: 1px solid var(--line); border-radius: 16px; padding: 22px; margin: 22px 0; }
.panel-card h3 { font-size: 16px; margin-bottom: 14px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; align-items: end; }
.grid-form .btn { margin-top: 0; }
.table-wrap { overflow-x: auto; margin-top: 18px; border: 1px solid var(--line); border-radius: 16px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
.data-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: #888; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.data-table td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.row-actions form { display: inline; }
.link-cell { min-width: 280px; }
.btn-mini { padding: 7px 14px; border: 1px solid var(--line); border-radius: 20px; background: var(--glass); color: #fff; font-family: inherit; font-size: 12px; cursor: pointer; transition: .2s; }
.btn-mini:hover { border-color: rgba(255,255,255,.35); }
.btn-danger { color: #ff7b86; border-color: rgba(220,53,69,.4); }
.btn-danger:hover { background: rgba(220,53,69,.15); }
.cred { background: #000; padding: 3px 8px; border-radius: 6px; font-family: ui-monospace, monospace; color: #12c2e9; }
.alert-ok { background: rgba(25,135,84,.12); border-color: rgba(25,135,84,.4); color: #8ff0bf; }

/* single-file media view */
.view-title { font-size: clamp(22px, 3vw, 30px); margin-bottom: 16px; word-break: break-word; }
.media-stage { background: #0c0d10; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; margin-bottom: 18px; display: flex; align-items: center; justify-content: center; }
.media-stage img, .media-stage video { max-width: 100%; max-height: 70vh; display: block; }
.media-stage-audio { padding: 28px; }
.media-stage-audio audio { width: 100%; }

/* gallery */
/* titled sections (media-server categories) */
.gallery-section { margin-top: 40px; }
.section-title { font-size: clamp(19px, 2.6vw, 26px); font-weight: 700; line-height: 1.2; margin: 0 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.section-empty { margin: 2px 0 4px; }
/* inline audio "player" card (e.g. a band's live tracks) */
.gtile .gaudio { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.gaudio-top { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.gaudio-ico { font-size: 18px; }
.gaudio-name { word-break: break-word; }
.gaudio audio { width: 100%; }
.gtile[data-kind="audio"] { cursor: default; }
.gtile[data-kind="audio"]:hover { border-color: rgba(255,255,255,.28); }
.gnote span { font-size: 40px; }
/* lazy video preview: reserve a stable 16:9 box (no layout shift), poster loads
   only when on screen; the empty box shows the tile bg + play badge until then */
.lazy-vid { width: 100%; aspect-ratio: 16 / 9; height: auto; object-fit: cover; background: #16171b; display: block; }

/* ── rendered text notes (viewer + inline) ─────────────────────────────────── */
.note-viewer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.note-viewer-head h3 { word-break: break-word; }
.note-rendered { background: #0f1013; border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; max-height: 68vh; overflow: auto; }
.note-pre { white-space: pre-wrap; overflow-wrap: break-word; font-family: ui-monospace, Consolas, monospace; font-size: 13.5px; line-height: 1.6; margin: 0; color: #e9eaee; }
.note-md { line-height: 1.7; color: #e9eaee; }
.note-md > :first-child { margin-top: 0; }
.note-md h1, .note-md h2, .note-md h3, .note-md h4 { margin: .9em 0 .4em; line-height: 1.25; }
.note-md h1 { font-size: 1.6em; } .note-md h2 { font-size: 1.35em; } .note-md h3 { font-size: 1.15em; }
.note-md p { margin: 0 0 .8em; }
.note-md ul, .note-md ol { margin: 0 0 .8em 1.4em; }
.note-md li { margin: .2em 0; }
.note-md code { background: rgba(255,255,255,.09); padding: 1px 5px; border-radius: 5px; font-family: ui-monospace, monospace; font-size: .9em; }
.note-md pre.note-code { background: #000; padding: 12px 14px; border-radius: 10px; overflow: auto; margin: 0 0 .8em; }
.note-md pre.note-code code { background: none; padding: 0; }
.note-md blockquote { border-left: 3px solid var(--line); margin: 0 0 .8em; padding: .2em 0 .2em 14px; color: var(--muted); }
.note-md a { color: #12c2e9; text-decoration: underline; }
.note-md hr { border: none; border-top: 1px solid var(--line); margin: 1em 0; }
.album-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 6px 0 22px; }
.album { display: flex; align-items: center; gap: 10px; padding: 12px 18px; background: var(--glass); border: 1px solid var(--line); border-radius: 12px; font-size: 14px; }
.album:hover { border-color: rgba(255,255,255,.3); }
.album-ico { font-size: 20px; }
/* Masonry: tiles keep each item's natural aspect ratio (no square crop).
   CSS columns flow tiles top-to-bottom; column-width makes the count responsive. */
.gallery-grid { column-width: 240px; column-gap: 12px; margin-top: 10px; }
.gtile { position: relative; display: block; width: 100%; margin: 0 0 12px;
  break-inside: avoid; -webkit-column-break-inside: avoid; page-break-inside: avoid;
  border-radius: 14px; overflow: hidden; background: #16171b; border: 1px solid var(--line); cursor: pointer; }
.gtile img, .gtile video { width: 100%; height: auto; display: block; transition: transform .35s; }
/* Lazy placeholder: reserve space + a soft shimmer until the image loads. */
img.lazy { background: linear-gradient(100deg, #16171b 30%, #20222a 50%, #16171b 70%); background-size: 200% 100%; animation: lazyShimmer 1.2s ease-in-out infinite; }
/* Fallback height only when real dimensions are unknown; images with width/height
   attributes reserve their exact aspect ratio automatically (no layout shift). */
.gtile img.ph.lazy { min-height: 220px; }
@keyframes lazyShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.gtile:hover img, .gtile:hover video { transform: scale(1.04); }
.gtile figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 12px 8px; font-size: 12px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.7)); opacity: 0; transition: opacity .25s; word-break: break-word; }
.gtile:hover figcaption { opacity: 1; }
/* Non-media / broken-image tiles get a consistent box since they have no ratio. */
.gfallback { aspect-ratio: 4 / 3; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; font-size: 40px; color: var(--muted); }
.gfile small { font-size: 12px; padding: 0 10px; text-align: center; word-break: break-word; }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 15000; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; }
.lb-stage { max-width: 92vw; max-height: 82vh; display: flex; align-items: center; justify-content: center; }
.lb-stage img, .lb-stage video { max-width: 92vw; max-height: 82vh; border-radius: 8px; }
.lb-close { position: absolute; top: 18px; right: 22px; background: none; border: none; color: #fff; font-size: 26px; cursor: pointer; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.08); border: 1px solid var(--line); color: #fff; width: 52px; height: 52px; border-radius: 50%; font-size: 30px; cursor: pointer; }
.lb-nav:hover { background: rgba(255,255,255,.16); }
.lb-prev { left: 18px; } .lb-next { right: 18px; }
.lb-download { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); margin-top: 0; }

/* read-only file list */
.filelist { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; margin-top: 10px; }
.filerow { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); font-size: 14px; }
.filerow:last-child { border-bottom: none; }
.filerow:hover { background: rgba(255,255,255,.03); }
.fr-ico { font-size: 20px; }
.fr-name { flex: 1; word-break: break-word; }
.fr-meta { font-size: 12px; }

/* QR codes */
.qr-block { display: flex; align-items: center; gap: 16px; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.qr-img { background: #fff; border-radius: 10px; padding: 6px; flex-shrink: 0; display: block; }
.qr-text { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.qr-modal { align-items: center; text-align: center; }
.qr-lg { width: 240px; height: 240px; }

/* ---------- responsive ---------- */
/* Hamburger toggle (hidden on desktop, shown on small screens). */
.nav-toggle { display: none; background: none; border: 0; cursor: pointer; padding: 8px; }
.nav-toggle span { display: block; width: 24px; height: 2px; background: #fff; margin: 5px 0; border-radius: 2px; transition: transform .3s, opacity .3s; }
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Touch devices have no hover — keep per-tile action buttons & captions visible. */
@media (hover: none) {
  .tile-menu { opacity: 1; }
}

/* Tablet / phone navigation → collapse links into a dropdown panel. */
@media (max-width: 820px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 4px;
    background: rgba(17, 18, 21, .98); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
    box-shadow: 0 14px 34px rgba(0, 0, 0, .45);
    padding: 10px 16px 16px; display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links > li { width: 100%; }
  .nav-links > li > a { display: block; padding: 13px 12px; border-radius: 8px; font-size: 15px; }
}

@media (max-width: 700px) {
  .vis-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
  .copy-row { flex-direction: column; }
  .btn-copy { width: 100%; }
  .explorer-head { flex-direction: column; align-items: flex-start; }
  .toolbar { width: 100%; }
  .explorer-grid { column-width: 150px; column-gap: 10px; }
  .gallery-grid { column-width: 150px; column-gap: 10px; }
  .qr-block { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 560px) {
  .nav-inner { padding: 12px 16px; }
  .logo img { height: 38px; }
  .hero { padding: 96px 16px 48px; }
  .page { padding-left: 16px; padding-right: 16px; }
  .upload-card, .result-card, .panel-card, .modal { padding: 18px; }
  .grid-form { grid-template-columns: 1fr; }
  .explorer-grid { column-width: 130px; column-gap: 10px; }
  .tile-name { font-size: 12px; }
  .lb-nav { width: 42px; height: 42px; font-size: 24px; }
  .lb-prev { left: 6px; } .lb-next { right: 6px; }
  .lb-download { bottom: 12px; }
  h1 { line-height: 1.12; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .chip, .vis-option, .dropzone, .nav-toggle span { transition: none; }
}
