/* Shared by the planet and the wedding hall, linked before the page sheet (which owns the colour tokens):
   name tags + chat bubbles, fields + buttons, the name dialog, the chat dock, the capture button.
   shortcut: wedding.css still carries its own identical copy of the tag / field / dialog / dock rules (it wins there,
   being linked later); delete that copy from wedding.css when the hall's sheet is next edited. */

:root { --shadow-soft: 0 2px 0 rgba(59, 47, 51, .12), 0 8px 20px rgba(59, 47, 51, .14); --dock-h: 60px; }
.name-dialog[hidden], .chat[hidden], .chat-log[hidden] { display: none; }

/* ---------- name tags + bubbles (projected each frame) ---------- */
.labels { position: fixed; inset: 0; pointer-events: none; z-index: 2; overflow: hidden; }
.label {
  position: absolute; left: 0; top: 0;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  will-change: transform;
}
.label.is-hidden { visibility: hidden; }
.tag {
  padding: 3px 10px; border-radius: var(--r-pill);
  background: var(--sign); color: var(--ink);
  font-weight: 600; font-size: 14px; line-height: 1.3; white-space: nowrap;
  box-shadow: 0 2px 0 rgba(59, 47, 51, .14), 0 4px 10px rgba(59, 47, 51, .12);
}
.label.is-me .tag { background: var(--butter); }
.bubble {
  position: relative; max-width: 220px; width: max-content;
  padding: 8px 14px; border-radius: 18px;
  background: var(--input); color: var(--ink);
  font-size: 16px; line-height: 1.35; text-align: center; text-wrap: pretty; overflow-wrap: anywhere;
  outline: 2px dashed var(--stitch); outline-offset: -5px;
  box-shadow: var(--shadow-soft);
  opacity: 0; transform: translateY(6px) scale(.96); transform-origin: 50% 100%;
  transition-property: opacity, transform; transition-duration: 400ms; transition-timing-function: ease-in;
}
.bubble::after {
  content: ""; position: absolute; left: 50%; bottom: -9px; width: 18px; height: 10px; margin-left: -9px;
  background: inherit; clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.bubble.is-on { opacity: 1; transform: none; transition-duration: 150ms; transition-timing-function: var(--ease-out); }
.label.is-me .bubble { background: var(--butter); }
.bubble:empty { display: none; }

/* ---------- shared field + buttons ---------- */
.field {
  width: 100%; height: 48px; padding: 0 18px; border-radius: 24px;
  background: var(--input); color: var(--ink); border: 2px dashed var(--stitch);
  font: 400 16px/1 var(--font-body); appearance: none;
}
.field::placeholder { color: var(--muted); opacity: 1; }
.field:focus-visible { outline: 3px solid var(--berry-deep); outline-offset: 2px; }
.btn {
  height: 48px; padding: 0 22px; border: 0; border-radius: var(--r-pill);
  background: var(--berry-deep); color: var(--sign);
  font: 600 16px/1 var(--font-body); cursor: pointer;
  transition-property: transform, opacity; transition-duration: 140ms; transition-timing-function: ease-out;
}
.btn:active { transform: scale(.96); }

/* ---------- name dialog ---------- */
.name-dialog {
  position: fixed; inset: 0; z-index: 10;
  display: grid; place-items: center; padding: 16px;
  background: rgba(31, 35, 42, .32);
  transition: opacity 300ms var(--ease-out);
}
.name-dialog.is-leaving { opacity: 0; pointer-events: none; }
.name-card {
  width: min(320px, 100%); padding: 26px 22px 22px; border-radius: var(--r-card);
  display: flex; flex-direction: column; gap: 14px;
  background: var(--cream); box-shadow: var(--shadow);
  outline: 2px dashed var(--stitch); outline-offset: -10px;
  animation: card-in 420ms var(--ease-out) both;
}
.name-title {
  margin: 0 0 4px; text-align: center; text-wrap: balance;
  font: 400 24px/1.25 var(--font-display); color: var(--ink);
}
@keyframes card-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* ---------- chat dock ---------- */
.chat {
  position: fixed; z-index: 5; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom));
  width: min(560px, 100% - 24px); transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px;
}
.chat-log {
  max-height: calc(5 * 1.45em + 20px); overflow: hidden; padding: 10px 14px; border-radius: 20px;
  background: rgba(251, 243, 228, .94); box-shadow: var(--shadow-soft);
  font-size: 16px; line-height: 1.45; overscroll-behavior: contain;
  display: flex; flex-direction: column;
}
.chat-log.is-overflow {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 1.2em);
          mask-image: linear-gradient(to bottom, transparent 0, #000 1.2em);
}
.chat-log:focus-within, .chat-log:focus { overflow-y: auto; -webkit-mask-image: none; mask-image: none; }
.chat-log:focus-visible { outline: 3px solid var(--berry-deep); outline-offset: 2px; }
.chat-line { margin: 0; overflow-wrap: anywhere; text-wrap: pretty; animation: line-in 220ms var(--ease-out) both; }
.chat-line:first-child { margin-top: auto; }
.chat-name { font-weight: 600; color: var(--berry-deep); margin-right: .45em; }
@keyframes line-in { from { opacity: 0; transform: translateY(4px); } }
.chat-row { display: flex; gap: 8px; align-items: center; }
.chat-row .field { flex: 1; min-width: 0; box-shadow: var(--shadow-soft); }
.send {
  flex: 0 0 44px; width: 44px; height: 44px; border: 0; border-radius: 50%; padding: 0;
  display: grid; place-items: center;
  background: var(--berry-deep); color: var(--sign); cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition-property: transform, opacity; transition-duration: 140ms; transition-timing-function: ease-out;
}
.send svg { margin-top: -1px; }
.send:active:not(:disabled) { transform: scale(.94); }
.send:disabled { opacity: .45; cursor: default; }
/* touch controls sit above the dock on any page that has one (the hall's sheet sets the same) */
.chat ~ .mp-joy { bottom: calc(16px + var(--dock-h) + 8px + env(safe-area-inset-bottom)); }
.chat ~ .mp-jump { bottom: calc(16px + var(--dock-h) + 48px + env(safe-area-inset-bottom)); }

/* ---------- capture button (js/capture.js places it left of 화질) + the blink over the page ---------- */
.shot {
  position: fixed; z-index: 6; top: calc(16px + env(safe-area-inset-top)); right: calc(68px + env(safe-area-inset-right));
  width: 44px; height: 44px; border: 0; padding: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center;
  background: var(--butter); color: var(--ink);
  outline: 2px dashed var(--stitch); outline-offset: -6px;
  box-shadow: 0 2px 0 rgba(59, 47, 51, .12), 0 8px 20px rgba(59, 47, 51, .14);
  transition-property: transform; transition-duration: 160ms; transition-timing-function: ease-out;
}
.shot:hover { transform: translateY(-2px); }
.shot:active { transform: scale(.96); transition-duration: 90ms; }
.shot:focus-visible { outline: 3px solid var(--berry-deep); outline-offset: 2px; }
.flash { position: fixed; inset: 0; z-index: 30; background: #fffaf3; opacity: 0; pointer-events: none; }
.flash.is-on { animation: shot-flash 360ms ease-out; }
@keyframes shot-flash { from { opacity: .85; } to { opacity: 0; } }
@keyframes shot-dim { from { opacity: .3; } to { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .name-dialog, .bubble, .btn, .send, .shot { transition-duration: 1ms !important; }
  .name-card, .chat-line { animation: none; }
  .bubble, .shot:hover, .shot:active { transform: none; }
  .flash.is-on { animation-name: shot-dim; } /* a dim blink, not a white flash */
}
