:root {
  --sidebar-width: 300px;
  --chat-width: 300px;
  --collapsed-width: 40px;
  --primary-color: #ff69b4;
  --primary-hover: #ff85c2;
  --bg-color: #0f0f0f;
  --sidebar-bg: #1a1a1a;
  --main-bg: #0f0f0f;
  --border-color: #2a2a2a;
  --text-color: #f8f9fa;
  --secondary-text: #a0a0a0;
  --control-bg: rgba(26, 26, 26, 0.8);
  --control-hover: rgba(255, 105, 180, 0.15);
  --icon-size: 28px;
  --icon-size-sm: 22px;
  --icon-bg: rgba(26, 26, 26, 0.8);
  --icon-bg-hover: rgba(255, 105, 180, 0.15);
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  height: 100vh;
  overflow: hidden;
}

#main-content-wrapper {
  display: grid;
  grid-template-columns: auto 1fr auto;
  height: 100vh;
}

/* Add margin-bottom when upload bar is visible */
#main-content-wrapper.upload-bar-visible {
  margin-bottom: 60px;
}

.sidebar {
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  transition: width 0.3s ease;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.sidebar.collapsed {
  width: var(--collapsed-width);
}

.sidebar-toggle {
  position: absolute;
  right: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  background: var(--primary-color);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background-color 0.2s;
}

.sidebar-toggle:hover {
  background: var(--primary-hover);
}

.sidebar-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
}

.sidebar.collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

.upload-container {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.upload-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.upload-btn {
  flex: 1;
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.2s;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  text-align: center;
}

.upload-btn:hover {
  background-color: var(--primary-hover);
}

.auth-btn {
  background-color: var(--bg-color);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.875rem;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
  width: 40px;
  height: 40px;
  justify-content: center;
}

.auth-btn:hover {
  background-color: var(--sidebar-bg);
}

.auth-btn.logged-in {
  background-color: var(--bg-color);
  color: var(--text-color);
  border-color: var(--border-color);
  border-color: var(--primary-color);
  box-shadow: 0 0 0 1px var(--primary-color);
}

.auth-btn.logged-in:hover {
  background-color: var(--sidebar-bg);
}

.admin-only {
  display: none;
  pointer-events: none;
  opacity: 0;
}

.admin-only.visible {
  display: block;
  pointer-events: auto;
  opacity: 1;
}

#file-input {
  display: none;
}

.video-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  max-height: calc(100vh - 120px); /* Account for upload container */
}

.date-group {
  margin-bottom: 24px;
  border-radius: 8px;
  background: var(--sidebar-bg);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  overflow: hidden;
}

.date-header {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary-color);
  background: var(--sidebar-bg);
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
}

.date-header .chevron {
  transition: transform 0.2s;
  width: 18px;
  height: 18px;
  display: inline-block;
}
.date-header.collapsed .chevron {
  transform: rotate(-90deg);
}

.month-videos {
  padding: 0 0 12px 0;
  display: block;
  transition: max-height 0.3s cubic-bezier(.4,0,.2,1);
}
.month-videos.collapsed {
  display: none;
}

.video-item {
  position: relative;
  padding: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s;
  margin-bottom: 16px;
  background: none;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.video-item:hover {
  transform: translateY(-2px);
}

.video-item.selected::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border: 2px solid var(--primary-color);
  border-radius: 8px;
  pointer-events: none;
}

.thumbnail {
  width: 100%;
  aspect-ratio: 16/9;
  background-color: var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.thumbnail::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(0deg, 
    rgba(0,0,0,0.9) 0%, 
    rgba(0,0,0,0.7) 30%,
    rgba(0,0,0,0.4) 60%,
    rgba(0,0,0,0.1) 100%
  );
  opacity: 0.8;
  transition: opacity 0.2s;
}

.video-item:hover .thumbnail::after {
  opacity: 1;
}

.thumbnail img, 
.thumbnail video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 0.3s ease;
}

.thumbnail img {
  display: block;
  transition: opacity 0.3s ease, filter 0.3s ease;
}

.thumbnail video {
  transition: opacity 0.3s ease, filter 0.3s ease;
}

.video-item:hover .thumbnail img,
.video-item:hover .thumbnail video {
  filter: blur(4px);
}

.thumbnail img[style*="display: none"] + video {
  opacity: 1 !important;
}

.video-info {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 1;
}

.video-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-color);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
  max-height: 2.6em;
  padding-right: 80px; /* Space for buttons */
}

.video-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 2;
}

.video-item:hover .video-actions {
  opacity: 1;
}

.video-edit-btn,
.video-delete-btn {
  background: var(--icon-bg);
  border: none;
  border-radius: 4px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-color);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.video-edit-btn:hover {
  background: var(--icon-bg-hover);
  color: var(--primary-color);
}

.video-chat-btn {
  background: var(--icon-bg);
  border: none;
  border-radius: 4px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-color);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.video-chat-btn:hover {
  background: var(--icon-bg-hover);
  color: var(--primary-color);
}

.video-delete-btn:hover {
  background: var(--icon-bg-hover);
  color: #dc3545;
}

.video-metadata {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--text-color);
  opacity: 0.6;
  transition: opacity 0.2s;
}

.video-date-row {
  display: flex;
  align-items: center;
  gap: 6px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.video-stats-row {
  display: flex;
  align-items: center;
  gap: 12px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.video-stats-row span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.video-item:hover .video-metadata {
  opacity: 1;
}

.video-metadata span {
  display: flex;
  align-items: center;
  gap: 6px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.video-metadata svg {
  width: 14px;
  height: 14px;
  opacity: 0.9;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.5));
}

.video-date {
  font-size: 0.75rem;
  color: var(--secondary-text);
}

.main-content {
  background: var(--main-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: hidden;
}

.player-container {
  background-color: black;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 16/9;
  width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

#video-player {
  width: 100%;
  height: 100%;
  background: black;
  display: block;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  min-height: 200px; /* Ensure minimum height for clickability */
  position: relative;
  z-index: 1;
  pointer-events: auto;
}

.video-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-color);
  z-index: 100;
}

.placeholder-content {
  text-align: center;
  color: var(--secondary-text);
}

.placeholder-content svg {
  margin-bottom: 16px;
  opacity: 0.6;
}

.placeholder-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-color);
}

.placeholder-content p {
  font-size: 0.875rem;
  opacity: 0.8;
}

.vod-controls {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 2;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.vod-controls.visible {
  opacity: 1;
  pointer-events: auto;
}

.vod-controls-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--icon-bg);
  padding: 10px 16px 8px 16px;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
  gap: 10px;
}

.vod-controls-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vod-controls-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vod-icon-btn {
  background: none;
  border: none;
  outline: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  width: var(--icon-size-sm);
  height: var(--icon-size-sm);
  padding: 0;
  color: var(--text-color);
  transition: background 0.2s, color 0.2s;
}

.vod-icon-btn:hover {
  background: var(--icon-bg-hover);
  color: var(--primary-color);
}

.vod-volume-slider {
  width: 90px;
  accent-color: var(--primary-color);
  margin: 0 8px;
}

.vod-progress-container {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  margin-bottom: 0;
  padding: 0 0 4px 0;
}

.progress-bar-container {
  flex: 1;
  position: relative;
  height: 12px;
  display: flex;
  align-items: center;
}

.buffered-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 6px;
  overflow: hidden;
  pointer-events: none;
}

.buffered-segment {
  position: absolute;
  top: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 6px;
}

.vod-progress {
  flex: 1;
  height: 12px;
  -webkit-appearance: none;
  appearance: none;
  background-color: var(--border-color);
  border-radius: 6px;
  outline: none;
}

.vod-progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  background-color: var(--primary-color);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(255, 105, 180, 0.2);
  border: 2px solid #fff;
  transition: background 0.2s;
}

.vod-progress:focus::-webkit-slider-thumb {
  outline: 2px solid var(--primary-color);
}

.vod-progress::-moz-range-thumb {
  width: 22px;
  height: 22px;
  background-color: var(--primary-color);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(255, 105, 180, 0.2);
  border: 2px solid #fff;
  transition: background 0.2s;
}

.vod-progress:focus::-moz-range-thumb {
  outline: 2px solid var(--primary-color);
}

.vod-progress::-ms-thumb {
  width: 22px;
  height: 22px;
  background-color: var(--primary-color);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(255, 105, 180, 0.2);
  border: 2px solid #fff;
  transition: background 0.2s;
}

.vod-progress:focus::-ms-thumb {
  outline: 2px solid var(--primary-color);
}

.vod-progress::-ms-fill-lower {
  background: var(--border-color);
  border-radius: 6px;
}

.vod-progress::-ms-fill-upper {
  background: var(--border-color);
  border-radius: 6px;
}

.vod-progress:focus {
  outline: none;
}

.vod-time {
  font-size: 0.85rem;
  color: var(--secondary-text);
  min-width: 60px;
  text-align: right;
}

.vod-center-btn {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  background: var(--icon-bg);
  border-radius: 50%;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  outline: none;
  cursor: pointer;
  color: var(--text-color);
  font-size: 40px;
  opacity: 0;
  pointer-events: auto;
  transition: opacity 0.3s;
}

.vod-center-btn.visible {
  opacity: 1;
}

.vod-center-btn:hover {
  background: var(--icon-bg-hover);
  color: var(--primary-color);
}

.chat-sidebar {
  background-color: var(--sidebar-bg);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  width: var(--chat-width);
  transition: width 0.3s ease;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.chat-sidebar.collapsed {
  width: var(--collapsed-width);
}

.chat-header {
  font-size: 1rem;
  font-weight: 600;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--primary-color);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 80px); /* Account for chat header */
  position: relative;
}

.chat-spacer {
  flex: 1;
  min-height: 0;
}

.chat-message {
  margin-top: 12px;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--text-color);
  opacity: 0;
  transform: translateY(10px);
  animation: slideInMessage 0.3s ease-out forwards;
}

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

.message-time {
  color: var(--secondary-text);
  font-size: 0.75rem;
  margin-right: 8px;
}

.message-user {
  color: var(--primary-color);
  font-weight: 500;
  margin-right: 4px;
}

.upload-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 8px;
  background-color: var(--border-color);
  display: none;
  z-index: 10000;
  pointer-events: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background-color: var(--primary-color);
  transition: width 0.3s ease-in-out;
  box-shadow: 0 0 10px rgba(255, 105, 180, 0.5);
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--sidebar-bg);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color);
}

.sidebar.collapsed .upload-container,
.sidebar.collapsed .video-list,
.chat-sidebar.collapsed .chat-header,
.chat-sidebar.collapsed .chat-messages {
  display: none;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.3s;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.modal-overlay.visible {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.modal {
  background: var(--sidebar-bg);
  border-radius: 8px;
  padding: 24px;
  width: 100%;
  max-width: 480px;
  position: relative;
  transform: translateY(20px);
  transition: transform 0.3s;
}

.modal-overlay.visible .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-color);
  user-select: text;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
}

.modal-close {
  background: none;
  border: none;
  color: var(--secondary-text);
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--primary-color);
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  color: var(--secondary-text);
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 8px 12px;
  color: var(--text-color);
  font-size: 0.875rem;
  transition: border-color 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-color);
  user-select: text;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.btn {
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-secondary {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  color: var(--text-color);
}

.btn-secondary:hover {
  background: var(--sidebar-bg);
}

.btn-primary {
  background: var(--primary-color);
  border: none;
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

/* Console modal */
#console-output {
  width: 100%;
  height: 60vh;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 12px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  line-height: 1.4;
  white-space: pre-wrap;
}

.log-line { display: block; margin-bottom: 2px; }
.log-line .ts { color: var(--secondary-text); margin-right: 6px; }
.log-line .level { margin-right: 6px; }
.log-line.info .level, .log-line.log .level { color: #8be9fd; }
.log-line.warn .level { color: #f1fa8c; }
.log-line.error .level { color: #ff5555; }
.log-line.debug .level { color: #50fa7b; }

/* Right sidebar toggle button positioning */
#right-sidebar .sidebar-toggle {
  right: auto;
  left: -12px;
}

#right-sidebar.collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

/* Always show the toggle button */
.chat-sidebar .sidebar-toggle {
  display: flex !important;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Chat mention styling */
.mention {
  color: var(--primary-color);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.2s, background-color 0.2s;
  padding: 1px 2px;
  border-radius: 3px;
}

.mention:hover {
  color: var(--primary-hover);
  text-decoration: underline;
  background-color: rgba(255, 105, 180, 0.1);
}

/* Hoverable username styling */
.hoverable-username {
  color: var(--primary-color);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.2s, background-color 0.2s;
  padding: 1px 2px;
  border-radius: 3px;
}

.hoverable-username:hover {
  color: var(--primary-hover);
  text-decoration: underline;
  background-color: rgba(255, 105, 180, 0.1);
}

/* User profile card styling */
.user-profile-card {
  background: var(--sidebar-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  width: 280px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  font-size: 0.875rem;
  animation: fadeIn 0.2s ease-out;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 40px);
  overflow: hidden;
  pointer-events: auto;
}

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

/* Ensure profile cards don't go off-screen */
.user-profile-card {
  position: fixed !important;
  z-index: 10000;
}

/* Adjust position if card would go off-screen */
.user-profile-card[style*="left"] {
  max-width: calc(100vw - 20px);
}

.user-profile-card[style*="top"] {
  max-height: calc(100vh - 20px);
}

.profile-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
  position: relative;
}

.profile-close-btn {
  position: absolute;
  top: 0;
  right: 0;
  background: none;
  border: none;
  color: var(--secondary-text);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.2s, background-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-close-btn:hover {
  color: var(--text-color);
  background: var(--border-color);
}

.profile-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-color);
}

.profile-info {
  flex: 1;
  margin-right: 24px; /* Space for close button */
}

.profile-name {
  font-weight: 600;
  color: var(--text-color);
  font-size: 1rem;
  margin-bottom: 2px;
}

.profile-username-link {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.2s;
}

.profile-username-link:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.profile-login {
  color: var(--secondary-text);
  font-size: 0.8125rem;
  margin-bottom: 4px;
}

.profile-type {
  display: inline-block;
  background: var(--primary-color);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: capitalize;
}

.profile-stats {
  margin-bottom: 12px;
}

.stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}

.stat-label {
  color: var(--secondary-text);
  font-size: 0.8125rem;
}

.stat-value {
  color: var(--text-color);
  font-weight: 500;
}

.profile-description {
  color: var(--text-color);
  font-size: 0.8125rem;
  line-height: 1.4;
  margin-bottom: 12px;
  opacity: 0.9;
}

.profile-actions {
  display: flex;
  gap: 8px;
}

.profile-link {
  background: var(--primary-color);
  color: white;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: background-color 0.2s;
  flex: 1;
  text-align: center;
}

.profile-link:hover {
  background: var(--primary-hover);
}

/* Resume auto-scroll button */
.resume-scroll-btn {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: background-color 0.2s, transform 0.2s;
  z-index: 10;
  pointer-events: auto;
}

.resume-scroll-btn:hover {
  background: var(--primary-hover);
  transform: translateX(-50%) translateY(-1px);
}

.resume-scroll-btn svg {
  width: 14px;
  height: 14px;
}

/* Video loading overlay */
.video-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  backdrop-filter: blur(2px);
}

.loading-content {
  text-align: center;
  color: var(--text-color);
  max-width: 300px;
  padding: 20px;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border-color);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

.loading-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-color);
}

.loading-content p {
  font-size: 0.875rem;
  opacity: 0.8;
  color: var(--secondary-text);
}

/* Disabled controls styling */
.vod-icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.vod-icon-btn:disabled:hover {
  background: none;
  color: var(--text-color);
}

.vod-progress:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.vod-volume-slider:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Disabled center play button */
.vod-center-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.vod-center-btn:disabled:hover {
  background: var(--icon-bg);
  color: var(--text-color);
}

/* Ensure retry buttons are always clickable */
#retry-btn, #retry-btn-timeout {
  z-index: 1000 !important;
  position: relative !important;
  pointer-events: auto !important;
}

/* Make sure video player doesn't interfere when hidden */
#video-player[style*="display: none"] {
  pointer-events: none !important;
  z-index: -1 !important;
}

.video-title-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  background: linear-gradient(180deg, 
    rgba(0, 0, 0, 0.8) 0%, 
    rgba(0, 0, 0, 0.6) 50%,
    rgba(0, 0, 0, 0.3) 80%,
    rgba(0, 0, 0, 0) 100%
  );
  padding: 20px 16px 40px 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.video-title-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.video-title-overlay h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-color);
  margin: 0;
  padding: 0;
  line-height: 1.3;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  word-wrap: break-word;
  overflow-wrap: break-word;
  text-align: left;
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
  .video-title-overlay {
    padding: 16px 12px 32px 12px;
  }
  
  .video-title-overlay h2 {
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  .video-title-overlay {
    padding: 12px 8px 24px 8px;
  }
  
  .video-title-overlay h2 {
    font-size: 1rem;
  }
}

.message-text {
  color: var(--text-color);
  user-select: text;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  cursor: text;
}

.chat-emote {
  height: 1.2em;
  width: auto;
  vertical-align: middle;
  margin: 0 1px;
  display: inline-block;
  border-radius: 2px;
  transition: transform 0.1s ease;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

.chat-emote:hover {
  transform: scale(1.1);
  filter: brightness(1.1);
}

/* Platform-specific emote styling */

.chat-emote[data-source="bttv"],
.chat-emote[data-source="bttv-channel"],
.chat-emote[data-source="bttv-shared"] {
  /* BTTV emotes might need slight adjustments */
  filter: contrast(1.05);
}

.chat-emote[data-source="ffz"],
.chat-emote[data-source="ffz-channel"] {
  /* FFZ emotes might need slight adjustments */
  filter: saturate(1.05);
}

.chat-emote[data-source="7tv"],
.chat-emote[data-source="7tv-channel"] {
  /* 7TV emotes might need slight adjustments */
  filter: brightness(1.02);
}

/* Zero-width emotes (like 7TV effects) */
.chat-emote[data-source*="7tv"] {
  position: relative;
}

/* Animated emotes */
.chat-emote[data-source*="animated"] {
  /* Add subtle animation for animated emotes */
  animation: emotePulse 2s ease-in-out infinite;
}

/* Specific styling for animated 7TV emotes (WebM files) */
.chat-emote[data-source="7tv"][data-animated="true"],
.chat-emote[data-source="7tv-channel"][data-animated="true"] {
  /* Ensure WebM files play properly */
  object-fit: contain;
  max-width: 100%;
  max-height: 100%;
  /* Remove the pulse animation for WebM files as they have their own animation */
  animation: none;
}

/* For static 7TV emotes, keep the subtle pulse */
.chat-emote[data-source="7tv"][data-animated="false"],
.chat-emote[data-source="7tv-channel"][data-animated="false"] {
  animation: emotePulse 2s ease-in-out infinite;
}

/* Ensure WebM files are properly sized and positioned */
.chat-emote[src*=".webm"] {
  object-fit: contain;
  max-width: 100%;
  max-height: 100%;
  /* WebM files should loop by default */
  animation: none;
}

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