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

body {
  font-family: 'Microsoft YaHei', sans-serif;
  background-color: #f0f2f5;
  min-height: 100vh;
  overflow: hidden;
}

.app {
  display: flex;
  height: calc(100vh - 80px);
  gap: 0;
  padding: 0;
  max-width: 100%;
  margin: 0 auto;
}

/* ========== 头部 ========== */
.header {
  text-align: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #5a6fd6;
}

.header h1 {
  font-size: 20px;
  color: #333;
  margin-bottom: 8px;
}

.subtitle {
  font-size: 14px;
  color: #888;
}

/* ========== 编辑面板 ========== */
.editor-panel {
  flex: 3;
  overflow-y: auto;
  padding: 20px;
  background: white;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
}

/* ========== 预览面板 ========== */
.preview-panel {
  flex: 2;
  height: calc(100vh - 80px);
  background: #fffef5;
  overflow: hidden;
  padding: 20px;
}

#previewContainer {
  width: 100%;
  height: 100%;
  background: #fffef5;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#previewContainer iframe {
  width: 100%;
  height: 100%;
  border: none;
  overflow: auto;
  background: #fffef5;
  border-radius: 8px;
}

/* ========== 工具栏 ========== */
.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.fetch-group {
  display: flex;
  gap: 4px;
  align-items: center;
}

.fetch-group input {
  width: 110px;
  padding: 6px 10px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  font-size: 13px;
}

/* ========== 按钮统一样式 ========== */
.toolbar button,
.comments-header button,
.comment-row button,
.default-commenter button {
  padding: 6px 14px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
  font-family: 'Microsoft YaHei', sans-serif;
  white-space: nowrap;
}

.toolbar button:disabled,
.comments-header button:disabled,
.comment-row button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 工具栏按钮颜色 */
#fetchBtn {
  background: #5a6fd6;
  color: white;
}

#fetchBtn:hover:not(:disabled) {
  background: #4a5fc6;
}

#batchAddBtn {
  background: #52c41a;
  color: white;
}

#batchAddBtn:hover:not(:disabled) {
  background: #45a518;
}

#loadJsonBtn,
#saveJsonBtn {
  background: #5a6fd6;
  color: white;
}

#loadJsonBtn:hover:not(:disabled),
#saveJsonBtn:hover:not(:disabled) {
  background: #4a5fc6;
}

#clearAllBtn {
  background: #e06060;
  color: white;
}

#clearAllBtn:hover:not(:disabled) {
  background: #cc4a4a;
}

/* ========== 默认评论者设置栏 ========== */
.default-commenter-bar {
  margin-bottom: 16px;
  padding: 12px 14px;
  background: #fafafa;
  border: 1px solid #e8e8e8;
  border-radius: 6px;
}

.default-commenter {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.dc-label {
  font-size: 13px;
  color: #555;
  font-weight: bold;
  white-space: nowrap;
}

.dc-name {
  flex: 1;
  min-width: 100px;
  padding: 5px 10px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  font-size: 13px;
  background: white;
}

.dc-name:focus {
  outline: none;
  border-color: #5a6fd6;
  box-shadow: 0 0 0 2px rgba(90, 111, 214, 0.1);
}

.dc-qq {
  width: 90px;
  padding: 5px 10px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  font-size: 13px;
  background: white;
}

.dc-qq:focus {
  outline: none;
  border-color: #5a6fd6;
  box-shadow: 0 0 0 2px rgba(90, 111, 214, 0.1);
}

.dc-avatar-status {
  font-size: 11px;
  color: #999;
  min-width: 100px;
  white-space: nowrap;
}

.dc-fetch-qq-avatar {
  background: #5a6fd6;
  color: white;
}

.dc-fetch-qq-avatar:hover {
  background: #4a5fc6;
}

.dc-clear {
  background: #e06060;
  color: white;
}

.dc-clear:hover {
  background: #cc4a4a;
}

/* ========== 加载状态 ========== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
  color: #5a6fd6;
  font-size: 14px;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #e8e8e8;
  border-top: 3px solid #5a6fd6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ========== 空状态 ========== */
.empty-state {
  text-align: center;
  padding: 40px;
  color: #999;
  font-size: 14px;
}

/* ========== 番剧卡片 ========== */
.anime-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.anime-card {
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  padding: 14px;
  background: #fafafa;
  transition: box-shadow 0.2s;
}

.anime-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.anime-header {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.anime-index {
  font-size: 12px;
  color: #999;
  min-width: 30px;
}

.anime-select {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: #5a6fd6;
}

.title-input {
  flex: 3;
  padding: 6px 10px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  font-size: 14px;
}

.subtitle-input {
  flex: 2;
  padding: 6px 10px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  font-size: 14px;
}

.anime-header .preview-btn {
  background: #5a6fd6;
  color: white;
  padding: 4px 12px;
  font-size: 13px;
  cursor: pointer;
  border: none;
  border-radius: 4px;
  transition: all 0.2s;
  font-family: 'Microsoft YaHei', sans-serif;
  white-space: nowrap;
  line-height: 1.4;
}

.anime-header .preview-btn:hover {
  background: #4a5fc6;
}

.anime-header .delete-btn {
  background: #e06060;
  color: white;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 16px;
  line-height: 28px;
  text-align: center;
  cursor: pointer;
  border: none;
  border-radius: 4px;
  transition: all 0.2s;
}

.anime-header .delete-btn:hover {
  background: #cc4a4a;
}

.anime-info {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
  color: #888;
}

.anime-detail {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 4px;
  font-size: 12px;
  color: #888;
  line-height: 1.5;
}

.detail-label {
  color: #5a6fd6;
  font-weight: bold;
  white-space: nowrap;
  min-width: 40px;
}

.detail-text {
  white-space: pre-line;
  color: #666;
}

.tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.tag {
  background: #eef0fb;
  border: 1px solid #cdd2f0;
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 11px;
  color: #5a6fd6;
}

.visual-info {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.visual-path {
  font-size: 12px;
  color: #999;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========== 评论区 ========== */
.comments-section {
  border-top: 1px solid #e8e8e8;
  padding-top: 10px;
}

.comments-header {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
  color: #555;
  flex-wrap: wrap;
}

.comments-header span {
  margin-right: auto;
  font-weight: bold;
  color: #333;
}

.add-comment-btn {
  background: #52c41a;
  color: white;
}

.add-comment-btn:hover {
  background: #45a518;
}

.add-default-comment-btn {
  background: #5a6fd6;
  color: white;
}

.add-default-comment-btn:hover:not(:disabled) {
  background: #4a5fc6;
}

.add-default-comment-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #c0c0c0;
  color: #888;
}

.comment-item {
  background: #fafafa;
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 8px;
  transition: box-shadow 0.2s;
}

.comment-item:hover {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.comment-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.comment-name {
  flex: 1;
  min-width: 80px;
  padding: 4px 8px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  font-size: 13px;
  background: white;
}

.comment-qq {
  width: 90px;
  padding: 4px 8px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  font-size: 13px;
  background: white;
}

.comment-medal {
  padding: 4px 8px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  font-size: 12px;
  background: white;
}

.avatar-status {
  font-size: 11px;
  color: #999;
  min-width: 70px;
  white-space: nowrap;
}

.comment-row button {
  padding: 4px 10px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
  font-family: 'Microsoft YaHei', sans-serif;
  white-space: nowrap;
  line-height: 1.4;
}

.btn-qq-avatar {
  background: #5a6fd6;
  color: white;
}

.btn-qq-avatar:hover {
  background: #4a5fc6;
}

.btn-delete-comment {
  background: #e06060;
  color: white;
  width: 26px;
  height: 26px;
  padding: 0;
  font-size: 14px;
  line-height: 26px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-delete-comment:hover {
  background: #cc4a4a;
}

.comment-text {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  box-sizing: border-box;
  background: white;
  line-height: 1.5;
}

.comment-text:focus {
  outline: none;
  border-color: #5a6fd6;
  box-shadow: 0 0 0 2px rgba(90, 111, 214, 0.1);
}

/* ========== 日志区 ========== */
.log-container {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: #1a1a2e;
  color: #00ff88;
  padding: 8px 20px;
  overflow: hidden;
}

.log {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 12px;
  line-height: 1.6;
}

.log::-webkit-scrollbar {
  width: 6px;
}

.log::-webkit-scrollbar-track {
  background: transparent;
}

.log::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.log::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* ========== 预览区 ========== */
.preview-placeholder,
.preview-loading,
.preview-error {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 200px;
  font-size: 16px;
}

.preview-placeholder {
  color: #bbb;
}

.preview-loading {
  color: #5a6fd6;
}

.preview-error {
  color: #e06060;
  padding: 20px;
  text-align: center;
}

/* ========== 滚动条 ========== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}

/* ========== 响应式 ========== */
@media (max-width: 1000px) {
  .app {
    flex-direction: column;
    height: auto;
  }

  .editor-panel {
    max-height: 50vh;
  }

  .preview-panel {
    height: 50vh;
  }
}