:root {
  --ink: #1f1b4d;
  --ink-soft: #5b5780;
  --purple: #7c4dff;
  --purple-2: #a36bff;
  --card: #ffffff;
  --line: rgba(124, 77, 255, 0.12);
  --shadow: 0 10px 30px rgba(94, 62, 180, 0.12);
  --shadow-lg: 0 18px 40px rgba(94, 62, 180, 0.18);
  --radius: 22px;
  --font-display: "Fredoka", "Nunito", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 1rem;
}

body.page-home {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 0% 0%, #f3e8ff 0%, transparent 60%),
    radial-gradient(900px 600px at 100% 10%, #fde7f3 0%, transparent 55%),
    radial-gradient(900px 700px at 50% 100%, #e0ecff 0%, transparent 60%),
    #f7f3ff;
  background-attachment: fixed;
  padding:
    max(0.75rem, env(safe-area-inset-top))
    max(0.75rem, env(safe-area-inset-right))
    max(1rem, env(safe-area-inset-bottom))
    max(0.75rem, env(safe-area-inset-left));
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.home {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

/* ---------- Top bar ---------- */

.home-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 0.8rem 0.6rem 1.1rem;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.home-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.55rem;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
}

.home-logo__pad {
  flex: 0 0 auto;
  width: auto;
  height: 2.3rem;
  margin-top: -0.35rem;
}

.home-logo__name {
  background: linear-gradient(90deg, var(--purple), var(--purple-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.home-logo__star {
  font-size: 1.25rem;
}

.home-nav {
  display: flex;
  gap: 0.45rem;
  margin-left: auto;
}

.home-nav__link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0 1.1rem;
  border-radius: 999px;
  background: #f4f1fb;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 0.92rem;
  text-decoration: none;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}

.home-nav__link svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex-shrink: 0;
}

.home-nav__link:hover {
  background: #ebe4ff;
  color: var(--purple);
}

.home-nav__link.is-active {
  background: linear-gradient(135deg, var(--purple), var(--purple-2));
  color: #fff;
  box-shadow: 0 6px 16px rgba(124, 77, 255, 0.35);
}

.home-bar__end {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding-left: 0.6rem;
  margin-left: 0.4rem;
  border-left: 1px solid var(--line);
}

.home-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, #fde7f3, #ede4ff);
  box-shadow: 0 0 0 3px #fff, 0 4px 12px rgba(124, 77, 255, 0.25);
  flex-shrink: 0;
}

.home-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 8%;
  display: block;
}

.home-gear {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: #f4f1fb;
  color: var(--ink-soft);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.3s;
}

.home-gear svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.home-gear:hover {
  background: #ebe4ff;
  color: var(--purple);
  transform: rotate(45deg);
}

/* ---------- Hero ---------- */

.home-hero {
  position: relative;
  overflow: hidden;
  min-height: clamp(260px, 30vw, 380px);
  border-radius: 30px;
  border: 3px solid rgba(255, 255, 255, 0.95);
  background: linear-gradient(90deg, #efe6ff, #fbe8f5);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
}

.home-hero__art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 70% 45%;
}

.home-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(245, 237, 255, 0.95) 0%,
    rgba(245, 237, 255, 0.8) 30%,
    rgba(245, 237, 255, 0) 55%
  );
  z-index: 1;
}

.home-hero__copy {
  position: relative;
  z-index: 2;
  max-width: 520px;
  padding: clamp(1.5rem, 3.5vw, 2.8rem);
}

.home-hero__kicker {
  margin: 0 0 0.4rem;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--purple);
}

.home-hero__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  line-height: 0.98;
  color: var(--ink);
}

.home-hero__name {
  display: block;
  background: linear-gradient(90deg, #6d3cff, #b06bff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.home-hero__lead {
  margin: 0.9rem 0 1.4rem;
  max-width: 26rem;
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  font-weight: 600;
  line-height: 1.45;
  color: var(--ink-soft);
}

.home-hero__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 54px;
  padding: 0 1.8rem 0 1.4rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #7c4dff, #b26bff);
  color: #fff;
  font-weight: 800;
  font-size: 1.1rem;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(124, 77, 255, 0.4);
  transition: transform 0.15s, box-shadow 0.2s;
}

.home-hero__cta svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.home-hero__cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(124, 77, 255, 0.45);
}

.home-hero__cta:active {
  transform: translateY(1px) scale(0.98);
}

.home-hero__welcome-back {
  display: inline-block;
  margin: 1rem 0 0;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--purple);
  font-weight: 800;
}

.home-hero__spark {
  position: absolute;
  z-index: 2;
  line-height: 1;
  color: #ffd84d;
  text-shadow: 0 4px 10px rgba(255, 190, 40, 0.45);
  animation: home-twinkle 3.2s ease-in-out infinite;
  pointer-events: none;
}

.home-hero__spark--1 { top: 8%; left: 36%; font-size: 3.2rem; }
.home-hero__spark--2 { bottom: 10%; right: 2%; font-size: 3rem; animation-delay: 0.8s; }
.home-hero__spark--3 { bottom: 6%; left: 40%; font-size: 2.2rem; color: #ff9bd2; text-shadow: 0 4px 10px rgba(255, 120, 200, 0.4); animation-delay: 1.6s; }
.home-hero__spark--4 { top: 22%; left: 44%; font-size: 1.3rem; animation-delay: 2.2s; }

@keyframes home-twinkle {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; }
  50% { transform: scale(0.82) rotate(12deg); opacity: 0.75; }
}

/* ---------- Story book shelf ---------- */

.home-books {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  margin: 1.1rem 0 0.9rem;
  padding: 1.6rem 1.8rem 0;
  border-radius: 30px;
  border: 3px solid rgba(255, 255, 255, 0.95);
  background: linear-gradient(90deg, #fde8f1, #f4e8ff);
  box-shadow: var(--shadow-lg);
  scroll-margin-top: 1rem;
}

.home-books__bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 70% 30%;
}

.home-books::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    90deg,
    rgba(255, 240, 246, 0.85) 0%,
    rgba(255, 240, 246, 0.55) 40%,
    rgba(255, 240, 246, 0) 70%
  );
}

.home-books__star {
  position: absolute;
  z-index: -1;
  color: #ffd84d;
  text-shadow: 0 0 14px rgba(255, 216, 77, 0.8);
  animation: home-twinkle 3.2s ease-in-out infinite;
  pointer-events: none;
}

.home-books__star--1 { top: 1.6rem; left: 36%; font-size: 2.4rem; }
.home-books__star--2 { top: 4.2rem; left: 43%; font-size: 1.6rem; animation-delay: 0.8s; }
.home-books__star--3 { top: 1.2rem; left: 61%; font-size: 1.3rem; animation-delay: 1.6s; }

.home-books__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem 1rem;
}

.home-books__kicker {
  margin: 0 0 0.2rem;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--purple);
}

.home-books__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 3.6vw, 2.9rem);
  line-height: 1.05;
  color: var(--ink);
}

.home-books__name {
  display: block;
  background: linear-gradient(90deg, var(--purple), #c04dff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.home-books__sub {
  max-width: 26rem;
  margin: 0.5rem 0 0;
  font-weight: 700;
  color: var(--ink-soft);
}

.home-books__all {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 50px;
  padding: 0 1.1rem 0 1.5rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--purple), var(--purple-2));
  color: #fff;
  font-weight: 800;
  font-size: 1.05rem;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(124, 77, 255, 0.35);
  transition: transform 0.15s;
}

.home-books__all:hover {
  transform: translateY(-2px);
}

.home-books__all svg,
.home-books__arrow svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-books__shelf {
  position: relative;
  margin: 0.8rem -1.8rem 0;
}

.home-books__track {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 1.6rem;
  margin: 0;
  padding: 1rem 4rem 40px;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 4rem;
  scrollbar-width: none;
}

.home-books__track::-webkit-scrollbar {
  display: none;
}

.home-books__plank {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 58px;
  background:
    linear-gradient(180deg, #f3cf9d 0, #e7b77c 12px, #d9a468 13px, #c98f55 100%);
  box-shadow: inset 0 -8px 14px rgba(120, 70, 30, 0.25);
}

.home-books__plank::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -10px;
  height: 10px;
  background: linear-gradient(180deg, rgba(120, 70, 30, 0), rgba(120, 70, 30, 0.18));
}

.home-books__arrow {
  position: absolute;
  z-index: 2;
  top: calc(50% - 40px);
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s, opacity 0.2s;
}

.home-books__arrow[hidden] {
  display: none;
}

.home-books__arrow:hover:not(:disabled) {
  transform: scale(1.08);
}

.home-books__arrow:disabled {
  opacity: 0.35;
  cursor: default;
}

.home-books__arrow--prev { left: 0.8rem; }
.home-books__arrow--next { right: 0.8rem; }

.hbook {
  flex: 0 0 auto;
  width: 200px;
  scroll-snap-align: start;
}

.hbook__link {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: inherit;
  text-decoration: none;
  outline: none;
}

.hbook__cover {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 6px 14px 14px 6px;
  background: hsl(var(--h, 280) 70% 82%);
  box-shadow:
    inset -3px 0 0 rgba(255, 255, 255, 0.5),
    6px 10px 18px rgba(80, 40, 30, 0.28);
  transform: rotate(var(--tilt, 0deg));
  transform-origin: 50% 100%;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hbook__link:hover .hbook__cover,
.hbook__link:focus-visible .hbook__cover {
  transform: translateY(-10px) rotate(0deg);
  box-shadow:
    inset -3px 0 0 rgba(255, 255, 255, 0.5),
    8px 18px 26px rgba(80, 40, 30, 0.3);
}

.hbook__link:focus-visible .hbook__cover {
  outline: 4px solid var(--purple);
  outline-offset: 3px;
}

.hbook__art,
.hbook__art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hbook__art img {
  object-fit: cover;
}

.hbook__cover--plain {
  background:
    radial-gradient(circle at 22% 78%, rgba(255, 255, 255, 0.55) 0 5px, transparent 6px),
    radial-gradient(circle at 78% 62%, rgba(255, 255, 255, 0.45) 0 4px, transparent 5px),
    radial-gradient(circle at 60% 88%, rgba(255, 255, 255, 0.5) 0 3px, transparent 4px),
    linear-gradient(160deg, hsl(var(--h, 280) 80% 84%), hsl(var(--h, 280) 65% 64%));
}

.hbook__cover--plain::after {
  content: "✦";
  position: absolute;
  left: 50%;
  top: 62%;
  transform: translate(-50%, -50%);
  font-size: 3.2rem;
  color: rgba(255, 255, 255, 0.85);
}

.hbook__spine {
  position: absolute;
  z-index: 2;
  top: 0;
  bottom: 0;
  left: 0;
  width: 12px;
  background: linear-gradient(90deg, hsl(var(--h, 280) 55% 42%), hsl(var(--h, 280) 60% 58%));
  box-shadow: 2px 0 3px rgba(0, 0, 0, 0.18);
}

.hbook__title {
  position: absolute;
  z-index: 2;
  top: 7%;
  left: 12%;
  right: 6%;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  line-height: 1.1;
  text-align: center;
  color: #fff;
  overflow-wrap: anywhere;
  text-shadow:
    0 2px 0 hsl(var(--h, 280) 55% 36%),
    2px 0 0 hsl(var(--h, 280) 55% 36%),
    -2px 0 0 hsl(var(--h, 280) 55% 36%),
    0 -2px 0 hsl(var(--h, 280) 55% 36%),
    0 4px 10px rgba(0, 0, 0, 0.35);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.hbook__shine {
  position: absolute;
  z-index: 1;
  inset: 0;
  background: linear-gradient(105deg, rgba(255, 255, 255, 0) 55%, rgba(255, 255, 255, 0.22) 70%, rgba(255, 255, 255, 0) 80%);
  pointer-events: none;
}

.hbook__label {
  position: relative;
  z-index: 3;
  max-width: 94%;
  margin-top: -18px;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  background: #fff7ef;
  box-shadow: 0 4px 10px rgba(80, 40, 30, 0.2);
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hbook--extra .hbook__cover {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 3px dashed rgba(124, 77, 255, 0.45);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 8px 18px rgba(94, 62, 180, 0.12);
  transform: none;
}

.hbook--sample .hbook__cover {
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.9);
  background: linear-gradient(160deg, #ffe3f1, #e8dcff);
}

.hbook__extra-icon {
  font-size: 3rem;
}

.hbook__extra-text {
  padding: 0 1rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  text-align: center;
  color: var(--purple);
}

@media (max-width: 640px) {
  .home-books {
    padding: 1.2rem 1.1rem 0;
    border-radius: 24px;
  }
  .home-books__shelf {
    margin: 0.6rem -1.1rem 0;
  }
  .home-books__track {
    gap: 1.1rem;
    padding: 0.8rem 1.2rem 36px;
    scroll-padding: 0 1.2rem;
  }
  .home-books__plank {
    height: 52px;
  }
  .home-books__arrow {
    display: none;
  }
  .home-books__all {
    min-height: 44px;
    font-size: 0.95rem;
  }
  .home-books__star--1,
  .home-books__star--2 {
    display: none;
  }
  .hbook {
    width: 150px;
  }
  .hbook__title {
    font-size: 1.02rem;
  }
  .hbook__label {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-books__star {
    animation: none;
  }
  .hbook__cover,
  .hbook__link:hover .hbook__cover {
    transition: none;
  }
}

/* ---------- Character stage ---------- */

.home-cast {
  scroll-margin-top: 1rem;
}

.home-cast__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.6rem 1rem;
  margin: 0.4rem 0 0.7rem;
}

.home-cast__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.2rem;
  color: var(--ink);
}

.home-cast__sub {
  margin: 0.1rem 0 0;
  font-weight: 700;
  color: var(--ink-soft);
}

.home-cast__add {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 46px;
  padding: 0 1.3rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff7ac0, #b26bff);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(236, 72, 153, 0.35);
  transition: transform 0.15s;
}

.home-cast__add:hover {
  transform: translateY(-2px);
}

.home-cast__stage {
  position: relative;
  height: 290px;
  border-radius: 30px;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-lg);
  background: linear-gradient(180deg, #bfe3ff 0%, #e3f1ff 45%, #fde9f5 100%);
  isolation: isolate;
}

.home-cast__sun {
  position: absolute;
  top: 18px;
  right: 8%;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #fff6b8, #ffd54a 60%, #ffc233);
  box-shadow: 0 0 40px 12px rgba(255, 214, 74, 0.55);
}

.home-cast__cloud {
  position: absolute;
  width: 120px;
  height: 36px;
  border-radius: 999px;
  background: #fff;
  opacity: 0.95;
  animation: cast-cloud 60s linear infinite;
}

.home-cast__cloud::before,
.home-cast__cloud::after {
  content: "";
  position: absolute;
  background: #fff;
  border-radius: 50%;
}

.home-cast__cloud::before {
  width: 54px;
  height: 54px;
  top: -26px;
  left: 18px;
}

.home-cast__cloud::after {
  width: 40px;
  height: 40px;
  top: -18px;
  left: 60px;
}

.home-cast__cloud--1 { top: 40px; left: -140px; }
.home-cast__cloud--2 { top: 78px; left: -140px; transform: scale(0.7); animation-duration: 85s; animation-delay: -40s; }
.home-cast__cloud--3 { top: 30px; left: -140px; transform: scale(0.55); animation-duration: 110s; animation-delay: -75s; }

@keyframes cast-cloud {
  to { left: calc(100% + 140px); }
}

.home-cast__hills {
  position: absolute;
  left: -5%;
  right: -5%;
  bottom: 40px;
  height: 110px;
  background:
    radial-gradient(60% 100% at 20% 100%, #b7e4a8 0 60%, transparent 61%),
    radial-gradient(55% 90% at 75% 100%, #a6dc98 0 60%, transparent 61%),
    radial-gradient(40% 70% at 50% 100%, #c7ecb6 0 60%, transparent 61%);
}

.home-cast__grass {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 62px;
  background:
    radial-gradient(circle at 10% 30%, #ffd1e8 0 4px, transparent 5px),
    radial-gradient(circle at 34% 60%, #fff3a6 0 4px, transparent 5px),
    radial-gradient(circle at 62% 35%, #ffd1e8 0 4px, transparent 5px),
    radial-gradient(circle at 88% 55%, #e0d0ff 0 4px, transparent 5px),
    linear-gradient(180deg, #8fd47c, #6fbf5f);
  border-top-left-radius: 50% 18px;
  border-top-right-radius: 50% 18px;
}

.cast-walker {
  position: absolute;
  left: 0;
  bottom: 12px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
  animation: cast-appear 0.7s cubic-bezier(0.3, 1.6, 0.5, 1) backwards;
}

.cast-walker--back {
  bottom: 44px;
  z-index: 2;
}

.cast-walker__body {
  display: block;
  transform-origin: 50% 100%;
  animation: cast-waddle 0.55s ease-in-out infinite alternate;
}

.cast-walker__img {
  display: block;
  height: 185px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(60, 40, 120, 0.25));
  transition: transform 0.25s;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}

.cast-walker--back .cast-walker__img {
  height: 140px;
  max-width: 160px;
}

.cast-walker__body.is-left .cast-walker__img {
  transform: scaleX(-1);
}

.cast-walker__shadow {
  position: absolute;
  bottom: 14px;
  left: 50%;
  width: 70%;
  height: 12px;
  translate: -50% 0;
  border-radius: 50%;
  background: rgba(40, 80, 30, 0.22);
  filter: blur(2px);
}

.cast-walker__name {
  margin-top: -4px;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  white-space: nowrap;
}

.cast-walker__puff {
  position: absolute;
  top: 30%;
  left: 50%;
  translate: -50% 0;
  font-size: 2.4rem;
  opacity: 0;
  pointer-events: none;
  animation: cast-puff 0.9s ease-out backwards;
  animation-delay: inherit;
}

.cast-walker.is-idle .cast-walker__body {
  animation: cast-breathe 1.6s ease-in-out infinite alternate;
}

.cast-walker.is-hop .cast-walker__body {
  animation: cast-hop 0.6s ease-out 2;
}

.cast-walker.is-picked .cast-walker__img {
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.95)) drop-shadow(0 4px 8px rgba(124, 77, 255, 0.45));
}

.cast-walker:focus-visible {
  outline: 3px solid var(--purple);
  outline-offset: 4px;
  border-radius: 16px;
}

@keyframes cast-appear {
  from { scale: 0; opacity: 0; }
  to { scale: 1; opacity: 1; }
}

@keyframes cast-puff {
  0% { opacity: 0; scale: 0.4; }
  30% { opacity: 1; scale: 1.3; }
  100% { opacity: 0; scale: 1.8; }
}

@keyframes cast-waddle {
  from { transform: translateY(0) rotate(-4deg); }
  to { transform: translateY(-7px) rotate(4deg); }
}

@keyframes cast-breathe {
  from { transform: scale(1, 1); }
  to { transform: scale(1.02, 0.98); }
}

@keyframes cast-hop {
  0% { transform: translateY(0) scale(1.05, 0.92); }
  40% { transform: translateY(-38px) scale(0.96, 1.05); }
  70% { transform: translateY(0) scale(1.06, 0.92); }
  100% { transform: translateY(0) scale(1, 1); }
}

.home-cast__stage.is-calm .cast-walker__body,
html.kids-reduce-motion .cast-walker__body,
html.kids-reduce-motion .home-cast__cloud {
  animation: none !important;
}

.home-cast__bubble {
  position: absolute;
  z-index: 10;
  min-width: 190px;
  max-width: 260px;
  padding: 0.7rem 0.9rem 0.8rem;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(60, 40, 120, 0.25);
  text-align: center;
  animation: cast-appear 0.3s cubic-bezier(0.3, 1.6, 0.5, 1);
  transform-origin: var(--tail, 50%) 100%;
}

.home-cast__bubble[hidden] {
  display: none;
}

.home-cast__bubble::after {
  content: "";
  position: absolute;
  bottom: -9px;
  left: var(--tail, 50%);
  width: 18px;
  height: 18px;
  translate: -50% 0;
  rotate: 45deg;
  background: #fff;
  border-radius: 3px;
}

.home-cast__bubble.is-side::after {
  bottom: auto;
  top: 22px;
  left: -2px;
}

.home-cast__bubble.is-side-left::after {
  left: auto;
  right: -16px;
}

.home-cast__bubble-text {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
}

.home-cast__bubble-go {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 1rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #ec4899, #b26bff);
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
  text-decoration: none;
}

/* ---------- Games ---------- */

.home-games {
  scroll-margin-top: 1rem;
}

.home-games__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem 1.2rem;
  margin: 0.6rem 0 1.1rem;
}

.home-games__heading {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-right: auto;
}

.home-games__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.2rem;
  color: var(--ink);
}

.home-games__sub {
  margin: 0;
  font-weight: 600;
  color: var(--ink-soft);
}

.home-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 220px;
  height: 46px;
  padding: 0 1rem;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(94, 62, 180, 0.1);
  color: var(--ink-soft);
}

.home-search:focus-within {
  box-shadow: 0 0 0 3px rgba(124, 77, 255, 0.3), 0 4px 14px rgba(94, 62, 180, 0.1);
}

.home-search svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex-shrink: 0;
}

.home-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
}

.home-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.home-tab {
  min-height: 42px;
  padding: 0 1rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.home-tab:hover {
  background: #fff;
}

.home-tab.is-active {
  background: linear-gradient(135deg, var(--purple), var(--purple-2));
  color: #fff;
  box-shadow: 0 6px 14px rgba(124, 77, 255, 0.3);
}

.home-tab--fav {
  color: #e0457b;
}

.home-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 1.1rem;
}

.hcard {
  position: relative;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  border: 3px solid #fff;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.hcard:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.hcard__link {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
  text-decoration: none;
}

.hcard__thumb {
  aspect-ratio: 16 / 8;
  overflow: hidden;
  background: var(--accent-soft);
  display: grid;
  place-items: center;
}

.hcard__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s;
}

.hcard:hover .hcard__img {
  transform: scale(1.05);
}

.hcard__emoji {
  font-size: 4rem;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.12));
}

.hcard__body {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.85rem 1rem 1rem;
  background: linear-gradient(180deg, #fff 0%, var(--accent-soft) 160%);
}

.hcard__text {
  flex: 1;
  min-width: 0;
}

.hcard__title {
  margin: 0 0 0.2rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--ink);
}

.hcard__desc {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink-soft);
}

.hcard__go {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 6px 14px color-mix(in srgb, var(--accent) 45%, transparent);
  transition: transform 0.2s;
}

.hcard:hover .hcard__go {
  transform: translateX(3px);
}

.hcard__fav {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.9);
  color: #c9c3dd;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition: color 0.2s, transform 0.15s;
}

.hcard__fav svg {
  fill: currentColor;
}

.hcard__fav:hover {
  color: #f472a6;
}

.hcard__fav.is-on {
  color: #ec3f7f;
  animation: home-pop 0.3s ease-out;
}

@keyframes home-pop {
  50% { transform: scale(1.25); }
}

.home-empty {
  margin: 1rem 0;
  padding: 2rem 1rem;
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
}

/* ---------- About ---------- */

.home-about {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-top: 0.8rem;
  padding: 1.3rem 1.5rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: var(--shadow);
  scroll-margin-top: 1rem;
}

.home-about__icon {
  font-size: 2rem;
  line-height: 1;
}

.home-about__title {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.3rem;
}

.home-about__text p {
  margin: 0.3rem 0 0;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.5;
}

.home-about__text strong {
  color: var(--ink);
}

/* ---------- Focus ---------- */

.home a:focus-visible,
.home button:focus-visible {
  outline: 3px solid var(--purple);
  outline-offset: 3px;
}

/* ---------- Responsive ---------- */

@media (max-width: 1080px) {
  .home-nav__link {
    padding: 0 0.85rem;
  }
  .home-logo {
    font-size: 1.3rem;
  }
}

@media (max-width: 900px) {
  .home-bar {
    flex-wrap: wrap;
    border-radius: 26px;
  }
  .home-nav {
    order: 3;
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
  }
  .home-nav__link {
    flex: 1;
    justify-content: center;
  }
  .home-bar__end {
    margin-left: auto;
    border-left: 0;
  }
  .home-games__heading {
    width: 100%;
  }
  .home-search {
    flex: 1;
  }
}

@media (max-width: 640px) {
  .home-logo {
    font-size: 1.15rem;
  }
  .home-logo__pad {
    height: 1.9rem;
  }
  .home-nav__link {
    flex-direction: column;
    gap: 0.15rem;
    min-height: 54px;
    padding: 0 0.3rem;
    font-size: 0.72rem;
    border-radius: 18px;
  }
  .home-nav__link svg {
    width: 20px;
    height: 20px;
  }
  .home-nav__my {
    display: none;
  }
  .home-avatar {
    width: 40px;
    height: 40px;
  }
  .home-gear {
    width: 40px;
    height: 40px;
  }
  .home-hero {
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
  }
  .home-hero__art {
    position: relative;
    height: auto;
    aspect-ratio: 16 / 10;
    object-position: 75% 50%;
  }
  .home-hero::before {
    display: none;
  }
  .home-hero__copy {
    background: linear-gradient(180deg, #f5edff, #fbeaf5);
    padding: 1.2rem 1.3rem 1.5rem;
  }
  .home-hero__spark--1,
  .home-hero__spark--3,
  .home-hero__spark--4 {
    display: none;
  }
  .home-games__heading {
    flex-direction: column;
    gap: 0.1rem;
  }
  .home-games__title,
  .home-cast__title {
    font-size: 1.8rem;
  }
  .home-cast__stage {
    height: 235px;
    border-radius: 24px;
  }
  .cast-walker__img {
    height: 112px;
    max-width: 130px;
  }
  .cast-walker--back .cast-walker__img {
    height: 88px;
    max-width: 105px;
  }
  .cast-walker--back {
    bottom: 36px;
  }
  .home-cast__sun {
    width: 46px;
    height: 46px;
  }
  .home-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    width: 100%;
    padding-bottom: 0.2rem;
    scrollbar-width: none;
  }
  .home-tabs::-webkit-scrollbar {
    display: none;
  }
  .home-tab {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.7);
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-hero__spark,
  .hcard__fav.is-on {
    animation: none;
  }
  .hcard,
  .hcard__img,
  .hcard__go {
    transition: none;
  }
}

html.kids-reduce-motion .home-hero__spark,
html.kids-reduce-motion .hcard__fav.is-on {
  animation: none;
}

html.kids-reduce-motion .hcard:hover,
html.kids-reduce-motion .hcard:hover .hcard__img {
  transform: none;
}
