/* ==========================================================================
   MOGLE - DESIGN SYSTEM & STYLESHEET
   Inspired by classic Omegle with modern polish & dual-theme engine.
   ========================================================================== */

/* --- CSS Variables & Design Tokens --- */
:root {
  /* Classic Omegle Palette */
  --bg-page: #fbfbfd;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f3f7;
  --border-light: #e2e8f0;
  --border-strong: #cbd5e1;

  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;

  --brand-blue: #0284c7;
  --brand-blue-hover: #0369a1;
  --brand-cyan: #38bdf8;
  --brand-orange: #ea580c;
  --brand-orange-hover: #c2410c;

  --chat-stranger: #dc2626; /* Classic Omegle Red for Stranger */
  --chat-you: #0284c7;      /* Classic Omegle Blue for You */
  --chat-system: #64748b;

  --btn-stop-bg: #f8fafc;
  --btn-stop-border: #cbd5e1;
  --btn-stop-text: #0f172a;
  
  --btn-really-bg: #ef4444;
  --btn-really-border: #dc2626;
  --btn-really-text: #ffffff;

  --btn-new-bg: #0284c7;
  --btn-new-border: #0369a1;
  --btn-new-text: #ffffff;

  --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-brand: 'Outfit', 'Plus Jakarta Sans', sans-serif;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* --- Dark Theme Tokens --- */
body.theme-dark {
  --bg-page: #090d16;
  --bg-surface: #111827;
  --bg-subtle: #1f293d;
  --border-light: #28354d;
  --border-strong: #3b4d6e;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --brand-blue: #38bdf8;
  --brand-blue-hover: #0284c7;
  --brand-orange: #fb923c;
  --brand-orange-hover: #ea580c;

  --chat-stranger: #f87171;
  --chat-you: #38bdf8;
  --chat-system: #94a3b8;

  --btn-stop-bg: #1e293b;
  --btn-stop-border: #334155;
  --btn-stop-text: #f8fafc;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg: 0 12px 24px rgba(0,0,0,0.6);
}

/* --- Base Reset & Typography --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  font-family: var(--font-main);
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* --- Application Layout --- */
.app-wrapper {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  max-width: 1700px;
  margin: 0 auto;
  padding: 10px 16px;
  gap: 8px;
}

/* --- Header --- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.logo-icon {
  width: 44px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(37, 99, 235, 0.35));
  transition: transform 0.2s ease;
}

.brand-logo:hover .logo-icon {
  transform: rotate(-6deg) scale(1.05);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.logo-name {
  font-family: var(--font-brand);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.8px;
  line-height: 1;
  background: linear-gradient(135deg, #0284c7 20%, #ea580c 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
}

/* Header Right */
.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.online-counter {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  background-color: var(--bg-subtle);
  border-radius: 20px;
  border: 1px solid var(--border-light);
}

.pulse-indicator {
  width: 8px;
  height: 8px;
  background-color: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

#onlineCountText {
  color: var(--brand-blue);
  font-weight: 700;
}

.counter-label {
  color: var(--text-secondary);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pill-btn:hover {
  background-color: var(--border-light);
  transform: translateY(-1px);
}

.pill-btn.active {
  border-color: var(--brand-blue);
  background-color: rgba(2, 132, 199, 0.08);
}

/* --- Interests & Tabs Bar --- */
.interests-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  gap: 12px;
}

.interests-container {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 8px;
  overflow: hidden;
}

.interests-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
}

.tags-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.tag-remove {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
}

.tag-remove:hover {
  color: var(--chat-stranger);
}

#interestInput {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 12px;
  color: var(--text-primary);
  padding: 4px 6px;
  min-width: 140px;
}

#interestInput::placeholder {
  color: var(--text-muted);
}

.chat-mode-tabs {
  display: flex;
  align-items: center;
  background-color: var(--bg-subtle);
  padding: 2px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
}

.mode-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mode-tab.active {
  background-color: var(--bg-surface);
  color: var(--brand-blue);
  box-shadow: var(--shadow-sm);
}

/* --- Main Workspace (Video + Chat) --- */
.chat-workspace {
  display: flex;
  flex: 1;
  gap: 12px;
  min-height: 0; /* Prevents overflow bug in flex */
}

/* --- Left Column: Video Feeds --- */
.video-column {
  display: flex;
  flex-direction: column;
  width: 380px;
  flex-shrink: 0;
  gap: 10px;
  height: 100%;
  transition: width var(--transition-normal), opacity var(--transition-normal);
}

.video-column.hidden-mode {
  width: 0;
  opacity: 0;
  margin: 0;
  pointer-events: none;
  overflow: hidden;
}

.video-card {
  position: relative;
  flex: 1;
  background-color: #000000;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border-light);
}

.stream-element {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.stream-element.mirrored {
  transform: scaleX(-1);
}

.stream-element.hidden {
  display: none;
}

/* Overlay inside video cards */
.video-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 15, 26, 0.88);
  backdrop-filter: blur(4px);
  color: #f8fafc;
  padding: 16px;
  text-align: center;
  z-index: 5;
  transition: opacity 0.3s ease;
}

.video-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

/* Radar Animation for Connecting Stranger */
.search-animation {
  position: relative;
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.radar-circle {
  position: absolute;
  border: 2px solid var(--brand-blue);
  border-radius: 50%;
  opacity: 0;
  animation: ripple 2.4s cubic-bezier(0.2, 0.6, 0.3, 1) infinite;
}

.circle-1 { animation-delay: 0s; }
.circle-2 { animation-delay: 0.8s; }
.circle-3 { animation-delay: 1.6s; }

@keyframes ripple {
  0% {
    width: 20px;
    height: 20px;
    opacity: 0.8;
  }
  100% {
    width: 90px;
    height: 90px;
    opacity: 0;
  }
}

.radar-icon {
  font-size: 26px;
  z-index: 2;
}

.overlay-status {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
}

.overlay-sub {
  font-size: 11px;
  color: #94a3b8;
}

.user-avatar-icon {
  font-size: 40px;
  margin-bottom: 8px;
}

.action-btn-small {
  margin-top: 10px;
  padding: 6px 14px;
  background-color: var(--brand-blue);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.action-btn-small:hover {
  background-color: var(--brand-blue-hover);
}

/* Watermarks on Video */
.video-watermark {
  position: absolute;
  bottom: 8px;
  left: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.75);
  background: rgba(0, 0, 0, 0.6);
  padding: 2px 7px;
  border-radius: 4px;
  pointer-events: none;
  z-index: 3;
}

.watermark-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #ef4444;
}

.watermark-dot.active {
  background-color: #22c55e;
}

.partner-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.6);
  color: #e2e8f0;
  border-radius: 4px;
  z-index: 3;
}

/* Cam Quick Controls */
.cam-quick-controls {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  gap: 4px;
  opacity: 0.4;
  transition: opacity var(--transition-fast);
  z-index: 4;
}

.video-card:hover .cam-quick-controls {
  opacity: 1;
}

.cam-control-btn {
  width: 26px;
  height: 26px;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.cam-control-btn:hover {
  background: rgba(0, 0, 0, 0.9);
}

.cam-control-btn.muted {
  background-color: #ef4444;
  border-color: #dc2626;
}

/* --- Right Column: Chat Box --- */
.chat-column {
  display: flex;
  flex-direction: column;
  flex: 1;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  height: 100%;
}

.chat-history {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Custom Scrollbar */
.chat-history::-webkit-scrollbar {
  width: 6px;
}

.chat-history::-webkit-scrollbar-thumb {
  background-color: var(--border-strong);
  border-radius: 4px;
}

/* Classic Watermark Logo in Chat (Directly from user's Omegle screenshot) */
.welcome-watermark {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: auto;
  text-align: center;
  padding: 20px;
  user-select: none;
}

.watermark-graphic {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 24px;
}

.watermark-m-logo {
  font-family: var(--font-brand);
  font-size: 82px;
  font-weight: 900;
  letter-spacing: -2px;
  line-height: 0.9;
  display: flex;
}

.watermark-m {
  color: #0284c7;
}

.watermark-ogle {
  color: #ea580c;
}

/* The iconic Omegle water reflection effect */
.watermark-reflection {
  font-family: var(--font-brand);
  font-size: 82px;
  font-weight: 900;
  letter-spacing: -2px;
  line-height: 0.9;
  display: flex;
  transform: scaleY(-1);
  opacity: 0.18;
  mask-image: linear-gradient(to top, rgba(0, 0, 0, 1), transparent 75%);
  -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent 75%);
}

.welcome-message h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.welcome-message p {
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 440px;
  margin: 0 auto 4px auto;
}

.small-hint {
  font-size: 11px !important;
  color: var(--text-muted) !important;
}

kbd {
  display: inline-block;
  padding: 2px 6px;
  font-size: 11px;
  font-family: monospace;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.1);
}

/* Chat Messages */
.messages-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-message {
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
  animation: fadeInMsg 0.15s ease-out;
}

@keyframes fadeInMsg {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-message .msg-sender {
  font-weight: 800;
  margin-right: 6px;
}

.chat-message.msg-you .msg-sender {
  color: var(--chat-you);
}

.chat-message.msg-stranger .msg-sender {
  color: var(--chat-stranger);
}

.chat-message.msg-system {
  font-size: 12px;
  color: var(--chat-system);
  padding: 6px 12px;
  background-color: var(--bg-subtle);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--brand-blue);
  margin: 4px 0;
}

.chat-message.msg-disconnected {
  border-left-color: var(--chat-stranger);
  color: var(--chat-stranger);
  font-weight: 600;
}

/* Typing Indicator */
.typing-indicator {
  font-size: 12px;
  font-style: italic;
  color: var(--chat-stranger);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.typing-indicator.hidden {
  display: none;
}

.typing-dots span {
  animation: blinkDot 1.4s infinite both;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blinkDot {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}

/* --- Chat Bottom Action Bar --- */
.chat-action-bar {
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 10px;
  background-color: var(--bg-subtle);
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}

/* Classic Multi-State Esc Button (Omegle Trademark) */
.esc-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 90px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--btn-stop-border);
  background-color: var(--btn-stop-bg);
  color: var(--btn-stop-text);
  cursor: pointer;
  user-select: none;
  transition: all var(--transition-fast);
  padding: 6px 10px;
}

.esc-primary-text {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.1;
}

.esc-hint-text {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.esc-button:hover {
  filter: brightness(0.96);
}

/* State: Really? */
.esc-button.state-really {
  background-color: var(--btn-really-bg);
  border-color: var(--btn-really-border);
  color: var(--btn-really-text);
  animation: shakeBtn 0.3s ease;
}

.esc-button.state-really .esc-hint-text {
  color: rgba(255, 255, 255, 0.85);
}

@keyframes shakeBtn {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

/* State: New Partner */
.esc-button.state-new {
  background-color: var(--btn-new-bg);
  border-color: var(--btn-new-border);
  color: var(--btn-new-text);
}

.esc-button.state-new .esc-hint-text {
  color: rgba(255, 255, 255, 0.85);
}

/* Input Area */
.chat-input-wrapper {
  flex: 1;
  display: flex;
}

.chat-textarea {
  width: 100%;
  resize: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-primary);
  background-color: var(--bg-surface);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.chat-textarea:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

/* Send Button */
.send-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 80px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 6px 10px;
}

.send-label {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.1;
}

.send-shortcut {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.send-button:hover {
  background-color: var(--brand-blue);
  color: #ffffff;
  border-color: var(--brand-blue);
}

.send-button:hover .send-shortcut {
  color: rgba(255, 255, 255, 0.8);
}

/* --- Footer --- */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.footer-left strong {
  color: var(--brand-orange);
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.footer-right a {
  color: var(--text-secondary);
  text-decoration: none;
}

.footer-right a:hover {
  color: var(--brand-blue);
  text-decoration: underline;
}

/* --- Modals --- */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeInModal 0.2s ease;
}

.modal-backdrop.hidden {
  display: none;
}

@keyframes fadeInModal {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 520px;
  overflow: hidden;
  animation: scaleInModal 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleInModal {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
}

#snapshotPreviewImg {
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  display: block;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
  background-color: var(--bg-subtle);
}

.btn-primary {
  padding: 8px 16px;
  background-color: var(--brand-blue);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary:hover {
  background-color: var(--brand-blue-hover);
}

.btn-secondary {
  padding: 8px 16px;
  background-color: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
}

.btn-secondary:hover {
  background-color: var(--border-light);
}

.shortcuts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.shortcut-item {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
}

.shortcut-item kbd {
  min-width: 80px;
  text-align: center;
}

.modal-divider {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 16px 0;
}

.about-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Flash animation for taking snapshot */
.flash-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: white;
  opacity: 0.9;
  z-index: 999;
  pointer-events: none;
  animation: flashFade 0.4s ease-out forwards;
}

@keyframes flashFade {
  0% { opacity: 0.9; }
  100% { opacity: 0; }
}

/* --- Responsive Media Queries --- */
@media (max-width: 960px) {
  .app-wrapper {
    padding: 6px;
  }
  .chat-workspace {
    flex-direction: column;
  }
  .video-column {
    width: 100%;
    height: 240px;
    flex-direction: row;
  }
}

/* =============================================================
   18+ Age Gate & Safety Disclaimer Modal
   ============================================================= */
.age-gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(3, 7, 18, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.age-gate-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.97);
}

.hidden,
.age-gate-step.hidden {
  display: none !important;
}

.age-gate-card {
  width: 100%;
  max-width: 580px;
  max-height: 94vh;
  background: #0f172a;
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 18px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 40px rgba(239, 68, 68, 0.15);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  animation: popIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.age-gate-card::-webkit-scrollbar {
  width: 6px;
}

.age-gate-card::-webkit-scrollbar-track {
  background: #0f172a;
}

.age-gate-card::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.age-gate-header {
  padding: 22px 24px 18px;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(220, 38, 38, 0.05));
  border-bottom: 1px solid rgba(239, 68, 68, 0.25);
  display: flex;
  align-items: center;
  gap: 16px;
}

.age-badge-icon {
  font-size: 38px;
  width: 56px;
  height: 56px;
  background: rgba(239, 68, 68, 0.18);
  border: 1.5px solid rgba(239, 68, 68, 0.5);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

.age-header-text h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 4px 0;
  letter-spacing: -0.3px;
}

.age-sub-badge {
  font-size: 11px;
  font-weight: 700;
  color: #f87171;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.age-gate-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.age-warning-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(239, 68, 68, 0.12);
  border-left: 4px solid #ef4444;
  border-radius: 8px;
  padding: 12px 14px;
}

.warning-sign {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.age-warning-alert strong {
  display: block;
  font-size: 13px;
  color: #fca5a5;
  margin-bottom: 2px;
}

.age-warning-alert p {
  font-size: 12px;
  color: #cbd5e1;
  margin: 0;
  line-height: 1.4;
}

.age-rules-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.age-rule-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
}

.rule-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 2px;
}

.rule-content h4 {
  font-size: 13px;
  font-weight: 700;
  color: #f1f5f9;
  margin: 0 0 3px 0;
}

.rule-content p {
  font-size: 11.5px;
  color: #94a3b8;
  margin: 0;
  line-height: 1.4;
}

/* 5s Timer Box */
.age-timer-box {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.timer-countdown-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.countdown-badge {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 2px solid #3b82f6;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.25);
}

.countdown-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  font-weight: 800;
  color: #60a5fa;
  line-height: 1;
}

.countdown-unit {
  font-size: 8px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
}

.timer-desc strong {
  display: block;
  font-size: 13px;
  color: #ffffff;
  margin-bottom: 2px;
}

.timer-desc p {
  font-size: 11px;
  color: #94a3b8;
  margin: 0;
}

.timer-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  overflow: hidden;
}

.timer-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3b82f6, #22c55e);
  border-radius: 10px;
  transition: width 0.1s linear;
}

/* Footer Buttons */
.age-gate-footer {
  padding: 16px 24px 20px;
  background: rgba(15, 23, 42, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 12px;
}

.btn-age-reject {
  flex: 1;
  padding: 12px 14px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 10px;
  color: #fca5a5;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-age-reject:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #ffffff;
}

.btn-age-confirm {
  flex: 1.6;
  padding: 12px 18px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.25s ease;
  border: none;
}

.btn-age-confirm.disabled {
  background: #1e293b;
  color: #64748b;
  cursor: not-allowed;
  opacity: 0.65;
  box-shadow: none;
}

.btn-age-confirm:not(.disabled) {
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #ffffff;
  cursor: pointer;
  opacity: 1;
  box-shadow: 0 4px 20px rgba(34, 197, 94, 0.4);
  animation: pulseGlow 1.8s infinite;
}

.btn-age-confirm:not(.disabled):hover {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  transform: translateY(-1px);
  box-shadow: 0 6px 25px rgba(34, 197, 94, 0.5);
}

@keyframes pulseGlow {
  0% { box-shadow: 0 0 10px rgba(34, 197, 94, 0.3); }
  50% { box-shadow: 0 0 25px rgba(34, 197, 94, 0.6); }
  100% { box-shadow: 0 0 10px rgba(34, 197, 94, 0.3); }
}

/* 2-Step Indicator */
.age-step-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.step-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
}

.step-badge.active {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.step-separator {
  font-size: 11px;
  color: #64748b;
}

/* Legal Checkboxes Section */
.age-checkboxes-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.legal-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(15, 23, 42, 0.9);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.legal-checkbox-label:hover {
  background: rgba(30, 41, 59, 0.8);
  border-color: rgba(59, 130, 246, 0.4);
}

.legal-checkbox-label.checked {
  background: rgba(34, 197, 94, 0.08);
  border-color: #22c55e;
}

.legal-checkbox {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkbox-custom {
  width: 20px;
  height: 20px;
  border: 2px solid #64748b;
  border-radius: 5px;
  flex-shrink: 0;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  background: #0f172a;
}

.legal-checkbox:checked + .checkbox-custom {
  background: #22c55e;
  border-color: #22c55e;
}

.legal-checkbox:checked + .checkbox-custom::after {
  content: '✓';
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.legal-checkbox:disabled ~ .checkbox-custom,
.legal-checkbox:disabled ~ .checkbox-text {
  opacity: 0.5;
  cursor: not-allowed;
}

.checkbox-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.checkbox-text strong {
  font-size: 12.5px;
  color: #f1f5f9;
}

.checkbox-text span {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.35;
}

/* Step 2 Elements */
.alert-critical {
  background: rgba(220, 38, 38, 0.18) !important;
  border-left-color: #dc2626 !important;
}

.step2-summary-card {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px;
}

.step2-summary-card h3 {
  font-size: 13.5px;
  color: #ffffff;
  margin: 0 0 10px 0;
  font-family: 'Outfit', sans-serif;
}

.summary-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.summary-list li {
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.4;
}

.final-warning-text {
  font-size: 12.5px;
  font-weight: 600;
  color: #fbbf24;
  text-align: center;
  margin: 8px 0 0;
}

.btn-final-confirm {
  background: linear-gradient(135deg, #16a34a, #059669) !important;
  font-size: 13.5px !important;
}

.btn-final-confirm:hover {
  background: linear-gradient(135deg, #22c55e, #10b981) !important;
}

/* --- Device Settings Modal --- */
.modal-settings {
  max-width: 480px;
}

.settings-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-icon {
  font-size: 20px;
}

.settings-hint {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.45;
}

.form-select {
  width: 100%;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 13.5px;
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-select:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

.audio-meter-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-top: 14px;
}

.meter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.meter-val {
  font-weight: 700;
  color: var(--brand-blue);
}

.meter-bar-track {
  height: 8px;
  background: var(--border-light);
  border-radius: 4px;
  overflow: hidden;
}

.meter-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #22c55e 0%, #eab308 65%, #ef4444 100%);
  border-radius: 4px;
  transition: width 0.06s ease;
}

/* ==========================================================================
   RESPONSIVE DESIGN SYSTEM (MOBILE, TABLET & COMPACT SCREENS)
   ========================================================================== */

/* Tablets & Small Laptops (max-width: 1024px) */
@media (max-width: 1024px) {
  .app-wrapper {
    max-width: 100%;
    padding: 8px 12px;
  }

  .video-column {
    width: 310px;
  }

  .pill-btn {
    padding: 5px 9px;
    font-size: 11px;
  }
}

/* Tablets (Portrait) & Large Phones (max-width: 860px) */
@media (max-width: 860px) {
  .app-wrapper {
    padding: 6px 8px;
    height: 100vh;
    height: 100dvh;
    gap: 6px;
  }

  .app-header {
    padding: 6px 10px;
  }

  .brand-logo {
    gap: 8px;
  }

  .logo-icon {
    width: 36px;
    height: 36px;
  }

  .logo-name {
    font-size: 22px;
  }

  .logo-tag {
    font-size: 10px;
  }

  .pill-btn .btn-label {
    display: none;
  }

  .pill-btn {
    padding: 6px 8px;
  }

  .counter-label {
    display: none;
  }

  .interests-bar {
    padding: 6px 10px;
    gap: 8px;
  }

  .chat-workspace {
    flex-direction: column;
    gap: 8px;
  }

  .video-column {
    width: 100%;
    height: 220px;
    flex-direction: row;
    flex-shrink: 0;
    gap: 8px;
  }

  .video-card {
    flex: 1;
    height: 100%;
    min-width: 0;
  }

  .chat-column {
    flex: 1;
    min-height: 0;
  }

  .watermark-m-logo,
  .watermark-reflection {
    font-size: 58px !important;
    letter-spacing: -1.5px;
  }

  .welcome-message h3 {
    font-size: 15px;
  }

  .welcome-message p {
    font-size: 12px;
  }

  .chat-action-bar {
    padding: 6px 8px;
    gap: 8px;
  }

  .esc-button {
    min-width: 70px;
    padding: 8px 10px;
  }

  .chat-textarea {
    font-size: 16px; /* Prevents auto-zoom on iOS */
    padding: 8px 10px;
  }

  .send-button {
    min-width: 65px;
    padding: 8px 12px;
  }

  .send-shortcut,
  .esc-hint-text {
    display: none;
  }

  .app-footer {
    padding: 4px 8px;
    font-size: 11px;
    flex-direction: column;
    text-align: center;
    gap: 3px;
  }

  .safety-badge {
    display: none;
  }

  .age-gate-card {
    width: 95vw !important;
    max-width: 95vw !important;
    padding: 16px !important;
    margin: 8px;
    max-height: 92vh;
    overflow-y: auto;
  }

  .modal-card {
    width: 95vw !important;
    max-width: 95vw !important;
    padding: 16px !important;
    margin: 8px;
    max-height: 92vh;
    overflow-y: auto;
  }
}

/* Small Phones & Mobile Portrait (max-width: 480px) */
@media (max-width: 480px) {
  .app-wrapper {
    padding: 4px;
    gap: 5px;
  }

  .app-header {
    padding: 5px 8px;
  }

  .logo-icon {
    width: 32px;
    height: 32px;
  }

  .logo-name {
    font-size: 20px;
  }

  .interests-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 6px 8px;
    gap: 6px;
  }

  .interests-container {
    width: 100%;
  }

  .chat-mode-tabs {
    width: 100%;
    display: flex;
  }

  .mode-tab {
    flex: 1;
    justify-content: center;
    padding: 6px 8px;
    font-size: 12px;
  }

  .video-column {
    height: 170px;
    gap: 6px;
  }

  .cam-quick-controls {
    bottom: 4px;
    right: 4px;
    gap: 3px;
  }

  .cam-control-btn {
    width: 28px;
    height: 28px;
    font-size: 11px;
    padding: 2px;
  }

  .watermark-m-logo,
  .watermark-reflection {
    font-size: 46px !important;
    letter-spacing: -1px;
  }

  .welcome-watermark {
    padding: 8px;
  }

  .chat-history {
    padding: 8px;
  }

  .message-item {
    font-size: 13px;
    padding: 6px 10px;
  }

  .esc-button {
    min-width: 60px;
    font-size: 13px;
    padding: 6px 8px;
  }

  .send-button {
    min-width: 60px;
    font-size: 13px;
    padding: 6px 8px;
  }

  .footer-right {
    gap: 8px;
    font-size: 11px;
  }

  .age-gate-header h2 {
    font-size: 16px;
  }

  .age-step-indicator {
    font-size: 10px;
    gap: 4px;
  }

  .step-badge {
    padding: 2px 6px;
    font-size: 10px;
  }
}

/* ==========================================================================
   LEGAL MODALS & FOOTER NAVIGATION (AGB, Datenschutz, Impressum)
   ========================================================================== */
.legal-link {
  color: #38bdf8 !important;
  text-decoration: underline !important;
  cursor: pointer;
  font-weight: 600;
  transition: color 0.2s ease;
}

.legal-link:hover {
  color: #7dd3fc !important;
}

.modal-legal {
  max-width: 640px !important;
  width: 92% !important;
  max-height: 85vh !important;
  display: flex !important;
  flex-direction: column !important;
}

.modal-legal-body {
  overflow-y: auto !important;
  max-height: 58vh !important;
  padding: 18px 20px !important;
  color: #cbd5e1 !important;
  font-size: 13px !important;
  line-height: 1.65 !important;
}

.modal-legal-body h4 {
  color: #f8fafc !important;
  margin: 16px 0 6px 0 !important;
  font-size: 14px !important;
  font-family: 'Outfit', sans-serif !important;
}

.modal-legal-body h4:first-child {
  margin-top: 0 !important;
}

.modal-legal-body p {
  margin-bottom: 10px !important;
}

.modal-legal-body ul {
  padding-left: 20px !important;
  margin-bottom: 12px !important;
}

.modal-legal-body li {
  margin-bottom: 6px !important;
}

.modal-backdrop {
  z-index: 999999 !important;
}

.age-gate-legal-footer {
  padding: 12px 24px;
  background: rgba(3, 7, 18, 0.45);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 11.5px;
  position: relative;
  z-index: 1000;
}

.age-gate-legal-footer a {
  color: #38bdf8 !important;
  text-decoration: underline !important;
  cursor: pointer !important;
  font-weight: 600;
  transition: color 0.2s ease;
}

.age-gate-legal-footer a:hover {
  color: #7dd3fc !important;
}

.age-gate-legal-footer .dot {
  color: #64748b;
  user-select: none;
}

.footer-right a {
  cursor: pointer !important;
}



