:root{
  --bg:#0b1220;
  --panel:#0f1a30;
  --panel2:#0c1629;
  --line:#223152;
  --text:#e6edf7;
  --muted:#a9b7d0;
  --btn:#1c2a48;
  --btnHover:#24355c;
  --btnActive:#14213c;
  --primary:#2b6cff;
  --primaryHover:#3a79ff;
  --danger:#e05252;
  --dangerHover:#ff6a6a;
  --shadow:0 12px 30px rgba(0,0,0,.35);
  --radius:14px;
  --radius2:18px;
  --tap:46px;
  --mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --tooltipBg:#0a0f1a;
}

*{box-sizing:border-box;}

body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,"Noto Sans KR",sans-serif;
}

/* Topbar */
.topbar{
  position:sticky;top:0;z-index:20;
  background:rgba(11,18,32,.85);
  border-bottom:1px solid var(--line);
  backdrop-filter: blur(8px);
}

.topbar-inner{
  max-width:1100px;margin:0 auto;
  display:flex;justify-content:space-between;align-items:center;
  padding:12px 14px;
  gap:10px;
}

.brand{min-width:0;}
.brand .title{font-weight:800;font-size:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.brand .sub{font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}

/* Buttons */
.btn{
  height:var(--tap);
  padding:0 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background:var(--btn);
  color:var(--text);
  cursor:pointer;
  transition: background .15s ease, transform .06s ease, border-color .15s ease;
  user-select:none;
  line-height:1;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  white-space:nowrap;
  font-family: inherit;
  font-size: 14px;
}

.btn:hover{ background:var(--btnHover); border-color: rgba(255,255,255,.16); }
.btn:active{ background:var(--btnActive); transform: translateY(1px); }
.btn.primary{background:var(--primary); border-color: rgba(255,255,255,.10);}
.btn.primary:hover{background:var(--primaryHover);}
.btn.danger{background:rgba(224,82,82,.18); border-color: rgba(224,82,82,.35);}
.btn.danger:hover{background:rgba(255,106,106,.22); border-color: rgba(255,106,106,.45);}
.btn.ghost{background:transparent;}
.btn.small{ height:auto; padding:6px 8px; font-size:12px; border-radius:10px; }

.btn.slot{
  background: rgba(155,81,224,.12);
  border-color: rgba(155,81,224,.26);
}
.btn.slot:hover{
  background: rgba(155,81,224,.18);
  border-color: rgba(155,81,224,.34);
}

.btn.saveone{
  background: rgba(242,201,76,.14);
  border-color: rgba(242,201,76,.28);
}
.btn.saveone:hover{
  background: rgba(242,201,76,.20);
  border-color: rgba(242,201,76,.38);
}

/* Layout */
.wrap{max-width:1100px;margin:0 auto;padding:14px;}

.card{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--radius2);
  box-shadow:var(--shadow);
}

.card-head{padding:12px 14px;border-bottom:1px solid var(--line);}
.card-body{padding:14px;}

.dropzone{
  border:2px dashed var(--line);
  border-radius:var(--radius2);
  padding:40px 10px;
  text-align:center;
}

.dropzone.dragover{
  border-color: var(--primary);
  background: rgba(43, 108, 255, 0.05);
}

.queue{margin-top:12px;}
.qitem{
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:8px;
  margin-bottom:8px;
  background: rgba(255,255,255,.02);
}

/* Overlay + Drawer */
.overlay{
  position:fixed;inset:0;
  background:rgba(0,0,0,.45);
  display:none;
  z-index:90;
}
.overlay.on{display:block;}

.drawer{
  position:fixed;top:0;right:0;height:100%;
  width:min(460px,94vw);
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel2) 100%);
  border-left:1px solid var(--line);
  transform:translateX(100%);
  transition:transform .2s ease;
  z-index:100;
  display:flex;
  flex-direction:column;
  overflow:hidden;
  box-shadow: var(--shadow);
}
.drawer.open{transform:translateX(0);}

/* Files Drawer */
.sb-top{
  padding:12px 12px 10px 12px;
  border-bottom:1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.sb-meta{
  padding:8px 12px;
  border-bottom:1px solid rgba(255,255,255,.06);
  display:flex;
  flex-direction:column;
  gap:4px;
}

.sb-meta .sbHint{
  font-size:12px;
  color:var(--muted);
  white-space:nowrap;
}

.brandWrap{
  display:flex;
  flex-direction:column;
  gap:2px;
  min-width:0;
}

.sbTitle{
  font-weight:800;
  letter-spacing:.2px;
  font-size:14px;
  line-height:1.1;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.sbHint{
  font-size:11px;
  color:var(--muted);
  line-height:1.1;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  opacity:.95;
}

.sb-actions{
  display:flex;
  gap:8px;
  align-items:center;
  flex:0 0 auto;
  flex-wrap: wrap;
}

.selectAllRow{
  display:none;
  padding:8px 12px;
  border-bottom:1px solid rgba(255,255,255,.06);
  align-items:center;
  gap:10px;
  font-size:13px;
  color:var(--muted);
  user-select:none;
}
.selectionMode .selectAllRow{ display:flex; }

.list{
  padding:8px;
  overflow:auto;
  flex:1;
  position:relative;
  -webkit-overflow-scrolling: touch;
}

/* File Item */
.item{
  position:relative;
  border:1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.03);
  border-radius: 12px;
  padding:10px 10px;
  margin-bottom:8px;
  cursor:pointer;
  display:flex;
  gap:10px;
  align-items:flex-start;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
  user-select:none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.item:hover{
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.12);
  transform: translateY(-1px);
}

.chk{
  width:18px;
  height:18px;
  margin-top:2px;
  accent-color: var(--primary);
  display:none;
  flex:0 0 auto;
}
.selectionMode .chk{ display:inline-block; }

.bullet{
  width:10px;
  height:10px;
  border-radius: 999px;
  margin-top:5px;
  flex:0 0 auto;
  box-shadow: 0 0 0 2px rgba(255,255,255,.06);
  background: rgba(255,255,255,.25);
}

.meta{
  flex:1;
  min-width:0;
}

.titleRow{
  display:flex;
  align-items:center;
  gap:8px;
  min-width:0;
}

.title{
  font-weight:700;
  font-size:13px;
  color: var(--text);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  min-width:0;
  flex:1;
}

.sub{
  font-size:12px;
  color: var(--muted);
  margin-top:4px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.sbStatusRow{
  font-size:12px;
  color:var(--muted);
  line-height:1.2;
  white-space:nowrap;
}

/* Modal */
.modalWrap{
  position:fixed;inset:0;
  display:none;
  align-items:center;justify-content:center;
  z-index:110;
}
.modalWrap.on{display:flex;}

.modal{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--radius2);
  padding:20px;
  width:min(520px,94vw);
  box-shadow: var(--shadow);
}

/* Toast */
.toast{
  position:fixed;left:50%;bottom:16px;
  transform:translateX(-50%);
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:10px 14px;
  display:none;
  z-index:120;
  box-shadow: var(--shadow);
}
.toast.on{display:block;}

/* Thumbnail View */
.thumbMode .list{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(120px,1fr));
  gap:10px;
}

.thumbMode .item{
  flex-direction:column;
  align-items:stretch;
}

.thumb{
  width:100%;
  aspect-ratio:1/1;
  border-radius:10px;
  background:#000;
  overflow:hidden;
  display:flex;
  align-items:center;
  justify-content:center;
}

.thumb img{
  width:100%;
  height:100%;
  object-fit:cover;
}

.thumbVideo{
  font-size:11px;
  color:#fff;
  opacity:.7;
}

.thumbMode .meta{
  padding-top:6px;
}

.thumbMode .titleRow{
  flex-wrap:wrap;
}

/* File Icon Card */
.fileIcon{
  width:100%;
  aspect-ratio:1/1;
  border-radius:10px;
  background: linear-gradient(145deg, #121a2e, #0b1220);
  border:1px solid rgba(255,255,255,.08);
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:6px;
  padding:10px;
}

.fileIcon .ext{
  font-size:18px;
  font-weight:800;
  letter-spacing:.5px;
  color:var(--primary);
}

.fileIcon .label{
  font-size:11px;
  color:var(--muted);
  max-width:90%;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  text-align:center;
}

/* Video Card */
.videoCard{
  position:relative;
  width:100%;
  aspect-ratio:1/1;
  border-radius:10px;
  overflow:hidden;
  background:
    linear-gradient(
      180deg,
      rgba(0,0,0,.25) 0%,
      rgba(0,0,0,.65) 100%
    ),
    linear-gradient(145deg, #121a2e, #0b1220);
  border:1px solid rgba(255,255,255,.10);
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:6px;
  color:#fff;
  cursor:pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}

.videoCard .play{
  width:46px;
  height:46px;
  border-radius:999px;
  background:rgba(0,0,0,.55);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:22px;
  box-shadow:0 6px 16px rgba(0,0,0,.45);
  transition: transform .15s ease, background .15s ease;
}

.videoCard .label{
  font-size:11px;
  opacity:.85;
  letter-spacing:.3px;
}

.videoCard:hover{
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(0,0,0,.55);
}

.videoCard:hover .play{
  transform: scale(1.15);
  background: rgba(0,0,0,.75);
}

.videoCard .ext{
  position:absolute;
  top:8px;
  right:8px;
  font-size:10px;
  padding:3px 6px;
  border-radius:6px;
  background:rgba(0,0,0,.55);
  opacity:.9;
}
