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

:root {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-tertiary: #0f3460;
  --accent: #e94560;
  --accent-hover: #c93a52;
  --text-primary: #eee;
  --text-secondary: #aaa;
  --border: #2d3561;
  --success: #4ecca3;
  --shadow: rgba(0, 0, 0, 0.3);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.header {
  background: var(--bg-secondary);
  padding: 1.5rem 2rem;
  box-shadow: 0 2px 10px var(--shadow);
  border-bottom: 2px solid var(--accent);
}

.header h1 {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent) 0%, var(--success) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.connection-status {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--success);
  color: var(--bg-primary);
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-left: 1rem;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.container {
  display: flex;
  flex-direction: column;
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem;
  gap: 1.5rem;
  overflow: hidden;
}

.username-section {
  background: var(--bg-secondary);
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 4px 6px var(--shadow);
  border: 1px solid var(--border);
}

.username-section label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.username-section input {
  width: 100%;
  padding: 0.75rem;
  background: var(--bg-primary);
  border: 2px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.3s ease;
}

.username-section input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.1);
}

.chat-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  background: var(--bg-secondary);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 16px var(--shadow);
  border: 1px solid var(--border);
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scroll-behavior: smooth;
}

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

.messages::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

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

.message {
  background: var(--bg-tertiary);
  padding: 1rem;
  border-radius: 8px;
  border-left: 3px solid var(--accent);
  animation: slideIn 0.3s ease;
  box-shadow: 0 2px 4px var(--shadow);
}

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

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.message-username {
  font-weight: 700;
  color: var(--success);
  font-size: 0.9rem;
}

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

.message-content {
  color: var(--text-primary);
  line-height: 1.5;
  word-wrap: break-word;
}

.input-area {
  padding: 1.5rem;
  background: var(--bg-primary);
  border-top: 1px solid var(--border);
}

.input-area {
  display: flex;
  gap: 1rem;
}

.input-area input {
  flex: 1;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.3s ease;
}

.input-area input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.1);
}

.input-area button {
  padding: 0.75rem 2rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px var(--shadow);
}

.input-area button:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px var(--shadow);
}

.input-area button:active {
  transform: translateY(0);
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
}

@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }

  .header {
    padding: 1rem;
  }

  .header h1 {
    font-size: 1.5rem;
  }

  .input-area {
    flex-direction: column;
  }

  .input-area button {
    width: 100%;
  }
}

