:root {
  color-scheme: light;
  --ink: #24445a;
  --ink-soft: #567083;
  --paper: #fffdf7;
  --sky: #e7f6f4;
  --sun: #f5c96a;
  --coral: #eb746c;
  --coral-soft: #f9c6a8;
  --aqua: #73c9c4;
  --mint: #bde4c0;
  --lavender: #b9a5d8;
  --plum: #76558f;
  --shadow: 0 18px 45px rgba(56, 74, 88, 0.12);
  --small-shadow: 0 8px 22px rgba(56, 74, 88, 0.1);
  background: var(--sky);
  font-family:
    ui-rounded, "Arial Rounded MT Bold", "Avenir Next Rounded", system-ui,
    -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

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

html {
  min-height: 100%;
  background:
    radial-gradient(circle at 12% 5%, #fff8cf 0 8%, transparent 8.2%),
    linear-gradient(155deg, #e2f5f1 0%, #f0f8ec 50%, #fff5db 100%);
}

body {
  min-width: 280px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  overflow-x: hidden;
}

body.parent-open {
  overflow: hidden;
}

body::before,
body::after {
  position: fixed;
  z-index: -1;
  width: 28rem;
  height: 28rem;
  border-radius: 50%;
  content: "";
  filter: blur(1px);
  opacity: 0.45;
  pointer-events: none;
}

body::before {
  top: -18rem;
  right: -12rem;
  background: #cdebe9;
}

body::after {
  bottom: -20rem;
  left: -10rem;
  background: #fff0c9;
}

button {
  color: inherit;
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a:focus-visible,
button:focus-visible {
  outline: 4px solid #385d76;
  outline-offset: 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.portal-shell {
  width: min(1180px, 100%);
  margin-inline: auto;
  padding: clamp(2rem, 5vw, 4.5rem) clamp(1.25rem, 4vw, 3.5rem) 3rem;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(110px, 0.55fr) minmax(360px, 2fr) minmax(
      90px,
      0.45fr
    );
  align-items: center;
  gap: clamp(1rem, 3vw, 2.5rem);
  margin: 0 auto clamp(2rem, 4vw, 3.5rem);
}

.hero__copy {
  text-align: center;
}

.eyebrow {
  margin: 0 0 0.45rem;
  color: #687e72;
  font-size: clamp(0.74rem, 1.5vw, 0.88rem);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(2.35rem, 5.6vw, 4.9rem);
  font-weight: 900;
  letter-spacing: -0.055em;
  line-height: 0.92;
}

.hero h1 span {
  display: block;
  margin-top: 0.13em;
  color: var(--coral);
  font-size: 0.74em;
  letter-spacing: -0.035em;
}

.hero__intro {
  margin: 1.2rem 0 0;
  color: var(--ink-soft);
  font-size: clamp(1rem, 2vw, 1.2rem);
  font-weight: 650;
}

.hero__mark {
  position: relative;
  width: min(100%, 150px);
  justify-self: end;
}

.hero__mark svg {
  position: relative;
  display: block;
  width: 100%;
  overflow: visible;
  animation: cloud-drift 5.5s ease-in-out infinite;
  fill: var(--paper);
  filter: drop-shadow(0 10px 10px rgba(63, 92, 105, 0.1));
}

.hero__mark svg circle {
  fill: var(--ink);
}

.hero__mark svg path:last-of-type {
  fill: none;
  stroke: var(--ink);
  stroke-linecap: round;
  stroke-width: 3;
}

.hero__sun {
  position: absolute;
  top: -1.15rem;
  left: 1rem;
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  background: var(--sun);
  box-shadow: 0 0 0 10px rgba(245, 201, 106, 0.2);
}

.hero__kite {
  width: min(100%, 110px);
}

.hero__kite svg {
  display: block;
  width: 100%;
  overflow: visible;
  animation: kite-sway 6s ease-in-out infinite;
  fill: #ef8279;
  filter: drop-shadow(0 8px 6px rgba(71, 87, 96, 0.08));
  transform-origin: 50% 0;
}

.hero__kite svg path:not(:first-child) {
  fill: none;
  stroke: var(--ink);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.15rem, 3vw, 2rem);
}

.game-card {
  --card-bg: #ffe4cf;
  --card-accent: var(--coral);
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 29rem;
  flex-direction: column;
  overflow: hidden;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: clamp(1.65rem, 3.5vw, 2.5rem);
  box-shadow: var(--shadow);
  text-decoration: none;
  transform: translateZ(0);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease;
}

.game-card--device {
  --card-bg: #d8f3ed;
  --card-accent: #368f91;
}

.game-card--counting {
  --card-bg: #e2efd1;
  --card-accent: #668457;
}

.game-card--coloring {
  --card-bg: #eee1f5;
  --card-accent: var(--plum);
}

.game-card--shape {
  --card-bg: #fff0c9;
  --card-accent: #d88747;
}

.game-card--friend {
  --card-bg: #dff3ef;
  --card-accent: #3d9894;
}

.game-card--homes {
  --card-bg: #e7e7fa;
  --card-accent: #73835c;
}

.game-card[data-availability="coming-soon"] {
  cursor: default;
}

.card-art {
  position: relative;
  display: grid;
  min-height: 16rem;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 84% 16%, rgba(255, 255, 255, 0.7) 0 5%, transparent 5.4%),
    var(--card-bg);
}

.card-art::after {
  position: absolute;
  right: -5%;
  bottom: -3rem;
  width: 55%;
  height: 5rem;
  border-radius: 50% 0 0;
  background: rgba(255, 255, 255, 0.2);
  content: "";
}

.card-art img {
  position: relative;
  z-index: 1;
  display: block;
  width: min(100%, 430px);
  height: auto;
  object-fit: cover;
}

.card-copy {
  display: flex;
  min-height: 13rem;
  flex: 1;
  flex-direction: column;
  padding: clamp(1.25rem, 3vw, 1.8rem);
}

.card-kicker {
  margin-bottom: 0.35rem;
  color: var(--card-accent);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.card-title {
  font-size: clamp(1.65rem, 3vw, 2.15rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1.02;
}

.card-description {
  max-width: 35rem;
  margin-top: 0.7rem;
  color: var(--ink-soft);
  font-size: clamp(0.94rem, 1.8vw, 1.06rem);
  font-weight: 580;
  line-height: 1.48;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: auto;
  padding-top: 1.25rem;
}

.status-pill {
  display: inline-flex;
  min-height: 2rem;
  align-items: center;
  padding: 0.32rem 0.75rem;
  color: var(--card-accent);
  background: color-mix(in srgb, var(--card-bg) 66%, white);
  border: 1px dashed color-mix(in srgb, var(--card-accent) 45%, white);
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.status-pill--ready {
  color: #fff;
  background: var(--card-accent);
  border-style: solid;
}

.card-arrow {
  display: grid;
  width: 2.55rem;
  height: 2.55rem;
  flex: 0 0 auto;
  place-items: center;
  color: #fff;
  background: var(--card-accent);
  border-radius: 50%;
  font-size: 1.35rem;
  font-weight: 800;
}

[data-availability="coming-soon"] .card-arrow {
  color: var(--card-accent);
  background: var(--card-bg);
  border: 2px solid color-mix(in srgb, var(--card-accent) 45%, white);
}

/* Fruit plane art */
.art-cloud {
  fill: rgba(255, 255, 255, 0.6);
}

.art-cloud--small {
  opacity: 0.65;
}

.plane-body {
  fill: #fffdf5;
  stroke: #34556a;
  stroke-linejoin: round;
  stroke-width: 5;
}

.plane-fold {
  fill: none;
  stroke: #34556a;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.fruit--orange circle {
  fill: #f08b56;
}

.fruit--orange > path:first-of-type,
.fruit--berry > path:first-of-type {
  fill: none;
  stroke: #4d7255;
  stroke-linecap: round;
  stroke-width: 4;
}

.fruit-leaf {
  fill: #70a26d;
}

.fruit--berry circle {
  fill: #cc5976;
}

.sparkles {
  fill: #fff6ca;
}

/* Pretend device art */
.device-shadow {
  fill: rgba(42, 92, 102, 0.1);
}

.device-body {
  fill: #f9cf77;
  stroke: #31586a;
  stroke-width: 5;
}

.device-screen {
  fill: #eefaf5;
  stroke: #31586a;
  stroke-width: 4;
}

.device-sun {
  fill: #f09974;
}

.device-hill--back {
  fill: #a4d6b2;
}

.device-hill {
  fill: #68b7a7;
}

.device-button {
  fill: #ec7d76;
  stroke: #31586a;
  stroke-width: 4;
}

.device-slider,
.device-signal path,
.device-music path {
  fill: none;
  stroke: #31586a;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 5;
}

.device-music circle {
  fill: #9473ad;
}

/* Counting trail art */
.trail-sun {
  fill: #f4c76d;
}

.trail-hill--back {
  fill: #afcf9e;
}

.trail-hill {
  fill: #74aa78;
}

.trail-path {
  fill: none;
  stroke: #f8e8c6;
  stroke-linecap: round;
  stroke-width: 36;
}

.trail-stones {
  fill: #fff7e7;
  stroke: #5b7658;
  stroke-width: 3;
}

.trail-numbers {
  fill: #496751;
  font-size: 17px;
  font-weight: 900;
  text-anchor: middle;
}

.trail-flowers path {
  fill: none;
  stroke: #426d58;
  stroke-linecap: round;
  stroke-width: 4;
}

.trail-flowers circle {
  fill: #f28b83;
}

.trail-butterfly {
  fill: #aa83bf;
  stroke: #5c5676;
  stroke-width: 3;
}

/* Coloring art */
.photo-frame rect:first-child {
  fill: #f9c973;
  stroke: #654d77;
  stroke-width: 5;
}

.photo-frame rect:last-child {
  fill: #fffaf1;
}

.photo-sun {
  fill: #f28b78;
}

.photo-hill--back {
  fill: #b8d9bd;
}

.photo-hill {
  fill: #78baa5;
}

.crayon {
  stroke: #654d77;
  stroke-linejoin: round;
  stroke-width: 4;
}

.crayon--one {
  fill: #ef7475;
}

.crayon--two {
  fill: #6ebac0;
}

.crayon-tip {
  fill: #f5d5af;
  stroke: #654d77;
  stroke-linejoin: round;
  stroke-width: 4;
}

.color-sparkles {
  fill: #9670ae;
}

.footer-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  margin: 2.25rem 0 0;
  color: #70867b;
  font-size: 0.88rem;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.footer-note span {
  color: #fff;
  font-size: 1.25rem;
  filter: drop-shadow(0 2px 3px rgba(53, 83, 93, 0.15));
}

.parent-leaf {
  position: fixed;
  z-index: 20;
  display: grid;
  width: 50px;
  min-width: 50px;
  height: 50px;
  min-height: 50px;
  padding: 7px;
  place-items: center;
  color: #507d66;
  background: rgba(255, 253, 247, 0.65);
  border: 0;
  border-radius: 50%;
  box-shadow: 0 4px 14px rgba(49, 81, 74, 0.08);
  cursor: pointer;
  opacity: 0.42;
  touch-action: none;
  transition:
    opacity 160ms ease,
    transform 160ms ease,
    background 160ms ease;
  user-select: none;
  -webkit-user-select: none;
}

.parent-leaf svg {
  width: 100%;
  fill: #79a982;
  stroke: #406a58;
  stroke-linecap: round;
  stroke-width: 2.2;
}

.parent-leaf--one {
  top: max(0.75rem, env(safe-area-inset-top));
  left: max(0.75rem, env(safe-area-inset-left));
  transform: rotate(-15deg);
}

.parent-leaf--two {
  right: max(0.75rem, env(safe-area-inset-right));
  bottom: max(0.75rem, env(safe-area-inset-bottom));
  transform: rotate(165deg);
}

.parent-leaf.is-held {
  color: #fff;
  background: #d8edcf;
  opacity: 1;
  transform: rotate(0) scale(1.12);
}

.parent-panel {
  width: min(760px, calc(100% - 2rem));
  max-height: min(88vh, 900px);
  max-height: min(88dvh, 900px);
  padding: 0;
  color: var(--ink);
  background: var(--paper);
  border: 0;
  border-radius: 2rem;
  box-shadow: 0 30px 100px rgba(33, 60, 73, 0.3);
}

.parent-panel::backdrop {
  background: rgba(30, 58, 69, 0.58);
  backdrop-filter: blur(7px);
}

.parent-panel__inner {
  padding: clamp(1.4rem, 4vw, 2.5rem);
}

.parent-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.parent-panel h2,
.parent-panel h3,
.parent-panel h4,
.parent-panel p {
  margin-top: 0;
}

.parent-panel h2 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: -0.05em;
}

.parent-panel h3 {
  margin-bottom: 0.6rem;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.parent-panel h4 {
  margin-bottom: 0.35rem;
  color: var(--plum);
  font-size: 0.95rem;
}

.parent-panel p {
  color: var(--ink-soft);
  line-height: 1.55;
}

.close-button {
  display: grid;
  width: 48px;
  min-width: 48px;
  height: 48px;
  min-height: 48px;
  padding: 0;
  place-items: center;
  background: #eef5ef;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.75rem;
  line-height: 1;
}

.parent-section {
  margin-top: 1rem;
  padding: 1.15rem;
  background: #f7f5ed;
  border-radius: 1.25rem;
}

.connection-card {
  background: #e8f4ef;
  border: 1px solid #d1e9df;
}

#offline-status {
  margin-bottom: 0.35rem;
  color: #356653;
  font-weight: 750;
}

.fine-print {
  margin-bottom: 0;
  font-size: 0.87rem;
}

.promise-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.promise-list li {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  font-size: 0.94rem;
  font-weight: 650;
  line-height: 1.4;
}

.promise-list span {
  color: #4f8c68;
  font-weight: 900;
}

.install-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.install-grid article {
  padding: 1rem;
  background: #fffdf8;
  border: 1px solid #ebe4d5;
  border-radius: 1rem;
}

.install-grid p {
  margin-bottom: 0;
  font-size: 0.9rem;
}

.reset-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
}

.reset-card h3 {
  margin-bottom: 0.25rem;
}

.reset-button {
  min-height: 48px;
  padding: 0.75rem 1rem;
  color: #754d4e;
  background: #fff6ef;
  border: 2px solid #e6b6ad;
  border-radius: 0.9rem;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 800;
}

#reset-confirmation {
  grid-column: 1 / -1;
  margin: 0;
  color: #4f735c;
  font-size: 0.87rem;
  font-weight: 700;
}

@keyframes cloud-drift {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-7px);
  }
}

@keyframes kite-sway {
  0%,
  100% {
    transform: rotate(-2deg);
  }
  50% {
    transform: rotate(3deg) translateY(-4px);
  }
}

@media (hover: hover) and (pointer: fine) {
  .game-card:not([data-availability="coming-soon"]):hover {
    box-shadow: 0 24px 55px rgba(56, 74, 88, 0.18);
    transform: translateY(-7px) rotate(-0.3deg);
  }

  .parent-leaf:hover {
    opacity: 0.8;
  }

  .close-button:hover,
  .reset-button:hover {
    filter: brightness(0.97);
  }
}

@media (max-width: 700px) {
  .portal-shell {
    padding: 2.5rem 1rem 4.75rem;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 0;
    margin-bottom: 1.75rem;
  }

  .hero__copy {
    grid-row: 1;
  }

  .hero h1 {
    font-size: clamp(3.25rem, 16vw, 4.8rem);
  }

  .hero__intro {
    max-width: 22rem;
    margin: 1rem auto 0;
  }

  .hero__mark {
    position: absolute;
    top: -1.6rem;
    left: -0.75rem;
    width: 82px;
    opacity: 0.78;
  }

  .hero__sun {
    top: -0.45rem;
    left: 0.2rem;
    width: 3rem;
    height: 3rem;
  }

  .hero__kite {
    display: none;
  }

  .game-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }

  .game-card {
    display: grid;
    min-height: 0;
    grid-template-columns: minmax(118px, 39%) minmax(0, 1fr);
    border-radius: 1.65rem;
  }

  .card-art {
    min-height: 12.5rem;
  }

  .card-art svg {
    width: 145%;
    max-width: none;
  }

  .card-copy {
    min-height: 12.5rem;
    padding: 1.15rem 1rem;
  }

  .card-kicker {
    font-size: 0.65rem;
  }

  .card-title {
    font-size: clamp(1.35rem, 6vw, 1.7rem);
  }

  .card-description {
    margin-top: 0.5rem;
    font-size: 0.86rem;
    line-height: 1.35;
  }

  .card-footer {
    padding-top: 0.75rem;
  }

  .status-pill {
    min-height: 1.75rem;
    padding-inline: 0.58rem;
    font-size: 0.66rem;
  }

  .card-arrow {
    width: 2rem;
    height: 2rem;
    font-size: 1rem;
  }

  .parent-leaf {
    width: 48px;
    min-width: 48px;
    height: 48px;
    min-height: 48px;
  }

  .parent-panel {
    width: calc(100% - 1rem);
    max-height: calc(100dvh - 1rem);
    border-radius: 1.4rem;
  }

  .promise-list,
  .install-grid {
    grid-template-columns: 1fr;
  }

  .reset-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 380px) {
  .game-card {
    grid-template-columns: minmax(102px, 36%) minmax(0, 1fr);
  }

  .card-art svg {
    width: 170%;
  }

  .card-copy {
    padding-inline: 0.85rem;
  }

  .card-description {
    font-size: 0.8rem;
  }
}

@media (orientation: landscape) and (max-height: 540px) {
  .portal-shell {
    padding-top: 1.25rem;
  }

  .hero {
    grid-template-columns: 80px 1fr 70px;
    margin-bottom: 1.25rem;
  }

  .hero__copy {
    grid-row: auto;
  }

  .hero h1 {
    font-size: clamp(2.7rem, 8vw, 4.1rem);
  }

  .hero__intro {
    display: none;
  }

  .hero__mark {
    position: relative;
    top: auto;
    left: auto;
    width: 80px;
  }

  .hero__kite {
    display: block;
    width: 70px;
  }

  .game-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .game-card {
    grid-template-columns: minmax(105px, 35%) minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
