:root {
  --bg-color: #1a1a2e; /* Darker, more futuristic */
  --main-chat-bg: #16213e;
  --message-bg: #1a1a2e;
  --input-bg: #0f3460;
  --text-color: #e0e0e0; /* Lighter text */
  --subtle-text-color: #a0a0c0;
  --accent-color: #e94560; /* Vibrant red-pink */
  --accent-color-hover: #b82d49;
  --accent-color-rgb: 233, 69, 96; /* RGB for accent-color for rgba */
  --border-color: #0c182e;
  --reaction-bg: #2b2d31; /* Keep a neutral tone for reactions */
  --reaction-border: #404249;
  --admin-badge-color: #ed4245; /* Red */
  --mod-badge-color: #5865f2; /* Blue */
  --trial-mod-badge-color: #2ecc71; /* Green for trial mod */
  --system-message-bg: rgba(var(--accent-color-rgb), 0.1);

    /* Damaelo specific colors */
    --damaelo-red: #ff5555;
    --damaelo-blue: #5555ff;
    --damaelo-green: #55ff55;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* More modern font */
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0a0a0a, #2a002a); /* Darker, more futuristic gradient */
    margin: 0;
    font-family: 'Aldrich', sans-serif; /* A sci-fi/game-like font */
    color: #e0f0ff; /* Slightly cooler light bluish-white */
    overflow: hidden; /* Prevent scrollbar from background effects */
}

/* Optional: Add a subtle animated background pattern for futuristic feel */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 10% 20%, rgba(50, 0, 50, 0.2) 0%, transparent 80%),
        radial-gradient(circle at 90% 80%, rgba(0, 50, 50, 0.2) 0%, transparent 80%);
    opacity: 0.7;
    animation: backgroundPulse 15s infinite alternate;
    pointer-events: none; /* Allow clicks to pass through */
}

@keyframes backgroundPulse {
    0% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.05); opacity: 0.8; }
    100% { transform: scale(1); opacity: 0.7; }
}

#root {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  width: 100%; /* Ensure root takes full width */
}

.login-container {
  background: var(--main-chat-bg);
  padding: 40px;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  text-align: center;
  width: 90%;
  max-width: 400px;
  border: 1px solid var(--border-color);
}

.login-container h2 {
  color: var(--accent-color);
  margin-bottom: 25px;
  font-size: 2.2em;
  letter-spacing: 1px;
}

.login-form input {
  width: 100%;
  padding: 12px 15px;
  margin-bottom: 15px;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-color);
  font-size: 1em;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.login-form input:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(var(--accent-color-rgb), 0.3);
}

.login-form button {
  width: 100%;
  padding: 12px 15px;
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1.1em;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.2s;
  letter-spacing: 0.5px;
}

.login-form button:hover:not(:disabled) {
  background: var(--accent-color-hover);
  transform: translateY(-2px);
}

.login-form button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.login-error {
  color: var(--admin-badge-color); /* Red for errors */
  margin-top: 15px;
  font-weight: 500;
}

/* Avatar Picker in Login Form */
.avatar-picker-container {
  margin-bottom: 15px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px;
  background: var(--input-bg);
}

.avatar-selection-mode {
  display: flex;
  margin-bottom: 10px;
}

.avatar-selection-mode button {
  flex: 1;
  background: var(--main-chat-bg);
  color: var(--subtle-text-color);
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.avatar-selection-mode button:first-child {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none;
}

.avatar-selection-mode button:last-child {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.avatar-selection-mode button.active {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
}

.emoji-avatar-section, .upload-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.avatar-emoji-button {
  background: var(--main-chat-bg);
  color: var(--text-color);
  padding: 10px 15px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1em;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.avatar-emoji-button:hover {
  background: var(--reaction-bg);
}

.avatar-picker-container .emoji-picker {
  position: static; /* Position normally within flow */
  transform: none;
  margin-top: 10px;
  box-shadow: none;
  width: 100%;
}

.upload-avatar-section button {
  background: var(--main-chat-bg);
  color: var(--text-color);
  padding: 10px 15px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  font-size: 1em;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.upload-avatar-section button:hover {
  background: var(--reaction-bg);
}

.avatar-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--reaction-bg);
  padding: 5px;
  border-radius: 8px;
}

.avatar-preview img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-color);
}

.remove-avatar-button {
  background: none;
  border: none;
  color: var(--admin-badge-color);
  cursor: pointer;
  font-size: 1.2em;
}

.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 768px; /* Max width for a chat app */
  margin: 0 auto;
  border-left: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  background: var(--main-chat-bg);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.chat-header {
  height: 60px; /* Taller header */
  padding: 0 20px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  font-weight: bold;
  background: var(--main-chat-bg);
  color: var(--text-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  font-size: 1.2em;
  position: relative;
  z-index: 10;
}

.chat-header i {
  margin-right: 8px;
  font-size: 1.5em;
  color: var(--accent-color);
}

.chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  max-height: calc(100vh - 120px); /* Adjust for header and input */
  scroll-behavior: smooth;
  background: var(--main-chat-bg);
}

.message {
  display: flex;
  gap: 16px;
  position: relative; /* For reply icon positioning */
  padding: 8px 0; /* Add some padding */
  border-radius: 8px;
}

.message-avatar {
  width: 44px; /* Slightly larger avatar */
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--border-color);
}

.message-avatar-emoji {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2em;
  background-color: var(--input-bg);
  border: 2px solid var(--border-color);
}

.message-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.message-header {
  display: flex;
  align-items: center; 
  gap: 8px;
  margin-bottom: 4px;
  position: relative; /* For reaction positioning */
}

.header-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.message-author {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-color);
  font-size: 1.1em;
}

.message-time {
  color: var(--subtle-text-color);
  font-size: 0.85em;
}

.message-text {
  color: var(--text-color);
  line-height: 1.5;
  word-wrap: break-word;
  padding-right: 15px; /* Prevent text from overlapping reply icon */
}

/* Reply button always visible */
.message-action-button.reply-button-always-visible {
  background: none;
  border: none;
  color: var(--subtle-text-color); /* Slightly more visible */
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  font-size: 1.1em;
  transition: background-color 0.2s, color 0.2s;
  margin-left: auto; /* Push to the right */
  opacity: 1; /* Always visible */
}

.message-action-button.reply-button-always-visible:hover {
  background: var(--input-bg);
  color: var(--text-color);
}

.message-reactions {
  position: relative;
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.reaction {
  background: var(--reaction-bg);
  border: 1px solid var(--reaction-border);
  border-radius: 12px; /* More rounded */
  padding: 3px 8px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s, border-color 0.2s;
  color: var(--text-color);
}

.reaction:hover {
  background: var(--input-bg);
  border-color: var(--accent-color);
}

.reaction.active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: white;
}

.add-reaction {
  color: var(--subtle-text-color);
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  transition: background-color 0.2s;
}

.add-reaction:hover {
  background: var(--reaction-bg);
}

.emoji-picker {
  position: absolute;
  background: var(--reaction-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 5px;
  z-index: 100;
  transform: translateY(-100%);
  margin-top: -10px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.emoji-picker button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
  border-radius: 5px;
  transition: background-color 0.2s;
  font-size: 18px;
}

.emoji-picker button:hover {
  background: var(--input-bg);
}

/* Chat Input Layout - Reorganized */
.chat-input {
  padding: 16px;
  display: flex;
  flex-direction: column; /* Stack input row and button row vertically */
  gap: 10px;
  background: var(--main-chat-bg);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.chat-input .input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end; /* Align textarea and send button */
  position: relative; /* For maximize button positioning */
}

.chat-input .action-buttons-row {
  display: flex;
  gap: 10px;
  justify-content: flex-start; /* Align action buttons to the left */
}

.chat-textarea {
  flex: 1;
  width: 100%;
  padding: 12px 15px;
  background: var(--input-bg);
  border: none;
  border-radius: 10px; /* More rounded */
  color: var(--text-color);
  outline: none;
  font-size: 1em;
  resize: none; /* Disable manual resize */
  overflow-y: hidden; /* Hide scrollbar but allow content to scroll */
  min-height: 48px; /* Minimum height similar to input */
  max-height: 200px; /* Max height before scrolling */
  line-height: 1.5;
  transition: background-color 0.2s, box-shadow 0.2s;
}

.chat-textarea::placeholder {
  color: var(--subtle-text-color);
}

.chat-textarea:focus {
  box-shadow: 0 0 0 3px rgba(var(--accent-color-rgb), 0.3);
}

/* New Maximize Input Button Styling (inside input) */
.maximize-input-button {
  background: none;
  border: none;
  color: var(--subtle-text-color);
  cursor: pointer;
  font-size: 1.3em;
  padding: 0;
  position: absolute; /* Position relative to .input-row */
  right: 82px; /* Moved left to avoid border */
  bottom: 12px; 
  z-index: 10;
  transition: color 0.2s;
}

.maximize-input-button:hover:not(:disabled) {
  color: var(--accent-color);
}

.upload-button {
  background: var(--input-bg);
  border: none;
  border-radius: 10px;
  color: var(--text-color);
  padding: 0 16px; /* Wider buttons */
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3em; /* Larger icons */
  min-width: 50px; /* Minimum width for square buttons */
  height: 48px; /* Fixed height for consistent button size */
  flex-shrink: 0;
}

.upload-button.send-button { /* Specific style for send button */
  background: var(--accent-color);
}

.upload-button.send-button:hover:not(:disabled) {
  background: var(--accent-color-hover);
}

.upload-button:hover:not(:disabled) {
  background: var(--reaction-border);
}

.upload-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.message-image, .message-video, .message-audio {
  max-width: 100%;
  max-height: 400px;
  border-radius: 10px;
  margin-top: 10px;
  background-color: #000;
  object-fit: contain;
  display: block; /* Ensures it takes up its own line */
  border: 1px solid var(--border-color);
}

.message-image {
  cursor: pointer; /* Change cursor for popup */
}

.file-upload-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 16px 0 16px;
  padding: 10px 15px;
  background: var(--reaction-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--subtle-text-color);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}

.file-upload-preview img,
.file-upload-preview video {
  max-height: 50px;
  max-width: 80px;
  border-radius: 6px;
  object-fit: cover;
}

.file-upload-preview audio {
  flex-grow: 1;
  height: 40px; /* Consistent height */
}

.file-upload-preview .file-type {
  font-size: 0.9em;
  font-weight: bold;
  margin-right: auto;
  color: var(--accent-color);
}

.remove-file {
  color: var(--text-color);
  cursor: pointer;
  padding: 5px;
  font-size: 1.2em;
  transition: color 0.2s;
}

.remove-file:hover {
  color: var(--admin-badge-color);
}

.loading-indicator {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 3px solid var(--text-color);
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.admin-badge, .mod-badge, .trial-mod-badge {
  font-size: 0.7em;
  padding: 3px 6px;
  border-radius: 5px;
  margin-left: 6px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-badge {
  background: var(--admin-badge-color);
  color: white;
}

.mod-badge {
  background: var(--mod-badge-color);
  color: white;
}

.trial-mod-badge {
  background: var(--trial-mod-badge-color);
  color: white;
}

.command-help {
  padding: 15px;
  background: var(--reaction-bg);
  border-radius: 10px;
  margin: 10px 16px; /* Adjust margin to align with input */
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  position: relative; /* For z-index to be above other elements */
  z-index: 99;
}

.command-help h3 {
  margin-bottom: 10px;
  color: var(--text-color);
  font-size: 1.2em;
}

.command-item {
  display: flex;
  margin-bottom: 8px;
  padding: 4px 0;
  border-bottom: 1px dashed rgba(var(--border-color), 0.5);
}
.command-item:last-child {
  border-bottom: none;
}

.command-name {
  font-weight: bold;
  min-width: 140px; /* Slightly wider for commands */
  color: var(--accent-color);
  font-family: monospace; /* For code-like commands */
}

.command-desc {
  color: var(--subtle-text-color);
  font-size: 0.95em;
}

.system-message {
  background: var(--system-message-bg);
  padding: 10px 15px;
  border-radius: 10px;
  color: var(--subtle-text-color);
  font-style: italic;
  font-size: 0.95em;
  border-left: 3px solid var(--accent-color);
}

.message-content.deleted .message-text {
  color: #72767d;
  font-style: italic;
}

.mod-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.mod-action {
  background: var(--input-bg);
  border: none;
  color: var(--text-color);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9em;
  transition: background-color 0.2s;
}

.mod-action:hover {
  background: var(--reaction-border);
}

.mod-timer {
  font-size: 0.8em;
  color: var(--mod-badge-color);
  margin-left: 5px;
}

.scroll-bottom-button {
  margin-left: 15px; /* Aligned next to Chatiel name */
  background: var(--accent-color);
  border: none;
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95em;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background-color 0.2s, transform 0.2s;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  margin-right: auto; /* Push to the right, keeping space from Chatiel*/
}

.scroll-bottom-button:hover {
  background: var(--accent-color-hover);
  transform: translateY(-1px);
}

.floating-scroll-button {
  position: fixed;
  bottom: 90px; /* Adjust for new input size */
  right: calc(50% - 350px); /* Align with chat container */
  transform: translateX(calc(100% + 20px)); /* Move outside main chat width */
  background: var(--accent-color);
  border: none;
  color: white;
  width: 50px; /* Slightly larger */
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  z-index: 100;
  font-size: 1.1em; /* Smaller text inside */
  flex-direction: column; /* Stack icon and text */
  transition: background-color 0.2s, transform 0.3s ease-out;
  padding: 5px;
}

.floating-scroll-button i {
  font-size: 1.8em;
  margin-bottom: 2px;
}
.floating-scroll-button span {
  font-size: 0.8em;
  line-height: 1;
  text-align: center;
}

@media (max-width: 768px) {
  .floating-scroll-button {
    right: 20px;
    transform: translateX(0); /* On smaller screens, keep it on the right */
  }
}

.floating-scroll-button:hover {
  background: var(--accent-color-hover);
  transform: translateY(-2px) translateX(calc(100% + 20px)); /* Maintain position on hover */
  @media (max-width: 768px) {
    transform: translateY(-2px) translateX(0);
  }
}

.banned {
  text-decoration: line-through;
  opacity: 0.6;
}

/* Reply feature styles */
.message-actions-container {
  /* This was for hover actions. Reply button is now always visible */
  display: none; /* Hide this container as reply button is outside */
}

.message-reply-preview {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 6px;
  padding: 8px 12px;
  background: rgba(var(--accent-color-rgb), 0.15); /* Slightly more prominent */
  border-left: 4px solid var(--accent-color);
  border-radius: 8px;
  font-size: 0.9em;
  color: var(--subtle-text-color);
  cursor: pointer;
  max-width: 100%;
  transition: background-color 0.2s;
}

.message-reply-preview:hover {
  background: rgba(var(--accent-color-rgb), 0.25);
}

.message-reply-preview-content {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-reply-preview .message-author-replied {
  font-weight: 600;
  color: var(--text-color);
  margin-right: 6px;
}

.reply-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 16px 0 16px;
  padding: 10px 15px;
  background: var(--reaction-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--subtle-text-color);
  font-size: 0.95em;
}

.reply-preview-label {
  font-weight: bold;
  color: var(--accent-color);
}

.reply-preview-content {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.remove-reply {
  color: var(--text-color);
  cursor: pointer;
  padding: 5px;
  font-size: 1.2em;
  transition: color 0.2s;
}

.remove-reply:hover {
  color: var(--admin-badge-color);
}

/* Audio recording buttons */
.chat-input .record-button {
  background: #ED4245; /* Red for record */
}

.chat-input .record-button:hover:not(:disabled) {
  background: #C43437;
}

.chat-input .stop-button {
  background: #FAA61A; /* Orange for stop */
}

.chat-input .stop-button:hover:not(:disabled) {
  background: #D98C12;
}

.chat-input .send-audio-button {
  background: var(--accent-color); /* Blue for send audio */
}

.chat-input .send-audio-button:hover:not(:disabled) {
  background: var(--accent-color-hover);
}

.chat-input .cancel-audio-button {
  background: var(--input-bg); /* Grey for cancel */
}

.chat-input .cancel-audio-button:hover:not(:disabled) {
  background: var(--reaction-border);
}

/* Clear Chat Button */
.chat-input .clear-chat-button {
  background: #C43437; /* Red for delete */
}

.chat-input .clear-chat-button:hover:not(:disabled) {
  background: #A02C30;
}

/* GIF Button */
.chat-input .gif-button {
  background: #9B59B6; /* Purple for GIF */
  color: white;
  font-weight: bold;
  font-size: 1.1em;
  padding: 0 12px;
}
.chat-input .gif-button:hover:not(:disabled) {
  background: #8e44ad;
}

/* New styles for logout confirmation */
.logout-confirm-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.logout-confirm-modal {
  background: var(--main-chat-bg);
  padding: 30px;
  border-radius: 15px;
  text-align: center;
  max-width: 90%;
  width: 400px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.logout-confirm-buttons {
  display: flex;
  gap: 15px;
  margin-top: 20px;
  justify-content: center;
}

.logout-confirm-button {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.2s;
}

.logout-confirm {
  background: var(--accent-color);
  color: white;
}

.logout-confirm:hover {
  background: var(--accent-color-hover);
}

.logout-cancel {
  background: var(--input-bg);
  color: var(--text-color);
}

.logout-cancel:hover {
  background: var(--reaction-border);
}

/* Updated GIF generator styles */
.generated-gif-actions {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  justify-content: center;
}

.generated-gif-actions button {
  flex: 1;
  padding: 10px;
}

/* New messages indicator styles */
.new-messages-bubble {
  position: absolute;
  top: 10px;
  right: 20px;
  background: var(--accent-color);
  color: white;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 100;
}

.bubble-number {
  font-size: 1.5em;
  font-weight: bold;
  line-height: 1;
}

.bubble-text {
  font-size: 0.7em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.error-message {
  color: var(--admin-badge-color);
  margin-top: 10px;
}

/* New sound controls style */
#send-sound, #notification-sound {
  display: none;
}

/* Damaelo Game Styles */
.game-container {
    text-align: center;
    background-color: rgba(26, 26, 26, 0.8); /* Slightly transparent for depth */
    padding: 30px; /* Increased padding */
    border-radius: 15px; /* More rounded corners */
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.25), 0 0 60px rgba(100, 0, 100, 0.4); /* Enhanced glow */
    border: 1px solid rgba(150, 0, 150, 0.3); /* Subtle border */
    position: relative;
    z-index: 1; /* Ensure it's above the background animation */
}

#game-title {
    font-family: 'Aldrich', sans-serif;
    color: #ffb6c1; /* Light pink */
    font-size: 3.5em; /* Slightly larger */
    margin-bottom: 20px;
    text-shadow: 0 0 15px #ff69b4, 0 0 30px #ff69b4; /* Stronger pink glow */
    letter-spacing: 2px; /* Add some spacing */
}

.player-turn {
    font-size: 1.3em; /* Slightly larger */
    margin-bottom: 15px;
    color: #e0f0ff;
}

#current-player-display {
    font-weight: bold;
    text-transform: uppercase; /* Make player names uppercase */
    animation: pulseGlow 1.5s infinite alternate; /* Add a pulse effect */
}

/* Specific colors for each player */
#current-player-display[data-player="red"] { color: var(--damaelo-red); text-shadow: 0 0 5px var(--damaelo-red); }
#current-player-display[data-player="blue"] { color: var(--damaelo-blue); text-shadow: 0 0 5px var(--damaelo-blue); }
#current-player-display[data-player="green"] { color: var(--damaelo-green); text-shadow: 0 0 5px var(--damaelo-green); }

@keyframes pulseGlow {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.02); opacity: 0.9; }
}

#gameCanvas {
    background-color: transparent; /* Board image will be drawn by JS */
    border: 2px solid #777; /* Slightly thicker, subtle border */
    border-radius: 5px;
    display: block; /* Remove extra space below canvas */
    margin: 0 auto;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.1), 0 0 20px rgba(0, 200, 200, 0.3); /* Light blue/cyan glow */
}

.game-message {
    margin-top: 20px;
    font-size: 1.2em; /* Slightly larger */
    font-weight: bold;
    color: #a0ffff; /* Brighter cyan color */
    min-height: 1.5em; /* Reserve space to prevent layout shifts */
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.5); /* Cyan glow */
}

/* Modal Styles (for setup/lobby) */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 100; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.8); /* Black w/ opacity */
    display: flex; /* Use flexbox for centering */
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: rgba(26, 26, 26, 0.95);
    padding: 40px;
    border: 1px solid #888;
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.3), 0 0 80px rgba(100, 0, 100, 0.5);
    text-align: center;
    width: 90%;
    max-width: 500px;
    animation: fadeIn 0.5s ease-out;
    color: #e0f0ff;
    position: relative; /* For reset button */
}

.modal-content h2 {
    font-family: 'Aldrich', sans-serif;
    color: #ffb6c1;
    font-size: 2.5em;
    margin-bottom: 25px;
    text-shadow: 0 0 10px #ff69b4;
}

#player-inputs {
    margin-bottom: 20px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.player-lobby-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--input-bg);
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.player-avatar-preview {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid var(--border-color);
}

.player-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.player-avatar-preview .message-avatar-emoji {
  width: 100%;
  height: 100%;
  font-size: 1.5em;
}

.player-lobby-name {
    font-size: 1.1em;
    font-weight: bold;
    flex-grow: 1;
}

.player-lobby-color-text {
    font-size: 0.9em;
    color: var(--subtle-text-color);
}

.color-options {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap; /* Allow wrapping for smaller screens */
}

.damaelo-color-picker {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
  margin-bottom: 20px;
}

.color-option {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5em; /* Checkmark size */
    color: white;
    font-weight: bold;
}

.color-option.red { background-color: var(--damaelo-red); }
.color-option.blue { background-color: var(--damaelo-blue); }
.color-option.green { background-color: var(--damaelo-green); }

.color-option.selected {
    border-color: #a0ffff;
    box-shadow: 0 0 15px #a0ffff, inset 0 0 8px #a0ffff;
    transform: scale(1.1);
}

.color-option.unavailable {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: none;
    transform: none;
}

.start-button, .leave-game-button, .reset-game-button {
    background-color: #ff69b4; /* Pink */
    color: white;
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-family: 'Aldrich', sans-serif;
    font-size: 1.4em;
    cursor: pointer;
    margin-top: 30px;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 0 20px rgba(255, 105, 180, 0.6);
    width: 100%;
}

.start-button:hover:not(:disabled), .leave-game-button:hover, .reset-game-button:hover {
    background-color: #ff479e;
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(255, 105, 180, 0.8);
}

.start-button:disabled {
    background-color: #666;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.leave-game-button {
  background-color: #f00;
  font-size: 1em;
  padding: 10px 15px;
  width: auto;
  margin-top: 0;
  margin-left: auto;
}

.reset-game-button {
  background-color: #ff8c00;
  font-size: 1em;
  padding: 10px 15px;
  width: auto;
  margin-top: 0;
  margin-bottom: 20px;
}
.reset-game-button:hover {
  background-color: #e07b00;
}

.modal-message {
    margin-top: 15px;
    color: var(--damaelo-red); /* Error message color */
    font-size: 1em;
    min-height: 1.2em;
    font-weight: bold;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.damaelo-color-selection-container {
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    background: var(--input-bg);
    text-align: center;
}

.damaelo-color-selection-container label {
    display: block;
    margin-bottom: 10px;
    font-size: 1.1em;
    font-weight: bold;
    color: var(--text-color);
}