:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #667085;
  --line: #d9dee7;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --danger: #b42318;
  --shadow: 0 16px 50px rgba(20, 30, 46, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

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

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: 0;
}

#summary {
  margin: 7px 0 0;
  color: var(--muted);
}

.actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.search {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.search input {
  width: min(320px, 42vw);
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 11px;
  background: #fff;
  color: var(--text);
}

#downloadCurrent,
#refresh,
#closePlayer {
  height: 38px;
  border-radius: 6px;
  padding: 0 14px;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 34px;
  margin-bottom: 12px;
  color: var(--muted);
}

.breadcrumbs button {
  min-height: 30px;
  border-radius: 6px;
  padding: 4px 9px;
}

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

.table-head,
.file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px 190px 190px;
  align-items: center;
  gap: 14px;
}

.table-head {
  min-height: 42px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: #eef2f6;
}

.table-head button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-size: 12px;
  font-weight: 700;
}

.file-list {
  min-height: 180px;
}

.file-row {
  min-height: 58px;
  padding: 9px 16px;
  border-bottom: 1px solid #eef0f4;
}

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

.file-row:hover {
  background: #f8fafb;
}

.name {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.kind {
  display: inline-grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background: #e6f4f1;
  color: var(--accent-strong);
  font-size: 16px;
}

.file-link {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-link[aria-disabled="true"] {
  cursor: default;
}

.file-link:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.file-link[aria-disabled="true"]:hover {
  color: var(--text);
  text-decoration: none;
}

.meta {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.row-actions button,
.row-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
}

.row-actions button:hover,
.row-actions a:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.row-actions .danger {
  border-color: rgba(180, 35, 24, 0.35);
  color: var(--danger);
}

.row-actions .danger:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.empty,
.error {
  padding: 34px 18px;
  color: var(--muted);
  text-align: center;
}

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

#playerDialog {
  width: min(980px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: #0b1117;
  color: #fff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
}

#playerDialog::backdrop {
  background: rgba(4, 12, 20, 0.62);
}

.player-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
}

#playerTitle {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#player {
  display: block;
  width: 100%;
  max-height: calc(100vh - 150px);
  background: #000;
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 16px;
  }

  .topbar,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .search input {
    width: 100%;
  }

  .table-head {
    display: none;
  }

  .file-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
    align-items: start;
  }

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