body {
    font-family: 'Roboto', sans-serif;
    background-color: #f0f2f5;
    color: #1c1e21;
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    box-sizing: border-box;
}

.container {
    width: 100%;
    max-width: 600px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* --- Setup Screen --- */
#setup-container {
    padding: 40px;
    text-align: center;
}

#setup-container h1 {
    font-size: 2em;
    color: #333;
    margin-bottom: 10px;
}

#setup-container p {
    color: #666;
    margin-bottom: 30px;
}

.input-group {
    display: flex;
    gap: 10px;
}

#youtuber-name-input {
    flex-grow: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
}

#youtuber-name-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

button {
    padding: 12px 20px;
    border: none;
    background-color: #007bff;
    color: white;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #0056b3;
}

/* --- Loading Screen --- */
#loading-container {
    padding: 60px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    text-align: center;
}

.loader {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #007bff;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1.5s linear infinite;
}

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

#loading-text {
    font-size: 1.2em;
    color: #555;
}

/* --- Chat Screen --- */
#chat-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    background-color: #f7f7f7;
    border-bottom: 1px solid #ddd;
}

#youtuber-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    background-color: #e0e0e0;
}

#chat-title {
    margin: 0;
    font-size: 1.2em;
    font-weight: 700;
}

#chat-messages {
    height: 400px;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 18px;
    line-height: 1.4;
    word-wrap: break-word;
}

.user-message {
    background-color: #007bff;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.ai-message {
    background-color: #e9e9eb;
    color: #1c1e21;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

#chat-form {
    display: flex;
    padding: 15px;
    border-top: 1px solid #ddd;
    gap: 10px;
}

#message-input {
    flex-grow: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 1em;
}

#message-input:focus {
    outline: none;
    border-color: #007bff;
}

#chat-form button {
    border-radius: 20px;
}

.hidden {
    display: none !important;
}


/* Typing Indicator */
#typing-indicator {
    padding: 5px 20px 10px;
}

.dot-flashing {
  position: relative;
  width: 10px;
  height: 10px;
  border-radius: 5px;
  background-color: #9880ff;
  color: #9880ff;
  animation: dotFlashing 1s infinite linear alternate;
  animation-delay: .5s;
}

.dot-flashing::before, .dot-flashing::after {
  content: '';
  display: inline-block;
  position: absolute;
  top: 0;
}

.dot-flashing::before {
  left: -15px;
  width: 10px;
  height: 10px;
  border-radius: 5px;
  background-color: #9880ff;
  color: #9880ff;
  animation: dotFlashing 1s infinite alternate;
  animation-delay: 0s;
}

.dot-flashing::after {
  left: 15px;
  width: 10px;
  height: 10px;
  border-radius: 5px;
  background-color: #9880ff;
  color: #9880ff;
  animation: dotFlashing 1s infinite alternate;
  animation-delay: 1s;
}

@keyframes dotFlashing {
  0% {
    background-color: #999;
  }
  50%,
  100% {
    background-color: #ccc;
  }
}

@media (max-width: 480px) {
    body {
        padding: 0;
        min-height: -webkit-fill-available; /* iOS Safari */
        height: 100vh;
    }
    .container {
        height: 100%;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }
    #chat-container {
        flex-grow: 1;
        display: flex;
        flex-direction: column;
    }
    #chat-messages {
        flex-grow: 1;
    }
}