  :root {
    --bg: #0f172a;
    --surface: #111827;
    --border: rgba(148,163,253,0.15);
    --text: #e5e7eb;
    --muted: #9ca3af;
    --accent: #6366f1;
    --accent-soft: rgba(99,102,241,0.12);
    --radius: 14px;
    --font: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }

  body {
    font-family: var(--font);
    background: radial-gradient(circle at top, #0f172a 0, #020817 60%, #010410 100%);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 32px 16px 48px;
    transition: background 0.4s ease, color 0.4s ease;
    overflow-x: hidden;
    position: relative;
  }

  /* Theme button */
  .theme-toggle {
    position: fixed;
    top: 14px;
    right: 18px;
    z-index: 999;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: rgba(15,23,42,0.85);
    color: #e5e7eb;
    font-size: 16px;
    display: grid;
    place-items: center;
    cursor: pointer;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.45);
    transition: all 0.25s ease;
  }

  .theme-toggle:hover {
    transform: translateY(-1px) scale(1.06);
    box-shadow: 0 14px 36px rgba(99,102,241,0.5);
    border-color: var(--accent);
  }

  /* Starry night theme (default ON) */
  body.theme-starry {
    background: radial-gradient(circle at top, #0b1020 0, #020817 100%);
    color: #e5e7eb;
  }

  /* Stars layer */
  .stars-layer {
    position: fixed;
    inset: -40%;
    pointer-events: none;
    z-index: 3;
    opacity: 0;
    transition: opacity 0.6s ease;
    overflow: hidden;
  }

  body.theme-starry .stars-layer {
    opacity: 1;
    animation: stars-drift 45s linear infinite alternate;
  }

  @keyframes stars-drift {
    from { transform: translateX(0); }
    to   { transform: translateX(-8%); }
  }

  .star, .star2, .star3, .star-bright {
    position: absolute;
    border-radius: 50%;
    background: #ffffff;
  }

  @keyframes twinkle-1 {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    30%      { opacity: 1;   transform: scale(1.4); }
    70%      { opacity: 0.5; transform: scale(0.9); }
  }

  @keyframes twinkle-2 {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    40%      { opacity: 1;   transform: scale(1.5); }
    80%      { opacity: 0.6; transform: scale(0.95); }
  }

  @keyframes twinkle-3 {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50%      { opacity: 1;   transform: scale(1.2); }
  }

  @keyframes bright-pulse {
    0%, 100% { opacity: 0.9; box-shadow: 0 0 4px #fff; }
    50%      { opacity: 1;   box-shadow: 0 0 12px #bfb6ff, 0 0 28px rgba(139,92,246,0.7); }
  }

  .star         { animation: twinkle-1 4s ease-in-out infinite alternate; }
  .star2        { animation: twinkle-2 5.5s ease-in-out infinite alternate; }
  .star3        { animation: twinkle-3 7s ease-in-out infinite alternate; }
  .star-bright  { animation: bright-pulse 6s ease-in-out infinite alternate; }

  /* Single centered galaxy - zoomed out, soft edges */
  .galaxy-center,
  .galaxy-overlay {
    position: fixed;
    pointer-events: none;
    z-index: 1;
    display: none;
  }

  body.theme-starry .galaxy-center {
    display: block !important;
    opacity: 0.25;
  }

  /* Slowly rotating galaxy overlay with soft edges to hide rotation seam */
  body.theme-starry .galaxy-overlay {
    display: block !important;
    top: 50%;
    left: 50%;
    width: 225vw;
    height: 225vh;
    transform-origin: center center;
    border-radius: 999px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    mix-blend-mode: screen;
    /* Fallback gradient so background is never empty before JS loads full image */
    background-image:
      radial-gradient(circle at 50% 50%, rgba(120,100,255,0.35), transparent 60%),
      radial-gradient(circle at 70% 40%, rgba(99,102,241,0.25), transparent 55%);
    /* Soft radial mask so edges fade and rotation seam is invisible */
    -webkit-mask-image: radial-gradient(circle at center, rgba(0,0,0,1) 15%, rgba(0,0,0,0.85) 40%, transparent 75%);
            mask-image: radial-gradient(circle at center, rgba(0,0,0,1) 15%, rgba(0,0,0,0.85) 40%, transparent 75%);
    animation: galaxy-rotate-slow 240s linear infinite !important;
  }

  /* Wide, very soft nebula base glow */
  .galaxy-center {
    top: 50%;
    left: 50%;
    width: 260vw;
    height: 260vh;
    transform: translate(-50%, -50%);
    border-radius: 999px;
    background:
      radial-gradient(circle at center,
        rgba(120,100,255,0.14) 0,
        rgba(80,70,160,0.08) 30%,
        rgba(20,15,40,0.03) 70%,
        transparent 100%);
    filter: blur(90px);
    animation: galaxy-diffuse 60s ease-in-out infinite alternate;
  }

  /* Spiral texture overlay is now defined under body.theme-starry for clean rotation */

  @keyframes galaxy-diffuse {
    from { transform: translate(-50%, -50%) scale(1); opacity: 0.25; }
    to   { transform: translate(-50%, -50%) scale(1.04); opacity: 0.3; }
  }



  /* Slow, subtle galaxy rotation */
  @keyframes galaxy-rotate-slow {
    from { transform: translate(-50%, -50%) rotate(0deg);   opacity: 0.4; }
    to   { transform: translate(-50%, -50%) rotate(360deg); opacity: 0.4; }
  }

  /* Main content sits above background layers */
  .container {
    width: 100%;
    max-width: 960px;
    position: relative;
    z-index: 10;
  }

  header {
    margin-bottom: 24px;
    display: flex; align-items: center; gap: 14px;
  }

  .logo {
    width: 42px; height: 42px; border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    display: grid; place-items: center; font-size: 18px;
    box-shadow: 0 14px 40px rgba(99,102,241,0.35);
    flex-shrink: 0;
  }

  .title-block { display: flex; flex-direction: column; gap: 2px; }

  h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.03em; }

  .subtitle {
    font-size: 12px; color: var(--muted);
    display: flex; align-items: center; gap: 8px;
  }

  .breadcrumb {
    font-size: 11px; padding: 4px 10px; border-radius: 999px;
    background: var(--accent-soft); color: #a5b4fc;
    display: inline-flex; align-items: center; gap: 6px;
    white-space: nowrap; overflow-x: auto;
  }

  .breadcrumb span { opacity: 0.6; }

  .toolbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
  }

  .search-box { position: relative; flex: 1; max-width: 320px; }

  .search-box input {
    width: 100%; padding: 9px 14px 9px 36px; border-radius: 999px;
    border: 1px solid var(--border); background: rgba(15,23,42,0.8);
    color: var(--text); font-size: 13px; outline: none;
    transition: all 0.2s ease;
  }

  .search-box input::placeholder { color: #6b7280; }
  .search-box input:focus { border-color: var(--accent); box-shadow: 0 0 18px rgba(99,102,241,0.35); }

  .search-icon {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    font-size: 14px; color: #6b7280; pointer-events: none;
  }

  .stats { font-size: 11px; color: var(--muted); display: flex; gap: 14px; }

  .table-wrap {
    background: linear-gradient(180deg, rgba(15,23,42,0.9), rgba(2,6,23,0.98));
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: 0 24px 70px rgba(0,0,0,0.55), inset 0 1px 0 rgba(148,163,253,0.06);
  }

  table { width: 100%; border-collapse: collapse; font-size: 13px; }

  thead th {
    text-align: left; padding: 10px 14px; font-size: 10px;
    letter-spacing: 0.1em; color: #6b7280; text-transform: uppercase;
    border-bottom: 1px solid var(--border); cursor: pointer;
    user-select: none; position: relative;
  }

  thead th:hover { color: #a5b4fc; }
  thead th .arrow { font-size: 9px; margin-left: 4px; opacity: 0.6; }

  tbody tr {
    border-bottom: 1px solid rgba(148,163,253,0.06);
    transition: background 0.15s ease;
  }

  tbody tr:last-child { border-bottom: none; }
  tbody tr:hover { background: rgba(99,102,241,0.07); }

  td { padding: 9px 14px; vertical-align: middle; }

  .name-cell { display: flex; align-items: center; gap: 8px; }

  .icon {
    width: 26px; height: 26px; border-radius: 7px;
    display: grid; place-items: center; font-size: 13px; flex-shrink: 0;
  }

  .dir-icon { background: rgba(59,130,246,0.18); color: #60a5fa; }
  .file-icon { background: rgba(75,85,99,0.4); color: #d1d5db; }

  a.item-link {
    color: var(--text); text-decoration: none; font-weight: 500;
    transition: color 0.15s ease;
  }

  a.item-link:hover { color: #a5b4fc; text-decoration: underline; }

  .size, .date { color: var(--muted); font-size: 12px; white-space: nowrap; }

  footer {
    margin-top: 18px; display: flex; justify-content: space-between; align-items: center;
    font-size: 10px; color: #6b7280;
  }


/* Site header */
  .site-header { margin-bottom: 18px; display: flex; align-items: center; justify-content: space-between; }
  .site-name { font-size: 20px; font-weight: 700; color: var(--accent); text-decoration: none; letter-spacing: -0.03em; }

/* Table column widths */
  .col-size { width: 100px; }
  .col-date { min-width: 140px; }

  @media (max-width: 640px) {
    .stats, footer { display: none; }
    thead th:nth-child(3), td:nth-child(3),
    thead th:nth-child(4), td:nth-child(4) { display: none; }
  }

  /* Respect reduced motion: disable heavy animations */
  @media (prefers-reduced-motion: reduce) {
    .stars-layer,
    .star,
    .star2,
    .star3,
    .star-bright,
    .galaxy-overlay,
    .galaxy-center {
      animation: none !important;
    }
  }
