:root {
  --bg-primary: #070A10;
  --bg-surface: #0E1524;
  --bg-elevated: #162035;
  --border-subtle: #1E293B;
  --border-focus: #10B981;
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --accent-emerald: #10B981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.2);
  --accent-violet: #8B5CF6;
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-ui);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 16px 20px 40px 20px;
  -webkit-font-smoothing: antialiased;
}

/* ==============================================================================
   Top Announcement Banner
   ============================================================================== */
.top-banner {
  width: 100%;
  max-width: 620px;
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.12), rgba(139, 92, 246, 0.12));
  border: 1px solid rgba(16, 185, 129, 0.28);
  border-radius: 14px;
  padding: 11px 18px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: #E2E8F0;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.top-banner .sparkle {
  color: #34D399;
  font-size: 15px;
}

/* ==============================================================================
   App Container & Header
   ============================================================================== */
.app-container {
  width: 100%;
  max-width: 620px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.25);
  display: block;
}

.brand-name {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.7px;
  color: #FFFFFF;
}

.network-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-emerald);
  animation: pulse-dot 2s infinite ease-in-out;
}

.status-dot.connecting {
  background: #F59E0B;
  box-shadow: 0 0 10px #F59E0B;
}

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

/* ==============================================================================
   Main Card Section
   ============================================================================== */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 26px;
  padding: 32px 28px;
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.6);
  text-align: center;
}

.pill-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.28);
  padding: 5px 14px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 14px;
}

.pill-tag.connected {
  background: rgba(16, 185, 129, 0.2);
  color: #34D399;
  border-color: rgba(52, 211, 153, 0.4);
}

h2 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
  color: #FFFFFF;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 14.5px;
  line-height: 1.6;
  margin-bottom: 22px;
}

.feature-bullets {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: #34D399;
  flex-wrap: wrap;
}

/* ==============================================================================
   Room Box & Pairing Code
   ============================================================================== */
.room-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 24px 20px;
  margin-bottom: 22px;
  position: relative;
  overflow: hidden;
}

.room-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-emerald), transparent);
}

.room-title {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.room-code {
  font-family: var(--font-mono);
  font-size: 46px;
  font-weight: 800;
  letter-spacing: 10px;
  color: var(--accent-emerald);
  margin-bottom: 8px;
  text-shadow: 0 0 24px rgba(16, 185, 129, 0.35);
  user-select: all;
}

.room-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

.btn-qr-toggle {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: #34D399;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-qr-toggle:hover {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.4);
}

.qrcode-box {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

#qrcode {
  padding: 12px;
  background: #FFFFFF;
  border-radius: 14px;
  display: inline-block;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

#qrcode img {
  display: block;
  margin: 0 auto;
}

.qrcode-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  margin: 22px 0;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-subtle);
}

.divider span {
  padding: 0 12px;
}

.join-row {
  display: flex;
  gap: 12px;
}

.code-input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-subtle);
  border-radius: 14px;
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  color: var(--text-primary);
  outline: none;
  letter-spacing: 4px;
  transition: all 0.2s;
  min-height: 50px;
}

.code-input::placeholder {
  letter-spacing: 0;
  font-family: var(--font-ui);
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-muted);
}

.code-input:focus {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.25);
}

.btn {
  border: none;
  border-radius: 14px;
  padding: 12px 24px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  user-select: none;
}

.btn-primary {
  background: var(--accent-emerald);
  color: #05140D;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn-primary:hover {
  background: #34D399;
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: #1E293B;
  color: var(--text-primary);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
  transform: none !important;
}

.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(5, 20, 13, 0.3);
  border-top-color: #05140D;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==============================================================================
   Active Transfer Canvas
   ============================================================================== */
.dropzone {
  border: 2px dashed rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.04);
  border-radius: 20px;
  padding: 38px 24px;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 16px;
  text-align: center;
}

.dropzone:hover {
  border-color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.08);
}

.dropzone.dragover {
  border-color: #34D399;
  background: rgba(16, 185, 129, 0.15);
  transform: scale(1.01);
}

.drop-icon {
  width: 48px;
  height: 48px;
  stroke: var(--accent-emerald);
  margin-bottom: 8px;
}

.drop-text {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
}

.drop-hint {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* Progress Box */
.progress-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 18px;
  margin-top: 20px;
  text-align: left;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
}

.progress-filename {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 75%;
}

.progress-track {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-bar {
  background: linear-gradient(90deg, #10B981, #34D399);
  height: 100%;
  width: 0%;
  transition: width 0.1s linear;
}

.progress-footer {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-secondary);
}

/* Received File Box */
.received-file-box {
  background: var(--bg-elevated);
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: 18px;
  padding: 20px;
  margin-top: 20px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.received-file-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.file-icon-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(16, 185, 129, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-emerald);
  flex-shrink: 0;
}

.received-details {
  flex: 1;
  overflow: hidden;
}

.received-name {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.received-size {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.btn-download {
  background: var(--accent-emerald);
  color: #05140D;
  text-decoration: none;
  border-radius: 14px;
  padding: 12px;
  font-weight: 700;
  font-size: 14.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
  transition: background 0.2s;
}

.btn-download:hover {
  background: #34D399;
}

/* ==============================================================================
   Native Google Play Promotion Badge
   ============================================================================== */
.playstore-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  background: linear-gradient(135deg, rgba(14, 21, 36, 0.8), rgba(22, 32, 53, 0.8));
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  text-align: center;
}

.playstore-text {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.playstore-text strong {
  color: var(--text-primary);
}

.playstore-badge {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: #000000;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 8px 18px;
  text-decoration: none;
  color: #FFFFFF;
  transition: all 0.2s;
}

.playstore-badge:hover {
  border-color: #10B981;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.playstore-badge-text {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.playstore-subtext {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #94A3B8;
  line-height: 1.1;
}

.playstore-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1.2;
}

/* ==============================================================================
   In-Page Privacy Policy Modal
   ============================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 24px;
  width: 100%;
  max-width: 580px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.75);
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.modal-overlay.active .modal-dialog {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-close {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 24px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1;
}

.modal-close:hover {
  color: #FFFFFF;
  background: #1E293B;
  border-color: var(--accent-emerald);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text-secondary);
  text-align: left;
}

.modal-body h4 {
  font-size: 15px;
  font-weight: 700;
  color: #FFFFFF;
  margin-top: 18px;
  margin-bottom: 6px;
}

.modal-body p {
  margin-bottom: 10px;
}

.modal-body ul {
  padding-left: 20px;
  margin-bottom: 12px;
}

.modal-body li {
  margin-bottom: 6px;
}

.policy-callout {
  background: var(--bg-elevated);
  border-left: 3px solid var(--accent-emerald);
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  color: #E2E8F0;
  font-size: 13px;
}

/* ==============================================================================
   Footer
   ============================================================================== */
.app-footer {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

.footer-love {
  font-weight: 500;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
}

.footer-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s;
}

.footer-link:hover {
  color: var(--accent-emerald);
  text-decoration: underline;
}

.mono {
  font-family: var(--font-mono);
}

/* ==============================================================================
   Mobile Responsiveness Overhaul (Screens under 600px)
   ============================================================================== */
@media (max-width: 600px) {
  body {
    padding: 10px 14px 28px 14px;
  }

  .top-banner {
    font-size: 12px;
    padding: 9px 12px;
    border-radius: 12px;
    margin-bottom: 14px;
  }

  .app-container {
    gap: 16px;
  }

  .brand-name {
    font-size: 20px;
  }

  .brand-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
  }

  .card {
    padding: 24px 18px;
    border-radius: 22px;
  }

  h2 {
    font-size: 21px;
  }

  .subtitle {
    font-size: 13.5px;
    margin-bottom: 18px;
  }

  .room-box {
    padding: 18px 14px;
    border-radius: 16px;
  }

  .room-code {
    font-size: 38px;
    letter-spacing: 7px;
  }

  .join-row {
    flex-direction: row;
    gap: 8px;
  }

  .code-input {
    font-size: 16px; /* Prevents auto-zoom on iOS Safari */
    padding: 11px;
    letter-spacing: 3px;
  }

  .btn {
    padding: 11px 18px;
    font-size: 14px;
  }

  .dropzone {
    padding: 30px 16px;
  }

  .modal-dialog {
    max-height: 90vh;
    border-radius: 20px;
  }

  .modal-header {
    padding: 16px 20px;
  }

  .modal-body {
    padding: 20px;
  }
}
