:root {
  color-scheme: light;
  --bg: #f7f7f2;
  --panel: #ffffff;
  --panel-soft: #f0f4f3;
  --text: #202426;
  --muted: #697178;
  --line: #dfe5e2;
  --accent: #167e7a;
  --accent-strong: #0e5f5b;
  --warn: #b7791f;
  --shadow: 0 18px 50px rgba(33, 42, 44, 0.1);
}

:root.dark {
  color-scheme: dark;
  --bg: #111414;
  --panel: #1a1f20;
  --panel-soft: #202829;
  --text: #f1f4ef;
  --muted: #a6b0ae;
  --line: #303a3b;
  --accent: #4ab8ad;
  --accent-strong: #7dd7cd;
  --warn: #e1b35f;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(22, 126, 122, 0.08), transparent 340px),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

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

button,
input {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 clamp(16px, 4vw, 52px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(18px);
}

.brand,
.nav,
.toolbar,
.browser-head,
.row {
  display: flex;
  align-items: center;
}

.brand {
  min-width: 0;
  gap: 10px;
  font-weight: 750;
}

.brand img {
  width: 34px;
  height: 34px;
}

.brand span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav {
  gap: 12px;
  color: var(--muted);
}

.nav a {
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 650;
}

.icon-button,
.refresh {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  padding: 34px 0 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 760;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.02;
  letter-spacing: 0;
}

.intro p:last-child {
  max-width: 620px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px;
}

.stats div {
  min-height: 76px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stats span {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 22px;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats small {
  color: var(--muted);
}

.toolbar {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.search {
  display: flex;
  align-items: center;
  width: min(420px, 100%);
  height: 44px;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.search span {
  color: var(--muted);
  font-size: 20px;
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.browser {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.browser-head {
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.browser-head p {
  margin: 0 0 6px;
  font-weight: 760;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.crumbs button {
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  cursor: pointer;
  padding: 0;
}

.table {
  width: 100%;
}

.row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 120px 180px;
  gap: 14px;
  min-height: 58px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
}

.file-list .row {
  cursor: pointer;
}

.file-list .row:hover {
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}

.row.header {
  min-height: 44px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 680;
  background: var(--panel-soft);
}

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

.name {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  font-weight: 650;
}

.file-icon {
  display: inline-grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  color: var(--accent-strong);
}

.name span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  height: 34px;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--line));
  border-radius: 8px;
  color: var(--accent-strong);
  font-weight: 700;
}

.state {
  padding: 42px 20px;
  color: var(--muted);
  text-align: center;
}

.error {
  color: #c2410c;
}

.site-footer {
  width: min(1120px, calc(100% - 32px));
  margin: -24px auto 0;
  padding: 0 0 34px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.site-footer p {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
}

.site-footer a,
.privacy-link {
  color: var(--accent-strong);
}

.site-footer a:hover,
.privacy-link:hover {
  text-decoration: underline;
}

.privacy-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: inherit;
  padding: 0;
}

.privacy-icon {
  position: relative;
  display: inline-block;
  width: 24px;
  height: 13px;
  overflow: hidden;
  border: 1px solid #1d4ed8;
  border-radius: 2px;
  background: #2563eb;
  vertical-align: -2px;
}

.privacy-icon span {
  position: absolute;
  top: 2px;
  width: 8px;
  height: 8px;
  border-top: 2px solid #fff;
  border-right: 2px solid #fff;
}

.privacy-icon span:first-child {
  left: 4px;
  transform: rotate(45deg);
}

.privacy-icon span:last-child {
  right: 4px;
  transform: rotate(225deg);
}

.privacy-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
}

.privacy-modal.open {
  display: block;
}

.privacy-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 16, 18, 0.46);
}

.privacy-panel {
  position: absolute;
  right: max(16px, calc((100vw - 1120px) / 2));
  bottom: 18px;
  width: min(420px, calc(100vw - 32px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
}

.privacy-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--line);
}

.privacy-head h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
}

.privacy-body {
  display: grid;
  gap: 12px;
  padding: 16px 20px;
  color: var(--muted);
}

.privacy-body p {
  margin: 0;
}

.privacy-choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 70px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.privacy-choice div {
  display: grid;
  gap: 4px;
}

.privacy-choice strong {
  color: var(--text);
  font-size: 14px;
}

.privacy-choice span {
  font-size: 12px;
}

.choice-state {
  flex: 0 0 auto;
  color: var(--accent-strong);
  font-weight: 700;
}

.privacy-choice input {
  flex: 0 0 auto;
  width: 42px;
  height: 24px;
  accent-color: var(--accent);
}

.privacy-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px 20px;
}

.download.primary {
  background: var(--accent-strong);
  color: var(--panel);
}

.context-menu {
  position: fixed;
  z-index: 40;
  display: none;
  min-width: 148px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
}

.context-menu.open {
  display: grid;
}

.context-menu button {
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.context-menu button:last-child {
  border-bottom: 0;
}

.context-menu button:hover {
  background: var(--panel-soft);
}

@media (max-width: 820px) {
  .intro,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .intro {
    display: block;
  }

  .stats {
    margin-top: 22px;
  }

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

  .row {
    grid-template-columns: minmax(0, 1fr) 86px;
  }

  .row.header span:nth-child(3),
  .row > span:nth-child(3) {
    display: none;
  }
}

@media (max-width: 560px) {
  .topbar {
    padding: 0 14px;
  }

  .nav a {
    display: none;
  }

  .shell {
    width: calc(100% - 20px);
    padding-top: 18px;
  }

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

  .browser-head,
  .row {
    padding-left: 12px;
    padding-right: 12px;
  }
}
