:root {
  /* Asekurácia – oficiálny dizajn manuál 2025 */
  --navy: #152841;        /* Dark blue – primárna */
  --navy-2: #1d3a5e;
  --turquoise: #09C79B;   /* Turquoise – akcent */
  --turquoise-dark: #07ad87;
  --light: #EAEFF5;       /* Light blue – pozadie */
  --card: #ffffff;
  --line: #D6DEEA;
  --text: #152841;
  --muted: #76849a;
  --error: #c23155;
  --shadow: 0 4px 16px rgba(21, 40, 65, 0.10);
  --gradient: linear-gradient(125deg, #152841 0%, #163a55 45%, #09C79B 125%);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--light);
  color: var(--text);
  line-height: 1.5;
}

/* --- Topbar / branding --- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; padding-top: max(14px, env(safe-area-inset-top));
  background: linear-gradient(110deg, #152841 0%, #152841 55%, #0c6f78 100%);
  color: #fff;
  border-bottom: 3px solid var(--turquoise);
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 11px; }
.logo { width: 30px; height: 29px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: 2px; }
.brand-sub { font-size: 11.5px; opacity: 0.82; font-weight: 400; letter-spacing: 0.3px; }
.demo-badge {
  background: var(--turquoise); color: var(--navy); font-weight: 700; font-size: 11px;
  letter-spacing: 0.5px; padding: 4px 10px; border-radius: 999px;
}

.container { max-width: 640px; margin: 0 auto; padding: 16px; padding-bottom: 40px; }

.screen { display: none; }
.screen.active { display: block; animation: fade 0.2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px);} to { opacity: 1; transform: none; } }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px;
}

h1 { font-size: 23px; font-weight: 700; margin: 0 0 6px; color: var(--navy); letter-spacing: -0.2px; }
.claim { color: var(--turquoise-dark); font-weight: 600; font-style: italic; margin: 0 0 12px; }
.muted { color: var(--muted); font-size: 14px; }
.error { color: var(--error); font-size: 14px; font-weight: 600; margin: 10px 0 0; }

/* --- Formulár EČV --- */
.intro label { display: block; font-weight: 600; margin: 16px 0 6px; font-size: 14px; color: var(--navy); }
.intro input {
  width: 100%; padding: 14px; font-size: 20px; letter-spacing: 1px; text-transform: uppercase;
  border: 2px solid var(--line); border-radius: 12px; outline: none; text-align: center;
  color: var(--navy); font-weight: 700; font-family: inherit;
}
.intro input:focus { border-color: var(--turquoise); box-shadow: 0 0 0 3px rgba(9,199,155,0.20); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%; border: none; border-radius: 12px; padding: 15px 16px;
  font-size: 16px; font-weight: 700; cursor: pointer; margin-top: 16px; font-family: inherit;
}
.btn.primary { background: var(--turquoise); color: var(--navy); }
.btn.primary:active { background: var(--turquoise-dark); }
.btn.primary:disabled { background: #cdd7e3; color: #8a98ab; cursor: not-allowed; }
.btn.big { padding: 16px; font-size: 17px; position: sticky; bottom: 12px; box-shadow: var(--shadow); }

/* --- Karta vozidla --- */
.vehicle-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 0; }
.vehicle-row b { text-align: right; color: var(--navy); font-size: 20px; letter-spacing: 1px; font-weight: 700; }

/* --- Progres --- */
.progress { display: flex; align-items: center; gap: 10px; margin: 4px 0 14px; }
.progress-bar { flex: 1; height: 9px; background: #d8e0ec; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--gradient); transition: width 0.25s ease; }
.section-hint { margin: 0 0 12px; }

/* --- Mriežka fotiek --- */
.photo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.photo-card {
  position: relative; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; overflow: hidden; cursor: pointer; box-shadow: var(--shadow);
  transition: border-color 0.2s, transform 0.1s;
}
.photo-card:active { transform: scale(0.98); }
.photo-card.done { border-color: var(--turquoise); border-width: 2px; }
.photo-card .thumb {
  aspect-ratio: 4 / 3; width: 100%; object-fit: cover; display: block; background: var(--light);
}
.photo-card .sample { aspect-ratio: 4 / 3; width: 100%; display: block; background: var(--light); }
.photo-card .meta { padding: 9px 11px; }
.photo-card .title { font-size: 13px; font-weight: 600; color: var(--navy); }
.photo-card .hint { font-size: 11px; color: var(--muted); }
.photo-card .req { color: var(--error); }

.badge-ok {
  position: absolute; top: 8px; right: 8px; width: 27px; height: 27px; border-radius: 50%;
  background: var(--turquoise); color: var(--navy); display: none; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px; box-shadow: var(--shadow);
}
.photo-card.done .badge-ok { display: flex; }
.retake {
  position: absolute; top: 8px; left: 8px; background: rgba(21,40,65,0.78); color: #fff;
  font-size: 11px; padding: 4px 9px; border-radius: 999px; display: none; font-weight: 500;
}
.photo-card.done .retake { display: inline-block; }

/* --- Ilustrácie (oficiálne, Asekurácia) --- */
.hero-illu {
  display: block; width: 88%; max-width: 320px; height: auto; margin: 2px auto 14px;
}

/* --- Hotovo --- */
.done { text-align: center; padding: 28px 20px 34px; }
.done-illu { display: block; width: 70%; max-width: 240px; height: auto; margin: 0 auto 4px; }
.check-badge {
  width: 44px; height: 44px; border-radius: 50%; background: var(--gradient); color: #fff;
  font-size: 24px; font-weight: 800; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px; box-shadow: 0 6px 16px rgba(9,199,155,0.30);
}

/* --- Výber zdroja fotky (action sheet) --- */
.chooser { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; }
.chooser[hidden] { display: none; }
.chooser-backdrop { position: absolute; inset: 0; background: rgba(21,40,65,0.45); }
.chooser-sheet {
  position: relative; width: 100%; max-width: 640px; margin: 0 auto;
  background: var(--card); border-radius: 18px 18px 0 0; padding: 10px 14px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  box-shadow: 0 -6px 24px rgba(21,40,65,0.18);
  animation: sheetUp 0.22s ease;
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
.chooser-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; border: none; background: transparent; cursor: pointer;
  font-family: inherit; font-size: 17px; font-weight: 600; color: var(--navy);
  padding: 16px; border-bottom: 1px solid var(--line);
}
.chooser-btn:active { background: var(--light); }
.chooser-ico { font-size: 20px; }
.chooser-btn.cancel { color: var(--muted); border-bottom: none; font-weight: 500; }

/* --- Overlay --- */
.overlay {
  position: fixed; inset: 0; background: rgba(234,239,245,0.90); z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
}
.overlay[hidden] { display: none; }
.overlay p { color: var(--navy); font-weight: 600; }
.spinner {
  width: 44px; height: 44px; border: 4px solid #d0dae8; border-top-color: var(--turquoise);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Animácie a interaktivita
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {

  /* Hero ilustrácia – jemné vznášanie */
  .hero-illu { animation: float 5s ease-in-out infinite; transform-origin: center; }
  @keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }

  /* Karta – plynulé interakcie */
  .photo-card { transition: transform .18s cubic-bezier(.2,.8,.2,1), box-shadow .18s, border-color .2s; }
  .photo-card:hover { transform: translateY(-4px); box-shadow: 0 10px 26px rgba(21,40,65,.16); }
  .photo-card:active { transform: scale(.97); }

  /* „Scan" línia cez nedokončené karty – živý inšpekčný efekt (striedmo, posunuté fázy) */
  .photo-card { position: relative; }
  .photo-card::after {
    content: ""; position: absolute; left: 0; right: 0; top: 0; height: 30%;
    background: linear-gradient(180deg, rgba(9,199,155,.30), rgba(9,199,155,0));
    pointer-events: none; opacity: 0; will-change: transform, opacity;
    animation: scan 3.6s ease-in-out infinite;
  }
  @keyframes scan {
    0%   { transform: translateY(-30%); opacity: 0; }
    12%  { opacity: .85; }
    48%  { transform: translateY(240%); opacity: .85; }
    60%  { opacity: 0; }
    100% { opacity: 0; }
  }
  .photo-card:nth-child(3n)   ::after, .photo-card:nth-child(3n)::after   { animation-delay: 1.2s; }
  .photo-card:nth-child(3n+1) ::after, .photo-card:nth-child(3n+1)::after { animation-delay: .4s; }
  .photo-card:nth-child(3n+2) ::after, .photo-card:nth-child(3n+2)::after { animation-delay: 2.2s; }
  .photo-card.done::after { display: none; }

  /* Karta po nafotení – pop */
  .photo-card.done { animation: cardPop .42s cubic-bezier(.2,.9,.3,1.3); }
  @keyframes cardPop { 0% { transform: scale(.95); } 60% { transform: scale(1.03); } 100% { transform: scale(1); } }

  /* Badge ✓ – spring */
  .photo-card.done .badge-ok { animation: badgePop .45s cubic-bezier(.2,.9,.3,1.5); }
  @keyframes badgePop { 0% { transform: scale(0) rotate(-40deg); } 70% { transform: scale(1.25); } 100% { transform: scale(1) rotate(0); } }

  /* Progres – pohyblivý lesk */
  .progress-fill { position: relative; overflow: hidden; }
  .progress-fill::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent);
    transform: translateX(-100%); animation: shimmer 1.8s ease-in-out infinite;
  }
  @keyframes shimmer { 0% { transform: translateX(-100%); } 60%, 100% { transform: translateX(100%); } }

  /* Tlačidlo „Ukončiť" – pulz keď je všetko nafotené */
  .btn.big.ready { animation: readyPulse 1.5s ease-in-out infinite; }
  @keyframes readyPulse {
    0%, 100% { box-shadow: 0 4px 16px rgba(9,199,155,.28); }
    50%      { box-shadow: 0 6px 28px rgba(9,199,155,.65); transform: translateY(-1px); }
  }

  /* Obrazovka „hotovo" – ilustrácia priletí + odznak vyskočí */
  #screen-done.active .done-illu { animation: bounceIn .7s cubic-bezier(.2,.8,.2,1.2); }
  @keyframes bounceIn { 0% { transform: scale(.6) translateY(24px); opacity: 0; } 60% { transform: scale(1.05); } 100% { transform: scale(1); opacity: 1; } }
  #screen-done.active .check-badge { animation: badgePop .5s .12s backwards cubic-bezier(.2,.9,.3,1.5); }
}

/* Video hero má vlastný pohyb – nepridávať CSS vznášanie */
video.hero-illu { animation: none !important; }
