:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
  --hover: #f3f4f6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171c;
    --fg: #e8e8ea;
    --muted: #9aa0aa;
    --border: #2a2d34;
    --accent: #5b9dff;
    --hover: #1f222a;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--fg);
}

#app {
  min-height: 100vh;
}

.status {
  padding: 2rem;
  text-align: center;
  color: var(--muted);
}

.status.error {
  color: #dc2626;
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: min(320px, 90vw);
  padding: 2rem;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.login-form h1 {
  margin: 0 0 0.5rem;
  font-size: 1.4rem;
  text-align: center;
}

.login-form input {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  font-size: 1rem;
}

.login-form button {
  padding: 0.6rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-size: 1rem;
  cursor: pointer;
}

.error {
  color: #dc2626;
  font-size: 0.85rem;
  min-height: 1.2em;
  text-align: center;
}

.app-shell {
  max-width: 900px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 600;
}

.host-badge {
  font-size: 0.7rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
}

.spacer {
  flex: 1;
}

.username {
  color: var(--muted);
  font-size: 0.9rem;
}

.topbar button,
.upload-btn {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  font-size: 0.9rem;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  gap: 1rem;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.crumb {
  cursor: pointer;
  color: var(--accent);
}

.crumb.current {
  color: var(--fg);
  font-weight: 600;
  cursor: default;
}

.crumb-sep {
  color: var(--muted);
}

.upload-progress {
  height: 4px;
  background: var(--border);
  margin: 0 1rem;
  border-radius: 2px;
  overflow: hidden;
}

.upload-progress .bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.15s;
}

.entries {
  list-style: none;
  margin: 0;
  padding: 0 0.5rem 2rem;
}

.entry {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
}

.entry:hover {
  background: var(--hover);
}

.entry .name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry .size {
  color: var(--muted);
  font-size: 0.8rem;
}

.preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.preview-panel {
  background: var(--bg);
  border-radius: 12px;
  padding: 1rem;
  max-width: min(90vw, 900px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.preview-header button {
  border: none;
  background: transparent;
  color: var(--fg);
  font-size: 1.2rem;
  cursor: pointer;
}

.preview-panel video,
.preview-panel audio {
  max-width: 100%;
  max-height: 75vh;
  width: min(80vw, 800px);
}
