:root {
  --fg: #0a0a0a;
  --muted: #737373;
  --hairline: #e8e8e8;
  --font: "Selecta", "Söhne", "Inter", ui-sans-serif, system-ui, -apple-system,
          "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--fg);
  background: #f4f4f4;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }

.stage {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}

/* ---------- Switcher ---------- */
.switcher {
  position: absolute;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 12px 28px rgba(0,0,0,0.06);
}

.sw-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 10px 10px;
  border-radius: 14px;
  color: var(--fg);
  min-width: 148px;
  transition: background 120ms ease;
}
.sw-item:hover { background: #f4f4f4; }
.sw-item[aria-selected="true"] {
  background: #0a0a0a;
  color: #fff;
}

.sw-icon {
  width: 32px; height: 32px;
  border-radius: 10px;
  background: #f4f4f4;
  display: grid;
  place-items: center;
  font-size: 16px;
  color: #e25757;
  position: relative;
  flex-shrink: 0;
}
.sw-item[aria-selected="true"] .sw-icon { background: rgba(255,255,255,0.12); }

.sw-icon.faces { background: #f4f4f4; }
.sw-icon.faces img {
  width: 18px; height: 18px;
  border-radius: 999px;
  object-fit: cover;
  border: 1.5px solid #fff;
  position: absolute;
}
.sw-icon.faces img:first-child { left: 5px; }
.sw-icon.faces img:last-child  { right: 5px; }

.sw-icon.mixed { background: #f4f4f4; overflow: hidden; }
.sw-icon.mixed span { color: #e25757; font-size: 13px; position: absolute; left: 6px; top: 4px; }
.sw-icon.mixed img {
  width: 16px; height: 16px; border-radius: 999px; object-fit: cover;
  position: absolute; right: 5px; bottom: 5px; border: 1.5px solid #fff;
}

.sw-icon.none { color: #b4b4b4; font-size: 18px; }

.sw-label {
  font-size: 14px;
  line-height: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

/* ---------- Card ---------- */
.card {
  width: 419px;
  background: #fff;
  border-radius: 24px;
  padding: 16px 16px 20px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 24px 48px rgba(0,0,0,0.06);
}

.preview {
  position: relative;
  aspect-ratio: 526 / 396;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  overflow: visible;
  background: #fff;
}
.preview-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 16px;
}

/* ---------- Bubbles (hearts + faces) ---------- */
.bubbles { position: absolute; pointer-events: none; overflow: visible; }

.bubbles-side {
  top: calc(-40% + 20px);
  right: 8px;
  bottom: calc(8% - 20px);
  width: 50px;
}

.face-cluster {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 74px;
  height: 74px;
  display: none;
  pointer-events: none;
}
body[data-effect="faces"] .face-cluster,
body[data-effect="mixed"] .face-cluster {
  display: block;
}

.face-slot {
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  overflow: hidden;
  background: #ddd;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2), 0 0 0 2px #fff;
  transform-origin: center;
}
.face-slot[data-slot="0"] { right: 0;    bottom: 0;  }
.face-slot[data-slot="1"] { right: 22px; bottom: 18px; }
.face-slot[data-slot="2"] { right: 40px; bottom: 4px; }

body[data-effect="mixed"] .face-cluster { right: auto; left: 10px; }
body[data-effect="mixed"] .face-slot[data-slot="0"] { right: auto; left: 0;    bottom: 0;  }
body[data-effect="mixed"] .face-slot[data-slot="1"] { right: auto; left: 22px; bottom: 18px; }
body[data-effect="mixed"] .face-slot[data-slot="2"] { right: auto; left: 40px; bottom: 4px; }
body[data-effect="mixed"] .face-slot.entering { animation: faceInLeft 0.55s cubic-bezier(0.22, 1, 0.36, 1) both; }
body[data-effect="mixed"] .face-slot.leaving  { animation: faceOutLeft 0.45s ease-in both; }

@keyframes faceInLeft {
  0%   { transform: translate(-8px, 14px) scale(0.5); opacity: 0; }
  60%  { transform: translate(0, 0)      scale(1.08); opacity: 1; }
  100% { transform: translate(0, 0)      scale(1);    opacity: 1; }
}
@keyframes faceOutLeft {
  0%   { transform: translate(0, 0)     scale(1);   opacity: 1; }
  100% { transform: translate(8px, -10px) scale(0.7); opacity: 0; }
}

.face-inner {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  animation: hover 3.6s ease-in-out infinite;
  animation-delay: var(--hover-delay, 0s);
}
.face-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.face-slot.entering { animation: faceIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) both; }
.face-slot.leaving  { animation: faceOut 0.45s ease-in both; pointer-events: none; }

@keyframes faceIn {
  0%   { transform: translate(8px, 14px) scale(0.5); opacity: 0; }
  60%  { transform: translate(0, 0)     scale(1.08); opacity: 1; }
  100% { transform: translate(0, 0)     scale(1);    opacity: 1; }
}
@keyframes faceOut {
  0%   { transform: translate(0, 0)      scale(1);   opacity: 1; }
  100% { transform: translate(-8px, -10px) scale(0.7); opacity: 0; }
}
@keyframes hover {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}

.bubble {
  position: absolute;
  left: 50%;
  bottom: 0;
  --dx: 0px;
  --scale: 1;
  --start-x: 0px;
  --dur: 2.8s;
  will-change: transform, opacity;
  animation:
    heartRise    var(--dur) linear forwards,
    heartFade    var(--dur) ease-out forwards;
}

.bubble {
  font-size: 32px;
  color: #e25757;
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(224, 84, 84, 0.35));
  text-shadow:
    0 1px 0 rgba(255,255,255,0.6),
    0 0 12px rgba(255, 120, 120, 0.4);
}

.face {
  width: 30px; height: 30px;
  border-radius: 999px;
  overflow: hidden;
  background: #ddd;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15), 0 0 0 2px #fff;
}
.face img { width: 100%; height: 100%; object-fit: cover; display: block; }

@keyframes heartRise {
  from { transform: translate(calc(-50% + var(--start-x)), 0)                              scale(calc(var(--scale) * 0.6)); }
  to   { transform: translate(calc(-50% + var(--start-x) + var(--dx)), -200%)              scale(calc(var(--scale) * 0.9)); }
}
@keyframes heartFade {
  0%   { opacity: 0; }
  12%  { opacity: 1; }
  75%  { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes facePop {
  0%   { transform: scale(0.4); opacity: 0; }
  60%  { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1);   opacity: 1; }
}

/* ---------- Title row ---------- */
.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding: 0 4px;
}

.app-info { display: flex; align-items: center; gap: 12px; min-width: 0; }

.orb {
  width: 56px; height: 56px;
  border-radius: 999px;
  background-size: cover;
  background-position: center;
  position: relative;
}

.names { min-width: 0; }
.name {
  font-size: 16px;
  line-height: 18px;
  font-weight: 400;
  color: var(--fg);
}
.author {
  font-size: 14px;
  line-height: 16px;
  color: var(--muted);
  font-weight: 400;
  margin-top: 2px;
}

.actions { display: flex; gap: 10px; align-items: center; }
.action {
  position: relative;
  display: inline-flex;
  align-items: center;
  color: var(--fg);
  padding: 6px 4px;
}
.action svg { width: 22px; height: 22px; }
.action span {
  font-size: 9px;
  font-weight: 500;
  position: relative;
  top: -9px;
  margin-left: -3px;
}

@media (max-width: 820px) {
  .stage {
    flex-direction: column;
    padding: 16px;
    gap: 16px;
  }
  .switcher {
    position: static;
    transform: none;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .sw-item { min-width: 0; }
  .sw-label { display: none; }
  .card { width: 100%; max-width: 419px; }
}
