/**
 * Virtual Remote Mobile Controller CSS
 * Ultra-Responsive, Full-Screen App-Like Touch Interface for Quiz Players
 */

body.player-page-body {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  margin: 0;
  padding: 0;
  background-color: #080c16;
  background-image: 
    radial-gradient(circle at 20% 10%, rgba(99, 102, 241, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 80% 90%, rgba(16, 185, 129, 0.08) 0%, transparent 40%);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.player-wrapper {
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
  padding: 0.5rem 0.65rem 0.65rem 0.65rem;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-height: 100dvh;
  box-sizing: border-box;
  gap: 0.45rem;
}

/* Header & Player Identity Bar */
.player-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(17, 24, 39, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.45rem 0.75rem;
  border-radius: 14px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.player-identity {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.2rem 0.35rem;
  border-radius: 8px;
  transition: background 0.2s;
  min-width: 0;
}

.player-identity:active {
  background: rgba(255, 255, 255, 0.1);
}

.player-avatar-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 8px currentColor;
  flex-shrink: 0;
}

.player-name-display {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-edit-icon {
  font-size: 0.7rem;
  opacity: 0.6;
  flex-shrink: 0;
}

.player-stats {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.player-score-chip {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(16, 185, 129, 0.25));
  border: 1px solid rgba(99, 102, 241, 0.4);
  padding: 0.2rem 0.65rem;
  border-radius: 9999px;
  font-weight: 800;
  font-size: 0.85rem;
  color: #34d399;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

/* Quiz & Question Info Card */
.quiz-info-card {
  background: rgba(17, 24, 39, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0.45rem 0.75rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.quiz-title-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: #818cf8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.15rem;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.question-status-heading {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-primary);
}

.question-text-peek {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.3;
  margin-top: 0.25rem;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-align: left;
}

/* Big Live State Banner */
.remote-status-banner {
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  font-weight: 800;
  font-size: 0.9rem;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

.remote-status-banner.locked {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.remote-status-banner.open {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.3), rgba(6, 182, 212, 0.3));
  border: 2px solid #10b981;
  color: #34d399;
  animation: pulse-border 1.2s infinite alternate;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.4);
}

.remote-status-banner.won-first {
  background: linear-gradient(135deg, #f59e0b, #eab308);
  border: 2px solid #fde047;
  color: #0f172a;
  font-size: 0.95rem;
  animation: winner-bounce 0.5s ease;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.6);
}

.remote-status-banner.other-won {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
}

.remote-status-banner.answered {
  background: rgba(59, 130, 246, 0.25);
  border: 2px solid #3b82f6;
  color: #60a5fa;
}

.remote-status-banner.correct {
  background: linear-gradient(135deg, #10b981, #059669);
  border: 2px solid #34d399;
  color: white;
  animation: winner-bounce 0.5s ease;
}

.remote-status-banner.wrong {
  background: rgba(239, 68, 68, 0.25);
  border: 2px solid #ef4444;
  color: #fca5a5;
}

/* 4 Big Buzzer Buttons (2x2 Dynamic Full-Height Touch Grid) */
.buzzer-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 0.65rem;
  flex: 1;
  min-height: 0; /* Critical for flex child grid filling */
  touch-action: manipulation;
}

.player-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  border: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  padding: 0.5rem;
  height: 100%;
  box-sizing: border-box;
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.15s ease, opacity 0.15s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.2);
}

.player-btn:active {
  transform: scale(0.93);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.player-btn.disabled {
  opacity: 0.4;
  filter: grayscale(40%);
  cursor: not-allowed;
}

.player-btn.selected {
  outline: 4px solid white;
  transform: scale(0.96);
  filter: brightness(1.2);
  box-shadow: 0 0 25px rgba(255, 255, 255, 0.7);
}

/* Individual Choice Button Colors & Icons */
.btn-choice-a {
  background: linear-gradient(145deg, #ef4444, #dc2626);
  color: white;
}
.btn-choice-a:not(.disabled):hover {
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.5);
}

.btn-choice-b {
  background: linear-gradient(145deg, #3b82f6, #2563eb);
  color: white;
}
.btn-choice-b:not(.disabled):hover {
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.5);
}

.btn-choice-c {
  background: linear-gradient(145deg, #f59e0b, #d97706);
  color: #0f172a;
}
.btn-choice-c:not(.disabled):hover {
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.5);
}

.btn-choice-d {
  background: linear-gradient(145deg, #10b981, #059669);
  color: white;
}
.btn-choice-d:not(.disabled):hover {
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.5);
}

.btn-letter {
  font-size: clamp(2rem, 9vw, 3.2rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.03em;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.btn-shape-icon {
  font-size: clamp(1rem, 4vw, 1.4rem);
  margin-top: 0.1rem;
  opacity: 0.85;
}

.btn-label-text {
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0.92;
  text-transform: uppercase;
  margin-top: 0.2rem;
  max-width: 90%;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

/* Modals & Customization Sheets */
.player-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 10000;
  display: none; /* Hidden by default */
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}

.player-modal-backdrop.open {
  display: flex !important;
}

.player-modal {
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 1.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.7);
  animation: modal-pop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.color-picker-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.5rem;
  margin: 1rem 0;
}

.color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s, border-color 0.15s;
}

.color-swatch:hover, .color-swatch.active {
  transform: scale(1.15);
  border-color: white;
}

/* Keyframes */
@keyframes pulse-border {
  0% { box-shadow: 0 0 8px rgba(16, 185, 129, 0.2); }
  100% { box-shadow: 0 0 22px rgba(16, 185, 129, 0.6); }
}

@keyframes winner-bounce {
  0% { transform: scale(0.92); }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

@keyframes modal-pop {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
