/* Fredoka is declared via @font-face in styles.css (self-hosted), which every
   page loading this file also loads first. */

:root {
  --brand: #6a11cb;
  --brand-dark: #4b0f92;
  --bg: #f0f7f4;
  --header-gradient: linear-gradient(135deg, #00C9FF 0%, #92FE9D 100%);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Fredoka', system-ui, sans-serif;
  background-color: var(--bg);
  background-image: radial-gradient(#dcf0e8 2px, transparent 2px);
  background-size: 30px 30px;
  color: #2d2d2d;
  overscroll-behavior-y: none;
  /* Blocks pinch/double-tap zoom at the CSS level - modern iOS Safari ignores
     the viewport meta's user-scalable=no, so this is the layer that actually
     still works there. Still allows normal scrolling/panning. */
  touch-action: manipulation;
}

/* ---------- Home page ---------- */

.animal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem;
  padding: 1rem;
  max-width: 600px;
  margin: 0 auto;
  padding-bottom: 2rem;
}

.animal-card {
  background: white;
  border-radius: 24px;
  border: 4px solid #fff;
  box-shadow: 0 8px 16px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.06);
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s ease;
}

.animal-card:active {
  transform: scale(0.94);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.animal-card .emoji {
  font-size: 4.5rem;
  line-height: 1;
}

.animal-card .name {
  margin-top: 0.5rem;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--brand-dark);
}

/* ---------- Story page ---------- */

html.story-page, html.story-page body {
  height: 100dvh;
  overflow: hidden;
}

html.story-page body {
  display: flex;
  flex-direction: column;
}

.story-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.bottom-bar {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0.8rem 0.6rem;
  flex: 0 0 auto;
  padding-bottom: calc(0.8rem + env(safe-area-inset-bottom));
  background: #b6e6a9;
  border-top: 3px solid rgba(0,0,0,0.05);
}

/* Round gradient buttons, matching the style used on game pages
   (e.g. drawing-canvas.html's .refresh-btn / .download-btn). */
.bottom-bar button {
  background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
  border: none;
  border-radius: 50%;
  width: 3.5rem;
  height: 3.5rem;
  font-size: 1.5rem;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  transition: transform 0.2s;
}

.bottom-bar button:active {
  transform: scale(0.9);
}

.bottom-bar button:disabled {
  opacity: 0.4;
}

.story-pane {
  flex: 1 1 45%;
  overflow-y: auto;
  padding: 1.2rem 1.4rem;
  -webkit-overflow-scrolling: touch;
}

.story-title {
  color: var(--brand-dark);
  font-size: 1.3rem;
  margin: 0 0 0.6rem;
}

.story-text {
  font-size: 1.25rem;
  line-height: 1.6;
}

.story-text .sentence {
  border-radius: 6px;
  transition: background-color 0.3s ease;
}

.story-text .sentence.active {
  background-color: rgba(106, 17, 203, 0.14);
  box-shadow: 0 0 0 4px rgba(106, 17, 203, 0.14);
}

.playground-stage {
  flex: 1 1 45%;
  position: relative;
  overflow: hidden;
  background: linear-gradient(to bottom, #bfe4ff 0%, #bfe4ff 55%, #b6e6a9 55%, #b6e6a9 100%);
  border-top: 3px solid rgba(0,0,0,0.05);
}

.playground-prop {
  position: absolute;
  font-size: 5.5rem;
  line-height: 1;
  letter-spacing: -0.6rem;
  text-align: right;
  max-width: 55%;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.playground-prop-1 {
  right: 6%;
  bottom: 16%;
}

.playground-prop-2 {
  right: 28%;
  bottom: 12%;
  font-size: 4.5rem;
  z-index: 1;
}

.playground-prop.visible {
  opacity: 1;
}

.playground-actor {
  position: absolute;
  bottom: 12%;
  font-size: 3.75rem;
  letter-spacing: -0.4rem;
  will-change: transform;
}

.playground-actor-1 { left: 8%; z-index: 2; }
.playground-actor-2 { left: 22%; font-size: 3rem; z-index: 1; }

@keyframes motionHopAcross {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(20vw, -18px); }
  50%  { transform: translate(40vw, 0); }
  75%  { transform: translate(60vw, -18px); }
  100% { transform: translate(75vw, 0); }
}
.motion-hop-across { animation: motionHopAcross 3.2s ease-in-out forwards; }
.playground-actor-2.motion-hop-across { animation-duration: 4.2s; }

@keyframes motionRunAcross {
  0%   { transform: translate(0, 0) scaleX(1); }
  50%  { transform: translate(45vw, -6px) scaleX(-1); }
  100% { transform: translate(78vw, 0) scaleX(-1); }
}
.motion-run-across { animation: motionRunAcross 2s linear forwards; }
.playground-actor-2.motion-run-across { animation-duration: 3.3s; }

@keyframes motionWalkAcross {
  0%   { transform: translate(0, 0); }
  50%  { transform: translate(40vw, -4px); }
  100% { transform: translate(75vw, 0); }
}
.motion-walk-across { animation: motionWalkAcross 3.6s ease-in-out forwards; }
.playground-actor-2.motion-walk-across { animation-duration: 4.8s; }

@keyframes motionSwimAcross {
  0%   { transform: translate(0, 0) rotate(0deg); }
  25%  { transform: translate(20vw, 6px) rotate(-4deg); }
  50%  { transform: translate(40vw, -6px) rotate(4deg); }
  75%  { transform: translate(60vw, 6px) rotate(-4deg); }
  100% { transform: translate(75vw, 0) rotate(0deg); }
}
.motion-swim-across { animation: motionSwimAcross 3.4s ease-in-out forwards; }
.playground-actor-2.motion-swim-across { animation-duration: 4.4s; }

@keyframes motionFlyAcross {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(20vw, -30px); }
  50%  { transform: translate(40vw, -50px); }
  75%  { transform: translate(60vw, -30px); }
  100% { transform: translate(75vw, -50px); }
}
.motion-fly-across { animation: motionFlyAcross 3s ease-in-out forwards; }
.playground-actor-2.motion-fly-across { animation-duration: 3.9s; }

@keyframes motionClimbUp {
  0%   { transform: translate(0, 0) scale(1); }
  40%  { transform: translate(6vw, -30px) scale(0.95); }
  70%  { transform: translate(10vw, -70px) scale(0.9); }
  100% { transform: translate(12vw, -110px) scale(0.85); }
}
.motion-climb-up { animation: motionClimbUp 2.6s ease-in-out forwards; }

@keyframes motionJumpInPlace {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-40px); }
}
.motion-jump-in-place { animation: motionJumpInPlace 0.8s ease-in-out 3; }

@keyframes motionSleep {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
.motion-sleep { animation: motionSleep 2.4s ease-in-out infinite; }

@keyframes motionEat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(-8deg); }
}
.motion-eat { animation: motionEat 0.6s ease-in-out 3; }

@keyframes motionPlay {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-12deg); }
  75% { transform: rotate(12deg); }
}
.motion-play { animation: motionPlay 0.7s ease-in-out 3; }

@keyframes motionHide {
  0%   { transform: scale(1); opacity: 1; }
  60%  { transform: scale(0.6); opacity: 0.4; }
  100% { transform: scale(0.6); opacity: 0.4; }
}
.motion-hide { animation: motionHide 1s ease-in-out forwards; }

@keyframes motionMoveToProp {
  0% { transform: translate(0, 0); }
  100% { transform: translate(65vw, 0); }
}
.motion-move-to-prop { animation: motionMoveToProp 2s ease-in-out forwards; }

@keyframes motionJumpToProp {
  0% { transform: translate(0, 0); }
  50% { transform: translate(35vw, -80px); }
  100% { transform: translate(65vw, -30px); }
}
.motion-jump-to-prop { animation: motionJumpToProp 1.2s ease-in-out forwards; }

@keyframes motionMoveAndEat {
  0% { transform: translate(0, 0) rotate(0deg); }
  40% { transform: translate(65vw, 0) rotate(0deg); }
  50% { transform: translate(65vw, -8px) rotate(-8deg); }
  60% { transform: translate(65vw, 0) rotate(0deg); }
  70% { transform: translate(65vw, -8px) rotate(-8deg); }
  80% { transform: translate(65vw, 0) rotate(0deg); }
  100% { transform: translate(65vw, 0) rotate(0deg); }
}
.motion-move-and-eat { animation: motionMoveAndEat 3s ease-in-out forwards; }

@keyframes motionMoveAndSleep {
  0% { transform: translate(0, 0) scale(1); }
  40% { transform: translate(65vw, -10px) scale(1); }
  60% { transform: translate(65vw, -10px) scale(1.05); }
  80% { transform: translate(65vw, -10px) scale(1); }
  100% { transform: translate(65vw, -10px) scale(1.05); }
}
.motion-move-and-sleep { animation: motionMoveAndSleep 4s ease-in-out forwards; }

@keyframes motionMoveAndHide {
  0%   { transform: translate(0, 0) scale(1); opacity: 1; }
  40%  { transform: translate(65vw, 0) scale(1); opacity: 1; }
  70%  { transform: translate(65vw, 0) scale(0.6); opacity: 0.4; }
  100% { transform: translate(65vw, 0) scale(0.6); opacity: 0.4; }
}
.motion-move-and-hide { animation: motionMoveAndHide 3s ease-in-out forwards; }

@keyframes motionSpinInPlace {
  0%   { transform: rotate(0deg) scale(1); }
  50%  { transform: rotate(180deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(1); }
}
.motion-spin-in-place { animation: motionSpinInPlace 1s ease-in-out 2; }

@keyframes motionHappyBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-16px) scale(1.1); }
}
.motion-happy-bounce { animation: motionHappyBounce 0.6s ease-in-out 3; }

@keyframes motionIdleBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.motion-idle-bounce { animation: motionIdleBounce 1.6s ease-in-out infinite; }

/* ---------- History (time machine) overlay ---------- */

.history-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-end;
  z-index: 20;
}

.history-overlay.hidden { display: none; }

.history-sheet {
  background: white;
  width: 100%;
  max-height: 70vh;
  overflow-y: auto;
  border-radius: 24px 24px 0 0;
  padding: 1.2rem;
}

.history-sheet h2 {
  color: var(--brand);
  margin: 0 0 0.8rem;
  font-size: 1.2rem;
}

.history-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: var(--bg);
  border-radius: 16px;
  padding: 0.8rem 1rem;
  margin-bottom: 0.7rem;
  font-size: 0.95rem;
  line-height: 1.4;
  font-family: inherit;
  color: inherit;
}

.history-item .date {
  font-size: 0.75rem;
  color: #888;
  margin-bottom: 0.3rem;
}

.history-item .title {
  font-weight: 600;
  color: var(--brand-dark);
  margin-bottom: 0.2rem;
}

.history-item .preview {
  color: #555;
}

.history-empty {
  color: #888;
  text-align: center;
  padding: 1rem;
}

.history-close {
  display: block;
  margin: 0.5rem auto 0;
  background: var(--brand);
  color: white;
  border: none;
  border-radius: 14px;
  padding: 0.6rem 1.4rem;
  font-family: inherit;
  font-size: 1rem;
}

/* ---------- Marketing site header/footer ----------
   Used on the marketing home page and the informational /pages/*.html pages only -
   NOT on the fullscreen, distraction-free kid-facing app pages under /story/. */

html, body {
  overflow-x: hidden;
}

.site-header {
  background: var(--header-gradient);
  color: #333;
  padding: 1rem 1.2rem;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border-bottom: 4px solid rgba(255,255,255,0.5);
}

.site-header h1 {
  margin: 0 0 0.3rem;
  font-size: 1.5rem;
}

.site-header p {
  margin: 0;
  opacity: 0.85;
  font-size: 0.95rem;
}

.site-main {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem 1.2rem 3rem;
}

.site-footer {
  background: #2d2d2d;
  color: white;
  text-align: center;
  padding: 1.8rem 1.2rem;
  margin-top: 2rem;
}

.site-footer .footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.site-footer .footer-nav a {
  color: #ddd;
  text-decoration: none;
  font-size: 0.9rem;
}

.site-footer .footer-nav a:hover { text-decoration: underline; }

.site-footer p {
  font-size: 0.8rem;
  color: #aaa;
}

/* ---------- Marketing home page ---------- */

.hero {
  text-align: center;
  padding: 2rem 0 1rem;
}

.hero h2 {
  color: var(--brand-dark);
  font-size: 1.8rem;
  margin: 0 0 0.6rem;
}

.hero p.tagline {
  font-size: 1.15rem;
  color: #555;
  max-width: 560px;
  margin: 0 auto 1.5rem;
}

.cta-button {
  display: inline-block;
  background: var(--brand);
  color: white;
  padding: 0.9rem 2.2rem;
  border-radius: 30px;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
  box-shadow: 0 6px 16px rgba(106,17,203,0.3);
}

.section-title {
  text-align: center;
  color: var(--brand-dark);
  font-size: 1.5rem;
  margin: 2.5rem 0 0.4rem;
}

.section-subtitle {
  text-align: center;
  color: #666;
  max-width: 560px;
  margin: 0 auto 1.5rem;
  font-size: 0.95rem;
}

.benefit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.2rem;
  margin: 1.5rem 0;
}

.benefit-card {
  background: white;
  border-radius: 16px;
  padding: 1.4rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.benefit-card .icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.benefit-card h3 {
  color: var(--brand-dark);
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
}

.benefit-card p {
  font-size: 0.9rem;
  color: #555;
  line-height: 1.5;
  margin: 0;
}

.how-it-works {
  background: white;
  border-radius: 16px;
  padding: 1.6rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  margin: 1.5rem 0;
}

.how-it-works ol {
  margin: 0.8rem 0 0 1.2rem;
  padding: 0;
}

.how-it-works li {
  margin-bottom: 0.6rem;
  line-height: 1.5;
}

.cta-banner {
  text-align: center;
  margin: 2.5rem 0 1rem;
}

/* ---------- Informational /pages/*.html ---------- */

.page-card {
  background: white;
  border-radius: 16px;
  padding: 1.8rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.page-card h1 {
  color: var(--brand-dark);
  font-size: 1.7rem;
  margin: 0 0 0.4rem;
}

.page-card .subtitle {
  color: #666;
  margin-bottom: 1.4rem;
}

.page-card h2 {
  color: var(--brand-dark);
  margin: 1.6rem 0 0.7rem;
  font-size: 1.15rem;
}

.page-card p {
  margin-bottom: 1rem;
  line-height: 1.6;
}

.page-card ul {
  margin: 0 0 1rem 1.4rem;
}

.page-card li {
  margin-bottom: 0.4rem;
}

.page-card .last-updated {
  font-style: italic;
  color: #888;
  margin-bottom: 1.4rem;
}

.highlight-box {
  background: #f5f0ff;
  border-left: 4px solid var(--brand);
  padding: 1rem 1.2rem;
  border-radius: 8px;
  margin: 1.2rem 0;
}

.contact-method {
  background: #f5f0ff;
  border-radius: 12px;
  padding: 1.4rem;
  text-align: center;
  margin: 1.4rem 0;
}

.contact-method strong {
  display: block;
  color: var(--brand-dark);
  margin-bottom: 0.4rem;
}

.contact-method a {
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
}

/* Explicitly disable floating share widget on individual story reading pages */
.story-page .share-widget {
  display: none !important;
}

