/* Design System: QR Visual Transfer (Cyberpunk / Sci-Fi Theme) */

:root {
  --bg-deep: #0a0b10;
  --bg-dark: #0f111a;
  --primary: #00f0ff; /* Electric Cyan */
  --secondary: #bd00ff; /* Cyberpunk Purple */
  --accent: #39ff14; /* Matrix Green */
  --warning: #ff007f; /* Cyberpunk Pink */
  --text-main: #f0f3ff;
  --text-muted: #8a96c4;
  --border-alpha: rgba(0, 240, 255, 0.15);
  --glass-bg: rgba(15, 17, 26, 0.65);
  --font-mono: 'Share Tech Mono', monospace;
  --font-display: 'Orbitron', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-mono);
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
}

/* Background Effects */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 50%, rgba(189, 0, 255, 0.08) 0%, transparent 60%),
              radial-gradient(circle at 10% 20%, rgba(0, 240, 255, 0.05) 0%, transparent 40%);
  z-index: -1;
  pointer-events: none;
}

/* Star field decoration (Pure CSS - 100% Offline & No CORS/403) */
.stars {
  position: fixed;
  top: 0;
  left: 0;
  width: 2px;
  height: 2px;
  background: transparent;
  box-shadow: 
    120px 200px #fff, 350px 80px #fff, 100px 600px #fff, 750px 420px #fff, 900px 150px #fff,
    15vw 45vh rgba(255,255,255,0.7), 35vw 75vh #fff, 55vw 15vh rgba(255,255,255,0.4),
    70vw 60vh rgba(255,255,255,0.9), 90vw 25vh #fff, 5vw 95vh rgba(255,255,255,0.5),
    45vw 20vh #fff, 80vw 80vh rgba(255,255,255,0.8), 65vw 85vh #fff, 25vw 10vh #fff;
  z-index: -3;
  opacity: 0.6;
  animation: twinkle 8s infinite ease-in-out;
}

.twinkling {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  background: transparent;
  box-shadow: 
    200px 300px #00f0ff, 450px 180px #bd00ff, 150px 500px #fff, 850px 320px #00f0ff, 950px 250px #bd00ff,
    5vw 25vh rgba(0,240,255,0.8), 25vw 85vh #fff, 65vw 35vh rgba(189,0,255,0.7),
    80vw 50vh rgba(0,240,255,0.9), 95vw 15vh #fff, 12vw 90vh rgba(189,0,255,0.6);
  z-index: -2;
  opacity: 0.5;
  animation: twinkle 4s infinite ease-in-out alternate;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.8; }
}

/* Typography & Glitch */
h1, h2, h3 {
  font-family: var(--font-display);
  letter-spacing: 2px;
}

.glitch {
  position: relative;
  font-weight: 900;
  font-size: 3rem;
  color: var(--text-main);
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-deep);
}

.glitch::before {
  left: 2px;
  text-shadow: -2px 0 var(--warning);
  clip: rect(44px, 450px, 56px, 0);
  animation: glitch-anim 5s infinite linear alternate-reverse;
}

.glitch::after {
  left: -2px;
  text-shadow: -2px 0 var(--primary), 0 2px var(--accent);
  clip: rect(85px, 450px, 140px, 0);
  animation: glitch-anim2 5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
  0% { clip: rect(15px, 9999px, 66px, 0); }
  100% { clip: rect(34px, 9999px, 55px, 0); }
}

@keyframes glitch-anim2 {
  0% { clip: rect(70px, 9999px, 105px, 0); }
  100% { clip: rect(12px, 9999px, 85px, 0); }
}

/* HUB / Index Styles */
.hub-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-height: 100vh;
  padding: 3rem 1.5rem;
}

.hub-header {
  text-align: center;
  margin-bottom: 2rem;
}

.logo-container {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 1rem auto;
  background: rgba(0, 240, 255, 0.1);
  border: 2px solid var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}

.logo-glow {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow: 0 0 20px var(--primary);
  animation: pulse-glow 2s infinite ease-in-out;
}

@keyframes pulse-glow {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.1); opacity: 0.9; }
}

.subtitle {
  color: var(--text-muted);
  margin-top: 0.5rem;
  letter-spacing: 3px;
  font-size: 0.9rem;
}

/* Cards Grid */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  width: 100%;
  max-width: 900px;
  margin: 2rem 0;
}

@media (min-width: 768px) {
  .card-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.hub-card {
  text-decoration: none;
  color: inherit;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-alpha);
  border-radius: 12px;
  padding: 2.5rem;
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  cursor: pointer;
}

.hub-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  opacity: 0.7;
}

.hub-card:hover {
  transform: translateY(-8px);
  border-color: rgba(0, 240, 255, 0.4);
  box-shadow: 0 10px 30px rgba(0, 240, 255, 0.15);
}

.card-glow {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(0, 240, 255, 0.05) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}

.hub-card:hover .card-glow {
  opacity: 1;
}

.card-icon {
  font-size: 3rem;
  margin-bottom: 1.5rem;
}

.hub-card h2 {
  font-size: 1.8rem;
  margin-bottom: 0.2rem;
  color: #fff;
  transition: color 0.3s;
}

.hub-card:hover h2 {
  color: var(--primary);
}

.sender-card:hover h2 {
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}

.receiver-card:hover h2 {
  text-shadow: 0 0 10px rgba(189, 0, 255, 0.3);
}

.card-code {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--text-muted);
  border: 1px solid rgba(138, 150, 196, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.hub-card p {
  color: var(--text-muted);
  line-height: 1.6;
  font-size: 0.95rem;
}

/* Status Indicator Footer */
.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

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

@keyframes pulse-green {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

/* Dashboard Styles (Sender / Receiver Layouts) */
.page-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-alpha);
  margin-bottom: 1.5rem;
}

.back-btn {
  text-decoration: none;
  color: var(--text-muted);
  border: 1px solid var(--border-alpha);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  transition: all 0.3s;
  background: rgba(255,255,255,0.02);
}

.back-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

.page-title {
  font-size: 1.5rem;
  color: #fff;
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.2);
}

/* Main Grid Layout for App Pages */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 992px) {
  .dashboard-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Panel Design */
.panel {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-alpha);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.panel-header {
  border-bottom: 1px solid var(--border-alpha);
  padding-bottom: 0.75rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Drag & Drop Area */
.drop-zone {
  border: 2px dashed rgba(0, 240, 255, 0.2);
  border-radius: 12px;
  padding: 3rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  background: rgba(0, 240, 255, 0.01);
  backdrop-filter: blur(8px);
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}

.drop-zone::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: radial-gradient(circle at center, rgba(0, 240, 255, 0.08) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.drop-zone:hover::before, .drop-zone.dragover::before {
  opacity: 1;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--primary);
  border-style: solid;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.25), inset 0 0 15px rgba(0, 240, 255, 0.05);
  transform: translateY(-2px);
}

.drop-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.drop-zone:hover .drop-icon {
  transform: scale(1.15) translateY(-2px);
}

/* File Info Box */
.file-info-box {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  display: none;
}

.file-info-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.file-info-label {
  color: var(--text-muted);
}

.file-info-value {
  color: #fff;
  font-weight: bold;
}

/* Controls & Controls Group */
.control-group {
  margin-bottom: 1.25rem;
}

.control-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.control-val {
  color: var(--primary);
  font-weight: bold;
}

select, input[type="range"] {
  width: 100%;
  background: #141622;
  color: #fff;
  border: 1px solid var(--border-alpha);
  border-radius: 6px;
  padding: 8px 12px;
  font-family: var(--font-mono);
  outline: none;
}

input[type="range"] {
  height: 6px;
  -webkit-appearance: none;
  background: #141622;
  padding: 0;
  border: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 0 8px var(--primary);
}

/* Action Buttons */
.btn-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: auto;
}

.btn {
  font-family: var(--font-display);
  font-weight: bold;
  border: 1px solid var(--primary);
  border-radius: 6px;
  padding: 12px;
  cursor: pointer;
  background: rgba(0, 240, 255, 0.05);
  color: var(--primary);
  font-size: 0.9rem;
  transition: all 0.3s;
  text-align: center;
  outline: none;
}

.btn:hover {
  background: var(--primary);
  color: #000;
  box-shadow: 0 0 15px var(--primary);
}

.btn-secondary {
  border-color: var(--secondary);
  background: rgba(189, 0, 255, 0.05);
  color: var(--secondary);
}

.btn-secondary:hover {
  background: var(--secondary);
  color: #fff;
  box-shadow: 0 0 15px var(--secondary);
}

.btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  box-shadow: none !important;
  background: transparent !important;
  color: var(--text-muted) !important;
  border-color: var(--border-alpha) !important;
}

.holo-pedestal {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-grow: 1;
  width: 100%;
  padding: 1.5rem;
  background: radial-gradient(circle, rgba(0, 240, 255, 0.03) 0%, transparent 70%);
  border-radius: 12px;
  min-height: 350px;
}

.qr-grid-wrapper {
  display: grid;
  gap: 12px;
  margin: auto;
  position: relative;
  width: 100%;
  max-width: 520px;
}

.qr-container {
  background: #fff;
  padding: 8px;
  border-radius: 8px;
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.15);
  border: 2px solid var(--primary);
  position: relative;
  transition: transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.qr-code-element {
  width: 100% !important;
  height: 100% !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-code-element canvas,
.qr-code-element img {
  max-width: 100% !important;
  max-height: 100% !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
}

.qr-frame-corner {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid var(--warning);
  pointer-events: none;
}

.top-left { top: -2px; left: -2px; border-right: none; border-bottom: none; }
.top-right { top: -2px; right: -2px; border-left: none; border-bottom: none; }
.bottom-left { bottom: -2px; left: -2px; border-right: none; border-top: none; }
.bottom-right { bottom: -2px; right: -2px; border-left: none; border-top: none; }

/* Camera Viewport and Scan Target Overlay */
.camera-wrapper {
  position: relative;
  width: 100%;
  height: 280px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-alpha);
  background: #000;
  margin-bottom: 1.5rem;
}

.camera-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  box-shadow: inset 0 0 80px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.scan-target {
  width: 200px;
  height: 200px;
  border: 2px dashed rgba(0, 240, 255, 0.4);
  position: relative;
}

.laser-line {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--warning);
  box-shadow: 0 0 10px var(--warning);
  animation: laser-scan 2.5s linear infinite;
}

@keyframes laser-scan {
  0% { top: 0%; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* Chunk Defragmenter Map */
.chunk-map-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14px, 1fr));
  gap: 4px;
  max-height: 140px;
  overflow-y: auto;
  background: rgba(0,0,0,0.2);
  padding: 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.05);
  margin-bottom: 1.5rem;
}

.chunk-block {
  aspect-ratio: 1;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  transition: background-color 0.2s, box-shadow 0.2s;
  border: 1px solid rgba(0,0,0,0.1);
}

.chunk-block.received {
  background: var(--accent);
  box-shadow: 0 0 6px rgba(57, 255, 20, 0.5);
  animation: block-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chunk-block.scanning {
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary);
}

@keyframes block-pop {
  0% { transform: scale(0.6); opacity: 0.5; }
  70% { transform: scale(1.25); }
  100% { transform: scale(1); opacity: 1; }
}

/* HUD Stats Row */
.hud-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 1.5rem;
}

.hud-card {
  background: rgba(0,0,0,0.15);
  border: 1px solid var(--border-alpha);
  border-radius: 6px;
  padding: 8px;
  text-align: center;
}

.hud-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.hud-value {
  font-family: var(--font-display);
  font-size: 1rem;
  color: #fff;
  font-weight: bold;
}

/* Liquid / Wave Progress Bar */
.progress-bar-wrapper {
  position: relative;
  width: 100%;
  height: 20px;
  background: rgba(0,0,0,0.3);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-alpha);
  margin-bottom: 1rem;
}

.progress-liquid {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 0.3s ease;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}

/* Action Center (Modal de Sucesso) */
.action-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 11, 16, 0.85);
  backdrop-filter: blur(20px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.action-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--glass-bg);
  border: 2px solid var(--primary);
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  padding: 2rem;
  box-shadow: 0 0 40px rgba(0, 240, 255, 0.25);
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.action-modal.active .modal-content {
  transform: scale(1);
}

.success-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  text-shadow: 0 0 20px var(--accent);
}

.modal-title {
  font-size: 1.6rem;
  color: var(--accent);
  margin-bottom: 1rem;
}

/* In-App Preview Frame */
.preview-container {
  width: 100%;
  max-height: 200px;
  background: rgba(0,0,0,0.3);
  border-radius: 8px;
  border: 1px solid var(--border-alpha);
  margin: 1.5rem 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.preview-text {
  width: 100%;
  height: 100%;
  padding: 10px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-align: left;
  overflow-y: auto;
  white-space: pre-wrap;
}

.preview-media-player {
  width: 100%;
}

/* Bidirectional Feedback Panel */
.feedback-qr-panel {
  position: fixed;
  bottom: 15px;
  right: 15px;
  background: #fff;
  padding: 8px;
  border-radius: 6px;
  border: 2px solid var(--warning);
  box-shadow: 0 0 15px rgba(255, 0, 127, 0.3);
  z-index: 100;
  display: none;
  animation: pulse-border 2s infinite ease-in-out;
}

@keyframes pulse-border {
  0%, 100% { border-color: var(--warning); }
  50% { border-color: var(--secondary); }
}

.webcam-feedback-wrapper {
  width: 100%;
  height: 120px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--warning);
  background: #000;
  margin-top: 10px;
}

/* Correção para renderização forçada do elemento vídeo da câmera */
#reader {
  width: 100% !important;
  height: 100% !important;
  background: #000;
  border: none !important;
}

#reader video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

/* ==========================================
   4. NOVAS REGRAS: TELA CHEIA E GRUPOS A-Z
   ========================================== */

body.fullscreen-active {
  overflow: hidden;
}

/* Remove a restrição do contêiner pai (backdrop-filter cria contêiner fixo local) */
body.fullscreen-active .panel,
body.fullscreen-active .holo-pedestal {
  backdrop-filter: none !important;
  filter: none !important;
  transform: none !important;
  will-change: auto !important;
}

#qrGridWrapper.fullscreen-mode {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: none !important;
  background: #050608 !important;
  z-index: 9999 !important;
  display: grid !important;
  place-content: center !important;
  gap: 24px !important;
  padding: 40px !important;
  box-sizing: border-box !important;
  margin: 0 !important;
}

/* Configura colunas da grade em tela cheia de acordo com o tamanho ativo */
#qrGridWrapper.fullscreen-mode.grid-1 {
  grid-template-columns: min(80vw, 80vh) !important;
}
#qrGridWrapper.fullscreen-mode.grid-2 {
  grid-template-columns: repeat(2, min(45vw, 45vh)) !important;
}
#qrGridWrapper.fullscreen-mode.grid-4 {
  grid-template-columns: repeat(2, min(40vw, 40vh)) !important;
}

#qrGridWrapper.fullscreen-mode .qr-container {
  width: 100% !important;
  height: 100% !important;
  aspect-ratio: 1 / 1 !important;
  margin: 0 !important;
}

.fullscreen-close-btn {
  display: none;
}
#qrGridWrapper.fullscreen-mode .fullscreen-close-btn {
  display: flex !important;
  align-items: center;
  justify-content: center;
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  background: var(--secondary);
  border: 1px solid var(--accent);
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: bold;
  cursor: pointer;
  font-family: 'Orbitron', sans-serif;
  transition: all 0.2s ease;
}
#qrGridWrapper.fullscreen-mode .fullscreen-close-btn:hover {
  background: var(--accent);
  color: #000;
  box-shadow: 0 0 15px var(--accent);
}

.group-filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 15px;
  background: rgba(255, 255, 255, 0.01);
  padding: 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.group-filter-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(0, 240, 255, 0.15);
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  font-family: 'Share Tech Mono', monospace;
  transition: all 0.2s ease;
}
.group-filter-btn:hover {
  background: rgba(0, 240, 255, 0.08);
  color: var(--text-main);
}
.group-filter-btn.active {
  background: var(--primary) !important;
  color: #000 !important;
  font-weight: bold;
  box-shadow: 0 0 10px var(--primary);
}

.filter-badge {
  background: var(--accent);
  color: #000;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: bold;
  font-family: 'Share Tech Mono', monospace;
  box-shadow: 0 0 8px var(--accent);
  text-transform: uppercase;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(0, 240, 255, 0.2);
  color: var(--primary);
  width: 32px;
  height: 32px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all 0.2s ease;
}
.btn-icon:hover {
  background: var(--primary);
  color: #000;
  box-shadow: 0 0 10px var(--primary);
}

.contrast-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 10px;
}
.contrast-toggle-wrap input {
  cursor: pointer;
}

.inverted-contrast .qr-code-element img,
.inverted-contrast .qr-code-element canvas {
  filter: invert(1) !important;
}

/* Estilos de Cartões de Grupo no Receptor */
.chunk-group-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(0, 240, 255, 0.1);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 12px;
  transition: all 0.3s ease;
}
.chunk-group-card.completed {
  border-color: var(--success) !important;
  background: rgba(57, 255, 20, 0.03) !important;
}
.group-card-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: bold;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.chunk-group-card.completed .group-card-header {
  color: var(--success) !important;
}
.group-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18px, 1fr));
  gap: 4px;
}

/* Toast Acústico */
.acoustic-toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: rgba(10, 11, 16, 0.95);
  border: 1px solid var(--accent);
  color: var(--text-main);
  padding: 12px 24px;
  border-radius: 8px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.9rem;
  font-weight: bold;
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.3);
  z-index: 10000;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), border-color 0.2s;
  pointer-events: none;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.acoustic-toast.show {
  transform: translateX(-50%) translateY(0);
}
.acoustic-toast.success-toast {
  border-color: var(--success) !important;
  box-shadow: 0 0 20px rgba(57, 255, 20, 0.4) !important;
}
.acoustic-toast.error-toast {
  border-color: var(--secondary) !important;
  box-shadow: 0 0 20px rgba(255, 0, 127, 0.4) !important;
}

/* Animações de pulso de sintonia acústica no wrapper do grid */
@keyframes success-pulse-glow {
  0%, 100% { border-color: rgba(0, 240, 255, 0.3); box-shadow: none; }
  50% { border-color: var(--success) !important; box-shadow: 0 0 35px var(--success) !important; }
}
.acoustic-success-pulse {
  animation: success-pulse-glow 0.8s ease-out;
}

@keyframes error-pulse-glow {
  0%, 100% { border-color: rgba(0, 240, 255, 0.3); box-shadow: none; }
  50% { border-color: var(--secondary) !important; box-shadow: 0 0 35px var(--secondary) !important; }
}
.acoustic-error-pulse {
  animation: error-pulse-glow 0.8s ease-out;
}

body.receiver-body {
  overflow: hidden !important;
  height: 100vh !important;
  max-height: 100vh !important;
}

/* Layout Responsivo Fluído com Câmera Flutuante (Picture-in-Picture) */
@media (max-width: 768px) {
  body.receiver-body {
    overflow: hidden !important;
    height: 100vh !important;
    max-height: 100vh !important;
  }

  .page-container {
    padding: 8px !important;
  }

  .panel {
    padding: 12px 10px !important;
    margin-bottom: 8px !important;
  }

  .nav-bar {
    padding-bottom: 8px !important;
    margin-bottom: 8px !important;
  }

  .page-title {
    font-size: 1.1rem !important;
  }

  /* Quando ativa a flutuação (PiP) ao rolar */
  .camera-section-row.floating-active .camera-preview-col {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    width: 180px !important;
    height: 135px !important;
    z-index: 9999 !important;
    border-radius: 8px !important;
    border: 2px solid var(--accent) !important;
    box-shadow: 0 0 25px rgba(0, 240, 255, 0.7) !important;
    overflow: hidden !important;
    margin: 0 !important;
  }

  /* Wrapper filho preenche o col pai no estado PiP */
  .camera-section-row.floating-active .camera-wrapper-compact {
    width: 100% !important;
    height: 100% !important;
  }
}

/* Estilos de Câmera Lado a Lado (Geral e Mobile) */
.camera-section-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 10px;
}

.camera-preview-col {
  width: 100%;
  flex-shrink: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.camera-wrapper-compact {
  position: relative;
  width: 100%;
  height: clamp(140px, 30vh, 220px); /* Responsivo — encaixa em qualquer tela */
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border-alpha);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.15);
}

.camera-wrapper-compact #viewfinderCanvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
  object-fit: cover;
  border-radius: 8px;
}

.camera-controls-col {
  flex: none;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.control-group-compact {
  display: flex;
  flex-direction: column;
}

.compact-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 3px;
  letter-spacing: 0.5px;
}

.camera-controls-col select {
  flex: 1;
  min-width: 0;
  margin-top: 0;
  padding: 6px 10px;
  font-size: 0.75rem;
}

/* Botão de Câmera Toggle Único */
.btn-toggle-off {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.1) 0%, rgba(0, 240, 255, 0.2) 100%);
  color: var(--primary);
  border: 1px solid var(--primary);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.15);
}

.btn-toggle-off:hover {
  background: rgba(0, 240, 255, 0.25);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.4);
}

.btn-toggle-on {
  background: linear-gradient(135deg, rgba(255, 0, 127, 0.2) 0%, rgba(255, 0, 127, 0.3) 100%) !important;
  color: var(--secondary) !important;
  border: 1px solid var(--secondary) !important;
  box-shadow: 0 0 15px rgba(255, 0, 127, 0.3) !important;
}

.btn-toggle-on:hover {
  background: rgba(255, 0, 127, 0.4) !important;
  box-shadow: 0 0 20px rgba(255, 0, 127, 0.5) !important;
}

.scan-target-compact {
  position: absolute;
  top: 5%;
  left: 5%;
  width: 90%;
  height: 90%;
  border: 1px dashed rgba(0, 240, 255, 0.3);
  pointer-events: none;
  box-sizing: border-box;
}

.scan-target-compact .laser-line {
  position: absolute;
  width: 100%;
  height: 2px;
  background: var(--secondary);
  box-shadow: 0 0 8px var(--secondary);
  animation: laser-move 2s infinite ease-in-out;
}

/* Modificações da Visualização do Grid de Setores Unificado */
.chunk-map-container {
  display: grid !important;
  grid-template-columns: repeat(25, 1fr) !important;
  gap: 2px !important;
  background: rgba(0, 0, 0, 0.25) !important;
  padding: 6px !important;
  border-radius: 6px !important;
  border: 1px solid rgba(255, 255, 255, 0.05) !important;
  max-height: 180px;
  overflow-y: auto !important;
}

/* Custom Scrollbar */
.chunk-map-container::-webkit-scrollbar {
  width: 4px;
}
.chunk-map-container::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}
.chunk-map-container::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 2px;
}

.chunk-block {
  aspect-ratio: 1 !important;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 1px !important;
  border: 1px solid transparent;
  transition: background-color 0.1s, box-shadow 0.1s, border-color 0.1s !important;
}

.chunk-block.received {
  background: var(--accent);
  box-shadow: 0 0 4px var(--accent);
}

.chunk-block.sending {
  background: #ff3344 !important;
  box-shadow: 0 0 5px #ff3344 !important;
}

.chunk-block.completed {
  background: rgba(120, 130, 160, 0.3) !important;
  box-shadow: none !important;
  opacity: 0.5;
}

/* Mapa de setores miniaturizado — usado APENAS no receiver */
.chunk-map-mini {
  grid-template-columns: repeat(50, 1fr) !important;
  gap: 1px !important;
  max-height: 72px !important;
  padding: 4px !important;
}

.chunk-map-mini .chunk-block {
  animation: none !important;
}
