:root {
  --bg: #000000;
  --fg: #ffffff;
  --muted: rgba(255, 255, 255, 0.5);
  --line: rgba(255, 255, 255, 0.16);
  --line-strong: rgba(255, 255, 255, 0.82);
  --hover: rgba(255, 255, 255, 0.06);
  --selected: rgba(255, 255, 255, 0.1);
  --button-bg: #ffffff;
  --button-fg: #000000;
  --danger: #ff8c8c;
  --backdrop: rgba(0, 0, 0, 0.66);
  --window-shadow: 0 32px 90px rgba(0, 0, 0, 0.62);
  --window-inset: 16px;
  --window-radius: 16px;
  --tree-width: 236px;
  --font-sans: "Segoe UI Variable Display", "Segoe UI", "Helvetica Neue", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  --font-mono: "Cascadia Mono", "SFMono-Regular", "Roboto Mono", "Consolas", monospace;
}

[data-theme="light"] {
  --bg: #ffffff;
  --fg: #000000;
  --muted: rgba(0, 0, 0, 0.5);
  --line: rgba(0, 0, 0, 0.16);
  --line-strong: rgba(0, 0, 0, 0.82);
  --hover: rgba(0, 0, 0, 0.045);
  --selected: rgba(0, 0, 0, 0.075);
  --button-bg: #000000;
  --button-fg: #ffffff;
  --danger: #b42318;
  --backdrop: rgba(255, 255, 255, 0.66);
  --window-shadow: 0 24px 70px rgba(0, 0, 0, 0.13);
}

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

html,
body {
  height: 100%;
}

html {
  background: var(--bg);
  color-scheme: dark;
}

[data-theme="light"] {
  color-scheme: light;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

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

::selection {
  background: var(--fg);
  color: var(--bg);
}

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

/* -------------------------------------------------------------------------- */
/* Access gate                                                                */
/* -------------------------------------------------------------------------- */

.access-gate {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100vh;
  height: 100svh;
  padding: 72px 24px;
  overflow-y: auto;
  background: var(--bg);
  animation: gate-appear 450ms ease both;
}

.gate-actions {
  position: fixed;
  top: 20px;
  right: clamp(20px, 4.4vw, 64px);
  z-index: 2;
  display: flex;
  gap: 4px;
  align-items: center;
}

.gate-main {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100%;
}

.gate-panel {
  width: min(100%, 360px);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--window-radius);
  background: var(--bg);
  box-shadow: var(--window-shadow);
  animation: gate-panel-in 550ms 60ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.gate-label {
  margin: 0 0 16px;
  color: var(--fg);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.18em;
  line-height: 1;
  text-align: center;
  text-indent: 0.18em;
}

.gate-login-icon {
  display: grid;
  width: 38px;
  height: 38px;
  margin: 0 auto 18px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
}

.gate-login-icon svg {
  width: 18px;
  height: 18px;
}

.gate-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gate-form input {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: transparent;
  color: var(--fg);
  font-size: 13px;
}

.gate-form input:focus {
  border-color: var(--line-strong);
}

.gate-form input::placeholder {
  color: var(--muted);
}

.gate-submit {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--fg);
  border-radius: 8px;
  background: var(--button-bg);
  color: var(--button-fg);
  font-size: 12px;
}

.gate-submit:hover,
.gate-submit:focus-visible {
  opacity: 0.84;
}

.gate-submit:disabled,
.gate-public:disabled {
  cursor: wait;
  opacity: 0.45;
}

.gate-error {
  min-height: 16px;
  margin: 7px 0 0;
  color: var(--danger);
  font-size: 10px;
  line-height: 1.4;
  text-align: center;
}

.gate-public {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 36px;
  margin-top: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}

.gate-public:hover,
.gate-public:focus-visible {
  color: var(--fg);
}

.gate-public svg {
  width: 14px;
  height: 14px;
  flex: none;
}

/* -------------------------------------------------------------------------- */
/* Motion                                                                     */
/* -------------------------------------------------------------------------- */

@keyframes gate-appear {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes gate-panel-in {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes explorer-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

/* -------------------------------------------------------------------------- */
/* Window                                                                     */
/* -------------------------------------------------------------------------- */

.explorer {
  position: fixed;
  inset: var(--window-inset);
  display: flex;
  flex-direction: column;
  width: auto;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--window-radius);
  background: var(--bg);
  box-shadow: var(--window-shadow);
  overflow: hidden;
  animation: explorer-in 450ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.titlebar {
  display: flex;
  flex: none;
  align-items: flex-end;
  height: 46px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
}

.tabs {
  display: flex;
  align-items: flex-end;
  height: 100%;
}

.tab {
  display: flex;
  gap: 8px;
  align-items: center;
  height: 34px;
  padding: 0 8px 0 10px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
  color: var(--fg);
  font-size: 12px;
  line-height: 1;
}

.tab > svg {
  width: 14px;
  height: 14px;
  flex: none;
  color: var(--muted);
}

.tab-brand {
  display: block;
  width: 14px;
  height: 14px;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
}

.tab-close {
  display: grid;
  width: 20px;
  height: 20px;
  margin-left: 4px;
  place-items: center;
  border-radius: 50%;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
}

.tab-close:hover,
.tab-close:focus-visible {
  background: var(--hover);
  color: var(--fg);
}

.titlebar-actions {
  display: flex;
  gap: 3px;
  align-items: center;
  margin-left: auto;
  padding-bottom: 7px;
}

.icon-button {
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: var(--line);
  background: var(--hover);
  color: var(--fg);
}

.icon-button:disabled {
  opacity: 0.3;
  cursor: default;
}

.icon-button:disabled:hover {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.icon-button svg {
  width: 16px;
  height: 16px;
}

.theme-icon--moon {
  display: none;
}

[data-theme="light"] .theme-icon--sun {
  display: none;
}

[data-theme="light"] .theme-icon--moon {
  display: block;
}

/* -------------------------------------------------------------------------- */
/* Path bar                                                                   */
/* -------------------------------------------------------------------------- */

.pathbar {
  display: flex;
  flex: none;
  gap: 8px;
  align-items: center;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
}

.history-buttons {
  display: flex;
  flex: none;
  gap: 2px;
  align-items: center;
}

.path-field {
  display: flex;
  flex: 1;
  gap: 8px;
  align-items: center;
  min-width: 0;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.path-field > svg {
  width: 15px;
  height: 15px;
  flex: none;
}

.breadcrumbs {
  display: flex;
  gap: 4px;
  align-items: center;
  min-width: 0;
  overflow-x: auto;
  font-size: 12px;
  line-height: 1;
  scrollbar-width: none;
  white-space: nowrap;
}

.breadcrumbs::-webkit-scrollbar {
  display: none;
}

.crumb {
  padding: 4px 1px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  line-height: 1.2;
}

.crumb:hover,
.crumb:focus-visible {
  color: var(--fg);
}

.crumb.is-current {
  color: var(--fg);
  cursor: default;
}

.crumb-sep {
  color: var(--muted);
  opacity: 0.45;
  font-size: 10px;
}

.tree-toggle {
  display: none;
}

/* -------------------------------------------------------------------------- */
/* Action bar                                                                 */
/* -------------------------------------------------------------------------- */

.actionbar {
  display: flex;
  flex: none;
  gap: 10px;
  align-items: center;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
}

.action-group {
  display: flex;
  flex: 1;
  gap: 2px;
  align-items: center;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.action-group::-webkit-scrollbar {
  display: none;
}

.tool-button {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  height: 32px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

.tool-button:hover,
.tool-button:focus-visible {
  border-color: var(--line);
  background: var(--hover);
  color: var(--fg);
}

.tool-button:disabled {
  opacity: 0.28;
  cursor: default;
}

.tool-button:disabled:hover {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.tool-button svg {
  width: 15px;
  height: 15px;
  flex: none;
}

.tool-icon {
  display: inline-flex;
  width: 15px;
  height: 15px;
  flex: none;
}

.tool-icon svg {
  width: 15px;
  height: 15px;
}

.tool-separator {
  width: 1px;
  height: 18px;
  margin: 0 4px;
  flex: none;
  background: var(--line);
}

.drive-search {
  display: flex;
  flex: none;
  gap: 6px;
  align-items: center;
  width: 176px;
  padding-bottom: 4px;
  border-bottom: 1px solid transparent;
  color: var(--muted);
}

.drive-search:focus-within {
  border-color: var(--line-strong);
  color: var(--fg);
}

.drive-search svg {
  width: 14px;
  height: 14px;
  flex: none;
}

.drive-search input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--fg);
  font-size: 11px;
  line-height: 1.3;
}

.drive-search input::placeholder {
  color: var(--muted);
}

/* -------------------------------------------------------------------------- */
/* Workspace                                                                  */
/* -------------------------------------------------------------------------- */

.workspace {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 0;
}

.tree-pane {
  display: flex;
  flex: none;
  flex-direction: column;
  width: var(--tree-width);
  min-width: 0;
  border-right: 1px solid var(--line);
  transition:
    transform 220ms cubic-bezier(0.2, 0.7, 0.2, 1),
    visibility 220ms;
}

.tree-heading {
  display: flex;
  flex: none;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  line-height: 1;
  text-transform: uppercase;
}

.tree {
  flex: 1;
  min-height: 0;
  padding: 7px 6px;
  overflow-y: auto;
  scrollbar-color: var(--line) transparent;
  scrollbar-width: thin;
}

.tree::-webkit-scrollbar {
  width: 5px;
}

.tree::-webkit-scrollbar-thumb {
  border-radius: 99px;
  background: var(--line);
}

.tree-scope + .tree-scope {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
}

.tree-row {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  height: 30px;
}

.tree-row .tree-item {
  flex: 1;
  width: auto;
  padding-left: 4px;
}

.tree-caret {
  display: grid;
  width: 16px;
  height: 16px;
  flex: none;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
}

.tree-caret:hover,
.tree-caret:focus-visible {
  background: var(--hover);
  color: var(--fg);
}

.tree-caret svg {
  width: 12px;
  height: 12px;
  transition: transform 160ms ease;
}

.tree-caret.is-collapsed svg {
  transform: rotate(-90deg);
}

.tree-caret-spacer {
  width: 16px;
  height: 16px;
  flex: none;
}

.tree-item {
  display: flex;
  gap: 7px;
  align-items: center;
  width: 100%;
  min-width: 0;
  height: 30px;
  padding: 0 7px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  text-align: left;
}

.tree-item:hover,
.tree-item:focus-visible {
  background: var(--hover);
  color: var(--fg);
}

.tree-item.is-current {
  background: var(--selected);
  color: var(--fg);
}

.tree-item svg {
  width: 14px;
  height: 14px;
  flex: none;
}

.tree-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.tree-lock {
  color: var(--muted);
}

.tree-empty {
  padding: 6px 8px;
  color: var(--muted);
  font-size: 11px;
}

.tree-footer {
  display: flex;
  flex: none;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.logout-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.logout-button:hover,
.logout-button:focus-visible {
  color: var(--fg);
}

.tree-scrim {
  display: none;
  transition:
    opacity 180ms ease,
    visibility 180ms;
}

/* -------------------------------------------------------------------------- */
/* Content                                                                    */
/* -------------------------------------------------------------------------- */

.content-pane {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.manager {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.file-list-head {
  display: grid;
  flex: none;
  grid-template-columns: minmax(0, 1fr) 82px 112px;
  gap: 16px;
  align-items: center;
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.09em;
  line-height: 1;
  text-transform: uppercase;
}

.file-list-wrap {
  display: flex;
  flex: 1;
  min-height: 0;
}

.file-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  margin: 0;
  padding: 6px 8px;
  overflow-y: auto;
  list-style: none;
  scrollbar-color: var(--line) transparent;
  scrollbar-width: thin;
  overscroll-behavior: contain;
}

.file-list::-webkit-scrollbar {
  width: 5px;
}

.file-list::-webkit-scrollbar-thumb {
  border-radius: 99px;
  background: var(--line);
}

.file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px 112px;
  gap: 16px;
  align-items: center;
  min-height: 43px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  border-radius: 6px;
  color: var(--fg);
  cursor: default;
  user-select: none;
}

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

.file-row.is-selected {
  background: var(--selected);
  box-shadow: inset 2px 0 0 var(--fg);
}

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

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

.file-select {
  display: grid;
  width: 14px;
  height: 14px;
  flex: none;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--bg);
  opacity: 0.55;
}

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

.file-select.is-checked {
  border-color: var(--fg);
  background: var(--fg);
  opacity: 1;
}

.file-select.is-checked::after {
  content: "";
  width: 5px;
  height: 3px;
  border-left: 1.5px solid var(--bg);
  border-bottom: 1.5px solid var(--bg);
  transform: rotate(-45deg) translateY(-0.5px);
}

.file-row.is-dragging {
  opacity: 0.38;
}

.file-row.is-drop-target,
.tree-item.is-drop-target {
  background: var(--selected);
  outline: 1px dashed var(--line-strong);
  outline-offset: -1px;
}

.file-list-wrap.is-drop-target {
  background: var(--hover);
  outline: 1px dashed var(--line-strong);
  outline-offset: -5px;
}

.file-icon {
  display: flex;
  flex: none;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.file-icon svg {
  width: 18px;
  height: 18px;
}

.file-row:hover .file-icon,
.file-row.is-selected .file-icon {
  color: var(--fg);
}

.file-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.file-name {
  overflow: hidden;
  color: var(--fg);
  font-size: 12.5px;
  font-weight: 430;
  letter-spacing: -0.01em;
  line-height: 1.25;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.file-inline-meta {
  display: none;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
}

.file-size,
.file-date {
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.3;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.file-date {
  font-family: var(--font-sans);
  font-size: 10.5px;
}

/* Empty state */

.file-empty {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-height: 100%;
  padding: 40px;
  color: var(--muted);
}

.file-empty-icon {
  display: grid;
  width: 54px;
  height: 54px;
  margin-bottom: 16px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
}

.file-empty-icon svg {
  width: 23px;
  height: 23px;
}

.file-empty-title {
  margin: 0 0 6px;
  color: var(--fg);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 1.2;
}

.file-empty-copy {
  max-width: 360px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.file-empty-button {
  width: max-content;
  max-width: 100%;
  margin-top: 18px;
  flex: none;
  white-space: nowrap;
}

.file-empty.is-error .file-empty-title {
  color: var(--danger);
}

/* -------------------------------------------------------------------------- */
/* Status bar                                                                 */
/* -------------------------------------------------------------------------- */

.statusbar {
  display: flex;
  flex: none;
  gap: 16px;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
}

.drive-summary {
  flex: none;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.drive-status {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.drive-location-note {
  flex: none;
  color: var(--muted);
  white-space: nowrap;
}

/* -------------------------------------------------------------------------- */
/* Buttons                                                                    */
/* -------------------------------------------------------------------------- */

.drive-button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 15px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: transparent;
  color: var(--fg);
  font-size: 12px;
  white-space: nowrap;
}

.drive-button:hover,
.drive-button:focus-visible {
  background: var(--hover);
}

.drive-button--solid {
  border-color: var(--fg);
  background: var(--button-bg);
  color: var(--button-fg);
}

.drive-button--solid:hover,
.drive-button--solid:focus-visible {
  opacity: 0.82;
  background: var(--button-bg);
}

.drive-button:disabled {
  cursor: wait;
  opacity: 0.48;
}

.drive-button svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.icon-button,
.tool-button,
.tree-item,
.crumb,
.file-row,
.tab-close,
.drive-button,
.drive-dialog-button,
.logout-button,
.gate-submit,
.gate-public,
.gate-form input {
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    opacity 160ms ease;
}

/* -------------------------------------------------------------------------- */
/* Upload progress                                                            */
/* -------------------------------------------------------------------------- */

.upload-progress {
  display: flex;
  flex: none;
  gap: 10px;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  color: var(--muted);
  font-size: 10px;
}

.upload-progress-label {
  flex: none;
  max-width: 45%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.upload-progress-track {
  flex: 1;
  height: 2px;
  overflow: hidden;
  background: var(--line);
}

.upload-progress-fill {
  display: block;
  width: 0;
  height: 100%;
  background: var(--fg);
  transition: width 120ms linear;
}

.upload-progress-percent {
  flex: none;
  min-width: 30px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  text-align: right;
}

/* -------------------------------------------------------------------------- */
/* Context menu                                                               */
/* -------------------------------------------------------------------------- */

.context-menu {
  position: fixed;
  z-index: 120;
  min-width: 190px;
  max-width: min(260px, calc(100vw - 16px));
  max-height: min(70vh, 430px);
  padding: 5px;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  animation: context-in 120ms ease-out both;
}

.context-item {
  display: flex;
  gap: 9px;
  align-items: center;
  width: 100%;
  height: 32px;
  padding: 0 9px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--fg);
  font-size: 11px;
  line-height: 1;
  text-align: left;
}

.context-item:hover:not(:disabled),
.context-item:focus-visible {
  background: var(--hover);
}

.context-item:disabled {
  cursor: default;
  opacity: 0.32;
}

.context-item svg {
  width: 14px;
  height: 14px;
  flex: none;
  color: var(--muted);
}

.context-item.is-danger,
.context-item.is-danger svg {
  color: var(--danger);
}

.context-separator {
  height: 1px;
  margin: 5px 6px;
  background: var(--line);
}

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

/* -------------------------------------------------------------------------- */
/* Preview                                                                    */
/* -------------------------------------------------------------------------- */

.preview-dialog {
  width: min(980px, calc(100vw - 32px));
  max-height: 88vh;
  max-height: 88svh;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--bg);
  color: var(--fg);
  box-shadow: var(--window-shadow);
}

.preview-dialog[open] {
  display: flex;
  flex-direction: column;
  animation: dialog-in 180ms ease-out both;
}

.preview-dialog::backdrop {
  background: var(--backdrop);
}

.preview-header {
  display: flex;
  flex: none;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.preview-heading {
  min-width: 0;
}

.preview-heading h2 {
  margin: 0;
  overflow: hidden;
  color: var(--fg);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.25;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.preview-meta {
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1.3;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.preview-actions {
  display: flex;
  flex: none;
  gap: 7px;
  align-items: center;
}

.preview-download {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--fg);
  font-size: 10px;
}

.preview-download:hover,
.preview-download:focus-visible {
  border-color: var(--line-strong);
  background: var(--hover);
}

.preview-close {
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}

.preview-close:hover,
.preview-close:focus-visible {
  background: var(--hover);
  color: var(--fg);
}

.preview-body {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 18px;
  overflow: auto;
  background: var(--bg);
}

.preview-body img {
  display: block;
  max-width: 100%;
  max-height: calc(88svh - 126px);
  object-fit: contain;
}

.preview-body video {
  width: min(100%, 900px);
  max-height: calc(88svh - 126px);
  border-radius: 8px;
  background: #000;
}

.preview-body audio {
  width: min(100%, 560px);
}

.preview-body iframe {
  width: 100%;
  height: calc(88svh - 130px);
  border: 0;
  background: var(--bg);
}

.preview-text {
  width: 100%;
  height: 100%;
  max-height: calc(88svh - 130px);
  margin: 0;
  padding: 20px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.preview-message {
  max-width: 420px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  text-align: center;
}

.preview-message.is-error {
  color: var(--danger);
}

.preview-loading {
  color: var(--muted);
  font-size: 12px;
}

/* -------------------------------------------------------------------------- */
/* Dialogs                                                                    */
/* -------------------------------------------------------------------------- */

.drive-dialog {
  width: min(92vw, 400px);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--bg);
  color: var(--fg);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.3);
}

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

.drive-dialog::backdrop {
  background: var(--backdrop);
}

.drive-dialog form {
  padding: 23px;
}

.drive-dialog h2 {
  margin: 0 0 17px;
  color: var(--fg);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 1.15;
}

.drive-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.drive-field span {
  color: var(--muted);
  font-size: 10px;
}

.drive-field input {
  width: 100%;
  height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: 0;
  background: transparent;
  color: var(--fg);
  font-size: 13px;
}

.drive-field input:focus {
  border-color: var(--fg);
}

.drive-dialog-error {
  min-height: 16px;
  margin: 7px 0 0;
  color: var(--danger);
  font-size: 10px;
  line-height: 1.4;
}

.drive-confirm-message {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

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

.drive-dialog-button {
  height: 36px;
  padding: 0 16px;
  border-radius: 6px;
  font-size: 11px;
}

.drive-dialog-button--ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg);
}

.drive-dialog-button--ghost:hover {
  background: var(--hover);
}

.drive-dialog-button--solid {
  border: 1px solid var(--fg);
  background: var(--fg);
  color: var(--bg);
}

.drive-dialog-button:disabled {
  cursor: wait;
  opacity: 0.5;
}

.noscript-note {
  position: fixed;
  bottom: 20px;
  left: 50%;
  z-index: 100;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--fg);
  font-size: 12px;
}

/* -------------------------------------------------------------------------- */
/* Responsive                                                                 */
/* -------------------------------------------------------------------------- */

@media (max-width: 960px) {
  :root {
    --tree-width: 200px;
  }

  .tool-button {
    padding: 0 6px;
  }

  .drive-search {
    width: 140px;
  }
}

@media (max-width: 760px) {
  :root {
    --window-inset: 6px;
    --window-radius: 12px;
  }

  .access-gate {
    padding: 64px 18px 24px;
  }

  .gate-actions {
    top: 14px;
    right: 18px;
  }

  .gate-panel {
    padding: 26px 22px;
  }

  .titlebar {
    height: 44px;
    padding: 0 7px;
  }

  .tab {
    height: 32px;
    font-size: 11px;
  }

  .titlebar-actions {
    padding-bottom: 6px;
  }

  .icon-button {
    width: 28px;
    height: 28px;
  }

  .pathbar {
    flex-wrap: wrap;
    gap: 5px;
    padding: 6px 7px;
  }

  .tree-toggle {
    display: grid;
    width: 28px;
    height: 28px;
  }

  .path-field {
    flex-basis: 100%;
    order: 2;
    height: 28px;
  }

  .history-buttons {
    flex: 1;
  }

  .actionbar {
    gap: 6px;
    padding: 5px 7px;
  }

  .action-group {
    gap: 1px;
  }

  .tool-button {
    width: 30px;
    height: 30px;
    padding: 0;
    justify-content: center;
  }

  .tool-button > span:not(.tool-icon) {
    display: none;
  }

  .tool-separator {
    margin: 0 2px;
  }

  .drive-search {
    display: none;
  }

  .tree-pane {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 6;
    width: min(80vw, 290px);
    visibility: hidden;
    transform: translateX(-102%);
    background: var(--bg);
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.35);
  }

  .explorer.tree-open .tree-pane {
    visibility: visible;
    transform: translateX(0);
  }

  .tree-scrim {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: block;
    border: 0;
    background: rgba(0, 0, 0, 0.42);
    opacity: 0;
    visibility: hidden;
  }

  .explorer.tree-open .tree-scrim {
    opacity: 1;
    visibility: visible;
  }

  .content-pane {
    width: 100%;
  }

  .file-list-head {
    display: none;
  }

  .file-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 7px 6px;
  }

  .file-size,
  .file-date {
    display: none;
  }

  .file-inline-meta {
    display: block;
  }

  .statusbar {
    gap: 8px;
    height: 26px;
    padding: 0 8px;
    font-size: 9px;
  }

  .drive-location-note {
    display: none;
  }

  .file-empty {
    padding: 28px 18px;
  }

  .upload-progress {
    padding: 0 8px;
    font-size: 9px;
  }

  .preview-dialog {
    width: calc(100vw - 16px);
    max-height: 92vh;
    max-height: 92svh;
    border-radius: 12px;
  }

  .preview-header {
    gap: 10px;
    padding: 11px 12px;
  }

  .preview-heading h2 {
    font-size: 14px;
  }

  .preview-body {
    padding: 10px;
  }

  .preview-body img,
  .preview-body video {
    max-height: calc(92svh - 116px);
  }

  .preview-body iframe {
    height: calc(92svh - 120px);
  }

  .preview-text {
    max-height: calc(92svh - 120px);
    padding: 14px;
    font-size: 11px;
  }
}

@media (max-width: 390px) {
  .gate-panel {
    padding: 24px 18px;
  }

  .tab {
    padding-left: 8px;
  }

  .tool-separator {
    display: none;
  }

  .file-name {
    font-size: 12px;
  }
}
