:root {
  --bg: #f0f2f8;
  --surface: #fff;
  --border: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
  --primary: #5b1a8a;
  --accent: #9b4dff;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(30, 41, 59, 0.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

.app__title {
  font-size: 26px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.app__desc {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 28px;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.panel {
  display: flex;
  flex-direction: column;
  min-height: 520px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.panel__head .panel__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel__title { font-size: 16px; font-weight: 700; }
.panel__actions { display: flex; gap: 8px; }
.panel__badge {
  font-size: 12px;
  color: var(--muted);
  padding: 4px 10px;
  background: var(--bg);
  border-radius: 999px;
}

.panel__meta {
  padding: 12px 20px;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

.btn {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--primary));
}

.btn--ghost {
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
}

.input-area {
  flex: 1;
  width: 100%;
  min-height: 380px;
  padding: 20px;
  font-size: 15px;
  font-family: inherit;
  line-height: 1.75;
  border: none;
  outline: none;
  resize: none;
}

.table-wrap { flex: 1; overflow: auto; }

.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.result-table thead {
  position: sticky;
  top: 0;
  background: #f8fafc;
}

.result-table th {
  padding: 12px 20px;
  text-align: left;
  font-weight: 700;
  color: var(--primary);
  border-bottom: 2px solid var(--border);
}

.result-table th:last-child {
  width: 120px;
  text-align: center;
}

.result-table td {
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
}

.result-table td:last-child {
  text-align: center;
  font-weight: 700;
  color: var(--primary);
}

.result-table tbody tr:hover td { background: #faf5ff; }

.result-table__empty td {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}

/* 文字云 */
.panel--cloud {
  margin-top: 24px;
  min-height: 460px;
}

.wordcloud-wrap {
  position: relative;
  flex: 1;
  min-height: 400px;
  margin: 0 16px 16px;
  border-radius: 10px;
  background: linear-gradient(160deg, #faf5ff 0%, #f8fafc 50%, #fff5f7 100%);
  border: 1px solid var(--border);
  overflow: hidden;
}

.wordcloud-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  font-size: 15px;
  color: var(--muted);
  z-index: 1;
}

#wordCloudCanvas {
  display: none;
  width: 100%;
  height: 400px;
}

#wordCloudCanvas.is-visible {
  display: block;
  position: relative;
  z-index: 2;
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .panel { min-height: 360px; }
  .input-area { min-height: 240px; }
}
