/* ============================================================
   SILVER - WEREWOLF CARD GAME (STYLESHEET)
   ============================================================ */

:root {
  --bg-dark: #0a0b0e;
  --bg-panel: rgba(18, 20, 29, 0.78);
  --bg-card: rgba(25, 28, 42, 0.85);
  --card-border: rgba(255, 255, 255, 0.12);
  --card-shadow: 0 4px 14px rgba(0, 0, 0, 0.55);
  --card-radius: 6px;
  
  --silver-bright: #e2e8f0;
  --silver-glow: rgba(226, 232, 240, 0.4);
  --accent-cyan: #38bdf8;
  --accent-gold: #f59e0b;
  --accent-yellow: #fbbf24;
  --accent-green: #22c55e;
  --accent-red: #ef4444;
  --accent-blue: #3b82f6;
  --accent-purple: #a855f7;

  --glow-cyan: 0 0 16px rgba(56, 189, 248, 0.75);
  --glow-gold: 0 0 18px rgba(245, 158, 11, 0.8);
  --glow-red: 0 0 16px rgba(239, 68, 68, 0.75);
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

html {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: auto;
}

body {
  width: 100%;
  min-height: 100%;
  min-height: 100dvh;
  background-color: var(--bg-dark);
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: auto;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Screen Wrapper: Fits mobile portrait (up to 480px) and centers on desktop */
.screen-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: 480px;
  background-color: #100e13;
  background-image: 
    radial-gradient(ellipse at 50% 45%, rgba(35, 28, 26, 0.55) 0%, rgba(8, 7, 10, 0.95) 80%),
    url('material/table_bg.webp');
  background-size: cover;
  background-position: center bottom;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.9);
}

/* Atmospheric Moonlight Overlay */
.screen-wrapper::before {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(circle at 50% 15%, rgba(148, 163, 184, 0.12) 0%, transparent 60%),
    radial-gradient(circle at 50% 50%, transparent 45%, rgba(0, 0, 0, 0.7) 100%),
    linear-gradient(to bottom, rgba(5, 5, 8, 0.4) 0%, transparent 20%, transparent 80%, rgba(5, 5, 8, 0.9) 100%);
  pointer-events: none;
  z-index: 1;
}

/* ============================================================
   APP VIEWS CONTROLLER (Landing, Lobby, Game)
   ============================================================ */
.app-view {
  display: none;
  width: 100%;
  height: 100%;
  flex-direction: column;
  position: relative;
  z-index: 2;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.app-view.active {
  display: flex;
}

#gameView {
  overflow: hidden; /* Game table stays locked */
  justify-content: space-between;
}

/* ============================================================
   VIEW 1: LANDING PAGE STYLING
   ============================================================ */
.landing-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem 1.25rem 2.5rem;
  min-height: 100%;
}

.landing-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
}

.hero-logo-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.wolf-icon {
  font-size: 3rem;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 0 14px rgba(226, 232, 240, 0.6));
}

.moon-glow {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(226, 232, 240, 0.4) 0%, rgba(148, 163, 184, 0.1) 60%, transparent 100%);
  animation: pulseMoon 4s ease-in-out infinite alternate;
}

@keyframes pulseMoon {
  0% { transform: scale(0.9); opacity: 0.6; }
  100% { transform: scale(1.15); opacity: 1; }
}

.game-main-title {
  font-size: 2.4rem;
  font-weight: 900;
  letter-spacing: 4px;
  color: #fff;
  text-shadow: 0 0 20px rgba(226, 232, 240, 0.6), 0 2px 4px #000;
  margin-bottom: 0.2rem;
}

.game-tagline {
  font-size: 0.85rem;
  color: #94a3b8;
  letter-spacing: 0.5px;
}

/* Panels */
.panel-box {
  background: var(--bg-panel);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 1rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

.panel-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: #cbd5e1;
  margin-bottom: 0.5rem;
}

.input-row {
  width: 100%;
}

.styled-input {
  width: 100%;
  background: rgba(10, 12, 18, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  outline: none;
  transition: all 0.2s ease;
}

.styled-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

.uppercase-input {
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

/* Mode Selection Panel */
.mode-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.text-link-btn {
  background: none;
  border: none;
  color: var(--accent-cyan);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 2px 4px;
}

.text-link-btn:hover {
  color: #7dd3fc;
}

.mode-cards-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.mode-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: rgba(15, 18, 28, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 0.85rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.mode-card:hover {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(25, 30, 48, 0.8);
}

.mode-card.active {
  border-color: var(--accent-cyan);
  background: rgba(24, 38, 58, 0.85);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.35);
}

.mode-card input.mode-radio {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  accent-color: var(--accent-cyan);
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.mode-card-badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 4px;
  margin-bottom: 0.2rem;
}

.amulet-badge {
  background: rgba(56, 189, 248, 0.2);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.bullet-badge {
  background: rgba(168, 85, 247, 0.2);
  color: #d8b4fe;
  border: 1px solid rgba(168, 85, 247, 0.4);
}

.mode-card.active#modeCardBullet {
  border-color: var(--accent-purple);
  background: rgba(36, 22, 54, 0.85);
  box-shadow: 0 0 16px rgba(168, 85, 247, 0.35);
}

.mode-card-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.3px;
}

.mode-card-desc {
  font-size: 0.82rem;
  line-height: 1.35;
  color: #cbd5e1;
}

.mode-card-desc strong {
  color: #fff;
}

.mode-card-meta {
  font-size: 0.72rem;
  color: #64748b;
  margin-top: 0.2rem;
}

/* Actions Container */
.actions-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.btn-primary {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 0.85rem 1.2rem;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.45);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.6);
  filter: brightness(1.08);
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-primary:disabled {
  background: #334155;
  color: #94a3b8;
  cursor: not-allowed;
  box-shadow: none;
  opacity: 0.75;
}

.or-divider {
  display: flex;
  align-items: center;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: #64748b;
  margin: 0.2rem 0;
}

.or-divider::before, .or-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.or-divider span {
  padding: 0 0.6rem;
}

.join-room-row {
  display: flex;
  gap: 0.5rem;
}

.join-room-row .styled-input {
  flex: 1;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.7rem 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
}

/* ============================================================
   VIEW 2: LOBBY STYLING
   ============================================================ */
.lobby-content {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.25rem 1.1rem 2rem;
  min-height: 100%;
}

.lobby-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.back-link-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: color 0.15s ease;
}

.back-link-btn:hover {
  color: #fff;
}

.online-pulse-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #86efac;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  padding: 3px 8px;
  border-radius: 9999px;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulseDot 1.6s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

.room-code-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.85) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1px solid rgba(226, 232, 240, 0.3);
  border-radius: 12px;
  padding: 1.1rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.room-code-header {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #94a3b8;
  margin-bottom: 0.2rem;
}

.room-code-value {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 5px;
  color: #f8fafc;
  text-shadow: 0 0 16px rgba(226, 232, 240, 0.6);
  margin-bottom: 0.7rem;
}

.room-code-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.pill-action-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 9999px;
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #e2e8f0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.15s ease;
}

.pill-action-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: #fff;
}

.lobby-mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: #cbd5e1;
}

/* Players List in Lobby */
.lobby-players-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.players-title-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.player-count-badge {
  font-size: 0.72rem;
  font-weight: 800;
  background: rgba(56, 189, 248, 0.2);
  color: #7dd3fc;
  padding: 2px 6px;
  border-radius: 4px;
}

.small-add-btn {
  background: rgba(34, 197, 94, 0.2);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #86efac;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.small-add-btn:hover {
  background: rgba(34, 197, 94, 0.35);
}

.players-slots-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.player-slot-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  background: rgba(10, 12, 18, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  transition: all 0.15s ease;
}

.player-slot-card.occupied {
  border-color: rgba(255, 255, 255, 0.2);
}

.slot-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.slot-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.avatar-blue   { background-color: var(--accent-blue); }
.avatar-yellow { background-color: var(--accent-yellow); color: #000; }
.avatar-green  { background-color: var(--accent-green); }
.avatar-red    { background-color: var(--accent-red); }
.avatar-empty  { background-color: rgba(255, 255, 255, 0.08); color: #64748b; }

.slot-info {
  display: flex;
  flex-direction: column;
}

.slot-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
}

.slot-sub {
  font-size: 0.72rem;
  color: #94a3b8;
}

.slot-right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.slot-badge-host {
  font-size: 0.7rem;
  font-weight: 800;
  background: rgba(245, 158, 11, 0.2);
  color: #fde047;
  border: 1px solid rgba(245, 158, 11, 0.4);
  padding: 2px 6px;
  border-radius: 4px;
}

.slot-badge-bot {
  font-size: 0.7rem;
  font-weight: 800;
  background: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
}

.slot-remove-btn {
  background: none;
  border: none;
  color: #ef4444;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 2px 6px;
  opacity: 0.7;
}

.slot-remove-btn:hover {
  opacity: 1;
}

/* Empty slot pulse */
.player-slot-card.empty {
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.12);
  opacity: 0.75;
}

.player-slot-card.empty .slot-name {
  color: #64748b;
  font-weight: 600;
}

.readiness-banner {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  font-size: 0.78rem;
  color: #fde68a;
}

.readiness-banner.ready {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.3);
  color: #bbf7d0;
}

.host-only-note {
  font-size: 0.75rem;
  text-align: center;
  color: #64748b;
  margin-top: 0.4rem;
}

/* ============================================================
   VIEW 3: ACTIVE GAME TABLE STYLING
   ============================================================ */
.game-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 10px;
  background: rgba(10, 12, 18, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 10;
}

.game-back-btn, .game-rules-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: #cbd5e1;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  cursor: pointer;
}

.game-room-tag {
  font-size: 0.78rem;
  font-weight: 800;
  color: #94a3b8;
  letter-spacing: 0.4px;
}

/* Top Phase Banner */
.phase-banner {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  background: rgba(10, 12, 18, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.phase-title {
  font-size: clamp(11.5px, 3.2vw, 13.5px);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent-cyan);
}

.phase-subtitle {
  font-size: clamp(9.5px, 2.6vw, 11px);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
}

/* Card Geometry & 3D Flipping */
.card-container {
  position: relative;
  aspect-ratio: 1 / 1.48;
  perspective: 800px;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card-container:hover {
  transform: translateY(-3px) scale(1.03);
}

.card-container:active {
  transform: scale(0.97);
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
  border-radius: var(--card-radius);
}

.card-container.is-flipped .card-inner {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: var(--card-radius);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background-size: cover;
  background-position: center;
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.card-back {
  background-image: url('material/Back_of_cards.webp');
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.card-front {
  transform: rotateY(180deg);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Guard: Face-down cards must NEVER show front face; Flipped cards hide back face */
.card-container:not(.is-flipped) .card-front {
  display: none !important;
}

.card-container.is-flipped .card-back {
  display: none !important;
}

/* Selection / Peek Glows */
.card-container.glow-cyan .card-face {
  border: 2px solid var(--accent-cyan);
  box-shadow: var(--glow-cyan), var(--card-shadow);
}

.card-container.glow-gold .card-face {
  border: 2px solid var(--accent-gold);
  box-shadow: var(--glow-gold), var(--card-shadow);
}

/* Peek Badge Note */
.peek-badge {
  position: absolute;
  top: 3px;
  left: 5px;
  font-size: clamp(14px, 3.5vw, 17px);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 4px #000, 0 2px 6px #000;
  line-height: 1;
  z-index: 12;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  pointer-events: none;
}

.card-container.is-flipped .peek-badge {
  display: none !important;
}

/* Shield Badge (Bodyguard Protection) */
.shield-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 22px;
  height: 22px;
  padding: 0 4px;
  border-radius: 9999px;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  border: 1.5px solid #7dd3fc;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.8), 0 0 10px rgba(56, 189, 248, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  z-index: 15;
  pointer-events: none;
  animation: shieldPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.shield-badge.badge-pair-1 {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  border-color: #38bdf8;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.8), 0 0 12px rgba(56, 189, 248, 0.9);
}

.shield-badge.badge-pair-2 {
  background: linear-gradient(135deg, #d97706, #b45309);
  border-color: #fbbf24;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.8), 0 0 12px rgba(251, 191, 36, 0.9);
}

.shield-badge.badge-pair-3 {
  background: linear-gradient(135deg, #059669, #047857);
  border-color: #34d399;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.8), 0 0 12px rgba(52, 211, 153, 0.9);
}

@keyframes shieldPop {
  0% { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.card-container.is-protected {
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.8), inset 0 0 8px rgba(56, 189, 248, 0.4);
  border-radius: var(--card-radius);
}

.card-container.is-protected.pair-1,
.card-container.is-bodyguard-1,
.card-container.protected-pair-1 {
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.9), inset 0 0 8px rgba(56, 189, 248, 0.45) !important;
}
.card-container.is-protected.pair-1 .card-face,
.card-container.is-bodyguard-1 .card-face,
.card-container.protected-pair-1 .card-face {
  border-color: #38bdf8 !important;
}

.card-container.is-protected.pair-2,
.card-container.is-bodyguard-2,
.card-container.protected-pair-2 {
  box-shadow: 0 0 14px rgba(251, 191, 36, 0.9), inset 0 0 8px rgba(251, 191, 36, 0.45) !important;
}
.card-container.is-protected.pair-2 .card-face,
.card-container.is-bodyguard-2 .card-face,
.card-container.protected-pair-2 .card-face {
  border-color: #fbbf24 !important;
}

.card-container.is-protected.pair-3,
.card-container.is-bodyguard-3,
.card-container.protected-pair-3 {
  box-shadow: 0 0 14px rgba(52, 211, 153, 0.9), inset 0 0 8px rgba(52, 211, 153, 0.45) !important;
}
.card-container.is-protected.pair-3 .card-face,
.card-container.is-bodyguard-3 .card-face,
.card-container.protected-pair-3 .card-face {
  border-color: #34d399 !important;
}

/* Synchronized Hover Highlighting across Pairs */
.card-container.pair-hover-highlight {
  transform: translateY(-6px) scale(1.06) !important;
  z-index: 15 !important;
}
.card-container.pair-hover-highlight.pair-1 {
  box-shadow: 0 0 22px rgba(56, 189, 248, 1), 0 8px 18px rgba(0, 0, 0, 0.7) !important;
}
.card-container.pair-hover-highlight.pair-2 {
  box-shadow: 0 0 22px rgba(251, 191, 36, 1), 0 8px 18px rgba(0, 0, 0, 0.7) !important;
}
.card-container.pair-hover-highlight.pair-3 {
  box-shadow: 0 0 22px rgba(52, 211, 153, 1), 0 8px 18px rgba(0, 0, 0, 0.7) !important;
}

/* Bodyguard Visual Cover Overlay */
/* Facedown Card Cover: Bodyguard art prominently covers card with animated entrance */
.card-face.card-back .bodyguard-cover-overlay {
  position: absolute;
  inset: 4px;
  border-radius: calc(var(--card-radius) - 2px);
  background-image: url('material/3_BODYGUARD.jpg');
  background-size: cover;
  background-position: center top;
  z-index: 8;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.85);
  animation: bodyguardCoverEnter 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  overflow: hidden;
}

.card-face.card-back .bodyguard-cover-overlay.pair-1 {
  border: 2px solid #38bdf8;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.85), 0 0 12px rgba(56, 189, 248, 0.75);
}
.card-face.card-back .bodyguard-cover-overlay.pair-2 {
  border: 2px solid #fbbf24;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.85), 0 0 12px rgba(251, 191, 36, 0.75);
}
.card-face.card-back .bodyguard-cover-overlay.pair-3 {
  border: 2px solid #34d399;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.85), 0 0 12px rgba(52, 211, 153, 0.75);
}

/* Face-Up Card Cover: Covers lower-right, keeping top-left rank & character art detectable */
.card-face.card-front .bodyguard-cover-overlay {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 66%;
  height: 58%;
  border-radius: 8px 0 var(--card-radius) 0;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.3) 0%, rgba(15, 23, 42, 0.75) 100%),
              url('material/3_BODYGUARD.jpg') center top / cover no-repeat;
  z-index: 7;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding: 3px;
  animation: bodyguardCoverSlideCorner 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
  pointer-events: none;
  box-shadow: -3px -3px 8px rgba(0, 0, 0, 0.65);
}

.card-face.card-front .bodyguard-cover-overlay.pair-1 {
  border-top: 2px solid #38bdf8;
  border-left: 2px solid #38bdf8;
  box-shadow: -3px -3px 8px rgba(0, 0, 0, 0.65), 0 0 10px rgba(56, 189, 248, 0.7);
}
.card-face.card-front .bodyguard-cover-overlay.pair-2 {
  border-top: 2px solid #fbbf24;
  border-left: 2px solid #fbbf24;
  box-shadow: -3px -3px 8px rgba(0, 0, 0, 0.65), 0 0 10px rgba(251, 191, 36, 0.7);
}
.card-face.card-front .bodyguard-cover-overlay.pair-3 {
  border-top: 2px solid #34d399;
  border-left: 2px solid #34d399;
  box-shadow: -3px -3px 8px rgba(0, 0, 0, 0.65), 0 0 10px rgba(52, 211, 153, 0.7);
}

/* Inspect Peek on Hover: slides down so full card text is easily readable on request */
.card-container:hover .card-face.card-front .bodyguard-cover-overlay {
  transform: translateY(68%);
  opacity: 0.35;
}

.bodyguard-cover-tag {
  background: rgba(15, 23, 42, 0.88);
  color: #ffffff;
  font-size: 8px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 4px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}
.bodyguard-cover-overlay.pair-1 .bodyguard-cover-tag {
  border-color: #38bdf8;
  color: #7dd3fc;
}
.bodyguard-cover-overlay.pair-2 .bodyguard-cover-tag {
  border-color: #fbbf24;
  color: #fde68a;
}
.bodyguard-cover-overlay.pair-3 .bodyguard-cover-tag {
  border-color: #34d399;
  color: #a7f3d0;
}

@keyframes bodyguardCoverEnter {
  0% {
    opacity: 0;
    transform: translateY(-24px) scale(0.85);
  }
  60% {
    opacity: 1;
    transform: translateY(2px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes bodyguardCoverSlideCorner {
  0% {
    opacity: 0;
    transform: translate(18px, 18px) scale(0.85);
  }
  60% {
    opacity: 1;
    transform: translate(-2px, -2px) scale(1.03);
  }
  100% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
}

/* Face-Up Village Card Usable Power (0-4) */
.card-container.faceup-power-ready {
  cursor: pointer;
}

.card-container.faceup-power-ready:hover {
  transform: translateY(-4px) scale(1.05);
}

.power-ready-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  border-radius: 4px;
  padding: 1px 5px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.8), 0 0 8px rgba(245, 158, 11, 0.6);
  z-index: 14;
  display: flex;
  align-items: center;
  gap: 2px;
  pointer-events: none;
  animation: powerBadgePulse 1.8s ease-in-out infinite;
}

@keyframes powerBadgePulse {
  0%, 100% {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.8), 0 0 6px rgba(245, 158, 11, 0.5);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.9), 0 0 14px rgba(245, 158, 11, 0.9);
    transform: scale(1.08);
  }
}

/* Game Table Layout */
.game-table {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 4px 8px;
  flex: 1;
}

/* Player Badge Pills */
.player-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(9px, 2.5vw, 10.5px);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 2.5px 8px;
  border-radius: 9999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  z-index: 10;
  white-space: nowrap;
}

.badge-yellow { background-color: var(--accent-yellow); color: #000; }
.badge-green  { background-color: var(--accent-green);  color: #fff; }
.badge-red    { background-color: var(--accent-red);    color: #fff; }
.badge-blue   { background-color: var(--accent-blue);   color: #fff; }

/* 1. TOP PLAYER: TED 3000 */
.top-player-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 3px;
}

.top-cards-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(4px, 1.4vw, 8px);
  width: 100%;
}

.top-cards-row .card-container {
  width: clamp(44px, 13vw, 56px);
}

/* 2. MIDDLE ARENA: Left Player, Center Table, Right Player */
.middle-arena {
  position: relative;
  display: flex;
  flex: 1;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  padding: 2px 0;
  min-height: 200px;
}

/* LEFT PLAYER: T0-N1 (Name placed ABOVE cards column) */
.left-player-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-left: clamp(10px, 3vw, 16px);
  position: relative;
  z-index: 10;
}

.left-cards-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: clamp(56px, 16vw, 68px);
}

.left-cards-column .card-container {
  width: clamp(38px, 10.5vw, 46px);
  transform: rotate(90deg);
  margin: -10px 0;
}

/* RIGHT PLAYER: Ren33-BOT (FIX: Profile name badge moved ABOVE cards column so it is never under cards!) */
.right-player-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-right: clamp(10px, 3vw, 16px);
  position: relative;
  z-index: 10;
}

.right-cards-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: clamp(56px, 16vw, 68px);
}

.right-cards-column .card-container {
  width: clamp(38px, 10.5vw, 46px);
  transform: rotate(-90deg);
  margin: -10px 0;
}

/* Side Player Badge Wrapper (Clean horizontal badge centered above cards) */
.side-player-badge-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 20;
  margin-bottom: 2px;
}

/* CENTER TABLE: Unplayed Deck & Discard Pile */
.center-table-area {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  gap: 8px;
}

.piles-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 2vw, 16px);
  flex-wrap: wrap;
  max-width: 100%;
}

.pile-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.pile-card {
  width: clamp(48px, 13vw, 66px);
  aspect-ratio: 1 / 1.48;
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  background-size: cover;
  background-position: center;
}

.pile-card:hover {
  transform: translateY(-4px) scale(1.05);
}

.discard-card {
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.deck-card {
  background-image: url('material/Back_of_cards.webp');
  border: 1px solid rgba(255, 255, 255, 0.15);
  position: relative;
}

/* Squire Face-Up Display Pile Cards */
.squire-display-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 2vw, 12px);
  flex-wrap: wrap;
}

.squire-pile-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.squire-card {
  border: 1.5px solid #38bdf8;
  position: relative;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
}

.squire-card.turn-pulse {
  animation: squirePulse 1.6s ease-in-out infinite;
}

@keyframes squirePulse {
  0%, 100% {
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
    border-color: #38bdf8;
    transform: translateY(0);
  }
  50% {
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.9), 0 0 30px rgba(56, 189, 248, 0.5);
    border-color: #bae6fd;
    transform: translateY(-2px);
  }
}

/* 3D Stack Effect for Deck */
.deck-card::after {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  right: 3px;
  bottom: 3px;
  border-radius: var(--card-radius);
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(20, 20, 30, 0.9);
  z-index: -1;
  box-shadow: -2px -2px 4px rgba(0, 0, 0, 0.7);
}

.pile-label {
  font-size: clamp(9px, 2.5vw, 10.5px);
  font-weight: 700;
  color: #94a3b8;
  text-shadow: 0 1px 3px #000;
}

/* 3. BOTTOM PLAYER: Temba */
.bottom-player-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 4px;
}

.bottom-cards-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(4px, 1.4vw, 8px);
  width: 100%;
}

.bottom-cards-row .card-container {
  width: clamp(48px, 14.5vw, 64px);
}

.setup-controls-row {
  display: flex;
  justify-content: center;
  min-height: 28px;
}

.action-btn-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--accent-cyan), #0284c7);
  color: #fff;
  border: none;
  padding: 4px 14px;
  font-size: clamp(10px, 2.8vw, 12px);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-radius: 9999px;
  box-shadow: 0 3px 10px rgba(56, 189, 248, 0.4);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  animation: bounceBtn 2s infinite;
}

@keyframes bounceBtn {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

/* 4. SCOREBOARD FOOTER BAR */
.scoreboard-bar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: rgba(8, 9, 13, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.score-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 48px;
}

.score-num {
  font-size: clamp(15px, 4.2vw, 18px);
  font-weight: 900;
  line-height: 1;
}

.score-label {
  font-size: clamp(8.5px, 2.3vw, 10px);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-top: 2px;
}

.score-red    .score-num { color: var(--accent-red); }
.score-red    .score-label { color: var(--accent-red); }
.score-blue   .score-num { color: var(--accent-cyan); }
.score-blue   .score-label { color: var(--accent-cyan); }
.score-green  .score-num { color: var(--accent-green); }
.score-green  .score-label { color: var(--accent-green); }
.score-yellow .score-num { color: var(--accent-yellow); }
.score-yellow .score-label { color: var(--accent-yellow); }

.round-info-center {
  display: flex;
  align-items: center;
  gap: 6px;
}

.round-text-group {
  display: flex;
  align-items: baseline;
  gap: 3px;
}

.round-num {
  font-size: clamp(13px, 3.6vw, 15px);
  font-weight: 900;
  color: #fff;
}

.round-word {
  font-size: clamp(9px, 2.4vw, 10.5px);
  font-weight: 800;
  text-transform: uppercase;
  color: #94a3b8;
}

.settings-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s ease;
}

.settings-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  transform: rotate(45deg);
}

/* ============================================================
   MODALS & OVERLAYS
   ============================================================ */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-box {
  background: #141722;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  padding: 1.25rem;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
}

.modal-box.large-modal {
  max-width: 440px;
  max-height: 85vh;
}

.modal-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.85rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
}

.modal-close-btn:hover {
  color: #fff;
}

.modal-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--accent-cyan), #0284c7);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.75rem;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-btn:hover {
  filter: brightness(1.1);
}

.btn-secondary-modal {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary-modal:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* Comparison Modal Details */
.rules-modal-scroll {
  overflow-y: auto;
  max-height: 60vh;
  padding-right: 4px;
  margin-bottom: 1rem;
}

.rules-lead {
  font-size: 0.82rem;
  color: #cbd5e1;
  line-height: 1.4;
  margin-bottom: 0.85rem;
}

.comparison-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.compare-card {
  border-radius: 10px;
  padding: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(20, 24, 38, 0.6);
}

.compare-amulet {
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(24, 40, 60, 0.4);
}

.compare-bullet {
  border-color: rgba(168, 85, 247, 0.35);
  background: rgba(40, 22, 58, 0.4);
}

.compare-card-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.compare-card-header h4 {
  font-size: 0.92rem;
  font-weight: 800;
  color: #fff;
}

.compare-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.compare-list li {
  font-size: 0.78rem;
  color: #cbd5e1;
  line-height: 1.35;
  padding-left: 0.8rem;
  position: relative;
}

.compare-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--accent-cyan);
}

.compare-bullet .compare-list li::before {
  color: var(--accent-purple);
}

/* Toast Notification */
.toast-popup {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--accent-cyan);
  border-radius: 9999px;
  padding: 6px 16px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7);
  z-index: 200;
  pointer-events: none;
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast-popup.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   PULL TO REFRESH INDICATOR
   ============================================================ */
.pull-refresh-indicator {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(-70px);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(56, 189, 248, 0.45);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
  padding: 6px 14px;
  border-radius: 9999px;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.1s ease-out;
}

.pull-refresh-spinner {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: transform 0.2s ease;
}

.pull-refresh-indicator.can-refresh {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.5), 0 4px 20px rgba(0, 0, 0, 0.7);
}

.pull-refresh-indicator.can-refresh .pull-refresh-spinner {
  transform: rotate(180deg) scale(1.15);
}

.pull-refresh-indicator.refreshing .pull-refresh-spinner {
  animation: spinRefresh 0.7s linear infinite;
}

@keyframes spinRefresh {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.refresh-text {
  font-size: 0.78rem;
  font-weight: 700;
  color: #cbd5e1;
  letter-spacing: 0.3px;
}

/* ============================================================
   ACTIVE POWER GUIDE BANNER (Interactive On-Board Helper)
   ============================================================ */
.active-power-guide {
  position: relative;
  z-index: 45;
  width: calc(100% - 16px);
  max-width: 440px;
  margin: 4px auto 6px auto;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.98) 0%, rgba(30, 41, 59, 0.98) 100%);
  border: 1.5px solid var(--accent-cyan);
  border-radius: 10px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.75), 0 0 12px rgba(56, 189, 248, 0.3);
  animation: slideDownGuide 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideDownGuide {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.power-guide-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  overflow: hidden;
}

.power-guide-badge {
  font-size: 0.72rem;
  font-weight: 900;
  color: #fde047;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.power-guide-instruction {
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.25;
}

.power-guide-targets {
  display: flex;
  gap: 6px;
  align-items: center;
}

.power-target-btn {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid var(--accent-cyan);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.power-target-btn:hover {
  background: var(--accent-cyan);
  color: #0f172a;
}

.power-guide-skip-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #cbd5e1;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.power-guide-skip-btn:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: rgba(239, 68, 68, 0.6);
  color: #fff;
}

/* Discard Queue Picker (Master 10 Ability) */
.discard-queue-picker {
  position: relative;
  z-index: 46;
  width: calc(100% - 16px);
  max-width: 420px;
  margin: 4px auto 8px auto;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.98) 0%, rgba(30, 41, 59, 0.98) 100%);
  border: 1.5px solid var(--accent-cyan);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.85), 0 0 16px rgba(56, 189, 248, 0.35);
  animation: slideDownGuide 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.discard-queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.discard-queue-title {
  font-size: 0.74rem;
  font-weight: 900;
  color: var(--accent-cyan);
  letter-spacing: 0.6px;
}

.discard-queue-counter {
  font-size: 0.7rem;
  font-weight: 800;
  color: #fde047;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 1px 7px;
  border-radius: 9999px;
}

.discard-queue-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.discard-nav-btn {
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: #fff;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.discard-nav-btn:not(:disabled):hover {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  color: #0f172a;
  transform: scale(1.08);
}

.discard-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.discard-card-display {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 6px 10px;
  overflow: hidden;
}

.discard-queue-preview {
  width: 44px;
  aspect-ratio: 1 / 1.48;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
  flex-shrink: 0;
}

.discard-queue-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  flex: 1;
}

.discard-queue-name {
  font-size: 0.92rem;
  font-weight: 900;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.discard-queue-desc {
  font-size: 0.72rem;
  color: #cbd5e1;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.discard-queue-footer {
  width: 100%;
}

.discard-select-btn {
  width: 100%;
  min-height: 40px;
  background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 3px 12px rgba(56, 189, 248, 0.45);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.discard-select-btn:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
}

/* Pulsing highlight for eligible card targets during abilities */
.card-container.ability-target-card {
  cursor: pointer;
  animation: abilityTargetBounce 1.2s infinite alternate ease-in-out;
}

@keyframes abilityTargetBounce {
  0% { transform: translateY(0); }
  100% { transform: translateY(-4px); }
}

.card-container.ability-target-card .card-face {
  border: 2px solid var(--accent-cyan) !important;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.95), var(--card-shadow) !important;
  animation: abilityGlowPulse 1.2s infinite alternate ease-in-out;
}

@keyframes abilityGlowPulse {
  0% {
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.6), var(--card-shadow);
    filter: brightness(1);
  }
  100% {
    box-shadow: 0 0 22px rgba(56, 189, 248, 1), 0 0 32px rgba(56, 189, 248, 0.7), var(--card-shadow);
    filter: brightness(1.2);
  }
}

@keyframes pulseHelp {
  0% { transform: scale(1); filter: drop-shadow(0 0 0px var(--accent-cyan)); }
  50% { transform: scale(1.03); filter: drop-shadow(0 0 12px var(--accent-cyan)); }
  100% { transform: scale(1); filter: drop-shadow(0 0 0px var(--accent-cyan)); }
}

.pulse-help {
  animation: pulseHelp 0.6s ease-in-out 2;
}

/* ============================================================
   ACTIVE TURN & DRAWN CARD STAGE
   ============================================================ */
.drawn-card-stage {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.98) 0%, rgba(30, 41, 59, 0.96) 100%);
  border: 1.5px solid var(--accent-cyan);
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 6px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.75), 0 0 14px rgba(56, 189, 248, 0.25);
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: slideUpStage 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 25;
}

@keyframes slideUpStage {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.drawn-card-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.drawn-card-preview {
  width: 48px;
  aspect-ratio: 1 / 1.48;
  border-radius: var(--card-radius);
  background-size: cover;
  background-position: center;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  flex-shrink: 0;
}

.drawn-card-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
  flex: 1;
}

.drawn-card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawn-card-source {
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--accent-cyan);
}

.drawn-card-title {
  font-size: 0.96rem;
  font-weight: 900;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.drawn-card-ability {
  font-size: 0.76rem;
  color: #e2e8f0;
  line-height: 1.35;
  background: rgba(255, 255, 255, 0.07);
  border-left: 3px solid var(--accent-cyan);
  border-radius: 0 6px 6px 0;
  padding: 5px 8px;
  margin-top: 2px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ability-tag-label {
  font-size: 0.65rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #fde047;
}

.ability-tag-text {
  font-weight: 600;
  color: #f1f5f9;
}

/* Modern Balanced Action Buttons */
.drawn-actions-row {
  display: flex;
  gap: 10px;
  width: 100%;
}

.action-btn-discard {
  flex: 1;
  min-height: 44px;
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: #fff;
  font-size: clamp(0.78rem, 2.5vw, 0.85rem);
  font-weight: 800;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-shadow: 0 3px 10px rgba(185, 28, 28, 0.4);
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}

.action-btn-discard.action-btn-power {
  background: linear-gradient(135deg, #d97706 0%, #ea580c 50%, #dc2626 100%);
  border-color: rgba(253, 224, 71, 0.4);
  box-shadow: 0 3px 12px rgba(234, 88, 12, 0.45);
}

.action-btn-discard:hover, .action-btn-discard:active {
  filter: brightness(1.12);
  transform: translateY(-1px);
}

.action-btn-exchange {
  flex: 1;
  min-height: 44px;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: #e2e8f0;
  font-size: clamp(0.78rem, 2.5vw, 0.85rem);
  font-weight: 800;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.action-btn-exchange.is-ready {
  background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 3px 12px rgba(56, 189, 248, 0.5), 0 0 10px rgba(56, 189, 248, 0.3);
}

.action-btn-exchange.is-ready-gold {
  background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 3px 12px rgba(245, 158, 11, 0.5), 0 0 10px rgba(245, 158, 11, 0.3);
}

.action-btn-exchange:hover, .action-btn-exchange:active {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.action-btn-plain-discard {
  width: 100%;
  min-height: 32px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: #94a3b8;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
  user-select: none;
}

.action-btn-plain-discard:hover, .action-btn-plain-discard:active {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  transform: translateY(-1px);
}

/* Call Silver Metallic Button */
.action-btn-silver {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(135deg, #cbd5e1 0%, #94a3b8 50%, #e2e8f0 100%);
  color: #0f172a;
  border: 1px solid #fff;
  padding: 4px 14px;
  font-size: clamp(10px, 2.8vw, 12px);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-radius: 9999px;
  box-shadow: 0 3px 12px rgba(226, 232, 240, 0.45);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.action-btn-silver:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 5px 16px rgba(255, 255, 255, 0.6);
}

/* End Turn Action Button */
.action-btn-endturn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: 1.5px solid #6ee7b7;
  padding: 5px 16px;
  font-size: clamp(11px, 2.8vw, 13px);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-radius: 9999px;
  box-shadow: 0 3px 12px rgba(16, 185, 129, 0.45);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: endTurnAttention 1.5s infinite alternate ease-in-out;
}

.action-btn-endturn:hover {
  transform: translateY(-2px) scale(1.06);
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  box-shadow: 0 5px 18px rgba(16, 185, 129, 0.7);
}

@keyframes endTurnAttention {
  0% { transform: scale(1); box-shadow: 0 3px 12px rgba(16, 185, 129, 0.45); }
  100% { transform: scale(1.05); box-shadow: 0 4px 18px rgba(52, 211, 153, 0.85); }
}

/* Turn Available Glow on Draw Deck and Discard Pile */
.pile-card.turn-pulse {
  border-color: var(--accent-cyan) !important;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.8), var(--card-shadow) !important;
  animation: pulseCard 1.8s infinite alternate ease-in-out;
}

@keyframes pulseCard {
  0% { transform: scale(1); filter: brightness(1); }
  100% { transform: scale(1.05); filter: brightness(1.15); }
}

/* Selection States for Village Cards */
.card-container.selected-cyan .card-inner {
  transform: translateY(-8px);
}

.card-container.selected-cyan .card-face {
  border: 2px solid var(--accent-cyan) !important;
  box-shadow: var(--glow-cyan), var(--card-shadow) !important;
}

.card-container.selected-gold .card-inner {
  transform: translateY(-8px);
}

.card-container.selected-gold .card-face {
  border: 2px solid var(--accent-gold) !important;
  box-shadow: var(--glow-gold), var(--card-shadow) !important;
}

/* Round End Modal Content */
.round-end-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 55vh;
  overflow-y: auto;
  margin-bottom: 0.75rem;
}

.round-end-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 8px 10px;
}

.round-end-row.winner {
  border-color: var(--accent-gold);
  background: rgba(245, 158, 11, 0.15);
}

.round-end-player-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 800;
}

.round-end-cards {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mini-card-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.72rem;
  font-weight: 700;
}

.round-end-score-badge {
  font-size: 0.95rem;
  font-weight: 900;
  color: #fff;
}



/* ============================================================
   ONLINE MULTIPLAYER: ACCOUNTS, PRESENCE & CONNECTION STATUS
   ============================================================ */
[hidden] {
  display: none !important;
}

input, textarea {
  user-select: text;
  -webkit-user-select: text;
}

.play-area {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-loading {
  font-size: 0.85rem;
  color: #94a3b8;
  text-align: center;
  padding: 0.5rem 0;
}

.signed-out-box {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.signed-out-box .panel-label {
  margin-bottom: 0;
}

.guest-btn {
  margin-top: 0.15rem;
}

.auth-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.15rem 0.35rem;
  margin-top: 0.35rem;
}

.auth-links-sep {
  color: #475569;
  font-size: 0.8rem;
}

.account-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.account-row .slot-avatar {
  width: 40px;
  height: 40px;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.account-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.account-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-sub {
  font-size: 0.75rem;
  color: #94a3b8;
}

.account-form {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.form-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #cbd5e1;
}

.form-hint {
  font-size: 0.78rem;
  line-height: 1.45;
  color: #94a3b8;
}

.form-hint:empty,
.form-error:empty {
  display: none;
}

.form-error {
  font-size: 0.8rem;
  font-weight: 700;
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
}

.modal-btn:disabled,
.btn-secondary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Lobby presence */
.slot-presence {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: 0.35rem;
  vertical-align: middle;
  background: var(--accent-green);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.8);
}

.slot-presence.offline {
  background: #64748b;
  box-shadow: none;
}

.slot-you {
  font-size: 0.75rem;
  color: var(--accent-cyan);
}

.last-result-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.last-result-list li {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #e2e8f0;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  background: rgba(10, 12, 18, 0.6);
}

.last-result-list li.winner {
  color: #fde047;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

/* Table presence: whose turn it is, who is offline */
.player-badge.is-turn {
  outline: 2px solid #fde047;
  outline-offset: 2px;
  box-shadow: 0 0 14px rgba(253, 224, 71, 0.75);
}

.player-badge.is-offline {
  filter: grayscale(0.8) brightness(0.8);
}

.connection-banner {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(127, 29, 29, 0.92);
  border: 1px solid rgba(239, 68, 68, 0.6);
  color: #fee2e2;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 9999px;
  z-index: 300;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
}

.connection-banner .pulse-dot {
  background: #fca5a5;
}

.toast-popup {
  max-width: calc(100% - 32px);
  white-space: normal;
  text-align: center;
  border-radius: 14px;
}

.round-end-waiting {
  font-size: 0.78rem;
  text-align: center;
  color: #94a3b8;
  margin-top: 0.5rem;
}
