/* Gifts: the picker sheet and the moment of arrival. Palette and radii follow
   css/style.css (maroon wood, warm cream, gold). */

/* ── the picker ─────────────────────────────────────────────── */
.gift-sheet-wrap { position: fixed; inset: 0; z-index: 70; }
.gift-sheet-wrap[hidden] { display: none; }
.gift-scrim { position: absolute; inset: 0; background: rgba(12, 4, 3, .55); opacity: 0; transition: opacity .2s; }
.gift-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; height: min(86vh, 680px); display: flex; flex-direction: column;
  padding: 8px 14px calc(14px + var(--sab, env(safe-area-inset-bottom, 0px))); border-radius: 22px 22px 0 0;
  border: 1px solid var(--edge); border-bottom: 0;
  background: radial-gradient(120% 60% at 50% 0%, rgba(255, 214, 120, .14), transparent 60%), linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: 0 -16px 48px rgba(0, 0, 0, .65);
  transform: translateY(100%); transition: transform .24s cubic-bezier(.2, .8, .2, 1);
}
.gift-sheet-wrap.is-open .gift-scrim { opacity: 1; }
.gift-sheet-wrap.is-open .gift-sheet { transform: translateY(0); }
.gift-grab { width: 40px; height: 4px; border-radius: 4px; background: var(--edge); margin: 2px auto 8px; }
.gift-head { display: flex; align-items: center; justify-content: space-between; }
.gift-head h2 { margin: 0; font-size: 18px; font-family: var(--serif, Georgia, serif); color: var(--ink); }
.gift-to { display: flex; align-items: center; gap: 8px; overflow-x: auto; padding: 8px 0 4px; scrollbar-width: none; }
.gift-to-label { font-size: 12px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .08em; }
.gift-who {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 4px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--edge-soft); background: var(--well); color: var(--ink); font: inherit; font-size: 13px; cursor: pointer;
}
.gift-who i { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 700; font-size: 12px; color: #3a1d00; background: linear-gradient(180deg, #f6d98a, #c9962b); }
.gift-who.is-on { border-color: #e6b94f; box-shadow: 0 0 0 1px rgba(230, 185, 79, .5) inset; }
.gift-who.is-fixed { cursor: default; }
.gift-tabs { display: flex; gap: 6px; margin: 8px 0; }
.gift-tab { flex: 1; min-height: 38px; border-radius: 12px; border: 1px solid var(--edge-soft); background: var(--well); color: var(--ink-2); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.gift-tab.is-on { color: #3a1d00; border-color: #e6b94f; background: linear-gradient(180deg, #f6d98a, #d4a037); }
.gift-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; align-content: start; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 2px; flex: 1 1 auto; min-height: 0; }
.gift-head, .gift-to, .gift-tabs, .gift-foot { flex: none; }
.gift-plan { min-height: 120px; }
.gift-plan s { opacity: .6; font-size: 11px; }
.gift-card {
  position: relative; display: grid; justify-items: center; gap: 2px; padding: 8px 4px 8px; border-radius: 16px; cursor: pointer;
  border: 1px solid var(--edge-soft); background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(0, 0, 0, .18)); color: var(--ink); font: inherit;
  transition: transform .12s, border-color .12s;
}
.gift-card img { width: 64px; height: 64px; pointer-events: none; }
.gift-card b { font-size: 12px; font-weight: 600; text-align: center; line-height: 1.15; }
.gift-card.is-none img { opacity: .55; filter: saturate(.7); }
.gift-card.is-on { transform: translateY(-2px); border-color: #e6b94f; box-shadow: 0 0 0 1px rgba(230, 185, 79, .55) inset, 0 8px 18px rgba(0, 0, 0, .4); }
.gift-card.tier-cash { background: linear-gradient(180deg, rgba(255, 214, 120, .16), rgba(0, 0, 0, .2)); }
.gift-badge-pill { display: inline-flex; align-items: center; gap: 3px; min-height: 18px; padding: 0 8px; border-radius: 999px; background: rgba(0, 0, 0, .4); color: var(--ink-2); font-size: 11px; font-weight: 700; }
.gift-card.tier-free:not(.is-none) .gift-badge-pill { color: #7fe39a; }
.gift-foot { padding-top: 10px; display: grid; gap: 8px; }
.gift-preview { display: flex; align-items: center; gap: 10px; }
.gift-preview img { width: 44px; height: 44px; }
.gift-preview b { display: block; font-size: 14px; }
.gift-preview span { font-size: 12px; color: var(--ink-2); }
.gift-go { min-height: 48px; }
.btn-gold { background: linear-gradient(180deg, #f6d98a, #d4a037 60%, #b98122); color: #3a1d00; border: 0; border-radius: 14px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn-gold:disabled { opacity: .55; }

/* the gift button beside chat, and the shop/inventory tab */
.gift-open { position: relative; }
.gift-open svg { width: 22px; height: 22px; }
.gift-open .gift-dot { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: #e6b94f; box-shadow: 0 0 0 2px var(--surface-2); }
.shop-gift-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.shop-gift { display: grid; justify-items: center; gap: 3px; padding: 10px 8px; border-radius: 16px; border: 1px solid var(--edge-soft); background: rgba(0, 0, 0, .18); text-align: center; }
.shop-gift img { width: 72px; height: 72px; }
.shop-gift h3 { margin: 0; font-size: 13px; }
.shop-gift p { margin: 0; font-size: 12px; color: var(--ink-2); min-height: 28px; }
.shop-gift .held { font-size: 11px; color: #7fe39a; font-weight: 700; }

/* ── the stage: the moment a gift arrives ───────────────────── */
.gift-stage { position: fixed; inset: 0; z-index: 80; pointer-events: none; }
.gift-stage > * { position: absolute; left: var(--gx); top: var(--gy); }
.gift-glow { width: calc(var(--gs) * 2.6); height: calc(var(--gs) * 2.6); border-radius: 50%; transform: translate(-50%, -50%); opacity: 0;
  background: radial-gradient(circle, rgba(255, 233, 160, .85), rgba(255, 190, 80, .32) 38%, transparent 68%); }
.gift-rays { width: calc(var(--gs) * 2.4); height: calc(var(--gs) * 2.4); border-radius: 50%; transform: translate(-50%, -50%); opacity: 0;
  background: repeating-conic-gradient(from 0deg, rgba(255, 236, 170, .55) 0deg 8deg, transparent 8deg 24deg);
  -webkit-mask: radial-gradient(circle, #000 14%, transparent 68%); mask: radial-gradient(circle, #000 14%, transparent 68%); }
.gift-art { width: var(--gs); height: var(--gs); transform: translate(-50%, -50%); filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .5)); opacity: 0; }
.gift-sparks i { position: absolute; left: 0; top: 0; width: 9px; height: 9px; border-radius: 50%; opacity: 0;
  background: radial-gradient(circle, #fff7d0, #ffc84a 60%, transparent 72%); transform: translate(-50%, -50%); }
.gift-sparks i:nth-child(3n) { width: 6px; height: 6px; background: radial-gradient(circle, #fff, #ff9ab0 60%, transparent 72%); }
.gift-sparks i:nth-child(4n) { width: 7px; height: 7px; background: radial-gradient(circle, #fff, #8fe3ff 60%, transparent 72%); }
.gift-cap { transform: translate(-50%, calc(var(--gs) * .5 + 14px)); opacity: 0; min-width: 190px; max-width: 86vw; text-align: center; padding: 8px 16px 9px;
  border-radius: 16px; background: linear-gradient(180deg, rgba(60, 22, 18, .94), rgba(34, 12, 10, .94)); border: 1px solid #e6b94f;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .55); color: var(--ink); font-size: 13.5px; display: grid; gap: 1px; }
.gift-cap b { color: #ffe6a0; }
.gift-cap em { font-style: normal; font-size: 12px; color: var(--ink-2); }
.gift-cap.tier-cash { border-color: #ffd86b; box-shadow: 0 0 22px rgba(255, 200, 80, .55), 0 10px 26px rgba(0, 0, 0, .55); }
.gift-landed { animation: gift-land 1.1s ease-out; }
@keyframes gift-land { 0% { box-shadow: 0 0 0 0 rgba(255, 214, 120, .9); } 40% { box-shadow: 0 0 0 10px rgba(255, 214, 120, .35), 0 0 26px rgba(255, 214, 120, .8); transform: scale(1.06); } 100% { box-shadow: 0 0 0 18px rgba(255, 214, 120, 0); transform: none; } }
.gift-ring { position: fixed; z-index: 81; width: 64px; height: 64px; border-radius: 50%; border: 3px solid #ffd86b; pointer-events: none; }
.gift-keepsake { position: absolute; right: -6px; top: -12px; width: 30px; height: 30px; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .5)); animation: gift-pop .4s cubic-bezier(.3, 1.6, .5, 1); transition: opacity .4s, transform .4s; z-index: 3; pointer-events: none; }
.gift-keepsake.is-out { opacity: 0; transform: translateY(-8px) scale(.8); }
@keyframes gift-pop { from { transform: scale(0) rotate(-20deg); } to { transform: scale(1) rotate(0); } }
.chip { position: relative; }
@media (prefers-reduced-motion: reduce) { .gift-landed, .gift-keepsake { animation: none; } .gift-sheet { transition: none; } }

/* The gift button shares the bottom row with chat and history, so it is a
   touch smaller, and the name chip gives it the room on narrow phones. */
#btn-gift.gift-open { width: 38px; height: 38px; }
.seat-row-bottom { gap: 8px; }
.seat-row-bottom:has(#btn-gift:not([hidden])) #me .chip { min-width: 150px; }

/* a sticker that can still be sent for free */
.sticker-free { position: absolute; right: 1px; bottom: 0; padding: 1px 5px; border-radius: 999px; font-size: 11px; font-weight: 800; color: #3a1d00; background: linear-gradient(180deg, #f6d98a, #d4a037); }

/* Shop page: five section chips need to scroll on a phone, not squeeze or spill. */
#screen-shop .shop-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
#screen-shop .shop-tabs::-webkit-scrollbar { display: none; }
#screen-shop .shop-tab { flex: 1 0 auto; padding: 6px 14px; white-space: nowrap; }
#screen-shop .topbar { padding-left: 16px; padding-right: 16px; }

/* ── Broadcast ─────────────────────────────────────────────── */
.broadcast-home {
  display: flex; align-items: center; gap: 12px; width: 100%; margin: 10px 0 2px; padding: 12px 14px; cursor: pointer;
  border-radius: 16px; border: 1px solid var(--edge); color: var(--ink); font: inherit; text-align: left;
  background: linear-gradient(90deg, rgba(231, 76, 76, .16), rgba(0, 0, 0, .18));
}
.broadcast-home[hidden] { display: none; }
.broadcast-home-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #ff8e8e; background: rgba(0, 0, 0, .3); flex: none; }
.broadcast-home-copy { display: grid; gap: 1px; flex: 1; min-width: 0; }
.broadcast-home-copy b { font-size: 15px; }
.broadcast-home-copy em { font-style: normal; font-size: 12px; color: var(--ink-2); }
.broadcast-home-go { font-size: 22px; color: var(--ink-2); }
.broadcast-home:disabled { opacity: .5; }

.live-pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 7px; border-radius: 999px; background: #c62828; color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.live-pill i { width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: live-blink 1.2s ease-in-out infinite; }
@keyframes live-blink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .live-pill i { animation: none; } }

.game-broadcast.is-live { color: #ff6b6b; }
.game-broadcast.is-live svg { filter: drop-shadow(0 0 4px rgba(255, 90, 90, .7)); }

.spectator-bar { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 6px 12px; font-size: 13px; color: var(--ink-2); }
.spectator-bar[hidden] { display: none; }
.spectator-bar b { letter-spacing: .18em; color: var(--ink); font-variant-numeric: tabular-nums; }

/* Watching: the board and who is playing, nothing to press. */
body.is-spectating #btn-throw,
body.is-spectating #btn-chat,
body.is-spectating #btn-gift,
body.is-spectating #log-toggle,
body.is-spectating #btn-game-call,
body.is-spectating #btn-game-mute,
body.is-spectating #btn-broadcast,
body.is-spectating #btn-async-retry,
body.is-spectating #turn-timer { display: none !important; }
body.is-spectating .board { pointer-events: none; }

.bc-live { display: flex; align-items: center; justify-content: space-between; margin: 6px 0; color: var(--ink-2); font-size: 13px; }
.bc-code { text-align: center; font-family: var(--serif, Georgia, serif); font-size: 38px; font-weight: 700; letter-spacing: .06em; color: #e6b94f; padding: 10px 0 4px; }
.bc-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0; }
.watch-panel .code-input { text-transform: uppercase; letter-spacing: .3em; text-align: center; }

/* gift picker: shelves scroll sideways, each card shows how many are left */
.gift-tabs { overflow-x: auto; scrollbar-width: none; }
.gift-tabs::-webkit-scrollbar { display: none; }
.gift-tab { flex: 0 0 auto; padding: 0 12px; white-space: nowrap; }
.gift-card { position: relative; }
.gift-count { position: absolute; top: 4px; right: 4px; min-width: 24px; padding: 1px 6px; border-radius: 999px; background: linear-gradient(180deg, #f6d98a, #d4a037); color: #3a1d00; font: 800 11px/16px inherit; font-style: normal; text-align: center; box-shadow: 0 2px 5px rgba(0,0,0,.4); }
.gift-card.is-none .gift-count { background: rgba(0,0,0,.5); color: var(--ink-2); }
.gift-card img { width: 64px; height: 64px; object-fit: contain; }
.gift-preview img { object-fit: contain; }
.gift-pack { font-size: 11px; color: var(--ink-2); margin-top: -2px; }

/* profile card */
.profile-card { max-height: 88dvh; overflow-y: auto; }
.pf-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.pf-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; border-radius: 14px; background: var(--well); border: 1px solid var(--edge-soft); }
.pf-stat b { font-size: 20px; color: #f6d98a; }
.pf-stat span { font-size: 11px; color: var(--ink-2); text-align: center; }
.pf-h { margin: 6px 0 8px; font-size: 14px; }
.pf-gifts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; max-height: 34dvh; overflow-y: auto; }
.pf-gift { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; text-align: center; }
.pf-gift img { width: 52px; height: 52px; object-fit: contain; }
.pf-gift em { position: absolute; top: -2px; right: 2px; font-style: normal; font-weight: 800; font-size: 11px; padding: 0 5px; border-radius: 999px; background: linear-gradient(180deg, #f6d98a, #d4a037); color: #3a1d00; }
.pf-gift b { font-weight: 600; line-height: 1.1; }
.pf-h-btn { display: flex; align-items: center; gap: 6px; width: 100%; background: none; border: 0; padding: 6px 0; color: var(--ink-1, #fff); font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; text-align: left; }
.pf-h-btn i { margin-left: auto; font-style: normal; font-size: 20px; opacity: .7; transition: transform .15s; }
.pf-h-btn[aria-expanded="true"] i { transform: rotate(90deg); }
.pf-log { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; max-height: 40dvh; overflow-y: auto; }
.pf-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 12px; background: var(--well); }
.pf-row img { width: 40px; height: 40px; object-fit: contain; }
.pf-row span { display: flex; flex-direction: column; flex: 1; font-size: 13px; }
.pf-row em { font-style: normal; font-size: 12px; color: var(--ink-2); }
.pf-row time { font-size: 11px; color: var(--ink-2); }

.av-ladder { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.av-ladder li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 12px; background: var(--well); }
.av-ladder img { width: 44px; height: 44px; object-fit: contain; }
.av-ladder span { display: flex; flex-direction: column; font-size: 13px; }
.av-ladder em { font-style: normal; font-size: 12px; color: var(--ink-2); }
.shop-gift img[src*="avatars"] { border-radius: 50%; }

.pf-avatar { width: 64px; height: 64px; flex: none; }
.pf-avatar img { width: 100%; height: 100%; object-fit: contain; }
.pf-look { margin: 10px 0 4px; }
.pf-avs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
.pf-av { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px; border-radius: 12px; border: 1px solid var(--edge-soft); background: var(--well); color: inherit; font: inherit; cursor: pointer; }
.pf-av img { width: 52px; height: 52px; object-fit: contain; }
.pf-av small { font-size: 11px; color: var(--ink-2); text-align: center; line-height: 1.1; }
.pf-av.is-on { border-color: #e6b94f; box-shadow: 0 0 0 1px rgba(230,185,79,.55) inset; }
.pf-av.is-locked img { opacity: .4; filter: grayscale(.6); }
.pf-tis { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.pf-ti { padding: 6px 10px; border-radius: 999px; border: 1px solid var(--edge-soft); background: var(--well); color: inherit; font: inherit; font-size: 12.5px; cursor: pointer; }
.pf-ti small { opacity: .6; font-size: 11px; }
.pf-ti.is-on { color: #3a1d00; border-color: #e6b94f; background: linear-gradient(180deg, #f6d98a, #d4a037); }
.pf-ti:disabled { opacity: .45; cursor: default; }
/* Broadcast: who is watching, listen-only audio */
.bc-watchers { list-style: none; margin: 8px 0 4px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; max-height: 96px; overflow-y: auto; }
.bc-watcher { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border-radius: 999px; background: var(--card-2, rgba(0,0,0,.06)); font-size: 13px; color: var(--ink); }
.bc-ava { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--gold, #d9a441); color: #fff; }
.spectator-views, .watchers-chip { font: inherit; font-size: 13px; color: var(--ink-2); background: none; border: 0; padding: 4px 6px; cursor: pointer; }
.spectator-listen { font: inherit; font-size: 13px; border-radius: 999px; border: 1px solid var(--line, rgba(0,0,0,.15)); background: var(--card, #fff); color: var(--ink); padding: 4px 10px; cursor: pointer; }
.spectator-listen small { opacity: .7; font-size: 11px; margin-left: 2px; }
.spectator-listen[aria-pressed="true"] { background: var(--green, #2e9e5b); color: #fff; border-color: transparent; }
.spectator-listen[hidden], .watchers-chip[hidden] { display: none; }
.watchers-chip { display: block; margin: 0 auto; border-radius: 999px; background: var(--card-2, rgba(0,0,0,.06)); padding: 3px 10px; }
.bc-ask { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; margin: 8px 0; border-radius: 12px; background: var(--card, #fff); border: 1px solid var(--line, rgba(0,0,0,.15)); }
.bc-ask-btns { display: flex; gap: 6px; }
.bc-watcher .btn { margin-left: auto; padding: 2px 10px; font-size: 12px; }

/* The send-a-gift sheet has a fixed height with a scrolling grid; the other
   sheets that reuse its chrome size to their content. */
.pg-sheet, .broadcast-sheet { height: auto; max-height: 86vh; }
