:root {
  --ink: #181223;
  --paper: #fff8e7;
  --shell: #ffcf3d;
  --shell-dark: #f0932b;
  --blue: #2d6cff;
  --cyan: #4ee3ff;
  --rose: #ff4f87;
  --mint: #51d88a;
  --violet: #8b5cff;
  --screen: #bdf7ff;
  --screen-deep: #8ce5f6;
  --shadow: rgba(54, 32, 10, 0.22);
  --radius-large: 28px;
  --radius-mid: 18px;
  --radius-small: 12px;
  font-family:
    ui-rounded,
    "SF Pro Rounded",
    "Nunito",
    "Avenir Next",
    system-ui,
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.6) 0 25%, transparent 25% 50%, rgba(255, 255, 255, 0.35) 50% 75%, transparent 75%) 0 0 / 34px 34px,
    linear-gradient(160deg, #ffe66f 0%, #ff8fb2 42%, #68dcff 100%);
}

button {
  border: 0;
  color: inherit;
  font: inherit;
}

.app-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 14px;
}

.device {
  width: min(100%, 430px);
  min-height: min(820px, calc(100dvh - 28px));
  display: grid;
  grid-template-rows: auto auto minmax(224px, 0.72fr) auto auto;
  gap: 10px;
  padding: 15px;
  border: 4px solid var(--ink);
  border-radius: 36px;
  background:
    radial-gradient(circle at 15% 12%, rgba(255, 255, 255, 0.72) 0 9%, transparent 10%),
    radial-gradient(circle at 88% 8%, rgba(255, 255, 255, 0.55) 0 7%, transparent 8%),
    var(--shell);
  box-shadow:
    0 22px 0 rgba(70, 32, 12, 0.18),
    0 30px 50px var(--shadow);
  position: relative;
  overflow: hidden;
}

.device::before,
.device::after {
  content: "";
  position: absolute;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: #fff3a6;
  opacity: 0.65;
}

.device::before {
  width: 86px;
  height: 22px;
  left: -24px;
  top: 132px;
  rotate: -28deg;
}

.device::after {
  width: 104px;
  height: 24px;
  right: -34px;
  bottom: 210px;
  rotate: 26deg;
}

.top-bar,
.status-strip,
.bottom-dock {
  position: relative;
  z-index: 2;
}

.top-bar {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  gap: 10px;
}

.brand-lockup {
  text-align: center;
  min-width: 0;
}

.brand-kicker,
.stat-label,
.dock-label {
  display: block;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 8vw, 36px);
  line-height: 0.95;
  letter-spacing: 0;
  text-shadow: 2px 2px 0 #fff;
}

.crown-row {
  min-height: 18px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3px;
  margin-top: 5px;
  padding-inline: 4px;
}

.crown {
  width: 18px;
  height: 15px;
  display: inline-block;
  border: 2px solid var(--ink);
  border-top: 0;
  border-radius: 0 0 5px 5px;
  background: linear-gradient(180deg, #fff28a 0%, #ffcf3d 62%, #f0932b 100%);
  box-shadow: 0 2px 0 var(--ink);
  clip-path: polygon(0 36%, 20% 5%, 40% 36%, 50% 0, 62% 36%, 82% 5%, 100% 36%, 100% 100%, 0 100%);
}

.icon-button,
.primary-action {
  min-height: 46px;
  border: 3px solid var(--ink);
  border-radius: var(--radius-mid);
  background: #fff;
  box-shadow: 0 5px 0 var(--ink);
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.icon-button {
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 900;
}

.icon-button:active,
.primary-action:active,
.task-card:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--ink);
}

.status-strip {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}

.stat-chip {
  min-width: 64px;
  padding: 8px 10px;
  border: 3px solid var(--ink);
  border-radius: var(--radius-small);
  background: #fff;
  text-align: center;
  box-shadow: 0 4px 0 var(--ink);
}

.stat-chip strong {
  display: block;
  font-size: 18px;
  line-height: 1;
}

.xp-track {
  height: 21px;
  padding: 3px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  overflow: hidden;
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.12);
}

.xp-fill {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: repeating-linear-gradient(135deg, var(--rose) 0 10px, var(--violet) 10px 20px, var(--cyan) 20px 30px);
  transition: width 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.screen {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 224px;
  padding: 12px;
  border: 4px solid var(--ink);
  border-radius: var(--radius-large);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), transparent 28%),
    linear-gradient(180deg, var(--screen), var(--screen-deep));
  box-shadow: inset 0 -8px 0 rgba(12, 87, 130, 0.18), 0 7px 0 var(--ink);
  overflow: hidden;
}

.pixel-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(21, 35, 80, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(21, 35, 80, 0.09) 1px, transparent 1px);
  background-size: 18px 18px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.1));
}

.mood-card {
  position: relative;
  z-index: 3;
  width: fit-content;
  max-width: 78%;
  padding: 7px 10px;
  border: 3px solid var(--ink);
  border-radius: var(--radius-small);
  background: #fff;
  box-shadow: 0 4px 0 var(--ink);
}

.mood-label {
  display: block;
  font-size: 12px;
  font-weight: 900;
}

.mood-copy {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 800;
}

.pet-stage {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  align-self: center;
  min-height: 155px;
}

.aura {
  position: absolute;
  width: 146px;
  aspect-ratio: 1;
  border: 4px dashed rgba(45, 108, 255, 0.42);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.12) 62%, transparent 63%);
  animation: orbit 8s linear infinite;
}

.pet-avatar {
  position: relative;
  width: min(58vw, 212px);
  max-height: 190px;
  object-fit: contain;
  filter: drop-shadow(0 10px 0 rgba(19, 16, 42, 0.18));
  transform-origin: 50% 70%;
  animation: idle-bob 2.6s ease-in-out infinite;
}

.pet-avatar.happy {
  animation: happy-hop 560ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.pet-avatar.super {
  animation: super-hop 900ms cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.level-burst {
  position: absolute;
  top: 18%;
  right: 2%;
  padding: 8px 11px;
  border: 3px solid var(--ink);
  border-radius: var(--radius-small);
  background: var(--rose);
  color: #fff;
  font-size: 13px;
  font-weight: 1000;
  letter-spacing: 0.04em;
  opacity: 0;
  transform: rotate(9deg) scale(0.4);
  text-shadow: 1px 1px 0 var(--ink);
}

.level-burst.show {
  animation: burst 900ms ease both;
}

.task-panel {
  position: relative;
  z-index: 2;
  padding: 13px;
  border: 4px solid var(--ink);
  border-radius: var(--radius-large);
  background: #fffdf6;
  box-shadow: 0 7px 0 var(--ink);
}

.panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.panel-heading h2 {
  font-size: 20px;
  line-height: 1;
}

.panel-heading span {
  font-size: 11px;
  font-weight: 900;
  color: rgba(24, 18, 35, 0.64);
}

.task-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.task-card {
  position: relative;
  display: grid;
  gap: 4px;
  justify-items: center;
  min-height: 82px;
  padding: 7px 4px 6px;
  border: 3px solid var(--ink);
  border-radius: var(--radius-mid);
  background: var(--task-bg, #fff);
  box-shadow: 0 5px 0 var(--ink);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.task-card.done {
  filter: saturate(1.08);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0)),
    var(--task-bg, #fff);
}

.task-card.done::after {
  content: "OK";
  position: absolute;
  top: -7px;
  right: -7px;
  padding: 3px 5px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--mint);
  font-size: 9px;
  font-weight: 1000;
}

.task-toy {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.9) 0 13%, transparent 14%),
    var(--toy, #fff);
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.13);
  color: #fff;
  font-size: 16px;
  font-weight: 1000;
  line-height: 1;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.28);
}

.toy-glyph {
  position: relative;
  display: block;
  width: 25px;
  height: 25px;
  scale: 0.84;
}

.toy-glyph::before,
.toy-glyph::after {
  content: "";
  position: absolute;
  display: block;
}

.toy-glyph.english {
  border: 3px solid #fff;
  border-radius: 6px;
}

.toy-glyph.english::before {
  width: 15px;
  height: 3px;
  left: 3px;
  top: 6px;
  background: #fff;
  box-shadow: 0 7px 0 #fff;
}

.toy-glyph.english::after {
  width: 7px;
  height: 7px;
  right: -6px;
  top: -7px;
  border: 3px solid #fff;
  border-left: 0;
  border-bottom: 0;
  rotate: 15deg;
}

.toy-glyph.move {
  border-left: 5px solid #fff;
  border-bottom: 5px solid #fff;
  border-radius: 0 0 0 12px;
  rotate: -18deg;
}

.toy-glyph.move::before {
  width: 11px;
  height: 11px;
  right: -1px;
  top: -2px;
  border-radius: 50%;
  background: #fff;
}

.toy-glyph.move::after {
  width: 19px;
  height: 5px;
  left: 5px;
  top: 12px;
  border-radius: 999px;
  background: #fff;
  rotate: 32deg;
}

.toy-glyph.commute {
  width: 27px;
  height: 18px;
  margin-top: 3px;
  border: 3px solid #fff;
  border-radius: 8px 8px 5px 5px;
}

.toy-glyph.commute::before {
  width: 4px;
  height: 4px;
  left: 3px;
  bottom: -8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 14px 0 0 #fff;
}

.toy-glyph.commute::after {
  width: 15px;
  height: 3px;
  left: 3px;
  top: 5px;
  background: #fff;
}

.toy-glyph.video {
  width: 28px;
  height: 20px;
  margin-top: 2px;
  border: 3px solid #fff;
  border-radius: 7px;
}

.toy-glyph.video::before {
  width: 0;
  height: 0;
  left: 8px;
  top: 4px;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 9px solid #fff;
}

.toy-glyph.book {
  width: 26px;
  height: 23px;
  border-left: 4px solid #fff;
  border-right: 4px solid #fff;
  border-bottom: 4px solid #fff;
  border-radius: 2px 2px 7px 7px;
}

.toy-glyph.book::before {
  width: 4px;
  height: 22px;
  left: 9px;
  top: 1px;
  background: #fff;
}

.toy-glyph.book::after {
  width: 27px;
  height: 4px;
  left: -4px;
  top: 0;
  background: #fff;
  border-radius: 999px;
}

.toy-glyph.art {
  width: 25px;
  height: 25px;
  border: 4px solid #fff;
  border-radius: 7px;
  rotate: 45deg;
}

.toy-glyph.art::before {
  width: 9px;
  height: 9px;
  left: 4px;
  top: 4px;
  border-radius: 3px;
  background: #fff;
}

.toy-glyph.skill {
  width: 26px;
  height: 18px;
  margin-top: 3px;
  border: 3px solid #fff;
  border-radius: 6px;
}

.toy-glyph.skill::before {
  width: 6px;
  height: 6px;
  left: 7px;
  top: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 8px 0 0 #fff;
}

.toy-glyph.skill::after {
  width: 16px;
  height: 4px;
  left: 3px;
  bottom: -7px;
  background: #fff;
  border-radius: 999px;
}

.toy-glyph.vault {
  clip-path: polygon(50% 0, 62% 34%, 100% 50%, 62% 66%, 50% 100%, 38% 66%, 0 50%, 38% 34%);
  background: #fff;
}

.toy-glyph.idea {
  width: 22px;
  height: 22px;
  border: 4px solid #fff;
  border-radius: 50%;
}

.toy-glyph.idea::before {
  width: 8px;
  height: 8px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #fff;
}

.toy-glyph.idea::after {
  width: 12px;
  height: 5px;
  left: 3px;
  bottom: -7px;
  border-radius: 999px;
  background: #fff;
}

.toy-glyph.cut {
  width: 26px;
  height: 18px;
  border: 3px solid #fff;
  border-radius: 5px;
}

.toy-glyph.cut::before {
  width: 21px;
  height: 3px;
  left: 0;
  top: 6px;
  background: #fff;
  rotate: -24deg;
}

.toy-glyph.cut::after {
  width: 6px;
  height: 6px;
  right: -3px;
  bottom: -4px;
  border: 3px solid #fff;
  border-radius: 50%;
}

.toy-glyph.review {
  width: 23px;
  height: 23px;
  border: 4px solid #fff;
  border-radius: 50%;
}

.toy-glyph.review::before {
  width: 12px;
  height: 4px;
  left: 4px;
  top: 5px;
  background: #fff;
  box-shadow: 0 7px 0 #fff;
}

.toy-glyph.review::after {
  width: 8px;
  height: 4px;
  right: -6px;
  bottom: 0;
  background: #fff;
  rotate: 45deg;
}

.toy-glyph.sleep {
  width: 26px;
  height: 21px;
  border-bottom: 5px solid #fff;
  border-radius: 0 0 14px 14px;
}

.toy-glyph.sleep::before {
  width: 16px;
  height: 16px;
  right: 2px;
  top: 0;
  border-radius: 50%;
  box-shadow: -6px 0 0 #fff;
}

.toy-glyph.sleep::after {
  width: 5px;
  height: 5px;
  left: 3px;
  top: 1px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 8px 2px 0 #fff;
}

.task-title {
  font-size: 10px;
  font-weight: 1000;
  line-height: 1.05;
  text-align: center;
  max-width: 4.6em;
}

.task-time {
  font-size: 8px;
  font-weight: 900;
  color: rgba(24, 18, 35, 0.68);
}

.bottom-dock {
  display: block;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 4px solid var(--ink);
  border-radius: var(--radius-large);
  background: #fff;
  box-shadow: 0 7px 0 var(--ink);
}

.bottom-dock p {
  margin-top: 3px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.25;
}

.spark {
  position: absolute;
  z-index: 4;
  width: 12px;
  height: 12px;
  background: #fff;
  clip-path: polygon(50% 0, 62% 36%, 100% 50%, 62% 64%, 50% 100%, 38% 64%, 0 50%, 38% 36%);
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.9));
  animation: sparkle 800ms ease-out forwards;
}

.feeding-chip {
  position: fixed;
  z-index: 20;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 5px 0 var(--ink);
  animation: feed-flight 620ms cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

@keyframes idle-bob {
  0%,
  100% {
    transform: translateY(0) rotate(-1deg);
  }

  50% {
    transform: translateY(-8px) rotate(1.5deg);
  }
}

@keyframes happy-hop {
  0% {
    transform: translateY(0) scale(1);
  }

  35% {
    transform: translateY(-22px) scale(1.04) rotate(-4deg);
  }

  70% {
    transform: translateY(4px) scale(0.98) rotate(3deg);
  }

  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes super-hop {
  0% {
    transform: translateY(0) scale(1);
    filter: drop-shadow(0 10px 0 rgba(19, 16, 42, 0.18));
  }

  42% {
    transform: translateY(-30px) scale(1.08) rotate(-5deg);
    filter: drop-shadow(0 0 26px rgba(255, 255, 255, 0.95));
  }

  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes orbit {
  to {
    transform: rotate(360deg);
  }
}

@keyframes sparkle {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.4) rotate(0);
  }

  24% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate(var(--dx), var(--dy)) scale(1.4) rotate(180deg);
  }
}

@keyframes burst {
  0% {
    opacity: 0;
    transform: rotate(9deg) scale(0.4);
  }

  25% {
    opacity: 1;
    transform: rotate(-8deg) scale(1.1);
  }

  70% {
    opacity: 1;
    transform: rotate(5deg) scale(1);
  }

  100% {
    opacity: 0;
    transform: rotate(9deg) scale(0.8);
  }
}

@keyframes feed-flight {
  0% {
    opacity: 1;
    transform: translate(0, 0) rotate(-8deg) scale(1);
  }

  100% {
    opacity: 0;
    transform: translate(var(--tx), var(--ty)) rotate(18deg) scale(0.35);
  }
}

@media (max-width: 370px) {
  .device {
    padding: 11px;
    gap: 8px;
    border-radius: 28px;
  }

  .task-grid {
    gap: 6px;
  }

  .task-card {
    min-height: 78px;
    padding-inline: 3px;
  }

  .task-toy {
    width: 33px;
    height: 33px;
  }

  .task-title {
    font-size: 11px;
  }
}

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