/* tiktokpusher — общий стиль. Телефон первым, дальше шире. */
:root {
  --bg: #f6f6f4;
  --card: #ffffff;
  --text: #1b1b1b;
  --muted: #6b6b6b;
  --line: #e2e2de;
  --accent: #ce101c;
  --ok: #1f7a3a;
  --warn: #b25b00;
  --radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #141414; --card: #1e1e1e; --text: #f0f0f0; --muted: #a0a0a0; --line: #333; }
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom); }
.top { display: flex; align-items: center; justify-content: space-between; max-width: 720px; margin: 0 auto;
       padding: 16px 0; }
.logo { font-weight: 800; font-size: 20px; color: var(--accent); text-decoration: none; }
main { max-width: 720px; margin: 0 auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
        margin-bottom: 16px; overflow-x: auto; }
h1 { font-size: 22px; margin: 0 0 12px; }
h2 { font-size: 17px; margin: 0 0 8px; }
label { display: block; margin-bottom: 8px; color: var(--muted); }
input[type=password] { width: 100%; font-size: 17px; padding: 12px; border: 1px solid var(--line);
                       border-radius: 8px; background: var(--bg); color: var(--text); }
button { font-size: 17px; padding: 12px 18px; border: 0; border-radius: 8px; background: var(--accent); color: #fff;
         cursor: pointer; margin-top: 12px; }
button:disabled { opacity: .6; cursor: default; }
button.link { background: none; color: var(--muted); padding: 8px; margin: 0; }
.error { color: var(--accent); margin-top: 12px; min-height: 1.2em; }
.muted { color: var(--muted); }
.low { color: var(--warn); font-weight: 600; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; }
td.num, th.num { text-align: right; }
@media (min-width: 768px) {
  .login { max-width: 420px; margin: 10vh auto 0; }
}

/* ---- фаза 3: песни, загрузка, обрезка, текст ---- */
/* атрибут hidden (nav на экране входа, полоса загрузки, подсказка языка) сильнее любого display ниже: правило
   браузера [hidden] { display: none } слабее стиля страницы, и nav { display: flex } показал бы меню при входе */
[hidden] { display: none !important; }
.top { gap: 12px; }
nav { display: flex; align-items: center; gap: 10px; font-size: 15px; }
nav a { color: var(--muted); text-decoration: none; }
a { color: var(--accent); }
a.button { display: inline-block; font-size: 17px; padding: 12px 18px; border-radius: 8px; background: var(--accent);
           color: #fff; text-decoration: none; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.row.between { justify-content: space-between; }
button.small { font-size: 15px; padding: 8px 12px; margin-top: 0; }
button.danger, .danger { color: var(--accent); }
label.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--text); }
input[type=text], input[type=file], select { width: 100%; font-size: 17px; padding: 10px 12px; margin-bottom: 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); }
select { width: auto; margin-bottom: 0; }
progress { width: 100%; height: 10px; margin-top: 12px; accent-color: var(--accent); }
ul.songs { list-style: none; padding: 0; margin: 0; }
.card.song { display: grid; gap: 4px; }
.card.song .title { font-weight: 600; font-size: 17px; }
.card.song button { justify-self: start; }
/* волна: ручки куска широкие — под палец (раздел 11) */
.wave { width: 100%; margin: 12px 0 4px; touch-action: pan-y; }
.wave ::part(region-handle) { width: 16px !important; background: rgba(206, 16, 28, 0.35) !important; }
.wave ::part(region-handle-left) { border-left: 3px solid var(--accent) !important; border-radius: 6px 0 0 6px; }
.wave ::part(region-handle-right) { border-right: 3px solid var(--accent) !important; border-radius: 0 6px 6px 0; }
.edges { display: grid; gap: 8px; }
.edge { display: flex; align-items: center; gap: 6px; }
.edge label { width: 64px; margin: 0; color: var(--text); }
input.time { width: 6.5em; margin: 0; text-align: center; font-variant-numeric: tabular-nums; }
.lines { display: grid; gap: 8px; margin: 12px 0; }
.line { display: grid; grid-template-columns: 6.5em auto 6.5em 1fr auto; gap: 6px; align-items: center; }
.line input { margin: 0; }
@media (max-width: 560px) {
  /* строка в две строки сетки (время, затем текст и «×»): без разделителя пары не отличить друг от друга */
  .lines { gap: 0; }
  .line { grid-template-columns: 6.5em auto 6.5em 1fr; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .line:last-child { border-bottom: 0; }
  .line input.text { grid-column: 1 / 4; }
}
@media (min-width: 768px) {
  .edges { grid-template-columns: 1fr 1fr; }
}

/* ---- фаза 4: «Создать» и «Готовые» ---- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.tpl { display: grid; gap: 6px; margin: 0; color: var(--text); cursor: pointer; }
.tpl input { justify-self: start; }
.tpl video { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 8px; background: #000; }
input[type=number] { width: 7em; font-size: 17px; padding: 10px 12px; margin-bottom: 12px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--bg); color: var(--text); }
.langs { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 4px 0 8px; }
label.lang.muted { color: var(--muted); }
img.sample { display: block; max-width: 100%; margin-top: 12px; border-radius: 8px; }
.dist { font-weight: 600; }
.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 8px; }
.tab { white-space: nowrap; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--text);
  text-decoration: none; }
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
a.button.small { font-size: 15px; padding: 8px 12px; }
.videos { display: grid; gap: 16px; }
.card.video { display: grid; gap: 6px; }
.card.video video, .card.video .placeholder { width: 100%; max-height: 70vh; aspect-ratio: 9 / 16; border-radius: 8px;
  background: #000; }
.card.video .placeholder { display: grid; place-items: center; color: #aaa; }
.card.video progress { margin-top: 0; }
.caption strong { display: block; margin-bottom: 4px; }
.caption .desc { white-space: pre-wrap; margin: 0 0 4px; }
.edit { display: grid; gap: 6px; }
.edit input { margin: 0; }
.offscreen { position: fixed; left: -9999px; top: 0; }
.card.video .error:empty { display: none; }
.remove-error { margin-bottom: 12px; }
.remove-error:empty { display: none; }
/* в меню четыре пункта: на телефоне шапка переносится, а не уходит за край */
@media (max-width: 480px) {
  .top { flex-wrap: wrap; row-gap: 4px; }
  nav { flex-wrap: wrap; gap: 6px 12px; font-size: 14px; }
}
@media (min-width: 768px) {
  .videos { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1200px) {
  main { max-width: 1080px; }
  .top { max-width: 1080px; }
  .videos { grid-template-columns: repeat(3, 1fr); }
}
