:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #eeeeef;
  background: #1c1d20;
  font-synthesis: none;
  --text: #eeeeef;
  --surface: #232428;
  --surface-raised: #2b2c31;
  --line: #3b3d44;
  --line-strong: #51535d;
  --muted: #b8b9bf;
  --soft: #323338;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  overflow: auto;
  background: #1c1d20;
  color: var(--text);
}

button, input { font: inherit; }

button { color: inherit; }

.workspace {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(22rem, 48dvh) minmax(24rem, 52dvh);
  min-height: 100dvh;
}

.directory {
  min-width: 0;
  display: grid;
  grid-template-rows: 3.25rem 3.25rem 2.75rem 1fr;
  border-bottom: 1px solid var(--line-strong);
  background: var(--surface);
}

.rail, .viewer-bar {
  display: flex;
  align-items: center;
  min-width: 0;
  border-bottom: 1px solid var(--line);
}

.rail { padding: 0 1rem; gap: .75rem; }

.mark {
  margin-right: auto;
  color: inherit;
  font-size: .875rem;
  font-weight: 750;
  letter-spacing: .06em;
  text-decoration: none;
}

.quiet {
  padding: .25rem 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  cursor: pointer;
  font-size: .75rem;
  line-height: 1;
}

.quiet:hover, .quiet:focus-visible { border-bottom-width: 2px; }

.state, .meta {
  color: var(--muted);
  font-size: .75rem;
  white-space: nowrap;
}

.search {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: 0 1rem;
  border-bottom: 1px solid var(--line);
}

.search input {
  width: 100%;
  min-width: 0;
  padding: .5rem 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  font-size: .875rem;
}

.search input::placeholder { color: #a4a4aa; }

kbd {
  color: #a4a4aa;
  font: inherit;
  font-size: .6875rem;
}

.tree {
  overflow: auto;
  padding: .5rem 0 2rem;
  scrollbar-width: thin;
}

.location {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 0 1rem;
  border-bottom: 1px solid var(--line);
}

.back {
  flex: 0 0 auto;
  padding: .2rem 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: var(--muted);
  font-size: .75rem;
  cursor: pointer;
}

.breadcrumb {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: .75rem;
}

.breadcrumb ol {
  display: flex;
  align-items: center;
  gap: .4rem;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  white-space: nowrap;
}

.breadcrumb li {
  display: flex;
  align-items: center;
  gap: .4rem;
  min-width: 0;
}

.breadcrumb li:not(:last-child)::after { content: '/'; color: #77777f; }

.breadcrumb a {
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  text-overflow: ellipsis;
}

.breadcrumb a:hover,
.breadcrumb a:focus-visible,
.breadcrumb a[aria-current="page"],
.breadcrumb-current { color: var(--text); }

.row {
  width: 100%;
  min-height: 2.25rem;
  display: grid;
  grid-template-columns: 1rem minmax(0, 1fr) auto;
  align-items: center;
  gap: .45rem;
  padding: .55rem 1rem;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.row:hover { background: var(--soft); }

.row:focus-visible { outline: 1px solid var(--text); outline-offset: -1px; }

.row[aria-current="true"] {
  background: #ededf0;
  color: #171719;
}

.glyph {
  color: var(--muted);
  font-size: .75rem;
  font-variant-numeric: tabular-nums;
}

.row[aria-current="true"] .glyph,
.row[aria-current="true"] .ext { color: #171719; }

.name {
  display: block;
  overflow: hidden;
  font-size: .875rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.row-context {
  display: block;
  margin-top: .15rem;
  overflow: hidden;
  color: var(--muted);
  font-size: .6875rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row[aria-current="true"] .row-context { color: #4f5057; }

.folder .name { font-weight: 640; }

.ext {
  color: #a4a4aa;
  font-size: .6875rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.folder .ext { text-transform: none; }

.directory-empty {
  margin: 1.25rem 1rem;
  color: var(--muted);
  font-size: .8125rem;
}

.viewer {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 3.25rem 1fr;
  min-height: 52dvh;
  background: var(--surface-raised);
}

.viewer-bar {
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1rem;
  background: var(--surface);
}

.path {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: .8125rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-actions { display: flex; align-items: center; gap: .75rem; }

.canvas {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: auto;
}

.preview-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.pdf-preview {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: 2.75rem 1fr;
}

.pdf-controls {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  background: #242529;
}

.pdf-controls button {
  padding: .25rem 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: var(--text);
  font-size: .75rem;
  cursor: pointer;
}

.pdf-controls button:disabled {
  color: #77777f;
  cursor: default;
}

.pdf-count {
  min-width: 4rem;
  color: var(--muted);
  font-size: .75rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.pdf-stage {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 1rem;
  text-align: center;
}

.pdf-page {
  display: block;
  max-width: 100%;
  margin: 0 auto;
  background: #fff;
  outline: 1px solid #424248;
}

.preview-image {
  display: block;
  max-width: calc(100% - 2rem);
  max-height: calc(100% - 2rem);
  margin: 1rem;
  object-fit: contain;
}

.preview-media { width: min(48rem, calc(100% - 2rem)); }

.preview-text {
  align-self: stretch;
  justify-self: stretch;
  margin: 0;
  padding: clamp(1rem, 4vw, 4rem);
  overflow: auto;
  background: var(--surface);
  color: var(--text);
  font: 400 .9375rem/1.65 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.empty {
  max-width: 28rem;
  margin: 2rem;
  color: var(--muted);
  font-size: .875rem;
  text-align: center;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 10;
  max-width: min(28rem, calc(100vw - 2rem));
  padding: .65rem .8rem;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font-size: .8125rem;
}

.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;
}

@media (min-width: 761px) {
  body { overflow: hidden; }

  .workspace {
    grid-template-columns: minmax(18rem, 23rem) 1fr;
    grid-template-rows: 1fr;
    height: 100dvh;
  }

  .directory { border-right: 1px solid var(--line-strong); border-bottom: 0; }
  .viewer { min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
