:root {
  color-scheme: light;
  --page-bg: #f5f0eb;
  --page-fg: #3b2e27;
  --muted-fg: #7a6358;
  --line: rgb(100 70 50 / 14%);
  --button-bg: #d97b6c;
  --button-fg: #ffffff;
  --sparkle-color: #c8975a;
  --sparkle-opacity: 0.88;
  --panel-bg: rgb(255 252 248 / 88%);
  --panel-shadow: 0 8px 32px -8px rgb(100 70 50 / 18%);
  --image-bg: #fde8d8;
  --image-highlight: #fff8f2;
  --pixel-ink: #3b2e27;
  --pixel-accent: #d97b6c;
}

:root[data-theme="night"] {
  color-scheme: dark;
  --page-bg: #171311;
  --page-fg: #f4f0eb;
  --muted-fg: #b8aaa0;
  --line: rgb(244 230 218 / 16%);
  --button-bg: #e28a76;
  --button-fg: #21140c;
  --sparkle-color: #ffba66;
  --sparkle-opacity: 0.82;
  --panel-bg: rgb(39 32 29 / 92%);
  --panel-shadow: 0 12px 40px rgb(0 0 0 / 38%);
  --image-bg: #49372e;
  --image-highlight: #5a4438;
  --pixel-ink: #f4f0eb;
  --pixel-accent: #e28a76;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 280px;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  display: grid;
  place-items: center;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse at 20% 10%, rgb(251 213 193 / 40%), transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgb(210 195 220 / 30%), transparent 50%),
    var(--page-bg);
  color: var(--page-fg);
  font-family: "Plus Jakarta Sans", sans-serif;
  transition:
    background-color 700ms ease,
    color 700ms ease;
}

.sparkle-field {
  position: fixed;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.sparkle {
  position: absolute;
  width: 18px;
  aspect-ratio: 1;
  background: var(--sparkle-color);
  clip-path: polygon(
    50% 0,
    61% 39%,
    100% 50%,
    61% 61%,
    50% 100%,
    39% 61%,
    0 50%,
    39% 39%
  );
  opacity: var(--sparkle-opacity);
  filter: drop-shadow(0 0 7px var(--sparkle-color));
  animation: twinkle 3.8s ease-in-out infinite alternate;
}

.sparkle:nth-child(1) {
  top: 14%;
  left: 17%;
  animation-delay: -1.5s;
}
.sparkle:nth-child(2) {
  top: 24%;
  left: 78%;
  width: 16px;
  animation-delay: -4s;
}
.sparkle:nth-child(3) {
  top: 72%;
  left: 12%;
  width: 15px;
  animation-delay: -2.5s;
}
.sparkle:nth-child(4) {
  top: 81%;
  left: 84%;
  animation-delay: -3s;
}
.sparkle:nth-child(5) {
  top: 46%;
  left: 91%;
  width: 15px;
  animation-delay: -1s;
}
.sparkle:nth-child(6) {
  top: 89%;
  left: 48%;
  width: 16px;
  animation-delay: -4.5s;
}
.sparkle:nth-child(7) {
  top: 9%;
  left: 57%;
  width: 15px;
  animation-delay: -2s;
}
.sparkle:nth-child(8) {
  top: 58%;
  left: 6%;
  width: 16px;
  animation-delay: -3.5s;
}
.sparkle:nth-child(9) {
  top: 38%;
  left: 96%;
  width: 20px;
  animation-delay: -2.8s;
}
.sparkle:nth-child(10) {
  top: 36%;
  left: 2%;
  width: 17px;
  animation-delay: -1.8s;
}
.sparkle:nth-child(11) {
  top: 94%;
  left: 75%;
  width: 19px;
  animation-delay: -3.3s;
}
.sparkle:nth-child(12) {
  top: 4%;
  left: 34%;
  width: 16px;
  animation-delay: -0.6s;
}

.welcome,
.about-content {
  position: relative;
  z-index: 1;
  width: min(100% - 36px, 680px);
  text-align: center;
}

.welcome {
  width: min(100% - 36px, 600px);
  padding: clamp(36px, 7vw, 58px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel-bg);
  box-shadow: var(--panel-shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.welcome-cat-frame {
  position: relative;
  isolation: isolate;
  width: min(100%, 248px, 34svh);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  margin: 0 auto;
  padding: 10px;
  border: 4px solid transparent;
  border-radius: 50%;
  background:
    linear-gradient(var(--image-bg), var(--image-bg)) padding-box,
    linear-gradient(135deg, #fde8d8, var(--pixel-accent) 52%, #c9684d) border-box;
  box-shadow:
    0 8px 24px rgb(100 70 50 / 14%),
    inset 0 0 0 3px rgb(255 255 255 / 28%);
}

.welcome-cat-frame::before {
  position: absolute;
  z-index: -1;
  inset: -9px;
  border: 1px solid var(--line);
  border-radius: 50%;
  content: "";
}

.welcome-ball {
  position: absolute;
  z-index: 2;
  width: 18px;
  aspect-ratio: 1;
  padding: 0;
  border: 3px solid var(--panel-bg);
  border-radius: 50%;
  background: var(--pixel-accent);
  box-shadow: 0 2px 8px rgb(100 70 50 / 18%);
  cursor: pointer;
  offset-path: circle(46% at 50% 50%);
  offset-distance: var(--ball-position, 12%);
  offset-rotate: 0deg;
}

.welcome-ball::before {
  position: absolute;
  inset: -10px;
  content: "";
}

.welcome-cat {
  position: relative;
  z-index: 1;
  display: block;
  width: 86%;
  max-height: 86%;
  object-fit: contain;
  filter: drop-shadow(0 8px 14px rgb(65 40 25 / 12%));
}

.welcome-copy {
  margin-top: 34px;
}

.welcome-copy h1 {
  margin: 0;
  color: var(--page-fg);
  font-size: clamp(1.6rem, 5vw, 2.15rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.2;
}

.welcome-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 30px;
}

.action-link {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--page-fg);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease;
}

.action-link:hover {
  transform: translateY(-2px);
}

.action-primary {
  background: var(--button-bg);
  color: var(--button-fg);
  box-shadow: 0 4px 16px rgb(100 70 50 / 14%);
}

.action-primary:hover {
  background: #c9684d;
  box-shadow: 0 8px 22px rgb(100 70 50 / 20%);
}

.action-secondary {
  border-color: var(--line);
  background: var(--panel-bg);
}

.action-secondary:hover {
  border-color: var(--pixel-accent);
  background: rgb(217 123 108 / 7%);
}

.action-link:focus-visible,
.profile-link:focus-visible,
.home-link:focus-visible {
  outline: 3px solid var(--sparkle-color);
  outline-offset: 4px;
}

.about-content {
  max-width: 570px;
}

.about-content h1 {
  margin: 0 0 18px;
  font-size: 2.2rem;
  font-weight: 600;
  line-height: 1.2;
}

.about-content p {
  max-width: 490px;
  margin: 0 auto 25px;
  color: var(--muted-fg);
  font-size: 1.05rem;
  line-height: 1.8;
}

.profile-link,
.home-link {
  display: block;
  width: fit-content;
  margin: 0 auto;
  color: var(--page-fg);
  font-weight: 600;
  text-underline-offset: 5px;
}

.profile-link span {
  color: var(--sparkle-color);
}

.home-link {
  margin-top: 28px;
  color: var(--muted-fg);
  font-size: 0.9rem;
  font-weight: 500;
}

@media (max-width: 480px) {
  .welcome {
    padding: 32px 24px;
    border-radius: 20px;
  }

  .welcome-cat-frame {
    width: min(100%, 216px, 30svh);
  }

  .welcome-copy {
    margin-top: 30px;
  }

  .welcome-actions {
    margin-top: 26px;
  }
}

@keyframes twinkle {
  from {
    opacity: 0.5;
    transform: rotate(0deg) scale(0.72);
  }
  to {
    opacity: var(--sparkle-opacity);
    transform: rotate(35deg) scale(1.08);
  }
}

@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;
  }
}
