/* JetBrains Mono */
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/JetBrainsMono-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/JetBrainsMono-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/JetBrainsMono-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/JetBrainsMono-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* Fira Code */
@font-face {
  font-family: 'Fira Code';
  src: url('/fonts/FiraCode-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Fira Code';
  src: url('/fonts/FiraCode-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Fira Code';
  src: url('/fonts/FiraCode-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Fira Code';
  src: url('/fonts/FiraCode-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

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

body {
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f0f23 100%);
  background-attachment: fixed;
  color: #e0e0e0;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100vh;
  padding: 16px;
  overflow: hidden;
  margin: 0;
}

#figlet-container {
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  margin-bottom: 12px;
}

#figlet-text {
  white-space: pre;
  font-size: 14px;
  line-height: 1.2;
  display: inline-block;
  transform-origin: top center;
  color: #50fa7b;
  text-shadow: 0 0 10px rgba(80, 250, 123, 0.5), 0 0 20px rgba(80, 250, 123, 0.3);
}

#subtitle {
  text-align: center;
  font-size: 16px;
  color: #50fa7b;
  margin-top: 4px;
  text-shadow: 0 0 8px rgba(80, 250, 123, 0.4);
  font-weight: 500;
}

h1 {
  display: none;
}

#active-channels {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  flex-shrink: 0;
  margin-bottom: 12px;
}

.channel-tag {
  display: inline-block;
  background: rgba(80, 250, 123, 0.1);
  border: 1px solid rgba(80, 250, 123, 0.3);
  padding: 4px 12px;
  font-size: 12px;
  color: #50fa7b;
  border-radius: 4px;
  backdrop-filter: blur(10px);
  transition: all 0.2s ease;
}

.channel-tag:hover {
  background: rgba(80, 250, 123, 0.2);
  border-color: rgba(80, 250, 123, 0.6);
}

#chat-container {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  width: 100%;
  flex: 1;
  min-height: 0;
  justify-content: center;
  overflow: hidden;
}

.chat-box {
  background: rgba(20, 20, 35, 0.7);
  border: 1px solid rgba(80, 250, 123, 0.3);
  border-radius: 12px;
  width: 700px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 400px;
  height: 100%;
  backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.chat-header {
  background: linear-gradient(90deg, rgba(80, 250, 123, 0.15) 0%, rgba(80, 250, 123, 0.05) 100%);
  border-bottom: 1px solid rgba(80, 250, 123, 0.3);
  color: #50fa7b;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  flex-shrink: 0;
  height: 44px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

#reload-btn {
  background: none;
  border: 1px solid rgba(80, 250, 123, 0.3);
  color: #50fa7b;
  font-size: 18px;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 4px;
  line-height: 1;
  transition: all 0.2s ease;
}

#reload-btn:hover {
  background: rgba(80, 250, 123, 0.15);
  border-color: rgba(80, 250, 123, 0.6);
}

.channel-name {
  text-transform: uppercase;
}

.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.5;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
  width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(80, 250, 123, 0.3);
  border-radius: 4px;
  transition: background 0.2s;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(80, 250, 123, 0.5);
}

.chat-message {
  margin-bottom: 2px;
  padding: 4px 8px;
  word-wrap: break-word;
  animation: fadeIn 0.15s ease-out;
  border-radius: 4px;
}

.chat-message:nth-child(odd) {
  background: rgba(255, 255, 255, 0.03);
}

.chat-message:nth-child(even) {
  background: rgba(80, 250, 123, 0.04);
}

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

.chat-message::before {
  content: '›';
  margin-right: 8px;
  color: #50fa7b;
  font-weight: bold;
  text-shadow: 0 0 5px rgba(80, 250, 123, 0.5);
}

.username {
  font-weight: 600;
  color: #f1fa8c;
}

.message {
  color: #f8f8f2;
}

.channel-indicator {
  color: #50fa7b;
  font-weight: 600;
  margin-right: 2px;
}

.chat-message.broadcaster .username {
  color: #ff5555;
  text-shadow: 0 0 8px rgba(255, 85, 85, 0.5);
}

.chat-message.moderator .username {
  color: #50fa7b;
  text-shadow: 0 0 8px rgba(80, 250, 123, 0.5);
}

.chat-message.vip .username {
  color: #ff79c6;
  text-shadow: 0 0 8px rgba(255, 121, 198, 0.5);
}

.chat-message.subscriber .username {
  color: #bd93f9;
  text-shadow: 0 0 8px rgba(189, 147, 249, 0.5);
}

.chat-message.founder .username {
  color: #f1fa8c;
  text-shadow: 0 0 8px rgba(241, 250, 140, 0.5);
}

/* Tablet */
@media screen and (max-width: 768px) {
  body {
    padding: 8px;
  }

  .chat-box {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    border-radius: 8px;
  }

  .chat-messages {
    padding: 8px 12px;
    font-size: 13px;
  }

  #figlet-text {
    font-size: 10px;
  }

  #subtitle {
    font-size: 14px;
  }

  .chat-header {
    padding: 10px 12px;
    font-size: 12px;
    height: 40px;
  }
}

/* Mobile */
@media screen and (max-width: 480px) {
  body {
    padding: 4px;
    height: 100dvh; /* dynamic viewport height for mobile browsers */
  }

  #figlet-container {
    margin-bottom: 6px;
  }

  #figlet-text {
    font-size: 7px;
    line-height: 1.1;
  }

  #subtitle {
    font-size: 12px;
    margin-top: 2px;
  }

  .chat-box {
    border-radius: 6px;
    min-width: 0;
  }

  .chat-header {
    padding: 8px 10px;
    font-size: 11px;
    height: 36px;
    letter-spacing: 1px;
  }

  .chat-messages {
    padding: 6px 8px;
    font-size: 12px;
    line-height: 1.4;
  }

  .chat-message {
    margin-bottom: 4px;
  }

  .chat-message::before {
    margin-right: 4px;
  }

  .channel-indicator {
    font-size: 11px;
  }

  .channel-indicator svg {
    width: 10px;
    height: 10px;
  }

  #active-channels {
    gap: 4px;
    margin-bottom: 6px;
  }

  .channel-tag {
    padding: 3px 8px;
    font-size: 10px;
  }

  #chat-container {
    gap: 8px;
  }
}

/* Very small screens */
@media screen and (max-width: 360px) {
  #figlet-container {
    display: none;
  }

  .chat-messages {
    font-size: 11px;
    padding: 4px 6px;
  }

  .chat-header {
    font-size: 10px;
    padding: 6px 8px;
    height: 32px;
  }
}
