* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: #ffffff;
  color: #111;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#app {
  max-width: 960px;
  margin: 24px auto;
  padding: 16px;
  display: grid;
  grid-template-columns: 1.1fr 2fr;
  gap: 24px;
}

.wojak-panel {
  text-align: center;
}

.wojak-panel h1 {
  margin: 0;
  font-size: 2rem;
}

.subtitle {
  margin: 4px 0 16px;
  font-size: 0.9rem;
  color: #666;
}

.wojak-avatar-wrapper {
  border: 2px solid #000;
  border-radius: 16px;
  padding: 12px;
  background: #f9f9f9;
}

#wojak-img {
  width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: contain;
}

.wojak-talking {
  animation: wojakTalk 0.2s infinite alternate;
}

@keyframes wojakTalk {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-4px);
  }
}

.chat-panel {
  border: 2px solid #000;
  border-radius: 16px;
  padding: 16px;
  background: #fdfdfd;
  display: flex;
  flex-direction: column;
  height: 80vh;
  max-height: 640px;
}

#messages {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

.message {
  margin-bottom: 10px;
  display: flex;
}

.message.user {
  justify-content: flex-end;
}

.message.wojak {
  justify-content: flex-start;
}

.bubble {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.95rem;
  line-height: 1.4;
  border: 1px solid #111;
}

.message.user .bubble {
  background: #111;
  color: #fff;
  border-color: #111;
}

.message.wojak .bubble {
  background: #f0f0f0;
}

#chat-form {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

#user-input {
  flex: 1;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid #000;
  font-size: 1rem;
}

#user-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px #000;
}

#chat-form button {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid #000;
  background: #000;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

#chat-form button:disabled {
  opacity: 0.6;
  cursor: default;
}

#typing-indicator {
  font-size: 0.8rem;
  color: #666;
  margin-top: 4px;
}

.hidden {
  display: none;
}

.follow-x-btn {
  position: fixed;
  right: 20px;
  bottom: 20px;
  padding: 10px 18px;
  background: #000;
  color: #fff;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  font-size: 0.9rem;
  border: 2px solid #000;
  transition: transform 0.15s ease;
  z-index: 9999;
}

.follow-x-btn:hover {
  transform: scale(1.05);
}

.desktop-text {
  display: inline;
}
.mobile-text {
  display: none;
}

@media (max-width: 900px) {
  #app {
    grid-template-columns: 1fr;
    max-width: 100%;
  }

  .chat-panel {
    height: 70vh;
    max-height: none;
  }
}

@media (max-width: 600px) {

  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  #app {
    max-width: 100%;
    margin: 0 auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100vh;
  }

  .wojak-panel {
    flex: 0 0 auto;
  }

  .wojak-panel h1 {
    font-size: 1.6rem;
    margin-top: 4px;
  }

  .subtitle {
    font-size: 0.8rem;
    margin-bottom: 8px;
  }

  .wojak-avatar-wrapper {
    padding: 6px;
    border-radius: 12px;
  }

  #wojak-img {
    max-height: 140px;
    width: auto;
  }

  .chat-panel {
    flex: 1 1 0;
    height: auto;
    max-height: none;
    padding: 10px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  #messages {
    flex: 1 1 0;
    overflow-y: auto;
    font-size: 0.9rem;
    padding-right: 4px;
  }

  .bubble {
    font-size: 0.9rem;
    padding: 7px 10px;
  }

  #chat-form {
    margin-top: 8px;
    gap: 6px;
    flex-shrink: 0;
  }

  #user-input {
    padding: 7px 10px;
    font-size: 0.9rem;
  }

  #chat-form button {
    padding: 7px 14px;
    font-size: 0.9rem;
  }

  @keyframes wojakTalk {
    from { transform: translateY(0); }
    to   { transform: translateY(-2px); }
  }

  .follow-x-btn {
    right: 10px;
    top: 10px;
    bottom: auto;
    padding: 8px 14px;
    font-size: 0.8rem;
  }

  .desktop-text {
    display: none;
  }
  .mobile-text {
    display: inline;
  }
}