* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { background: var(--bg); margin: 0; padding: 0; }
body {
  font-family: var(--md-font); color: var(--text); min-height: 100vh;
  padding-top: var(--safe-top); padding-bottom: calc(96px + var(--safe-bottom));
  -webkit-font-smoothing: antialiased; transition: background 0.22s var(--md-ease), color 0.22s var(--md-ease);
}
svg.ico { width: 22px; height: 22px; fill: currentColor; display: block; flex-shrink: 0; }
svg.ico-sm { width: 17px; height: 17px; fill: currentColor; display: block; flex-shrink: 0; }
.hidden { display: none !important; }

.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: var(--s-low); border-radius: 28px; padding: 32px 26px; }
.login-badge {
  width: 48px; height: 48px; border-radius: 16px; background: var(--primary-c); color: var(--on-primary-c);
  display: flex; align-items: center; justify-content: center; margin-bottom: 18px;
}

.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--bg);
  padding: 10px 14px; display: flex; align-items: center; gap: 10px;
  max-width: 1080px; margin: 0 auto;
}
.main-wrap { max-width: 1080px; margin: 0 auto; padding: 2px 16px 32px; }

.chip-scroll { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; scrollbar-width: none; }
.chip-scroll::-webkit-scrollbar { display: none; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; font-size: 13px; font-weight: 500; }
.crumb { padding: 5px 10px; border-radius: 999px; cursor: pointer; color: var(--text-var); }
.crumb.cur, .crumb:hover { background: var(--s-mid); color: var(--text); }

.batch-bar {
  background: var(--primary-c); color: var(--on-primary-c); border-radius: 18px;
  padding: 10px 14px; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  flex-wrap: wrap;
}

.files.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 10px; }
.files.list { display: flex; flex-direction: column; gap: 8px; }

.file-card {
  background: var(--s-low); border-radius: 20px; padding: 13px; cursor: pointer; position: relative;
  border: 2px solid transparent; transition: background 0.15s, transform 0.13s var(--md-ease), border-color 0.15s;
}
.file-card.selected { border-color: var(--primary); background: var(--s-mid); }
.file-card:active { background: var(--s-high); transform: scale(0.985); }
.files.list .file-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 14px; border-radius: 16px; }

.file-ico {
  width: 42px; height: 42px; border-radius: 14px; background: var(--s-high); color: var(--primary);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.file-ico.dir { background: var(--primary-c); color: var(--on-primary-c); }
.file-name { font-size: 14px; font-weight: 600; margin-top: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.files.list .file-name { margin-top: 0; }
.file-meta { font-size: 12px; color: var(--text-var); margin-top: 2px; }

.stat-card { background: var(--s-low); border-radius: 24px; padding: 18px; margin-bottom: 12px; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }
.stat-tile { background: var(--s-mid); border-radius: 16px; padding: 12px 14px; }

.upload-banner {
  position: fixed; bottom: calc(92px + var(--safe-bottom)); left: 50%; transform: translateX(-50%);
  width: calc(100% - 32px); max-width: 420px; background: var(--s-high);
  border-radius: 20px; padding: 14px 18px; display: none; z-index: 40;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.42);
}
.upload-banner.show { display: block; }

.preview-modal {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.92); z-index: 70;
  display: none; flex-direction: column; padding: calc(14px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
}
.preview-modal.open { display: flex; }
.preview-body { flex: 1; display: flex; align-items: center; justify-content: center; overflow: auto; }
.preview-body img, .preview-body video { max-width: 100%; max-height: 78vh; border-radius: 14px; }
.editor-area {
  width: 100%; height: 74vh; background: var(--s-low); color: var(--text);
  border: 1px solid var(--outline); border-radius: 16px; padding: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.5; outline: none;
}

.seed-row { display: flex; gap: 12px; margin: 10px 0 18px; }
.seed-dot { width: 32px; height: 32px; border-radius: 16px; border: 2.5px solid transparent; cursor: pointer; }
.seed-dot.active { border-color: var(--text); }
.tab { display: none; }
.tab.active { display: block; }
