:root {
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #e8f1ed;
}

.mira-intro {
  --core-x: 51.5%;
  --core-y: 50.8%;
  position: relative;
  width: 100%;
  height: 100svh;
  min-height: 100%;
  overflow: hidden;
  background-color: #e8f1ed;
  background-image:
    radial-gradient(ellipse 34% 36% at 50% 46%, rgba(248,250,245,.68) 0%, rgba(248,250,245,.28) 34%, rgba(248,250,245,0) 100%),
    radial-gradient(ellipse 66% 30% at 50% 100%, rgba(242,231,213,.15) 0%, rgba(242,231,213,.055) 42%, rgba(242,231,213,0) 78%),
    radial-gradient(ellipse at 50% 48%, rgba(232,241,237,0) 0%, rgba(232,241,237,0) 58%, rgba(220,234,231,.38) 80%, rgba(209,226,225,.74) 100%);
}

.particle-pet {
  position: absolute;
  z-index: 2;
  display: block;
  height: auto;
  opacity: 0;
  mix-blend-mode: multiply;
  pointer-events: none;
  will-change: transform;
}

.particle-dog {
  left: -3vw;
  bottom: -5vh;
  width: clamp(410px, 35vw, 680px);
  aspect-ratio: 610 / 724;
  -webkit-mask-image: radial-gradient(ellipse 72% 67% at 44% 56%, #000 0 72%, rgba(0,0,0,.92) 83%, transparent 100%);
  mask-image: radial-gradient(ellipse 72% 67% at 44% 56%, #000 0 72%, rgba(0,0,0,.92) 83%, transparent 100%);
}

.particle-cat {
  top: 3vh;
  right: -5vw;
  width: clamp(380px, 34vw, 650px);
  aspect-ratio: 606 / 670;
  -webkit-mask-image: radial-gradient(ellipse 68% 64% at 48% 42%, #000 0 72%, rgba(0,0,0,.92) 84%, transparent 100%);
  mask-image: radial-gradient(ellipse 68% 64% at 48% 42%, #000 0 72%, rgba(0,0,0,.92) 84%, transparent 100%);
}

#mira-orbit-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#pet-flow-canvas {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  pointer-events: none;
  mix-blend-mode: multiply;
}

#life-effect-canvas {
  position: absolute;
  inset: 0;
  z-index: 7;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: transparent;
}

.metric-orbit {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: rgba(0,0,0,.9);
}

.metric-card {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: clamp(132px, 9.6vw, 164px);
  min-height: clamp(176px, 20.5vh, 212px);
  padding: 10px 10px 8px;
  border: 0;
  background: transparent;
  text-align: center;
  animation: metric-breathe 6.8s ease-in-out infinite;
}

.metric-heart {
  top: 1.8%;
  left: 50%;
  transform: translateX(-50%);
}

.metric-location {
  top: 16%;
  left: 29%;
  animation-delay: -1.2s;
}

.metric-respiration {
  top: 17.5%;
  right: 29%;
  animation-delay: -2.4s;
}

.metric-stress {
  left: 35%;
  bottom: 7.5%;
  animation-delay: -3.3s;
}

.metric-temperature {
  right: 21%;
  bottom: 27%;
  animation-delay: -4.1s;
}

.metric-sleep {
  bottom: 7%;
  left: 61%;
  transform: translateX(-50%);
  animation-delay: -5.2s;
}

.metric-icon {
  display: grid;
  grid-template-rows: auto auto;
  align-content: center;
  gap: 6px;
  place-items: center;
  width: 34px;
  height: 31px;
  margin-bottom: 1px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 35px;
  line-height: 1;
  color: #050505;
}

.metric-label {
  font-size: 13px;
  font-weight: 520;
  line-height: 1.2;
}

.metric-value {
  margin-top: 5px;
  font-size: 31px;
  font-weight: 520;
  line-height: 1;
  letter-spacing: -.03em;
}

.metric-value small {
  font-size: 11px;
  font-weight: 520;
  letter-spacing: 0;
}

.metric-word {
  margin-top: 8px;
  font-size: 22px;
  font-weight: 520;
  line-height: 1;
}

.metric-chart {
  display: block;
  width: 104px;
  height: 30px;
  margin-top: 7px;
  border-bottom: 1px solid rgba(0,0,0,.13);
  opacity: .96;
}

.metric-bar-chart {
  height: 35px;
  margin-top: 9px;
}

.chart-ticks {
  display: flex;
  justify-content: space-between;
  width: 99px;
  margin-top: 2px;
  color: rgba(0,0,0,.62);
  font-size: 7px;
  line-height: 1;
}

.metric-state {
  display: grid;
  grid-template-columns: 9px auto;
  align-items: center;
  gap: 3px;
  margin-top: 10px;
  font-size: 11px;
  line-height: 1.18;
  color: rgba(0,0,0,.7);
  text-align: left;
}

.metric-state small {
  grid-column: 2;
  font-size: 10px;
  color: rgba(0,0,0,.57);
}

.state-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #56b848;
  box-shadow: 0 0 0 2px rgba(86,184,72,.08);
  animation: state-pulse 2.8s ease-in-out infinite;
}

.mini-map {
  position: relative;
  width: 108px;
  height: 58px;
  margin-top: 9px;
  overflow: hidden;
  border: 1px solid rgba(47,67,70,.2);
  border-radius: 5px;
  background: #e6ebe6;
  box-shadow: 0 2px 7px rgba(51,74,72,.08);
}

.mini-map img {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) saturate(.08) contrast(.82) brightness(1.08);
  opacity: .82;
}

.mini-map::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(232,241,237,.17);
  pointer-events: none;
}

.mini-map span {
  position: absolute;
  z-index: 2;
  left: 58%;
  top: 38%;
  width: 10px;
  height: 10px;
  border: 3px solid #050505;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
}

.mini-map span::after {
  content: "";
  position: absolute;
  left: 1px;
  top: 1px;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #050505;
}

.mini-map b {
  position: absolute;
  z-index: 2;
  left: 55%;
  top: 20%;
  padding: 2px 4px;
  border-radius: 3px;
  color: rgba(0,0,0,.84);
  background: rgba(248,250,245,.9);
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  font-size: 8px;
  font-weight: 650;
  letter-spacing: .01em;
  transform: translateX(-100%);
}

.mini-map > small {
  position: absolute;
  z-index: 2;
  right: 2px;
  bottom: 1px;
  padding: 1px 2px;
  color: rgba(0,0,0,.66);
  background: rgba(248,250,245,.8);
  font-size: 5px;
  line-height: 1;
}

.mini-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  width: 94px;
  height: 35px;
  margin-top: 9px;
  padding: 0 3px 2px;
  border-bottom: 1px solid rgba(0,0,0,.14);
}

.mini-bars i {
  width: 6px;
  height: var(--h);
  min-height: 4px;
  background: rgba(64,83,105,.16);
  animation: bar-breathe 3.6s ease-in-out infinite;
}

.stress-bars i:nth-child(-n+4) {
  background: rgba(87,190,72,.82);
}

.sleep-bars i {
  background: rgba(91,75,200,.52);
}

.mini-bars i:nth-child(2n) { animation-delay: -.8s; }
.mini-bars i:nth-child(3n) { animation-delay: -1.6s; }

.icon-lungs {
  position: relative;
  width: 37px;
  height: 32px;
}

.icon-lungs::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 1px;
  width: 2px;
  height: 12px;
  background: #050505;
}

.icon-lungs i {
  position: absolute;
  top: 9px;
  width: 14px;
  height: 20px;
  border: 2px solid #050505;
  border-radius: 58% 44% 50% 62%;
}

.icon-lungs i:first-child { left: 2px; transform: rotate(10deg); }
.icon-lungs i:last-child { right: 2px; transform: scaleX(-1) rotate(10deg); }

.icon-thermometer {
  position: relative;
  width: 14px;
  height: 30px;
  margin-bottom: 2px;
  border: 2px solid #050505;
  border-radius: 8px;
}

.icon-thermometer::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 5px;
  width: 2px;
  height: 14px;
  background: #050505;
}

.icon-thermometer::after {
  content: "";
  position: absolute;
  left: 2px;
  bottom: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #050505;
}

@keyframes metric-breathe {
  0%, 100% { opacity: .86; filter: none; }
  50% { opacity: 1; filter: drop-shadow(0 1px 4px rgba(0,0,0,.035)); }
}

@keyframes state-pulse {
  0%, 100% { transform: scale(.9); opacity: .72; }
  50% { transform: scale(1.14); opacity: 1; }
}

@keyframes bar-breathe {
  0%, 100% { transform: scaleY(.82); transform-origin: bottom; }
  50% { transform: scaleY(1.06); transform-origin: bottom; }
}

@media (max-height: 760px) {
  .metric-card {
    min-height: 172px;
    padding-top: 9px;
    transform: scale(.88);
  }

  .metric-heart,
  .metric-sleep {
    transform: translateX(-50%) scale(.88);
  }
}

@media (max-width: 1180px) {
  .metric-location { left: 27.5%; }
  .metric-respiration { right: 27.5%; }
  .metric-stress { left: 33%; bottom: 8%; }
  .metric-sleep { left: 58%; bottom: 7%; }
  .metric-temperature { right: 16.5%; bottom: 22%; }
}

.mira-core {
  position: absolute;
  left: var(--core-x);
  top: var(--core-y);
  z-index: 4;
  display: grid;
  place-items: center;
  width: clamp(105px, 7.8vw, 138px);
  aspect-ratio: 1;
  border-radius: 50%;
  color: rgba(0,0,0,.88);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(19px, 1.5vw, 27px);
  font-weight: 450;
  letter-spacing: .01em;
  text-decoration: none;
  background: transparent;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.home-glass-button {
  position: absolute;
  right: clamp(20px, 2.4vw, 42px);
  bottom: clamp(18px, 3.4vh, 34px);
  z-index: 8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 104px;
  min-height: 42px;
  padding: 0 20px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.66);
  border-radius: 999px;
  color: rgba(24,45,47,.84);
  background:
    linear-gradient(145deg, rgba(255,255,255,.64), rgba(255,255,255,.22) 52%, rgba(209,232,229,.38)),
    rgba(235,248,244,.26);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.86),
    inset 0 -1px 0 rgba(105,145,145,.18),
    0 10px 24px rgba(70,108,107,.14),
    0 2px 5px rgba(70,108,107,.1);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  font-weight: 520;
  letter-spacing: .08em;
  text-decoration: none;
  text-shadow: 0 1px 1px rgba(255,255,255,.72);
  transition: transform .25s ease, box-shadow .25s ease, background .25s ease;
}

.home-glass-button::before {
  content: "";
  position: absolute;
  top: -70%;
  left: -28%;
  width: 46%;
  height: 240%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.72), transparent);
  transform: rotate(22deg);
  opacity: .52;
  animation: glass-sheen 7s ease-in-out infinite;
  pointer-events: none;
}

.home-glass-button:hover,
.home-glass-button:focus-visible {
  color: rgba(20,44,45,.95);
  background:
    linear-gradient(145deg, rgba(255,255,255,.78), rgba(255,255,255,.3) 52%, rgba(209,232,229,.48)),
    rgba(235,248,244,.34);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.94),
    inset 0 -1px 0 rgba(105,145,145,.2),
    0 14px 30px rgba(70,108,107,.19),
    0 3px 7px rgba(70,108,107,.12);
  outline: none;
  transform: translateY(-2px);
}

.home-glass-button:focus-visible {
  outline: 2px solid rgba(91,147,149,.48);
  outline-offset: 4px;
}

@keyframes glass-sheen {
  0%, 38% { left: -28%; opacity: 0; }
  48% { opacity: .52; }
  62%, 100% { left: 112%; opacity: 0; }
}

/* 移动端使用独立的纵向构图：完整猫犬分居上下，六项数据等距环绕星核。 */
@media (max-width: 720px) {
  .mira-intro {
    --core-x: 50%;
    --core-y: 47%;
    --metric-ring-radius: min(36vw, 138px);
    --metric-ring-side: min(31.2vw, 119.5px);
    --metric-ring-half: min(18vw, 69px);
    background-image:
      radial-gradient(ellipse 76% 31% at 50% 47%, rgba(248,250,245,.7) 0%, rgba(248,250,245,.3) 40%, rgba(248,250,245,0) 100%),
      radial-gradient(ellipse 90% 27% at 50% 100%, rgba(242,231,213,.14) 0%, rgba(242,231,213,.05) 46%, rgba(242,231,213,0) 82%),
      radial-gradient(ellipse at 50% 47%, rgba(232,241,237,0) 0%, rgba(232,241,237,0) 58%, rgba(220,234,231,.38) 80%, rgba(209,226,225,.74) 100%);
  }

  .particle-cat {
    top: max(8px, env(safe-area-inset-top));
    right: 2vw;
    width: min(44vw, 184px);
  }

  .particle-dog {
    left: 2vw;
    bottom: max(10px, env(safe-area-inset-bottom));
    width: min(50vw, 212px);
  }

  .metric-card {
    width: 132px;
    min-height: 176px;
    padding: 10px 10px 8px;
    right: auto;
    bottom: auto;
    transform: translate(-50%, -50%) scale(.58);
    transform-origin: 50% 50%;
  }

  .metric-heart {
    top: calc(var(--core-y) - var(--metric-ring-radius));
    left: 50%;
  }

  .metric-respiration {
    top: calc(var(--core-y) - var(--metric-ring-half));
    left: calc(50% + var(--metric-ring-side));
  }

  .metric-temperature {
    top: calc(var(--core-y) + var(--metric-ring-half));
    left: calc(50% + var(--metric-ring-side));
  }

  .metric-sleep {
    top: calc(var(--core-y) + var(--metric-ring-radius));
    left: 50%;
  }

  .metric-stress {
    top: calc(var(--core-y) + var(--metric-ring-half));
    left: calc(50% - var(--metric-ring-side));
  }

  .metric-location {
    top: calc(var(--core-y) - var(--metric-ring-half));
    left: calc(50% - var(--metric-ring-side));
  }

  .mira-core {
    width: 94px;
    font-size: 18px;
  }

  .mira-core span {
    position: relative;
    z-index: 1;
    padding: 4px 7px;
    border-radius: 999px;
    background: rgba(232,241,237,.82);
    box-shadow: 0 0 16px 8px rgba(232,241,237,.68);
  }
}

@media (max-width: 720px) and (max-height: 760px) {
  .particle-cat {
    top: max(6px, env(safe-area-inset-top));
    width: min(39vw, 164px);
  }

  .particle-dog {
    bottom: max(8px, env(safe-area-inset-bottom));
    width: min(44vw, 186px);
  }

  .metric-card {
    transform: translate(-50%, -50%) scale(.53);
  }

  .mira-core {
    width: 84px;
    font-size: 16px;
  }
}

@media (max-width: 640px) {
  .home-glass-button {
    right: 16px;
    bottom: 16px;
    min-width: 96px;
    min-height: 40px;
    padding: 0 16px;
    font-size: 12px;
  }
}
