/* The pile (pile.js): the hangout's chat as one shared stack in the room
   (Elliott, 2026-10-08). The faces strip and the pile read as one room box, the
   message box sits at its bottom, and a video someone plays sits at the top of
   the pile, never covered by it. Loaded after bloom.css, which owns the chat
   panel's position and its keyboard handling. */
.call.chat-open .chat.open {
  background: var(--bloom-surface); border: 0;
}
/* One room box: the strip of faces runs straight into the pile below it. */
.call.chat-open.table-mode:not(.typing):not(.keyboard-open) .pucks { border-radius: 28px 28px 0 0; }
.call.chat-open.table-mode:not(.typing):not(.keyboard-open) .chat.open {
  top: calc(var(--call-heading-height, 72px) + var(--chat-strip-height)) !important;
  border-radius: 0 0 28px 28px;
}
/* No header: the pile's hint carries "disappears when the hangout ends". A small × in the
   corner closes it, as the chat button does: with the keyboard up the controls tuck away, and
   the way out must never be hidden (Elliott, 2026-10-17). */
.call.chat-open .chat.open .chat-footnote { display: none; }
.call.chat-open .chat.open #close-chat { position: absolute; top: 8px; right: 8px; z-index: 9; margin: 0; background: #fff; box-shadow: 0 1px 3px #0002; }
/* A video playing together starts below the ×, so its Stop button is never under it. */
.call.chat-open.watching .chat.open .watch-player { margin-top: 52px; }
.call.chat-open .chat.open #chat-history-panel { border-top: 0 !important; position: relative !important; }
/* The plain list is for screen readers; the pile is what you see. */
.call.chat-open .chat.open #messages {
  position: absolute !important; width: 1px; height: 1px; padding: 0 !important; margin: -1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; border: 0; animation: none;
}
.call.chat-open .chat.open #chat-form { border-top: 0 !important; align-items: center !important; }
.call.chat-open .chat.open #message { background: #fff; box-shadow: 0 1px 3px #0002; }
.chat:not(.open) .pile-attach { display: none; }

/* The space the pile has, between the video (if any) and the message box. */
.pile-area { position: relative; flex: 1; min-height: 0; }
.pile { position: absolute; inset: 0; }
.pile-hint { margin: 0; padding: 2px 12px 4px; text-align: center; font-size: 13px; line-height: 1.3; color: var(--bloom-muted); }
.pile-count { border: 0; margin-left: 6px; padding: 3px 9px; border-radius: 10px; background: #fff; color: var(--bloom-ink); font: inherit; font-size: 13px; font-weight: 700; box-shadow: 0 1px 2px #0002; }
.pile-count[hidden] { display: none; }

.pile-card {
  position: absolute; left: 50%; top: 50%; width: 220px; box-sizing: border-box;
  background: #fff; color: var(--bloom-ink); border-radius: 16px;
  box-shadow: 0 1px 2px #0000000f, 0 10px 24px #00000024;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: grab;
  will-change: transform; transform: translate(-50%, -50%);
}
.pile-card:focus-visible { outline: 3px solid #5b8cff; outline-offset: 2px; }
.pile-card.note { width: auto; min-width: 120px; max-width: 230px; padding: 11px 14px 13px; font-size: 16px; line-height: 1.35; }
.pile-card.note.mine { background: #e1e8d2; }
.pile-text { overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 8; -webkit-box-orient: vertical; overflow: hidden; }
.pile-link { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.pile-card.pic { padding: 8px 8px 10px; }
.pile-media { position: relative; overflow: hidden; border-radius: 9px; line-height: 0; background: #ddd; }
.pile-media img { display: block; width: 100%; max-height: 260px; object-fit: cover; pointer-events: none; }
.pile-card.link .pile-media img { aspect-ratio: 16 / 9; }
.pile-who { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 12px; font-weight: 650; line-height: 1; color: var(--bloom-muted); }
.pile-card.pic .pile-who { margin: 9px 2px 0; }
.pile-who img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.pile-play { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; translate: -50% -50%; border-radius: 50%; background: #000a; }
.pile-play::after { content: ""; position: absolute; left: 18px; top: 13px; border-left: 15px solid #fff; border-top: 10px solid transparent; border-bottom: 10px solid transparent; }
.pile-duration { position: absolute; left: 8px; bottom: 8px; padding: 4px 7px; border-radius: 9px; background: #000a; color: #fff; font-size: 11px; font-weight: 600; line-height: 1; }
.pile-title { margin: 8px 3px 0; font-size: 14px; font-weight: 650; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pile-site { margin: 3px 3px 0; font-size: 12px; color: var(--bloom-muted); }
.pile-watch { display: block; width: calc(100% - 4px); margin: 9px 2px 0; padding: 9px; border: 0; border-radius: 12px; background: var(--bloom-ink); color: #fff; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.pile-card.playing .pile-watch { background: var(--bloom-control); color: var(--bloom-ink); }
.pile-card.playing .pile-media::after { content: "▲ Playing up top"; position: absolute; inset: 0; display: grid; place-items: center; background: #0008; color: #fff; font-size: 13px; font-weight: 700; line-height: 1.2; }
.pile-card.sending .pile-media img { opacity: .55; }
.pile-sending { position: absolute; left: 50%; top: 50%; translate: -50% -50%; padding: 5px 10px; border-radius: 10px; background: #000a; color: #fff; font-size: 12px; font-weight: 700; line-height: 1.2; }

/* See all: everything shared so far, newest first, in two columns. */
.pile.spread { display: grid; grid-template-columns: 1fr 1fr; align-content: start; align-items: start; gap: 10px; padding: 10px; overflow-y: auto; overscroll-behavior: contain; }
.pile.spread .pile-card { position: static; width: auto; min-width: 0; max-width: none; transform: none !important; cursor: pointer; touch-action: auto; }
.pile.spread .pile-card.note { font-size: 14px; }

/* The photo button, inside the message box's row. */
.pile-attach { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 22px; background: #fff; box-shadow: 0 1px 3px #0002; cursor: pointer; }
.pile-attach svg { width: 22px; height: 22px; fill: none; stroke: var(--bloom-ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pile-attach input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.pile-attach:focus-within { outline: 3px solid #5b8cff; outline-offset: 2px; }
/* A picked photo or video waits here, as a small picture, until Send. */
.pile-attach { position: relative; }
.pile-attach.staged { border-radius: 12px; background: #000; }
.pile-attach.staged svg { display: none; }
.pile-staged { width: 100%; height: 100%; border-radius: 12px; object-fit: cover; }
.pile-attach.video::after { content: ""; position: absolute; left: 17px; top: 14px; border-left: 13px solid #fff; border-top: 8px solid transparent; border-bottom: 8px solid transparent; filter: drop-shadow(0 1px 2px #0008); pointer-events: none; }
.pile-attach.preparing svg { opacity: .35; }
.pile-unstage { position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; padding: 0; border: 2px solid #fff; border-radius: 50%; background: var(--bloom-ink); color: #fff; font: inherit; font-size: 14px; font-weight: 700; line-height: 1; cursor: pointer; }
.pile-unstage[hidden] { display: none; }
.pile-unstage::before { content: ""; position: absolute; inset: -10px; }

/* Watching together: the video sits at the top of the pile, the faces shrink
   to a smaller strip above it, and the pile keeps whatever room is left. */
.call.chat-open.watching { --chat-strip-height: 64px; }
.call.chat-open.watching:has(.pucks > .tile.has-audio-status) { --chat-strip-height: 96px; }
.watch-player { position: relative; flex: none; margin: 8px 8px 0; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; background: #000; box-shadow: 0 1px 2px #0000000f, 0 10px 24px #00000024; }
.watch-player[hidden] { display: none; }
.watch-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
/* Taps on the picture play or pause for everyone; YouTube's player only gets one when it needs a tap to start. */
.watch-tap { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.watch-tap[hidden] { display: none; }
.watch-who { position: absolute; top: 10px; left: 12px; padding: 4px 9px; border-radius: 10px; background: #0009; color: #fff; font-size: 12px; font-weight: 600; pointer-events: none; transition: opacity .4s; }
.watch-who.faded { opacity: 0; }
.watch-round { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%; background: #0009; color: #fff; font-size: 15px; cursor: pointer; }
.watch-stop { position: absolute; top: 8px; right: 8px; }
.watch-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 10px; padding: 18px 12px 8px; background: linear-gradient(transparent, #000a); color: #fff; font-size: 12px; font-variant-numeric: tabular-nums; }
.watch-toggle { flex: none; width: 30px; height: 30px; border: 0; background: none; color: #fff; font-size: 15px; cursor: pointer; }
.watch-track { flex: 1; height: 18px; display: flex; align-items: center; background: linear-gradient(#fff5, #fff5) center / 100% 4px no-repeat; cursor: pointer; }
.watch-track span { display: block; height: 4px; width: 0; border-radius: 2px; background: #fff; }
.watch-time { flex: none; }
/* The video's own play button takes the tap: this note only points at it. */
.watch-blocked { position: absolute; left: 50%; bottom: 44px; translate: -50% 0; padding: 6px 12px; border-radius: 12px; background: #000c; color: #fff; font-size: 13px; font-weight: 700; white-space: nowrap; pointer-events: none; }
.watch-blocked[hidden], .watch-problem[hidden] { display: none; }
.watch-problem { position: absolute; inset: 0; display: grid; place-content: center; gap: 8px; padding: 16px; background: #000d; color: #fff; text-align: center; font-size: 14px; }
.watch-problem a { color: #fff; font-weight: 700; }

/* While a video plays, new lines pop up just under it, never over it. */
.pile-pops { position: absolute; left: 10px; right: 10px; top: 8px; z-index: 50; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; pointer-events: none; }
.pile-pop { display: flex; align-items: center; gap: 7px; max-width: 100%; box-sizing: border-box; padding: 6px 12px 6px 6px; border-radius: 18px; background: #fffffff2; color: var(--bloom-ink); font-size: 14px; line-height: 1.3; box-shadow: 0 4px 14px #0002; }
.pile-pop.mine { background: #e9f0dcf2; }
.pile-pop img { flex: none; width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.pile-pop span { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pile-pop b { margin-right: 4px; font-weight: 700; }
.call.watching .pile { top: 30px; }
/* Starting or stopping a video: the strip of faces resizes on the same curve as
   the chat box under it and the video opening (pile.js slide), so nothing jumps. */
.call.chat-open.table-mode:not(.typing):not(.keyboard-open) .pucks { transition: height 240ms cubic-bezier(.22, .8, .22, 1); }
.pile { transition: top 240ms cubic-bezier(.22, .8, .22, 1); }
@media (prefers-reduced-motion: reduce) { .call.chat-open.table-mode .pucks, .pile { transition: none; } }

/* Typing while a video plays: the video, the lines under it and the message box
   fill what the keyboard leaves; the faces and the pile step aside for now. */
.call.chat-open.typing.watching { --typing-strip: 0px; }
.call.chat-open.typing.watching .pucks { visibility: hidden; }
.call.chat-open.typing.watching .pile, .call.chat-open.typing.watching .pile-hint { visibility: hidden; }
.call.chat-open.keyboard-open.watching .pile, .call.chat-open.keyboard-open.watching .pile-hint { visibility: hidden; }

/* A photo or video opened from the pile: full screen, for you only. */
.pile-viewer { position: fixed; inset: 0; z-index: 2147483000; display: flex; flex-direction: column; background: #0d0d0d; color: #fff; }
.pile-viewer header { display: flex; align-items: center; gap: 10px; padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 12px; }
.pile-viewer header div { flex: 1; font-weight: 650; }
.pile-viewer header small { display: block; color: #fffa; font-size: 12px; font-weight: 500; }
.pile-viewer-close { width: 40px; height: 40px; border: 0; border-radius: 50%; background: #fff2; color: #fff; font-size: 18px; }
.pile-viewer-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding-bottom: env(safe-area-inset-bottom, 0px); }
.pile-viewer-stage img, .pile-viewer-stage video { display: block; max-width: 100%; max-height: 100%; }
@media (prefers-reduced-motion: reduce) { .pile-card, .watch-who { transition: none !important; } }

/* The chat button's little pile: something is waiting in the chat. Its top card
   shows the newest photo when there is one; new lines from others still get
   their count on top. */
.chat-pile { position: absolute; top: -5px; right: -7px; width: 24px; height: 21px; pointer-events: none; }
.chat-pile[hidden] { display: none; }
.chat-pile i { position: absolute; inset: 0; border-radius: 4px; background: #fff; box-shadow: 0 1px 3px #0000003d; }
.chat-pile i:first-child { transform: translate(-3px, 2px) rotate(-13deg); }
.chat-pile i:last-child {
  transform: rotate(8deg); padding: 3px; box-sizing: border-box;
  background: linear-gradient(#c9ccc2, #c9ccc2) 5px 6px / 13px 2px no-repeat, linear-gradient(#c9ccc2, #c9ccc2) 5px 11px / 9px 2px no-repeat, #fff;
}
.chat-pile.picture i:last-child { background: #fff; }
.chat-pile img { display: none; width: 100%; height: 100%; border-radius: 2px; object-fit: cover; }
.chat-pile.picture img { display: block; }
.call #chat-button .unread { z-index: 1; }
/* With the little pile showing, the count sits on its lower corner so the picture shows. */
.call #chat-button .chat-pile:not([hidden]) + .unread { top: 11px; right: -11px; box-shadow: 0 0 0 2px var(--bloom-canvas, #fff); }
@media (prefers-reduced-motion: no-preference) {
  .chat-pile:not([hidden]) { animation: chat-pile-in .3s ease-out; }
}
@keyframes chat-pile-in { from { opacity: 0; transform: translateY(4px) scale(.7); } }
