* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  background: #0f0f0f;
  color: #fff;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  overflow: hidden;
}

.app {
  width: 100vw;
  height: 100vh;
  display: flex;
  background: #111;
}

.sidebar {
  width: 310px;
  min-width: 260px;
  max-width: 380px;
  height: 100%;
  background: #080808;
  border-right: 1px solid #252525;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex-shrink: 0;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  color: #33ff00;
  font-weight: 900;
  font-size: 20px;
  letter-spacing: 0.02em;
}

.icon-btn {
  border: 1px solid #333;
  background: #181818;
  color: #fff;
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.new-chat {
  width: 100%;
  border: 1px solid #33ff00;
  background: #33ff00;
  color: #111;
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
}

.history-label {
  color: #aaa;
  font-size: 12px;
  margin-top: 4px;
}

.conversation-list {
  overflow-y: auto;
  flex: 1;
}

.conversation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 10px;
  border-radius: 10px;
  cursor: pointer;
  color: #ddd;
  margin-bottom: 5px;
}

.conversation:hover,
.conversation.active {
  background: #1e1e1e;
}

.conversation-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
}

.delete-conv {
  border: 0;
  background: transparent;
  color: #777;
  cursor: pointer;
  font-size: 17px;
  padding: 4px;
  flex-shrink: 0;
}

.delete-conv:hover {
  color: #ff6868;
}

.main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.header {
  min-height: 72px;
  border-bottom: 1px solid #252525;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.header-title {
  font-weight: 900;
  font-size: 21px;
}

.header-subtitle {
  color: #aaa;
  font-size: 13px;
  margin-top: 3px;
}

.chat {
  flex: 1;
  overflow-y: auto;
  padding: 28px 24px;
  position: relative;
}

.empty {
  max-width: 720px;
  margin: 16vh auto 0;
  text-align: center;
}

.empty h1 {
  font-size: clamp(34px, 5vw, 52px);
  margin: 0;
  line-height: 1.2;
}

.messages {
  max-width: 920px;
  margin: 0 auto;
}

.message {
  display: flex;
  gap: 12px;
  margin-bottom: 22px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #2a2a2a;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 900;
}

.message.assistant .avatar {
  background: #33ff00;
  color: #111;
}

.bubble {
  flex: 1;
  min-width: 0;
  background: #181818;
  border: 1px solid #2a2a2a;
  border-radius: 15px;
  padding: 15px 17px;
  line-height: 1.8;
  overflow-wrap: anywhere;
  font-size: 15.5px;
}

.message.user .bubble {
  background: #202020;
}

.bubble p {
  margin: 0 0 10px;
}

.bubble p:last-child {
  margin-bottom: 0;
}

.bubble ul {
  margin: 8px 0 8px 20px;
  padding: 0;
}

.bubble code {
  background: #0b0b0b;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 1px 4px;
}

.bubble pre {
  background: #0b0b0b;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 12px;
  overflow-x: auto;
}

.input-bar {
  border-top: 1px solid #252525;
  padding: 16px 22px;
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-shrink: 0;
}

textarea {
  flex: 1;
  resize: none;
  min-height: 52px;
  max-height: 180px;
  background: #181818;
  color: #fff;
  border: 1px solid #333;
  border-radius: 14px;
  padding: 14px 15px;
  font-size: 16px;
  line-height: 1.55;
  outline: none;
}

textarea:focus {
  border-color: #33ff00;
}

#sendBtn {
  width: 104px;
  min-height: 52px;
  border: 0;
  border-radius: 14px;
  background: #33ff00;
  color: #111;
  font-weight: 900;
  cursor: pointer;
  font-size: 15px;
  flex-shrink: 0;
}

#sendBtn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.muted {
  color: #888;
  font-size: 14px;
  padding: 8px 4px;
}

.mobile-only {
  display: none;
}

@media (max-width: 768px) {
  .app {
    position: relative;
  }

  .sidebar {
    position: absolute;
    z-index: 20;
    left: -88vw;
    top: 0;
    width: 86vw;
    min-width: 0;
    max-width: 360px;
    box-shadow: 12px 0 32px rgba(0, 0, 0, 0.42);
    transition: left 0.2s ease;
  }

  .sidebar.open {
    left: 0;
  }

  .mobile-only {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .header {
    min-height: 64px;
    padding: 10px 12px;
  }

  .header-title {
    font-size: 18px;
  }

  .header-subtitle {
    font-size: 11.5px;
  }

  .chat {
    padding: 16px 12px;
  }

  .empty {
    margin-top: 18vh;
  }

  .empty h1 {
    font-size: 34px;
  }

  .message {
    gap: 8px;
    margin-bottom: 16px;
  }

  .avatar {
    width: 30px;
    height: 30px;
    font-size: 10px;
  }

  .bubble {
    padding: 12px;
    font-size: 14.5px;
  }

  .input-bar {
    padding: 10px;
    gap: 8px;
  }

  textarea {
    min-height: 48px;
    padding: 12px;
    font-size: 15px;
  }

  #sendBtn {
    width: 72px;
    min-height: 48px;
  }
}
