/* XAMVA Data: 포털의 모달 파일관리자를 전체 화면으로 쓰고, 호스팅 전용 열(주소·권한)은 숨긴다. */
#fm { padding: 0; background: var(--bg); }
.fm-win { width: 100%; height: 100vh; height: 100dvh; border: 0; border-radius: 0; box-shadow: none; }
.fm-head { align-items: center; flex-wrap: wrap; }
.fm-head .ghost { margin-left: 0; }
.fm-cols, .fm-row { grid-template-columns: minmax(160px, 1fr) 140px 110px 90px; }
.fm-cols .col-ad, .fm-row .ad, .fm-cols .col-mode, .fm-row .pm { display: none; }

/* 용량 막대 */
.du { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink2); min-width: 0; }
.du-txt b { color: var(--ink); font-weight: 600; }
.du-bar { position: relative; display: flex; width: 160px; height: 8px; border-radius: 99px; overflow: hidden;
  background: color-mix(in srgb, var(--line) 80%, transparent); }
.du-bar i { display: block; height: 100%; }
.du .mine { background: var(--accent); }
.du .other { background: color-mix(in srgb, var(--ink2) 55%, transparent); }
.du-bar.warn .mine, .du-bar.warn .other { background: var(--warn-ink, #c25a00); }
.du-key { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.du-key i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-left: 6px; }
.pwbox { display: grid; gap: 10px; min-width: min(320px, 80vw); }

@media (max-width: 760px) {
  .fm-cols, .fm-row { grid-template-columns: minmax(0, 1fr) 80px; }
  .du { order: 3; width: 100%; margin-left: 0; flex-wrap: wrap; }
  .du-key { display: none; }
  .du-bar { flex: 1; }
}

/* ---------- 왼쪽: 폴더 트리(위) + 미리보기(아래) ---------- */
.fm-main { grid-template-columns: min(720px, 48vw) minmax(0, 1fr); }
.fm-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 55%, var(--raise)); }
.fm-side .fm-tree { flex: 1 1 auto; min-height: 90px; border-right: 0; background: none; }
.fm-prev { flex: 0 0 66%; min-height: 0; display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.pv-head { display: flex; align-items: center; justify-content: space-between; padding: 5px 8px 5px 12px; font-size: 12px;
  font-weight: 600; color: var(--ink2); border-bottom: 1px solid var(--line); }
.pv-x { background: none; border: 0; color: var(--ink2); font-size: 12px; padding: 2px 6px; border-radius: 4px; }
.pv-x:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 10%, transparent); }
.pv-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pv-media { flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; background: color-mix(in srgb, var(--rack) 88%, transparent); }
.pv-img { border: 0; padding: 0; width: 100%; cursor: zoom-in; }
.pv-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.pv-ico { position: relative; display: grid; place-items: center; color: var(--rack-dim); }
.pv-ico .ic { width: 64px; height: 64px; }
.pv-n { position: absolute; bottom: -4px; right: -10px; min-width: 22px; padding: 1px 6px; border-radius: 99px; font-size: 12px;
  background: var(--accent); color: var(--on-accent); text-align: center; }
.pv-info { padding: 8px 12px 10px; display: grid; gap: 2px; font-size: 12px; color: var(--ink2); }
.pv-info b { color: var(--ink); font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.pv-empty { margin: auto; padding: 16px; text-align: center; font-size: 13px; color: var(--ink2); }

/* 보기 전환 */
.vwbox { display: flex; gap: 2px; margin-left: auto; flex: none; }
.vw[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--ink); }

/* ---------- 아이콘(썸네일) 보기 ---------- */
.fm-list.icons { --tile: 136px; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(var(--tile), 100%), 1fr)); align-content: start; gap: 4px; padding: 6px; }
.fm-list.icons .fm-row.tile { height: auto; display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 4px;
  border: 1px solid transparent; border-radius: 4px; }
.fm-list.icons .fm-row.tile:hover { border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.fm-list.icons .fm-row.tile.sel { box-shadow: none; border-color: var(--accent); }
.tile .th { aspect-ratio: 4 / 3; display: grid; place-items: center; position: relative; overflow: hidden; border-radius: 2px; color: var(--ink2); }
.tile .th.img { background: color-mix(in srgb, var(--rack) 70%, transparent); }
.tile .th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ic.big { width: 54px; height: 54px; }
.th .ext, .pv-ico .ext { position: absolute; bottom: 14%; left: 50%; transform: translateX(-50%); font-size: 10px; font-weight: 700;
  letter-spacing: .02em; padding: 0 4px; border-radius: 3px; background: var(--raise); color: var(--ink2); }
.tile .nt { font-size: 12px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.tile .rn { width: 100%; font-size: 12px; }
.fm-list.icons .fm-empty { grid-column: 1 / -1; }

/* 끌어서 범위 선택 · 끌기 표시 */
.fm-marquee { position: absolute; z-index: 2; pointer-events: none; border: 1px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, transparent); }
.fm-ghost { position: fixed; top: -200px; left: 0; display: flex; align-items: center; gap: 8px; padding: 6px 10px; max-width: 280px;
  background: var(--raise); color: var(--ink); border: 1px solid var(--accent); border-radius: 6px; font-size: 13px; }
.fm-ghost img { width: 40px; height: 30px; object-fit: cover; border-radius: 2px; }
.fm-ghost span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-ghost small { color: var(--ink2); font-size: 11px; white-space: nowrap; }

/* ---------- 이미지 크게 보기 ---------- */
.lb { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; background: rgba(5, 8, 10, .94); color: #e8eef2; outline: 0; }
.lb-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-size: 13px; }
.lb-bar .sp { flex: 1; }
.lb-bar .ghost { color: #e8eef2; border-color: rgba(255, 255, 255, .25); }
.lb-cap { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 0 56px 16px; }
.lb-img { max-width: 100%; max-height: 100%; object-fit: contain; transition: opacity .15s; }
.lb.loading .lb-img { opacity: .35; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; font-size: 34px; line-height: 1;
  border: 0; border-radius: 6px; background: rgba(255, 255, 255, .08); color: #fff; }
.lb-nav:hover { background: rgba(255, 255, 255, .18); }
.lb-nav.prev { left: 8px; }
.lb-nav.next { right: 8px; }

@media (max-width: 760px) {
  .fm-main { grid-template-columns: 1fr; }
  .fm-side { display: none; }
  .fm-list.icons { --tile: 104px; }
  .fm-list.icons.z2 { --tile: 208px; }
  .fm-list.icons.z4 { --tile: 100%; }
  .vwbox .vw:last-child { display: none; }
  .lb-stage { padding: 0 8px 8px; }
}

/* ---------- 동영상·음악 ---------- */
.pv-vid { background: #000; }
.pv-vid video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.pv-aud { display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 12px; }
.pv-aud audio { width: 100%; }
.lb-stage video.lb-img { width: 100%; height: 100%; background: #000; }
.th.vid::after { content: "▶"; position: absolute; right: 8px; top: 8px; width: 24px; height: 24px; display: grid; place-items: center;
  font-size: 11px; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; }

/* ---------- 웹 주소·공유 ---------- */
.pv-act { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.shr-on { font-size: 12px; color: var(--ok-ink); }
.shr-on .link { font-size: 12px; }
.tile.shared .th::before { content: "🔗"; position: absolute; left: 6px; top: 6px; z-index: 1; font-size: 12px; line-height: 1;
  padding: 3px 4px; border-radius: 4px; background: rgba(0, 0, 0, .55); }
.fm-row.shared:not(.tile) .nt::after { content: " 🔗"; font-size: 11px; }
.shr-list { display: grid; gap: 6px; min-width: min(560px, 82vw); max-height: 55vh; overflow: auto; }
.shr-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 6px; }
.shr-p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }

/* ---------- 기간별 묶음 제목 ---------- */
.fm-grp { display: flex; align-items: center; gap: 8px; padding: 10px 14px 4px; font-size: 13px; font-weight: 600; color: var(--accent);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); cursor: pointer; user-select: none; }
.fm-grp .gc { font-weight: 400; color: var(--ink2); font-size: 12px; }
.fm-grp:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.fm-list.icons .fm-grp { grid-column: 1 / -1; margin-top: 6px; padding: 6px 4px 4px; }
.fm-list.icons .fm-grp:first-child { margin-top: 0; }

/* ---------- 트래픽 게이지 ---------- */
.du-tr { display: flex; align-items: center; gap: 8px; padding-left: 12px; margin-left: 2px; border-left: 1px solid var(--line); white-space: nowrap; }
.du-bar.sm { width: 90px; }
.du .tr { background: var(--ok-ink); }
.du-bar.warn .tr { background: var(--warn-ink, #c25a00); }
@media (max-width: 1100px) { .du-key { display: none; } }
@media (max-width: 760px) { .du-tr { border-left: 0; padding-left: 0; } }

/* 아이콘 크기: 기본 / 2배 / 4배 (모바일 규칙이 뒤에 있어 위에서 따로 덮음) */
.fm-list.icons.z2 { --tile: 272px; }
.fm-list.icons.z4 { --tile: 544px; }
@media (max-width: 760px) {
  .fm-list.icons.z2 { --tile: 208px; }
  .fm-list.icons.z4 { --tile: 100%; }
}
/* 2배·4배는 칸을 늘리지 않고 정확한 크기로(남는 공간은 오른쪽에 비움) */
.fm-list.icons.z2, .fm-list.icons.z4 { grid-template-columns: repeat(auto-fill, minmax(min(var(--tile), 100%), var(--tile))); }

/* ---------- 가로 / 세로 영상 ---------- */
/* 미리보기: 세로 영상이면 미리보기 창을 키워 화면 높이를 최대한 쓴다(트리는 최소 높이로 줄어듦) */
.fm-side:has(.fm-prev.portrait) .fm-tree { flex: 0 0 110px; min-height: 0; }
.fm-prev.portrait { flex: 1 1 0; }
.fm-prev.portrait .pv-vid { background: #000; }
/* 크게 보기: 영상 크기에 딱 맞춰(컨트롤이 화면 폭 전체로 퍼지지 않게) 가로·세로 모두 화면에 최대한 크게.
   세로 영상은 폰 화면처럼 둥근 틀을 씌운다. --ar = 가로/세로 비율 */
.lb-stage video.lb-img[data-o] { width: min(100%, calc((100vh - 110px) * var(--ar, 1.78))); height: auto; max-height: 100%; }
.lb-stage.portrait video.lb-img { border-radius: 14px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .12), 0 10px 40px rgba(0, 0, 0, .6); }
/* 미리보기 영상은 창 안에 꽉 차게(영상 비율은 contain으로 맞춤) — 비율 때문에 창 밖으로 커지지 않게 */
.pv-vid { position: relative; }
.pv-vid video { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto !important; }
