@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/IBMPlexSans-Light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/IBMPlexSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/IBMPlexSans-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/fonts/IBMPlexMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/fonts/IBMPlexMono-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Material Symbols Sharp";
  src: url("/static/fonts/MaterialSymbolsSharp.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: block;
}

:root {
  --canvas: #c9c3b8;
  --canvas-deep: #b8b0a3;
  --paper: #e6e1d7;
  --paper-bright: #f0ece4;
  --ink: #171714;
  --ink-soft: #57554f;
  --muted: #827d73;
  --rule: #aaa397;
  --rule-dark: #817a6e;
  --gold: #a98018;
  --gold-deep: #795b0b;
  --gold-pale: #d8c894;
  --shadow: 0 18px 55px rgb(36 31 22 / 14%);
  --sans: "IBM Plex Sans", Arial, sans-serif;
  --mono: "IBM Plex Mono", monospace;
}

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

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, transparent 0 49.8%, rgb(255 255 255 / 5%) 50%, transparent 50.2%),
    var(--canvas);
  font-family: var(--sans);
  font-weight: 300;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background:
    radial-gradient(circle at 12% 18%, rgb(169 128 24 / 13%), transparent 24rem),
    radial-gradient(circle at 88% 74%, rgb(255 255 255 / 17%), transparent 30rem);
  content: "";
  pointer-events: none;
}

body.dialog-open {
  overflow: hidden;
}

a,
button,
input,
select {
  font: inherit;
}

button,
select {
  color: inherit;
}

.ms {
  font-family: "Material Symbols Sharp";
  font-size: 20px;
  font-style: normal;
  font-weight: 300;
  line-height: 1;
  vertical-align: middle;
}

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

.top-rule {
  height: 6px;
  background: var(--ink);
}

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  min-height: 58px;
  padding: 0 32px;
  border-bottom: 1px solid var(--rule-dark);
  background: rgb(201 195 184 / 93%);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-decoration: none;
  text-transform: uppercase;
}

.brand-mark {
  width: 12px;
  height: 12px;
  background: var(--gold);
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 220ms ease;
}

.brand:hover .brand-mark,
.brand:focus-visible .brand-mark {
  box-shadow: 3px 3px 0 var(--ink);
  transform: rotate(45deg) scale(0.9);
}

.topbar-path {
  min-width: 0;
  margin-left: 34px;
  overflow: hidden;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-stats {
  display: flex;
  gap: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.stats-separator {
  color: var(--gold-deep);
}

.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 58px 0 72px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding: 0 4px 32px;
  border-bottom: 1px solid var(--rule-dark);
}

.eyebrow,
.dialog-kicker {
  margin: 0 0 12px;
  color: var(--gold-deep);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  max-width: 780px;
  margin: 0;
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: clamp(30px, 4.2vw, 56px);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 18px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.breadcrumbs a {
  color: var(--ink-soft);
  text-decoration-color: transparent;
  text-underline-offset: 3px;
}

.breadcrumbs a:hover {
  color: var(--gold-deep);
  text-decoration-color: currentColor;
}

.back-link {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--rule-dark);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
  transition: 150ms ease;
}

.back-link:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper-bright);
}

.controls {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 18px;
  align-items: end;
  padding: 24px;
  border: 1px solid var(--rule-dark);
  border-bottom-color: var(--rule);
  border-radius: 14px 14px 0 0;
  background: rgb(230 225 215 / 58%);
  box-shadow: 0 12px 36px rgb(35 29 20 / 7%);
}

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

.search-field > .ms {
  position: absolute;
  left: 0;
  color: var(--gold-deep);
}

#search {
  width: 100%;
  height: 43px;
  padding: 0 54px 0 30px;
  border: 0;
  border-bottom: 2px solid var(--ink);
  border-radius: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
}

.search-shortcut {
  position: absolute;
  right: 8px;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  pointer-events: none;
}

.search-shortcut[hidden] {
  display: none;
}

.search-shortcut kbd {
  display: grid;
  width: 25px;
  height: 25px;
  border: 1px solid var(--rule-dark);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: rgb(240 236 228 / 72%);
  font-family: var(--mono);
  font-size: 10px;
  place-items: center;
}

#search::placeholder {
  color: var(--muted);
}

#search:focus {
  border-color: var(--gold-deep);
  background: rgb(255 255 255 / 18%);
}

.clear-search {
  position: absolute;
  right: 0;
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  place-items: center;
}

.clear-search .ms {
  font-size: 17px;
}

.sort-controls {
  display: grid;
  grid-template-columns: auto minmax(120px, 155px) 43px;
  align-items: center;
  gap: 10px;
}

.control-actions {
  display: flex;
  align-items: end;
  gap: 12px;
}

.sort-controls label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#sortKey,
.icon-button {
  height: 43px;
  border: 1px solid var(--rule-dark);
  border-radius: 7px;
  background: var(--paper);
}

.view-controls {
  display: inline-grid;
  grid-template-columns: repeat(2, 41px);
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--rule-dark);
  border-radius: 9px;
  background: rgb(201 195 184 / 58%);
}

.view-button {
  display: grid;
  width: 41px;
  height: 35px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, transform 150ms ease;
  place-items: center;
}

.view-button .ms {
  font-size: 18px;
}

.view-button:hover,
.view-button:focus-visible {
  color: var(--ink);
  transform: translateY(-1px);
}

.view-button.is-active {
  background: var(--ink);
  color: var(--paper-bright);
  box-shadow: 0 4px 12px rgb(23 23 20 / 18%);
}

#sortKey {
  padding: 0 34px 0 12px;
  outline: 0;
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
}

.icon-button {
  display: grid;
  padding: 0;
  cursor: pointer;
  place-items: center;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper-bright);
}

.file-panel {
  overflow: hidden;
  border: 1px solid var(--rule-dark);
  border-top: 0;
  border-radius: 0 0 14px 14px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.file-head,
.file-row {
  display: grid;
  grid-template-columns: 86px minmax(210px, 1fr) 150px 92px 150px 52px;
  align-items: center;
}

.file-head {
  min-height: 44px;
  padding: 0 15px;
  border-bottom: 1px solid var(--rule-dark);
  background: var(--ink);
  color: #d8d3c8;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.align-right {
  text-align: right;
}

.file-row {
  min-height: 80px;
  padding: 8px 15px;
  border-bottom: 1px solid var(--rule);
  animation: row-in 320ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  transition: background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.file-row:nth-child(2) { animation-delay: 35ms; }
.file-row:nth-child(3) { animation-delay: 70ms; }
.file-row:nth-child(4) { animation-delay: 105ms; }
.file-row:nth-child(n + 5) { animation-delay: 130ms; }

@keyframes row-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.file-row:last-child {
  border-bottom: 0;
}

.file-row:hover,
.file-row:focus-within {
  position: relative;
  z-index: 1;
  background: var(--paper-bright);
  box-shadow: inset 4px 0 0 var(--gold);
  transform: translateX(3px);
}

.file-row.is-directory:hover,
.file-row.is-directory:focus-within {
  background: #e7dbb5;
}

.preview-cell {
  display: flex;
  align-items: center;
}

.file-thumb {
  position: relative;
  display: grid;
  width: 66px;
  height: 50px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--rule-dark);
  border-radius: 7px;
  background: #d6d0c5;
  color: var(--ink-soft);
  cursor: pointer;
  text-decoration: none;
  place-items: center;
}

.icon-tile .ms {
  font-size: 25px;
}

.is-directory .icon-tile {
  border-color: var(--gold);
  background: var(--gold-pale);
  color: var(--gold-deep);
}

.file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 220ms ease, filter 220ms ease;
}

.file-thumb:hover img,
.file-thumb:focus-visible img {
  filter: brightness(0.74);
  transform: scale(1.055);
}

.thumb-overlay {
  position: absolute;
  opacity: 0;
  color: white;
  font-size: 22px;
  transition: opacity 150ms ease;
}

.file-thumb:hover .thumb-overlay,
.file-thumb:focus-visible .thumb-overlay {
  opacity: 1;
}

.thumb-fallback {
  display: none;
  color: var(--muted);
  font-size: 24px;
}

.file-thumb.has-error img,
.file-thumb.has-error .thumb-overlay {
  display: none;
}

.file-thumb.has-error .thumb-fallback {
  display: block;
}

.name-cell {
  min-width: 0;
  padding-right: 16px;
}

.file-name {
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  overflow-wrap: anywhere;
  text-decoration-color: transparent;
  text-underline-offset: 4px;
  transition: color 130ms ease, text-decoration-color 130ms ease;
}

.file-name:hover,
.file-name:focus-visible {
  color: var(--gold-deep);
  text-decoration-color: currentColor;
}

.extension-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 5px;
  background: #c5beb2;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  vertical-align: 2px;
}

.type-cell,
.size-cell,
.date-cell,
.mobile-meta {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.size-cell,
.date-cell {
  text-align: right;
  white-space: nowrap;
}

.mobile-meta {
  display: none;
}

.action-cell {
  display: flex;
  justify-content: flex-end;
}

.row-action {
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  place-items: center;
}

.row-action .ms {
  font-size: 18px;
}

.row-action:hover,
.row-action:focus-visible {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper-bright);
}

.empty-state {
  display: flex;
  min-height: 260px;
  padding: 40px 20px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  text-align: center;
}

.empty-state[hidden] {
  display: none;
}

.empty-state > .ms {
  margin-bottom: 18px;
  color: var(--rule-dark);
  font-size: 38px;
}

.empty-state strong {
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
}

.colophon {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 32px;
  padding: 15px 4px 0;
  border-top: 5px solid var(--ink);
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.file-panel[data-view="grid"] .file-head {
  display: none;
}

.file-panel[data-view="grid"] .file-rows {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
  gap: 15px;
  padding: 16px;
  background:
    linear-gradient(rgb(255 255 255 / 10%), rgb(255 255 255 / 10%)),
    var(--canvas);
}

.file-panel[data-view="grid"] .file-row {
  display: grid;
  min-width: 0;
  min-height: 254px;
  grid-template-areas:
    "preview preview preview"
    "name name action"
    "type type action"
    "size date date";
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 46px;
  grid-template-rows: 158px auto auto auto;
  align-items: center;
  padding: 0 0 13px;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--paper);
  box-shadow: 0 8px 22px rgb(35 29 20 / 8%);
}

.file-panel[data-view="grid"] .file-row:hover,
.file-panel[data-view="grid"] .file-row:focus-within {
  border-color: var(--rule-dark);
  box-shadow: 0 15px 32px rgb(35 29 20 / 16%);
  transform: translateY(-4px);
}

.file-panel[data-view="grid"] .preview-cell {
  align-self: stretch;
  grid-area: preview;
}

.file-panel[data-view="grid"] .file-thumb {
  width: 100%;
  height: 100%;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 9px 9px 0 0;
}

.file-panel[data-view="grid"] .icon-tile {
  background:
    radial-gradient(circle at 50% 38%, rgb(255 255 255 / 36%), transparent 34%),
    var(--gold-pale);
}

.file-panel[data-view="grid"] .icon-tile .ms {
  font-size: 48px;
  transition: transform 200ms ease;
}

.file-panel[data-view="grid"] .file-row:hover .icon-tile .ms {
  transform: translateY(-3px) rotate(-3deg) scale(1.05);
}

.file-panel[data-view="grid"] .name-cell {
  align-self: end;
  grid-area: name;
  padding: 13px 6px 0 14px;
}

.file-panel[data-view="grid"] .file-name {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-panel[data-view="grid"] .extension-badge {
  display: none;
}

.file-panel[data-view="grid"] .mobile-meta {
  display: none;
}

.file-panel[data-view="grid"] .type-cell {
  display: block;
  align-self: start;
  grid-area: type;
  padding: 5px 14px 10px;
}

.file-panel[data-view="grid"] .size-cell {
  display: block;
  grid-area: size;
  padding: 4px 0 0 14px;
  text-align: left;
}

.file-panel[data-view="grid"] .date-cell {
  display: block;
  grid-area: date;
  padding: 4px 14px 0 5px;
}

.file-panel[data-view="grid"] .action-cell {
  align-self: center;
  grid-area: action;
  padding-right: 10px;
}

.file-rows.is-reordering .file-row:not([hidden]) {
  animation: rearrange 260ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.file-rows.is-reordering .file-row:nth-child(2) {
  animation-delay: 25ms;
}

.file-rows.is-reordering .file-row:nth-child(3) {
  animation-delay: 50ms;
}

.file-rows.is-reordering .file-row:nth-child(n + 4) {
  animation-delay: 70ms;
}

@keyframes rearrange {
  from {
    opacity: 0.55;
    transform: translateY(7px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.preview-dialog {
  width: min(1160px, calc(100vw - 56px));
  max-width: none;
  height: min(860px, calc(100vh - 40px));
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--ink);
  overflow: visible;
}

.preview-dialog[open] {
  animation: dialog-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.preview-dialog[open]::backdrop {
  animation: backdrop-in 180ms ease both;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.preview-dialog::backdrop {
  background: rgb(19 18 15 / 76%);
  backdrop-filter: blur(14px) saturate(0.75);
}

.dialog-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  overflow: hidden;
  border: 1px solid #8f887b;
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 0 34px 110px rgb(0 0 0 / 48%);
}

.dialog-header,
.dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 20px;
}

.dialog-header {
  position: relative;
  z-index: 6;
  border-bottom: 1px solid var(--rule);
  background: rgb(240 236 228 / 94%);
  box-shadow: 0 8px 28px rgb(0 0 0 / 9%);
}

.dialog-kicker {
  margin-bottom: 5px;
}

.dialog-header h2 {
  max-width: min(70vw, 760px);
  margin: 0;
  overflow: hidden;
  font-size: 16px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dialog-close {
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--rule-dark);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: transform 160ms ease, background-color 160ms ease, color 160ms ease;
  place-items: center;
}

.dialog-close:hover,
.dialog-close:focus-visible {
  background: var(--ink);
  color: white;
  transform: rotate(7deg) scale(1.05);
}

.preview-stage {
  position: relative;
  display: block;
  min-height: 0;
  overflow: hidden;
  background: #211f1b;
}

.preview-canvas {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 300px;
  padding: clamp(24px, 3vw, 44px) clamp(68px, 7vw, 92px);
  overflow: hidden;
  background: #211f1b;
  isolation: isolate;
  place-items: center;
}

.preview-canvas::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    radial-gradient(circle at center, transparent 18%, rgb(17 16 14 / 34%) 100%),
    linear-gradient(180deg, rgb(255 255 255 / 4%), rgb(0 0 0 / 8%));
  content: "";
  pointer-events: none;
}

.preview-backdrop {
  position: absolute;
  z-index: -2;
  inset: -45px;
  width: calc(100% + 90px);
  height: calc(100% + 90px);
  opacity: 0;
  filter: blur(38px) brightness(0.45) saturate(0.85);
  object-fit: cover;
  transform: scale(1.08);
  transition: opacity 320ms ease;
}

.preview-backdrop.is-ready {
  opacity: 0.82;
}

#previewImage {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  grid-area: 1 / 1;
  min-width: 0;
  min-height: 0;
  opacity: 0;
  border-radius: 10px;
  box-shadow: 0 20px 62px rgb(0 0 0 / 38%);
  object-fit: contain;
  transform: scale(0.985);
  transition: opacity 240ms ease, transform 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

#previewImage.is-ready {
  opacity: 1;
  transform: none;
}

.preview-loading {
  position: relative;
  z-index: 3;
  display: flex;
  grid-area: 1 / 1;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  color: #aaa397;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.preview-loading[hidden] {
  display: none;
}

.loading-spinner {
  width: 34px;
  height: 34px;
  border: 2px solid rgb(255 255 255 / 18%);
  border-top-color: var(--gold-pale);
  border-radius: 50%;
  animation: spin 850ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.preview-error {
  position: relative;
  z-index: 3;
  display: flex;
  grid-area: 1 / 1;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  color: #c9c3b8;
  font-family: var(--mono);
  font-size: 11px;
}

.preview-error[hidden] {
  display: none;
}

.preview-error .ms {
  font-size: 38px;
}

.preview-navigation {
  position: absolute;
  z-index: 5;
  top: 50%;
  display: grid;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 24%);
  border-radius: 50%;
  background: rgb(17 16 14 / 54%);
  color: #eee9df;
  cursor: pointer;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgb(0 0 0 / 24%);
  transform: translateY(-50%);
  transition: background-color 150ms ease, border-color 150ms ease, transform 150ms ease;
  place-items: center;
}

.preview-navigation .ms {
  font-size: 28px;
}

.preview-navigation.previous {
  left: 18px;
}

.preview-navigation.next {
  right: 18px;
}

.preview-navigation:hover:not(:disabled),
.preview-navigation:focus-visible:not(:disabled) {
  border-color: rgb(255 255 255 / 54%);
  background: rgb(169 128 24 / 88%);
  color: white;
  transform: translateY(-50%) scale(1.08);
}

.preview-navigation:disabled {
  opacity: 0.3;
  cursor: default;
}

.preview-counter {
  position: absolute;
  z-index: 5;
  top: 16px;
  left: 50%;
  min-width: 54px;
  padding: 7px 11px;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 999px;
  background: rgb(17 16 14 / 48%);
  color: #e4ded3;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-align: center;
  backdrop-filter: blur(10px);
  transform: translateX(-50%);
}

.dialog-footer {
  border-top: 1px solid var(--rule);
  background: rgb(240 236 228 / 96%);
}

.preview-metadata {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.04em;
}

.preview-metadata span {
  padding: 6px 9px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: rgb(255 255 255 / 26%);
}

.dialog-actions {
  display: flex;
  gap: 10px;
}

.primary-action,
.secondary-action {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-decoration: none;
  text-transform: uppercase;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.primary-action {
  background: var(--ink);
  color: white;
}

.secondary-action {
  color: var(--ink);
}

.primary-action:hover,
.primary-action:focus-visible,
.secondary-action:hover,
.secondary-action:focus-visible {
  border-color: var(--gold-deep);
  background: var(--gold);
  color: var(--ink);
  transform: translateY(-1px);
}

:focus-visible {
  outline: 2px solid var(--gold-deep);
  outline-offset: 3px;
}

@media (max-width: 880px) {
  .file-head,
  .file-row {
    grid-template-columns: 82px minmax(190px, 1fr) 132px 82px 132px 44px;
  }

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

  .sort-controls {
    justify-content: end;
  }

  .control-actions {
    justify-content: flex-end;
  }
}

@media (max-width: 720px) {
  .topbar {
    min-height: 52px;
    padding: 0 16px;
  }

  .topbar-path {
    margin-left: 24px;
  }

  .stats-label,
  .stats-separator {
    display: none;
  }

  .topbar-stats {
    gap: 6px;
  }

  .topbar-stats span:first-child::after {
    content: "/";
    margin-left: 6px;
  }

  .page-shell {
    width: min(100% - 24px, 620px);
    padding: 34px 0 48px;
  }

  .hero {
    align-items: flex-start;
    padding-bottom: 22px;
    flex-direction: column;
  }

  .back-link {
    min-height: 38px;
  }

  .controls {
    padding: 16px;
    border-radius: 14px;
  }

  .control-actions {
    justify-content: space-between;
  }

  .sort-controls {
    grid-template-columns: 1fr 43px;
    justify-content: stretch;
  }

  .sort-controls label {
    grid-column: 1 / -1;
  }

  .file-panel {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .file-panel[data-view="grid"] .file-rows {
    gap: 10px;
    padding: 12px 0 0;
    background: transparent;
  }

  .file-panel[data-view="grid"] .file-row {
    min-height: 278px;
    grid-template-rows: 180px auto auto auto;
  }

  .file-head {
    display: none;
  }

  .file-rows {
    display: grid;
    gap: 9px;
    padding-top: 12px;
  }

  .file-row {
    display: grid;
    min-height: 82px;
    grid-template-areas:
      "preview name action"
      "preview name action";
    grid-template-columns: 78px minmax(0, 1fr) 38px;
    grid-template-rows: 1fr 1fr;
    padding: 10px;
    border: 1px solid var(--rule);
    background: var(--paper);
    box-shadow: 0 6px 16px rgb(35 29 20 / 7%);
  }

  .preview-cell {
    grid-area: preview;
  }

  .name-cell {
    grid-area: name;
    align-self: center;
    padding-right: 8px;
  }

  .action-cell {
    grid-area: action;
    align-self: center;
  }

  .type-cell,
  .size-cell,
  .date-cell {
    display: none;
  }

  .mobile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 7px;
    font-size: 8px;
    line-height: 1.45;
  }

  .extension-badge {
    display: none;
  }

  .file-name {
    display: block;
    font-size: 13px;
  }

  .empty-state {
    border: 1px solid var(--rule);
    background: var(--paper);
  }

  .preview-dialog {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
  }

  .dialog-shell {
    border: 0;
    border-radius: 0;
  }

  .dialog-header,
  .dialog-footer {
    padding: 14px;
  }

  .dialog-header h2 {
    max-width: calc(100vw - 100px);
    font-size: 14px;
  }

  .preview-stage {
    min-height: 0;
  }

  .preview-canvas {
    min-height: 220px;
    padding: 18px 46px;
  }

  #previewImage {
    border-radius: 7px;
  }

  .preview-navigation {
    width: 40px;
    height: 40px;
  }

  .preview-navigation.previous {
    left: 7px;
  }

  .preview-navigation.next {
    right: 7px;
  }

  .preview-counter {
    top: 10px;
    padding: 5px 9px;
  }

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

  .dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .primary-action,
  .secondary-action {
    padding: 0 8px;
  }
}

@media (max-width: 430px) {
  .topbar-path {
    display: none;
  }

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

  .page-shell {
    width: calc(100% - 18px);
  }

  .file-row {
    grid-template-columns: 70px minmax(0, 1fr) 36px;
    padding: 8px;
  }

  .file-thumb {
    width: 60px;
    height: 47px;
  }

  .colophon {
    font-size: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
