:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --ink: #17202a;
  --muted: #627087;
  --panel: rgba(255, 255, 255, 0.86);
  --line: rgba(35, 48, 68, 0.12);
  --primary: #5c7cfa;
  --primary-dark: #364fc7;
  --mint: #3bd2a2;
  --warm: #ffb454;
  --danger: #ef5b72;
  --shadow: 0 22px 50px rgba(34, 49, 76, 0.18);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  height: 100dvh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 8%, rgba(92, 124, 250, 0.18), transparent 28%),
    radial-gradient(circle at 82% 20%, rgba(59, 210, 162, 0.18), transparent 28%),
    linear-gradient(180deg, #f8fbff, #eaf0f7 62%, #dfe9f5);
  overflow: hidden;
}

button {
  font: inherit;
}

.app-shell {
  width: min(100vw, 390px);
  height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  gap: clamp(7px, 1.4vh, 11px);
  padding: clamp(10px, 2vh, 14px) 16px;
  overflow: hidden;
}

.topbar,
.status-panel,
.pet-stage,
.demo-limits,
.footer-bar {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--primary-dark);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.3rem, 6vw, 1.65rem);
  line-height: 1;
}

.level-pill {
  min-width: 66px;
  border-radius: 18px;
  padding: 8px 10px;
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  text-align: center;
}

.level-pill span,
.mood-card span,
.demo-limits span,
.footer-bar span {
  display: block;
  color: inherit;
  opacity: 0.78;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.level-pill strong {
  display: block;
  margin-top: 2px;
  font-size: 1.22rem;
}

.status-panel {
  display: grid;
  gap: 7px;
  padding: 8px 10px;
}

.stat-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 7px;
}

.stat-row span,
.stat-row strong {
  font-size: 0.82rem;
  font-weight: 800;
}

.meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(23, 32, 42, 0.1);
}

.meter div {
  width: 50%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), var(--primary));
  transition: width 220ms ease, background 220ms ease;
}

.pet-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
  padding: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.42)),
    linear-gradient(180deg, #dff4ff 0 54%, #d9f2df 54% 100%);
}

.room-window {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 78px;
  height: 60px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border: 5px solid rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(180deg, #9ad7ff, #d5f3ff);
}

.room-window span {
  border: 1px solid rgba(255, 255, 255, 0.82);
}

.speech {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 88px;
  min-height: 38px;
  border-radius: 18px 18px 18px 6px;
  padding: 8px 10px;
  color: #223044;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 12px 24px rgba(31, 44, 66, 0.12);
  font-size: 0.78rem;
  font-weight: 750;
}

.pet {
  position: relative;
  width: clamp(112px, 30vh, 136px);
  height: clamp(126px, 34vh, 154px);
  margin-top: clamp(26px, 5vh, 38px);
  animation: idleBounce 2.6s ease-in-out infinite;
}

.body,
.face,
.ear,
.foot {
  position: absolute;
  background: linear-gradient(145deg, #ffe2a9, #ffb454);
  border: 4px solid #784c1d;
}

.body {
  left: 16%;
  bottom: 8%;
  width: 68%;
  height: 60%;
  border-radius: 46% 46% 42% 42%;
}

.face {
  left: 10%;
  top: 13%;
  width: 80%;
  height: 56%;
  border-radius: 48% 48% 44% 44%;
  z-index: 2;
}

.ear {
  top: 10px;
  width: 24%;
  height: 28%;
  border-radius: 50% 50% 34% 34%;
}

.ear.left {
  left: 11%;
  transform: rotate(-20deg);
}

.ear.right {
  right: 11%;
  transform: rotate(20deg);
}

.eye {
  position: absolute;
  top: 36%;
  width: 12px;
  height: 16px;
  border-radius: 999px;
  background: #25201b;
}

.eye.left {
  left: 29%;
}

.eye.right {
  right: 29%;
}

.mouth {
  position: absolute;
  left: 50%;
  top: 63%;
  width: 34px;
  height: 18px;
  border: 4px solid #25201b;
  border-top: 0;
  border-radius: 0 0 999px 999px;
  transform: translateX(-50%);
}

.pet.is-tired .mouth {
  width: 28px;
  height: 4px;
  border-top: 4px solid #25201b;
  border-bottom: 0;
  border-radius: 999px;
}

.foot {
  bottom: 0;
  width: 23%;
  height: 15%;
  border-radius: 999px;
}

.foot.left {
  left: 29%;
}

.foot.right {
  right: 29%;
}

.mood-card {
  position: absolute;
  left: 14px;
  right: 18px;
  bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 18px;
  padding: 9px 12px;
  color: white;
  background: linear-gradient(135deg, rgba(54, 79, 199, 0.92), rgba(92, 124, 250, 0.86));
}

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

.action-grid button,
.footer-bar button {
  border: 0;
  border-radius: 18px;
  color: #1c2635;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 22px rgba(34, 49, 76, 0.14);
  cursor: pointer;
  font-weight: 850;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.action-grid button {
  min-height: 52px;
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 7px 5px;
  font-size: 0.82rem;
}

.action-grid button:active,
.footer-bar button:active {
  transform: translateY(1px) scale(0.98);
}

.action-icon {
  width: 24px;
  height: 24px;
  display: block;
  border-radius: 50%;
}

.action-icon.food { background: radial-gradient(circle at 35% 35%, #fff3bf, #ff922b); }
.action-icon.play { background: radial-gradient(circle at 35% 35%, #d0ebff, #5c7cfa); }
.action-icon.rest { background: radial-gradient(circle at 35% 35%, #f3d9fa, #9c36b5); }
.action-icon.clean { background: radial-gradient(circle at 35% 35%, #d0f4ff, #15aabf); }

.demo-limits {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
}

.demo-limits div {
  border-radius: 16px;
  padding: 7px;
  background: rgba(23, 32, 42, 0.06);
  text-align: center;
}

.demo-limits span {
  color: var(--muted);
}

.demo-limits strong {
  display: block;
  margin-top: 3px;
  color: var(--primary-dark);
  font-size: 0.82rem;
}

.footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px;
}

.footer-bar span {
  color: var(--muted);
}

.footer-bar button {
  min-height: 38px;
  padding: 0 14px;
}

@keyframes idleBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

@media (max-width: 360px) {
  .app-shell {
    gap: 7px;
    padding: 8px;
  }

  .action-grid button {
    min-height: 50px;
    font-size: 0.76rem;
  }
}

@media (max-height: 660px) {
  .app-shell {
    gap: 6px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .status-panel {
    gap: 5px;
    padding: 8px 10px;
  }

  .stat-row {
    grid-template-columns: 56px minmax(0, 1fr) 30px;
  }

  .room-window {
    display: none;
  }

  .speech {
    right: 14px;
    min-height: 34px;
    font-size: 0.74rem;
  }

  .pet {
    width: 108px;
    height: 122px;
    margin-top: 28px;
  }

  .action-grid button {
    min-height: 50px;
    font-size: 0.75rem;
  }

  .demo-limits {
    padding: 7px;
  }

  .demo-limits div {
    padding: 6px 4px;
  }

  .footer-bar {
    padding: 8px;
  }
}
