:root {
  --flip-orange: #ff8201;
  --flip-orange-dark: #e06e00;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e6e8eb;
  --text: #1d1f23;
  --text-muted: #6b7280;
  --row-hover: #fdf3e7;
  --accent-soft: #fff4e6;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181d;
    --surface: #1e2127;
    --border: #2c3038;
    --text: #e8eaed;
    --text-muted: #9aa1ac;
    --row-hover: #2a2417;
    --accent-soft: #2a2417;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--flip-orange-dark);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.logo-badge {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 10px;
  background: var(--flip-orange);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 20px;
  box-shadow: 0 2px 6px rgba(255, 130, 1, 0.4);
}

.site-header h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.site-header .subtitle {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

/* Collapsible sections */
.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  overflow: hidden;
}

.section > summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 20px;
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
}
.section > summary::-webkit-details-marker {
  display: none;
}
.section > summary::before {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--flip-orange);
  border-bottom: 2px solid var(--flip-orange);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  flex: 0 0 auto;
}
.section[open] > summary::before {
  transform: rotate(45deg);
}
.section > summary:hover {
  background: var(--accent-soft);
}

.section-body {
  padding: 4px 20px 20px;
  border-top: 1px solid var(--border);
}

/* Build info */
.info-grid {
  display: grid;
  grid-template-columns: minmax(140px, max-content) 1fr;
  gap: 6px 20px;
  margin: 12px 0;
  font-size: 14px;
}
.info-grid dt {
  color: var(--text-muted);
  font-weight: 600;
}
.info-grid dd {
  margin: 0;
  word-break: break-word;
}
.info-grid dd code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--accent-soft);
  padding: 1px 6px;
  border-radius: 5px;
}

.info-subhead {
  margin: 18px 0 4px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--flip-orange-dark);
  font-weight: 700;
}
.info-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  margin: 8px 0;
  background: var(--bg);
}

/* File listing */
.listing-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.listing-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}
.listing-summary {
  color: var(--text-muted);
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

table.files {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.files thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
table.files thead th.col-size,
table.files thead th.col-time {
  text-align: right;
}
table.files thead th .arrow {
  display: inline-block;
  width: 0;
  opacity: 0;
  margin-left: 6px;
  transition: opacity 0.1s;
}
table.files thead th[aria-sort="ascending"] .arrow,
table.files thead th[aria-sort="descending"] .arrow {
  width: auto;
  opacity: 1;
  color: var(--flip-orange);
}

table.files tbody td {
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.files tbody tr:last-child td {
  border-bottom: none;
}
table.files tbody tr:hover td {
  background: var(--row-hover);
}
td.col-size,
td.col-time {
  text-align: right;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  font-size: 12.5px;
}

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

.twisty {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  color: var(--text-muted);
  border: none;
  background: none;
  padding: 0;
}
.twisty svg {
  transition: transform 0.12s ease;
}
tr.dir.expanded .twisty svg {
  transform: rotate(90deg);
}
.twisty.spacer {
  cursor: default;
}

.icon {
  flex: 0 0 auto;
  color: var(--text-muted);
}
tr.dir .icon {
  color: var(--flip-orange);
}

.node-name {
  overflow: hidden;
  text-overflow: ellipsis;
}
tr.dir .node-name {
  font-weight: 600;
  cursor: pointer;
}
.dir-count {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 12px;
  margin-left: 4px;
}

.empty,
.error {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}
.error {
  color: #c0392b;
}

.site-footer {
  margin-top: 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}
