.telehlam-body {
  padding: 0;
  gap: 0;
}

.telehlam-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  height: 100%;
  max-height: 100%;
  background: rgba(11, 20, 39, 0.9);
  overflow: hidden;
}

.telehlam-sidebar {
  border-right: 4px solid rgba(255, 255, 255, 0.05);
  background: rgba(8, 15, 31, 0.8);
  display: flex;
  flex-direction: column;
  padding: 1rem;
  gap: 0.8rem;
  overflow-y: auto;
}

.telehlam-chat-button {
  background: rgba(15, 26, 45, 0.7);
  border: 4px solid transparent;
  color: var(--text-color);
  font-family: inherit;
  font-size: 0.55rem;
  padding: 0.6rem 0.7rem;
  cursor: var(--cursor-pointer), pointer;
  text-align: left;
  transition: border 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.telehlam-chat-button:hover {
  background: rgba(20, 32, 55, 0.9);
}

.telehlam-chat-button.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(25, 40, 65, 0.9);
}

.telehlam-main {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  min-height: 0;
}

.telehlam-module-bar {
  display: flex;
  gap: 0.6rem;
  padding: 0.9rem 1.2rem 0.4rem;
  background: rgba(18, 30, 55, 0.9);
  border-bottom: 4px solid rgba(255, 255, 255, 0.05);
  flex-wrap: wrap;
  flex-shrink: 0;
}

.telehlam-chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1.2rem;
  gap: 1rem;
  overflow: hidden;
  min-height: 0;
  max-height: 100%;
}

.telehlam-chat-log {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding-right: 0.4rem;
  min-height: 0;
  max-height: 100%;
}

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

.telehlam-chat-log::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

.telehlam-chat-log::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 4px;
}

.telehlam-message {
  max-width: 82%;
  background: rgba(20, 34, 59, 0.85);
  border: 4px solid rgba(255, 255, 255, 0.08);
  padding: 0.6rem 0.7rem;
  line-height: 1.5;
  word-wrap: break-word;
  animation: messageAppear 0.3s ease;
}

@keyframes messageAppear {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.telehlam-message.player {
  margin-left: auto;
  background: rgba(45, 70, 105, 0.9);
  border-color: var(--accent);
  color: var(--accent);
}

.telehlam-input {
  display: flex;
  gap: 0.6rem;
  padding-top: 0.4rem;
  border-top: 4px solid rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}

.telehlam-input input {
  flex: 1;
  background: rgba(10, 20, 39, 0.75);
  border: 4px solid rgba(255, 255, 255, 0.08);
  color: var(--text-color);
  font-family: inherit;
  font-size: 0.55rem;
  padding: 0.6rem 0.7rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.telehlam-input input:focus {
  border-color: var(--accent);
}

.telehlam-input button {
  min-width: 100px;
  flex-shrink: 0;
}

#telehlam-window {
  width: clamp(320px, 60vw, 720px);
  height: clamp(360px, 70vh, 600px);
  max-height: 80vh;
}

#telehlam-window .window-body {
  padding: 0;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}

@media (min-width: 769px) and (max-width: 1024px) {
  .telehlam-layout {
    grid-template-columns: 180px 1fr;
  }

  .telehlam-sidebar {
    padding: 0.9rem;
  }

  .telehlam-chat-button {
    font-size: 0.6rem;
    padding: 0.55rem 0.65rem;
  }

  .telehlam-module-bar {
    padding: 0.8rem 1rem 0.4rem;
  }

  .telehlam-chat-panel {
    padding: 1rem;
  }
}

@media (max-width: 768px) {
  #telehlam-window {
    width: 100vw !important;
    height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
    top: env(safe-area-inset-top, 0px) !important;
    left: 0 !important;
    right: 0 !important;
    bottom: env(safe-area-inset-bottom, 0px) !important;
    transform: none;
    border-width: 0;
    border-top-width: 4px;
    border-bottom-width: 4px;
  }

  .telehlam-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .telehlam-sidebar {
    border-right: none;
    border-bottom: 4px solid rgba(255, 255, 255, 0.05);
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.6rem;
    gap: 0.5rem;
    flex-shrink: 0;
  }

  .telehlam-chat-button {
    font-size: 0.6rem;
    padding: 0.5rem 0.6rem;
    white-space: nowrap;
    min-width: fit-content;
    min-height: 40px;
  }

  .telehlam-main {
    min-height: 0;
  }

  .telehlam-module-bar {
    padding: 0.6rem 0.8rem 0.3rem;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .telehlam-chat-panel {
    padding: 0.8rem;
    gap: 0.8rem;
  }

  .telehlam-input {
    flex-direction: column;
    gap: 0.6rem;
  }

  .telehlam-input input {
    width: 100%;
    min-height: 44px;
    font-size: 0.7rem;
    padding: 0.6rem;
  }

  .telehlam-input button {
    width: 100%;
    min-height: 44px;
  }
}

@media (max-width: 480px) {
  .telehlam-sidebar {
    padding: 0.5rem;
    gap: 0.4rem;
  }

  .telehlam-chat-button {
    font-size: 0.45rem;
    padding: 0.45rem 0.55rem;
    min-height: 36px;
  }

  .telehlam-module-bar {
    padding: 0.5rem 0.6rem 0.3rem;
  }

  .telehlam-chat-panel {
    flex: 0.9;
    padding: 0.6rem;
    gap: 0.6rem;
  }
}