/* CSS Variables - Premium Cosmic Color Palette */
:root {
  --bg-primary: #0a0b10;
  --bg-secondary: #10121d;
  --glass-bg: rgba(16, 20, 36, 0.55);
  --glass-inset: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-glow-pink: rgba(255, 0, 127, 0.2);
  --glass-glow-cyan: rgba(0, 242, 254, 0.2);
  
  --primary-pink: #ff007f;
  --primary-cyan: #00f2fe;
  --accent-green: #39ff14;
  --accent-gold: #fecb02;
  
  --text-main: #f5f6fa;
  --text-dim: #9aa0b9;
  
  --font-display: 'Outfit', 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-body: 'Plus Jakarta Sans', system-ui, sans-serif;
}

/* Reset and Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent; /* Disable default tap highlights on mobile Safari */
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-main);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

/* Floating animated background blobs for premium depth effect */
.bg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  z-index: 0;
  opacity: 0.45;
  animation: floatBlobs 20s infinite alternate ease-in-out;
}

.blob-1 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--primary-pink), transparent 60%);
  top: -10%;
  left: -10%;
}

.blob-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--primary-cyan), transparent 60%);
  bottom: -15%;
  right: -5%;
  animation-delay: -5s;
}

.blob-3 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, #8a2be2, transparent 60%);
  top: 40%;
  left: 50%;
  animation-delay: -10s;
}

@keyframes floatBlobs {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(40px, -60px) scale(1.1);
  }
  100% {
    transform: translate(-30px, 40px) scale(0.95);
  }
}

/* Main Container Screens */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.screen.active {
  display: flex;
  opacity: 1;
}

/* Glassmorphism utility */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 16px 32px 0 rgba(0, 0, 0, 0.4);
}

.glass-inset {
  background: var(--glass-inset);
  border: 1px solid var(--glass-border);
}

/* AUTHENTICATION SCREEN */
.auth-card {
  width: 90%;
  max-width: 440px;
  padding: 2.5rem 2rem;
  border-radius: 24px;
  text-align: center;
}

.auth-header .logo-glow {
  font-size: 3.5rem;
  line-height: 1;
  margin-bottom: 1rem;
  filter: drop-shadow(0 0 10px var(--primary-pink));
}

.auth-header h1 {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 0%, var(--text-dim) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-header p {
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-top: 0.4rem;
}

.auth-tabs {
  display: flex;
  margin: 2rem 0 1.5rem 0;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.3rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 0.6rem 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.tab-btn.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.auth-form {
  display: none;
  flex-direction: column;
  gap: 1.2rem;
  text-align: left;
}

.auth-form.active {
  display: flex;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.input-group label {
  font-size: 0.85rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.input-group label i {
  width: 14px;
  height: 14px;
}

.input-group input,
.input-group select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  padding: 0.8rem 1rem;
  border-radius: 12px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

.input-group input:focus,
.input-group select:focus {
  outline: none;
  border-color: var(--primary-pink);
  box-shadow: 0 0 10px var(--glass-glow-pink);
  background: rgba(255, 255, 255, 0.08);
}

/* Customizer Style Box */
.customizer-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--glass-border);
  padding: 1rem;
  border-radius: 12px;
}

.customizer-title {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 0.6rem;
  font-weight: 600;
}

.customizer-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.picker-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.picker-group label {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.color-picker-grid {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.color-picker-grid input[type="color"] {
  padding: 0;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background: none;
  overflow: hidden;
}

.color-picker-grid input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}
.color-picker-grid input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}

.preset-color {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.preset-color:hover {
  transform: scale(1.2);
}

.preview-text {
  font-size: 0.85rem;
  color: var(--text-dim);
  border-top: 1px solid rgba(255,255,255,0.05);
  padding-top: 0.6rem;
}

/* Buttons */
.btn {
  border: none;
  padding: 0.9rem 1.5rem;
  border-radius: 12px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.primary-btn {
  background: linear-gradient(135deg, var(--primary-pink) 0%, #d0006c 100%);
  color: #fff;
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px var(--glass-glow-pink);
}

.btn-glow {
  box-shadow: 0 0 15px var(--glass-glow-pink);
}

/* MAIN CHAT SCREEN */
#chat-screen {
  width: 100%;
  height: 100%;
  padding: max(1.5rem, env(safe-area-inset-top)) 1.5rem max(1.5rem, env(safe-area-inset-bottom)) 1.5rem;
  display: none;
}

#chat-screen.active {
  display: flex;
}

.chat-container {
  width: 100%;
  max-width: 1300px;
  height: 100%;
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  z-index: 10;
}

/* App Header */
.app-header {
  height: 72px;
  padding: 0 1.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.02);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.header-logo {
  font-size: 2.2rem;
  filter: drop-shadow(0 0 5px var(--primary-pink));
}

.header-left h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
}

.online-indicator {
  font-size: 0.75rem;
  color: var(--accent-green);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.1rem;
}

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

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

.header-right {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

/* Call Badge in Header */
.call-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(0, 242, 254, 0.15);
  border: 1px solid rgba(0, 242, 254, 0.3);
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  color: var(--primary-cyan);
  font-weight: bold;
}

.badge-pulse {
  width: 6px;
  height: 6px;
  background-color: var(--primary-cyan);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--primary-cyan);
  animation: pulse 1.2s infinite;
}

/* Grid Layout App Body */
.app-body {
  flex: 1;
  display: grid;
  grid-template-columns: 280px 1fr;
  overflow: hidden;
}

/* SIDEBAR PANEL */
.sidebar {
  border-right: 1px solid var(--glass-border);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  background: rgba(0, 0, 0, 0.15);
  overflow-y: auto;
}

.section-card {
  padding: 1.2rem;
  border-radius: 18px;
}

.section-card h3 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}

.section-card h3 i {
  width: 16px;
  height: 16px;
}

.section-desc {
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.35;
  margin-bottom: 0.8rem;
}

.call-controls, .stream-controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.call-btn {
  width: 100%;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  background: rgba(0, 242, 254, 0.15);
  border: 1px solid rgba(0, 242, 254, 0.3);
  color: var(--primary-cyan);
}

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

.call-btn.in-call {
  background: rgba(255, 0, 127, 0.15);
  border-color: rgba(255, 0, 127, 0.3);
  color: var(--primary-pink);
}

.call-btn.in-call:hover {
  background: var(--primary-pink);
  color: #fff;
  box-shadow: 0 4px 15px var(--glass-glow-pink);
}

.active-call-box {
  margin-top: 0.8rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 0.8rem;
}

.section-subtitle {
  font-size: 0.75rem;
  font-weight: bold;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.peers-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.peer-avatar {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  border: 1px solid rgba(255,255,255,0.2);
  cursor: default;
}

/* Glowing speaker effect */
.peer-avatar.speaking {
  box-shadow: 0 0 10px var(--primary-cyan);
  border-color: var(--primary-cyan);
  animation: speaking-pulse 1s infinite alternate;
}

@keyframes speaking-pulse {
  0% { box-shadow: 0 0 4px var(--primary-cyan); }
  100% { box-shadow: 0 0 12px var(--primary-cyan); }
}

.peer-name-tooltip {
  visibility: hidden;
  background-color: #000;
  color: #fff;
  text-align: center;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  position: absolute;
  z-index: 100;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s;
}

.peer-avatar:hover .peer-name-tooltip {
  visibility: visible;
  opacity: 0.85;
}

/* Livestream items */
.stream-btn {
  background: rgba(255, 0, 127, 0.15);
  border: 1px solid rgba(255, 0, 127, 0.3);
  color: var(--primary-pink);
  width: 100%;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
}

.stream-btn:hover {
  background: var(--primary-pink);
  color: #fff;
  box-shadow: 0 4px 15px var(--glass-glow-pink);
}

.watch-btn {
  background: rgba(57, 255, 20, 0.15);
  border: 1px solid rgba(57, 255, 20, 0.3);
  color: var(--accent-green);
  width: 100%;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
}

.watch-btn:hover {
  background: var(--accent-green);
  color: #000;
  box-shadow: 0 4px 15px rgba(57, 255, 20, 0.2);
}

.stream-status-bar {
  font-size: 0.7rem;
  margin-top: 0.6rem;
  padding: 0.4rem;
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
  text-align: center;
}

.stream-status-bar.active {
  background: rgba(255, 0, 127, 0.1);
  color: var(--primary-pink);
  border: 1px solid rgba(255, 0, 127, 0.2);
  animation: pulse-stream 1.5s infinite alternate;
}

@keyframes pulse-stream {
  0% { box-shadow: 0 0 2px rgba(255, 0, 127, 0.1); }
  100% { box-shadow: 0 0 8px rgba(255, 0, 127, 0.2); }
}

/* User profile card */
.profile-card {
  margin-top: auto;
}

.profile-info {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.profile-emoji {
  font-size: 1.6rem;
}

.profile-info h4 {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
}

.role-badge {
  font-size: 0.7rem;
  color: var(--text-dim);
  background: rgba(255,255,255,0.05);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  display: inline-block;
  margin-top: 0.1rem;
}

/* CHAT AREA PANEL */
.chat-area {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: rgba(0, 0, 0, 0.05);
}

/* Livestream view screen overlay */
.livestream-view {
  height: 240px;
  position: relative;
  border-bottom: 1px solid var(--glass-border);
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.livestream-video-el {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-overlay {
  position: absolute;
  top: 1rem;
  left: 1rem;
  right: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
}

.live-tag {
  background: var(--primary-pink);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  letter-spacing: 0.5px;
  box-shadow: 0 0 10px var(--primary-pink);
}

#stream-host-name {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: bold;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.video-close-btn {
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.video-close-btn:hover {
  background: var(--primary-pink);
  border-color: var(--primary-pink);
}

.video-controls {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  z-index: 10;
}

.icon-btn-text {
  background: rgba(0,0,0,0.6);
  border: 1px solid var(--glass-border);
  color: #fff;
  font-size: 0.75rem;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
}

/* Chat Messages Scroller */
.messages-list {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  -webkit-overflow-scrolling: touch; /* Bouncy iOS physics */
}

/* Welcome box */
.chat-welcome {
  max-width: 500px;
  margin: 4rem auto;
  text-align: center;
  padding: 2rem;
  border-radius: 20px;
  border: 1px dashed var(--glass-border);
  background: rgba(255, 255, 255, 0.01);
}

.welcome-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  filter: drop-shadow(0 0 10px var(--primary-pink));
}

.chat-welcome h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.chat-welcome p {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.5;
}

/* Message Bubble layout */
.message-row {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  margin-bottom: 0.2rem;
}

.message-row.self {
  align-self: flex-end;
}

.message-row.other {
  align-self: flex-start;
}

.msg-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
  font-size: 0.75rem;
}

.message-row.self .msg-header {
  justify-content: flex-end;
}

.msg-display-name {
  font-weight: 700;
}

.msg-bubble {
  padding: 0.75rem 1.1rem;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.45;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.message-row.self .msg-bubble {
  background: linear-gradient(135deg, rgba(255, 0, 127, 0.15) 0%, rgba(255, 0, 127, 0.05) 100%);
  border: 1px solid rgba(255, 0, 127, 0.25);
  border-top-right-radius: 4px;
}

.message-row.other .msg-bubble {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%);
  border: 1px solid var(--glass-border);
  border-top-left-radius: 4px;
}

/* System message bubble */
.message-row.system {
  align-self: center;
  max-width: 100%;
}

.message-row.system .msg-bubble {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  font-size: 0.75rem;
  color: var(--text-dim);
  padding: 0.35rem 0.8rem;
  text-align: center;
}

/* Message attachments visual style */
.msg-media {
  max-width: 320px;
  border-radius: 12px;
  overflow: hidden;
  margin-top: 0.2rem;
  border: 1px solid rgba(255,255,255,0.05);
}

.msg-media img {
  width: 100%;
  height: auto;
  max-height: 240px;
  object-fit: cover;
  display: block;
}

.msg-media video {
  width: 100%;
  height: auto;
  max-height: 240px;
  display: block;
  background: #000;
}

.msg-audio {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.5rem 0.8rem;
  border-radius: 12px;
  margin-top: 0.2rem;
}

.msg-audio audio {
  width: 200px;
  height: 32px;
}

/* Large generic file layout */
.msg-file {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--glass-border);
  padding: 0.6rem 0.8rem;
  border-radius: 12px;
  margin-top: 0.2rem;
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.85rem;
  transition: background 0.2s;
}

.msg-file:hover {
  background: rgba(255,255,255,0.08);
}

.msg-file i {
  color: var(--primary-cyan);
}

.file-info-details {
  display: flex;
  flex-direction: column;
}

.file-size {
  font-size: 0.7rem;
  color: var(--text-dim);
}

/* Text to Speech trigger button */
.msg-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-top: 0.2rem;
}

.tts-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  transition: all 0.2s;
}

.tts-btn:hover {
  color: var(--primary-cyan);
  background: rgba(255,255,255,0.05);
}

.tts-btn i {
  width: 13px;
  height: 13px;
}

.msg-time {
  font-size: 0.65rem;
  color: var(--text-dim);
  margin-top: 0.2rem;
  align-self: flex-end;
}

/* Audio Record Panel */
.record-panel {
  position: absolute;
  bottom: 85px;
  left: 1.5rem;
  right: 1.5rem;
  background: rgba(16, 20, 36, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 0, 127, 0.3);
  box-shadow: 0 8px 30px var(--glass-glow-pink);
  border-radius: 18px;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  z-index: 50;
}

.record-pulse {
  width: 12px;
  height: 12px;
  background-color: var(--primary-pink);
  border-radius: 50%;
  animation: pulse-mic 1s infinite alternate ease-in-out;
}

@keyframes pulse-mic {
  0% { transform: scale(1); box-shadow: 0 0 2px var(--primary-pink); }
  100% { transform: scale(1.4); box-shadow: 0 0 12px var(--primary-pink); }
}

#record-duration {
  font-family: var(--font-display);
  font-weight: bold;
  font-size: 1.1rem;
}

.record-label {
  font-size: 0.85rem;
  color: var(--text-dim);
  flex: 1;
}

.cancel-btn {
  background: rgba(255,255,255,0.05);
  color: var(--text-main);
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
}

.cancel-btn:hover {
  background: rgba(255,255,255,0.1);
}

.send-record-btn {
  background: var(--primary-pink);
  color: #fff;
  padding: 0.5rem 1.2rem;
  font-size: 0.8rem;
}

/* File Upload Progress HUD styling */
.upload-hud {
  position: absolute;
  bottom: 85px;
  left: 1.5rem;
  right: 1.5rem;
  background: rgba(16, 20, 36, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 242, 254, 0.3);
  box-shadow: 0 8px 30px var(--glass-glow-cyan);
  border-radius: 18px;
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 50;
}

.hud-details {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.hud-filename {
  font-weight: bold;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 70%;
}

.hud-percentage {
  color: var(--primary-cyan);
  font-weight: bold;
}

.hud-progress-bg {
  height: 8px;
  background: rgba(255,255,255,0.05);
  border-radius: 4px;
  overflow: hidden;
}

.hud-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary-cyan) 0%, #00bfff 100%);
  border-radius: 4px;
  transition: width 0.2s ease;
}

.hud-sub {
  font-size: 0.7rem;
  color: var(--text-dim);
}

/* Sticker Picker Panel */
.sticker-picker {
  position: absolute;
  bottom: 145px;
  right: 1.5rem;
  width: 320px;
  height: 250px;
  background: rgba(16, 20, 36, 0.95);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  z-index: 60;
  overflow: hidden;
}

.picker-header {
  padding: 0.8rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 0.85rem;
  font-weight: bold;
}

.picker-header button {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
}

.stickers-grid {
  flex: 1;
  padding: 0.8rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  overflow-y: auto;
}

.sticker-item {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--glass-border);
  padding: 0.6rem;
  border-radius: 8px;
  text-align: center;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.sticker-item:hover {
  background: rgba(255, 0, 127, 0.15);
  border-color: var(--primary-pink);
  transform: scale(1.03);
}

/* Chat Input Bar wrapper */
.chat-input-wrapper {
  padding: 1rem 1.5rem;
  background: rgba(255, 255, 255, 0.01);
  border-top: 1px solid var(--glass-border);
}

.quick-emojis {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

.quick-emojis button {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.05);
  font-size: 1.1rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.quick-emojis button:hover {
  background: rgba(255,255,255,0.1);
  transform: scale(1.1);
}

.btn-sticker-picker {
  background: rgba(255, 0, 127, 0.1) !important;
  border: 1px solid rgba(255, 0, 127, 0.2) !important;
  color: var(--primary-pink) !important;
  font-size: 0.75rem !important;
  font-family: var(--font-display);
  font-weight: bold;
  padding: 0 0.8rem;
  border-radius: 16px !important;
  width: auto !important;
  height: 28px !important;
  margin-left: auto;
}

.btn-sticker-picker i {
  width: 14px;
  height: 14px;
}

/* Main Input form fields */
.chat-input-form {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  padding: 0.4rem 0.6rem;
  border-radius: 16px;
}

.chat-input-form:focus-within {
  border-color: var(--primary-pink);
  box-shadow: 0 0 8px var(--glass-glow-pink);
}

.chat-control-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.chat-control-btn:hover {
  color: #fff;
  background: rgba(255,255,255,0.06);
}

.mic-btn:hover {
  color: var(--primary-pink);
  background: rgba(255, 0, 127, 0.1);
}

.chat-input-form input {
  flex: 1;
  background: none;
  border: none;
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.6rem 0.2rem;
}

.chat-input-form input:focus {
  outline: none;
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--primary-pink);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: 0 0 10px var(--glass-glow-pink);
}

.chat-send-btn:hover {
  transform: scale(1.05);
  background: #ff1a8c;
}

/* Utilities */
.hidden {
  display: none !important;
}

.text-dim {
  color: var(--text-dim);
}

/* RESPONSIVE LAYOUT & MOBILE OPTIMIZATIONS */
@media (max-width: 900px) {
  #chat-screen {
    padding: max(0.5rem, env(safe-area-inset-top)) 0.5rem max(0.5rem, env(safe-area-inset-bottom)) 0.5rem;
  }
  
  .app-body {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    display: none; /* Hide sidebar in mobile by default, will expand if needed, or layout on top */
  }
  
  /* Create simplified mobile-friendly header indicators */
  .chat-container {
    border-radius: 16px;
  }
  
  .messages-list {
    padding: 1rem;
  }
  
  .msg-media {
    max-width: 250px;
  }
  
  .msg-audio audio {
    width: 150px;
  }
}

/* iOS Standalone Safe Area Padding Enhancements */
@media all and (display-mode: standalone) {
  body {
    background-color: #000;
  }
  .chat-container {
    height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }
}
