:root {
  --bg: #0e1014;
  --bg-soft: #13161d;
  --panel: #161a23;
  --panel-2: #1b2030;
  --line: #242a3a;
  --line-soft: #1d2230;
  --ink: #e4e6ec;
  --ink-dim: #9aa0ae;
  --ink-faint: #5d6373;
  --accent: #f0a843;
  --accent-deep: #d98f25;
  --accent-soft: rgba(240, 168, 67, .13);
  --green: #7ec77e;
  --blue: #6fb3d8;
  --violet: #a78bda;
  --rose: #d87a7a;
  --radius: 12px;
  --radius-sm: 8px;
  --ui: "Outfit", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --shadow: 0 8px 30px rgba(0, 0, 0, .45);
  --side-w: 236px;
}
* { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0; min-height: 100%;
  background: var(--bg);
  background-image:
    radial-gradient(1200px 500px at 80% -10%, rgba(240,168,67,.05), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(111,179,216,.04), transparent 60%);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 14.5px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
.m0 { margin: 0; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #262c3c; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ============ shell ============ */
.side {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 40;
  background: var(--bg-soft);
  border-right: 1px solid var(--line-soft);
  display: flex; flex-direction: column; padding: 18px 14px;
}
.side-brand { display: flex; align-items: center; gap: 11px; text-decoration: none; padding: 4px 8px 18px; }
.logo {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #14110a; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(240,168,67,.25);
}
.side-brand-text { font-weight: 700; font-size: 17px; letter-spacing: .01em; line-height: 1.1; }
.side-brand-text small { display: block; font-weight: 400; font-size: 10.5px; color: var(--ink-faint); font-family: var(--mono); margin-top: 3px; }
.side-label { font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-faint); padding: 8px 10px 6px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px;
  border-radius: var(--radius-sm); text-decoration: none; color: var(--ink-dim);
  font-weight: 500; font-size: 14px; transition: background .12s, color .12s;
}
.side-item svg { color: var(--ink-faint); transition: color .12s; flex: none; }
.side-item:hover { background: var(--panel); color: var(--ink); }
.side-item.active { background: var(--accent-soft); color: var(--accent); }
.side-item.active svg { color: var(--accent); }
.side-foot {
  margin-top: auto; display: flex; gap: 8px; align-items: flex-start;
  color: var(--ink-faint); font-size: 10.5px; line-height: 1.6; font-family: var(--mono);
  padding: 12px 10px 2px; border-top: 1px solid var(--line-soft);
}
.side-foot svg { flex: none; margin-top: 2px; color: var(--green); }
.backdrop { display: none; }

.main { margin-left: var(--side-w); min-height: 100vh; display: flex; flex-direction: column; }
.main-full { margin-left: 0; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 26px; position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.top-brand { font-weight: 700; font-size: 16px; text-decoration: none; display: none; }
.main-full .top-brand { display: block; }
.top-spacer { flex: 1; }
.userchip {
  display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-dim);
  background: var(--panel); border: 1px solid var(--line); border-radius: 99px; padding: 5px 13px;
}
.userchip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }
.iconbtn {
  background: transparent; border: none; color: var(--ink-dim); cursor: pointer;
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; transition: background .12s, color .12s;
}
.iconbtn:hover { background: var(--panel); color: var(--ink); }
.menubtn { display: none; }

.shell { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 26px 26px 70px; }

/* ============ buttons ============ */
.btn {
  font-family: var(--ui); font-weight: 600; font-size: 13px;
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep)); color: #181206;
  border: none; border-radius: var(--radius-sm); padding: 9px 16px; cursor: pointer;
  text-decoration: none; transition: filter .12s, transform .1s;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-ghost { background: var(--panel); color: var(--ink-dim); border: 1px solid var(--line); }
.btn-ghost:hover { color: var(--ink); filter: none; }

/* ============ page head / share cards ============ */
.page-head { margin: 4px 0 24px; }
.page-kicker { font-family: var(--mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 8px; }
.page-title { font-size: 26px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.page-title em { font-style: normal; color: var(--accent); }

.shares { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.share-card {
  position: relative; display: block; text-decoration: none; color: var(--ink);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 22px 18px; overflow: hidden;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
  animation: rise .45s ease backwards;
}
.share-card:nth-child(2) { animation-delay: .06s; } .share-card:nth-child(3) { animation-delay: .12s; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.share-card:hover { transform: translateY(-3px); border-color: #3a4258; box-shadow: var(--shadow); }
.share-icon {
  width: 44px; height: 44px; border-radius: 11px; margin-bottom: 16px;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.share-name { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.share-meta { font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); word-break: break-all; line-height: 1.5; }
.share-count { margin-top: 14px; font-size: 12px; color: var(--green); display: flex; align-items: center; gap: 6px; }
.share-count::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.share-down { color: var(--rose); } .share-down::before { background: var(--rose); }
.share-go {
  position: absolute; right: 16px; top: 20px; color: var(--ink-faint);
  transition: color .15s, transform .15s;
}
.share-card:hover .share-go { color: var(--accent); transform: translateX(3px); }

/* ============ browse toolbar ============ */
.crumbbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; font-size: 13.5px; min-width: 0; }
.crumbs a, .crumbs .here {
  padding: 5px 9px; border-radius: 7px; text-decoration: none; color: var(--ink-dim);
  max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.crumbs a:hover { background: var(--panel); color: var(--ink); }
.crumbs .here { color: var(--ink); font-weight: 600; background: var(--panel); }
.crumbs .sep { color: var(--ink-faint); font-size: 12px; }
.statusline { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); white-space: nowrap; }

.toolbar { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }
.searchbox { position: relative; flex: 1; min-width: 200px; }
.searchbox svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-faint); pointer-events: none; }
.search {
  width: 100%; background: var(--panel); border: 1px solid var(--line); color: var(--ink);
  font-family: var(--ui); font-size: 14px; padding: 9px 14px 9px 38px; outline: none;
  border-radius: var(--radius-sm); transition: border-color .12s, box-shadow .12s;
}
.search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search::placeholder { color: var(--ink-faint); }
.sortgroup { display: flex; align-items: center; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 3px; }
.sortgroup .lbl { font-size: 11px; color: var(--ink-faint); padding: 0 8px; text-transform: uppercase; letter-spacing: .1em; }
.sortbtn {
  font-size: 12.5px; font-weight: 500; color: var(--ink-dim); text-decoration: none;
  padding: 6px 11px; border-radius: 6px; transition: background .12s, color .12s;
}
.sortbtn:hover { color: var(--ink); background: var(--panel-2); }
.sortbtn.on { background: var(--accent-soft); color: var(--accent); }
.viewtoggle { display: flex; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 3px; }
.vbtn { width: 34px; height: 30px; display: flex; align-items: center; justify-content: center; color: var(--ink-faint); border-radius: 6px; text-decoration: none; transition: background .12s, color .12s; }
.vbtn:hover { color: var(--ink); }
.vbtn.on { background: var(--accent-soft); color: var(--accent); }

/* ============ grid ============ */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 14px; }
.tile {
  text-decoration: none; color: var(--ink); min-width: 0; display: block;
  border-radius: var(--radius); padding: 8px;
  background: var(--bg-soft); border: 1px solid var(--line-soft);
  transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease, background .14s;
}
.tile:hover { transform: translateY(-3px); border-color: #343c52; background: var(--panel); box-shadow: var(--shadow); }
.tile-thumb {
  position: relative; aspect-ratio: 1 / 1; border-radius: 8px; overflow: hidden;
  background: var(--panel); display: flex; align-items: center; justify-content: center;
}
.tile-thumb[data-kind="image"]:not(.noimg), .tile-thumb[data-kind="video"]:not(.noimg) {
  background: linear-gradient(110deg, var(--panel) 35%, var(--panel-2) 50%, var(--panel) 65%);
  background-size: 220% 100%; animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { to { background-position: -120% 0; } }
.tile-thumb img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .3s ease, transform .25s ease;
}
.tile-thumb img.ld { opacity: 1; }
.tile-thumb:has(img.ld) { animation: none; }
.tile:hover .tile-thumb img { transform: scale(1.05); }
.tile-glyph { color: var(--ink-faint); display: flex; }
.tile-thumb:not(.noimg):has(img) .tile-glyph { display: none; }
.glyph-video { color: var(--violet); } .glyph-audio { color: var(--green); }
.glyph-image { color: var(--blue); } .glyph-archive { color: var(--rose); }
.glyph-doc, .glyph-pdf, .glyph-text { color: var(--ink-dim); }
.tile-dir .tile-thumb { background: linear-gradient(150deg, var(--accent-soft), var(--panel) 70%); }
.tile-dir .tile-glyph, .tile-up .tile-glyph { color: var(--accent); }
.playbadge {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.92);
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(10, 12, 16, .62); backdrop-filter: blur(3px);
  color: #fff; display: flex; align-items: center; justify-content: center;
  pointer-events: none; opacity: .85; transition: transform .15s, opacity .15s;
  border: 1px solid rgba(255,255,255,.25);
}
.playbadge svg { margin-left: 2px; }
.tile:hover .playbadge { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.tile-name {
  margin: 9px 4px 0; font-size: 12.8px; font-weight: 500; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tile-meta { margin: 2px 4px 2px; font-family: var(--mono); font-size: 10px; color: var(--ink-faint); }

/* ============ list ============ */
.ftable { width: 100%; border-collapse: collapse; background: var(--bg-soft); border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; }
.ftable thead th {
  text-align: left; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 600; padding: 11px 16px;
  border-bottom: 1px solid var(--line); background: var(--panel);
}
.ftable thead th a { color: inherit; text-decoration: none; }
.ftable thead th a:hover { color: var(--ink); }
.ftable thead th .on { color: var(--accent); }
.ftable tbody tr { border-bottom: 1px solid var(--line-soft); transition: background .1s; }
.ftable tbody tr:last-child { border-bottom: none; }
.ftable tbody tr:hover { background: var(--panel); }
.ftable td { padding: 0; }
.ftable a.row { display: flex; align-items: center; gap: 13px; padding: 10px 16px; color: var(--ink); text-decoration: none; }
.ficon { display: flex; flex: none; }
.fname { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 500; font-size: 13.5px; }
.fsize { font-family: var(--mono); color: var(--ink-dim); font-size: 11.5px; white-space: nowrap; width: 90px; text-align: right; }
.fdate { font-family: var(--mono); color: var(--ink-faint); font-size: 11.5px; white-space: nowrap; width: 135px; text-align: right; }
.empty {
  color: var(--ink-faint); padding: 70px 20px; text-align: center;
  border: 1px dashed var(--line); border-radius: var(--radius); font-size: 14px;
}

/* ============ lightbox ============ */
.lb { position: fixed; inset: 0; z-index: 100; display: none; flex-direction: column; background: rgba(8, 9, 12, .96); backdrop-filter: blur(10px); }
.lb.open { display: flex; animation: lbfade .18s ease; }
@keyframes lbfade { from { opacity: 0; } }
.lb-top { display: flex; align-items: center; gap: 10px; padding: 12px 18px; }
.lb-title { min-width: 0; flex: 1; }
.lb-name { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-sub { font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); margin-top: 2px; }
.lb-btn {
  width: 40px; height: 40px; border-radius: 9px; border: none; cursor: pointer;
  background: rgba(255,255,255,.06); color: var(--ink-dim);
  display: flex; align-items: center; justify-content: center; text-decoration: none;
  transition: background .12s, color .12s; flex: none;
}
.lb-btn:hover { background: rgba(255,255,255,.13); color: #fff; }
.lb-stage { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 0 64px; }
.lb-stage img, .lb-stage video { max-width: 100%; max-height: 100%; border-radius: 6px; outline: none; box-shadow: 0 20px 70px rgba(0,0,0,.6); }
.lb-audio { text-align: center; padding: 30px; }
.lb-audio svg { color: var(--green); width: 64px; height: 64px; margin-bottom: 18px; }
.lb-audio audio { width: min(620px, 80vw); display: block; }
.lb-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(255,255,255,.14);
  background: rgba(16, 18, 24, .7); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s, transform .12s;
}
.lb-arrow:hover { background: rgba(40, 44, 56, .9); }
.lb-prev { left: 14px; } .lb-next { right: 14px; }
.lb-arrow[disabled] { opacity: .25; cursor: default; }
.lb-strip {
  display: flex; gap: 7px; padding: 12px 18px 16px; overflow-x: auto;
  scrollbar-width: thin; justify-content: safe center;
}
.lb-strip .st {
  flex: none; width: 62px; height: 44px; border-radius: 6px; overflow: hidden;
  border: 2px solid transparent; cursor: pointer; padding: 0; background: var(--panel);
  display: flex; align-items: center; justify-content: center; color: var(--ink-faint);
  opacity: .65; transition: opacity .12s, border-color .12s;
}
.lb-strip .st img { width: 100%; height: 100%; object-fit: cover; }
.lb-strip .st:hover { opacity: 1; }
.lb-strip .st.on { border-color: var(--accent); opacity: 1; }

/* ============ theater (direct preview page) ============ */
.theater-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin: 2px 0 16px; flex-wrap: wrap; }
.theater-title { font-size: 19px; overflow-wrap: anywhere; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.stage {
  position: relative; background: #07080b; border: 1px solid var(--line-soft); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; min-height: 200px; outline: none; overflow: hidden;
}
.stage.stage-fixed { height: 75vh; max-height: calc(100vh - 250px); min-height: 240px; }
.stage video, .stage img { width: 100%; height: 100%; object-fit: contain; outline: none; display: block; }
.stage:fullscreen { border: none; border-radius: 0; background: #000; }
.stage:fullscreen video, .stage:fullscreen img { max-height: 100vh; }
.audio-stage { padding: 56px 24px; text-align: center; width: 100%; }
.audio-glyph { color: var(--green); margin-bottom: 16px; }
.audio-name { color: var(--ink-dim); font-size: 12.5px; margin-bottom: 22px; overflow-wrap: anywhere; font-family: var(--mono); }
.audio-stage audio { width: 100%; max-width: 640px; }
.navarrow {
  position: absolute; top: 0; bottom: 0; width: 76px; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.55); text-decoration: none;
  opacity: 0; transition: opacity .15s ease;
}
.stage:hover .navarrow { opacity: 1; }
.nav-prev { left: 0; background: linear-gradient(90deg, rgba(0,0,0,.5), transparent); }
.nav-next { right: 0; background: linear-gradient(-90deg, rgba(0,0,0,.5), transparent); }
.navarrow:hover { color: var(--accent); }
.theater-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; flex-wrap: wrap; gap: 10px; }
.kbd-hint { color: var(--ink-faint); font-size: 11.5px; }
.kbd-hint b { color: var(--ink-dim); border: 1px solid var(--line); border-radius: 5px; padding: 1px 7px; font-weight: 500; font-family: var(--mono); }
.viewer-text {
  background: var(--bg-soft); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 22px;
  white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12.5px; line-height: 1.65;
  max-height: 70vh; overflow: auto; font-family: var(--mono);
}
.viewer-pdf { width: 100%; height: 78vh; border: 1px solid var(--line-soft); border-radius: var(--radius); background: #000; }
.nopreview { padding: 70px 24px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--ink-dim); }
.fileinfo { display: flex; flex-wrap: wrap; gap: 18px; margin: 14px 0 18px; color: var(--ink-faint); font-size: 12px; font-family: var(--mono); }
.fileinfo b { color: var(--ink-dim); font-weight: 500; }

/* ============ login ============ */
.login-wrap { display: flex; justify-content: center; padding-top: 9vh; }
.login-card {
  width: 100%; max-width: 392px; border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border-radius: 18px; padding: 40px 36px;
  box-shadow: var(--shadow); animation: rise .5s ease backwards;
}
.login-logo {
  width: 52px; height: 52px; border-radius: 14px; margin-bottom: 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep)); color: #14110a;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(240,168,67,.3);
}
.login-title { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
.login-sub { color: var(--ink-faint); font-size: 11px; font-family: var(--mono); letter-spacing: .12em; margin-bottom: 30px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 7px; font-weight: 600; }
.field input {
  width: 100%; background: var(--bg); border: 1px solid var(--line); color: var(--ink);
  font-family: var(--ui); font-size: 14.5px; padding: 11px 14px; outline: none; border-radius: var(--radius-sm);
  transition: border-color .12s, box-shadow .12s;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-card .btn { width: 100%; justify-content: center; padding: 12px; margin-top: 10px; font-size: 14px; }
.errors { color: var(--rose); font-size: 12.5px; margin-bottom: 14px; line-height: 1.5; }

/* ============ responsive ============ */
@media (max-width: 920px) {
  .side { transform: translateX(-100%); transition: transform .2s ease; box-shadow: none; }
  .side.open { transform: none; box-shadow: 30px 0 80px rgba(0,0,0,.5); }
  .backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(0,0,0,.5); }
  .backdrop:not(.show) { display: none; }
  .backdrop.show { display: block; }
  .main { margin-left: 0; }
  .menubtn { display: flex; }
  .top-brand { display: block; }
  .shell { padding: 18px 14px 60px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .fdate { display: none; }
  .lb-stage { padding: 0 8px; }
  .lb-arrow { width: 40px; height: 40px; }
  .stage.stage-fixed { height: 60vh; }
}
