:root {
  --bg: #FAFAFA;
  --surface: #FFFFFF;
  --ink: #171717;
  --ink-2: #4D4D4D;
  --ink-3: #8A8A8A;
  --border-soft: #EBEBEB;
  --ring: rgba(0,0,0,.10);
  --ring-strong: rgba(0,0,0,.16);
  --accent: #FF2D8C;
  --accent-tint: #FFEAF4;
  --danger: #E5484D;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --tabbar-h: 78px;
  --safe-b: env(safe-area-inset-bottom, 0px);

  /* тень-как-рамка: заменяет обычный border, даёт мягче переходы и глубину без веса */
  --shadow-ring: 0 0 0 1px var(--ring);
  --shadow-card: 0 0 0 1px var(--ring), 0 1px 3px rgba(0,0,0,.05), 0 8px 20px -14px rgba(0,0,0,.10);
  --shadow-lift: 0 0 0 1px var(--ring), 0 4px 16px -6px rgba(0,0,0,.12);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "liga" 1;
}

body {
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 20px);
  min-height: 100vh;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 18px 8px;
}
.brand {
  font-size: 19px; font-weight: 600; letter-spacing: -0.02em;
}
.brand .dot { color: var(--accent); }
.chip {
  background: var(--surface); box-shadow: var(--shadow-ring);
  border-radius: 999px; padding: 7px 12px;
  font-size: 12.5px; font-weight: 500; color: var(--ink-2);
  font-feature-settings: "tnum" 1;
}

.screen { padding: 12px 16px 8px; display: flex; flex-direction: column; gap: 12px; }

.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  padding: 18px;
}
.card-title {
  font-size: 13px; font-weight: 500; margin-bottom: 12px;
  color: var(--ink-2); letter-spacing: -0.01em;
}

.dropzone {
  display: flex; align-items: center; gap: 13px;
  border: 1px dashed #D9D9D9; border-radius: var(--r-md);
  padding: 18px; cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.dropzone:active { background: #FCFCFC; border-color: #C4C4C4; }
.dz-icon {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--ink); color: #fff; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.dz-text { display: flex; flex-direction: column; gap: 2px; }
.dz-title { font-size: 15px; font-weight: 500; letter-spacing: -0.01em; }
.dz-hint { font-size: 12.5px; color: var(--ink-3); }

.file-picked {
  margin-top: 12px; display: flex; align-items: center; gap: 10px;
  background: var(--bg); box-shadow: var(--shadow-ring);
  border-radius: var(--r-sm); padding: 10px 10px 10px 12px;
}
.file-ico { color: var(--ink-3); flex-shrink: 0; display: flex; }
.file-name {
  font-size: 13.5px; font-weight: 500; color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1;
}
.btn-icon {
  border: none; background: transparent; color: var(--ink-3);
  cursor: pointer; padding: 6px; display: flex; border-radius: var(--r-sm);
  flex-shrink: 0;
}
.btn-icon:active { background: var(--ring); color: var(--ink); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-opt {
  display: flex; align-items: center; gap: 7px;
  box-shadow: var(--shadow-ring); border-radius: 999px;
  padding: 8px 14px 8px 10px; font-size: 13.5px; font-weight: 500;
  background: var(--surface); cursor: pointer; color: var(--ink-2);
  transition: box-shadow .12s ease, color .12s ease;
}
.chip-opt .swatch {
  width: 15px; height: 15px; border-radius: 50%; flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
}
.chip-opt.active {
  color: var(--ink);
  box-shadow: 0 0 0 1.5px var(--accent);
}

.btn-primary {
  border: none; border-radius: var(--r-md);
  padding: 15px; font-size: 15px; font-weight: 500; letter-spacing: -0.01em;
  color: #fff; background: var(--ink);
  cursor: pointer; transition: opacity .12s ease;
}
.btn-primary:active { opacity: .85; }
.btn-primary:disabled {
  background: #EDEDED; color: #B8B8B8; cursor: default;
}

.progress-card { display: flex; flex-direction: column; gap: 10px; }
.progress-row { display: flex; align-items: baseline; justify-content: space-between; }
.progress-step { font-size: 13.5px; font-weight: 500; color: var(--ink); }
.progress-pct {
  font-size: 13px; font-weight: 500; color: var(--ink-2);
  font-feature-settings: "tnum" 1;
}
.progress-track {
  height: 5px; border-radius: 999px; background: #EFEFEF; overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: var(--accent);
  transition: width .5s ease;
}
.progress-note { font-size: 12.5px; color: var(--ink-3); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(250,250,250,.92);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  box-shadow: inset 0 1px 0 var(--border-soft);
  display: flex; align-items: center; justify-content: space-around;
}
.tab {
  border: none; background: none; display: flex; flex-direction: column;
  align-items: center; gap: 5px; font-size: 10.5px; color: var(--ink-3);
  font-weight: 500; padding: 6px 8px; cursor: pointer; letter-spacing: -0.01em;
}
.tab-ico { display: block; }
.tab-active { color: var(--ink); }

.toast {
  position: fixed; left: 16px; right: 16px;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px);
  background: var(--ink); color: #fff; text-align: center;
  padding: 11px 16px; border-radius: var(--r-md); font-size: 13.5px; font-weight: 500;
  opacity: 0; pointer-events: none; transform: translateY(6px);
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A0A0A; --surface: #161616; --ink: #F5F5F5; --ink-2: #A8A8A8; --ink-3: #6E6E6E;
    --border-soft: #262626; --ring: rgba(255,255,255,.10); --ring-strong: rgba(255,255,255,.16);
    --accent-tint: #2A0F1C;
  }
  :root:not([data-theme="light"]) .tabbar { background: rgba(10,10,10,.85); }
  :root:not([data-theme="light"]) .progress-track { background: #262626; }
}

/* --- экран «Ролики» --- */
.reel-list { display: flex; flex-direction: column; gap: 10px; }

.reel-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); box-shadow: var(--shadow-card);
  border-radius: var(--r-lg); padding: 10px;
}
.reel-thumb {
  width: 54px; height: 54px; border-radius: var(--r-sm);
  background: var(--bg); box-shadow: var(--shadow-ring);
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  color: var(--ink-3); overflow: hidden; position: relative;
}
.reel-thumb img {
  width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0;
}
.reel-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.reel-top { display: flex; align-items: center; gap: 7px; }
.reel-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.reel-date {
  font-size: 12.5px; color: var(--ink-3); font-feature-settings: "tnum" 1;
}
.reel-status { font-size: 13.5px; font-weight: 500; color: var(--ink); }
.reel-status.is-muted { color: var(--ink-3); font-weight: 400; }
.reel-status.is-danger { color: var(--danger); }

.reel-action {
  flex-shrink: 0; border: none; border-radius: var(--r-sm);
  padding: 9px 14px; font-size: 13px; font-weight: 500;
  background: var(--ink); color: #fff; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center;
}
.reel-action.is-ghost {
  background: transparent; color: var(--ink-3); box-shadow: var(--shadow-ring);
}

.empty-state { padding: 60px 20px; text-align: center; }
.empty-title { font-size: 15px; font-weight: 500; margin-bottom: 6px; }
.empty-hint { font-size: 13px; color: var(--ink-3); }
