/* downloader.augis.dev - iOS standalone išdėstymas pagal IOS-PWA-ISDESTYMAS.md 4 skyrių */
:root {
  --bg: #f2f4f8; --card: #ffffff; --card2: #eef1f6; --text: #111827; --muted: #6b7280; --line: #e2e6ee;
  --accent: #2563eb; --ok: #16a34a; --crit: #dc2626; --shadow: 0 1px 3px rgba(0,0,0,.08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1420; --card: #171d2b; --card2: #1f2637; --text: #e5e9f0; --muted: #8b93a5; --line: #27304a;
    --accent: #3b82f6; --ok: #22a55b; --crit: #f87171; --shadow: none;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; }
body {
  min-height: calc(100lvh + 1px);            /* +1px: kitaip iOS atiduoda ne visą ekraną */
  overscroll-behavior-y: none;
  background: var(--bg); color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }

/* Rėmas sraute, 100lvh, flex stulpelis: antraštė ir turinys */
.ramas { height: 100lvh; display: flex; flex-direction: column; }
.antraste {
  flex-shrink: 0; padding: env(safe-area-inset-top) 16px 8px;
  min-height: calc(3rem + env(safe-area-inset-top));
}
.antraste-eil { display: flex; align-items: center; justify-content: space-between; padding-top: 8px; }
.antraste-pav { font-size: 20px; font-weight: 700; }
.turinys {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  padding: 12px 16px calc(24px + env(safe-area-inset-bottom));
}
.vaizdas { display: flex; flex-direction: column; gap: 14px; max-width: 520px; margin: 0 auto; width: 100%; }

/* Didelis pagrindinis mygtukas */
.didelis {
  border: 0; border-radius: 22px; background: var(--accent); color: #fff; font: inherit; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 42vh; padding: 24px 18px; text-align: center;
}
.didelis:active { filter: brightness(.92); }
/* Kai sąraše jau yra video - mygtukas žemesnis, kad sąrašas tilptų */
.didelis.mazas { min-height: 0; flex-direction: row; gap: 12px; padding: 18px; }
.didelis.mazas .didelis-ico { font-size: 30px; }
.didelis.mazas .didelis-t { font-size: 20px; }
.didelis.mazas .didelis-s { display: none; }
.didelis:disabled { opacity: .6; }
.didelis.ok { background: var(--ok); }
.didelis-ico { font-size: 64px; line-height: 1; font-weight: 300; }
.didelis-t { font-size: 24px; font-weight: 700; }
.didelis-s { font-size: 14px; opacity: .9; }

/* Kortelės ir eiga */
.card { background: var(--card); border-radius: 14px; padding: 14px; box-shadow: var(--shadow); overflow-wrap: anywhere; }
.card h2 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.card.klaida { border-left: 4px solid var(--crit); }
.klaida-t { font-weight: 700; color: var(--crit); margin-bottom: 4px; }
#klaida-tech { margin-top: 8px; }
.eiga-pav { font-weight: 600; margin-bottom: 4px; }
.eiga-info { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { height: 10px; border-radius: 5px; background: var(--card2); overflow: hidden; margin: 10px 0 6px; }
.bar.plona { height: 6px; margin: 4px 0; }
.bar > i.pilna { background: var(--crit); }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 5px; transition: width .3s; }

/* Mygtukai ir formos */
.btn { border: 0; border-radius: 12px; padding: 13px 16px; font: inherit; font-weight: 600; background: var(--card2); color: var(--text); cursor: pointer; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.danger { background: var(--crit); color: #fff; }
.btn:disabled { opacity: .5; }
.btn-icon { border: 0; background: var(--card2); color: var(--text); width: 40px; height: 40px; border-radius: 50%; font-size: 20px; cursor: pointer; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.link { color: var(--accent); background: none; border: 0; font: inherit; padding: 8px; cursor: pointer; align-self: center; }
#ranka { display: flex; gap: 8px; }
#ranka input { flex: 1; min-width: 0; font: inherit; font-size: 16px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.err { color: var(--crit); min-height: 1.4em; margin: 0; text-align: center; }
#pradzia-err:empty { display: none; }
.irenginys { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.irenginys:last-child { border-bottom: 0; }

/* Prisijungimas */
#login { align-items: center; justify-content: center; padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom); }
.login-box { width: 100%; max-width: 300px; text-align: center; }
.login-logo { width: 72px; height: 72px; border-radius: 16px; }
.login-box h1 { margin: 10px 0 18px; font-size: 24px; }
.pin-dots { display: flex; justify-content: center; gap: 12px; margin-bottom: 18px; min-height: 14px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--muted); }
.pin-dots i.on { background: var(--text); border-color: var(--text); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.pin-pad button { border: 0; border-radius: 50%; aspect-ratio: 1; font: inherit; font-size: 26px; background: var(--card); color: var(--text); box-shadow: var(--shadow); cursor: pointer; }
.pin-pad button.gh { background: none; box-shadow: none; font-size: 18px; color: var(--muted); }
.pin-pad button:active { background: var(--card2); }
.btn-faceid { width: 100%; background: var(--accent); color: #fff; margin-bottom: 10px; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60;
  background: #111827; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: 90%; text-align: center;
}

/* Video sąrašas */
#sarasas { display: flex; flex-direction: column; gap: 10px; }
.sar-antraste { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-top: 6px; }
.video { background: var(--card); border-radius: 14px; padding: 12px 12px 12px 14px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: flex-start; }
.video.klaida { border-left: 4px solid var(--crit); }
.video-k { flex: 1; min-width: 0; }
.video-pav { font-weight: 600; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.video-info { font-size: 13px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.video-info .ok { color: var(--ok); font-weight: 600; }
.video-kl { font-size: 14px; margin-top: 2px; }
.video .bar { margin: 8px 0 4px; }
.video-veiksmas { margin-top: 10px; width: 100%; }
.btn.ok { background: var(--ok); color: #fff; }
.video-x { flex-shrink: 0; border: 0; background: none; color: var(--muted); font-size: 22px; line-height: 1; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; margin: -4px -4px 0 0; }
.video-x:active { background: var(--card2); }
