:root {
  color-scheme: dark;
  --bg: #000;
  --panel: #070707;
  --panel-2: #101214;
  --panel-3: #1a1d20;
  --ink: #f5f5f5;
  --muted: #8d8d8d;
  --line: #24282b;
  --line-strong: #444b52;
  --accent: #ffffff;
  --accent-ink: #000000;
  --danger: #ff5f57;
  --danger-bg: #251010;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #000;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
  cursor: pointer;
  overflow-wrap: anywhere;
  white-space: normal;
}

button:hover {
  filter: brightness(0.92);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

button.secondary,
button.ghostButton {
  border-color: var(--line);
  background: var(--panel-2);
  color: var(--ink);
}

button.danger {
  border-color: #49201f;
  background: var(--danger-bg);
  color: var(--danger);
}

.hidden {
  display: none !important;
}

.app {
  width: min(1280px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(10px, 2vw, 18px);
}

.homeView {
  min-height: calc(100vh - 28px);
  display: none;
  place-items: center;
}

.homeView.active {
  display: grid;
}

.homeInner {
  width: min(560px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #101214, #030303);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 46px;
  line-height: 1;
}

h2 {
  font-size: 20px;
  line-height: 1.1;
}

.homeActions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 26px;
}

.homeButton {
  min-height: 86px;
  font-size: 20px;
}

.secondaryHome {
  border-color: var(--line);
  background: var(--panel-2);
  color: var(--ink);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  background: rgba(0, 0, 0, 0.86);
  backdrop-filter: blur(14px);
}

#currentPath {
  margin-top: 4px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.iconButton {
  width: 44px;
  padding: 0;
  font-size: 22px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 5px;
  margin: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050505;
}

.tab {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.tab.active {
  background: var(--panel-3);
  color: var(--ink);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.uploadPanel,
.noteEditor,
.noteSearch,
.trashToolbar,
.lockPanel,
.settingsPanel,
.webhardHero,
.fileControls,
.listTools {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #090a0b, #050505);
  box-shadow: var(--shadow);
}

.webhardHero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.breadcrumb button {
  min-height: 34px;
  border-color: var(--line);
  background: var(--panel-2);
  color: var(--ink);
}

.breadcrumb span {
  color: var(--muted);
}

.folderStats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  color: var(--muted);
}

.heroStats {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.folderStats span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #030303;
}

.storageStats {
  width: min(360px, 100%);
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #030303;
}

.storageText {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
}

.storageText strong {
  color: var(--ink);
}

.storageBar {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #171717;
}

.storageBar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #fff;
}

.storageStats.warning .storageBar span {
  background: var(--danger);
}

.lockPanel {
  max-width: 520px;
  margin: 32px auto;
}

.lockPanel h3,
.settingsPanel h3 {
  margin: 0 0 8px;
}

.lockPanel p {
  margin: 0 0 14px;
  color: var(--muted);
}

.panelHint {
  margin: -2px 0 4px;
  color: var(--muted);
  line-height: 1.45;
}

.lockForm,
.settingsPanel {
  display: grid;
  gap: 10px;
}

.upload {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
}

.filePick {
  min-height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--ink);
  font-weight: 900;
  text-align: center;
}

.filePick input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.pickedFiles {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #030303;
  color: var(--muted);
  line-height: 1.4;
}

.pickedFiles.ready {
  border-color: #4a4a4a;
  color: var(--ink);
}

.pickedFiles strong,
.pickedFiles span,
.pickedFiles small {
  display: block;
}

.pickedFiles small {
  margin-top: 4px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.drop {
  margin-top: 10px;
  min-height: 96px;
  display: grid;
  place-items: center;
  gap: 4px;
  border: 1px dashed #3d3d3d;
  border-radius: 8px;
  background: #030303;
  color: var(--muted);
  text-align: center;
}

.drop strong {
  color: var(--ink);
}

.drop.active {
  border-color: #f5f5f5;
  background: #111;
}

.status {
  min-height: 22px;
  margin-top: 8px;
  color: #bdbdbd;
  font-weight: 800;
}

.status[data-mode="ok"] {
  color: #e9e9e9;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0 10px;
}

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

.segmented {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.filter {
  min-height: 38px;
  border-color: var(--line);
  background: var(--panel-2);
  color: var(--muted);
  white-space: nowrap;
}

.filter.active {
  background: var(--accent);
  color: var(--accent-ink);
}

.mediaGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: clamp(10px, 1.6vw, 16px);
}

.mediaCard,
.note {
  position: relative;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.mediaCard:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  background: #0b0b0b;
}

.mediaCard {
  display: grid;
  grid-template-rows: auto auto auto auto;
}

.mediaCard.dropTarget {
  border-color: #fff;
  background: #111;
  box-shadow: inset 0 0 0 1px #fff;
}

.compactMode .mediaGrid {
  grid-template-columns: 1fr;
}

.compactMode .mediaCard {
  grid-template-columns: 42px 76px 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
}

.compactMode .selectBox {
  position: static;
  margin-left: 12px;
}

.compactMode .preview {
  width: 76px;
  aspect-ratio: 1;
}

.compactMode .mediaTitle {
  padding: 0 10px;
}

.compactMode .mediaMeta {
  grid-column: 3;
  padding: 0 10px;
}

.compactMode .cardActions {
  grid-column: 4;
  grid-row: 1 / span 2;
  min-width: 220px;
}

.selectBox {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 4;
  width: 24px;
  height: 24px;
  accent-color: #fff;
}

.preview {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #050505;
  color: #fff;
  font-size: 20px;
  overflow: hidden;
}

.preview img,
.preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mediaCard.video .preview {
  aspect-ratio: 9 / 14;
}

.fileGlyph {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-align: center;
  line-height: 1.1;
}

.badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.mediaTitle {
  padding: 10px 10px 0;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.mediaMeta {
  padding: 5px 10px 0;
  color: var(--muted);
  font-size: 13px;
}

.cardActions,
.noteActions,
.editorActions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 8px;
  padding: 10px;
}

.cardActions button,
.noteActions button {
  min-width: 0;
  padding: 0 8px;
  font-size: 14px;
}

.selectionBar {
  position: sticky;
  top: 76px;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 7, 7, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.selectionBar strong {
  margin-right: auto;
}

.listTools {
  display: grid;
  grid-template-columns: minmax(170px, 220px) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  box-shadow: none;
}

.pageSizeControl {
  min-height: 48px;
  border-color: var(--line-strong);
  background: #050505;
}

.pageSizeControl span {
  color: var(--ink);
  font-size: 13px;
}

.toolHint {
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  line-height: 1.35;
}

.noteEditor {
  display: grid;
  gap: 10px;
}

textarea,
input[type="search"],
input[type="password"],
select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #030303;
  color: var(--ink);
}

textarea {
  resize: vertical;
  padding: 14px;
  line-height: 1.55;
}

input[type="search"] {
  min-height: 44px;
  padding: 0 12px;
}

input[type="password"] {
  min-height: 44px;
  padding: 0 12px;
}

select {
  min-height: 44px;
  padding: 0 12px;
}

.fileControls {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(150px, 220px);
  gap: 10px;
  margin-bottom: 12px;
  box-shadow: none;
}

.controlGroup {
  min-width: 0;
  min-height: 44px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #030303;
}

.controlGroup select {
  appearance: auto;
}

.controlGroup span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.controlGroup select {
  min-height: 34px;
  padding: 0 8px;
  border-color: transparent;
  background: transparent;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.pager span {
  min-width: 76px;
  color: var(--muted);
  font-weight: 900;
  text-align: center;
}

.settingsGrid {
  display: grid;
  grid-template-columns: minmax(240px, 360px) minmax(280px, 1fr);
  gap: 12px;
}

.settingsGrid .settingsPanel:last-child {
  grid-column: 1 / -1;
}

.logHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.logHeader > div {
  min-width: 0;
}

.folderLockList {
  display: grid;
  gap: 10px;
}

.folderLockItem {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #030303;
}

.folderLockInfo {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.folderLockInfo strong {
  overflow-wrap: anywhere;
}

.folderLockInfo span {
  color: var(--muted);
  font-size: 13px;
}

.folderLockActions {
  display: grid;
  grid-template-columns: repeat(3, minmax(74px, auto));
  gap: 8px;
}

.logList {
  display: grid;
  gap: 8px;
  max-height: 520px;
  overflow: auto;
}

.logItem {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #030303;
}

.logAction {
  font-weight: 900;
}

.logMeta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.editorActions {
  justify-content: flex-end;
  padding: 0;
}

.noteSearch {
  margin-top: 12px;
  box-shadow: none;
}

.notesList {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.note {
  padding: 12px;
}

.noteText {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.55;
}

.noteMeta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.noteActions {
  padding: 10px 0 0;
}

.empty {
  grid-column: 1 / -1;
  padding: 30px 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #030303;
  color: var(--muted);
  text-align: center;
}

.viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px;
  background: rgba(0, 0, 0, 0.96);
  backdrop-filter: blur(16px);
}

.viewerTop {
  width: min(1180px, 100%);
  justify-self: center;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(10, 10, 10, 0.78);
}

.viewerCounter {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.viewerTitle {
  margin-top: 3px;
  color: #fff;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewerClose {
  width: 46px;
  padding: 0;
  background: rgba(255, 255, 255, 0.11);
  color: #fff;
  font-size: 24px;
}

.viewerBody {
  width: 100%;
  min-height: 0;
  max-width: 1180px;
  max-height: 100%;
  justify-self: center;
  display: grid;
  place-items: center;
  overflow: auto;
  overscroll-behavior: contain;
}

.viewerBody img,
.viewerBody video {
  max-width: 100%;
  max-height: calc(100vh - 176px);
  border-radius: 8px;
  background: #050505;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.55);
}

.viewerBody img {
  cursor: zoom-in;
  object-fit: contain;
}

.viewer.zoomed .viewerBody {
  place-items: start center;
}

.viewer.zoomed .viewerBody img {
  max-width: none;
  max-height: none;
  width: min(1600px, 160vw);
  cursor: zoom-out;
}

.videoStage {
  position: relative;
  width: min(100%, 1080px);
  display: grid;
  place-items: center;
}

.videoStage video {
  width: 100%;
}

.videoOverlay {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 14px;
  display: flex;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.16s ease;
  pointer-events: none;
}

.videoStage:hover .videoOverlay,
.viewer:fullscreen .videoOverlay {
  opacity: 1;
  pointer-events: auto;
}

.videoOverlay button {
  min-height: 38px;
  background: rgba(10, 10, 10, 0.72);
  border-color: rgba(255, 255, 255, 0.18);
}

.viewerFooter {
  width: min(1180px, 100%);
  justify-self: center;
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(5, auto);
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(10, 10, 10, 0.78);
}

.viewerCaption {
  min-width: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
  font-size: 13px;
}

.viewerNav {
  position: fixed;
  top: 50%;
  width: 48px;
  height: 64px;
  padding: 0;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.11);
  color: #fff;
  font-size: 42px;
  z-index: 101;
}

.viewerNav.prev {
  left: 10px;
}

.viewerNav.next {
  right: 10px;
}

.viewer:fullscreen {
  padding: 14px;
}

.viewer:fullscreen .viewerBody {
  max-width: 100vw;
}

.viewer:fullscreen .viewerBody img,
.viewer:fullscreen .viewerBody video {
  max-height: calc(100vh - 176px);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.78);
}

.modalPanel {
  width: min(520px, 100%);
  max-height: min(680px, calc(100vh - 36px));
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #050505;
  box-shadow: var(--shadow);
}

.modalHeader,
.modalActions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.modalHeader h3 {
  margin: 0;
  font-size: 20px;
}

.modalHeader p {
  margin-top: 4px;
  color: var(--muted);
}

.modalHint {
  margin: -4px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.iconButton {
  width: 42px;
  padding: 0;
}

.moveTargetList {
  display: grid;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}

.moveSectionTitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.moveSectionTitle:first-child {
  margin-top: 0;
}

.moveTarget {
  min-height: 56px;
  display: grid;
  justify-items: start;
  padding: 10px 12px;
  border-color: var(--line);
  background: var(--panel-2);
  color: var(--ink);
  text-align: left;
}

.moveTarget small {
  margin-top: 3px;
  color: var(--muted);
  font-weight: 600;
}

.small {
  padding: 14px;
}

@media (max-width: 700px) {
  .app {
    padding: 10px;
  }

  h1 {
    font-size: 38px;
  }

  .homeActions,
  .upload,
  .viewerFooter,
  .settingsGrid,
  .webhardHero,
  .fileControls,
  .listTools {
    grid-template-columns: 1fr;
  }

  .settingsGrid .settingsPanel:last-child {
    grid-column: auto;
  }

  .topbar {
    grid-template-columns: auto 1fr auto;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbarActions,
  .selectionBar {
    width: 100%;
    flex-wrap: wrap;
  }

  .selectionBar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .selectionBar strong {
    grid-column: 1 / -1;
  }

  .viewerFooter {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .viewerCaption {
    grid-column: 1 / -1;
  }

  .viewer {
    padding: 8px;
    gap: 8px;
  }

  .viewerTop,
  .viewerFooter {
    padding: 8px;
  }

  .viewerBody img,
  .viewerBody video {
    max-height: calc(100vh - 190px);
  }

  .viewer.zoomed .viewerBody img {
    width: 190vw;
  }

  .videoOverlay {
    display: none;
  }

  .folderLockItem,
  .folderLockActions {
    grid-template-columns: 1fr;
  }

  .toolbarActions button,
  .selectionBar button {
    flex: 1;
  }

  .mediaGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .preview,
  .mediaCard.video .preview {
    aspect-ratio: 3 / 4;
  }

  .cardActions,
  .noteActions {
    flex-direction: column;
  }

  .folderStats {
    justify-content: flex-start;
  }

  .heroStats {
    justify-items: stretch;
  }

  .storageStats {
    width: 100%;
  }

  .storageText {
    flex-direction: column;
    gap: 3px;
  }

  .compactMode .mediaCard {
    grid-template-columns: 34px 64px 1fr;
  }

  .compactMode .preview {
    width: 64px;
  }

  .compactMode .cardActions {
    grid-column: 1 / -1;
    grid-row: auto;
    min-width: 0;
  }

  .viewerNav {
    display: none;
  }
}

@media (min-width: 1100px) {
  .mediaGrid {
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  }
}
