/* Leamos - a fiesta look: market colors and cut-paper banners on a bright sky. */

:root {
  --rosa: #e4007c;
  --turquesa: #00a6a6;
  --marigold: #ff9f1c;
  --marigold-deep: #d97f00;
  --limon: #c6e03a;
  --cielo: #e8f6ff;
  --tinta: #2a1b3d;
  --tinta-soft: #6a5c7b;
  --white: #ffffff;
  --line: #e2d6ee;
  --future: #d6e6f2;
  --future-ink: #8696aa;

  /* papel picado strip: four scalloped flags, tiled horizontally */
  --banner: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='44' viewBox='0 0 160 44'><rect width='160' height='3' fill='%232A1B3D'/><g id='f'><path d='M3 3H37V30L32.75 36L28.5 30L24.25 36L20 30L15.75 36L11.5 30L7.25 36L3 30Z' fill='%23E4007C'/><path d='M20 11L24 16L20 21L16 16Z' fill='%23E8F6FF'/></g><g transform='translate(40 0)'><path d='M3 3H37V30L32.75 36L28.5 30L24.25 36L20 30L15.75 36L11.5 30L7.25 36L3 30Z' fill='%2300A6A6'/><path d='M20 11L24 16L20 21L16 16Z' fill='%23E8F6FF'/></g><g transform='translate(80 0)'><path d='M3 3H37V30L32.75 36L28.5 30L24.25 36L20 30L15.75 36L11.5 30L7.25 36L3 30Z' fill='%23FF9F1C'/><path d='M20 11L24 16L20 21L16 16Z' fill='%23E8F6FF'/></g><g transform='translate(120 0)'><path d='M3 3H37V30L32.75 36L28.5 30L24.25 36L20 30L15.75 36L11.5 30L7.25 36L3 30Z' fill='%23C6E03A'/><path d='M20 11L24 16L20 21L16 16Z' fill='%23E8F6FF'/></g></svg>");

  color-scheme: light;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--cielo);
  color: var(--tinta);
  font-family: 'Andika', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }
[hidden] { display: none !important; }

h1, h2, .display {
  font-family: 'Chango', 'Andika', system-ui, sans-serif;
  font-weight: 400;
  margin: 0;
}

h3 {
  font-family: 'Andika', system-ui, sans-serif;
  font-weight: 700;
  margin: 0;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: 14px;
  min-height: 44px;
}

button:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--tinta);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---- shared layout shell ---------------------------------------------- */

.shell {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 76px 16px 32px;
}

/* the one bold moment: a cut-paper banner across the top of kid-facing pages */
.shell::before, .calendar-shell::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 44px;
  background: var(--banner) repeat-x left top;
}

.card {
  background: var(--white);
  color: var(--tinta);
  border-radius: 20px;
  border: 2px solid var(--line);
  box-shadow: 0 6px 0 var(--line);
  padding: 32px 28px;
  width: 100%;
  max-width: 420px;
}

/* ---- bilingual label component ---------------------------------------- */

.bilingual { display: flex; flex-direction: column; gap: 2px; }
.bilingual .es { font-size: 1rem; font-weight: 700; }
.bilingual .en { font-size: 0.78rem; font-weight: 400; color: var(--tinta-soft); }

/* ---- gate / login card -------------------------------------------------- */

.brand {
  text-align: center;
  margin-bottom: 24px;
}
.brand .lamp { font-size: 2.5rem; display: block; margin-bottom: 8px; }
.brand h1 { font-size: 1.7rem; line-height: 1.2; color: var(--rosa); }
.brand .subtitle { color: var(--tinta-soft); font-size: 0.9rem; margin-top: 6px; }

/* "¡Leamos!" set along an arc on the login screen */
.brand-arch { line-height: 0; }
.brand-arch svg { width: 100%; max-width: 320px; height: auto; overflow: visible; }
.brand-arch text {
  font-family: 'Chango', 'Andika', sans-serif;
  font-size: 44px;
  fill: var(--rosa);
}

/* one-time confetti burst (see confetti.js) */
.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 20;
}

.field-label { display: block; margin-bottom: 8px; }
.field-input {
  width: 100%;
  font-size: 1.3rem;
  font-family: 'Andika', sans-serif;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-align: center;
  padding: 14px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: var(--white);
  color: var(--tinta);
  margin-bottom: 16px;
}
.field-input:focus { outline: none; border-color: var(--turquesa); }

.btn-primary {
  width: 100%;
  background: var(--turquesa);
  color: var(--tinta);
  border-bottom: 4px solid var(--tinta);
  font-family: 'Andika', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 14px;
  transition: transform 0.1s ease, border-bottom-width 0.1s ease;
}
.btn-primary:active { transform: translateY(3px); border-bottom-width: 1px; }

.error-msg {
  color: var(--rosa);
  font-weight: 700;
  font-size: 0.9rem;
  min-height: 1.2em;
  margin-top: 4px;
}
.error-msg .en { display: block; font-size: 0.78rem; font-weight: 400; color: var(--tinta-soft); }

.link-quiet {
  display: block;
  text-align: center;
  margin-top: 20px;
  color: var(--tinta-soft);
  font-size: 0.85rem;
  text-decoration: underline;
}

/* ---- profile picker ------------------------------------------------------ */

.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.kid-tile {
  background: var(--cielo);
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 18px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}

.kid-tile .avatar {
  font-size: 2.2rem;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--tile-color, #eee);
}
.kid-tile .name { font-family: 'Andika', sans-serif; font-weight: 700; font-size: 1.05rem; color: var(--tinta); }

/* per-kid accent colors: the fiesta palette in pale tints */
.color-blue    { --tile-color: #bfebeb; }
.color-coral   { --tile-color: #fac9e2; }
.color-amber   { --tile-color: #ffe0b0; }
.color-green   { --tile-color: #e9f5b0; }
.color-purple  { --tile-color: #ddd0f0; }

/* ---- calendar page ------------------------------------------------------- */

.calendar-shell {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 68px 16px 48px;
}

.calendar-header {
  width: 100%;
  max-width: 480px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.kid-badge {
  display: flex;
  align-items: center;
  gap: 8px;
}
.kid-badge .avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--tile-color, #eee);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
}
.kid-badge .name { font-family: 'Andika', sans-serif; font-weight: 700; font-size: 1.15rem; }

.icon-btn {
  background: var(--tinta);
  color: var(--white);
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 1.1rem;
}

.book-page {
  background: var(--white);
  color: var(--tinta);
  border-radius: 20px;
  border: 2px solid var(--line);
  box-shadow: 0 6px 0 var(--line);
  width: 100%;
  max-width: 480px;
  padding: 24px 20px 28px;
}

.chapter-title { text-align: center; margin-bottom: 4px; }
.chapter-title .month-es {
  font-family: 'Chango', 'Andika', sans-serif;
  font-weight: 400;
  font-size: 1.6rem;
  color: var(--rosa);
  text-transform: lowercase;
}
.chapter-title .month-en { display: block; font-size: 0.85rem; color: var(--tinta-soft); margin-top: 2px; }

.month-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 12px;
}
.month-nav button {
  background: var(--cielo);
  color: var(--tinta);
  font-size: 1.4rem;
  font-weight: 700;
  width: 44px; height: 44px;
}
.month-nav button:disabled { opacity: 0.3; cursor: default; }

.question-line {
  text-align: center;
  margin: 4px 0 18px;
}
.question-line.bilingual { display: block; }
.question-line .es { font-size: 1.1rem; font-weight: 700; }
.question-line .en { display: block; font-size: 0.8rem; font-weight: 400; color: var(--tinta-soft); }

.streak-trail {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.streak-bead {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--line);
}
.streak-bead.lit { background: var(--limon); box-shadow: 0 0 0 2px var(--tinta); }

.weekday-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 6px;
}
.weekday-row div {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--tinta);
  text-transform: lowercase;
}
.weekday-row div .en { display: block; font-size: 0.62rem; font-weight: 400; color: var(--tinta-soft); }

.day-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.day-cell {
  aspect-ratio: 1;
  min-height: 44px;
  border-radius: 12px;
  background: var(--white);
  border: 2px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Andika', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--tinta);
  position: relative;
  overflow: hidden;
}
.day-cell.empty { visibility: hidden; }
.day-cell.future { color: var(--future-ink); background: var(--future); border-color: var(--future); cursor: default; }
.day-cell.past.checked {
  background: var(--marigold);
  border-color: var(--marigold-deep);
  color: var(--tinta);
}
/* cut-paper notch on days you read */
.day-cell.past.checked::after {
  content: "";
  position: absolute;
  top: 0; right: 0;
  width: 14px; height: 14px;
  background: var(--rosa);
  clip-path: polygon(0 0, 100% 0, 100% 100%);
}
.day-cell.past:not(.future) { cursor: pointer; }
.day-cell.today:not(.checked) { border-color: var(--rosa); border-style: dashed; border-width: 3px; }

@keyframes pulse-check {
  0% { transform: scale(1); }
  40% { transform: scale(1.18); }
  100% { transform: scale(1); }
}
.day-cell.just-toggled { animation: pulse-check 0.28s ease; }

.badges-row {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  justify-content: center;
  flex-wrap: wrap;
}
.badge-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--cielo);
  color: var(--tinta-soft);
  font-size: 0.82rem;
  font-weight: 700;
}
.badge-chip.earned { background: var(--rosa); color: var(--white); }

.toast {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  background: var(--tinta);
  color: var(--white);
  padding: 12px 18px;
  border-radius: 14px;
  font-size: 0.9rem;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,0.5);
}
.toast .en { display: block; font-size: 0.75rem; color: var(--line); }

.celebration {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(42, 27, 61, 0.72);
  z-index: 10;
}

/* the card drops in like a flag on a string */
@keyframes hang-in {
  0%   { transform: translateY(-60px) rotate(-7deg); opacity: 0; }
  60%  { transform: translateY(0) rotate(3deg); opacity: 1; }
  100% { transform: translateY(0) rotate(0); opacity: 1; }
}
.celebration-card {
  position: relative;
  overflow: hidden;
  transform-origin: top center;
  animation: hang-in 0.55s ease-out;
  background: var(--white);
  color: var(--tinta);
  border-radius: 20px;
  padding: 64px 28px 32px;
  text-align: center;
  max-width: 320px;
}
.celebration-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 44px;
  background: var(--banner) repeat-x center top;
}
.celebration-card .emoji { font-size: 3rem; display: block; margin-bottom: 8px; }
.celebration-card h2 { font-size: 1.3rem; line-height: 1.25; color: var(--rosa); margin-bottom: 6px; }
.celebration-card .en { color: var(--tinta-soft); font-size: 0.9rem; margin-bottom: 16px; }

/* ---- parent mode --------------------------------------------------------- */

.parent-shell { padding: 32px 16px; max-width: 560px; margin: 0 auto; }
.parent-card {
  background: var(--white);
  color: var(--tinta);
  border-radius: 16px;
  border: 2px solid var(--line);
  padding: 20px;
  margin-bottom: 16px;
}
.parent-card h3 { margin-bottom: 8px; }
.parent-card label { display: block; font-size: 0.85rem; font-weight: 700; margin: 10px 0 4px; }
.parent-card input, .parent-card select {
  width: 100%; padding: 10px; border-radius: 10px; border: 2px solid var(--line);
  font-family: inherit; font-size: 1rem; color: var(--tinta); background: var(--white);
}
.parent-card input:focus, .parent-card select:focus { outline: none; border-color: var(--turquesa); }
.parent-card button {
  margin-top: 14px; background: var(--turquesa); color: var(--tinta);
  border-bottom: 3px solid var(--tinta);
  font-weight: 700; padding: 10px 16px;
}
.overview-day-count { font-family: 'Andika', sans-serif; font-weight: 700; font-size: 1.4rem; }

@media (max-width: 380px) {
  .card, .book-page { padding: 20px 16px; }
}

/* ---- parent page (formerly inline styles; CSP forbids style attributes) ---- */
.parent-login-card { margin: 0 auto 20px; }
.parent-logout { margin-bottom: 16px; }
.overview-row { margin-bottom: 10px; }

/* ---- admin page ---- */
.admin-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.admin-row:last-child { border-bottom: 0; }
.admin-row.revoked { opacity: 0.55; }
.admin-detail { font-size: 0.85rem; color: var(--tinta-soft); margin-top: 2px; }
.parent-card .small-btn { margin-top: 8px; padding: 6px 12px; font-size: 0.85rem; }
.invite-code-box { margin-top: 14px; padding: 12px; border-radius: 10px; background: var(--cielo); border: 2px dashed var(--turquesa); }
.invite-code-label { font-size: 0.8rem; font-weight: 700; margin-bottom: 6px; }
.invite-code { display: block; font-size: 1.15rem; font-weight: 700; word-break: break-all; user-select: all; }
