:root {
  --royal: #1414e6;
  --royal-dark: #0e0eb0;
  --yellow: #f5b800;
  --sunset: #f08a3c;
  --white: #ffffff;
  --bg: #f6f6fb;
  --text: #14142b;
  --muted: #6b6b80;
  --border: #e2e2ec;
  --danger: #d92d20;
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--royal); }
img { display: block; max-width: 100%; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

/* ---------- topo azul ---------- */
.hero {
  background: radial-gradient(120% 120% at 50% 0%, #2a2af0 0%, var(--royal) 55%, var(--royal-dark) 100%);
  color: var(--white);
  text-align: center;
  padding: 56px 16px 64px;
}
.hero img.logo { width: 200px; height: 200px; margin: 0 auto 20px; border-radius: 40px; }
.hero h1 { font-size: clamp(28px, 6vw, 44px); line-height: 1.15; margin: 0 0 12px; font-weight: 800; }
.hero p { font-size: 18px; opacity: 0.92; margin: 0 auto; max-width: 560px; }
.badge {
  display: inline-block; margin-top: 24px; padding: 10px 18px; border-radius: 999px;
  background: var(--yellow); color: var(--royal-dark); font-weight: 700;
}

.features { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); padding: 40px 0; }
.card { background: var(--white); border-radius: var(--radius); padding: 22px; box-shadow: 0 4px 16px rgba(20, 20, 60, 0.06); }
.card h3 { margin: 0 0 6px; font-size: 18px; }
.card p { margin: 0; color: var(--muted); }

footer { padding: 32px 16px 48px; text-align: center; color: var(--muted); font-size: 14px; }
footer a { margin: 0 8px; }

/* ---------- páginas de texto ---------- */
.doc { max-width: 720px; margin: 0 auto; padding: 40px 16px; }
.doc h1 { font-size: 30px; }
.note { background: #fff7e0; border: 1px solid #f5d77a; border-radius: 12px; padding: 14px 16px; }

/* ---------- álbum compartilhado ---------- */
.topbar { background: var(--royal); color: var(--white); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.topbar a.brand { display: flex; align-items: center; gap: 10px; color: var(--white); text-decoration: none; font-weight: 800; font-size: 18px; }
.topbar a.brand img { width: 32px; height: 32px; border-radius: 8px; }
.brand-k { color: var(--yellow); }

.album-head { text-align: center; padding: 32px 0 16px; }
.album-head h1 { margin: 0 0 6px; font-size: clamp(26px, 5vw, 38px); line-height: 1.2; font-weight: 800; }
.album-meta { color: var(--muted); margin: 0; }
.album-note { max-width: 640px; margin: 16px auto 0; font-size: 17px; white-space: pre-line; }

.grid { display: grid; gap: 6px; grid-template-columns: repeat(3, 1fr); padding: 16px 0 24px; }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(4, 1fr); gap: 8px; } }
@media (min-width: 1000px) { .grid { grid-template-columns: repeat(5, 1fr); } }
.tile { position: relative; aspect-ratio: 1; border: 0; padding: 0; border-radius: 10px; overflow: hidden; background: var(--border); cursor: zoom-in; }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.25s ease; }
.tile:hover img { transform: scale(1.03); }
.tile:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

.created { text-align: center; color: var(--muted); font-size: 14px; padding-bottom: 8px; }
.cta { text-align: center; margin: 32px auto 48px; padding: 28px 20px; border-radius: var(--radius); background: var(--royal); color: var(--white); max-width: 560px; }
.cta p { margin: 0 0 4px; font-size: 18px; font-weight: 700; }
.cta span { opacity: 0.85; }

/* senha */
.gate { max-width: 420px; margin: 48px auto; background: var(--white); border-radius: var(--radius); padding: 28px 24px; text-align: center; box-shadow: 0 6px 24px rgba(20, 20, 60, 0.08); }
.gate h1 { margin: 0 0 8px; font-size: 24px; }
.gate p { color: var(--muted); margin: 0 0 18px; }
.code {
  width: 100%; font-size: 30px; letter-spacing: 0.35em; text-align: center; text-transform: uppercase;
  padding: 14px 10px 14px 20px; border-radius: 14px; border: 2px solid var(--border); font-weight: 800; color: var(--royal-dark);
}
.code:focus { outline: none; border-color: var(--royal); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 22px;
  border-radius: 999px; border: 0; font-size: 17px; font-weight: 700; cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--yellow); color: var(--royal-dark); width: 100%; margin-top: 14px; }
.btn-primary:disabled { opacity: 0.6; cursor: wait; }
.error { color: var(--danger); margin-top: 12px; min-height: 1.5em; }
.state { text-align: center; color: var(--muted); padding: 80px 16px; }

/* tela cheia */
.viewer { position: fixed; inset: 0; background: #000; display: none; z-index: 10; }
.viewer.open { display: block; }
.viewer img.full { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.viewer .bar { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: max(12px, env(safe-area-inset-top)) 16px 12px; color: #fff; }
.viewer .counter { font-weight: 600; opacity: 0.9; }
.viewer .actions { display: flex; gap: 8px; }
.round { width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.2); color: #fff; font-size: 20px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.round:hover { background: rgba(255, 255, 255, 0.32); }
.nav { position: absolute; top: 50%; transform: translateY(-50%); }
.nav.prev { left: 12px; }
.nav.next { right: 12px; }
@media (max-width: 600px) { .nav { display: none; } }
.viewer .caption { position: absolute; left: 16px; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); margin: 0 auto; max-width: 640px; background: rgba(0, 0, 0, 0.5); color: #fff; border-radius: 12px; padding: 12px 16px; text-align: center; }
.viewer .caption:empty { display: none; }

/* Sem permissão de download: o iPhone/Android não oferece "Salvar imagem" ao tocar e segurar. */
body.protected .tile img,
body.protected .viewer img.full {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}
body.protected .tile { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
[hidden] { display: none !important; }

/* botão "Baixar fotos" no banner azul */
.top-download {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px;
  border: 0; border-radius: 999px; background: var(--yellow); color: var(--royal-dark);
  font-size: 15px; font-weight: 700; cursor: pointer;
}
.top-download:hover { filter: brightness(1.05); }

/* janela de preparo do download */
.dl-overlay { position: fixed; inset: 0; z-index: 20; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(10, 10, 40, 0.55); }
.dl-overlay.open { display: flex; }
.dl-card { width: 100%; max-width: 380px; background: var(--white); border-radius: var(--radius); padding: 24px; text-align: center; }
.dl-title { margin: 0 0 14px; font-size: 17px; font-weight: 600; }
.dl-track { height: 10px; border-radius: 5px; background: var(--border); overflow: hidden; }
.dl-fill { height: 100%; width: 0; background: var(--yellow); transition: width 0.2s; }
.dl-cancel { background: transparent; color: var(--royal); width: 100%; margin-top: 6px; }
