/* Caderno da Gratidão Kids – app styles (loaded after the Skip shell styles in index.html). */
@font-face { font-family: "Nunito"; font-weight: 400; font-style: normal; font-display: swap; src: url(fonts/Nunito-400.woff2) format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 600; font-style: normal; font-display: swap; src: url(fonts/Nunito-600.woff2) format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 700; font-style: normal; font-display: swap; src: url(fonts/Nunito-700.woff2) format("woff2"); }
@font-face { font-family: "Baloo 2"; font-weight: 700; font-style: normal; font-display: swap; src: url(fonts/Baloo2-700.woff2) format("woff2"); }
@font-face { font-family: "Baloo 2"; font-weight: 800; font-style: normal; font-display: swap; src: url(fonts/Baloo2-800.woff2) format("woff2"); }

:root {
  --accent: #7c3aed;
  --accent-text: #5b21b6;
  --accent-contrast: #ffffff;
  --gold: #f59e0b;
  --sun: #f59e0b;
  --sky: #0ea5e9;
  --leaf: #16a34a;
  --pink: #db2777;
  --blue: #075985;
  --paper: #fffdf7;
  --ink: #1e1b4b;
  --line: #ddd6fe;
  --serif: "Baloo 2", "Nunito", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  margin: 0;
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  color: var(--ink);
  background: linear-gradient(160deg, #ede9fe 0%, #e0f2fe 45%, #fef3c7 100%);
  touch-action: pan-y;
}
button { font: inherit; }
h1, h2, h3 { font-family: var(--serif); }

/* ---------- header ---------- */
.app-header { flex: none; position: relative; z-index: 30; background: rgba(255,255,255,0.94); border-bottom: 2px solid var(--line); }
.hdr-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 12px; }
.hdr-row .row { flex-wrap: nowrap; }
.hdr-row > .row:first-child { min-width: 0; flex: 1 1 0; }
.hdr-row > .row:last-child { flex: none; }
.app-header .btn { min-height: 40px; padding: 6px 12px; font-size: .9rem; font-weight: 700; white-space: nowrap; border-radius: 12px; }
.lang-sel { min-height: 40px; max-width: 92px; padding: 0 4px; border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); font: inherit; font-size: .85rem; flex: none; }
.brand-mark { flex: none; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; color: #fff; font-size: 19px; background: linear-gradient(135deg, #f59e0b, #db2777); box-shadow: 0 3px 8px rgba(219,39,119,.28); }
.brand { font-family: var(--serif); font-weight: 800; color: var(--accent-text); font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress-wrap { padding: 0 12px 6px; }
.progress-track { height: 10px; background: #ede9fe; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #f59e0b, #16a34a, #0ea5e9); border-radius: 999px; transition: width .5s ease; }
.progress-meta { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; color: #4c1d95; margin-top: 3px; }
@media (max-width: 599px), (max-height: 520px) { .progress-meta { display: none; } }

/* ---------- book ---------- */
.stage { flex: 1; min-height: 0; display: flex; flex-direction: column; width: 100%; max-width: 1400px; margin: 0 auto; padding: 8px 10px 0; position: relative; }
.book { flex: 1; min-height: 0; position: relative; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); perspective: 2200px; }
.book.spread-mode { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.leaf {
  position: relative; min-height: 0; min-width: 0; display: flex; flex-direction: column;
  background: var(--paper); border-radius: 16px;
  box-shadow: 0 12px 30px rgba(30,27,75,0.18), inset 0 0 0 2px rgba(124,58,237,0.08);
  overflow: hidden;
}
.spread-mode .leaf.left-page { border-radius: 18px 0 0 18px; background: linear-gradient(270deg, #e7defc, var(--paper) 30px); }
.spread-mode .leaf.right-page { border-radius: 0 18px 18px 0; background: linear-gradient(90deg, #e7defc, var(--paper) 30px); }
.page-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: clamp(12px, 2.2vh, 26px) clamp(14px, 2.6vw, 28px); }
.fit { transform-origin: top left; }
.page-title { font-family: var(--serif); font-weight: 800; font-size: 1.75rem; line-height: 1.15; color: var(--accent-text); margin: 6px 0 10px; }
.page-sub { font-size: 1.02rem; color: #3b3a63; line-height: 1.55; margin: 0 0 14px; }
.eyebrow-pill { display: inline-block; font-weight: 800; font-size: .9rem; padding: 5px 12px; border-radius: 999px; background: #fde68a; color: #78350f; }
.verse-box { background: linear-gradient(135deg, #e0f2fe, #ede9fe); border-left: 6px solid var(--sky); border-radius: 14px; padding: 12px 16px; margin: 10px 0; }
.verse-ref { display: block; font-weight: 800; color: var(--blue); font-size: .98rem; }
.verse-text { font-size: 1.08rem; margin-top: 4px; line-height: 1.5; color: #0f172a; }
.ref-inline { font-weight: 800; color: var(--blue); font-size: .92rem; }
.challenge-box { background: #fef9c3; border-radius: 14px; padding: 12px 16px; margin: 10px 0; border: 2px dashed #f59e0b; line-height: 1.5; }
.challenge-box strong { color: #78350f; }
.tips { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 8px; }
@media (min-width: 560px) { .tips { grid-template-columns: 1fr 1fr; } }
.label { display: block; font-weight: 800; font-size: 1rem; margin: 12px 0 5px; color: #312e81; }
.helper { font-size: .92rem; color: #4b5563; margin: 4px 0 0; }
textarea.field, input.field { width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 10px 14px; min-height: 48px; }
textarea.field { min-height: 72px; resize: vertical; line-height: 1.5; }
textarea.field:focus, input.field:focus, .nav-btn:focus-visible, .btn:focus-visible { outline: 4px solid #facc15; outline-offset: 2px; border-color: var(--accent); }
.check-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-top: 12px; background: #f0fdf4; border: 2px solid #86efac; border-radius: 14px; cursor: pointer; min-height: 56px; }
.check-row input { width: 26px; height: 26px; accent-color: var(--leaf); }
.check-row span { font-size: 1.1rem; font-weight: 800; color: #14532d; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.btn-big { min-height: 48px; font-size: 1rem; padding: 10px 16px; border-radius: 14px; font-weight: 800; }

/* cover, month head, star, certificate */
.cover { text-align: center; }
.cover > .verse-box, .cover > .label, .cover > .field, .cover > .helper, .cover > .toolbar { text-align: left; }
.cover-emoji { font-size: 64px; line-height: 1; }
.cover-title { font-size: clamp(1.9rem, 6vw, 2.8rem); font-weight: 800; color: #5b21b6; margin: 8px 0 0; line-height: 1.05; }
.cover-sub { font-size: 1.1rem; color: #0f766e; font-weight: 800; margin: 6px 0 10px; }
.month-head { display: flex; align-items: center; gap: 12px; }
.month-emoji { font-size: 52px; line-height: 1; flex: none; }
.month-head .page-title { margin: 4px 0 0; }
.star-wrap { text-align: center; margin: 6px 0; }
.big-star { font-size: 72px; cursor: pointer; background: none; border: none; line-height: 1; transition: transform .2s; }
.big-star:hover { transform: scale(1.1) rotate(-6deg); }
.big-star.on { filter: drop-shadow(0 0 8px #facc15); }
.cert-frame { border: 6px double #f59e0b; border-radius: 18px; padding: 14px 18px; background: #fffbeb; text-align: center; }
.cert-frame .page-title { margin: 2px 0 6px; }
.cert-emoji { font-size: 44px; line-height: 1; }
.cert-name { font-family: var(--serif); font-weight: 800; font-size: 1.8rem; color: #5b21b6; border-bottom: 2px solid #5b21b6; display: inline-block; padding: 0 12px; margin: 4px 0; }
.cert-frame p { margin: 6px 0; }
.cert-date-input { max-width: 220px; margin: 0 auto; }
.sign-line { border-bottom: 2px solid #312e81; height: 40px; margin: 6px 0 2px; }
.prayer { font-style: italic; line-height: 1.55; background: #fff; border-radius: 14px; padding: 10px 14px; margin-top: 8px; text-align: left; }
.canvas-wrap { width: min(100%, calc(24vh * 2.4)); margin: 0 auto; border: 3px dashed #7dd3fc; border-radius: 14px; background: #fff; overflow: hidden; }
canvas.draw-canvas { display: block; width: 100%; height: auto; aspect-ratio: 12 / 5; touch-action: none; cursor: crosshair; }

/* ---------- navigation ---------- */
.nav-bar { flex: none; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 4px 8px; background: transparent; }
.nav-btn { min-width: 56px; min-height: 44px; padding: 6px 14px; font-size: 1rem; font-weight: 800; white-space: nowrap; border-radius: 14px; }
.page-count { font-size: 14px; font-weight: 800; color: #312e81; text-align: center; white-space: nowrap; }
.book-empty { padding: 40px; text-align: center; color: #4b5563; }
.help-line { font-size: 13px; color: #4b5563; }

/* ---------- contents grid and day chips ---------- */
.toc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toc-btn { text-align: left; background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 10px 12px; min-height: 64px; cursor: pointer; color: var(--ink); transition: transform .15s, border-color .15s; }
.toc-btn:hover { border-color: var(--accent); transform: translateY(-2px); }
.toc-btn strong { display: block; font-family: var(--serif); font-weight: 800; font-size: 1.02rem; color: var(--accent-text); }
.toc-btn small { display: block; font-size: 13px; color: #4b5563; }
.toc-btn small + small { color: #0f766e; font-weight: 800; }
@media (min-width: 960px) { .toc-grid { grid-template-columns: repeat(3, 1fr); } }
.day-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; margin-top: 10px; }
.day-chip { background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 4px 8px; min-height: 40px; cursor: pointer; font-size: 14px; text-align: left; color: var(--ink); }
.day-chip .dot { font-weight: 800; color: var(--accent-text); }
.day-chip.done { background: #dcfce7; border-color: var(--leaf); }
.chip-date { display: block; font-size: 11px; color: #4b5563; line-height: 1.1; }
.day-chip.is-start { box-shadow: 0 0 0 3px #16a34a; }
.day-chip.is-end { box-shadow: 0 0 0 3px #db2777; }
.day-chip.is-today { box-shadow: 0 0 0 3px #f59e0b; background: #fff4de; }
.day-chip.is-start.is-today { box-shadow: 0 0 0 3px #16a34a, 0 0 0 6px #f59e0b; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12px; color: #3b3a63; margin: 8px 0 0; }
.lg { display: inline-block; width: 14px; height: 14px; border-radius: 4px; background: #fff; margin-right: -4px; }
.lg-start { box-shadow: 0 0 0 2px #16a34a; }
.lg-end { box-shadow: 0 0 0 2px #db2777; }
.lg-today { box-shadow: 0 0 0 2px #f59e0b; }
.day-date { margin: -4px 0 8px; font-size: .95rem; font-weight: 800; color: var(--blue); }
.day-date::first-letter { text-transform: uppercase; }
.day-date-missing { font-weight: 600; font-size: .85rem; color: #92400e; }

/* ---------- Contents overlay ---------- */
.menu-panel { display: none; }
.menu-panel.open { display: block; position: fixed; inset: 0; z-index: 60; margin: 0; border: 0; border-radius: 0; box-shadow: none; overflow-y: auto; background: linear-gradient(160deg, #ede9fe 0%, #e0f2fe 45%, #fef3c7 100%); padding: calc(env(safe-area-inset-top) + 8px) 10px calc(env(safe-area-inset-bottom) + 10px); }
.menu-panel .menu-inner { max-width: 760px; margin: 0 auto; background: var(--paper); border-radius: 16px; box-shadow: 0 12px 30px rgba(30,27,75,0.18), inset 0 0 0 2px rgba(124,58,237,0.08); padding: clamp(14px, 2.6vw, 28px); }
.menu-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.menu-x { min-width: 44px; min-height: 44px; padding: 0; border-radius: 50%; font-size: 1.1rem; }
.fruit-btn { display: inline-flex; align-items: center; gap: 8px; background: #ffdd00; color: #0d0c22; border: 1px solid #0d0c22; font-weight: 700; text-decoration: none; }
.fruit-btn:hover { background: #ffe94d; color: #0d0c22; }
.legal-body { text-align: left; font-size: 14px; line-height: 1.5; margin-top: 8px; color: var(--ink); }
.legal-body h3 { margin: 12px 0 4px; font-size: 15px; color: #5b21b6; }
.legal-body p { margin: 0 0 8px; }

/* ---------- reading (fullscreen) mode, backup nudge ---------- */
.fullscreen-on .app-header { display: none; }
.fullscreen-on .stage { max-width: 100%; margin-top: 0; padding: 0; }
.fullscreen-on .nav-bar { padding-top: 6px; padding-bottom: 6px; }
.fullscreen-on .leaf { border-radius: 0; }
.full-exit { display: none; position: fixed; top: calc(8px + env(safe-area-inset-top)); right: 8px; z-index: 50; min-width: 44px; min-height: 44px; padding: 0; border-radius: 50%; font-size: 1.1rem; background: rgba(255,255,255,0.92); box-shadow: 0 4px 14px rgba(30,27,75,0.25); }
body.fullscreen-on .full-exit { display: inline-flex; align-items: center; justify-content: center; }
.backup-nudge { position: fixed; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 45; display: flex; align-items: center; justify-content: flex-end; gap: 6px 8px; flex-wrap: wrap; max-width: 560px; margin: 0 auto; padding: 8px 12px; background: #fff; border: 2px solid var(--line); border-radius: 14px; box-shadow: 0 8px 24px rgba(30,27,75,0.22); font-size: .9rem; line-height: 1.35; }
.backup-nudge span { flex: 1 1 100%; }
.backup-nudge .btn { min-height: 38px; padding: 4px 14px; }
.leaf.entering { animation: enter .6s cubic-bezier(.45,.05,.2,1); }
@keyframes enter { from { opacity: .2; transform: translateX(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .leaf.entering { animation: none; } }
@media (max-width: 480px) { #btnFull { display: none; } }

/* ---------- short landscape phones ---------- */
@media (max-height: 520px) {
  .progress-wrap { display: none; }
  .hdr-row { padding: 2px 10px; }
  .app-header .btn { min-height: 34px; padding: 3px 10px; }
  .lang-sel { min-height: 34px; }
  .stage { padding-top: 4px; }
  .nav-bar { padding: 3px 4px 4px; }
  .nav-bar .nav-btn { min-height: 38px; }
  .single-mode .fit { column-count: 2; column-gap: 28px; }
  .single-mode .fit > * { break-inside: avoid; }
  .single-mode .fit > .cover { break-inside: auto; }
  .single-mode .cover > * { break-inside: avoid; }
  .single-mode .fit > .cert-frame { break-inside: auto; }
  .single-mode .cert-frame > * { break-inside: avoid; }
  .single-mode .fit:has(.toc-grid) { column-count: 1; }
  .page-scroll .toc-grid { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .toc-btn { min-height: 44px; padding: 6px 10px; }
}

/* ---------- print (certificate / page) ---------- */
@media print {
  .app-header, .nav-bar, .backup-nudge, .full-exit, .toolbar { display: none !important; }
  .leaf { position: static !important; box-shadow: none; page-break-after: always; width: 100% !important; max-width: 100% !important; }
  .page-scroll { max-height: none; overflow: visible; }
  html, body { height: auto; overflow: visible; display: block; padding: 0; }
  body { background: #fff; }
  .stage { display: block; padding: 0; }
  .book { display: block; }
  .fit { zoom: 1 !important; }
  .cert-date-input { border: 0; background: transparent; }
}
