/* My Tama extras: diary, planet levels, missions, evolution celebration, stage timer, Tama clock, hero sky, petting */

/* Rough stage timer */
.stage-time {
  margin-top: 8px;
}
.stage-track {
  height: 7px;
  border-radius: 7px;
  background: #e6ebe4;
  overflow: hidden;
}
.stage-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f0cf58, #e2a23a);
}
.stage-time small {
  display: block;
  margin-top: 3px;
  font-size: 0.8rem;
  color: var(--muted);
}

/* Planet panel */
.planet-globe {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, #c7f0a4 0 22%, transparent 23%),
    radial-gradient(circle at 68% 62%, #c7f0a4 0 18%, transparent 19%),
    linear-gradient(140deg, #6ec5e8, #3b8fc4);
  box-shadow: inset -3px -3px 0 rgb(0 0 0 / 0.12);
}
.planet-next {
  margin: 8px 0 10px;
  font-size: 0.95rem;
}
.level-ladder {
  display: grid;
  gap: 8px;
  margin: 12px 0;
  padding: 0;
  list-style: none;
}
.level-ladder > li {
  display: flex;
  gap: 11px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.level-ladder > li.done {
  background: #f1f8ee;
  border-color: #b9d8b4;
}
.level-ladder > li.next {
  border: 2px solid #e2a23a;
  background: #fffaea;
}
.level-num {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #e6ebe4;
  font: 800 1.05rem var(--title);
  color: var(--ink);
}
.done .level-num {
  background: #79c3a9;
  color: #0e3a2c;
}
.next .level-num {
  background: #f0cf58;
  color: #4a3600;
}
.level-ladder strong {
  display: block;
  line-height: 1.25;
}
.level-check {
  margin-left: 4px;
  font-size: 0.74rem;
  font-weight: 700;
  color: #246254;
  white-space: nowrap;
}
.next .level-check {
  color: #7a5b00;
}
.level-ladder ul {
  margin: 4px 0 0;
  padding-left: 18px;
  font-size: 0.9rem;
  color: var(--muted);
}
.level-ladder p {
  margin: 4px 0 0;
  font-size: 0.86rem;
}

/* Missions */
.mission-count {
  margin: 4px 0;
  color: var(--muted);
}
.mission-count b {
  font: 800 1.5rem var(--title);
  color: var(--ink);
}
.mission-list {
  display: grid;
  gap: 6px;
  margin: 12px 0;
  padding: 0;
  list-style: none;
}
.mission-list label {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-height: 48px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
}
.mission-list input {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 2px 0 0;
  accent-color: #2f7d62;
}
.mission-list label:has(input:checked) {
  background: #f1f8ee;
  border-color: #b9d8b4;
}
.mission-list strong {
  display: block;
  line-height: 1.25;
}
.mission-list strong b {
  margin-left: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #fff1c7;
  font-size: 0.8rem;
  color: #6b4b00;
  white-space: nowrap;
}
.mission-list small {
  display: block;
  margin-top: 2px;
  font-size: 0.84rem;
  color: var(--muted);
}

/* Generations diary */
.family-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin: 10px 0;
  padding: 0;
  list-style: none;
}
.family-line li {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #eef3ea;
}
.family-line li + li::before {
  content: '→';
  position: absolute;
  left: -17px;
  color: var(--muted);
}
.family-line img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  image-rendering: pixelated;
}
.diary {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.diary li {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.diary-art {
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: none;
  cursor: pointer;
}
.diary-art .portrait {
  width: 52px;
  height: 52px;
}
.diary li > div {
  flex: 1;
  min-width: 0;
}
.diary small,
.diary span {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
}
.diary strong {
  display: block;
  font: 750 1.05rem/1.2 var(--title);
}

/* Evolution celebration */
.evo {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgb(18 44 40 / 0.6);
  animation: evo-fade 0.25s ease-out;
}
html[data-theme='dark'] .evo {
  background: rgb(7 19 14 / 0.55);
}
.evo-card {
  width: min(380px, 100%);
  padding: 18px 20px 20px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 18px 50px rgb(0 0 0 / 0.3);
  text-align: center;
  animation: evo-pop 0.45s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.evo-stage {
  position: relative;
  display: grid;
  place-items: center;
  height: 190px;
  margin-bottom: 12px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--tile);
}
.evo-stage img {
  grid-area: 1/1;
  position: relative;
  width: 128px;
  height: 128px;
  object-fit: contain;
  image-rendering: pixelated;
}
.evo-from {
  animation: evo-out 1s ease-in forwards;
}
.evo-to {
  animation: evo-in 0.7s 0.9s both cubic-bezier(0.3, 1.5, 0.5, 1);
}
.evo-card h2 {
  margin: 2px 0 6px;
  font-size: 1.9rem;
}
.evo-card p {
  margin: 0 0 10px;
}
.evo-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid #e3c25a;
  border-radius: 12px;
  background: #fff8df;
}
.evo-badge .badge-icon {
  background: linear-gradient(145deg, #ffd96a, #f0a93b);
  color: #5b3a05;
}
.evo-card .primary {
  min-width: 140px;
}
@keyframes evo-fade {
  from {
    opacity: 0;
  }
}
@keyframes evo-pop {
  from {
    transform: scale(0.85);
    opacity: 0;
  }
}
@keyframes evo-out {
  0% {
    transform: scale(1);
    opacity: 1;
    filter: none;
  }
  70% {
    transform: scale(1.15);
    opacity: 1;
    filter: brightness(0) invert(1);
  }
  100% {
    transform: scale(0.6);
    opacity: 0;
    filter: brightness(0) invert(1);
  }
}
@keyframes evo-in {
  from {
    transform: scale(0.4);
    opacity: 0;
  }
}

/* Tama clock row on the home card */
.tama-time-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.88rem;
  text-decoration: none;
}
.tama-time-row:hover {
  background: #f3f7ef;
}
.tama-time-row b {
  margin-right: 4px;
}
.sky-dot {
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f6c343;
  box-shadow: 0 0 0 3px #f6c34333;
}
.phase-morning .sky-dot {
  background: linear-gradient(#ffb36b 50%, #f6c343 50%);
}
.phase-evening .sky-dot {
  background: #f08a5d;
  box-shadow: 0 0 0 3px #f08a5d33;
}
.phase-night .sky-dot {
  background: #dfe6f5;
  box-shadow:
    inset -6px 0 0 #6d7fb3,
    0 0 0 3px #6d7fb333;
}

/* Home hero: night, shooting stars, December snow */
.hero-sky {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}
.flake {
  position: absolute;
  top: -12px;
  left: var(--x);
  width: var(--w);
  height: var(--w);
  border-radius: 50%;
  background: #fff;
  opacity: 0.75;
  animation: snow-fall var(--d) linear infinite;
  animation-delay: var(--o);
}
@keyframes snow-fall {
  to {
    transform: translate(26px, 330px);
  }
}
.shoot {
  position: absolute;
  top: 12%;
  left: 62%;
  width: 90px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, #fff, transparent);
  opacity: 0;
  transform: rotate(-28deg);
  animation: shoot 7s ease-in infinite;
}
.shoot.late {
  top: 30%;
  left: 82%;
  animation-delay: 3.4s;
}
@keyframes shoot {
  0%,
  78% {
    opacity: 0;
    transform: translate(0, 0) rotate(-28deg);
  }
  82% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-190px, 100px) rotate(-28deg);
  }
}
.moon {
  position: absolute;
  top: 14px;
  right: 18px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  box-shadow: inset -9px 3px 0 #fdf3b4;
}
.zzz {
  position: absolute;
  top: 20px;
  right: 58px;
  font: 800 0.9rem var(--title);
  color: #fdf3b4;
  animation: zzz 3s ease-in-out infinite;
}
.zzz b {
  font-size: 1.15em;
  margin-left: 2px;
}
.zzz b + b {
  font-size: 1.35em;
}
@keyframes zzz {
  50% {
    transform: translateY(-4px);
    opacity: 0.6;
  }
}

/* Petting */
.pet-spot {
  position: relative;
  cursor: pointer;
}
.pet-spot.petted img {
  animation: pet-hop 0.45s ease-out;
}
@keyframes pet-hop {
  40% {
    transform: translateY(-12px) scale(1.06, 0.96);
  }
  70% {
    transform: translateY(0) scale(0.96, 1.05);
  }
}
.pet-heart {
  position: absolute;
  top: 2px;
  right: 6px;
  font-style: normal;
  font-size: 1.2rem;
  color: #e85d7a;
  pointer-events: none;
  animation: pet-heart 0.9s ease-out forwards;
}
@keyframes pet-heart {
  to {
    transform: translateY(-34px) scale(1.5);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .evo,
  .evo-card,
  .evo-from,
  .evo-to,
  .flake,
  .shoot,
  .zzz,
  .pet-spot.petted img,
  .pet-heart {
    animation: none !important;
  }
  .evo-from,
  .flake,
  .shoot {
    display: none;
  }
}
@media print {
  .planet-panel .tama-row,
  .hero-sky,
  .evo,
  .tama-time-row {
    display: none !important;
  }
}
