* {
  box-sizing: border-box;
}

:root {
  --ink: #1e3f59;
  --blue: #4388aa;
  --sky: #80d0f5;
  --mist: #f5fbfe;
  --line: #d6eefc;
  --green: #2f9d68;
  --purple: #746cff;
  --rose: #db5d8a;
  --warm: #f5b94f;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: linear-gradient(180deg, #ffffff 0%, #f4fbff 100%);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.mini-app {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 46px 14px 16px;
}

.status {
  position: absolute;
  top: 13px;
  left: 18px;
  right: 18px;
  display: flex;
  justify-content: space-between;
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.title-group {
  display: grid;
  gap: 2px;
}

.label {
  color: var(--blue);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.08;
}

.pill {
  border-radius: 999px;
  background: #eef8fd;
  color: var(--blue);
  padding: 6px 9px;
  font-size: 9px;
  font-weight: 900;
  white-space: nowrap;
}

.card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 26px rgba(30, 63, 89, 0.1);
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--sky), var(--blue));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 900;
  flex: 0 0 auto;
}

.chat-thread,
.simple-stack,
.auto-stack {
  display: grid;
  gap: 10px;
}

.message {
  display: flex;
  gap: 9px;
  align-items: flex-end;
  animation: messageFloat 5.8s ease-in-out infinite;
}

.message:nth-child(2) {
  animation-delay: 0.28s;
}

.message:nth-child(3) {
  animation-delay: 0.56s;
}

.bubble {
  max-width: 78%;
  border-radius: 16px 16px 16px 5px;
  background: #fff;
  border: 1px solid var(--line);
  padding: 10px 11px;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.35;
  box-shadow: 0 8px 18px rgba(30, 63, 89, 0.08);
}

.message.me {
  justify-content: flex-end;
}

.message.me .bubble {
  border-color: rgba(67, 136, 170, 0.22);
  border-radius: 16px 16px 5px 16px;
  background: var(--blue);
  color: #fff;
}

.typing {
  display: inline-flex;
  gap: 3px;
}

.typing i {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--sky);
  animation: typingDot 1.4s ease-in-out infinite;
}

.typing i:nth-child(2) {
  animation-delay: 0.16s;
}

.typing i:nth-child(3) {
  animation-delay: 0.32s;
}

.media-card {
  overflow: hidden;
}

.media-img {
  height: 148px;
  background:
    linear-gradient(135deg, rgba(30, 63, 89, 0.1), rgba(128, 208, 245, 0.12)),
    url("../assets/grandpa-granddaughter.jpg") center / cover;
  animation: photoLift 5.2s ease-in-out infinite;
}

.media-caption {
  padding: 12px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.media-reactions {
  display: flex;
  gap: 7px;
  padding: 0 12px 12px;
}

.reaction {
  border-radius: 999px;
  background: #eef8fd;
  color: var(--blue);
  padding: 5px 8px;
  font-size: 10px;
  font-weight: 900;
  animation: reactionPop 5.2s ease-in-out infinite;
}

.reaction:nth-child(2) {
  animation-delay: 0.2s;
}

.simple-button {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 14px;
  font-size: 14px;
  font-weight: 900;
}

.simple-button::before {
  content: "";
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--sky), var(--blue));
  box-shadow: 0 0 0 0 rgba(128, 208, 245, 0.24);
  animation: tapTarget 5s ease-in-out infinite;
}

.call-screen {
  position: relative;
  min-height: 304px;
  overflow: hidden;
  border-radius: 18px;
  background: linear-gradient(160deg, #173b54 0%, #4388aa 100%);
  color: #fff;
}

.call-screen.live-call {
  background: #173b54;
}

.call-video,
.kiosk-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.call-overlay {
  position: absolute;
  left: 16px;
  bottom: 78px;
  border-radius: 16px;
  background: rgba(18, 47, 69, 0.74);
  color: #fff;
  padding: 11px 13px;
  backdrop-filter: blur(10px);
}

.call-overlay strong {
  display: block;
  font-size: 14px;
  line-height: 1.1;
}

.call-overlay span {
  display: block;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 10px;
  font-weight: 800;
}

.call-person {
  position: absolute;
  inset: 30px 30px auto;
  display: grid;
  justify-items: center;
  gap: 9px;
}

.call-avatar {
  width: 92px;
  height: 92px;
  border-radius: 999px;
  background: url("../assets/profile-woman.jpg") center / cover;
  border: 4px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.18);
  animation: callPulse 4.8s ease-in-out infinite;
}

.call-person strong {
  font-size: 17px;
}

.call-actions {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  display: flex;
  justify-content: center;
  gap: 14px;
}

.call-btn {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
}

.call-btn.primary {
  background: var(--green);
  animation: tapTarget 4.8s ease-in-out infinite;
}

.video-tile {
  min-height: 266px;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.video-window {
  border-radius: 16px;
  background: url("../assets/friends-pool.jpg") center / cover;
  min-height: 160px;
  animation: videoGlow 5.4s ease-in-out infinite;
}

.video-controls,
.group-grid {
  display: flex;
  justify-content: center;
  gap: 9px;
}

.control-dot {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #eef8fd;
}

.control-dot.active {
  background: var(--blue);
  animation: tapTarget 5.4s ease-in-out infinite;
}

.group-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
}

.group-tile {
  min-height: 108px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--sky), var(--blue));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 900;
  animation: groupJoin 5.6s ease-in-out infinite;
}

.group-tile:nth-child(2) { animation-delay: 0.18s; }
.group-tile:nth-child(3) { animation-delay: 0.36s; }
.group-tile:nth-child(4) { animation-delay: 0.54s; }

.kiosk {
  position: relative;
  min-height: 304px;
  overflow: hidden;
  border-radius: 18px;
  background: #102f45;
}

.slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: scale(1.04);
  animation: slideshow 9s ease-in-out infinite;
  background-position: center;
  background-size: cover;
}

.slide.one {
  background-image: url("../assets/grandpa-granddaughter.jpg");
}

.slide.two {
  background-image: url("../assets/elise-festival.jpg");
  animation-delay: 3s;
}

.slide.three {
  background-image: url("../assets/senior-couple-walking-in-the-park-in-autumn-2025-03-25-00-55-33-utc.jpg");
  animation-delay: 6s;
}

.kiosk-caption {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  padding: 11px;
  font-size: 12px;
  font-weight: 900;
}

.handsfree {
  display: grid;
  gap: 12px;
}

.handsfree-card {
  padding: 15px;
  display: grid;
  gap: 8px;
  text-align: center;
}

.big-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--sky), var(--blue));
  box-shadow: 0 12px 26px rgba(67, 136, 170, 0.2);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 26px;
  font-weight: 900;
  animation: gentleRock 5s ease-in-out infinite;
}

.fresh-stack {
  display: grid;
  gap: 10px;
}

.fresh-card {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px;
  animation: freshIn 5.8s ease-in-out infinite;
}

.fresh-thumb {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: url("../assets/jaime-dog.jpg") center / cover;
  flex: 0 0 auto;
}

.fresh-card strong {
  display: block;
  font-size: 12px;
}

.fresh-card span {
  color: var(--blue);
  font-size: 10px;
}

@keyframes messageFloat {
  0%, 100% { transform: translateY(0); opacity: 0.88; }
  45%, 68% { transform: translateY(-4px); opacity: 1; }
}

@keyframes typingDot {
  0%, 100% { transform: translateY(0); opacity: 0.45; }
  50% { transform: translateY(-4px); opacity: 1; }
}

@keyframes photoLift {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.045); }
}

@keyframes reactionPop {
  0%, 40%, 100% { transform: scale(1); }
  55% { transform: scale(1.12); }
}

@keyframes tapTarget {
  0%, 42%, 100% { box-shadow: 0 0 0 0 rgba(128, 208, 245, 0); transform: scale(1); }
  56% { box-shadow: 0 0 0 9px rgba(128, 208, 245, 0.18); transform: scale(1.05); }
}

@keyframes callPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 18px 38px rgba(0, 0, 0, 0.18); }
  52% { transform: scale(1.04); box-shadow: 0 22px 44px rgba(128, 208, 245, 0.26); }
}

@keyframes videoGlow {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(255,255,255,0); }
  52% { box-shadow: inset 0 0 0 3px rgba(128, 208, 245, 0.42); }
}

@keyframes groupJoin {
  0%, 20% { opacity: 0.72; transform: translateY(5px); }
  48%, 100% { opacity: 1; transform: translateY(0); }
}

@keyframes slideshow {
  0%, 28% { opacity: 1; transform: scale(1); }
  34%, 94% { opacity: 0; transform: scale(1.05); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes gentleRock {
  0%, 100% { transform: rotate(0deg); }
  45% { transform: rotate(-4deg); }
  68% { transform: rotate(3deg); }
}

@keyframes freshIn {
  0%, 28% { opacity: 0; transform: translateY(-8px); }
  42%, 82% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(8px); }
}

@media (min-aspect-ratio: 1/1) {
  .mini-app {
    padding: 34px 18px 14px;
  }

  .status {
    top: 11px;
  }

  .call-screen,
  .kiosk {
    min-height: calc(100vh - 48px);
  }

  .call-person {
    inset: 28px 30px auto;
  }

  .call-avatar {
    width: 76px;
    height: 76px;
  }

  .call-actions {
    bottom: 16px;
  }

  .video-tile {
    min-height: calc(100vh - 48px);
    grid-template-rows: 1fr auto;
  }

  .video-window {
    min-height: 112px;
  }

  .group-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .group-tile {
    min-height: 86px;
  }

  .handsfree {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .handsfree-card {
    min-height: 156px;
    align-content: center;
  }

  .fresh-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fresh-card:first-child {
    grid-column: 1 / -1;
  }
}

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