/* Board Parlor online play: the dialog online.js builds (#online.bp-online). Scoped to .bp-online so a
   game's own .overlay/.sheet/.btn styles can't clash. Colours follow the game's tutorial palette. */
.bp-online {
  --on-accent: var(--tut-accent, #ffcf5a);
  --on-accent-ink: var(--tut-accent-ink, #2a1a08);
  --on-panel: var(--tut-bubble, #fbf6ee);
  --on-ink: var(--tut-ink, #1d1d24);
  --on-muted: var(--tut-muted, #6d6878);
  --on-line: rgba(0, 0, 0, .12);
  position: fixed; inset: 0; z-index: 85; display: flex; align-items: flex-end; justify-content: center;
  padding: 12px; background: rgba(10, 12, 20, .5);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.bp-online[hidden] { display: none !important; }
@media (min-width: 560px) { .bp-online { align-items: center; } }
.bp-online .online-sheet {
  width: min(100%, 420px); max-height: 92vh; overflow-y: auto; text-align: center;
  background: var(--on-panel); color: var(--on-ink); border-radius: 20px; padding: 20px 18px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 14px 44px rgba(0, 0, 0, .35); animation: bp-online-up .18s ease-out;
}
.bp-online h2 { margin: 0 0 4px; font-size: 20px; font-weight: 800; color: var(--on-ink); }
.bp-online .online-text { margin: 4px 0 14px; font-size: 14px; color: var(--on-muted); }
.bp-online .btn {
  min-height: 46px; padding: 0 18px; border-radius: 14px; border: 0; cursor: pointer; font: 700 15px/1 system-ui, -apple-system, sans-serif;
  background: rgba(0, 0, 0, .07); color: var(--on-ink); display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.bp-online .btn.primary { background: var(--on-accent); color: var(--on-accent-ink); }
.bp-online .btn.ghost { background: transparent; box-shadow: inset 0 0 0 1.5px var(--on-line); }
.bp-online .btn:disabled { opacity: .5; cursor: default; }
.bp-online .btn:active:not(:disabled) { transform: translateY(1px); }
.bp-online .sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.bp-online .sheet-actions .btn { flex: 1 1 auto; }

.bp-online .online-link { display: grid; gap: 8px; }
.bp-online .online-url {
  padding: 11px 12px; border-radius: 12px; background: #fff; color: #1d1d24; border: 1.5px solid var(--on-line);
  font: 600 14px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; word-break: break-all; text-align: left; user-select: all; cursor: text;
}
.bp-online .online-url:focus { outline: none; border-color: var(--on-accent); }
.bp-online .online-url .q { white-space: nowrap; word-break: normal; }
.bp-online .online-share { display: flex; gap: 8px; }
.bp-online .online-share .btn { flex: 1 1 0; }
.bp-online .online-wait { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 14px 0 0; font-size: 14px; color: var(--on-muted); }
.bp-online .online-pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--on-accent); animation: bp-online-pulse 1.4s ease-in-out infinite; }

.bp-online .online-friends { margin: 0 0 12px; }
.bp-online .online-flist { display: grid; gap: 6px; max-height: 204px; overflow-y: auto; }
.bp-online .online-friend {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 6px 12px;
  border: 1.5px solid var(--on-line); border-radius: 12px; background: #fff; color: #1d1d24; text-align: left; cursor: pointer; font: inherit;
}
.bp-online .online-friend:disabled { cursor: default; }
.bp-online .online-friend .dot { width: 9px; height: 9px; border-radius: 50%; background: rgba(0, 0, 0, .18); flex: none; }
.bp-online .online-friend.on .dot { background: #2fb160; box-shadow: 0 0 0 3px rgba(47, 177, 96, .18); }
.bp-online .online-friend .fname { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.bp-online .online-friend .fstate { font-size: 12px; color: #6d6878; font-weight: 600; }
.bp-online .online-friend .fact { flex: none; font-size: 13px; font-weight: 800; color: #9a6a00; }
.bp-online .online-friend.sent .fact { color: #1f8a4a; }
.bp-online .online-friend.no .fact { color: #c0392b; }
.bp-online .online-or { margin: 10px 0 0; font-size: 12px; color: var(--on-muted); text-transform: uppercase; letter-spacing: .08em; }
/* "List in Open games" (a signed-in host at level 2+; the level itself is never shown in a game) */
.bp-online .online-open { margin: 12px 0 0; }
.bp-online .on-sw {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 48px; margin: 0; padding: 6px 12px 6px 14px;
  border: 1.5px solid var(--on-line); border-radius: 12px; background: #fff; color: #1d1d24; cursor: pointer; text-align: left;
  font: 700 15px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.bp-online .on-sw:disabled { cursor: default; opacity: .7; }
.bp-online .on-sw:focus-visible { outline: 2px solid var(--on-accent); outline-offset: 2px; }
.bp-online .on-sw-track { position: relative; flex: none; width: 44px; height: 26px; border-radius: 13px; background: rgba(0, 0, 0, .2); transition: background .15s; }
.bp-online .on-sw-knob { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s; }
.bp-online .on-sw[aria-checked="true"] .on-sw-track { background: #2fb160; }
.bp-online .on-sw[aria-checked="true"] .on-sw-knob { transform: translateX(18px); }
.bp-online .online-open-note { margin: 6px 0 0; font-size: 13px; color: var(--on-muted); }
.bp-online .online-signin { margin: 12px 0 0; font-size: 13px; color: var(--on-muted); }
.bp-online .online-signin a { color: inherit; font-weight: 800; text-decoration: underline; }

@keyframes bp-online-up { from { transform: translateY(24px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes bp-online-pulse { 0%, 100% { opacity: .35; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.1); } }
@media (prefers-reduced-motion: reduce) { .bp-online .online-sheet, .bp-online .online-pulse { animation: none; } .bp-online .on-sw-track, .bp-online .on-sw-knob { transition: none; } }

/* After a finished online game with the result card closed: Rematch / Leave stay in reach */
.bp-online-endbar {
  position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 16px; border-radius: 18px; max-width: calc(100vw - 24px);
  background: var(--tut-bubble, #fbf6ee); color: var(--tut-ink, #1d1d24); box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
  font: 700 14px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.bp-online-endbar[hidden] { display: none !important; }
.bp-online-endbar .bp-endbar-text { white-space: nowrap; margin-right: 4px; }
.bp-online-endbar .bp-endbar-btn {
  min-height: 42px; padding: 0 16px; border: 0; border-radius: 13px; cursor: pointer; font: inherit;
  background: rgba(0, 0, 0, .07); color: var(--tut-ink, #1d1d24);
}
.bp-online-endbar .bp-endbar-btn.primary { background: var(--tut-accent, #ffcf5a); color: var(--tut-accent-ink, #2a1a08); }
.bp-online-endbar .bp-endbar-btn:disabled { opacity: .6; }

/* A small status line games can use during an online game (optional): <div class="bp-online-status"> */
.bp-online-status { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 13px; }
.bp-online-status .dot { width: 8px; height: 8px; border-radius: 50%; background: #9aa0a6; }
.bp-online-status .dot.on { background: #2fb160; }
