:root {
  --bg: #f7f5ef;
  --surface: #ffffff;
  --text: #182025;
  --muted: #65727c;
  --accent: #21618a;
  --line: #dde2e8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: ui-sans-serif, "Avenir Next", "Helvetica Neue", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top right, #dce7f1, var(--bg) 35%);
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

.notice {
  border: 1px solid #d9b25f;
  background: #fff7e8;
  color: #7b5a1f;
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  margin-bottom: 0.9rem;
  font-size: 0.9rem;
}

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

.actions,
.controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.controls {
  margin: 1rem 0;
}

.upload {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.upload-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

input[type="search"] {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  min-width: 280px;
  background: var(--surface);
}

select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  background: var(--surface);
}

.button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
}

.button.secondary {
  background: transparent;
  color: var(--accent);
}

.finder {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
}

.sidebar,
.main-pane {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 0.8rem;
}

.sidebar h2 {
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
}

.folder-tree {
  display: grid;
  gap: 0.3rem;
}

.folder-link {
  text-align: left;
  border: 1px solid var(--line);
  background: #f5f8fb;
  color: var(--text);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  cursor: pointer;
}

.folder-link.root {
  margin-bottom: 0.5rem;
}

.folder-link.active {
  border-color: var(--accent);
  background: #eaf3fb;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
  margin-bottom: 0.7rem;
}

.crumb {
  border: 1px solid var(--line);
  background: #f7fafc;
  color: var(--text);
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
  cursor: pointer;
  font-size: 0.83rem;
}

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

.file-list {
  display: grid;
  gap: 0.55rem;
}

.file-row {
  display: grid;
  grid-template-columns: 96px 1fr auto;
  gap: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem;
}

.folder-row {
  grid-template-columns: 1fr auto;
  background: #f8fbfd;
}

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

.thumb-mini {
  width: 88px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #eef2f5;
}

.thumb-mini.placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.72rem;
}

.file-meta {
  display: grid;
  gap: 0.2rem;
}

.file-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: start;
  justify-content: flex-end;
  gap: 0.35rem;
}

.mini {
  border: 1px solid var(--accent);
  background: #f1f7fb;
  color: var(--accent);
  border-radius: 8px;
  padding: 0.35rem 0.48rem;
  font-size: 0.77rem;
  cursor: pointer;
}

.mini.danger {
  border-color: #b84a4a;
  background: #fff5f5;
  color: #8a2f2f;
}

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

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}

.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}

.card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: #eff2f5;
}

.thumb-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  background: #eff2f5;
  color: var(--muted);
  font-size: 0.85rem;
}

.card .meta {
  padding: 0.6rem;
  display: grid;
  gap: 0.35rem;
}

.card .path {
  font-size: 0.83rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.download {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  margin-right: 0.5rem;
}

.delete {
  border: 1px solid #b84a4a;
  background: #fff5f5;
  color: #8a2f2f;
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
  cursor: pointer;
  margin-right: 0.4rem;
}

@media (max-width: 640px) {
  input[type="search"] {
    min-width: 0;
    width: 100%;
  }

  .controls {
    flex-direction: column;
  }

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

  .file-row {
    grid-template-columns: 1fr;
  }

  .file-actions {
    justify-content: flex-start;
  }
}
