/* Story Land — Home Screen Polish (mockup-aligned) */

:root {
  --home-nav-height: 96px;
  --cream-shelf: #FFF8EB;
  --cream-shelf-dark: #F3E4C8;
  --card-glow: 0 16px 48px rgba(123, 79, 191, 0.38), 0 6px 16px rgba(0, 0, 0, 0.14);
}

#screen-home {
  padding-bottom: var(--home-nav-height);
  overflow-x: clip;
  overflow-y: auto;
}

/* ── Rich 3D magical background ── */
.home-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: linear-gradient(180deg, #5EB8E8 0%, #87CEEB 40%, #7CCD7C 100%);
}

.home-bg-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 28%;
  transform: scale(1.08);
  filter: saturate(1.12) contrast(1.06) brightness(1.03);
  animation: bg-drift 32s ease-in-out infinite alternate;
  will-change: transform;
}

@keyframes bg-drift {
  from { transform: scale(1.08) translateY(0); }
  to   { transform: scale(1.12) translateY(-2%); }
}

.home-bg-depth {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 120% 80% at 50% 110%, rgba(76, 175, 80, 0.35), transparent 55%),
    radial-gradient(ellipse 60% 40% at 15% 85%, rgba(255, 105, 180, 0.12), transparent 50%),
    radial-gradient(ellipse 50% 35% at 85% 80%, rgba(255, 193, 7, 0.1), transparent 45%);
  pointer-events: none;
}

.home-bg-candy {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.candy-shape {
  position: absolute;
  opacity: 0.55;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.15));
}

.candy-shape.lollipop {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.5);
}

.candy-shape.lollipop::after {
  content: '';
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 32px;
  background: linear-gradient(90deg, #DEB887, #F5DEB3);
  border-radius: 3px;
}

.lollipop.l1 {
  bottom: 22%;
  left: 6%;
  background: radial-gradient(circle at 35% 35%, #FF8A80, #E91E63);
  animation: float-candy 7s ease-in-out infinite;
}

.lollipop.l2 {
  bottom: 30%;
  right: 8%;
  width: 36px;
  height: 36px;
  background: radial-gradient(circle at 35% 35%, #81D4FA, #0288D1);
  animation: float-candy 9s ease-in-out infinite reverse;
}

.candy-shape.mushroom {
  width: 44px;
  height: 36px;
}

.candy-shape.mushroom::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 26px;
  background: radial-gradient(ellipse, #FF6B9D 0%, #E91E63 100%);
  border-radius: 50% 50% 40% 40%;
  box-shadow: inset -4px -4px 0 rgba(255, 255, 255, 0.25);
}

.candy-shape.mushroom::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 14px;
  background: #FFCCBC;
  border-radius: 4px 4px 8px 8px;
}

.mushroom.m1 { bottom: 18%; left: 18%; animation: float-candy 8s ease-in-out infinite 1s; }
.mushroom.m2 { bottom: 24%; right: 16%; transform: scale(0.85); animation: float-candy 6s ease-in-out infinite 0.5s; }

@keyframes float-candy {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}

.home-bg-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg,
      rgba(135, 206, 235, 0.2) 0%,
      rgba(255, 255, 255, 0) 22%,
      rgba(255, 255, 255, 0) 50%,
      rgba(255, 248, 225, 0.06) 100%);
  pointer-events: none;
}

.home-bg-vignette {
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 120px rgba(90, 45, 145, 0.12);
  pointer-events: none;
}

.home-bg-sparkles {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 8% 15%, rgba(255, 213, 79, 0.95), transparent),
    radial-gradient(1.5px 1.5px at 22% 8%, rgba(255, 255, 255, 0.9), transparent),
    radial-gradient(2px 2px at 48% 12%, rgba(255, 213, 79, 0.85), transparent),
    radial-gradient(1px 1px at 68% 6%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(2px 2px at 88% 14%, rgba(255, 213, 79, 0.9), transparent),
    radial-gradient(1.5px 1.5px at 35% 22%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1px 1px at 75% 20%, rgba(255, 213, 79, 0.6), transparent);
  animation: sparkle-twinkle 5s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes sparkle-twinkle {
  from { opacity: 0.45; }
  to   { opacity: 1; }
}

/* ── Header ── */
#screen-home .home-header {
  padding: 16px 24px 0;
  max-width: 1140px;
  margin: 0 auto;
  width: 100%;
}

.logo-cloud {
  display: inline-block;
  padding: 12px 32px 16px;
  background: radial-gradient(ellipse 95% 85% at 50% 55%, #fff 0%, rgba(255, 255, 255, 0.94) 65%, transparent 100%);
  border-radius: 50% 50% 45% 45% / 60% 60% 40% 40%;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.14));
}

#screen-home .logo-text {
  font-size: clamp(1.65rem, 4.5vw, 2.6rem);
  text-shadow:
    2px 2px 0 rgba(255, 255, 255, 0.6),
    3px 5px 0 rgba(0, 0, 0, 0.1);
}

#screen-home .logo-banner {
  margin-top: 10px;
  padding: 7px 32px;
  font-size: 0.82rem;
  background: linear-gradient(180deg, #9B6FD4 0%, #5A2D91 100%);
  box-shadow: 0 5px 18px rgba(90, 45, 145, 0.4);
  border: 2px solid rgba(255, 255, 255, 0.3);
}

#screen-home .icon-btn svg,
#screen-home .menu-btn .hamburger {
  width: 46px;
  height: 46px;
  box-shadow: 0 5px 18px rgba(90, 45, 145, 0.38);
  transition: transform 0.2s, box-shadow 0.2s;
}

#screen-home .parent-btn-header svg {
  background: linear-gradient(180deg, #FFE082 0%, #FFB300 100%);
  color: #5A2D91;
}

/* ── Main layout ── */
#screen-home .home-main {
  max-width: 1140px;
  margin: 0 auto;
  width: 100%;
  padding: 24px 24px 28px;
  gap: 32px;
  flex: 1;
  justify-content: center;
}

.books-section {
  width: 100%;
  overflow: visible;
}

.shelf-heading {
  width: fit-content;
  margin: 0 auto -2px;
  padding: 8px 22px;
  border-radius: 999px;
  background: rgba(255, 248, 225, 0.94);
  color: #5A2D91;
  font-family: var(--font-display);
  font-size: 1.05rem;
  box-shadow: 0 6px 18px rgba(90, 45, 145, 0.2);
}

.pdf-books-section {
  margin-top: -12px;
}

.books-shelf {
  width: 100%;
  overflow: visible;
  padding: 8px 4px;
}

/* ── Book cards ── */
.books-carousel {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding: 16px 12px 24px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  justify-content: flex-start;
}

.books-carousel::-webkit-scrollbar { display: none; }

.book-card {
  flex: 0 0 auto;
  width: clamp(150px, 20vw, 190px);
  scroll-snap-align: center;
  cursor: pointer;
  perspective: 900px;
  padding: 4px;
}

.book-card-inner {
  background: linear-gradient(165deg, #FFFCF5 0%, var(--cream-shelf) 45%, var(--cream-shelf-dark) 100%);
  border-radius: 24px;
  padding: 12px 12px 14px;
  box-shadow:
    0 10px 32px rgba(90, 45, 145, 0.22),
    0 4px 10px rgba(0, 0, 0, 0.1),
    inset 0 2px 0 rgba(255, 255, 255, 0.95),
    inset 0 -3px 8px rgba(210, 180, 140, 0.15);
  border: 2.5px solid rgba(255, 255, 255, 0.75);
  transition:
    transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.35s ease;
}

.book-card:hover .book-card-inner {
  transform: translateY(-10px) scale(1.04);
  box-shadow:
    var(--card-glow),
    0 0 0 4px rgba(255, 213, 79, 0.5),
    inset 0 2px 0 rgba(255, 255, 255, 1);
  animation: card-bounce 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.book-card:active .book-card-inner {
  transform: translateY(-3px) scale(0.98);
}

@keyframes card-bounce {
  0%   { transform: translateY(0) scale(1); }
  45%  { transform: translateY(-12px) scale(1.05); }
  75%  { transform: translateY(-8px) scale(1.03); }
  100% { transform: translateY(-10px) scale(1.04); }
}

.book-cover-wrap {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  background: #fff;
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.22),
    inset 0 -3px 8px rgba(0, 0, 0, 0.08);
}

.book-cover-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  transition: transform 0.4s ease;
  background: #f5f0ff;
}

.book-card:hover .book-cover-wrap img {
  transform: scale(1.05);
}

.book-star-corner {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 35% 30%, #FFE082 0%, #FFB300 100%);
  color: #fff;
  font-size: 0.8rem;
  border-radius: 50%;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.28);
  border: 2px solid rgba(255, 255, 255, 0.5);
}

.book-badge {
  top: 8px;
  left: 8px;
  right: auto;
  z-index: 2;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.22);
}

.book-title-label {
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 14px;
  font-family: var(--font-display);
  font-size: clamp(0.74rem, 1.8vw, 0.86rem);
  font-weight: 700;
  color: #2a2a2a;
  text-align: center;
  line-height: 1.3;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  min-height: 2.6em;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Continue Reading ── */
.continue-section {
  width: 100%;
  margin-top: auto;
  overflow: visible;
}

.continue-row {
  display: flex;
  align-items: flex-end;
  gap: 0;
  position: relative;
  max-width: 100%;
}

.owl-mascot {
  position: relative;
  flex-shrink: 0;
  width: 96px;
  margin-right: -24px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.owl-body {
  font-size: 4rem;
  line-height: 1;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.28));
  animation: owl-bob 3.5s ease-in-out infinite;
  display: block;
}

.owl-stump {
  display: block;
  width: 58px;
  height: 20px;
  margin-top: -10px;
  background: linear-gradient(180deg, #BCAAA4 0%, #6D4C41 100%);
  border-radius: 45% 45% 10px 10px;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.22);
}

@keyframes owl-bob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-10px) rotate(-2deg); }
}

.continue-card {
  flex: 1;
  min-width: 0;
  background: linear-gradient(180deg, #FFFCF0 0%, #FFF4D4 100%);
  border-radius: 28px;
  padding: 22px 28px;
  box-shadow:
    0 16px 48px rgba(90, 45, 145, 0.22),
    0 6px 16px rgba(0, 0, 0, 0.08),
    inset 0 3px 0 rgba(255, 255, 255, 0.95);
  border: 3px solid rgba(255, 213, 79, 0.65);
}

.continue-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.continue-header h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: #5A2D91;
  letter-spacing: 0.01em;
}

.star-icon {
  font-size: 1.15rem;
  color: #FFB300;
  filter: drop-shadow(0 1px 3px rgba(255, 179, 0, 0.5));
}

.continue-body {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
}

.continue-thumb {
  width: 72px;
  height: 94px;
  border-radius: 12px;
  object-fit: cover;
  object-position: center top;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
  border: 2.5px solid rgba(255, 255, 255, 0.9);
  background: #f5f0ff;
}

.continue-info h3 {
  font-family: var(--font-display);
  font-size: 1.12rem;
  color: #333;
  margin-bottom: 4px;
}

.continue-info .chapter {
  font-size: 0.88rem;
  color: #888;
  margin-bottom: 10px;
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 280px;
}

.progress-bar {
  flex: 1;
  height: 11px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-pill);
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #81C784 0%, #43A047 100%);
  border-radius: var(--radius-pill);
  box-shadow: 0 0 10px rgba(76, 175, 80, 0.45);
}

.progress-pct {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  color: #388E3C;
  min-width: 38px;
}

.btn-resume {
  padding: 16px 26px;
  background: linear-gradient(180deg, #A87DE0 0%, #6B3FA0 100%);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  border-radius: var(--radius-pill);
  box-shadow: 0 8px 24px rgba(107, 63, 160, 0.45);
  border: 2px solid rgba(255, 255, 255, 0.25);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.btn-resume:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 32px rgba(107, 63, 160, 0.55);
}

.btn-resume .chevron {
  font-size: 1.3rem;
  line-height: 1;
}

/* Signposts */
.quick-links {
  display: none;
  flex-direction: column;
  gap: 12px;
  margin-left: 14px;
  flex-shrink: 0;
}

.signpost {
  padding: 14px 18px;
  min-width: 108px;
  background: linear-gradient(135deg, #BCAAA4 0%, #8D6E63 50%, #6D4C41 100%);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 8px 16px 16px 8px;
  box-shadow: 4px 5px 0 #4E342E, 0 6px 16px rgba(0, 0, 0, 0.22);
  transition: transform 0.2s;
  text-align: center;
}

.signpost:hover {
  transform: translateX(5px) rotate(1.5deg);
}

.signpost-new .signpost-icon { color: #FF6B9D; }
.signpost-popular .signpost-icon { color: #64B5F6; }

/* ── Premium bottom navigation ── */
.bottom-nav-shell {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding: 0 16px calc(14px + env(safe-area-inset-bottom));
  pointer-events: none;
}

.bottom-nav-shell::before {
  content: '';
  position: absolute;
  bottom: calc(14px + env(safe-area-inset-bottom) + 58px);
  left: 50%;
  transform: translateX(-50%);
  width: min(720px, calc(100% - 24px));
  height: 14px;
  background:
    radial-gradient(circle at 14px 14px, transparent 12px, #FFD54F 13px) 0 0 / 28px 14px repeat-x;
  filter: drop-shadow(0 -2px 4px rgba(255, 193, 7, 0.3));
  pointer-events: none;
  z-index: 1;
}

.bottom-nav-shell .bottom-nav {
  pointer-events: auto;
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  background: linear-gradient(180deg, #9B6FD4 0%, #5A2D91 100%);
  border-radius: 32px;
  box-shadow:
    0 -6px 32px rgba(90, 45, 145, 0.4),
    0 12px 40px rgba(0, 0, 0, 0.22),
    inset 0 2px 0 rgba(255, 255, 255, 0.18),
    inset 0 -4px 12px rgba(0, 0, 0, 0.12);
  border: 2.5px solid rgba(255, 255, 255, 0.15);
}

.bottom-nav-shell .bottom-nav::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.14) 1.2px, transparent 1.2px);
  background-size: 16px 16px;
  pointer-events: none;
  opacity: 0.55;
}

#screen-home .bottom-nav-shell .nav-item {
  position: relative;
  z-index: 1;
  flex: 1;
  padding: 11px 8px;
  font-size: 0.7rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.8);
  border-radius: 22px;
  transition: all 0.25s cubic-bezier(0.34, 1.2, 0.64, 1);
}

#screen-home .bottom-nav-shell .nav-item svg {
  width: 26px;
  height: 26px;
  transition: transform 0.25s;
}

#screen-home .bottom-nav-shell .nav-item.active {
  background: linear-gradient(180deg, #fff 0%, #F8F0FF 100%);
  color: #6B3FA0;
  box-shadow:
    0 4px 18px rgba(0, 0, 0, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 1);
}

#screen-home .bottom-nav-shell .nav-item.active svg {
  transform: scale(1.1);
}

#screen-home .bottom-nav-shell .nav-item:not(.active):hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  transform: translateY(-2px);
}

/* ── Desktop: all books visible, no cutoff ── */
@media (min-width: 960px) {
  #screen-home .home-main {
    padding-left: 32px;
    padding-right: 32px;
  }

  .books-shelf {
    padding: 12px 8px 16px;
  }

  .books-carousel {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 28px;
    overflow: visible;
    padding: 20px 16px 28px;
    max-width: 960px;
    margin: 0 auto;
    width: 100%;
  }

  .book-card {
    width: auto;
    min-width: 0;
    padding: 6px;
  }

  .quick-links {
    display: flex;
  }

  .continue-row {
    align-items: center;
    max-width: 960px;
    margin: 0 auto;
  }

  .continue-body {
    gap: 24px;
  }
}

@media (min-width: 768px) and (max-width: 959px) {
  .books-carousel {
    justify-content: center;
    gap: 22px;
    padding-left: 20px;
    padding-right: 20px;
  }

  .book-card {
    width: 168px;
  }

  .quick-links {
    display: flex;
  }
}

/* ── Mobile ── */
@media (max-width: 767px) {
  #screen-home .home-header {
    padding: 12px 14px 0;
  }

  #screen-home .home-main {
    padding: 16px 16px 24px;
    gap: 24px;
  }

  .home-bg-candy .candy-shape {
    opacity: 0.35;
    transform: scale(0.75);
  }

  .books-carousel {
    gap: 16px;
    padding: 12px 16px 20px;
  }

  .book-card {
    width: 152px;
  }

  .continue-row {
    flex-direction: column;
    align-items: stretch;
  }

  .owl-mascot {
    width: auto;
    margin-right: 0;
    margin-bottom: -28px;
    align-self: flex-start;
    margin-left: 16px;
  }

  .owl-body {
    font-size: 3.2rem;
  }

  .continue-card {
    padding: 20px 18px;
    border-radius: 24px;
  }

  .continue-body {
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: 14px;
  }

  .continue-thumb-wrap {
    grid-row: 1 / 3;
  }

  .progress-row {
    max-width: none;
  }

  .btn-resume {
    grid-column: 1 / -1;
    justify-content: center;
    width: 100%;
  }

  .quick-links {
    display: flex;
    flex-direction: row;
    margin-left: 0;
    margin-top: 14px;
    gap: 12px;
  }

  .signpost {
    flex: 1;
  }

  .bottom-nav-shell {
    padding: 0 8px calc(8px + env(safe-area-inset-bottom));
  }

  .bottom-nav-shell::before {
    bottom: calc(8px + env(safe-area-inset-bottom) + 54px);
    height: 10px;
    background-size: 24px 10px;
  }

  .bottom-nav-shell .bottom-nav {
    border-radius: 26px;
    padding: 10px 8px;
  }

  #screen-home .bottom-nav-shell .nav-item {
    padding: 9px 4px;
    font-size: 0.62rem;
  }

  #screen-home .bottom-nav-shell .nav-item svg {
    width: 22px;
    height: 22px;
  }
}

@media (max-width: 480px) {
  #screen-home .header-actions .icon-btn span {
    display: none;
  }

  .logo-cloud {
    padding: 10px 20px 12px;
  }

  .book-card {
    width: 140px;
  }
}
