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

body {
  font-family: sans-serif;
  background: #f5f5f5;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

#app {
  display: flex;
  flex-direction: column;
  width: 900px;
  height: 680px;
  border: 1px solid #ddd;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

/* Header */
#header {
  padding: 12px 16px;
  border-bottom: 1px solid #ddd;
  background: #f9f9f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#header-title {
  font-size: 16px;
  font-weight: 600;
}

.mode-tabs {
  display: flex;
  gap: 8px;
}

.tab {
  font-size: 13px;
  padding: 6px 14px;
  border: 1px solid #ccc;
  border-radius: 20px;
  cursor: pointer;
  background: transparent;
  color: #666;
  transition: all 0.2s;
}

.tab.active {
  background: #e8f0fe;
  color: #1a73e8;
  border-color: #1a73e8;
}

/* Main layout */
#main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Chat area */
#chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Messages */
#messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
}

.msg.user {
  align-self: flex-end;
  background: #e8f0fe;
  color: #1a73e8;
  border-radius: 12px 12px 4px 12px;
}

.msg.ai {
  align-self: flex-start;
  background: #f1f3f4;
  color: #202124;
  border: 1px solid #e0e0e0;
  border-radius: 12px 12px 12px 4px;
}

.msg.ai img {
  max-width: 100%;
  border-radius: 8px;
  margin-top: 8px;
  display: block;
}

.msg-label {
  font-size: 11px;
  color: #888;
  margin-bottom: 4px;
  font-weight: 600;
  text-transform: uppercase;
}

/* Mode hint */
#mode-hint {
  font-size: 12px;
  color: #888;
  padding: 4px 16px;
  border-top: 1px solid #f0f0f0;
}

/* Input area */
#input-area {
  padding: 12px 16px;
  border-top: 1px solid #ddd;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

#user-input {
  flex: 1;
  resize: none;
  font-size: 14px;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  min-height: 40px;
  max-height: 100px;
  font-family: sans-serif;
  outline: none;
}

#user-input:focus {
  border-color: #1a73e8;
}

#send-btn {
  padding: 8px 20px;
  font-size: 14px;
  border-radius: 8px;
  background: #1a73e8;
  color: white;
  border: none;
  cursor: pointer;
  height: 40px;
  font-weight: 600;
}

#send-btn:hover {
  background: #1558b0;
}

#send-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* Typing animation */
.typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 4px 0;
}

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

.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* History panel */
#history-panel {
  width: 190px;
  border-left: 1px solid #ddd;
  overflow-y: auto;
  background: #fafafa;
  padding: 12px;
}

#history-title {
  font-size: 12px;
  font-weight: 600;
  color: #888;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.history-item {
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 8px;
  color: #555;
  cursor: pointer;
  border: 1px solid transparent;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item:hover {
  background: #fff;
  border-color: #ddd;
}

.hi-type {
  font-size: 10px;
  color: #aaa;
  margin-bottom: 2px;
}