* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: radial-gradient(circle at 20% 20%, #1d223f, #0a0c17 65%);
  color: #eef1ff;
  overflow-x: hidden;
}

/* ── Stars ── */
.stars-container { position: fixed; inset: 0; pointer-events: none; z-index: 0; }

.star {
  position: absolute;
  background: white;
  border-radius: 50%;
  animation: twinkle linear infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.15; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.4); }
}

/* ── Moon ── */
.moon {
  position: fixed;
  right: 40px;
  top: 30px;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff7cf 0%, #f2d77f 70%, #9e8748 100%);
  box-shadow: 0 0 40px rgba(255, 225, 132, 0.5);
  z-index: 0;
}

/* ── Loading screen ── */
.loading-screen {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 18, 0.9);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.loading-cat { font-size: 64px; animation: loadBounce 1s ease-in-out infinite; }
.loading-screen p { color: #b7c0ff; font-size: 1.1rem; }

.loading-dots { display: flex; gap: 6px; }
.loading-dots span {
  width: 8px; height: 8px;
  background: #8f8aff;
  border-radius: 50%;
  animation: dotPulse 1.2s ease-in-out infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes loadBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@keyframes dotPulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ── Registration modal ── */
.reg-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 6, 18, 0.85);
  backdrop-filter: blur(6px);
}

.reg-box {
  background: #14182c;
  border: 1px solid #5040a0;
  border-radius: 20px;
  padding: 40px 32px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 0 60px rgba(100, 80, 200, 0.3);
  animation: popIn 0.3s ease;
}

.reg-cat { font-size: 56px; margin-bottom: 12px; }
.reg-box h2 { margin-bottom: 8px; font-size: 1.5rem; }
.reg-box > p { color: #b7c0ff; margin-bottom: 20px; }

.reg-box input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid #5040a0;
  background: #0e1022;
  color: #eef1ff;
  font-size: 1rem;
  margin-bottom: 16px;
  text-align: center;
}

.reg-note { font-size: 12px; color: #6a6f99; margin-top: 12px; }

/* ── Skin picker ── */
.skin-picker {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.skin-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  border-radius: 12px;
  padding: 8px;
  border: 2px solid transparent;
  transition: border-color 0.2s, transform 0.1s;
}

.skin-opt svg { width: 52px; height: 52px; border-radius: 50%; }
.skin-opt span { font-size: 11px; color: #9fb1ff; }
.skin-opt:hover { transform: scale(1.08); border-color: #5040a0; }
.skin-opt.selected { border-color: #8f8aff; background: rgba(143,138,255,0.1); }

/* ── App layout ── */
.app {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 16px 60px;
  position: relative;
  z-index: 1;
}

h1 { text-align: center; font-size: 2.4rem; letter-spacing: 2px; }
.subtitle { text-align: center; margin-top: 8px; color: #b7c0ff; font-size: 0.95rem; }

/* ── Panel ── */
.panel { display: flex; flex-direction: column; gap: 8px; align-items: center; margin: 16px 0 20px; }

.primary {
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  background: linear-gradient(90deg, #8f8aff, #3ec3ff);
  color: #11142a;
  padding: 12px 28px;
  font-size: 1rem;
  transition: opacity 0.2s, transform 0.1s;
}
.primary:hover { opacity: 0.85; transform: translateY(-1px); }
.primary:disabled { opacity: 0.4; cursor: default; transform: none; }

.wallet { font-size: 13px; color: #9be1ff; }
.wallet.cursed { color: #ff6d6d; font-weight: 700; }

.curse-icon { cursor: help; position: relative; }
.curse-icon:hover::after {
  content: attr(title);
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);
  background: #1a0a0a;
  border: 1px solid #ff4444;
  color: #ffcccc;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 999;
  pointer-events: none;
}

/* ── Sick banner ── */
.sick-banner {
  background: linear-gradient(90deg, #3a0000, #5a0000);
  border: 1px solid #ff4444;
  border-radius: 10px;
  padding: 10px 16px;
  text-align: center;
  color: #ffaaaa;
  font-weight: 600;
  margin-bottom: 12px;
  animation: sickPulse 2s ease-in-out infinite;
}

@keyframes sickPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(255,68,68,0.3); }
  50% { box-shadow: 0 0 20px rgba(255,68,68,0.6); }
}

/* ── Pet card ── */
.pet-card {
  background: #14182c;
  border: 1px solid #303861;
  border-radius: 18px;
  padding: 24px 18px 18px;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: border-color 0.4s, box-shadow 0.4s;
}

.pet-card.state-happy { border-color: #7dff76; box-shadow: 0 0 24px rgba(125,255,118,0.1); }
.pet-card.state-tired { border-color: #ffd84a; box-shadow: 0 0 24px rgba(255,216,74,0.1); }
.pet-card.state-exhausted { border-color: #ff6b35; box-shadow: 0 0 24px rgba(255,107,53,0.15); }
.pet-card.state-ghost { border-color: #4d9fff; box-shadow: 0 0 30px rgba(77,159,255,0.25); background: #0d1425; }
.pet-card.state-sick { border-color: #ff4444; box-shadow: 0 0 24px rgba(255,68,68,0.2); }

/* ── SVG Cat ── */
.cat-svg {
  width: 210px;
  height: 250px;
  margin: 0 auto 8px;
  display: block;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5));
}

/* Eye state visibility */
.cat-svg .eyes-tired,
.cat-svg .eyes-sick,
.cat-svg .eyes-ghost { display: none; }
.cat-svg .legendary-sparkles { display: none; }

.cat-svg.state-tired .eyes-happy { display: none; }
.cat-svg.state-tired .eyes-tired { display: block; }

.cat-svg.state-exhausted .eyes-happy { display: none; }
.cat-svg.state-exhausted .eyes-tired { display: block; }

.cat-svg.state-sick .eyes-happy { display: none; }
.cat-svg.state-sick .eyes-sick { display: block; }

.cat-svg.state-ghost .eyes-happy { display: none; }
.cat-svg.state-ghost .eyes-ghost { display: block; }

.cat-svg.state-legendary .legendary-sparkles { display: block; }

/* Cat animations */
.cat-svg { animation: catFloat 4s ease-in-out infinite; }
.cat-svg.state-ghost { filter: drop-shadow(0 0 14px #4d9fff); opacity: 0.82; }
.cat-svg.state-legendary { filter: drop-shadow(0 0 18px #ffd84a88); }

/* Whole cat floating */
@keyframes catFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}

/* Tail swing — always on */
.cat-tail {
  animation: tailSwing 2.6s ease-in-out infinite;
}
.cat-svg.state-exhausted .cat-tail,
.cat-svg.state-ghost .cat-tail {
  animation: tailDroop 3s ease-in-out infinite;
}
@keyframes tailSwing {
  0%, 100% { transform: rotate(0deg); }
  30%       { transform: rotate(16deg); }
  70%       { transform: rotate(-8deg); }
}
@keyframes tailDroop {
  0%, 100% { transform: rotate(0deg); }
  50%      { transform: rotate(-12deg); }
}

/* Blink — scaleY from top */
.cat-blink-l, .cat-blink-r {
  transform-box: fill-box;
  transform-origin: top center;
  transform: scaleY(0);
  animation: catBlink 6s ease-in-out infinite;
}
.cat-blink-r { animation-delay: 0.06s; }
@keyframes catBlink {
  0%, 86%, 100% { transform: scaleY(0); }
  90%, 94%      { transform: scaleY(1); }
}
/* Hide blink covers on non-happy states */
.cat-svg.state-tired .cat-blink-l,
.cat-svg.state-tired .cat-blink-r,
.cat-svg.state-sick .cat-blink-l,
.cat-svg.state-sick .cat-blink-r,
.cat-svg.state-ghost .cat-blink-l,
.cat-svg.state-ghost .cat-blink-r { display: none; }

/* Right ear twitch */
.cat-ear-right {
  animation: earTwitch 7s ease-in-out infinite;
}
@keyframes earTwitch {
  0%, 75%, 100% { transform: rotate(0deg); }
  80%           { transform: rotate(-10deg); }
  87%           { transform: rotate(4deg); }
  93%           { transform: rotate(0deg); }
}

@keyframes ghostFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.cat-name-display {
  font-size: 1.4rem;
  font-weight: 700;
  color: #eef1ff;
  letter-spacing: 1px;
  margin-bottom: 2px;
  min-height: 28px;
}

.cat-phrase {
  color: #ffdda9;
  font-size: 1.05rem;
  margin: 4px 0 12px;
  min-height: 28px;
}

.status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
  font-size: 13px;
  color: #8be8b7;
  max-width: 420px;
  margin: 0 auto;
}

/* ── Stat rings ── */
.stat-rings {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.stat-ring {
  background: #14182c;
  border: 1px solid #303861;
  border-radius: 12px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.ring-wrap {
  position: relative;
  width: 70px;
  height: 70px;
}

.stat-ring svg {
  width: 70px;
  height: 70px;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: #1e2444;
  stroke-width: 3.5;
}

.ring-fill {
  fill: none;
  stroke-width: 3.5;
  stroke-linecap: round;
  transition: stroke-dasharray 0.4s ease;
}

.stat-ring[data-stat="hunger"] .ring-fill { stroke: #ff6b35; }
.stat-ring[data-stat="happiness"] .ring-fill { stroke: #7dff76; }
.stat-ring[data-stat="health"] .ring-fill { stroke: #ff6ad5; }
.stat-ring[data-stat="cleanliness"] .ring-fill { stroke: #3a9dff; }

.ring-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.ring-value { font-size: 1rem; font-weight: 700; color: #eef1ff; line-height: 1; }
.ring-label { font-size: 11px; color: #7080a0; margin-top: 2px; }

/* ── Action buttons ── */
.actions {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.actions button {
  padding: 14px 8px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: transform 0.1s, background 0.2s, box-shadow 0.2s;
  border: 1px solid #6751a3;
  background: linear-gradient(180deg, #2b2344, #161326);
  color: #eef1ff;
}

.actions button:hover { transform: translateY(-2px); background: #2d3863; box-shadow: 0 4px 12px rgba(0,0,0,0.4); }
.actions button:active { transform: translateY(0); }
.actions button:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

.action-feed { border-color: #ff8a3d !important; }
.action-feed:hover { box-shadow: 0 4px 16px rgba(255,138,61,0.3) !important; }

.heal-active {
  border-color: #ff4444 !important;
  background: linear-gradient(180deg, #3a0a0a, #200505) !important;
  animation: healPulse 1.5s ease-in-out infinite;
}

@keyframes healPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(255,68,68,0.3); }
  50% { box-shadow: 0 0 20px rgba(255,68,68,0.7); }
}

/* ── Share button ── */
.share-section { margin-top: 12px; text-align: center; }
.share-btn {
  background: #000;
  color: #fff;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 10px 28px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.share-btn:hover { background: #111; transform: translateY(-1px); }

/* ── Sections ── */
.leaderboard {
  margin-top: 18px;
  background: #14182c;
  border: 1px solid #303861;
  border-radius: 12px;
  padding: 14px 16px;
}

.leaderboard h3 { margin-bottom: 10px; font-size: 0.95rem; }
.leaderboard ol { margin: 0; padding-left: 20px; }
.leaderboard li { margin: 6px 0; color: #c7d1ff; }
.leaders-head { display: flex; justify-content: space-between; color: #9fb1ff; font-size: 13px; margin-bottom: 6px; }
.leader-row { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; }

/* ── Event feed ── */
.event-feed { list-style: none; padding: 0; }
.event-item {
  display: flex;
  gap: 6px;
  align-items: baseline;
  padding: 5px 0;
  border-bottom: 1px solid #1e2444;
  font-size: 13px;
}
.event-item:last-child { border-bottom: none; }
.event-actor { color: #9be1ff; font-weight: 600; }
.event-action { color: #c7d1ff; flex: 1; }
.event-time { color: #505870; font-size: 11px; white-space: nowrap; }
.event-empty { color: #505870; font-size: 13px; list-style: none; }

/* ── Prophecy ── */
.prophecy-text { color: #c7b3ff; font-style: italic; font-size: 1rem; line-height: 1.6; }

/* ── Shop ── */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}
.shop-grid button {
  border-radius: 10px;
  border: 1px solid #344171;
  background: #202745;
  color: #eef1ff;
  padding: 10px 6px;
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1.4;
  transition: background 0.2s;
}
.shop-grid button:hover { background: #2d3863; }
.shop-grid small { color: #9fb1ff; display: block; }

/* ── Level bar ── */
.cat-level-line { margin-top: 12px; font-size: 14px; color: #9be1ff; }
.level-bar-wrap { margin-top: 6px; }
.level-bar { width: 100%; height: 10px; background: #242b4d; border-radius: 999px; overflow: hidden; margin-bottom: 4px; }
.level-bar span { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, #8f8aff, #3ec3ff); transition: width 0.4s ease; }
.level-bar-wrap small { color: #6a7099; font-size: 11px; }

/* ── Crystal gain animation ── */
.crystal-gain {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.5rem;
  font-weight: bold;
  color: #ffd84a;
  text-shadow: 0 0 10px #ffd84a;
  animation: crystalFloat 2s ease forwards;
  pointer-events: none;
  z-index: 10;
}

@keyframes crystalFloat {
  0% { opacity: 1; transform: translate(-50%, -50%); }
  100% { opacity: 0; transform: translate(-50%, -200%); }
}

/* ── Particles ── */
.particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.8;
  background-image:
    radial-gradient(circle, rgba(255,231,119,.85) 2px, transparent 3px),
    radial-gradient(circle, rgba(163,231,255,.75) 2px, transparent 3px);
  background-size: 70px 70px, 90px 90px;
  animation: floatParticles 8s linear infinite;
}

@keyframes floatParticles {
  from { background-position: 0 0, 0 0; }
  to { background-position: 140px -160px, -120px -200px; }
}

/* ── Footer ── */
.site-footer {
  text-align: center;
  margin-top: 40px;
  padding: 16px;
  color: #505870;
  font-size: 13px;
  letter-spacing: 0.3px;
}

.footer-name {
  color: #9be1ff;
  font-weight: 600;
  text-decoration: none;
}
.footer-name:hover { text-decoration: underline; }

/* ── Milestone popup ── */
.milestone-popup {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5,6,18,0.88);
  backdrop-filter: blur(8px);
  animation: popIn 0.3s ease;
}

.milestone-box {
  background: #0e0e20;
  border: 2px solid var(--mc, #8f8aff);
  border-radius: 24px;
  padding: 28px 24px;
  text-align: center;
  max-width: 320px;
  width: 92%;
  box-shadow: 0 0 60px color-mix(in srgb, var(--mc, #8f8aff) 30%, transparent);
  position: relative;
}

.milestone-close {
  position: absolute;
  top: 14px; right: 16px;
  cursor: pointer;
  color: #505870;
  font-size: 18px;
}
.milestone-close:hover { color: #eef1ff; }

.milestone-badge { font-size: 52px; margin-bottom: 8px; }
.milestone-rarity { font-size: 12px; font-weight: 700; letter-spacing: 2px; margin-bottom: 4px; }
.milestone-title  { font-size: 1.6rem; font-weight: 700; margin-bottom: 4px; }
.milestone-name   { font-size: 1.1rem; color: #b7c0ff; margin-bottom: 8px; }
.milestone-sub    { font-size: 13px; color: #505870; margin-bottom: 20px; line-height: 1.5; }

.milestone-mint-btn {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: 2px solid;
  background: transparent;
  color: #eef1ff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, background 0.2s;
  margin-bottom: 10px;
}
.milestone-mint-btn:hover { transform: translateY(-2px); background: rgba(255,255,255,0.05); }
.milestone-mint-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.milestone-canvas-wrap {
  display: flex;
  justify-content: center;
  margin: 12px 0 16px;
}
.milestone-nft-canvas {
  border-radius: 10px;
  max-width: 230px;
  width: 100%;
  height: auto;
  display: block;
}
.milestone-download-btn {
  width: 100%;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.18);
  background: transparent;
  color: rgba(255,255,255,0.6);
  font-size: 0.9rem;
  cursor: pointer;
  margin-bottom: 8px;
  transition: border-color 0.2s, color 0.2s;
}
.milestone-download-btn:hover { border-color: rgba(255,255,255,0.5); color: #fff; }

.milestone-later {
  background: none;
  border: none;
  color: #505870;
  cursor: pointer;
  font-size: 13px;
  text-decoration: underline;
}
.milestone-later:hover { color: #9fb1ff; }

/* ── Milestone notification badge ── */
.milestone-notif {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 250;
  background: #14182c;
  border: 1px solid #8f8aff;
  border-radius: 14px;
  padding: 12px 18px;
  cursor: pointer;
  font-size: 14px;
  color: #eef1ff;
  box-shadow: 0 0 20px rgba(143,138,255,0.3);
  animation: notifPulse 2s ease-in-out infinite;
  max-width: 240px;
}
.milestone-notif span { color: #8f8aff; font-weight: 700; }
.milestone-notif:hover { background: #1e2444; }

@keyframes notifPulse {
  0%,100% { box-shadow: 0 0 12px rgba(143,138,255,0.3); }
  50%      { box-shadow: 0 0 28px rgba(143,138,255,0.6); }
}

/* ── Misc ── */
.hidden { display: none !important; }

@keyframes popIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ── Mobile ── */
@media (max-width: 560px) {
  h1 { font-size: 1.8rem; }
  .moon { width: 60px; height: 60px; right: 16px; top: 16px; }
  .actions { grid-template-columns: 1fr 1fr; }
  .stat-rings { grid-template-columns: 1fr 1fr; }
  .shop-grid { grid-template-columns: 1fr 1fr 1fr; }
  .cat-svg { width: 168px; height: 200px; }
}
