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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: "Inter", sans-serif;
  color: var(--text-main);
  background-color: var(--bg-main);

  /* ✅ DESKTOP FIX: Bahar ka double scrollbar band */
  overflow: hidden;
}

.grecaptcha-badge {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

#app {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  position: relative;
  z-index: 1;
  gap: 0px !important;
}

.glass-panel {
  background: var(--bg-panel);
  border-right: 2px solid var(--glass-border);
  width: 450px;
  flex-shrink: 0;
  overflow: hidden !important;
  padding: 40px 20px 40px 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

#leftContainer.hidden {
  display: none;
}

.project-title {
  font-size: 2.5rem;
  margin-bottom: 5px;
  font-weight: 800;
}
.protocol-type {
  color: var(--text-dim);
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 2px;
  margin-bottom: 30px;
  opacity: 0.9;
}

.tagline-lc {
  font-weight: 600;
  font-size: 1.3rem;
  margin-bottom: 15px;
  color: var(--text-main);
}
.description-text {
  color: var(--text-muted);
  line-height: 1.3;
  margin-bottom: 30px;
  font-size: 0.9rem;
}

.feature-item {
  display: flex;
}
.feature-item .checkIcon {
  height: fit-content;
  padding-right: 5px;
  color: var(--success);
}

.features-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  border-top: 2px solid var(--glass-border);
  padding-top: 30px;
}
.feature-title {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-main);
  text-transform: uppercase;
  font-size: 0.8rem;
}
.feature-desc {
  color: var(--text-muted);
  font-size: 0.7rem;
  line-height: 1.5;
}
.feature-item:hover {
  border-left-color: var(--text-main);
}

#rightContainer {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  height: 100%;
  background: var(--bg-container);
}

.material-symbols-rounded {
  font-size: 1.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.screen {
  display: none;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.4s ease;

  /* ✅ DESKTOP FIX: Sirf andar ka scroll chalu taaki 2 scrollbar na aayein */
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem;
  position: relative;
}

.screen.active {
  display: flex;
  opacity: 1;
  animation: glassFadeIn 0.5s ease forwards;
}

@keyframes glassFadeIn {
  from {
    opacity: 0;
    transform: translateY(15px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

#homeScreen {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  width: 100%;
  max-width: 100%;
  margin: auto;
  height: 100%;
  background: var(--glass-bg);
}

.home-header {
  text-align: center;
}
.logo {
  font-family: "Audiowide", sans-serif;
  font-size: clamp(2.5rem, 8vw, 3.5rem);
  font-weight: 800;
  margin-bottom: 0.5rem;
  letter-spacing: -1px;
}
.nix {
  color: var(--brand-nix);
  font-family: "Audiowide", sans-serif;
  font-weight: 800;
}
.void {
  color: var(--brand-void);
  font-family: "Audiowide", sans-serif;
  font-weight: 400;
}
.tagline {
  color: var(--text-muted);
  font-size: clamp(0.85rem, 3vw, 1rem);
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.home-actions {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
}

/* Home Screen UI Updates */
.min-cta {
  background: var(--btn-primary-bg);
  padding: 1.2rem 2rem;
  border-radius: var(--radius-xlg);
  color: var(--btn-text);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 30px var(--accent-glass);
  border: 1px solid var(--accent);
  transition: var(--transition);
  width: 100%;
}
.min-cta:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 40px var(--accent-glass-strong);
  background: var(--btn-primary-hover);
}

.ring-tabs {
  display: flex;
  background: var(--glass-bg);
  border-radius: var(--radius-xlg);
  padding: 0.4rem;
  border: 1px solid var(--glass-border-strong);
  backdrop-filter: blur(10px);
  width: 100%;
  justify-content: space-between;
}
.ring-tab {
  padding: 0.8rem 1rem;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-xlg);
  transition: var(--transition);
  font-size: 0.9rem;
  font-weight: 500;
  flex: 1;
  text-align: center;
  white-space: nowrap;
}
.ring-tab:hover {
  color: var(--text-bright);
  background: var(--glass-bg-hover);
}

.min-features {
  width: 100%;
  margin-top: 1rem;
}
.min-feature-item {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.2rem 0;
  border-bottom: 1px solid var(--glass-border);
}
.min-feature-item:last-child {
  border-bottom: none;
}
.min-feature-icon {
  color: var(--accent);
  font-size: 2rem !important;
}

.btn {
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius-xlg);
  letter-spacing: 0.2px;
  border: none;
  font-family: "Inter", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  color: var(--text-main);
}

.btn-primary {
  background: var(--btn-primary-bg);
  color: var(--btn-text);
  border: 1px solid var(--accent);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}
.btn-primary:hover {
  background: var(--btn-primary-hover);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}
.btn-secondary:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-strong);
  transform: translateY(-2px);
}

#modeSelectionScreen,
#connectingScreen,
#createScreen,
#joinScreen {
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  margin: auto;
  height: 100%;
  padding: 2rem 1.5rem;
  background: var(--glass-bg);
  justify-content: center;
  align-items: center;
}

#homeScreen > *:not(.app-footer),
#modeSelectionScreen > *:not(.back-btn, .screen-top-bar),
#connectingScreen > *,
#createScreen > *:not(.back-btn, .screen-top-bar),
#joinScreen > *:not(.back-btn, .screen-top-bar) {
  width: 100%;
  max-width: min(100%, 600px);
  box-sizing: border-box;
}

.info-text {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.screen-title {
  font-family: "Outfit", sans-serif;
  font-size: clamp(1.5rem, 5vw, 2rem);
  font-weight: 600;
  text-align: center;
  margin-bottom: 1rem;
  color: var(--text-bright);
}

.room-info {
  background: var(--input-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 1.5rem 1rem;
  text-align: center;
  box-shadow: inset 0 0 20px var(--glass-bg);
}

.room-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
}
.room-id {
  font-family: "Courier New", monospace;
  font-size: clamp(1.8rem, 6vw, 2.5rem);
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 3px;
  margin-bottom: 1rem;
  word-break: break-all;
}

.qr-container {
  display: inline-flex;
  justify-content: center;
  padding: 0.8rem;
  background: var(--qr-bg);
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  box-shadow: var(--glass-shadow);
  width: 100%;
  max-width: 200px;
}
.qr-container img,
.qr-container canvas {
  max-width: 100%;
  height: auto;
}

.copy-btn {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 0.8rem 1.2rem;
  border-radius: var(--radius-xlg);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  transition: var(--transition);
  backdrop-filter: blur(5px);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.copy-btn:hover {
  background: var(--glass-bg-hover);
}
.copy-btn.copied {
  background: var(--success);
  color: var(--text-inverse);
  border-color: var(--success);
}

.waiting-status {
  background: var(--accent-glass);
  border: 1px solid var(--accent-glass-strong);
  padding: 0.8rem;
  border-radius: var(--radius-xlg);
  margin-top: 1rem;
}
.waiting-status-text {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
}

.form-input {
  width: 100%;
  padding: 1rem;
  background: var(--input-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xlg);
  color: var(--text-main);
  font-size: 16px;
  text-align: center;
  letter-spacing: 2px;
  text-transform: uppercase;
  transition: var(--transition);
}
.form-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--input-focus);
}

.qr-upload {
  border: 2px dashed var(--glass-border-strong);
  border-radius: var(--radius-md);
  padding: 2.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  display: block;
  background: var(--glass-bg);
}
.qr-upload:hover {
  border-color: var(--accent);
  background: var(--accent-glass);
}
.qr-upload-text {
  font-size: 0.9rem;
}
.qr-upload input {
  display: none;
}

/* Hybrid Visual Card & Help Card Additions */
.hybrid-visual-card {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--input-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  width: 100%;
}

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

.routing-timeline .node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.routing-timeline .node .material-symbols-rounded {
  font-size: 1.8rem;
}

.routing-timeline .connection-line {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  margin: 0 1rem;
  font-size: 0.65rem;
  letter-spacing: 1px;
}

.routing-timeline .connection-line .line {
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--success), transparent);
  margin: 0.3rem 0;
  opacity: 0.6;
}

.mode-compare-grid {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.compare-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: left;
}

.compare-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: center;
}

.compare-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.compare-item .material-symbols-rounded {
  font-size: 1.1rem;
}

.compare-divider {
  width: 1px;
  background: var(--glass-border);
}

.help-card {
  margin-top: 2rem;
  padding: 1rem;
  background: var(--accent-glass);
  border: 1px solid var(--accent-glass-strong);
  border-radius: var(--radius-md);
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  text-align: left;
  width: 100%;
}

.help-card .help-icon {
  color: var(--accent);
  font-size: 1.8rem;
}

.help-card .help-title {
  font-weight: 600;
  color: var(--accent);
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}

.help-card .help-text {
  color: var(--text-main);
  font-size: 0.8rem;
  line-height: 1.4;
}

#chatScreen {
  flex-direction: column;
  padding: 0;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  height: 100%;
  background: var(--glass-bg);
}

.chat-header {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-header);
}

.chat-header-title {
  font-family: "Outfit", sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-bright);
  display: flex;
  align-items: center;
}

.user-count {
  font-size: 0.7rem;
  color: var(--accent);
  background: var(--accent-glass);
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  border: 1px solid var(--accent-glass);
  margin-top: 0.5rem;
  display: inline-block;
}

.exit-btn {
  background: var(--error-glass);
  border: 1px solid var(--error-border);
  color: var(--error);
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-xlg);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition);
}
.exit-btn:hover {
  background: var(--error);
  color: var(--text-inverse);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--glass-bg);
}

/* GLOBAL SCROLLBAR */
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--glass-border-strong);
  border-radius: 10px;
}

.message {
  display: flex;
  gap: 0.5rem;
  animation: slideIn 0.3s ease;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
}
.message > div {
  display: flex;
  flex-direction: column;
  max-width: 100%;
}
.message:not(.own) > div {
  align-items: flex-start;
}
.message.own {
  justify-content: flex-end;
}
.message.own > div {
  align-items: flex-end;
}

.message-bubble {
  background: var(--msg-bubble-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  padding: 0.8rem 1.2rem;
  border-radius: 0 14px 14px 14px;
  box-shadow: var(--glass-shadow);
  line-height: 1.5;
  color: var(--text-bright);
  font-size: 0.95rem;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  filter: blur(8px);
  cursor: pointer;
  user-select: none;
  transition: filter 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;

  /* ✅ YE 3 LINES UPDATE KAREIN */
  width: fit-content;
  /* max-width: 90%; */
  overflow: hidden; /* Progress bar ko bahar nikalne se rokega */

  word-break: break-all;
}
.message-bubble.unveiled {
  filter: blur(0px) !important;
  user-select: text;
}
.message.own .message-bubble {
  background: var(--msg-own-bg);
  border-color: var(--accent-glass);
  border-radius: 14px 0 14px 14px;
}

.message-sender {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  font-weight: 500;
  padding: 0 0.3rem;
}
.message.own .message-sender {
  text-align: right;
  color: var(--accent);
}

.chat-input-area {
  padding: 0.8rem 1rem;
  background: var(--bg-header);
  border-top: 1px solid var(--glass-border);
  display: flex;
  gap: 0.8rem;
  align-items: flex-end;
}

.input-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--input-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xlg);
  padding: 0.4rem 0.8rem;
  transition: var(--transition);
}
.input-wrapper:focus-within {
  border-color: var(--accent);
}
.input-wrapper textarea {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-bright);
  font-family: "Inter", sans-serif;
  font-size: 16px;
  resize: none;
  min-height: 24px;
  max-height: 100px;
  padding: 0.4rem 0;
}
.input-wrapper textarea:focus {
  outline: none;
}
.input-wrapper textarea::placeholder {
  color: var(--text-muted);
}

.send-btn {
  background: var(--accent);
  color: var(--text-inverse);
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: var(--transition);
  flex-shrink: 0;
}
.send-btn:hover:not(:disabled) {
  transform: scale(1.05);
}
.send-btn:disabled {
  background: var(--glass-bg);
  color: var(--text-muted);
  box-shadow: none;
  cursor: not-allowed;
  border: 1px solid var(--glass-border);
}

.back-btn {
  position: absolute !important;
  top: 1.5rem;
  left: 1.5rem;
  z-index: 100;
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.back-btn:hover {
  background: var(--glass-bg);
  color: var(--text-bright);
}

#joinScreen .screen-title {
  margin-top: 3.5rem;
}

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--bg-modal);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 350px;
  text-align: center;
  box-shadow: var(--glass-shadow);
}
.modal-title {
  font-family: "Outfit";
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 0.8rem;
  color: var(--text-bright);
}
.modal-text {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}
.modal-buttons {
  display: flex;
  gap: 0.8rem;
}
.modal-buttons .btn {
  padding: 0.8rem;
}

#homeScreen {
  gap: clamp(0.8rem, 2.5vh, 2rem) !important;
  padding: clamp(1rem, 4vh, 2.5rem) 1.5rem !important;
  overflow-y: auto !important;
}

#homeScreen::before {
  content: "";
  min-height: clamp(1rem, 4vh, 2.5rem);
  width: 100%;
  flex-shrink: 0;
}
.home-header .logo {
  font-size: clamp(2rem, 7vmin, 3.8rem) !important;
  margin-bottom: clamp(0.2rem, 1vh, 0.5rem) !important;
}
.home-header .tagline {
  font-size: clamp(0.75rem, 2vmin, 1rem) !important;
}

#homeScreen .app-footer {
  font-size: clamp(0.65rem, 1.8vmin, 0.75rem) !important;
  position: relative;
  margin-top: auto;
  padding: clamp(0.8rem, 2vh, 1.5rem);
  width: 100%;
}

@media (max-width: 768px) {
  html,
  body {
    position: relative !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    height: auto !important;
    scroll-behavior: smooth !important;
    min-height: 100dvh !important;
  }
  .version-badge {
    display: none;
  }
  #app {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    height: auto !important;
    overflow: visible !important;
    min-height: 100dvh !important;
  }
  .glass-panel {
    width: 100%;
    height: 100vh !important;
    min-height: 100vh !important;
    flex-shrink: 0;
    border-radius: 0 !important;
    border: none !important;
  }
  #rightContainer,
  .skeleton-right-panel {
    width: 100%;
    height: 100vh !important;
    min-height: 100vh !important;
    border-radius: 0 !important;
    border: none !important;
  }
  #rightContainer .screen,
  .skeleton-right-panel .screen {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 100vh !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    justify-content: flex-start !important;
  }
  #homeScreen,
  .skeleton-home-screen-clone {
    padding-top: 4rem !important;
  }
  .app-footer {
    position: relative !important;
    bottom: auto !important;
    margin-top: auto !important;
    padding-top: 2rem !important;
    padding-bottom: 0 !important;
    padding-left: clamp(0.8rem, 2vh, 1.5rem);
    padding-right: clamp(0.8rem, 2vh, 1.5rem);
  }

  .screen {
    overflow-y: visible !important;
    height: auto !important;
  }

  .screen.active:not(#chatScreen) {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    text-align: center;
    padding: 20px !important;
    justify-content: center !important;
    align-items: center !important;
    min-height: 100dvh !important;
  }

  #chatScreen {
    max-width: 100vw;
    height: 100% !important;
    min-height: unset !important; /* Isse chatScreen zaroorat se zyada bada nahi hoga */
    max-height: 100% !important;
    overflow: hidden !important;
  }

  #chatScreen .chat-header,
  #chatScreen .chat-input-area {
    flex-shrink: 0;
  }

  #chatScreen .chat-messages {
    flex-grow: 1;
    overflow-y: auto !important;
    height: 0; /* Flexbox trick to force internal scrolling */
  }

  .skeleton-wrapper {
    flex-direction: column;
    height: auto !important;
    min-height: 100vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }
  .skeleton-right-panel {
    width: 100%;
    height: 100vh !important;
    min-height: 100vh !important;
    border-radius: 0 !important;
    border: none !important;
  }

  #homeScreen.active {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    padding-top: 20px !important;
    padding-bottom: 80px !important;
  }

  #homeScreen::before {
    display: none !important;
  }

  #homeScreen .app-footer {
    position: absolute !important;
    bottom: 15px !important;
    margin-top: 0 !important;
    padding-top: 20px !important;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
  }
}

@media (max-width: 480px) {
  .features-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .feature-card {
    display: flex;
    align-items: center;
    text-align: left;
    padding: 1rem;
    gap: 1rem;
  }
  .feature-card .material-symbols-rounded {
    margin-bottom: 0;
  }
}

@media (max-width: 860px) and (min-width: 769px) {
  #rightContainer .screen > * {
    zoom: 0.85 !important;
  }
}
@media (max-width: 500px) {
  
  /* #homeScreen ke andar ke saare main elements par zoom lagega, par Footer normal rahega */
  #homeScreen > *:not(.app-footer) {
    zoom: 0.85 !important; /* 0.85 matlab 15% chhota. Aap ise 0.8 ya 0.9 bhi karke dekh sakte hain */
  }
  
}
@media (min-width: 769px) {
  #homeScreen {
    margin: 0px !important;
  }
}
@media (min-width: 769px) and (max-width: 900px) {
  .glass-panel {
    width: 50% !important;
  }
}

.features-grid {
  display: grid;
  /* Ye line 300px se kam jagah hote hi automatically columns stack kar degi */
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.8rem;
  width: 100%;
}

.feature-card {
  background: var(--input-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xlg);
  padding: 1.2rem 0.8rem;
  text-align: center;
  transition: var(--transition);
}
.feature-card:hover {
  background: var(--accent-glass);
  border-color: var(--accent);
  transform: translateY(-3px);
}
.feature-card .material-symbols-rounded {
  color: var(--accent);
  font-size: 2rem;
  margin-bottom: 0.5rem;
}
.feature-card h3 {
  font-size: 0.85rem;
  color: var(--text-bright);
  margin-bottom: 0.4rem;
  font-family: "Outfit", sans-serif;
  letter-spacing: 0.5px;
}
.feature-card p {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.app-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  width: 100%;
  padding-top: 1.5rem;
  border-top: 1px solid var(--glass-border);
}
.info-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.typing-indicator-container {
  padding: 0.5rem 1rem;
  display: none;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--accent);
  animation: pulse 1.5s infinite alternate;
  position: absolute;
  bottom: 93px;
}
.typing-indicator-container.active {
  display: flex;
}
.typing-dots {
  display: flex;
  gap: 3px;
}
.typing-dots span {
  width: 6px;
  height: 6px;
  background-color: var(--accent);
  border-radius: 50%;
  display: inline-block;
  animation: bounce 1.3s infinite ease-in-out;
}
.typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}
.typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes bounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-4px);
  }
}

.message-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
  width: 100%;
}
.status-tick {
  font-family: "Inter", sans-serif;
  font-weight: bold;
  font-size: 1rem;
  letter-spacing: 2px;
  color: var(--text-muted);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: inline-block;
  line-height: 1;
}
.status-tick.read {
  color: var(--accent);
  transform: scale(1.15);
}
.message-time {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-right: 5px;
  opacity: 0.8;
}

.screen-top-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
  margin-bottom: 1rem;
  min-height: 40px;
}
.top-share-btn {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--accent);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.top-share-btn:hover {
  background: var(--accent-glass);
  border-color: var(--accent);
  color: var(--text-bright);
}

.share-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1005;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.share-overlay.active {
  display: flex;
  animation: fadeIn 0.3s ease forwards;
}

.share-card {
  background: var(--bg-modal);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: var(--glass-shadow);
  position: relative;
  transform: scale(0.9);
  transition: var(--transition);
}
.share-overlay.active .share-card {
  transform: scale(1);
}

.share-card-title {
  font-family: "Outfit", sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 0.5rem;
}
.share-card-text {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 1rem;
  line-height: 1.4;
}

.popup-qr-container {
  margin: 0 auto 1rem auto;
  padding: 10px;
  background: var(--qr-bg);
  border-radius: var(--radius-sm);
  width: 150px;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--glass-border);
  transition: var(--transition);
}
.popup-qr-container:hover {
  border-color: var(--accent);
}
.popup-qr-container table,
.popup-qr-container img {
  max-width: 130px !important;
  max-height: 130px !important;
}

.share-options-grid {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.share-action-btn {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 0.7rem 1rem;
  border-radius: var(--radius-xlg);
  font-family: "Inter", sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition);
  width: 100%;
}
.share-action-btn:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-strong);
  transform: translateY(-2px);
}
.share-action-btn.primary {
  background: var(--accent-glass);
  border-color: var(--accent);
  color: var(--accent);
}
.share-action-btn.primary:hover {
  background: var(--accent);
  color: var(--text-inverse);
  text-shadow: none;
}

#createScreen .qr-container {
  border: 2px solid var(--glass-border);
}

.social-share-row {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}
.social-circle-btn {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-bright);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  font-size: 1.3rem;
}
.social-circle-btn:hover {
  transform: scale(1.1);
  background: var(--glass-bg-hover);
}
.social-circle-btn.whatsapp:hover {
  background: var(--brand-whatsapp-glass);
  border-color: var(--brand-whatsapp);
  color: var(--brand-whatsapp);
  box-shadow: 0 0 15px var(--brand-whatsapp-glass);
}
.social-circle-btn.telegram:hover {
  background: var(--brand-telegram-glass);
  border-color: var(--brand-telegram);
  color: var(--brand-telegram);
  box-shadow: 0 0 15px var(--brand-telegram-glass);
}

.close-share-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.close-share-btn:hover {
  color: var(--text-bright);
  text-decoration: underline;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.toast-container {
  position: fixed;
  width: 90%;
  max-width: max-content;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 99999;
  pointer-events: none;
}
.toast {
  background: var(--bg-modal);
  border: 1px solid var(--accent);
  color: var(--text-bright);
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 0.85rem;
  box-shadow: var(--glass-shadow);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideUpFade 0.4s ease forwards;
  backdrop-filter: blur(10px);
}
.toast.error {
  border-color: var(--error);
  box-shadow: 0 5px 15px var(--error-glass);
}
.toast.fade-out {
  animation: fadeOutDown 0.4s ease forwards;
}

@keyframes slideUpFade {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes fadeOutDown {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(20px);
  }
}

.network-banner {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  text-align: center;
  padding: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  z-index: 20000;
  transform: translateY(-100%);
  transition: transform 0.3s ease;
}
.network-banner.offline {
  background: var(--error);
  color: var(--text-bright);
  transform: translateY(0);
}
.network-banner.online {
  background: var(--success);
  color: var(--text-inverse);
  transform: translateY(0);
}

.skeleton-message {
  width: 60%;
  height: 40px;
  border-radius: 14px;
  margin-bottom: 15px;
  background: var(--skeleton-grad);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
}
.skeleton-message.right {
  align-self: flex-end;
  border-radius: 14px 0 14px 14px;
}
.skeleton-message.left {
  align-self: flex-start;
  border-radius: 0 14px 14px 14px;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

#modeSelectionScreen,
#connectingScreen {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 100%;
  margin: auto;
  padding: 2.5rem 1.5rem;
  height: 100%;
  background: var(--glass-bg);
}
.connecting-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}
.spinner-wrapper {
  position: relative;
  width: 70px;
  height: 70px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.connecting-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid var(--glass-border);
  border-top: 4px solid var(--accent);
  border-right: 4px solid var(--accent);
  border-radius: 50%;
  animation: smoothSpin 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
  position: absolute;
  z-index: 2;
}
.error-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-main);
  z-index: 99999999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}
.error-overlay h2 {
  color: var(--text-main);
}
.error-overlay p {
  color: var(--text-muted);
}
.network-wait-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-overlay);
  backdrop-filter: blur(10px);
  z-index: 999999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-main);
}
.network-wait-overlay p {
  color: var(--text-muted);
}

@keyframes smoothSpin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
@keyframes pulseGlow {
  0% {
    transform: scale(0.8);
    opacity: 0.2;
  }
  100% {
    transform: scale(1.5);
    opacity: 0.6;
  }
}

#pauseOverlay {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}
#pauseOverlay.active {
  display: flex;
  opacity: 1;
}

.header-mode-badge {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--accent-glass);
  border: 1px solid var(--accent);
  color: var(--accent);
  white-space: nowrap;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
/* SKELETON LOADER CLASSES */
.skeleton-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-main);
  z-index: 9999999;
  display: flex;
  flex-direction: row;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
.skeleton-wrapper.hidden {
  opacity: 0;
  visibility: hidden;
}
.skeleton-anim {
  background: var(--skeleton-bg, var(--glass-bg));
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
}
.skeleton-anim::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  transform: translateX(-100%);
  background: var(--skeleton-grad);
  animation: shimmer 2s infinite ease-in-out;
}
@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

@media (min-width: 769px) and (max-width: 900px) {
  .skeleton-left {
    width: 50% !important;
  }
}
#networkWaitOverlay .connecting-spinner {
  border: 4px solid var(--glass-border);
  border-top: 4px solid var(--accent);
}

.noscript-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-main);
  z-index: 999999999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}
.noscript-overlay h2 {
  color: var(--text-main);
}
.noscript-overlay p {
  color: var(--text-muted);
}

/* =========================================
   7. Settings UI & Utilities 
   ========================================= */

/* Toggle Switch Styling */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--glass-bg-hover);
  border: 1px solid var(--glass-border);
  transition: 0.4s;
  border-radius: 34px;
}

.toggle-switch .slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-muted);
  transition: 0.4s;
  border-radius: 50%;
}

.toggle-switch input:checked + .slider {
  background-color: var(--accent);
  border-color: var(--accent);
}

.toggle-switch input:checked + .slider:before {
  transform: translateX(20px);
  background-color: var(--text-inverse);
}

/* Reduced Motion Override */
body.reduced-motion * {
  transition: none !important;
  animation: none !important;
  scroll-behavior: auto !important;
}

/* =============================================
   CHAT LAYOUT FIXES - Safe Appended Overrides
   ============================================= */

/* Fix: Chat header & input stuck, only messages scroll */
#chatScreen {
  overflow: hidden !important;
}
#chatScreen .chat-header {
  flex-shrink: 0;
}
#chatScreen .chat-input-area {
  flex-shrink: 0;
  position: relative;
}
#chatScreen .chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}

/* Fix: Skeleton shimmer conflict - skeleton-anim uses translate, not background-position */
.skeleton-anim::after {
  animation-name: shimmer-translate !important;
}
@keyframes shimmer-translate {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

/* Smart Scroll Button */
.chat-input-area .scroll-to-bottom-btn {
  position: absolute;
  top: -45px;
  right: 1rem;
  background: var(--bg-panel);
  color: var(--accent);
  border: 1px solid var(--accent-glass);
  border-radius: 20px;
  padding: 5px 14px;
  font-family: "Outfit", sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  z-index: 100;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}
.chat-input-area .scroll-to-bottom-btn.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.chat-input-area .scroll-to-bottom-btn .material-symbols-rounded {
  font-size: 1rem;
}

/* Thanos Snap & Timer (from before) */
@keyframes thanosSnap {
  0% {
    opacity: 1;
    filter: blur(0px) sepia(0%);
    transform: scale(1) translateY(0) rotate(0deg);
  }
  30% {
    opacity: 0.8;
    filter: blur(2px) sepia(50%) hue-rotate(-30deg);
    transform: scale(1.02) translateY(-2px) rotate(1deg);
  }
  100% {
    opacity: 0;
    filter: blur(15px) sepia(100%) hue-rotate(-50deg);
    transform: scale(0.8) translateY(-20px) rotate(-3deg);
  }
}
.message.dissolving {
  animation: thanosSnap 1.4s cubic-bezier(0.55, 0.085, 0.68, 0.53) forwards !important;
  pointer-events: none;
}
@keyframes shrinkWidth {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}
.message-bubble[data-timer-started="true"]::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--accent);
  border-radius: 0 0 14px 14px;
  transform-origin: left;
  animation: shrinkWidth 10s linear forwards;
  z-index: 10;
  pointer-events: none;
}
