/* Roser Hari CDN: file browser theme (styles Apache's index page; cdn.js builds the interface) */
:root {
  --bg: #09090b;
  --panel: #131316;
  --panel-2: #1a1a1f;
  --line: #26262d;
  --text: #ececf1;
  --muted: #8d8d99;
  --accent: #ff2d42;
  --accent-soft: rgba(255, 45, 66, .14);
  --folder: #ffb224;
  --video: #ff5468;
  --image: #4dd4a0;
  --audio: #a78bfa;
  --archive: #f59e0b;
  --doc: #7cb7ff;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  background:
    radial-gradient(900px 420px at 12% -8%, rgba(255, 45, 66, .22), transparent 60%),
    radial-gradient(700px 380px at 100% 0%, rgba(120, 40, 200, .12), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

/* ---- hide Apache's own page when the script runs; plain fallback otherwise ---- */
html.js h1, html.js address, html.js #indexlist, html.js hr { display: none !important; }
h1 { font-size: 20px; margin: 24px auto 12px; max-width: 960px; padding: 0 16px; }
#indexlist { width: 100%; max-width: 960px; margin: 0 auto 24px; border-collapse: collapse; }
#indexlist th, #indexlist td { padding: 8px 16px; text-align: left; border-bottom: 1px solid var(--line); }
#indexlist a:hover { color: var(--accent); }
address { max-width: 960px; margin: 16px auto; padding: 0 16px; color: var(--muted); font-size: 12px; }

/* ---- app ---- */
.app { max-width: 1040px; margin: 0 auto; padding: 22px 16px 60px; }

.top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { height: 44px; width: auto; display: block; filter: drop-shadow(0 4px 14px rgba(255, 45, 66, .35)); }
.brand .tag {
  font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px; color: #fff; background: var(--accent);
}
.top .grow { flex: 1; }
.home-link { color: var(--muted); font-size: 13px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255, 255, 255, .02); }
.home-link:hover { color: var(--text); border-color: #3a3a44; }

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .025), rgba(255, 255, 255, 0)) , var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
}

.bar { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 14px; min-width: 0; }
.crumbs a, .crumbs span.cur { padding: 4px 9px; border-radius: 8px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { background: var(--panel-2); color: var(--text); }
.crumbs span.cur { color: var(--text); font-weight: 600; background: var(--accent-soft); }
.crumbs .sep { color: #4a4a55; }

.tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.search { position: relative; flex: 1; min-width: 200px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; height: 42px; padding: 0 44px 0 38px; border-radius: 11px; border: 1px solid var(--line);
  background: #0e0e11; color: var(--text); font-size: 15px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.search input::placeholder { color: #666672; }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 12px ui-monospace, monospace; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.select {
  height: 42px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--line); background: #0e0e11; color: var(--text); font-size: 14px; outline: none; cursor: pointer;
}
.select:focus { border-color: var(--accent); }
.stats { color: var(--muted); font-size: 13px; padding: 0 16px 12px; }
.stats b { color: var(--text); font-weight: 600; }

.list { border-top: 1px solid var(--line); }
.row {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) 92px 112px 118px; align-items: center; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid #1d1d23; content-visibility: auto; contain-intrinsic-size: 58px;
  transition: background .12s;
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--panel-2); }
.row.up .name { color: var(--muted); }
.ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: rgba(255, 255, 255, .04); }
.ico svg { width: 22px; height: 22px; }
.k-folder .ico { background: rgba(255, 178, 36, .12); color: var(--folder); }
.k-video .ico { background: rgba(255, 84, 104, .12); color: var(--video); }
.k-image .ico { background: rgba(77, 212, 160, .12); color: var(--image); }
.k-audio .ico { background: rgba(167, 139, 250, .12); color: var(--audio); }
.k-archive .ico { background: rgba(245, 158, 11, .12); color: var(--archive); }
.k-doc .ico { background: rgba(124, 183, 255, .12); color: var(--doc); }
.k-file .ico { color: var(--muted); }
.name { min-width: 0; display: flex; align-items: center; gap: 8px; }
.name a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.row .name a:hover { color: var(--accent); }
.ext { flex: none; font-size: 10px; font-weight: 700; letter-spacing: .06em; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; text-transform: uppercase; }
.ext.ok { color: #4dd4a0; border-color: rgba(77, 212, 160, .35); }
.size, .date { color: var(--muted); font-size: 13px; white-space: nowrap; }
.size { text-align: right; font-variant-numeric: tabular-nums; }
.act { display: flex; gap: 6px; justify-content: flex-end; }
.btn {
  height: 34px; min-width: 34px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 9px; border: 1px solid var(--line); background: #101014; color: var(--muted); cursor: pointer; font-size: 13px; transition: .12s;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { color: var(--text); border-color: #3b3b46; background: #17171c; }
.btn.play { color: #fff; background: var(--accent); border-color: var(--accent); }
.btn.play:hover { filter: brightness(1.1); }
.btn.done { color: #4dd4a0; border-color: rgba(77, 212, 160, .45); }
.empty { padding: 46px 16px; text-align: center; color: var(--muted); }

.foot { text-align: center; color: #5d5d68; font-size: 12px; margin-top: 22px; }
.foot a { color: var(--muted); }
.foot a:hover { color: var(--accent); }

/* ---- viewer ---- */
.modal { position: fixed; inset: 0; z-index: 50; display: none; background: rgba(0, 0, 0, .86); backdrop-filter: blur(6px); align-items: center; justify-content: center; padding: 18px; }
.modal.open { display: flex; }
.stage { width: min(1100px, 100%); }
.stage .title { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.stage .title span { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage video, .stage img { width: 100%; max-height: 78vh; border-radius: 12px; background: #000; display: block; object-fit: contain; }
.stage audio { width: 100%; }
.stage .note { color: var(--muted); font-size: 13px; margin-top: 8px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; background: #1f1f26; color: var(--text); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; font-size: 14px; transition: .2s; z-index: 60; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- small screens ---- */
@media (max-width: 760px) {
  .row { grid-template-columns: 38px minmax(0, 1fr) auto; row-gap: 2px; padding: 10px 12px; }
  .row .date { display: none; }
  .row .size { grid-column: 3; grid-row: 1; }
  .row .act { grid-column: 2 / 4; grid-row: 2; justify-content: flex-start; }
  .row .ico { grid-row: 1 / 3; width: 38px; height: 38px; }
  .brand img { height: 36px; }
  .home-link { display: none; }
  .crumbs a, .crumbs span.cur { max-width: 140px; }
}
