:root {
  --primary-blue: #3b82f6;
  --primary-blue-dark: #2563eb;
  --primary-blue-light: #60a5fa;
  --secondary-blue: #1e40af;
  --accent-blue: #1d4ed8;
  --bg-dark: #1a1a1a;
  --bg-card: #2a2a2a;
  --bg-card-hover: #353535;
  --text-primary: #ffffff;
  --text-secondary: #d0d0d0;
  --text-muted: #909090;
  --border-color: rgba(59, 130, 246, 0.2);
  --shadow-blue: rgba(59, 130, 246, 0.3);
  --shadow-dark: rgba(0, 0, 0, 0.5);
  
  --global-scale: 1;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, var(--bg-dark) 0%, #1f1f1f 50%, #1a1a1a 100%);
  color: var(--text-primary);
  min-height: 100vh;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

.top-nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(26, 26, 26, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 4px 20px var(--shadow-dark), 0 0 1px rgba(59, 130, 246, 0.1);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 700;
  transition: all 0.3s ease;
}

.nav-brand:hover {
  color: var(--primary-blue-light);
  transform: translateY(-1px);
}

.nav-brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
  list-style: none;
  flex: 1;
  justify-content: center;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  position: relative;
  padding: 0.5rem 0;
}

.nav-links a:hover {
  color: var(--primary-blue-light);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary-blue);
  transition: width 0.3s ease;
}

.nav-links a:hover::after {
  width: 100%;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-button {
  padding: 0.5rem 1.25rem;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
}

.nav-button-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.nav-button-secondary:hover {
  background: var(--bg-card);
  border-color: var(--primary-blue);
  color: var(--primary-blue-light);
}

.nav-button-primary {
  background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
  color: var(--text-primary);
  box-shadow: 0 4px 15px var(--shadow-blue);
}

.nav-button-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--shadow-blue);
}

.mobile-menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.2rem;
}

.main-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.stream-section {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.chat-sidebar {
  width: 380px;
  min-width: 380px;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px var(--shadow-dark), 0 0 0 1px rgba(59, 130, 246, 0.1);
  overflow: hidden;
  position: relative;
  min-height: 0;
  align-self: flex-start;
}

.chat-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  background: rgba(59, 130, 246, 0.08);
}

.chat-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-title::before {
  content: '💬';
  font-size: 1.2rem;
}


.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-messages::-webkit-scrollbar {
  width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
  background: var(--bg-dark);
  border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--primary-blue);
  border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--primary-blue-dark);
}

.chat-message {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem;
  background: rgba(59, 130, 246, 0.05);
  border-radius: 8px;
  border-left: 3px solid var(--primary-blue);
  animation: slideIn 0.3s ease;
  transition: all 0.2s ease;
}

.chat-message:hover {
  background: rgba(59, 130, 246, 0.1);
  transform: translateX(4px);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-username {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--primary-blue-light);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-username::before {
  content: '👤';
  font-size: 0.85rem;
}

.chat-text {
  color: var(--text-primary);
  font-size: 0.9rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.chat-timestamp {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  text-align: center;
  padding: 2rem;
  gap: 0.5rem;
}

.chat-empty-icon {
  font-size: 3rem;
  opacity: 0.5;
}

.chat-verification-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(26, 26, 26, 0.95);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  z-index: 100;
  gap: 1.5rem;
}

.chat-verification-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.chat-verification-icon svg {
  width: 100%;
  height: 100%;
}

.chat-verification-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
}

.chat-verification-message {
  font-size: 1rem;
  color: var(--text-secondary);
  text-align: center;
  max-width: 300px;
  line-height: 1.6;
}

.chat-verify-button {
  background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
  color: white;
  border: none;
  padding: 1rem 2.5rem;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px var(--shadow-blue);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chat-verify-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px var(--shadow-blue);
}

.chat-verify-button:active {
  transform: translateY(0);
}

.chat-messages-locked {
  filter: blur(3px);
  opacity: 0.4;
  pointer-events: none;
  user-select: none;
}

.chat-status {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border-color);
  background: rgba(59, 130, 246, 0.05);
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-status-dot {
  width: 8px;
  height: 8px;
  background: var(--primary-blue);
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
}

.stream-header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.stream-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.stream-meta {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.stream-info-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.4), 0 0 8px rgba(239, 68, 68, 0.2);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

.live-dot {
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
  animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.7; }
}

.thumbnail-container {
  position: relative;
  display: inline-block;
  cursor: pointer;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--border-color);
  box-shadow: 0 8px 32px var(--shadow-dark), 0 0 0 1px rgba(59, 130, 246, 0.15);
  transform-origin: center center;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--bg-card);
  width: 100%;
  max-width: 100%;
}

.stream {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  gap: 1rem;
}

.thumbnail-container img.thumb {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.thumbnail-container .thumb.hidden {
  visibility: hidden;
  opacity: 0;
}

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-dark), var(--bg-card));
  z-index: 30;
  color: #fff;
}

.loading-overlay .black-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--bg-dark);
}

.loading-overlay .spinner {
  position: relative;
  z-index: 40;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 6px solid rgba(59, 130, 246, 0.2);
  border-top-color: var(--primary-blue);
  border-right-color: var(--primary-blue-light);
  animation: spin 1s linear infinite;
  box-shadow: 0 0 20px var(--shadow-blue);
}

@keyframes spin { to { transform: rotate(360deg); } }

.thumbnail-container.loading-active .loading-overlay { display: flex; }
.thumbnail-container.loading-active .player { display: none; }

.player {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 120px;
  height: 120px;
  filter: brightness(0) invert(1);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0.95;
  z-index: 20;
}

.player::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.3) 0%, transparent 70%);
  border-radius: 50%;
  z-index: -1;
  transition: all 0.4s ease;
}

.viewer-count {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(26, 26, 26, 0.85);
  backdrop-filter: blur(10px);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: 0 4px 15px var(--shadow-dark), 0 0 0 1px rgba(59, 130, 246, 0.2);
  border: 1px solid var(--border-color);
}

.viewer-count #watchers {
  font-variant-numeric: tabular-nums;
  font-size: 1.1em;
  color: var(--primary-blue-light);
  font-weight: 700;
  display: inline-block;
}

.odometer-container {
  display: inline-block;
  position: relative;
  overflow: hidden;
  vertical-align: bottom;
}

.odometer-digit {
  display: inline-block;
  position: relative;
  overflow: hidden;
  vertical-align: bottom;
}

.odometer-roll {
  display: inline-block;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: center;
}

.odometer-roll.odometer-animating-up {
  animation: odometerRollUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.odometer-roll.odometer-animating-down {
  animation: odometerRollDown 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes odometerRollUp {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-100%);
  }
}

@keyframes odometerRollDown {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(100%);
  }
}

.odometer-digit-wrapper {
  display: inline-block;
  position: relative;
  overflow: hidden;
  height: 1.2em;
  line-height: 1.2em;
  vertical-align: bottom;
}

.odometer-digit-strip {
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.odometer-digit-item {
  height: 1.2em;
  line-height: 1.2em;
  display: block;
  text-align: center;
}

.odometer-digit-strip.odometer-animating-up {
  animation: odometerDigitRollUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.odometer-digit-strip.odometer-animating-down {
  animation: odometerDigitRollDown 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes odometerDigitRollUp {
  0% {
    transform: translateY(var(--start-pos, 0));
  }
  100% {
    transform: translateY(calc(var(--start-pos, 0) - 100%));
  }
}

@keyframes odometerDigitRollDown {
  0% {
    transform: translateY(var(--start-pos, 0));
  }
  100% {
    transform: translateY(calc(var(--start-pos, 0) + 100%));
  }
}

.odometer-digit-static {
  display: inline-block;
}

.odometer-comma {
  display: inline-block;
}
  
@media (max-width: 1200px) {
  .main-container {
    flex-direction: column;
  }
  
  .chat-sidebar {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 768px) {
  .top-nav {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
  }
  
  .nav-brand {
    font-size: 1.25rem;
  }
  
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(26, 26, 26, 0.98);
    backdrop-filter: blur(20px);
    flex-direction: column;
    padding: 1rem;
    gap: 1rem;
    border-top: 1px solid var(--border-color);
  }
  
  .nav-links.active {
    display: flex;
  }
  
  .mobile-menu-toggle {
    display: block;
  }
  
  .nav-actions {
    gap: 0.5rem;
  }
  
  .nav-button {
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
  }
  
  .main-container {
    padding: 1.5rem 1rem;
    flex-direction: column;
  }
  
  .stream-title {
    font-size: 1.5rem;
  }
  
  .stream-meta {
    gap: 1rem;
  }
}

@media (max-width: 480px) {
  .nav-brand {
    font-size: 1.1rem;
  }
  
  .nav-brand-icon {
    width: 28px;
    height: 28px;
  }
  
  .stream-title {
    font-size: 1.25rem;
  }
  
  .player {
    width: 80px;
    height: 80px;
  }
  
  .player::before {
    width: 100px;
    height: 100px;
  }
}

.signin-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.signin-modal.active {
  display: flex;
}

.signin-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
}

.signin-modal-content {
  position: relative;
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--border-color);
  box-shadow: 0 20px 60px var(--shadow-dark), 0 0 40px var(--shadow-blue);
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlideIn 0.3s ease;
  z-index: 1;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.signin-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 2rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.3s ease;
  z-index: 10;
}

.signin-modal-close:hover {
  background: rgba(59, 130, 246, 0.1);
  color: var(--primary-blue-light);
  transform: rotate(90deg);
}

.signin-modal-header {
  padding: 2.5rem 2rem 1.5rem;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
}

.signin-modal-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.signin-modal-header p {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.signin-form {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.signin-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.signin-form-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.signin-form-group input {
  padding: 0.875rem 1rem;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.3s ease;
  font-family: inherit;
}

.signin-form-group input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.signin-form-group input::placeholder {
  color: var(--text-muted);
}

.signin-form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
}

.signin-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: var(--text-secondary);
}

.signin-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary-blue);
}

.signin-forgot-link {
  color: var(--primary-blue-light);
  text-decoration: none;
  transition: color 0.3s ease;
}

.signin-forgot-link:hover {
  color: var(--primary-blue);
  text-decoration: underline;
}

.signin-submit-button {
  padding: 1rem;
  background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px var(--shadow-blue);
  margin-top: 0.5rem;
}

.signin-submit-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--shadow-blue);
}

.signin-submit-button:active {
  transform: translateY(0);
}

.signin-form-footer {
  text-align: center;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.signin-form-footer p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.signin-signup-link {
  color: var(--primary-blue-light);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s ease;
}

.signin-signup-link:hover {
  color: var(--primary-blue);
  text-decoration: underline;
}

@media (max-width: 480px) {
  .signin-modal-content {
    max-width: 100%;
    border-radius: 12px 12px 0 0;
    max-height: 85vh;
  }

  .signin-modal-header {
    padding: 2rem 1.5rem 1rem;
  }

  .signin-modal-header h2 {
    font-size: 1.5rem;
  }

  .signin-form {
    padding: 1.5rem;
  }
}
