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

/* Age Verification Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: #fff;
  padding: 30px;
  border-radius: 12px;
  max-width: 450px;
  width: 100%;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal h2 {
  color: #2c3e50;
  margin-bottom: 20px;
  font-size: 20px;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  text-align: left;
  font-size: 14px;
  line-height: 1.5;
  color: #555;
  cursor: pointer;
  margin-bottom: 24px;
}

.checkbox-label input[type="checkbox"] {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  cursor: pointer;
}

.checkbox-label a {
  color: #3498db;
  text-decoration: underline;
}

.checkbox-label a:hover {
  color: #2980b9;
}

.modal #enterBtn {
  padding: 14px 32px;
  background: #3498db;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.modal #enterBtn:hover:not(:disabled) {
  background: #2980b9;
}

.modal #enterBtn:disabled {
  background: #bdc3c7;
  cursor: not-allowed;
}

html, body {
  height: 100%;
  min-height: 500px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
}

.container {
  width: 100%;
  height: 100%;
  min-height: 500px;
  display: flex;
  flex-direction: column;
  background: #fff;
  position: relative;
}

.status-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #666;
  flex: 1;
  justify-content: center;
}

/* Actions Row - Below input */
.actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #fff;
  border-top: 1px solid #ecf0f1;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  overflow: visible;
}

.action-btn {
  padding: 6px 14px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  background: #f8f9fa;
  color: #333;
}

.action-btn:hover:not(:disabled) {
  background: #e9ecef;
}

.action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.action-btn.toggle.start {
  background: #27ae60;
  color: #fff;
  border-color: #27ae60;
}

.action-btn.toggle.start:hover {
  background: #219a52;
}

.action-btn.toggle.end {
  background: #e74c3c;
  color: #fff;
  border-color: #e74c3c;
}

.action-btn.toggle.end:hover {
  background: #c0392b;
}

.action-btn.report {
  background: #e67e22;
  color: #fff;
  border-color: #e67e22;
}

.action-btn.report:hover:not(:disabled) {
  background: #d35400;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: transparent;
  animation: none;
  flex-shrink: 0;
}

.status-dot.waiting {
  background: #f39c12;
  animation: pulse 1.5s infinite;
}

.status-dot.connected {
  background: #27ae60;
}

.status-dot.disconnected {
  background: #e74c3c;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(0.6); }
}

/* Messages - Scrollable Middle */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}

.message {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.4;
  animation: fadeIn 0.2s ease;
  word-wrap: break-word;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.message.self {
  align-self: flex-end;
  background: #3498db;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.message.partner {
  align-self: flex-start;
  background: #ecf0f1;
  color: #2c3e50;
  border-bottom-left-radius: 4px;
}

.message.system {
  align-self: center;
  background: transparent;
  color: #95a5a6;
  font-size: 13px;
  padding: 8px;
}

/* Sending Indicator */
.message.sending {
  align-self: flex-end;
  background: transparent;
  color: #95a5a6;
  font-size: 13px;
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sending-dot {
  width: 8px;
  height: 8px;
  background: #f1c40f;
  border-radius: 50%;
  animation: sendingPulse 0.8s ease-in-out infinite;
}

@keyframes sendingPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Receiving Indicator */
.message.receiving {
  align-self: flex-start;
  background: transparent;
  color: #95a5a6;
  font-size: 13px;
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Typing Indicator */
.typing-wrapper {
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 0 20px 12px;
}

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: #ecf0f1;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  width: fit-content;
  animation: fadeIn 0.2s ease;
}

.typing-indicator.hidden {
  display: none;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: #95a5a6;
  border-radius: 50%;
  animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(1) {
  animation-delay: 0s;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

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

/* Footer Area - Fixed Bottom */
.footer {
  position: sticky;
  bottom: 0;
  z-index: 100;
  background: #fff;
  flex-shrink: 0;
  overflow: visible;
}

/* Input Area */
.input-area {
  position: relative;
  padding: 12px 16px;
  background: #fff;
  border-top: 1px solid #ecf0f1;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}

.input-area input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 24px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}

.input-area input[type="text"]:focus {
  border-color: #3498db;
}

.input-area input[type="text"]:disabled {
  background: #f5f5f5;
  cursor: not-allowed;
}

#sendBtn {
  padding: 12px 20px;
  background: #3498db;
  color: #fff;
  border: none;
  border-radius: 24px;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

#sendBtn:hover:not(:disabled) {
  background: #2980b9;
}

#sendBtn:disabled {
  background: #bdc3c7;
  cursor: not-allowed;
}

/* Icon Buttons */
.icon-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
  color: #7f8c8d;
  border: 1px solid #ddd;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-btn:hover:not(:disabled) {
  background: #ecf0f1;
  color: #3498db;
  border-color: #3498db;
}

.icon-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Emoji Picker */
.emoji-picker-wrapper {
  position: static;
}

.emoji-dropdown {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 8px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  padding: 12px;
  z-index: 100;
  width: 320px;
}

.emoji-dropdown.show {
  display: block;
  animation: fadeIn 0.15s ease;
}

.emoji-search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 10px;
  outline: none;
  box-sizing: border-box;
}

.emoji-search:focus {
  border-color: #3498db;
}

.emoji-search::placeholder {
  color: #aaa;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  max-height: 220px;
  overflow-y: auto;
  overflow-x: hidden;
}

.emoji-grid::-webkit-scrollbar {
  width: 6px;
}

.emoji-grid::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.emoji-grid::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.emoji-grid::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}

.emoji-item {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.emoji-item:hover {
  background: #ecf0f1;
  transform: scale(1.15);
}

/* Games Picker */
.games-picker-wrapper {
  position: relative;
  overflow: visible;
}

.games-dropdown {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 8px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  padding: 8px;
  z-index: 100;
  width: 280px;
}

.games-dropdown.show {
  display: block;
  animation: fadeIn 0.15s ease;
}

.game-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}

.game-option:hover {
  background: #f8f9fa;
}

.game-icon {
  width: 48px;
  height: 48px;
  background: #ecf0f1;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3498db;
  flex-shrink: 0;
}

.game-option:hover .game-icon {
  background: #e8f4fc;
}

.game-info {
  flex: 1;
  min-width: 0;
}

.game-title {
  font-weight: 600;
  font-size: 14px;
  color: #2c3e50;
  margin-bottom: 2px;
}

.game-description {
  font-size: 12px;
  color: #7f8c8d;
  line-height: 1.3;
}

.game-option-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 10px;
  height: 10px;
  background: #e74c3c;
  border-radius: 50%;
  display: none;
}

.game-option-badge.show {
  display: block;
  animation: badgePulse 1.5s ease-in-out infinite;
}

/* Feature Tooltip */
.feature-tooltip {
  position: absolute;
  bottom: calc(100% + 70px);
  left: 0;
  background: #3498db;
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 9999;
  animation: tooltipBounce 0.5s ease;
}

.feature-tooltip.hidden {
  display: none;
}

.feature-tooltip .tooltip-arrow {
  position: absolute;
  bottom: -60px;
  left: 14px;
  width: 6px;
  height: 52px;
  background: #3498db;
  border-radius: 3px;
}

.feature-tooltip .tooltip-arrow::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: -9px;
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 12px solid #3498db;
}

/* Games button highlight when tooltip is visible */
#gamesBtn.highlighted {
  background: #3498db !important;
  color: #fff !important;
  box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.4);
  border-radius: 8px;
  animation: highlightPulse 1.5s ease-in-out infinite;
}

#gamesBtn.highlighted svg {
  stroke: #fff;
}

@keyframes highlightPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(52, 152, 219, 0.2); }
}

.feature-tooltip .tooltip-close {
  position: absolute;
  top: 2px;
  right: 4px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: bold;
}

.feature-tooltip .tooltip-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.feature-tooltip .tooltip-content {
  padding-right: 16px;
}

@keyframes tooltipBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* Inline Report Button */
.inline-report-btn {
  padding: 6px 14px;
  background: #e67e22;
  color: #fff;
  border: 1px solid #e67e22;
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.inline-report-btn:hover:not(:disabled) {
  background: #d35400;
  color: #fff;
}

.inline-report-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: #95a5a6;
  color: #95a5a6;
}

/* Inline Start New Chat Button */
.inline-start-btn {
  padding: 6px 14px;
  background: #27ae60;
  color: #fff;
  border: 1px solid #27ae60;
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  margin-left: 8px;
}

.inline-start-btn:hover {
  background: #219a52;
  border-color: #219a52;
}

/* Image Messages */
.message.image {
  padding: 6px;
  max-width: 70%;
}

.message.image img {
  max-width: 100%;
  max-height: 300px;
  border-radius: 12px;
  display: block;
  cursor: pointer;
}

/* Image Lightbox */
.lightbox-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: transparent;
  z-index: 2000;
  justify-content: center;
  align-items: center;
  padding: 20px;
  cursor: pointer;
}

.lightbox-overlay.show {
  display: flex;
}

.lightbox-content {
  position: relative;
  display: inline-block;
  padding: 50px 0;
}

.lightbox-content img {
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 140px);
  object-fit: contain;
  border-radius: 8px;
  cursor: default;
  display: block;
}

.lightbox-close {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  border: none;
  color: #fff;
  font-size: 20px;
  height: 36px;
  padding: 0 12px;
  border-radius: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
  white-space: nowrap;
}

.lightbox-close-top {
  top: 6px;
}

.lightbox-close-bottom {
  bottom: 6px;
}

.lightbox-close .close-text {
  font-size: 14px;
  font-weight: bold;
}

.lightbox-close:hover {
  background: rgba(0, 0, 0, 0.85);
}

/* Mobile lightbox adjustments */
@media (max-width: 600px) {
  .lightbox-overlay {
    position: absolute;
    bottom: auto;
    min-height: 100%;
    align-items: flex-start;
  }
  .lightbox-close {
    height: 40px;
    font-size: 22px;
  }
  .lightbox-close-top {
    top: 4px;
  }
  .lightbox-close-bottom {
    bottom: 4px;
  }
  .lightbox-close .close-text {
    font-size: 13px;
  }
}

/* Responsive - Mobile */
@media (max-width: 600px) {
  .input-area {
    padding: 10px 12px;
    gap: 6px;
  }

  .input-area input[type="text"] {
    padding: 10px 14px;
  }

  #sendBtn {
    padding: 10px 16px;
    font-size: 14px;
  }

  .actions-row {
    padding: 6px 12px;
  }

  .icon-btn {
    width: 40px;
    height: 40px;
  }

  .icon-btn svg {
    width: 18px;
    height: 18px;
  }

  .emoji-dropdown {
    width: 280px;
  }

  .emoji-grid {
    grid-template-columns: repeat(7, 1fr);
    max-height: 180px;
  }

  .emoji-item {
    width: 32px;
    height: 32px;
    font-size: 18px;
  }

  .emoji-search {
    padding: 6px 10px;
    font-size: 13px;
  }
}

/* Fix for iOS Safari viewport */
@supports (-webkit-touch-callout: none) {
  .container {
    min-height: -webkit-fill-available;
  }
}

/* SweetAlert2 - Prevent layout shift */
body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) {
  padding-right: 0 !important;
  overflow: hidden !important;
}

html.swal2-height-auto,
body.swal2-height-auto {
  height: 100% !important;
}
