#tutorai-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #10a37f;
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  font-size: 24px;
  z-index: 999998;
}

#tutorai-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 400px;
  height: 600px;
  max-height: 80vh;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 34px rgba(0,0,0,0.28);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  z-index: 999999;
  border: 1px solid #e5e5e5;
}

#tutorai-panel.open { display: flex; }

#tutorai-header {
  background: #ffffff;
  color: #202123;
  padding: 14px 16px;
  font-weight: 600;
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e5e5e5;
}

#tutorai-close {
  background: none;
  border: none;
  color: #6e6e80;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

#tutorai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  background: #ffffff;
}

.tutorai-row {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  align-items: flex-start;
}

.tutorai-row.bot { background: #f7f7f8; }

.tutorai-avatar {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

.tutorai-row.user .tutorai-avatar { background: #5b5b66; }
.tutorai-row.bot .tutorai-avatar { background: #10a37f; }

.tutorai-content {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  line-height: 1.55;
  color: #202123;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.tutorai-sources {
  font-size: 11px;
  color: #8e8ea0;
  margin-top: 6px;
}

.tutorai-code-block {
  margin: 10px 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #2d2d2d;
  background: #1e1e1e;
}

.tutorai-code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background: #2d2d2d;
  font-size: 12px;
  color: #c9c9c9;
}

.tutorai-code-lang {
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 11px;
  color: #9a9a9a;
}

.tutorai-copy-btn {
  background: transparent;
  border: 1px solid #4a4a4a;
  color: #d4d4d4;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 5px;
  cursor: pointer;
}
.tutorai-copy-btn:hover { background: #3a3a3a; }

.tutorai-code-block pre {
  margin: 0;
  padding: 12px;
  overflow-x: auto;
  background: #1e1e1e;
}

.tutorai-code-block code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.5;
  color: #e6e6e6;
  white-space: pre;
}

.tutorai-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.tutorai-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8e8ea0;
  animation: tutorai-bounce 1.2s infinite ease-in-out;
}
.tutorai-typing span:nth-child(2) { animation-delay: 0.15s; }
.tutorai-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes tutorai-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40% { transform: translateY(-4px); opacity: 1; }
}

#tutorai-inputbar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #e5e5e5;
  background: #fff;
}

#tutorai-input-wrap {
  flex: 1;
  display: flex;
  align-items: flex-end;
  border: 1px solid #d9d9e3;
  border-radius: 20px;
  padding: 6px 6px 6px 16px;
  background: #fff;
  transition: border-color 0.15s;
}

#tutorai-input-wrap.listening {
  border-color: #ef4444;
}

#tutorai-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 14px;
  padding: 8px 0;
  background: transparent;
  color: #202123;
  resize: none;
  overflow-y: auto;
  max-height: 140px;
  line-height: 1.4;
}

#tutorai-input:disabled {
  color: #ef4444;
}

#tutorai-input::placeholder { color: #8e8ea0; }

.tutorai-icon-btn {
  background: transparent;
  color: #6e6e80;
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tutorai-icon-btn:hover { background: #f0f0f2; }

#tutorai-mic.recording {
  color: #ef4444;
  animation: tutorai-pulse 1.2s infinite;
}

@keyframes tutorai-pulse {
  0% { box-shadow: 0 0 0 0 rgba(239,68,68,0.35); }
  70% { box-shadow: 0 0 0 9px rgba(239,68,68,0); }
  100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}

#tutorai-send {
  background: #10a37f;
  color: #fff;
}
#tutorai-send:hover { background: #0d8f6f; }
#tutorai-send:disabled {
  background: #d9d9e3;
  color: #fff;
  cursor: not-allowed;
}

#tutorai-listening-label {
  font-size: 12px;
  color: #ef4444;
  padding: 0 12px 8px;
  display: none;
  align-items: center;
  gap: 6px;
}
#tutorai-listening-label.show { display: flex; }

.tutorai-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ef4444;
  animation: tutorai-pulse 1.2s infinite;
}