/* 31 — Online mode (group platform).
 * Mirrors apps/wouldyourather/online.css class names (wyr-online-btn,
 * wyr-roster-item, wyr-host-more, wyr-remove-btn) so this game uses the
 * same recipe described in docs/group-platform-integration-spec.md §2g.
 *
 * Palette: GoF brand light (per docs/design-guidelines.md). The :root tokens
 * (--gof-*, --card-*, --shadow-*, --radius) are defined in style.css, which
 * loads before this file. The .card / .badge classes at the bottom were
 * previously inherited from style.css; they live here now that style.css is
 * scoped to the single-device modes. */

#thirtyone-online-root {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px 16px 80px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--gof-text);
}

.thirtyone-online-banner {
  background: #fdf3d4;
  border: 1px solid var(--gof-yellow);
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 13px;
  color: #6b5600;
}

.wyr-online-card {
  background: var(--panel-bg);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.wyr-online-card h2 {
  font-size: 16px;
  margin: 0 0 14px;
  font-weight: 600;
}
.wyr-online-section-title {
  font-size: 20px;
  margin: 0 0 12px;
  font-weight: 700;
}

#thirtyone-online-status {
  font-size: 13px;
  color: var(--gof-text-muted);
  margin: 0 0 14px;
  min-height: 1.2em;
}
#thirtyone-online-status.error { color: var(--gof-rust); }

/* ===== Roster ============================================================ */

.wyr-roster {
  list-style: none;
  padding: 0;
  margin: 0;
}
.wyr-roster-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--panel-border);
}
.wyr-roster-item:last-child { border-bottom: none; }
.wyr-roster-name {
  font-size: 15px;
  font-weight: 500;
}
.wyr-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  color: #fff;
}
.wyr-badge-you { background: var(--gof-olive); }
.wyr-badge-host { background: var(--gof-green-dark); }

.thirtyone-roster-lives {
  font-size: 14px;
  color: var(--card-red);
  font-weight: 600;
  margin-left: 6px;
}
.thirtyone-roster-lives.is-out {
  color: #b0b6bd;
  text-decoration: line-through;
}

/* ===== Buttons (mirror WYR) ============================================== */

.wyr-online-btn {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 8px;
  background: var(--gof-green);
  color: var(--gof-text);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 8px;
  font-family: inherit;
}
.wyr-online-btn:hover:not(:disabled) { background: var(--gof-green-hover); }
.wyr-online-btn:disabled { background: #cdd3da; color: #ffffff; cursor: not-allowed; }
.wyr-online-btn.secondary {
  background: var(--gof-bg);
  color: var(--gof-green-dark);
}
.wyr-online-btn.secondary:hover:not(:disabled) { background: #cfd9e4; }
.wyr-online-btn.switch {
  background: #fff3d6;
  color: #7a5300;
  border: 1px solid var(--gof-yellow);
}
.wyr-online-btn.switch:hover:not(:disabled) { background: #ffe9b3; }
.wyr-online-btn.warning {
  background: var(--gof-yellow);
  color: var(--gof-text);
}
.wyr-online-btn.warning:hover:not(:disabled) { background: var(--gof-yellow-hover); }

.wyr-hint {
  font-size: 13px;
  color: var(--gof-text-muted);
  margin: 12px 0;
  text-align: center;
}

/* ===== Host kick + host-more disclosure ================================== */

.wyr-remove-btn {
  display: inline-block;
  background: transparent;
  color: var(--card-red);
  border: 1px solid var(--card-red);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
}
.wyr-remove-btn:hover { background: #fdecea; }

.wyr-host-more {
  margin-top: 12px;
  border: 1px dashed var(--card-border);
  border-radius: 8px;
  padding: 0 12px;
  background: #f7f9fb;
}
.wyr-host-more[open] { padding-bottom: 12px; }
.wyr-host-more > summary {
  cursor: pointer;
  list-style: none;
  padding: 10px 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--gof-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.wyr-host-more > summary::-webkit-details-marker { display: none; }
.wyr-host-more > summary::after {
  content: '▾';
  margin-left: 6px;
  color: var(--gof-text-muted);
}
.wyr-host-more[open] > summary::after { content: '▴'; }
.wyr-host-more .wyr-online-btn { margin-bottom: 6px; }
.wyr-host-more p.wyr-host-warning {
  font-size: 12px;
  color: var(--gof-text-muted);
  margin: 6px 0 10px;
  line-height: 1.4;
}

/* ===== 31-specific: lobby ================================================ */

.thirtyone-lobby-config {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 12px 0;
  padding: 10px 0;
  border-top: 1px solid var(--panel-border);
}
.thirtyone-lobby-config label {
  font-size: 14px;
  color: var(--gof-text);
  font-weight: 500;
}
.thirtyone-lobby-config input {
  width: 60px;
  padding: 6px 8px;
  font-size: 16px;
  border: 1px solid var(--card-border);
  border-radius: 6px;
  text-align: center;
  font-family: inherit;
}
.thirtyone-lobby-player-count {
  font-size: 12px;
  color: var(--gof-text-muted);
  text-align: center;
  margin: 8px 0 12px;
}

.thirtyone-lobby-variants {
  margin: 10px 0 14px;
  border: 1px dashed var(--card-border);
  border-radius: 8px;
  padding: 0 12px;
  background: #f7f9fb;
}
.thirtyone-lobby-variants[open] { padding-bottom: 10px; }
.thirtyone-lobby-variants > summary {
  cursor: pointer;
  list-style: none;
  padding: 10px 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--gof-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.thirtyone-lobby-variants > summary::-webkit-details-marker { display: none; }
.thirtyone-lobby-variants > summary::after {
  content: '▾';
  margin-left: 6px;
  color: var(--gof-text-muted);
}
.thirtyone-lobby-variants[open] > summary::after { content: '▴'; }
.thirtyone-variant-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 0;
  font-size: 13px;
  color: var(--gof-text);
  line-height: 1.35;
  cursor: pointer;
}
.thirtyone-variant-row input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
}
.thirtyone-variant-row strong { color: var(--gof-text); }

/* ===== 31-specific: playing screen ======================================= */

.thirtyone-playing-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}
.thirtyone-playing-turn {
  font-size: 18px;
  font-weight: 700;
}
.thirtyone-playing-round {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gof-text-muted);
  font-weight: 600;
}

.thirtyone-playing-last-action {
  font-size: 13px;
  color: var(--gof-text-muted);
  background: var(--gof-bg);
  border-radius: 6px;
  padding: 8px 10px;
  margin: 0 0 14px;
}

.thirtyone-piles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  justify-items: center;
  align-items: flex-start;
  gap: 16px;
  margin: 10px 0 8px;
}
.thirtyone-piles .pile-section-simple {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.thirtyone-piles .pile-label {
  font-size: 12px;
  color: var(--gof-text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
/* Hot pile (clickable when it's your turn). */
.thirtyone-piles .pile-section-simple.pile-clickable .card,
.thirtyone-piles .pile-section-simple.pile-clickable .card-face-down,
.thirtyone-piles .pile-section-simple.pile-clickable .empty-discard {
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.thirtyone-piles .pile-section-simple.pile-clickable:hover .card,
.thirtyone-piles .pile-section-simple.pile-clickable:hover .card-face-down {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}

/* Action row aligned under [Discard | Draw] piles. */
.thirtyone-pile-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}
.thirtyone-pile-actions .wyr-online-btn { margin-bottom: 0; }
/* If only one of the two action buttons is visible (e.g. empty discard),
   span the visible one across both columns so the alignment doesn't shift. */
.thirtyone-pile-actions:has(> button[style*="display: none"]:nth-child(1):not([style*="none none"])) > button:nth-child(2),
.thirtyone-pile-actions:has(> button[style*="display: none"]:nth-child(2)) > button:nth-child(1) {
  grid-column: 1 / -1;
}
.thirtyone-knock-btn {
  margin-top: 0;
  margin-bottom: 4px;
}
.thirtyone-discard-btn {
  margin-top: 4px;
}

/* Turn-order strip: horizontal scroll of player slots in playerOrder.
   Current player highlighted; knocked + out players badged/dimmed. */
.thirtyone-turn-strip {
  display: flex;
  gap: 6px;
  margin: 8px 0 12px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}
.thirtyone-turn-strip .turn-slot {
  flex: 1 1 0;
  min-width: 88px;
  max-width: 160px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--gof-bg);
  border: 1.5px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: center;
  font-size: 12px;
  color: var(--gof-text);
}
.thirtyone-turn-strip .turn-slot.is-current {
  background: var(--gof-mint);
  border-color: var(--gof-green);
  font-weight: 700;
}
.thirtyone-turn-strip .turn-slot.is-out {
  opacity: 0.45;
  text-decoration: line-through;
}
.thirtyone-turn-strip .turn-slot .slot-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.thirtyone-turn-strip .turn-slot .slot-lives {
  font-size: 11px;
  color: var(--card-red);
}
.thirtyone-turn-strip .turn-slot .slot-badge {
  display: inline-block;
  font-size: 9.5px;
  padding: 1px 6px;
  border-radius: 8px;
  background: var(--gof-yellow);
  color: var(--gof-text);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 auto;
}
.thirtyone-turn-strip .turn-slot .slot-badge.out { background: var(--card-red); color: #fff; }
.thirtyone-turn-strip .turn-slot .slot-badge.dealer { background: var(--gof-text-muted); color: #fff; }

.thirtyone-hand-host {
  margin: 18px 0 6px;
}
.thirtyone-hand-host .hand-container {
  justify-content: center;
}
.thirtyone-hand-host .hand-score-text {
  text-align: center;
  margin-top: 8px;
  font-size: 14px;
  color: var(--gof-green-dark);
  font-weight: 700;
}
.thirtyone-out-hint {
  font-size: 14px;
  color: var(--gof-text-muted);
  text-align: center;
  padding: 16px;
}

.thirtyone-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.thirtyone-actions .wyr-online-btn { margin-bottom: 0; }
.thirtyone-actions .full-width { grid-column: 1 / -1; }

.thirtyone-section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--gof-text-muted);
  font-weight: 700;
  margin: 18px 0 6px;
  text-align: center;
}

/* ===== Round summary + game over ========================================= */

.player-result {
  border-bottom: 1px solid var(--panel-border);
  padding: 12px 0;
}
.player-result:last-child { border-bottom: none; }
.player-result-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.player-result-name {
  font-size: 16px;
  margin: 0;
  flex: 1 1 auto;
  font-weight: 600;
}
.player-result-score,
.player-result-lives {
  font-size: 13px;
  color: var(--gof-text-muted);
}
.result-hand-container {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.thirtyone-gameover-winner {
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 18px;
  color: var(--gof-green-dark);
}

/* ===== Cards (used by online.js buildCardEl) =============================
   Previously inherited from style.css; scoped here now that style.css only
   covers the single-device modes. */

.card {
  width: 80px;
  height: 112px;
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 6px 8px;
  box-shadow: var(--shadow-sm);
  position: relative;
}
.card-selectable {
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.card-selectable:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--gof-green);
}
.card-selected {
  border-color: var(--gof-green);
  border-width: 3px;
  box-shadow: 0 0 0 3px rgba(155, 202, 62, 0.3);
}
.card-rank {
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--gof-text);
  line-height: 1;
  margin-top: -4px;
}
.card-suit {
  font-size: 3rem;
  text-align: center;
  color: var(--gof-text);
  line-height: 1;
  margin-bottom: -4px;
}
.card-suit-red { color: var(--card-red); }
.card-face-down {
  width: 80px;
  height: 112px;
  background: var(--card-back);
  border: 2px solid var(--gof-green-dark);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: var(--shadow-sm);
}
.deck-size-badge {
  position: relative;
  z-index: 1;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.hand-container {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.empty-discard {
  color: var(--gof-text-muted);
  font-style: italic;
  font-size: 13px;
  padding: 34px 8px;
}
.badge {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.badge-lost-life {
  background: var(--card-red);
  color: #fff;
}

/* ===== Blitz celebration banner ========================================== */

.thirtyone-blitz-banner {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: thirtyone-blitz-fade-in 0.15s ease-out;
}
.thirtyone-blitz-content {
  text-align: center;
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  color: #fff;
}
.thirtyone-blitz-label {
  font-size: 48px;
  font-weight: 900;
  letter-spacing: 4px;
  color: var(--gof-yellow);
  text-shadow: 0 4px 24px rgba(255, 185, 32, 0.5);
  animation: thirtyone-blitz-pulse 0.6s ease-in-out infinite alternate;
}
.thirtyone-blitz-name {
  font-size: 22px;
  font-weight: 700;
}
.thirtyone-blitz-hand {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.thirtyone-blitz-score {
  font-size: 56px;
  font-weight: 900;
  color: var(--gof-yellow);
  line-height: 1;
}
@keyframes thirtyone-blitz-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes thirtyone-blitz-pulse {
  from { transform: scale(1); }
  to   { transform: scale(1.06); }
}
