* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --text-primary: #1a1a1a;
  --text-secondary: #4a4a4a;
  --text-tertiary: #8a8a8a;
  --text-quaternary: #b0b0b0;
  --border: #e5e5e5;
  --border-light: #f0f0f0;
  --accent: #2563eb;
  --accent-light: #dbeafe;
  --positive: #16a34a;
  --positive-light: #dcfce7;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --hover: #f5f5f5;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0a;
    --surface: #141414;
    --text-primary: #f0f0f0;
    --text-secondary: #b0b0b0;
    --text-tertiary: #808080;
    --text-quaternary: #555555;
    --border: #2a2a2a;
    --border-light: #1a1a1a;
    --hover: #1f1f1f;
    --accent-light: rgba(37,99,235,0.15);
    --positive-light: rgba(22,163,74,0.15);
    --warning-light: rgba(217,119,6,0.15);
    --danger-light: rgba(220,38,38,0.15);
  }
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  padding: 20px;
}
.container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: calc(100vh - 40px);
}
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--text-primary);
  display: flex; align-items: center; justify-content: center;
  color: var(--surface);
  font-size: 18px; font-weight: 500;
}
.header-title {
  font-size: 17px; font-weight: 500;
  line-height: 1.3;
}
.header-sub {
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.3;
}
select, input, textarea {
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease;
}
select {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
}
/* 工作区布局 */
.workspace {
  display: flex;
  gap: 16px;
  flex: 1;
  min-height: 0;
}
.main {
  display: flex;
  gap: 16px;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

/* 历史会话侧栏 */
.conv-sidebar {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}
.conv-sidebar.hidden { display: none !important; }
.conv-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}
.conv-sidebar-header button {
  padding: 4px 10px;
  font-size: 12px;
  background: var(--accent-light);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--accent);
  cursor: pointer;
}
.conv-sidebar-header button:hover { opacity: 0.85; }
.conv-list {
  flex: 1;
  min-height: 120px;
  max-height: 280px;
  overflow-y: auto;
  padding: 8px;
}
.conv-detail-header {
  padding: 10px 14px 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
}
.conv-detail {
  flex: 1;
  min-height: 100px;
  max-height: 200px;
  overflow-y: auto;
  padding: 0 10px 10px;
}
.conv-item {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  margin-bottom: 4px;
  transition: background 0.15s;
}
.conv-item:hover { background: var(--hover); }
.conv-item.active {
  background: var(--accent-light);
  border: 1px solid rgba(37,99,235,0.25);
}
.conv-item-title {
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-item-time {
  font-size: 11px;
  color: var(--text-quaternary);
  margin-top: 4px;
}
.conv-empty {
  padding: 20px 12px;
  text-align: center;
  color: var(--text-quaternary);
  font-size: 12px;
  line-height: 1.6;
}
.conv-load-more {
  padding: 10px;
  text-align: center;
  font-size: 12px;
  color: var(--text-quaternary);
}
.conv-load-more.hidden { display: none; }
.detail-item {
  padding: 10px;
  margin-bottom: 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--bg);
}
.detail-meta {
  font-size: 11px;
  color: var(--text-quaternary);
  margin-bottom: 6px;
}
.detail-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-top: 6px;
}
.detail-text {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  word-break: break-word;
}
.detail-snippet { color: var(--text-tertiary); }
.panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.form-group-grow {
  flex: 1;
  min-height: 0;
}
.panel-right {
  flex: 1.2;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--surface);
  position: relative;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.form-label button {
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.15s;
}
.form-label button:hover {
  background: var(--hover);
  color: var(--text-secondary);
}
input[type="text"], textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 14px;
}
input[type="text"]:focus, textarea:focus {
  border-color: var(--text-primary);
}
textarea {
  resize: vertical;
  line-height: 1.6;
  min-height: 140px;
}
.textarea-grow {
  flex: 1;
  min-height: 140px;
}
.btn-group {
  display: flex;
  gap: 10px;
}
.btn-primary {
  flex: 1;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-lg);
  background: var(--text-primary);
  color: var(--surface);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.85; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--text-secondary);
  font-size: 15px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-secondary:hover { background: var(--hover); }
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.tab-btn {
  flex: 1;
  padding: 12px;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-tertiary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.tab-btn.active {
  color: var(--text-primary);
  border-bottom-color: var(--text-primary);
}
.tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  font-size: 14px;
  line-height: 1.7;
}
.tab-pane { display: none; }
.tab-pane.active { display: block; }
.placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  gap: 12px;
  color: var(--text-quaternary);
}
.placeholder svg { opacity: 0.4; }
.placeholder-hint {
  font-size: 12px;
}
.loading-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(250,250,250,0.85);
  backdrop-filter: blur(2px);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  z-index: 10;
}
@media (prefers-color-scheme: dark) {
  .loading-overlay { background: rgba(10,10,10,0.85); }
}
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--text-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 4px;
  font-size: 12px;
  color: var(--text-quaternary);
  border-top: 1px solid var(--border);
}
.score-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--border);
  overflow: hidden;
  margin-bottom: 8px;
}
.score-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease-out;
}
.score-excellent { background: var(--positive); }
.score-good { background: var(--accent); }
.score-ok { background: var(--warning); }
.score-bad { background: var(--danger); }
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  margin: 2px;
}
.tag-core { background: var(--positive-light); color: var(--positive); }
.tag-bonus { background: var(--accent-light); color: var(--accent); }
.tag-miss { background: var(--danger-light); color: var(--danger); }
h3 { font-size: 15px; font-weight: 500; margin: 0 0 8px 0; color: var(--text-primary); }
h4 { font-size: 14px; font-weight: 500; margin: 12px 0 6px 0; color: var(--text-secondary); }
ul { margin: 0; padding-left: 18px; }
li { margin-bottom: 4px; }
.result-card {
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 12px;
}
.result-card-green {
  background: var(--positive-light);
  border: 1px solid rgba(22,163,74,0.2);
}
.result-card-yellow {
  background: var(--warning-light);
  border: 1px solid rgba(217,119,6,0.2);
}
.result-card-red {
  background: var(--danger-light);
  border: 1px solid rgba(220,38,38,0.2);
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.grid-item {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 10px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.copy-btn:hover { background: var(--hover); }
.result-content {
  display: none;
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.8;
}
.result-content.visible { display: block; }
.result-wrap { position: relative; }
@media (max-width: 768px) {
  .workspace { flex-direction: column; }
  .conv-sidebar { width: 100%; max-height: none; }
  .conv-list { max-height: 160px; }
  .conv-detail { max-height: 140px; }
  .main { flex-direction: column; }
  .panel-right { min-height: 400px; }
  .grid-3 { grid-template-columns: 1fr; }
  body { padding: 12px; }
}
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
