:root{
  --hf-bg:#ffffff;
  --hf-text:#111827;
  --hf-sub:#6b7280;
  --hf-border:#e5e7eb;
  --hf-muted:#f8fafc;
  --hf-emerald:#10b981;
  --hf-emerald-600:#059669;
  --hf-shadow:0 10px 30px rgba(2,6,23,.08);
  --radius-xl:18px; --radius-2xl:22px; --radius-pill:9999px;
  --preview-max-h: 60vh; /* максимум высоты превью относительно первого блока/экрана */
}
html.dark{
  --hf-bg:#0f172a; --hf-text:#e5e7eb; --hf-sub:#94a3b8; --hf-border:rgba(148,163,184,.28);
  --hf-muted:#0b1220; --hf-emerald:#10b981; --hf-emerald-600:#059669;
}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;font:14px/1.6 ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Inter,Arial;background:var(--hf-muted);color:var(--hf-text)}

/* ---------- Topbar ---------- */
.hf-topbar{position:sticky;top:0;z-index:40;background:rgba(255,255,255,.9);backdrop-filter:blur(10px);border-bottom:1px solid var(--hf-border)}
html.dark .hf-topbar{background:rgba(15,23,42,.8);}
.hf-container{max-width:1180px;margin:0 auto;padding:0 16px}
.hf-topbar__inner{display:flex;align-items:center;justify-content:space-between;height:56px}
.hf-brand{display:flex;align-items:center;gap:8px;font-weight:700}
.hf-emoji{font-size:20px}

/* Theme toggle */
.theme-toggle{display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:12px;border:1px solid var(--hf-border);background:var(--hf-bg);color:var(--hf-text);cursor:pointer;box-shadow:var(--hf-shadow);transition:transform .06s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease}
.theme-toggle:active{transform:translateY(1px)}
.theme-toggle__icon{font-size:18px;line-height:1}
html.dark .theme-toggle__icon--sun{display:none}
html.dark .theme-toggle__icon--moon{display:inline-block}
.theme-toggle__icon--moon{display:none}

/* ---------- Hero ---------- */
.hf-hero{padding:40px 16px 60px}
.hf-hero__card{padding:26px}
.hf-card{background:var(--hf-bg);border:1px solid var(--hf-border);border-radius:var(--radius-2xl);box-shadow:var(--hf-shadow)}
.hf-card--glass{background:linear-gradient(180deg,#fff,rgba(255,255,255,.96))}
html.dark .hf-card--glass{background:linear-gradient(180deg,#0f172a,rgba(15,23,42,.96))}
.hf-hero__head{margin-bottom:18px}
.hf-title{font-size:26px;line-height:1.25;margin:0 0 6px}
.hf-subtitle{margin:0;color:var(--hf-sub)}

/* ---------- Grid ---------- */
.hf-grid{display:grid;grid-template-columns:1fr 1fr;gap:22px;margin-top:20px}
@media (max-width: 860px){.hf-grid{grid-template-columns:1fr}}

/* ---------- Inputs ---------- */
.hf-pane{display:flex;flex-direction:column}
.hf-label{font-weight:600;margin:0 0 8px}
.hf-label--sm{font-size:12px;color:#374151;margin:12px 0 6px}
html.dark .hf-label--sm{color:#cbd5e1}
.hf-input-row{display:flex;gap:10px;align-items:center}
.hf-input{flex:1;height:44px;padding:10px 12px;border:1px solid var(--hf-border);border-radius:14px;outline:none;transition:border .2s,box-shadow .2s}
.hf-input:focus{border-color:#a7f3d0;box-shadow:0 0 0 4px rgba(16,185,129,.15)}

.hf-btn{height:44px;padding:0 16px;border:none;border-radius:14px;background:var(--hf-emerald);color:white;font-weight:600;cursor:pointer;transition:transform .06s ease, background .2s ease, box-shadow .2s ease;box-shadow:0 8px 20px rgba(16,185,129,.25)}
.hf-btn:hover{background:var(--hf-emerald-600)}
.hf-btn:active{transform:translateY(1px)}
.hf-btn--disabled{background:#e5e7eb;color:#9ca3af;cursor:not-allowed;box-shadow:none}

.hf-hint{margin:8px 0 0;color:#6b7280;font-size:12px}
html.dark .hf-hint{color:#94a3b8}

/* ---------- Dropzone ---------- */
.hf-dropzone{min-height:132px;border:2px dashed var(--hf-border);border-radius:18px;display:flex;align-items:center;justify-content:center;background:var(--hf-bg);position:relative;transition:border-color .2s, box-shadow .2s, transform .2s}
.hf-dropzone:focus{outline:none;box-shadow:0 0 0 4px rgba(16,185,129,.15)}
.hf-dropzone:hover{border-color:#a7f3d0}
.hf-dropzone__hint{text-align:center;padding:16px}
.hf-dropzone__text{font-weight:600}
.hf-dropzone__sub{font-size:12px;color:var(--hf-sub)}
.hf-hidden{display:none}

/* Clickable file input overlay (only when empty) */
.hf-fileinput-vis{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer;z-index:1}
/* When file selected, hide input overlay so inner buttons are clickable */
.hf-dropzone.has-file .hf-fileinput-vis{display:none}
/* Ensure file info content sits above overlay */
.hf-fileinfo{position:relative;z-index:2;width:100%;padding:14px}
.hf-fileinfo .name{font-weight:600; max-width:100%; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;}
.hf-fileinfo .meta{color:var(--hf-sub);font-size:12px}
.hf-fileinfo__row{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}

/* ---------- Actions ---------- */
.hf-actions{margin-top:12px}

/* ---------- Status ---------- */
.hf-status{margin-top:18px}
.status{border:1px solid var(--hf-border);border-radius:var(--radius-xl);padding:12px 14px;background:var(--hf-bg)}
.status--ok{border-color:#bbf7d0;background:#f0fdf4}
.status--err{border-color:#fecaca;background:#fef2f2}
html.dark .status--ok{ background:rgba(16,185,129,.1); border-color:rgba(16,185,129,.25); }
html.dark .status--err{ background:rgba(244,63,94,.1); border-color:rgba(244,63,94,.3); }
.status--load{position:relative;overflow:hidden}
.status--load::after{content:"";position:absolute;inset:0;background:linear-gradient(120deg,transparent 0%, rgba(16,185,129,.11) 50%, transparent 100%);animation:shine 1.1s linear infinite;transform:translateX(-100%)}

/* ---------- Preview ---------- */
.hf-preview{margin-top:14px}
.preview-card{background:var(--hf-bg);border:1px solid var(--hf-border);border-radius:var(--radius-xl);padding:14px}
.preview-title{margin:0 0 8px;font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.preview-media{
  border:1px solid var(--hf-border);
  border-radius:14px;
  overflow:hidden;
  display:flex;
  justify-content:center;
  align-items:center;
  background:#000; /* аккуратнее при letterboxing */
}
.preview-media video, .preview-media img{
  display:block;
  max-width:100%;
  height:auto;
  max-height:var(--preview-max-h);
  object-fit:contain;
  margin:0 auto;
}

/* Meta under video */
.preview-meta{
  margin-top:10px;
  display:grid;
  gap:8px;
}
.preview-desc{
  margin:0;
  color:var(--hf-text);
  white-space:pre-wrap;
  word-break:break-word;          /* чтобы длинные названия не выезжали */
}
.preview-stats{
  display:flex; gap:8px; flex-wrap:wrap;
}
.meta-pill{
  display:inline-flex; align-items:center; gap:8px;
  padding:8px 10px;
  border-radius:12px;
  background:linear-gradient(180deg, rgba(148,163,184,.10), rgba(148,163,184,.04));
  border:1px solid var(--hf-border);
  font-weight:600;
  font-size:13px;
  color:var(--hf-text);
}
.meta-pill__ico{font-size:16px;line-height:1}

/* ---------- CTA row (Скачать / Страница) ---------- */
.hf-cta-row{
  margin-top:12px;
  display:flex; gap:10px;
  width:100%;
}
.hf-cta{
  --shine: rgba(255,255,255,.35);
  appearance:none; border:1px solid rgba(2,6,23,.08); cursor:pointer; position:relative;
  display:flex; align-items:center; justify-content:center; gap:10px;
  padding:12px 14px; border-radius:16px; color:#0b1220; font-weight:800;
  width:50%;
  box-shadow:0 10px 22px rgba(2,6,23,.08), inset 0 1px 0 var(--shine);
  transform:translateY(0); transition:transform .08s ease, box-shadow .18s ease, filter .18s ease, background .2s ease;
  text-decoration:none;
  backdrop-filter: saturate(1.05);
}
.hf-cta:hover{ filter:saturate(1.05); box-shadow:0 12px 26px rgba(2,6,23,.12), inset 0 1px 0 var(--shine); }
.hf-cta:active{ transform:translateY(1px); }
.hf-cta--download{ background:linear-gradient(135deg,#34d399 0%, #22d3ee 100%); }
.hf-cta--page{ background:linear-gradient(135deg,#60a5fa 0%, #a78bfa 100%); }
.hf-cta__ico{
  font-size:16px; line-height:1; display:inline-grid; place-items:center;
  width:26px; height:26px; border-radius:10px; background:rgba(255,255,255,.18);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.25);
}
.hf-cta__label{ white-space:nowrap; color:#0b1220; }

/* мобильная укладка: равные отступы, кнопки во всю ширину и аккуратные */
@media (max-width: 540px){
  .hf-cta-row{ flex-direction:column; gap:10px; }
  .hf-cta{ width:100%; padding:12px 16px; }
}

/* ---------- Gallery ---------- */
.hf-album{margin-top:14px}
.hf-album__grid{display:grid;gap:10px;grid-template-columns:repeat(4,1fr)}
@media (max-width:1024px){.hf-album__grid{grid-template-columns:repeat(3,1fr)}}
@media (max-width:640px){.hf-album__grid{grid-template-columns:repeat(2,1fr)}}
.hf-thumb{border:1px solid var(--hf-border);border-radius:14px;overflow:hidden;background:var(--hf-bg);transition:transform .12s ease, box-shadow .2s ease}
.hf-thumb:hover{transform:translateY(-1px);box-shadow:0 8px 22px rgba(2,6,23,.08)}
.hf-thumb img{display:block;width:100%;height:160px;object-fit:cover}
.hf-thumb__name{padding:8px 10px;font-size:12px;color:#374151;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
html.dark .hf-thumb__name{color:#cbd5e1}
.hf-album__zip{margin-top:10px;display:flex;gap:10px;align-items:center}

/* ---------- Blob & anim ---------- */
.hf-blob{width:44px;height:44px;border-radius:50%;background:radial-gradient(circle at 30% 30%, #a7f3d0 0%, #34d399 35%, #10b981 70%, #059669 100%);box-shadow:0 12px 30px rgba(16,185,129,.25);margin:0 auto 8px}
@keyframes pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.06)}}
.pulse{animation:pulse 1.6s ease-in-out infinite}
@keyframes shine{to{transform:translateX(100%)}}

/* ---------- Footer ---------- */
.hf-footer{border-top:1px solid var(--hf-border);padding:18px 0;background:var(--hf-bg);color:#4b5563}
html.dark .hf-footer{color:#94a3b8}

/* ---------- Gradient sticker buttons (опции обработки) ---------- */
.hf-gbtns{ display:flex; gap:10px; flex-wrap:wrap; align-items:center; margin-top:10px; }
.hf-gbtn{
  --shine: rgba(255,255,255,.35);
  appearance:none; border:0; cursor:pointer; position:relative;
  display:flex; align-items:center; gap:10px;
  padding:12px 14px; border-radius:16px; color:#fff; font-weight:800;
  box-shadow:0 10px 22px rgba(2,6,23,.10), inset 0 1px 0 var(--shine);
  transform:translateY(0); transition:transform .08s ease, box-shadow .18s ease, filter .18s ease;
  outline:none;
}
.hf-gbtn:nth-child(1){ background:linear-gradient(135deg,#fb7185 0%, #f59e0b 100%); }
.hf-gbtn:nth-child(2){ background:linear-gradient(135deg,#34d399 0%, #22d3ee 100%); } /* «Удалить мат» — зелено-циановый */
.hf-gbtn:hover{ filter:saturate(1.05); box-shadow:0 12px 26px rgba(2,6,23,.14), inset 0 1px 0 var(--shine); }
.hf-gbtn:active{ transform:translateY(1px); }
.hf-gbtn__emoji{ font-size:20px; line-height:1; display:inline-grid; place-items:center; width:28px; height:28px; border-radius:10px; background:rgba(255,255,255,.15); box-shadow:inset 0 1px 0 rgba(255,255,255,.25); }
.hf-gbtn__label{ white-space:nowrap; }
.hf-gbtn[aria-pressed="true"]{ box-shadow:0 12px 30px rgba(2,6,23,.16), 0 0 0 3px rgba(255,255,255,.5) inset; filter:saturate(1.1) brightness(1.02); }
@media (max-width:480px){ .hf-gbtn{ flex:1 1 100%; justify-content:center; } }

/* ---------- Mobile polish: одинаковые поля, обрезка длинных надписей ---------- */
@media (max-width: 540px){
  .hf-container{padding:0 12px}
  .hf-hero{padding:28px 12px 48px}
  .preview-title,
  .hf-dropzone__text,
  .hf-fileinfo .name,
  .hf-thumb__name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
}
