:root {
  --bg-a: #fff2f8;
  --bg-b: #eef7ff;
  --bg-c: #fff8df;
  --ink: #33283d;
  --muted: #7b7089;
  --card: rgba(255, 255, 255, 0.72);
  --stroke: rgba(255, 255, 255, 0.78);
  --shadow: 0 24px 90px rgba(77, 47, 104, 0.18);
  --pink: #ff7eb6;
  --violet: #9b5cff;
  --blue: #70d6ff;
  --green: #9bf6c6;
  --yellow: #ffd166;
  --danger: #ff5d73;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, ui-rounded, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 12%, rgba(255, 126, 182, 0.24), transparent 32%),
    radial-gradient(circle at 80% 0%, rgba(112, 214, 255, 0.26), transparent 34%),
    linear-gradient(140deg, var(--bg-a), var(--bg-b) 52%, var(--bg-c));
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.ambient {
  position: fixed;
  width: 380px;
  height: 380px;
  border-radius: 999px;
  filter: blur(18px);
  opacity: 0.36;
  pointer-events: none;
  animation: drift 12s ease-in-out infinite alternate;
}

.ambient-one {
  background: #ffafcc;
  top: -120px;
  left: -100px;
}

.ambient-two {
  background: #bde0fe;
  right: -120px;
  top: 14%;
  animation-delay: -3s;
}

.ambient-three {
  background: #fdffb6;
  left: 18%;
  bottom: -180px;
  animation-delay: -5s;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(24px, -18px, 0) scale(1.08); }
}

.glass {
  background: var(--card);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(470px, 100%);
  border-radius: 36px;
  padding: 36px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: -80px -80px auto auto;
  width: 180px;
  height: 180px;
  border-radius: 80px;
  background: rgba(255, 126, 182, 0.22);
}

.logo-badge {
  width: 76px;
  height: 76px;
  border-radius: 28px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  background: linear-gradient(145deg, #ff8fab, #b388ff);
  color: white;
  font-size: 34px;
  box-shadow: 0 18px 44px rgba(155, 92, 255, 0.22);
  animation: pulse 2.4s ease-in-out infinite;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(42px, 6vw, 68px);
  line-height: 0.92;
  letter-spacing: -0.06em;
  margin-bottom: 14px;
}

h2 {
  margin-bottom: 0;
  letter-spacing: -0.035em;
}

.muted {
  color: var(--muted);
  line-height: 1.55;
}

.login-form,
.friend-form,
.chat-form {
  display: grid;
  gap: 12px;
}

.login-form {
  margin-top: 26px;
  text-align: left;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 750;
  font-size: 13px;
}

input {
  border: 1px solid rgba(110, 89, 130, 0.12);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  outline: none;
  transition: border 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

input:focus {
  border-color: rgba(155, 92, 255, 0.42);
  box-shadow: 0 0 0 5px rgba(155, 92, 255, 0.08);
  transform: translateY(-1px);
}

.primary-button,
.ghost-button,
.danger-button,
.actions-grid button,
.friend-form button,
.chat-form button,
.test-users button,
.visit-button {
  border: 0;
  border-radius: 18px;
  padding: 13px 16px;
  font-weight: 850;
  color: var(--ink);
  transition: transform 0.16s ease, filter 0.16s ease, box-shadow 0.16s ease;
}

.primary-button {
  background: linear-gradient(135deg, #ff8fab, #b388ff);
  color: white;
  box-shadow: 0 16px 36px rgba(155, 92, 255, 0.22);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.68);
}

.danger-button {
  background: rgba(255, 93, 115, 0.14);
  color: #b3213b;
}

button:hover {
  transform: translateY(-2px);
  filter: saturate(1.1);
}

button:active {
  transform: translateY(0) scale(0.99);
}

.error-text {
  min-height: 18px;
  margin: 6px 0 0;
  color: #d62839;
  font-size: 13px;
  font-weight: 750;
}

.test-users {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.test-users button {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.68);
}

.game-screen {
  min-height: 100vh;
  padding: 22px;
}

.topbar {
  max-width: 1480px;
  margin: 0 auto 18px;
  padding: 18px 20px;
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.eyebrow {
  color: var(--violet);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 900;
  margin-bottom: 5px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.pill.online {
  color: #18714b;
  background: rgba(155, 246, 198, 0.44);
}

.pill.soft {
  color: #7644c2;
  background: rgba(179, 136, 255, 0.13);
}

.layout {
  max-width: 1480px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(360px, 1fr) minmax(280px, 360px);
  gap: 18px;
  align-items: start;
}

.panel {
  border-radius: 32px;
  padding: 20px;
  overflow: hidden;
}

.panel-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.scene {
  min-height: 390px;
  border-radius: 30px;
  overflow: hidden;
  position: relative;
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 255, 255, 0.7), transparent 12%),
    radial-gradient(circle at 72% 18%, rgba(255, 255, 255, 0.72), transparent 13%),
    linear-gradient(180deg, rgba(190, 230, 255, 0.8), rgba(255, 220, 236, 0.86) 64%, rgba(255, 246, 220, 0.9));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.75);
}

.floor {
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: -56px;
  height: 152px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.72), rgba(255, 231, 240, 0.88));
  z-index: 1;
}

.cloud {
  position: absolute;
  width: 110px;
  height: 38px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.64);
  animation: cloudFloat 8s ease-in-out infinite alternate;
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: inherit;
}

.cloud::before {
  width: 54px;
  height: 54px;
  left: 18px;
  top: -24px;
}

.cloud::after {
  width: 42px;
  height: 42px;
  right: 18px;
  top: -18px;
}

.cloud-a {
  top: 48px;
  left: 32px;
}

.cloud-b {
  top: 86px;
  right: 26px;
  transform: scale(0.72);
  animation-delay: -3s;
}

@keyframes cloudFloat {
  from { translate: -8px 0; }
  to { translate: 12px -4px; }
}

.stars-layer::before,
.stars-layer::after {
  content: "✦  ✧    ✦     ✧  ✦";
  position: absolute;
  color: rgba(255, 255, 255, 0.88);
  letter-spacing: 18px;
  animation: twinkle 2.6s ease-in-out infinite alternate;
}

.stars-layer::before {
  top: 24px;
  left: 20%;
}

.stars-layer::after {
  top: 150px;
  left: 12%;
  animation-delay: -1.1s;
}

@keyframes twinkle {
  from { opacity: 0.28; transform: scale(0.98); }
  to { opacity: 0.9; transform: scale(1.02); }
}

.pet-mount {
  position: absolute;
  left: 50%;
  bottom: 50px;
  z-index: 3;
  transform: translateX(-50%);
}

.pet-mount.companion {
  left: 70%;
  bottom: 48px;
  transform: translateX(-50%) scale(0.86);
}

.home-scene.has-companion #petMount {
  left: 33%;
}

.luma-pet {
  --body: #ffb8d2;
  --belly: #fff8fb;
  --accent: #ff4d8d;
  --blush: #ff7aa2;
  --wobble: 3.5s;
  width: 172px;
  height: 206px;
  position: relative;
  animation: float var(--wobble) ease-in-out infinite;
  filter: drop-shadow(0 26px 32px rgba(77, 47, 104, 0.22));
}

.luma-pet.sleepy {
  animation-duration: 5.4s;
}

.luma-pet.dead {
  filter: grayscale(0.92) opacity(0.64) drop-shadow(0 16px 24px rgba(77, 47, 104, 0.14));
  animation: none;
}

.luma-pet.happy .pet-mouth {
  width: 26px;
  height: 14px;
  border-width: 4px;
}

.luma-pet.hungry .pet-mouth {
  width: 12px;
  height: 12px;
  border: 3px solid #33283d;
  border-radius: 50%;
}

.luma-pet.sleepy .pet-eye {
  height: 7px;
  top: 32px;
  border-radius: 999px;
  animation: none;
}

.luma-pet::after {
  position: absolute;
  left: 50%;
  top: -28px;
  transform: translateX(-50%);
  z-index: 8;
  font-size: 30px;
  filter: drop-shadow(0 8px 10px rgba(95, 60, 120, 0.18));
  pointer-events: none;
}

.luma-pet.act-feed { animation: eatBounce 0.72s ease-in-out infinite; }
.luma-pet.act-feed::after { content: "🍓"; animation: emoteFloat 1.1s ease-in-out infinite; }

.luma-pet.act-play { animation: playJump 0.58s ease-in-out infinite; }
.luma-pet.act-play::after { content: "✨"; animation: emoteFloat 0.9s ease-in-out infinite; }
.luma-pet.act-play .pet-tail { animation-duration: 0.36s; }

.luma-pet.act-clean::after { content: "🫧"; animation: emoteFloat 1.05s ease-in-out infinite; }
.luma-pet.act-clean .pet-aura span { font-size: 22px; }

.luma-pet.act-sleep { animation: sleepSway 2.4s ease-in-out infinite; }
.luma-pet.act-sleep::after { content: "Zzz"; font-size: 22px; font-weight: 900; color: #6d5dfc; animation: emoteFloat 1.4s ease-in-out infinite; }
.luma-pet.act-sleep .pet-eye { height: 7px; top: 32px; border-radius: 999px; animation: none; }

.luma-pet.act-cuddle { animation: cuddlePulse 0.85s ease-in-out infinite; }
.luma-pet.act-cuddle::after { content: "💗"; animation: emoteFloat 1s ease-in-out infinite; }

.luma-pet.act-story::after { content: "📖"; animation: emoteFloat 1.2s ease-in-out infinite; }
.luma-pet.act-story .pet-aura { animation-duration: 3.6s; }

@keyframes eatBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-5px) scale(1.045, 0.965); }
}

@keyframes playJump {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-24px) rotate(4deg); }
}

@keyframes sleepSway {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(4px) rotate(2deg); }
}

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

@keyframes emoteFloat {
  0%, 100% { translate: 0 0; opacity: 0.9; }
  50% { translate: 0 -9px; opacity: 1; }
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-12px) rotate(1.2deg); }
}

.pet-aura {
  position: absolute;
  inset: -26px;
  pointer-events: none;
  opacity: 0.75;
  animation: auraSpin 9s linear infinite;
}

.pet-aura span {
  position: absolute;
  font-size: 16px;
  animation: twinkle 1.8s ease-in-out infinite alternate;
}

.pet-aura span:nth-child(1) { left: 8%; top: 28%; }
.pet-aura span:nth-child(2) { right: 8%; top: 8%; animation-delay: -0.5s; }
.pet-aura span:nth-child(3) { left: 26%; bottom: 4%; animation-delay: -1s; }
.pet-aura span:nth-child(4) { right: 18%; bottom: 18%; animation-delay: -1.3s; }

@keyframes auraSpin {
  from { transform: rotate(0); }
  to { transform: rotate(360deg); }
}

.pet-body {
  position: absolute;
  left: 18px;
  top: 38px;
  width: 136px;
  height: 144px;
  border-radius: 48% 48% 45% 45% / 50% 50% 42% 42%;
  background: var(--body);
  box-shadow:
    inset 12px 14px 20px rgba(255,255,255,0.28),
    inset -12px -12px 22px rgba(89, 54, 115, 0.10);
  animation: breathe 2.7s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(1.035); }
}

.pet-belly {
  position: absolute;
  left: 36px;
  bottom: 18px;
  width: 64px;
  height: 54px;
  border-radius: 50%;
  background: var(--belly);
  opacity: 0.84;
}

.pet-ear {
  position: absolute;
  top: 8px;
  width: 44px;
  height: 82px;
  background: var(--body);
  box-shadow: inset 8px 8px 12px rgba(255,255,255,0.25);
  z-index: -1;
  animation: earWiggle 2.8s ease-in-out infinite;
}

.pet-ear.left {
  left: 34px;
  transform-origin: bottom center;
  rotate: -18deg;
}

.pet-ear.right {
  right: 34px;
  transform-origin: bottom center;
  rotate: 18deg;
  animation-delay: -0.6s;
}

.pet-ear.bunny {
  border-radius: 999px 999px 40px 40px;
}

.pet-ear.leaf {
  width: 48px;
  height: 72px;
  border-radius: 100% 0 100% 0;
}

.pet-ear.star {
  clip-path: polygon(50% 0%, 64% 34%, 100% 38%, 72% 59%, 80% 96%, 50% 76%, 20% 96%, 28% 59%, 0 38%, 36% 34%);
  border-radius: 0;
}

.pet-ear.cloud {
  height: 56px;
  width: 62px;
  border-radius: 48% 52% 45% 48%;
}

.pet-ear.cat {
  height: 70px;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  border-radius: 10px;
}

.pet-ear.droop {
  height: 82px;
  border-radius: 999px 999px 18px 40px;
  top: 28px;
}

@keyframes earWiggle {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(5deg); }
}

.pet-tail {
  position: absolute;
  right: 2px;
  bottom: 54px;
  width: 50px;
  height: 50px;
  background: var(--accent);
  z-index: -2;
  animation: tailWag 1.6s ease-in-out infinite;
}

.pet-tail.star {
  clip-path: polygon(50% 0%, 62% 33%, 98% 35%, 70% 57%, 80% 92%, 50% 72%, 20% 92%, 30% 57%, 2% 35%, 38% 33%);
}

.pet-tail.puff {
  border-radius: 50%;
}

.pet-tail.leaf {
  border-radius: 100% 0 100% 0;
}

.pet-tail.comet {
  width: 68px;
  height: 36px;
  border-radius: 999px 999px 999px 10px;
}

.pet-tail.heart {
  transform: rotate(-45deg);
  border-radius: 12px 12px 0 12px;
}

.pet-tail.heart::before,
.pet-tail.heart::after {
  content: "";
  position: absolute;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: inherit;
}

.pet-tail.heart::before { left: 0; top: -24px; }
.pet-tail.heart::after { left: 24px; top: 0; }

.pet-tail.tiny {
  width: 34px;
  height: 34px;
  border-radius: 50%;
}

@keyframes tailWag {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(14deg); }
}

.pet-face {
  position: absolute;
  left: 0;
  right: 0;
  top: 46px;
  height: 64px;
}

.pet-eye {
  position: absolute;
  top: 20px;
  width: 24px;
  height: 30px;
  border-radius: 50%;
  background: #221a2c;
  overflow: hidden;
  animation: blink 4.2s infinite;
}

.pet-eye.left { left: 34px; }
.pet-eye.right { right: 34px; }

.pet-eye::before {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: white;
  top: 6px;
  left: 6px;
}

.pet-eye.sparkle::after,
.pet-eye.shine::after,
.pet-eye.moon::after {
  content: "";
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: white;
  bottom: 6px;
  right: 5px;
}

.pet-eye.sleepy {
  height: 7px;
  top: 32px;
  border-radius: 999px;
  animation: none;
}

.pet-eye.round {
  width: 28px;
  height: 28px;
}

@keyframes blink {
  0%, 92%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(0.08); }
}

.pet-mouth {
  position: absolute;
  left: 50%;
  top: 56px;
  width: 18px;
  height: 10px;
  border: 3px solid #33283d;
  border-top: 0;
  border-radius: 0 0 999px 999px;
  transform: translateX(-50%);
}

.pet-cheek {
  position: absolute;
  top: 54px;
  width: 22px;
  height: 13px;
  border-radius: 50%;
  background: var(--blush);
  opacity: 0.68;
}

.pet-cheek.left { left: 18px; }
.pet-cheek.right { right: 18px; }

.pet-pattern {
  position: absolute;
  inset: 0;
  color: var(--accent);
  opacity: 0.62;
  font-size: 16px;
  pointer-events: none;
}

.pet-pattern span:nth-child(1) { position: absolute; left: 30px; top: 36px; }
.pet-pattern span:nth-child(2) { position: absolute; right: 26px; top: 74px; }
.pet-pattern span:nth-child(3) { position: absolute; left: 54px; bottom: 38px; }

.pet-accessory {
  position: absolute;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  z-index: 6;
  font-size: 28px;
  animation: accessoryPop 2.8s ease-in-out infinite;
}

@keyframes accessoryPop {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -3px; }
}

.pet-shadow {
  position: absolute;
  left: 46px;
  right: 46px;
  bottom: -3px;
  height: 18px;
  border-radius: 50%;
  background: rgba(84, 55, 115, 0.16);
  filter: blur(2px);
  animation: shadow 3s ease-in-out infinite;
}

@keyframes shadow {
  0%, 100% { transform: scaleX(1); opacity: 0.18; }
  50% { transform: scaleX(0.78); opacity: 0.10; }
}

.mood-line {
  min-height: 44px;
  margin: 14px 0 12px;
  color: var(--muted);
  line-height: 1.45;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.stat {
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.stat-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 8px;
}

.stat-bar {
  height: 9px;
  border-radius: 999px;
  background: rgba(102, 82, 128, 0.10);
  overflow: hidden;
}

.stat-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff8fab, #b388ff, #70d6ff);
  transition: width 0.45s ease;
}

.actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.actions-grid button {
  background: rgba(255, 255, 255, 0.66);
  box-shadow: 0 10px 22px rgba(77, 47, 104, 0.08);
}

.center-column {
  display: grid;
  gap: 18px;
}

.visit-panel {
  min-height: 240px;
}

.chat-box {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}

.messages {
  min-height: 230px;
  max-height: 330px;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.48);
}

.message {
  max-width: 82%;
  padding: 11px 13px;
  border-radius: 18px;
  background: white;
  box-shadow: 0 10px 24px rgba(77, 47, 104, 0.06);
}

.message.me {
  justify-self: end;
  background: linear-gradient(135deg, #ffeff7, #f1e8ff);
}

.message-author {
  display: block;
  color: var(--violet);
  font-size: 11px;
  font-weight: 950;
  margin-bottom: 4px;
}

.message p {
  margin: 0;
  line-height: 1.4;
}

.chat-form {
  grid-template-columns: 1fr auto;
}

.chat-form button,
.friend-form button,
.visit-button {
  background: linear-gradient(135deg, #b388ff, #70d6ff);
  color: white;
}

.memory-list {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow-y: auto;
}

.memory-item {
  padding: 13px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(255,255,255,0.65);
}

.memory-item p {
  margin: 0 0 5px;
  line-height: 1.45;
}

.memory-item time {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.friend-form {
  grid-template-columns: 1fr auto;
}

.friends-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.friend-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(255,255,255,0.68);
}

.friend-card strong {
  display: block;
  margin-bottom: 3px;
}

.friend-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: min(520px, calc(100vw - 28px));
  padding: 14px 18px;
  border-radius: 999px;
  background: rgba(51, 40, 61, 0.88);
  color: white;
  box-shadow: 0 18px 50px rgba(0,0,0,0.2);
  z-index: 30;
  animation: toastIn 0.25s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

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

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 1fr 1fr;
  }
  .friends-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 780px) {
  .game-screen {
    padding: 12px;
  }
  .topbar,
  .layout {
    grid-template-columns: 1fr;
  }
  .layout {
    display: grid;
  }
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .scene {
    min-height: 320px;
  }
  .pet-mount.companion {
    left: 72%;
  }
  .home-scene.has-companion #petMount {
    left: 30%;
  }
  .stats-grid,
  .actions-grid {
    grid-template-columns: 1fr;
  }
  .chat-form,
  .friend-form {
    grid-template-columns: 1fr;
  }
}

/* ==========================
   V3 polish: layout, language, hearts
   ========================== */
.layout {
  grid-template-columns: minmax(320px, 410px) minmax(520px, 1.45fr) minmax(320px, 380px);
}

.panel,
.center-column,
.friends-panel,
.pet-panel,
.visit-panel,
.memory-panel {
  min-width: 0;
}

.center-column {
  min-width: 0;
}

.memory-panel {
  min-height: 300px;
}

.friends-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 22px;
}

.friend-form {
  display: flex;
  gap: 10px;
  align-items: stretch;
  width: 100%;
}

.friend-form input {
  flex: 1 1 auto;
  min-width: 0;
}

.friend-form button {
  flex: 0 0 auto;
  min-width: 108px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.friends-tip {
  margin-top: 2px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255,255,255,0.65);
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.5;
}

.language-select {
  border: 0;
  border-radius: 999px;
  padding: 10px 13px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(77, 47, 104, 0.06);
  outline: none;
}

.chat-form {
  grid-template-columns: 1fr auto auto;
  align-items: stretch;
}

.heart-button {
  background: linear-gradient(135deg, #ff8fab, #ffc6ff) !important;
  color: white !important;
  min-width: 150px;
}

.heart-layer {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  overflow: hidden;
}

.floating-heart {
  position: absolute;
  font-size: clamp(24px, 3vw, 38px);
  filter: drop-shadow(0 10px 14px rgba(145, 67, 113, 0.24));
  animation: heartFly 1.55s ease-out forwards;
  will-change: transform, opacity;
}

@keyframes heartFly {
  0% {
    opacity: 0;
    transform: translate3d(0, 18px, 0) scale(0.65) rotate(0deg);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--x), -185px, 0) scale(1.35) rotate(var(--r));
  }
}

.luma-pet.act-cuddle .pet-aura span {
  color: #ff4d8d;
}

.luma-pet.act-cuddle .pet-tail {
  animation-duration: 0.55s;
}

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 1fr 1fr;
  }

  .friends-panel {
    grid-column: 1 / -1;
    position: static;
  }
}

@media (max-width: 780px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    flex-wrap: wrap;
  }

  .friend-form,
  .chat-form {
    grid-template-columns: 1fr;
    display: grid;
  }

  .friend-form button,
  .chat-form button,
  .heart-button {
    width: 100%;
    min-width: 0;
  }
}

/* ==========================
   V4 big content: no demo login, rituals, bag, gifts, expeditions
   ========================== */
.login-language {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 3;
}

.login-card {
  padding-top: 46px;
}

.layout {
  grid-template-columns: minmax(320px, 410px) minmax(560px, 1.5fr) minmax(330px, 385px);
}

.right-column {
  display: grid;
  gap: 18px;
  min-width: 0;
  position: sticky;
  top: 22px;
  align-self: start;
}

.right-column .friends-panel {
  position: static;
}

.lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(260px, 0.95fr);
  gap: 18px;
}

.compact-panel {
  min-height: 250px;
}

.small-button {
  padding: 9px 12px !important;
  border-radius: 15px !important;
  font-size: 12px;
  min-height: 38px;
}

.small-copy {
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 12px;
}

.evolution-card,
.bond-card,
.daily-item,
.daily-reward,
.inventory-item,
.active-expedition,
.expedition-card {
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid rgba(255, 255, 255, 0.66);
  box-shadow: 0 12px 30px rgba(77, 47, 104, 0.06);
}

.evolution-card {
  margin: 18px 0 2px;
  padding: 15px;
}

.mini-card-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
  margin-bottom: 12px;
}

.mini-card-title strong {
  color: var(--violet);
  background: rgba(179, 136, 255, 0.13);
  padding: 6px 10px;
  border-radius: 999px;
}

.evolution-main {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 13px;
  align-items: center;
}

.evolution-main p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.mystery-orb {
  width: 58px;
  height: 58px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 1000;
  font-size: 26px;
  background: linear-gradient(135deg, #ff8fab, #b388ff, #70d6ff);
  box-shadow: 0 16px 30px rgba(155, 92, 255, 0.22);
  animation: pulse 2.2s ease-in-out infinite;
}

.evolution-progress {
  margin-top: 13px;
}

.bond-card {
  padding: 14px;
  margin-top: 10px;
}

.bond-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.bond-grid span {
  display: block;
  text-align: center;
  padding: 9px;
  border-radius: 14px;
  background: rgba(255,255,255,0.58);
  color: var(--muted);
  font-weight: 850;
  font-size: 12px;
}

.daily-list,
.inventory-list,
.expedition-list {
  display: grid;
  gap: 10px;
}

.daily-item {
  padding: 12px;
}

.daily-item > div:first-child {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 9px;
}

.daily-item strong {
  font-size: 13px;
}

.daily-item span {
  color: var(--muted);
  font-weight: 900;
  font-size: 12px;
}

.daily-item.done {
  background: rgba(155, 246, 198, 0.28);
}

.daily-reward {
  padding: 12px;
  color: var(--muted);
  font-weight: 900;
  text-align: center;
  background: linear-gradient(135deg, rgba(255, 143, 171, 0.14), rgba(179, 136, 255, 0.14));
}

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

.inventory-item {
  min-height: 82px;
  padding: 11px;
  display: grid;
  align-content: center;
  gap: 4px;
  position: relative;
  overflow: hidden;
}

.inventory-item::after {
  content: "";
  position: absolute;
  right: -28px;
  top: -28px;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: rgba(255,255,255,0.45);
}

.inventory-item span {
  font-size: 24px;
}

.inventory-item strong {
  font-size: 12px;
  line-height: 1.2;
  position: relative;
  z-index: 1;
}

.inventory-item em {
  font-style: normal;
  color: var(--violet);
  font-weight: 950;
  font-size: 12px;
  position: absolute;
  right: 10px;
  bottom: 8px;
  z-index: 1;
}

.expedition-panel {
  min-height: 420px;
}

.expedition-status {
  margin-bottom: 12px;
}

.active-expedition {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.active-expedition strong {
  line-height: 1.35;
}

.active-expedition span {
  color: var(--muted);
  font-weight: 900;
}

.active-expedition.done {
  background: rgba(155, 246, 198, 0.28);
}

.expedition-card {
  padding: 13px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
}

.expedition-card strong {
  display: block;
  margin-bottom: 4px;
}

.expedition-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.friend-card small {
  display: block;
  margin-top: 4px;
  color: var(--violet);
  font-size: 11px;
  font-weight: 900;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
}

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 1fr 1fr;
  }

  .right-column {
    grid-column: 1 / -1;
    position: static;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 900px) {
  .lower-grid,
  .right-column {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .inventory-list {
    grid-template-columns: 1fr;
  }

  .expedition-card {
    grid-template-columns: 1fr;
  }

  .login-language {
    position: static;
    margin: 0 auto 16px;
    display: block;
    width: fit-content;
  }

  .login-card {
    padding-top: 28px;
  }
}
