:root {
  --bg: #060b14;
  --panel: rgba(255,255,255,.035);
  --line: rgba(255,255,255,.10);
  --text: #ffffff;
  --muted: rgba(255,255,255,.45);
  --accent: #78c8ff;
  --danger: #ff8b8b;
  --folder: #78c8ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at center, rgba(120,180,255,.02), transparent 45%),
    linear-gradient(180deg, #0a1320, #060b14);
  color: var(--text);
  font: 15px/1.5 "Inter", Arial, sans-serif;
}

body::-webkit-scrollbar {
  width: 0;
  height: 0;
}

body {
  scrollbar-width: none;
}

.particles {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #fff;
  opacity: .42;
  transition: transform .15s linear;
}

.wrap {
  position: relative;
  z-index: 2;
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.topbar,
.list-head,
.selected-main,
.preview-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.topbar {
  margin-bottom: 14px;
}

.account-bar {
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.title-row {
  display: flex;
  align-items: baseline;
  gap: 24px;
  flex-wrap: wrap;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 56px;
  font-weight: 300;
  letter-spacing: -2px;
}

h2 {
  font-size: 17px;
  font-weight: 400;
}

.tiny {
  margin-top: 0;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 1px;
}

.panel {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.02));
  border: 1px solid var(--line);
  border-radius: 22px;
  backdrop-filter: blur(20px);
  overflow: hidden;
  padding: 0;
  margin-bottom: 16px;
}

.panel:has(.action-menu.show) {
  overflow: visible;
}

.auth-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 18px;
  align-items: center;
  padding: 22px 24px;
}

.auth-copy {
  min-width: 0;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.admin-users {
  display: grid;
  gap: 0;
  padding: 8px 20px 18px;
}

.admin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
  gap: 14px;
  align-items: center;
  padding: 12px 0;
}

.admin-row + .admin-row {
  border-top: 1px solid rgba(255,255,255,.05);
}

.admin-name {
  font-weight: 400;
  word-break: break-word;
}

.folderbar,
.list-head,
.preview-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 24px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.folderbar {
  border-bottom: 0;
}

.breadcrumbs {
  display: flex;
  gap: 5px;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
}

.crumb {
  border: 0;
  padding: 0;
  color: rgba(255,255,255,.6);
  background: transparent;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crumb:hover {
  color: var(--text);
  text-decoration: underline;
  background: transparent;
}

.crumb-sep {
  color: var(--muted);
}

.upload-zone {
  margin: 0 28px 22px;
  height: 96px;
  border-radius: 22px;
  border: 1px dashed rgba(255,255,255,.10);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: rgba(255,255,255,.48);
  cursor: pointer;
  transition: .25s;
  user-select: none;
}

.upload-zone.upload-collapsed {
  display: none;
}

.upload-zone:hover,
.upload-zone.drag {
  border-color: rgba(120,200,255,.24);
  background: rgba(80,160,255,.03);
}

#fileInput {
  display: none;
}

.selected {
  display: none;
  margin: 0 28px 28px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,.06);
}

.selected.show {
  display: block;
}

.selected-name {
  font-weight: 400;
  word-break: break-word;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.selected .actions {
  align-items: center;
}

button,
.btn-link,
.field {
  border: 1px solid rgba(255,255,255,.10);
  background:
    linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.02));
  color: var(--text);
  border-radius: 11px;
  padding: 9px 16px;
  font: inherit;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  text-decoration: none;
  transition: .25s;
}

.field {
  width: 100%;
  outline: none;
  cursor: text;
}

.field:focus {
  border-color: rgba(120,200,255,.35);
  box-shadow: 0 0 25px rgba(80,160,255,.08);
}

select.field {
  cursor: pointer;
}

select.field option {
  color: #101722;
}

button:hover,
.btn-link:hover {
  transform: translateY(-2px);
  border-color: rgba(120,200,255,.30);
  background:
    linear-gradient(180deg, rgba(80,160,255,.12), rgba(255,255,255,.03));
  box-shadow: 0 0 25px rgba(80,160,255,.08);
}

button:disabled,
.field:disabled {
  cursor: not-allowed;
  opacity: .48;
}

button:disabled:hover {
  transform: none;
  box-shadow: none;
}

button.primary {
  background:
    linear-gradient(180deg, rgba(120,200,255,.24), rgba(255,255,255,.04));
  color: var(--text);
  border-color: rgba(120,200,255,.28);
}

button.primary:hover {
  opacity: 1;
  background:
    linear-gradient(180deg, rgba(120,200,255,.30), rgba(255,255,255,.05));
}

.upload-action {
  padding: 8px 14px;
  border-radius: 11px;
  font-size: 13px;
}

button.danger,
.delete {
  color: var(--danger);
}

button.danger:hover,
.delete:hover {
  border-color: rgba(255,120,120,.25);
  box-shadow: 0 0 25px rgba(255,120,120,.10);
  background:
    linear-gradient(180deg, rgba(255,120,120,.08), rgba(255,255,255,.02));
}

button.text {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
}

button.text:hover {
  color: var(--text);
  transform: none;
  box-shadow: none;
  background: transparent;
}

.status {
  min-height: 20px;
  margin: 12px 28px 0;
  color: var(--muted);
  white-space: pre-wrap;
}

.status:empty {
  min-height: 0;
  margin-top: 0;
}

.auth-form .status,
.admin-panel .status {
  margin-left: 0;
  margin-right: 0;
}

.files {
  display: flex;
  flex-direction: column;
  padding: 10px 20px 24px;
}

.file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px 18px;
  border-radius: 14px;
  transition: .25s;
}

.file-row:hover {
  background: rgba(255,255,255,.03);
}

.file-row + .file-row {
  border-top: 1px solid rgba(255,255,255,.05);
}

.file-main {
  min-width: 0;
}

.file-entry {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.file-thumb {
  position: relative;
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  cursor: pointer;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.08);
  background:
    linear-gradient(135deg, rgba(80,160,255,.22), rgba(255,255,255,.03));
}

.folder-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--folder);
  text-shadow: 0 0 18px rgba(120,200,255,.18);
}

.folder-thumb svg {
  width: 30px;
  height: 30px;
  stroke: currentColor;
  stroke-width: 1.4;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.file-thumb img,
.file-thumb video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: #050505;
}

.file-thumb-empty {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  text-align: center;
  font-size: 10px;
  line-height: 1.3;
  color: rgba(255,255,255,.45);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.file-open {
  display: block;
  width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  text-align: left;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.file-open:hover {
  transform: none;
  box-shadow: none;
  background: transparent;
  border-color: transparent;
}

.file-open:hover .file-name {
  text-decoration: underline;
}

.file-name {
  display: block;
  font-size: 15px;
  font-weight: 400;
  word-break: break-word;
}

.file-meta {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: rgba(255,255,255,.42);
}

.file-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  position: relative;
}

.file-actions button,
.file-actions .btn-link {
  padding: 0;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 19px;
  line-height: 1;
  font-weight: 300;
}

.icon-action {
  font-family: "Inter", Arial, sans-serif;
}

.icon-action svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  stroke-width: 1.7;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.action-menu-wrap {
  position: relative;
}

.menu-toggle svg path {
  stroke-width: 3.5;
  stroke-linecap: round;
}

.action-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 8;
  display: none;
  width: 170px;
  padding: 6px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.03)),
    #0c1421;
  box-shadow: 0 18px 45px rgba(0,0,0,.38);
  backdrop-filter: blur(18px);
}

.action-menu.show {
  display: grid;
  gap: 2px;
}

.menu-item {
  box-sizing: border-box;
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255,255,255,.82);
  text-align: left;
  font: inherit;
  font-size: 13px;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-item:hover {
  transform: none;
  border-color: transparent;
  background: rgba(120,200,255,.10);
  box-shadow: none;
}

.action-menu button.menu-item,
.action-menu a.menu-item {
  margin: 0;
  border: 0;
  outline: 0;
}

.file-actions .action-menu .menu-item {
  width: 100%;
  height: auto;
  min-height: 34px;
  justify-content: flex-start;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.2;
}

.menu-item.danger {
  color: var(--danger);
}

.btn-link:hover {
  border-color: rgba(120,255,180,.25);
  box-shadow: 0 0 25px rgba(120,255,180,.10);
}

.empty {
  color: var(--muted);
  padding: 22px;
}

.preview {
  position: fixed;
  inset: 0;
  z-index: 4;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: rgba(0,0,0,.58);
  backdrop-filter: blur(12px);
}

.preview.show {
  display: flex;
  flex-direction: column;
}

.preview .preview-head,
.preview .preview-body {
  width: min(1180px, calc(100vw - 32px));
}

.preview .preview-head {
  border-radius: 24px 24px 0 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03)),
    #0b1220;
  border: 1px solid rgba(255,255,255,.10);
  border-bottom: 0;
}

.preview-title {
  font-size: 17px;
  font-weight: 400;
  word-break: break-word;
}

.preview-body {
  max-height: calc(100vh - 142px);
  overflow: auto;
  padding: 18px;
  border-radius: 0 0 24px 24px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.02)),
    #0b1220;
  border: 1px solid rgba(255,255,255,.10);
  border-top: 0;
}

.preview-body.preview-media {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.preview-body::-webkit-scrollbar,
.preview-body pre::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.preview-body::-webkit-scrollbar-thumb,
.preview-body pre::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.14);
  border-radius: 999px;
}

.preview-body::-webkit-scrollbar-track,
.preview-body pre::-webkit-scrollbar-track {
  background: transparent;
}

.preview-body,
.preview-body pre {
  scrollbar-color: rgba(255,255,255,.14) transparent;
  scrollbar-width: thin;
}

.preview-body img,
.preview-body video,
.preview-body audio,
.preview-body iframe,
.preview-body pre {
  max-width: 100%;
  width: 100%;
  border-radius: 18px;
  background: #000;
  border: 1px solid rgba(255,255,255,.08);
}

.preview-body.preview-media img,
.preview-body.preview-media video {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100vh - 184px);
  object-fit: contain;
}

.preview-body.preview-audio audio {
  width: 100%;
}

.preview-body pre {
  padding: 14px;
  white-space: pre-wrap;
  overflow: auto;
  max-height: 560px;
  color: #ddd;
  background: #0f1520;
}

.preview-body.preview-document iframe {
  min-height: min(74vh, 820px);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0,0,0,.55);
}

.modal.show {
  display: flex;
}

.modal-box {
  width: 100%;
  max-width: 360px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.025)),
    #111827;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 24px;
  padding: 18px;
  backdrop-filter: blur(20px);
}

.modal-title {
  font-size: 17px;
  font-weight: 400;
  margin-bottom: 10px;
}

.modal-input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.20);
  color: var(--text);
  font: inherit;
  outline: none;
}

.remember {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  user-select: none;
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.modal-error {
  min-height: 18px;
  margin-top: 8px;
  color: var(--danger);
  font-size: 13px;
}

@media (max-width: 760px) {
  .wrap {
    padding-top: 26px;
  }

  h1 {
    font-size: 44px;
  }

  .topbar,
  .preview-head,
  .selected-main,
  .list-head,
  .file-row,
  .auth-panel,
  .admin-row {
    display: block;
  }

  .account-bar {
    margin-top: 8px;
  }

  .folderbar,
  .list-head,
  .preview-head {
    padding: 12px 18px;
  }

  .file-actions,
  .actions {
    margin-top: 10px;
    justify-content: flex-start;
  }

  .preview-body video,
  .preview-body iframe {
    min-height: 260px;
  }

  .file-entry {
    align-items: flex-start;
  }

  .file-thumb {
    width: 56px;
    height: 56px;
    flex-basis: 56px;
  }
}
