.topbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 30;
  flex-shrink: 0;
  height: 52px;
  min-height: 52px;
  background: var(--bg-primary);
  border-bottom: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  pointer-events: auto;
}

.topbar-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
}

.topbar-btn i {
  font-size: 22px;
  color: var(--text-primary);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-logo {
  width: 16px;
  height: 16px;
  border-radius: 3px;
}

.topbar-title {
  font-weight: 600;
}

.chat-main {
  flex: 1;
  margin-top: 52px;
  padding: 16px 12px 120px;
  overflow-y: auto;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

.pinned-strip {
  margin-top: 0;
  background: #fffbf0;
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

[data-theme="dark"] .pinned-strip {
  background: #2a2620;
}

.pinned-strip i {
  color: var(--claude-orange);
  margin-top: 2px;
}

.pinned-strip p {
  margin: 0;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pinned-close {
  min-height: 24px;
  min-width: 24px;
  color: var(--text-secondary);
}

.chat-empty-state {
  min-height: calc(100dvh - 200px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
}

.empty-greeting {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
}

.empty-subtitle {
  margin: 0;
  color: var(--text-secondary);
}

.suggestions-row {
  width: 100%;
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding-bottom: 4px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.suggestions-row::-webkit-scrollbar {
  display: none;
}

.suggestion-card {
  min-height: 88px;
  min-width: 180px;
  max-width: 260px;
  flex-shrink: 0;
  text-align: left;
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 14px;
  background: var(--bg-primary);
  scroll-snap-align: start;
}

.suggestion-card:hover {
  transform: translateY(-1px);
  background: var(--hover-bg);
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 12px;
}

.message-row {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.message-row.user {
  display: flex;
  justify-content: flex-start;
}

.user-bubble {
  width: fit-content;
  max-width: 88%;
  margin-left: 0;
  padding: 12px 16px;
  border-radius: 18px;
  background: var(--user-bubble);
  line-height: 1.5;
  font-size: 15px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message-row.assistant {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.assistant-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.assistant-content {
  width: 100%;
  max-width: 100%;
  line-height: 1.6;
  font-size: 15px;
}

.assistant-content p {
  margin: 0 0 12px;
}

.assistant-content h1 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
}

.assistant-content h2 {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
}

.assistant-content h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}

.assistant-content ul,
.assistant-content ol {
  margin: 0 0 12px 18px;
  padding: 0;
}

.assistant-content code {
  background: #141414;
  color: #f2f2f2;
  padding: 2px 7px;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.code-wrap {
  position: relative;
  margin: 12px 0;
}

.assistant-content pre {
  margin: 0;
  background: #141414;
  color: #f2f2f2;
  border-radius: 10px;
  padding: 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  font-size: 13px;
}

.copy-code-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  min-height: 32px;
  min-width: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #f2f2f2;
  font-size: 12px;
}

.code-wrap .copy-code-btn {
  position: static;
}

.message-actions {
  display: flex;
  gap: 12px;
  color: var(--text-secondary);
}

.message-actions button {
  min-height: 44px;
  min-width: 44px;
  font-size: 14px;
  color: inherit;
}

.message-actions button:active {
  transform: scale(0.94);
}

.message-actions button.active-like {
  color: var(--claude-orange);
}

.message-actions button.active-dislike {
  color: #4e4e4e;
}

.message-actions button.active-pin {
  color: var(--claude-orange);
}

.message-actions i {
  font-size: 14px;
}

.message-timestamp {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1;
}

.user-timestamp {
  align-self: flex-start;
}

.assistant-timestamp {
  margin-left: 28px;
}

.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.typing-indicator span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-secondary);
  animation: bounce 0.9s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.3s;
}

.chat-watermark {
  display: none;
}

@keyframes bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

@media (min-width: 768px) {
  .chat-main {
    padding-left: 24px;
    padding-right: 24px;
  }

  .empty-greeting {
    font-size: 38px;
  }
}

@media (min-width: 1024px) {
  .topbar {
    display: none;
  }

  .pinned-strip {
    margin-top: 0;
  }

  .chat-main {
    margin-top: 0;
    padding: 24px 48px 120px;
  }

  .suggestions-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    max-width: 760px;
    overflow: visible;
  }

  .suggestion-card {
    max-width: none;
    min-width: 0;
  }

  .message-row.user {
    justify-content: flex-end;
  }

  .user-bubble {
    max-width: 70%;
    margin-left: auto;
    font-size: 16px;
  }

  .assistant-content {
    max-width: 75%;
    font-size: 16px;
  }

  .message-actions {
    opacity: 0;
    transition: opacity 0.2s ease;
  }

  .message-row.assistant:hover .message-actions {
    opacity: 1;
  }

  .user-timestamp {
    align-self: flex-end;
    margin-right: 8px;
  }

  .chat-watermark {
    display: block;
    position: fixed;
    right: 16px;
    bottom: 12px;
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.4;
    pointer-events: none;
    z-index: 5;
  }
}

@media (max-width: 1023px) {
  .main-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .chat-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    margin-top: 52px;
    padding: 0 16px 88px;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .chat-empty-state {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    gap: 8px;
    min-height: auto;
    text-align: center;
  }

  .chat-empty-state .empty-logo {
    width: 36px;
    height: 36px;
    margin-bottom: 4px;
    flex-shrink: 0;
  }

  .chat-empty-state .empty-greeting {
    font-size: 22px;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    margin: 0;
  }

  .chat-empty-state .empty-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
    text-align: center;
    line-height: 1.4;
  }

  .chat-empty-state .suggestions-row {
    margin-top: 16px;
  }

  .suggestions-row {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    gap: 8px;
    padding: 0 16px 4px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    align-self: stretch;
    scroll-snap-type: none;
  }

  .suggestions-row::-webkit-scrollbar {
    display: none;
  }

  .suggestion-card {
    min-width: 160px;
    max-width: 200px;
    min-height: auto;
    flex-shrink: 0;
    padding: 12px;
    font-size: 13px;
    line-height: 1.4;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-primary);
    cursor: pointer;
    white-space: normal;
    overflow-wrap: break-word;
    word-wrap: break-word;
    text-align: left;
  }

  .chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }

  .user-bubble {
    max-width: 88%;
  }

  .assistant-content {
    max-width: 100%;
  }

  .message-actions {
    opacity: 1;
    gap: 16px;
  }
}
