/* Friends game: home, lobby, capture, vote, result, finish. */
#room { flex: 1; display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.usion-only { display: none; }
.usion-mode .usion-only { display: flex; }
.usion-mode .browser-only { display: none !important; }

/* Home: the title is the caption of a meme. */
.home { justify-content: center; gap: 20px; }
.poster { flex: none; width: 100%; aspect-ratio: 1; max-height: 36vh; max-height: 36dvh; border-radius: 24px; box-shadow: 6px 6px 0 var(--ink); transform: rotate(-1.5deg); }
.usion-mode .poster { max-height: 50vh; max-height: 50dvh; }
.poster > img { object-fit: cover; opacity: 0; animation: cut 6s steps(1, end) infinite; }
.poster > img:nth-child(2) { animation-delay: 2s; }
.poster > img:nth-child(3) { animation-delay: 4s; }
.poster .cap { --o: 3px; left: 14px; right: 14px; }
.poster .cap.top { top: 16px; font-size: clamp(38px, 13vw, 58px); }
.poster .cap.bottom { bottom: 16px; font-size: clamp(22px, 7vw, 30px); }
#room-code { text-transform: uppercase; letter-spacing: .14em; }

/* Lobby */
.code-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 14px 18px; border: var(--line); border-radius: 20px; background: var(--paper); }
.code-card strong { font-size: 36px; font-weight: 900; line-height: 1; letter-spacing: .12em; }
.title span { opacity: .55; }
.crew { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px 8px; padding-top: 14px; }
.crew li { display: grid; justify-items: center; align-content: start; gap: 7px; min-width: 0; text-align: center; }
.crew .face { position: relative; display: grid; place-items: center; width: min(100%, 70px); aspect-ratio: 1; border: var(--line); border-radius: 50%; background: var(--paper); font-size: 32px; font-weight: 900; line-height: 1; text-transform: uppercase; }
.crew .host .face::before { content: ''; position: absolute; left: 50%; top: -19px; width: 34px; height: 22px; transform: translateX(-50%); background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 34 22'%3E%3Cpath d='M4 19 2 5l8 6 7-9 7 9 8-6-2 14z' fill='%23ff4d8d' stroke='%23000' stroke-width='3' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; }
.crew .name { max-width: 100%; font-size: 15px; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.you.away { background: transparent; border: 2px solid var(--ink); color: var(--ink); }
.crew .away .face { opacity: .45; }
.you { display: inline-block; margin-left: 6px; padding: 2px 6px; border-radius: 6px; background: var(--ink); color: #fff; font-size: 12px; font-style: normal; font-weight: 800; line-height: 1.1; text-transform: uppercase; vertical-align: 2px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: auto; counter-reset: step; }
.steps li { display: grid; justify-items: center; gap: 6px; counter-increment: step; font-size: 16px; font-weight: 700; line-height: 1.15; text-align: center; }
.steps li::before { content: counter(step); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: var(--sun); font-size: 20px; font-weight: 900; }
#lobby .dock { margin-top: 6px; }

/* Round count: the host picks, everyone sees the choice. */
.rounds-pick { display: flex; align-items: center; gap: 8px; margin-top: auto; }
.rounds-pick .title { margin-right: auto; }
.rounds-pick button { width: 52px; height: 46px; border: var(--line); border-radius: 14px; background: var(--paper); font-size: 22px; font-weight: 900; box-shadow: 0 3px 0 var(--ink); }
.rounds-pick button[aria-pressed=true] { background: var(--punch); }
.rounds-pick button:disabled { box-shadow: none; }
.rounds-pick button:disabled:not([aria-pressed=true]) { opacity: .4; }
.rounds-pick + .steps { margin-top: 0; }

/* Capture */
.meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 20px; }
.meta .hint:last-child { margin-left: auto; font-variant-numeric: tabular-nums; }
.cam.sent::before { content: ''; position: absolute; z-index: 2; top: 10px; right: 10px; width: 46px; height: 46px; border: var(--line); border-radius: 50%; background: var(--punch) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5' fill='none' stroke='%23000' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 26px no-repeat; }

/* Vote and result: the meme is the first tile, everyone's photo follows at the same size. */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
.shot { position: relative; display: block; width: 100%; aspect-ratio: 1; margin: 0; padding: 0; overflow: hidden; border: var(--line); border-radius: 18px; background: var(--ink); color: #fff; }
.shot > img { width: 100%; height: 100%; object-fit: cover; }
.shot > img:not([src]) { visibility: hidden; }
.shot.orig > img { object-fit: contain; }
.shot .cap { left: 8px; right: 8px; bottom: 9px; font-size: 20px; }
button.shot { box-shadow: 0 4px 0 var(--ink); transition: transform .06s, box-shadow .06s, opacity .15s; }
button.shot:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 0 0 var(--ink); }
button.shot[aria-pressed=true], .shot.lead { border-color: var(--punch); box-shadow: 0 0 0 4px var(--punch); }
.voted button.shot[aria-pressed=false] { opacity: .45; box-shadow: none; }
/* The meme is only the reference: a badge, no button shadow. Votable photos carry a tick circle. */
.shot.orig::before { content: 'MEME'; position: absolute; z-index: 1; top: 8px; left: 8px; padding: 4px 9px; border: var(--line); border-radius: 12px; background: var(--punch); color: var(--ink); font-size: 15px; font-weight: 900; line-height: 1; }
button.shot::after { content: ''; position: absolute; top: 8px; right: 8px; width: 38px; height: 38px; border: var(--line); border-radius: 50%; background: rgba(255,255,255,.85) center / 22px no-repeat; }
button.shot[aria-pressed=true]::after { background-color: var(--punch); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5' fill='none' stroke='%23000' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.votes { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; min-width: 42px; height: 42px; padding: 0 8px; border: var(--line); border-radius: 21px; background: var(--paper); color: var(--ink); font-size: 24px; font-weight: 900; line-height: 1; }
.lead .votes { background: var(--punch); }
.scores { display: grid; gap: 8px; }
.scores li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 52px; padding: 6px 18px 6px 12px; border: var(--line); border-radius: 16px; background: var(--paper); font-size: 18px; font-weight: 700; line-height: 1.15; }
.scores .rank { font-size: 20px; font-weight: 900; text-align: center; }
.scores .who { overflow-wrap: anywhere; }
.scores strong { font-size: 26px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
#finished { justify-content: center; }
#finished .dock { margin-top: 10px; }

@keyframes cut { 0% { opacity: 1; } 33.4% { opacity: 0; } }
@media (max-width: 340px) {
  .code-card strong { font-size: 30px; }
  .crew .face { font-size: 26px; }
  .shot .cap { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  .poster > img { animation: none; }
  .poster > img:first-child { opacity: 1; }
}
