.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.25s cubic-bezier(.4,0,.2,1);
  opacity: 1;
}
.modal.hide {
  opacity: 0;
  pointer-events: none;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  transition: background 0.25s cubic-bezier(.4,0,.2,1);
}
.modal-panel {
  position: relative;
  background: #fff;
  width: 90%;
  max-width: 420px;
  padding: 1.6rem 1.2rem 1.2rem 1.2rem;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.18);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: modalIn 0.3s cubic-bezier(.4,0,.2,1);
}
@keyframes modalIn {
  from { transform: translateY(40px) scale(0.98); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.modal-close {
  position: absolute;
  right: 0.8rem;
  top: 0.8rem;
  border: none;
  background: transparent;
  font-size: 1.3rem;
  cursor: pointer;
  color: #888;
  transition: color 0.2s;
}
.modal-close:hover {
  color: #333;
}
.modal-panel h3 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: #222;
  text-align: left;
}
.exit-textarea {
  min-height: 70px;
  resize: vertical;
  padding: 0.8rem;
  font-size: 1.15rem;
  border: 1px solid #e6e6e6;
  border-radius: 8px;
  background: #fafafa;
  color: #222;
  font-family: inherit;
  margin-bottom: 0.5rem;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.7rem;
}
.modal-actions .btn {
  padding: 0.6rem 1.2rem;
  font-size: 1.15rem;
  border-radius: 8px;
  font-weight: 500;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  transition: background 0.2s, color 0.2s;
}
.modal-actions .primary {
  background-image: linear-gradient(to bottom, #6EE7B7, #10B981) !important;
  color: white !important;
  border: none;
}
.modal-actions .btn:not(.primary) {
  background: #f3f3f3;
  color: #222;
  border: 1px solid #e6e6e6;
}
.modal-actions .btn:hover {
  opacity: 0.92;
}
/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 62.5%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(135deg, #FFF7EE, #E8F4FD);
  color: #222;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* NAV */
.navbar {
  height: 12%;
  min-height: 60px;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 0 1.6rem;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: 0 .2rem 1rem rgba(0, 0, 0, .08);
  flex-shrink: 0;
}
.logo {
  height: 20rem;
  max-height: 80px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}
.description { 
  font-weight: 700; 
  font-size: 2.7rem; 
  transform: rotate(-6deg); 
  margin-left: 8rem; 
  margin-top: 1rem; 
  color: #333; 
  background: linear-gradient(135deg, #0581FE, #7EBFFF);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.online { 
  margin-left: auto; 
  margin-right: 1rem; 
  font-size: 2.7rem; 
  color: #10B981; 
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Moderation buttons (report / block) */
.moderation {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.mod-btn {
  background: transparent;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  color: #374151;
  transition: background 0.15s ease, transform 0.08s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.mod-btn:hover {
  background: rgba(0,0,0,0.04);
  transform: translateY(-1px);
}

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

/* Report and Block variants (also match IDs if used) */
.mod-btn.report, #mod-report {
  color: #fff;
  background: linear-gradient(135deg, #EF4444, #DC2626);
  box-shadow: 0 6px 18px rgba(220,38,38,0.16);
  border: none;
}

.mod-btn.block, #mod-block {
  color: #fff;
  background: linear-gradient(135deg, #F97316, #FB923C);
  box-shadow: 0 6px 18px rgba(249,115,22,0.12);
  border: none;
}

/* MAIN LAYOUT */
.main {
  flex: 1;
  display: flex;
  gap: 1rem;
  padding: 1rem;
  align-items: stretch;
  overflow: hidden;
  min-height: 0;
}

/* LEFT: video area */
.videos {
  width: 30%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background-color: white;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  padding: 1rem;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.video-container {
  flex: 1;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  border: 3px solid rgba(0,0,0,0.08);
}
video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: black;
}
.video-label {
  position: absolute;
  left: 12px;
  top: 12px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  padding: .35rem .6rem;
  border-radius: 6px;
  font-size: 1.2rem;
  pointer-events: none;
}

/* STATUS BAR */
.status {
  margin-top: .25rem;
  padding: .8rem 1rem;
  border-radius: 8px;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  font-size: 1.4rem;
  text-align: center;
  color: #64748B;
  font-weight: 500;
}

/* Screenshot button */
.screenshot-container {
  display: flex;
  justify-content: center;
  margin-top: .5rem;
}
.screenshot-btn {
  height: 4rem;
  background: linear-gradient(135deg, #10B981, #059669);
  color: white;
  font-size: 1.6rem;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  padding: 0 1.5rem;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.3);
  -webkit-tap-highlight-color: transparent;
}

/* RIGHT: chat area */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 6px 18px rgba(10,10,10,0.04);
  overflow: hidden;
}

/* Chat messages */
.chat {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  font-size: 1.6rem;
  line-height: 1.45;
  background: linear-gradient(180deg,#fff,#fafafa);
  word-break: break-word;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  -webkit-overflow-scrolling: touch;
}

/* Message bubbles */
.bubble {
  display: inline-block;
  padding: .7rem 1rem;
  margin-bottom: .8rem;
  border-radius: 18px;
  max-width: 85%;
  word-break: break-word;
  font-size: 1.5rem;
  line-height: 1.4;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.bubble.you {
  background: linear-gradient(135deg, #0581FE, #7EBFFF);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.bubble.them {
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  color: #111;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  font-weight: 500;
}
.bubble.system {
  background: transparent;
  color: #9CA3AF;
  text-align: center;
  width: 100%;
  border-radius: 0;
  margin-bottom: 1.2rem;
  font-style: italic;
  align-self: center;
  box-shadow: none;
}

/* CHAT INPUT AREA - PROFESSIONAL MOBILE-FRIENDLY */
.composer {
  display: grid;
  grid-template-columns: 15rem 1fr 15rem;
  gap: 1rem;
  padding: 1rem;
  align-items: center;
  background: #fff;
  border-top: 1px solid rgba(0,0,0,0.06);
  flex-shrink: 0;
  min-height: 80px;
}

/* Control buttons */
.btn {
  height: 100%;
  min-height: 50px;
  font-size: 1.6rem;
  border-radius: 9px;
  border: 1px solid #D1D5DB;
  cursor: pointer;
  background: white;
  transition: all 0.2s ease;
  font-weight: 500;
  padding: 1rem 1.5rem;
  -webkit-tap-highlight-color: transparent;
}
.btn.primary {
  background: linear-gradient(135deg, #7EBFFF, #0581FE);
  color: #fff;
  border: none;
  font-weight: 600;
}
.btn.danger { 
  background: linear-gradient(135deg, #EF4444, #DC2626); 
  color: #fff; 
  border: none;
}

/* Text input */
.chat-input {
  width: 100%;
  height: 100%;
  min-height: 50px;
  resize: none;
  padding: 1.2rem;
  font-size: 1.6rem;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.08);
  outline: none;
  line-height: 1.4;
  font-family: inherit;
  background: #fff;
  -webkit-appearance: none;
}
.chat-input:focus {
  border-color: #0581FE;
  box-shadow: 0 0 0 3px rgba(5,129,254,0.1);
}

/* Utility classes */
.hide { display: none; }
.bold { font-weight: 700; }

/* ===== MOBILE RESPONSIVE STYLES ===== */

/* Tablet */
@media only screen and (max-width: 56.25em) { /* 900px */
  .description {
    margin-left: 6rem;
    font-size: 2rem;
  }
  .online {
    font-size: 2rem;
  }
  .composer {
    grid-template-columns: 12rem 1fr 12rem;
    gap: 0.8rem;
  }
}

/* Small Tablet */
@media only screen and (max-width: 48.125em) { /* 770px */
  .online {
    display: none;
  }
  .logo {
    height: 15rem;
    max-height: 60px;
  }
}

/* Mobile Layout - Switch to column */
@media only screen and (max-width: 43.75em) { /* 700px */
  .main {
    flex-direction: column;
    padding: 0.5rem;
    gap: 0.5rem;
  }
  
  .videos {
    width: 100%;
    height: 40vh;
    position: relative;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
  }
  
  #remoteWrap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
  }
  
  #localWrap {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 70px;
    height: 90px;
    z-index: 10;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.9);
  }
  
  .status {
    position: absolute;
    bottom: 5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    background: rgba(0,0,0,0.7);
    color: #fff;
    border-radius: 25px;
    font-size: 1.3rem;
  }
  
  .screenshot-container {
    position: absolute;
    bottom: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
  }
  
  .chat-container {
    flex: 1;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }
  
  /* MOBILE CHAT INPUT - PROFESSIONAL LAYOUT */
  .composer {
    height: auto;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 0.8rem;
    padding: 0.8rem;
    border-top: 1px solid rgba(0,0,0,0.1);
    background: #fff;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
  }
  
  /* Control buttons row */
  #startBtn, #stopBtn, #reallyBtn {
    grid-row: 1;
    grid-column: 1 / -1;
    height: auto;
    min-height: 4.5rem;
    width: 100%;
    font-size: 1.5rem;
    border-radius: 12px;
    margin-bottom: 0.5rem;
  }
  
  /* Input area row */
  .chat-input {
    grid-row: 2;
    grid-column: 1;
    height: auto;
    min-height: 4.5rem;
    border-radius: 12px 0 0 12px;
    resize: vertical;
    margin: 0;
  }
  
  #sendBtn {
    grid-row: 2;
    grid-column: 2;
    height: auto;
    min-height: 4.5rem;
    border-radius: 0 12px 12px 0;
    border-left: none;
    width: 8rem;
  }
}

/* Small Mobile */
@media only screen and (max-width: 31.25em) { /* 500px */
  .navbar {
    height: 10%;
    min-height: 50px;
    padding: 0.8rem;
  }
  
  .logo {
    height: 13rem;
    max-height: 50px;
  }
  
  .videos {
    height: 35vh;
  }
  
  #localWrap {
    width: 60px;
    height: 80px;
  }
  
  .composer {
    gap: 0.6rem;
    padding: 0.8rem;
  }
  
  #startBtn, #stopBtn, #reallyBtn {
    min-height: 4rem;
    font-size: 1.4rem;
  }
  
  .chat-input {
    min-height: 4rem;
    font-size: 1.4rem;
  }
  
  #sendBtn {
    min-height: 4rem;
    font-size: 1.4rem;
    width: 7rem;
  }
}

/* Extra Small Mobile */
@media only screen and (max-width: 28.125em) { /* 450px */
  html {
    font-size: 60%;
  }
  
  .navbar {
    height: 9%;
    min-height: 45px;
    padding: 0.5rem;
  }
  
  .logo {
    height: 10rem;
    max-height: 45px;

  /* Moderation icon container in navbar (top-right) */
  .moderation {
    margin-left: 1rem;
    margin-right: 0.5rem;
    display: flex;
    gap: 0.4rem;
    align-items: center;
  }

  .mod-btn {
    background: transparent;
    border: none;
    font-size: 2.2rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 6px;
  }

  .mod-btn:hover {
    background: rgba(0,0,0,0.04);
  }

  /* Exit modal styles */
  .modal.hide { display: none; }
  .modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
  }
  .modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
  }
  .modal-panel {
    position: relative;
    background: #fff;
    width: 90%;
    max-width: 520px;
    padding: 1.4rem;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
  }
  .modal-close {
    position: absolute;
    right: 0.6rem;
    top: 0.6rem;
    border: none;
    background: transparent;
    font-size: 1.1rem;
    cursor: pointer;
  }
  .modal-panel h3 {
    margin: 0;
    font-size: 1.6rem;
  }
  .exit-textarea {
    min-height: 84px;
    resize: vertical;
    padding: 0.8rem;
    font-size: 1.4rem;
    border: 1px solid #e6e6e6;
    border-radius: 8px;
  }
  .modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
  }
  .modal-actions .btn {
    padding: 0.6rem 1.1rem;
    font-size: 1.4rem;
    border-radius: 8px;
  }
  .modal-actions .primary {
    background-image: linear-gradient(to bottom, #6EE7B7, #10B981) !important;
    color: white !important;
  }
  }
  
  .description {
    display: none;
  }
  
  .videos {
    height: 30vh;
  }
  
  #localWrap {
    width: 50px;
    height: 70px;
    top: 0.5rem;
    right: 0.5rem;
  }
  
  .composer {
    gap: 0.5rem;
    padding: 0.6rem;
  }
  
  #startBtn, #stopBtn, #reallyBtn {
    min-height: 3.8rem;
    font-size: 1.3rem;
  }
  
  .chat-input {
    min-height: 3.8rem;
    font-size: 1.3rem;
    padding: 0.8rem;
  }
  
  #sendBtn {
    min-height: 3.8rem;
    font-size: 1.3rem;
    width: 6rem;
  }
}

/* iPhone SE & Very Small Phones */
@media only screen and (max-width: 375px) {
  html {
    font-size: 58%;
  }
  
  .navbar {
    height: 8%;
    min-height: 40px;
    padding: 0.3rem;
  }
  
  .logo {
    height: 9rem;
    max-height: 40px;
  }
  
  .videos {
    height: 28vh;
  }
  
  #localWrap {
    width: 45px;
    height: 60px;
  }
  
  .status {
    bottom: 3.5rem;
    font-size: 1.1rem;
    padding: 0.4rem 0.8rem;
  }
  
  .screenshot-btn {
    height: 3rem;
    font-size: 1.2rem;
    padding: 0 1rem;
  }
  
  .composer {
    gap: 0.4rem;
    padding: 0.5rem;
  }
  
  #startBtn, #stopBtn, #reallyBtn {
    min-height: 3.5rem;
    font-size: 1.2rem;
  }
  
  .chat-input {
    min-height: 3.5rem;
    font-size: 1.2rem;
    padding: 0.6rem;
  }
  
  #sendBtn {
    min-height: 3.5rem;
    font-size: 1.2rem;
    width: 5.5rem;
  }
}

/* Landscape Mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .navbar {
    height: 15%;
  }
  
  .main {
    height: 85%;
  }
  
  .videos {
    height: 60vh;
  }
  
  #localWrap {
    width: 80px;
    height: 100px;
  }
  
  .composer {
    min-height: 70px;
  }
}

/* Safe area support for notched devices */
@supports(padding: max(0px)) {
  .navbar, .main {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
  
  .navbar {
    padding-top: max(1rem, env(safe-area-inset-top));
  }
  
  .composer {
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }
}

/* Prevent zoom on iOS input focus */
@media screen and (max-width: 768px) {
  .chat-input {
    font-size: 16px;
  }
}

/* Focus styles for accessibility */
.btn:focus, .chat-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(5,129,254,0.2);
}