:root {
  --bg: #edf3f5;
  --panel: rgba(248, 252, 253, 0.9);
  --line: rgba(112, 134, 145, 0.2);
  --text: #233641;
  --muted: #617784;
  --accent: #6e8f9d;
  --accent-soft: #dce8ed;
  --success: #2f7a4a;
  --danger: #a1462f;
  --shadow: 0 18px 42px rgba(78, 103, 117, 0.12);
  --radius: 18px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-size: 14px;
  font-family: "Avenir Next", "PingFang SC", "Noto Sans SC", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(174, 201, 214, 0.34), transparent 28%),
    radial-gradient(circle at right, rgba(132, 161, 174, 0.16), transparent 22%),
    linear-gradient(180deg, #f2f7f8 0%, #e5eef1 100%);
}
button, input, textarea, select { font: inherit; }
.app-shell { display: grid; grid-template-columns: 284px minmax(0, 1fr); gap: 18px; padding: 18px; }
.sidebar, .card, .hero { backdrop-filter: blur(16px); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.sidebar {
  position: sticky;
  top: 18px;
  height: calc(100vh - 36px);
  padding: 20px;
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
}
.sidebar > * {
  flex-shrink: 0;
}
.brand h1, .hero h2, .panel-head h3, .card h4 { font-family: Georgia, "Times New Roman", serif; letter-spacing: 0.01em; }
.brand h1 { margin: 6px 0 8px; font-size: 28px; }
.hero h2 { margin: 4px 0 10px; font-size: 28px; }
.panel-head h3 { margin: 4px 0 0; font-size: 24px; }
.card h4 { margin: 0 0 14px; font-size: 18px; }
.eyebrow { margin: 0; color: var(--accent); text-transform: uppercase; letter-spacing: 0.14em; font-size: 11px; font-weight: 700; }
.subtitle, .hero p, .history-item p, label, .summary-card label, .feedback-box, .sentence-zh, .prompt-chip, .status-box { color: var(--muted); }
.nav-tabs { display: grid; gap: 8px; }
.nav-tab, button {
  border: none;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}
.nav-tab {
  text-align: left;
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.56);
  color: var(--text);
  font-weight: 600;
  border: 1px solid transparent;
}
.nav-tab:hover {
  transform: translateX(2px);
  background: rgba(220, 232, 237, 0.72);
}
.nav-tab:active {
  transform: scale(0.98);
}
.nav-tab.active {
  background: linear-gradient(135deg, #86a5b2 0%, #6e8f9d 100%);
  color: white;
  box-shadow: 0 10px 22px rgba(110, 143, 157, 0.28);
  border-color: rgba(110, 143, 157, 0.32);
}
button:not(.ghost) {
  background: linear-gradient(135deg, #86a5b2 0%, #6e8f9d 100%);
  color: white;
}
button {
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 700;
}
button:hover {
  transform: translateY(-1px);
}
button:active {
  transform: scale(0.98);
}
button.ghost { background: rgba(255,255,255,0.65); color: var(--text); border: 1px solid var(--line); }
.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.summary-grid div, .status-box {
  padding: 12px; border-radius: 14px; background: rgba(255,255,255,0.62); border: 1px solid var(--line);
}
.summary-grid span { display: block; font-size: 24px; font-weight: 800; }
.status-box { margin-top: 10px; line-height: 1.45; font-size: 13px; }
.main-panel { display: grid; gap: 18px; }
.hero { padding: 22px; border-radius: 22px; }
.tab-panel { display: none; gap: 16px; }
.tab-panel.active { display: grid; }
.grid { display: grid; gap: 16px; }
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { padding: 18px; border-radius: var(--radius); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid.compact-form {
  grid-template-columns: 1fr;
}
.form-grid .full { grid-column: 1 / -1; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
input, textarea, select { width: 100%; border-radius: 13px; border: 1px solid var(--line); background: rgba(255,255,255,0.76); padding: 11px 12px; color: var(--text); resize: vertical; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: rgba(110, 143, 157, 0.45);
  box-shadow: 0 0 0 3px rgba(110, 143, 157, 0.14);
}
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.history-list { display: grid; gap: 10px; }
.history-item { padding: 14px; border-radius: 15px; background: rgba(255,255,255,0.68); border: 1px solid var(--line); }
.history-item.nested-card {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.56);
}
.history-item h5, .history-item p { margin: 0; }
.history-item h5 + p, .history-item p + p { margin-top: 6px; }
.history-item strong.action-title { display: block; font-size: 16px; margin-bottom: 6px; }
.stat-item {
  background: linear-gradient(180deg, rgba(255,255,255,0.86), rgba(220,232,237,0.64));
}
.stat-number {
  color: var(--text);
  font-size: 24px;
  font-weight: 800;
  line-height: 1.1;
}
.stat-number.small {
  font-size: 18px;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.stats-grid div {
  padding: 10px;
  border-radius: 14px;
  background: rgba(255,255,255,0.62);
  border: 1px solid var(--line);
}
.stats-grid p {
  margin-top: 6px;
}
.step-list { display: grid; gap: 8px; }
.step {
  display: flex; gap: 10px; align-items: start; padding: 10px 12px; border-radius: 14px;
  background: rgba(255,255,255,0.62); border: 1px solid var(--line);
}
.step-index {
  width: 24px; height: 24px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--text); font-weight: 800; flex: 0 0 auto;
  font-size: 12px;
}
.step.done .step-index {
  background: rgba(47,122,74,0.18);
  color: var(--success);
}
.step-body h5, .step-body p { margin: 0; }
.step-body h5 { font-size: 14px; }
.step-body p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.result-box {
  white-space: pre-wrap; min-height: 120px; padding: 12px 14px; border-radius: 15px; background: rgba(255,255,255,0.68);
  border: 1px solid var(--line); line-height: 1.65; overflow: auto;
}
.result-box.compact { min-height: 0; }
.prompt-chip { display: inline-flex; width: fit-content; padding: 5px 9px; border-radius: 999px; background: var(--accent-soft); font-size: 11px; font-weight: 700; }
.sentence-zh { font-size: 20px; color: var(--text); line-height: 1.45; }
.feedback-box { min-height: 76px; padding: 12px 14px; border-radius: 15px; background: rgba(255,255,255,0.6); border: 1px solid var(--line); line-height: 1.55; }
.feedback-box.success { color: var(--success); border-color: rgba(47,122,74,0.2); }
.feedback-box.error { color: var(--danger); border-color: rgba(161,70,47,0.2); }
.selectable { cursor: pointer; }
.selectable.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(110,143,157,0.14); }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.action-card {
  padding: 16px; border-radius: 16px; background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(220,232,237,0.9));
  border: 1px solid rgba(110,143,157,0.22);
}
.action-row {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px;
}
.mini-button {
  display: inline-flex; padding: 7px 11px; border-radius: 999px; border: 1px solid var(--line);
  background: rgba(255,255,255,0.82); cursor: pointer; font-size: 12px; font-weight: 700;
}
.tag {
  display: inline-flex; padding: 4px 9px; border-radius: 999px; background: rgba(220,232,237,0.82);
  color: var(--text); font-size: 12px; font-weight: 600;
}
.word-network-core {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 68px;
  margin-bottom: 12px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(110,143,157,0.14), rgba(174,201,214,0.22));
  border: 1px solid rgba(110,143,157,0.22);
  color: var(--text);
  font-size: 22px;
  font-weight: 800;
  text-transform: lowercase;
}
.word-network-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.network-cluster {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.62);
  border: 1px solid var(--line);
}
.network-label {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.network-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.network-node {
  display: inline-flex;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(220,232,237,0.9);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
}
.network-node.active {
  background: rgba(110,143,157,0.16);
  border-color: rgba(110,143,157,0.3);
  color: var(--accent);
}
.trend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.trend-badge {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(110,143,157,0.12);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}
.progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(110,143,157,0.12);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(135deg, #86a5b2 0%, #6e8f9d 100%);
}
.custom-panel {
  margin-top: 14px;
  padding: 14px;
  border-radius: 15px;
  background: rgba(255,255,255,0.56);
  border: 1px solid var(--line);
}
.hidden {
  display: none;
}
.muted-note { color: var(--muted); font-size: 12px; }
.sidebar::-webkit-scrollbar {
  width: 8px;
}
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(110, 143, 157, 0.28);
  border-radius: 999px;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .two-col, .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .word-network-grid { grid-template-columns: 1fr; }
}
