/* Mapas em Casa — app sempre escuro, no teal dos PDFs. Cada ano tem a sua cor (--yc). */
:root {
  --bg: #0A3441; --panel: #0F4C5E; --panel2: #155A6E; --line: #1E6377; --ink: #F3F8F9; --muted: #A4C2CA;
  --gold: #F2A93B; --ok: #7FD8A6; --danger: #FFA493;
  --y5: #2E9D5B; --y6: #2E6FD5; --y7: #7B4ECF; --y8: #DE791F; --y9: #D8534E; --yc: var(--gold);
  --accent: #F2A93B; --card: #0F4C5E; /* usados pelo painel admin */
  --f-display: "Nunito", ui-rounded, system-ui, sans-serif;
  --f-body: "Nunito", ui-rounded, system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-label: "Nunito", ui-rounded, system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; background-image: linear-gradient(rgba(255, 255, 255, .03) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .03) 1px, transparent 1px); background-size: 18px 18px; }
[hidden] { display: none !important; }
button, a { font: inherit; cursor: pointer; touch-action: manipulation; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; }
em { font-style: normal; color: var(--gold); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.link { background: none; border: 0; color: var(--muted); padding: 6px; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Entrar ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: calc(24px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom)); }
.login-box { width: 100%; max-width: 400px; display: grid; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; font: 900 1.1rem var(--f-display); }
.brand-ico { width: 42px; height: 42px; border-radius: 12px; background: var(--panel); object-fit: contain; }
.login h1 { font: 900 1.8rem/1.15 var(--f-display); margin: 6px 0 0; text-wrap: balance; }
form { display: grid; gap: 10px; }
label { font: 800 .78rem var(--f-label); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
input[type=email] { width: 100%; font: 700 1.05rem var(--f-body); padding: 14px; border-radius: 12px; border: 2px solid transparent; background: #fff; color: #123; }
input[type=email]:focus { border-color: var(--gold); outline: none; }
#login-btn { background: var(--gold); color: #1F1606; border: 0; border-radius: 12px; padding: 14px; font-weight: 900; font-size: 1.02rem; }
#login-btn[disabled] { opacity: .6; cursor: progress; }
.msg { margin: 2px 0 0; color: var(--danger); font-size: .92rem; line-height: 1.45; }
.hint { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.login-owl { width: 170px; justify-self: center; }
.foot { margin: 0; color: var(--muted); font-size: .8rem; line-height: 1.7; }
.foot a { color: var(--ink); text-underline-offset: 3px; }
footer.foot { max-width: 1240px; margin: 0 auto; padding: 26px 20px calc(28px + env(safe-area-inset-bottom)); text-align: center; }

/* ---------- Barra e anos ---------- */
.appbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
  padding: calc(12px + env(safe-area-inset-top)) 20px 8px; background: rgba(10, 52, 65, .94); backdrop-filter: blur(8px); }
.logo { display: flex; align-items: center; gap: 9px; font: 900 1.05rem var(--f-display); white-space: nowrap; text-decoration: none; color: var(--ink); }
.logo-ico { width: 32px; height: 32px; border-radius: 9px; background: var(--panel); object-fit: contain; }
.who { margin-left: auto; display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--muted); font-size: .8rem; }
.who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 38vw; }
.years-bar { position: sticky; top: calc(52px + env(safe-area-inset-top)); z-index: 4; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  padding: 4px 20px 10px; background: rgba(10, 52, 65, .94); backdrop-filter: blur(8px); }
.years-bar::-webkit-scrollbar { display: none; }
.yp { flex: none; border: 0; border-radius: 99px; padding: 7px 14px; font-weight: 900; font-size: .9rem; background: var(--panel); color: var(--muted); }
.yp[aria-pressed=true] { background: var(--yc); color: #fff; }
.yp.edit { background: none; border: 1.5px dashed rgba(255, 255, 255, .35); color: var(--muted); }
.home { max-width: 1240px; margin: 0 auto; padding: 4px 0 8px; }

/* ---------- Destaque do ano ---------- */
.hero { position: relative; margin: 8px 20px 0; border-radius: 20px; overflow: hidden; background: var(--panel); padding: 20px 20px 18px; min-height: 210px; display: grid; align-content: start; gap: 8px; }
.hero::after { content: ""; position: absolute; right: -34px; top: 14px; width: 130px; height: 20px; background: var(--gold); transform: rotate(38deg); }
.hero .ytag { justify-self: start; font: 900 .7rem var(--f-label); letter-spacing: .06em; text-transform: uppercase; background: var(--yc); color: #fff; border-radius: 99px; padding: 4px 10px; }
.hero h1 { margin: 2px 0 0; font: 900 1.65rem/1.08 var(--f-display); max-width: 60%; text-wrap: balance; }
.hero p { margin: 0; color: #D6E6EA; font-size: .9rem; line-height: 1.45; max-width: 56%; }
.hero .owl { position: absolute; right: -6px; bottom: -6px; width: 170px; max-width: 44%; pointer-events: none; }
.hero .btns { margin-top: 6px; position: relative; z-index: 1; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; }
.b-acc { background: var(--gold); color: #1F1606; border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 900; text-decoration: none; display: inline-flex; gap: 8px; align-items: center; justify-content: center; }
.b-info { background: rgba(255, 255, 255, .12); border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 800; text-decoration: none; display: inline-flex; gap: 8px; align-items: center; justify-content: center; }
.hero .b-acc { max-width: 58%; text-align: left; }
@media (min-width: 780px) {
  .hero { padding: 34px 38px; min-height: 260px; }
  .hero h1 { font-size: 2.3rem; }
  .hero p { font-size: 1rem; max-width: 48ch; }
  .hero .owl { width: 260px; right: 30px; }
  .hero .b-acc { max-width: none; }
}

/* ---------- Busca ---------- */
.search { margin: 16px 20px 0; display: flex; align-items: center; gap: 10px; background: var(--panel); border-radius: 12px; padding: 0 12px; }
.search svg { flex: none; opacity: .7; }
.search input { flex: 1; min-width: 0; border: 0; background: none; color: var(--ink); font: 700 1rem var(--f-body); padding: 13px 0; outline: none; }
.search input::placeholder { color: var(--muted); }
.search .clear { border: 0; background: none; color: var(--muted); font-size: 1.3rem; padding: 4px; }
.empty { margin: 4px 20px 0; color: var(--muted); font-size: .9rem; }

/* ---------- Fileiras ---------- */
.row { padding: 22px 0 0; }
.row-h { display: flex; align-items: baseline; gap: 10px; margin: 0 20px 8px; flex-wrap: wrap; }
.row-h h2 { margin: 0; font: 900 1.1rem var(--f-display); }
.row-h small { color: var(--muted); font-size: .82rem; font-weight: 700; }
.row-sub { margin: -4px 20px 8px; color: var(--muted); font-size: .85rem; }
.rail { display: flex; align-items: flex-start; gap: 12px; overflow-x: auto; padding: 4px 20px 12px; scroll-snap-type: x mandatory; scroll-padding-left: 20px; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }

/* episódio (mapa) */
.epc { flex: 0 0 168px; scroll-snap-align: start; background: none; border: 0; padding: 0; text-align: left; }
@media (min-width: 780px) { .epc { flex-basis: 210px; } }
.epc .th { position: relative; border-radius: 10px; overflow: hidden; aspect-ratio: 1.6; background: #fff; }
.epc .th img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.epc .num { position: absolute; left: 6px; bottom: 6px; background: rgba(6, 31, 39, .86); color: #fff; font-size: .7rem; font-weight: 900; border-radius: 6px; padding: 2px 7px; }
.epc .seen { position: absolute; right: 6px; top: 6px; background: var(--y5); color: #fff; font-size: .66rem; font-weight: 900; border-radius: 6px; padding: 2px 7px; }
.epc .t { font-size: .84rem; font-weight: 800; margin-top: 6px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.epc .bar-seen { height: 3px; border-radius: 2px; background: var(--yc); margin-top: 5px; }
@media (hover: hover) { .epc:hover .th { outline: 3px solid var(--yc); } }

/* pôster */
.card { flex: 0 0 136px; scroll-snap-align: start; background: none; border: 0; padding: 0; text-align: left; }
@media (min-width: 780px) { .card { flex-basis: 160px; } }
.poster { position: relative; aspect-ratio: 2 / 3; border-radius: 12px; overflow: hidden; background: var(--panel); padding: 10px; transition: transform .18s ease; }
@media (hover: hover) { .card:hover .poster { transform: translateY(-4px); } }
.poster::before { content: ""; position: absolute; right: -24px; top: 8px; width: 76px; height: 11px; background: var(--gold); transform: rotate(38deg); }
.poster .tag { position: relative; z-index: 1; display: inline-block; font: 900 .58rem/1 var(--f-label); letter-spacing: .05em; text-transform: uppercase; background: var(--gold); color: #1F1606; padding: 4px 7px; border-radius: 99px; }
.poster .t { position: relative; z-index: 1; font: 900 .9rem/1.12 var(--f-display); margin-top: 7px; }
.poster img { position: absolute; right: -4px; bottom: 12px; width: 80%; }
.poster .strip { position: absolute; left: 0; right: 0; bottom: 0; height: 7px; background: var(--s, var(--panel2)); }
.poster .lock { position: absolute; left: 8px; bottom: 16px; z-index: 1; background: rgba(6, 31, 39, .86); border-radius: 8px; padding: 3px 8px; font-size: .68rem; font-weight: 900; }
.under { margin-top: 6px; font-size: .76rem; color: var(--muted); line-height: 1.35; font-weight: 700; }
.under .own { color: var(--ok); }
.under .buy { color: var(--gold); }

/* ---------- Camadas ---------- */
.overlay { position: fixed; inset: 0; z-index: 10; }
.bar { display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 12px 10px; background: var(--bg); border-bottom: 1px solid var(--line); }
.x { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .14); color: #fff; font-size: 1.4rem; line-height: 1; }
.bar-title { flex: 1; min-width: 0; font-weight: 800; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-txt { flex: 1; min-width: 0; display: grid; }
.bar-txt b { font-size: .95rem; font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-txt small { color: var(--muted); font-size: .78rem; font-weight: 700; }
.dl { flex: none; background: var(--gold); color: #1F1606; border-radius: 9px; padding: 9px 12px; font-weight: 900; font-size: .8rem; text-decoration: none; }
.viewer { background: #1B1F27; display: flex; flex-direction: column; z-index: 20; }
.frame-wrap { position: relative; flex: 1; }
.frame-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #1B1F27; }
.loading { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; padding: 24px; color: var(--muted); font-size: .9rem; text-align: center; pointer-events: none; }
.slow { display: grid; gap: 14px; justify-items: center; line-height: 1.5; pointer-events: auto; }

/* mapa em ecrã inteiro */
.map { background: #4E666D; display: flex; flex-direction: column; z-index: 18; }
.map-page { flex: 1; overflow: auto; padding: 10px; -webkit-overflow-scrolling: touch; }
.map-page img { display: block; width: 100%; max-width: 900px; margin: 0 auto; border-radius: 4px; background: #fff; box-shadow: 0 6px 24px rgba(0, 0, 0, .35); cursor: zoom-in; }
.map-page.zoom img { width: 200%; max-width: none; cursor: zoom-out; }
.map-page .loading { position: static; min-height: 50vh; color: #E3EEF1; }
.map-hint { text-align: center; color: #E3EEF1; font-size: .76rem; margin: 8px 0 2px; }
.map-acts { display: flex; gap: 8px; padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); }
.map-acts > * { flex: 1; font-size: .88rem; padding: 12px 10px; }

/* ficha */
.detail { background: rgba(3, 18, 23, .72); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 640px; max-height: 92dvh; overflow-y: auto; background: var(--bg); border-radius: 22px 22px 0 0; position: relative; }
@media (min-width: 780px) { .detail { align-items: center; } .sheet { border-radius: 20px; max-height: 88dvh; } }
.d-head { display: flex; gap: 14px; align-items: flex-end; padding: 18px 18px 0; }
.d-head .poster { flex: 0 0 108px; }
.d-x { position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .14); color: #fff; font-size: 1.35rem; z-index: 2; }
.d-body { padding: 14px 18px calc(24px + env(safe-area-inset-bottom)); display: grid; gap: 12px; }
.d-title { margin: 6px 40px 0 0; font: 900 1.3rem/1.15 var(--f-display); text-wrap: balance; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { font: 900 .66rem var(--f-label); letter-spacing: .05em; text-transform: uppercase; padding: 4px 9px; border-radius: 99px; background: rgba(255, 255, 255, .12); }
.badge.mine { background: var(--y5); }
.badge.year { background: var(--yc); }
.syn { margin: 0; color: #DCEAEE; line-height: 1.55; font-size: .97rem; max-width: 62ch; }
.diff { font-size: .88rem; line-height: 1.5; padding: 11px 12px; border-radius: 12px; background: var(--panel); color: #DCEAEE; }
.diff b { color: var(--gold); }
.sec-h { font: 900 .72rem var(--f-label); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 6px 0 -4px; }
.fine { margin: -4px 0 0; color: var(--muted); font-size: .8rem; text-align: center; }
.files { display: grid; gap: 8px; }
.file { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 11px 12px; border-radius: 11px; background: var(--panel); border: 0; text-align: left; width: 100%; }
.file b { font-weight: 800; font-size: .92rem; }
.file small { display: block; color: var(--muted); font-size: .76rem; margin-top: 1px; font-weight: 700; }
.file .st { font: 900 .7rem var(--f-label); letter-spacing: .04em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.file .st.go { color: var(--gold); }
.file.mine-year { box-shadow: inset 4px 0 0 var(--yc); }

/* ---------- Escolher o ano ---------- */
.pick { background: rgba(3, 18, 23, .8); display: flex; align-items: flex-end; justify-content: center; z-index: 25; }
.pick-card { width: 100%; max-width: 480px; background: var(--bg); border-radius: 22px 22px 0 0; padding: 18px 20px calc(22px + env(safe-area-inset-bottom)); display: grid; gap: 14px; }
@media (min-width: 780px) { .pick { align-items: center; } .pick-card { border-radius: 20px; } }
.pick-card .owl { width: 130px; justify-self: center; margin-bottom: -6px; }
.pick-card h2 { margin: 0; font: 900 1.45rem/1.2 var(--f-display); text-wrap: balance; }
.pick-card p { margin: -6px 0 0; color: var(--muted); font-size: .92rem; line-height: 1.45; }
.ygrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.yb { border: 2px solid transparent; border-radius: 14px; background: var(--panel); color: var(--ink); padding: 12px 0; font-weight: 900; font-size: 1.15rem; display: grid; justify-items: center; gap: 1px; }
.yb small { font-size: .62rem; font-weight: 800; color: var(--muted); }
.yb[aria-pressed=true] { background: var(--yc); border-color: #fff; }
.yb[aria-pressed=true] small { color: #fff; }
.tutor { display: flex; align-items: center; gap: 12px; background: var(--panel); border-radius: 12px; padding: 12px; border: 2px solid transparent; color: var(--ink); width: 100%; text-align: left; }
.tutor[aria-pressed=true] { border-color: var(--gold); }
.tutor b { display: block; font-weight: 900; }
.tutor span { font-size: .82rem; color: var(--muted); }
.tutor .ic { font-size: 1.4rem; }
.pick-card .b-acc[disabled] { opacity: .45; cursor: not-allowed; }

/* convite para instalar */
.inst { position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30; width: min(440px, calc(100% - 24px));
  background: #F3F8F9; color: #0A3441; border-radius: 18px; padding: 16px; display: grid; gap: 12px; box-shadow: 0 20px 50px rgba(0, 0, 0, .55); }
.inst .top { display: flex; gap: 12px; align-items: center; }
.inst .ico { width: 54px; height: 54px; border-radius: 13px; flex: none; }
.inst h4 { margin: 0; font: 900 1rem var(--f-display); }
.inst p { margin: 2px 0 0; font-size: .86rem; color: #36545C; line-height: 1.4; }
.inst .acts { display: flex; gap: 8px; justify-content: flex-end; }
.inst .acts button { border: 0; border-radius: 10px; padding: 9px 14px; font-weight: 900; font-size: .86rem; }
.inst .y { background: #0A3441; color: #fff; }
.inst .n { background: none; color: #36545C; }
.steps { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.steps li { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: center; font-size: .88rem; background: #DFEBEE; border-radius: 10px; padding: 8px 10px; }
.steps svg { width: 22px; height: 22px; }

@media (prefers-reduced-motion: no-preference) {
  .viewer, .map, .sheet, .pick-card { animation: rise .22s ease-out; }
  @keyframes rise { from { transform: translateY(14px); opacity: .5; } }
}

/* ---------- Página de privacidade ---------- */
.prose { max-width: 680px; margin: 0 auto; padding: 8px 20px calc(48px + env(safe-area-inset-bottom)); line-height: 1.65; }
.prose h1 { font: 900 1.6rem/1.2 var(--f-display); margin: 12px 0 4px; }
.prose h2 { font: 900 1.05rem var(--f-display); margin: 28px 0 8px; }
.prose p, .prose li { color: #D6E6EA; font-size: .95rem; }
.prose ul { padding-left: 1.2em; display: grid; gap: 6px; }
.prose .updated { color: var(--muted); font-size: .85rem; }
.prose a { color: var(--ink); }
