:root {
  --bg: #07080c;
  --bg-soft: #0b0d14;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-strong: rgba(255, 255, 255, 0.075);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #eceef5;
  --muted: #8f95ab;
  --accent: #7c5cff;
  --accent-2: #22d3ee;
  --danger: #ff5c7a;
  --ok: #35e0a1;
  --radius: 18px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(900px 520px at 12% -8%, rgba(124, 92, 255, 0.2), transparent 62%),
    radial-gradient(760px 420px at 92% -2%, rgba(34, 211, 238, 0.13), transparent 58%),
    var(--bg);
  font-family:
    ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.no-scroll {
  overflow: hidden;
}

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

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  padding: 8px 12px;
  background: var(--panel-strong);
  border-radius: 10px;
  z-index: 50;
}

.skip:focus {
  left: 8px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
}

/* ----------------------------------------------------------------- topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px clamp(16px, 4vw, 34px);
  background: rgba(7, 8, 12, 0.72);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: block;
}

.brand-text {
  font-weight: 650;
  letter-spacing: -0.02em;
  font-size: 17px;
}

.topbar-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.stats {
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ----------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 11px;
  padding: 8px 13px;
  font-size: 13.5px;
  font-weight: 550;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s ease,
    color 0.15s ease;
}

.btn:hover {
  background: var(--panel-strong);
  border-color: var(--line-strong);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn.primary {
  border: 0;
  padding: 10px 20px;
  color: #0a0714;
  font-weight: 700;
  background: linear-gradient(120deg, #a78bfa, #22d3ee);
  box-shadow: 0 10px 26px rgba(124, 92, 255, 0.32);
}

.btn.primary:hover {
  filter: brightness(1.06);
}

.btn.ghost {
  background: transparent;
}

.btn.ghost.is-unlocked {
  color: var(--ok);
  border-color: rgba(53, 224, 161, 0.35);
  background: rgba(53, 224, 161, 0.08);
}

.btn.ghost-sm {
  padding: 5px 9px;
  font-size: 12px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}

.btn.ghost-sm:hover {
  color: var(--text);
}

.btn.danger {
  color: var(--danger);
}

.btn.danger:hover {
  border-color: rgba(255, 92, 122, 0.4);
  background: rgba(255, 92, 122, 0.1);
}

/* ------------------------------------------------------------------- hero */

main {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding-bottom: 40px;
}

.hero {
  text-align: center;
  padding: clamp(38px, 7vw, 74px) 0 clamp(22px, 4vw, 34px);
}

.hero h1 {
  font-size: clamp(2rem, 6.4vw, 3.5rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
  font-weight: 750;
}

.grad {
  background: linear-gradient(100deg, #a78bfa 10%, #22d3ee 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero .sub {
  margin-top: 14px;
  color: var(--muted);
  font-size: clamp(0.95rem, 2.2vw, 1.05rem);
}

/* --------------------------------------------------------------- uploader */

.uploader {
  max-width: 780px;
  margin: 0 auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02));
  box-shadow: var(--shadow);
}

.dropzone {
  display: grid;
  place-items: center;
  min-height: 150px;
  padding: 24px;
  border: 1.5px dashed rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    transform 0.18s ease;
}

.dropzone:hover,
.dropzone.is-over {
  border-color: rgba(124, 92, 255, 0.7);
  background: rgba(124, 92, 255, 0.08);
}

.dropzone.is-over {
  transform: translateY(-1px);
}

.dz-idle {
  display: grid;
  justify-items: center;
  gap: 6px;
  text-align: center;
}

.dz-idle strong {
  font-size: 15.5px;
  font-weight: 600;
}

.dz-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 4px;
  border-radius: 14px;
  color: #cfc4ff;
  background: rgba(124, 92, 255, 0.16);
  border: 1px solid rgba(124, 92, 255, 0.3);
}

.dz-icon .icon {
  width: 22px;
  height: 22px;
}

.dz-hint {
  color: var(--muted);
  font-size: 12.5px;
}

.file-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 520px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--panel-strong);
  text-align: left;
}

.chip-ext {
  display: grid;
  place-items: center;
  min-width: 46px;
  height: 46px;
  padding: 0 6px;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(135deg, #7c5cff, #c026d3);
}

.chip-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.chip-name {
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-size {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-x {
  flex: none;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.chip-x:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.fields {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 12px;
  margin-top: 14px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.field-label em {
  font-style: normal;
  opacity: 0.7;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 52px;
  max-height: 180px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.45;
}

textarea::placeholder {
  color: rgba(255, 255, 255, 0.28);
}

textarea:focus {
  border-color: rgba(124, 92, 255, 0.55);
  outline: none;
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.14);
}

.progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.progress .bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress .bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #a78bfa, #22d3ee);
  transition: width 0.15s ease;
}

.progress span {
  font-size: 12px;
  color: var(--muted);
  min-width: 92px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.notice {
  margin-top: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 12.5px;
  color: #ffd9a8;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.28);
}

/* ---------------------------------------------------------------- sections */

.pinned-section,
.pile {
  margin-top: clamp(30px, 5vw, 46px);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head h2 {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #c9cde0;
}

.pill {
  font-size: 11.5px;
  color: #c9bcff;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(124, 92, 255, 0.14);
  border: 1px solid rgba(124, 92, 255, 0.3);
}

.tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
}

.search .icon {
  position: absolute;
  left: 10px;
  width: 15px;
  height: 15px;
  color: var(--muted);
  pointer-events: none;
}

.search input,
select {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  font-size: 13px;
}

.search input {
  width: 190px;
  padding: 0 10px 0 31px;
}

select {
  padding: 0 8px;
  cursor: pointer;
}

.search input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.search input:focus,
select:focus {
  border-color: rgba(124, 92, 255, 0.55);
  outline: none;
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.14);
}

/* ------------------------------------------------------------ pinned strip */

.pinned-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(180px, 220px);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x proximity;
}

.pin-tile {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(124, 92, 255, 0.32);
  background: var(--bg-soft);
  scroll-snap-align: start;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
}

.pin-media {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  cursor: zoom-in;
}

.pin-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pin-cap {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 22px 10px 8px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.82));
}

.pin-name {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pin-unpin {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.pin-unpin:hover {
  background: rgba(255, 92, 122, 0.85);
  border-color: transparent;
}

/* ------------------------------------------------------------------- grid */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 14px;
}

.card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015));
  overflow: hidden;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
}

.card.is-pinned {
  border-color: rgba(124, 92, 255, 0.35);
}

.thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  background:
    radial-gradient(240px 140px at 50% 20%, rgba(124, 92, 255, 0.14), transparent 70%),
    #0a0c12;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
  transition: transform 0.3s ease;
}

.card:hover .thumb img {
  transform: scale(1.03);
}

.fileicon {
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  border-radius: 16px;
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.fileicon-ext {
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.06em;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.cat-image {
  background: linear-gradient(135deg, #7c5cff, #c026d3);
}

.cat-video {
  background: linear-gradient(135deg, #fb923c, #ef4444);
}

.cat-audio {
  background: linear-gradient(135deg, #22d3ee, #3b82f6);
}

.cat-archive {
  background: linear-gradient(135deg, #f59e0b, #b45309);
}

.cat-doc {
  background: linear-gradient(135deg, #38bdf8, #6366f1);
}

.cat-code {
  background: linear-gradient(135deg, #34d399, #0ea5e9);
}

.cat-other {
  background: linear-gradient(135deg, #64748b, #334155);
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 13px 14px 14px;
  flex: 1;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.card-name {
  font-size: 14px;
  font-weight: 620;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.badge {
  flex: none;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  color: #d6cbff;
  background: rgba(124, 92, 255, 0.18);
  border: 1px solid rgba(124, 92, 255, 0.38);
}

.card-desc {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.dot {
  opacity: 0.5;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: auto;
  padding-top: 8px;
}

.empty {
  padding: 54px 20px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.015);
}

.empty-title {
  font-weight: 600;
  font-size: 15px;
}

.empty-sub {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

/* ----------------------------------------------------------------- footer */

.footer {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 40px;
  display: flex;
  justify-content: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.3);
  font-size: 11.5px;
}

/* ----------------------------------------------------------------- dialog */

.dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: #0d0f16;
  color: var(--text);
  box-shadow: var(--shadow);
}

.dialog::backdrop {
  background: rgba(3, 4, 8, 0.72);
  backdrop-filter: blur(4px);
}

.dialog form {
  display: grid;
  gap: 12px;
  padding: 22px;
}

.dialog h2 {
  font-size: 17px;
  letter-spacing: -0.01em;
}

.dialog-copy {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.dialog-copy code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11.5px;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
}

.dialog input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.3);
  font-size: 13.5px;
}

.dialog input:focus {
  border-color: rgba(124, 92, 255, 0.55);
  outline: none;
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.14);
}

.dialog-error {
  min-height: 16px;
  color: var(--danger);
  font-size: 12px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.link {
  justify-self: start;
  border: 0;
  background: none;
  padding: 0;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link.danger {
  color: var(--danger);
}

/* --------------------------------------------------------------- lightbox */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 24px;
  background: rgba(3, 4, 8, 0.92);
  cursor: zoom-out;
}

.lightbox img {
  max-width: min(100%, 1100px);
  max-height: 82vh;
  border-radius: 12px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7);
}

.lightbox-caption {
  max-width: min(100%, 760px);
  color: rgba(255, 255, 255, 0.65);
  font-size: 12.5px;
  text-align: center;
  overflow-wrap: anywhere;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 18px;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.14);
}

/* ------------------------------------------------------------------ toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 80;
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: #14161f;
  color: var(--text);
  font-size: 13px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  animation: toast-in 0.18s ease-out;
}

.toast.ok {
  border-color: rgba(53, 224, 161, 0.4);
}

.toast.error {
  border-color: rgba(255, 92, 122, 0.45);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 700px) {
  .topbar {
    flex-wrap: wrap;
  }

  .stats {
    display: none;
  }

  .fields {
    grid-template-columns: 1fr;
  }

  .fields .btn.primary {
    width: 100%;
  }

  .section-head {
    flex-wrap: wrap;
  }

  .tools {
    width: 100%;
  }

  .search {
    flex: 1;
  }

  .search input {
    width: 100%;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
    gap: 10px;
  }

  .card-body {
    padding: 11px 12px 12px;
  }

  .card-actions {
    gap: 2px;
  }

  .btn.ghost-sm {
    padding: 5px 7px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
