/* Say hi — floating host greeting. Self-contained palette (matches /card) so it
   reads the same over every blade's background. Transform + opacity only. */
@font-face {
  font-family: 'Bungee';
  font-display: swap;
  src: url(../card/assets/fonts/Bungee-400.woff2) format('woff2');
}

.say-hi {
  --sh-night: #0f0f1a;
  --sh-orange: #ff6b35;
  --sh-teal: #4ecdc4;
  --sh-yellow: #ffe66d;
  --sh-cream: #fbf8f4;
  --sh-muted: #a7a3b8;
  position: fixed;
  /* --say-hi-right-rail: width of the desktop right-hand blades (set by say-hi.js)
     so the button sits in the content area, never over the nav. */
  right: calc(var(--say-hi-right-rail, 0px) + max(16px, env(safe-area-inset-right, 0px)));
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  font-family: 'Chivo Mono', ui-monospace, monospace;
  opacity: 0;
  transform: translateY(24px) scale(0.9);
  transition: opacity 420ms ease, transform 520ms cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}
.say-hi.is-in { opacity: 1; transform: none; }
.say-hi > * { pointer-events: auto; }

.say-hi__fab {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 4px 18px 4px 4px;
  border: 3px solid var(--sh-night);
  border-radius: 999px;
  background: var(--sh-yellow);
  color: var(--sh-night);
  font: 400 16px/1 'Bungee', system-ui, sans-serif;
  letter-spacing: 0.02em;
  box-shadow: 4px 4px 0 var(--sh-night);
  cursor: pointer;
  transition: transform 160ms ease;
  animation: say-hi-nudge 5s ease-in-out 1.5s infinite;
}
.say-hi__fab:active { transform: translate(2px, 2px); }
.say-hi.is-open .say-hi__fab { animation: none; }
.say-hi__fab-face {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 18%;
  background: var(--sh-teal);
  border: 2px solid var(--sh-night);
}

.say-hi__panel {
  position: relative;
  width: min(340px, calc(100vw - 32px));
  padding: 18px 18px 16px;
  border: 3px solid var(--sh-night);
  border-radius: 18px;
  background: var(--sh-night);
  color: var(--sh-cream);
  box-shadow: 6px 6px 0 var(--sh-orange);
  transform-origin: 100% 100%;
  animation: say-hi-pop 380ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.say-hi__panel[hidden] { display: none; }

.say-hi__close {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 44px;
  height: 44px;
  border: 0;
  background: none;
  color: var(--sh-muted);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.say-hi__host { position: relative; width: 96px; height: 96px; margin: 0 auto 10px; }
.say-hi__face {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 18%;
  background: var(--sh-teal);
  border: 3px solid var(--sh-yellow);
  transition: transform 200ms ease;
}
.say-hi.is-talking .say-hi__face { animation: say-hi-talk 360ms ease-in-out infinite alternate; }

/* The lobby's "customizing your audio" mic: pulses while their clip bakes. */
.say-hi__mic {
  position: absolute;
  right: -4px;
  bottom: 2px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--sh-orange) center / 16px no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%230f0f1a'%3E%3Cpath d='M12 15a3 3 0 0 0 3-3V6a3 3 0 1 0-6 0v6a3 3 0 0 0 3 3zm5-3a5 5 0 0 1-10 0H5a7 7 0 0 0 6 6.92V21h2v-2.08A7 7 0 0 0 19 12z'/%3E%3C/svg%3E");
  border: 2px solid var(--sh-night);
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 240ms ease, transform 240ms ease;
}
.say-hi.is-baking .say-hi__mic { opacity: 1; transform: scale(1); animation: say-hi-pulse 1.1s ease-in-out infinite; }

.say-hi__line {
  margin: 0 0 12px;
  text-align: center;
  font-size: 14px;
  line-height: 1.4;
  min-height: 2.8em;
}

.say-hi__form { display: flex; gap: 8px; }
.say-hi__input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 0 12px;
  border: 2px solid var(--sh-muted);
  border-radius: 10px;
  background: #1b1b2b;
  color: var(--sh-cream);
  font: inherit;
  font-size: 16px; /* 16px stops iOS zooming the page on focus */
}
.say-hi__input:focus { outline: none; border-color: var(--sh-teal); }
.say-hi__go {
  min-height: 44px;
  padding: 0 16px;
  border: 2px solid var(--sh-night);
  border-radius: 10px;
  background: var(--sh-orange);
  color: var(--sh-night);
  font: 400 14px/1 'Bungee', system-ui, sans-serif;
  cursor: pointer;
}
.say-hi__go:active { transform: translate(1px, 1px); }

@keyframes say-hi-pop { from { opacity: 0; transform: scale(0.6) translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes say-hi-nudge { 0%, 88%, 100% { transform: none; } 92% { transform: rotate(-4deg) scale(1.05); } 96% { transform: rotate(4deg) scale(1.05); } }
@keyframes say-hi-talk { from { transform: scale(1) rotate(-1.5deg); } to { transform: scale(1.06) rotate(1.5deg); } }
@keyframes say-hi-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }

@media (prefers-reduced-motion: reduce) {
  .say-hi, .say-hi__fab, .say-hi__panel, .say-hi__face, .say-hi__mic { animation: none !important; transition: none !important; }
}
