/* ===== 基础与变量 ===== */
* {
  box-sizing: border-box;
}

:root {
  --bg-deep: #0d1117;
  --bg-card: #161b22;
  --bg-elevated: #21262d;
  --border: #30363d;
  --border-focus: #58a6ff;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --text-dim: #6e7681;
  --accent: #58a6ff;
  --accent-cyan: #39c5cf;
  --accent-glow: rgba(88, 166, 255, 0.25);
  --success: #3fb950;
  --error: #f85149;
  --radius: 8px;
  --radius-sm: 6px;
  --font-sans: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Consolas", monospace;
}

/* ===== AI 背景节点（神经风格光点） ===== */
@keyframes ai-node-pulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.05); }
}

@keyframes ai-node-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(2%, -1%) scale(1.02); }
  66% { transform: translate(-1%, 2%) scale(0.98); }
}

.ai-bg-nodes {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0.5;
  overflow: hidden;
}

.ai-node {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  animation: ai-node-pulse 4s ease-in-out infinite;
}

.ai-node-1 {
  width: 180px;
  height: 180px;
  background: rgba(88, 166, 255, 0.2);
  top: 15%;
  left: 10%;
  animation-delay: 0s;
}

.ai-node-2 {
  width: 120px;
  height: 120px;
  background: rgba(57, 197, 207, 0.25);
  top: 60%;
  right: 15%;
  animation-delay: 0.8s;
}

.ai-node-3 {
  width: 100px;
  height: 100px;
  background: rgba(88, 166, 255, 0.15);
  bottom: 25%;
  left: 20%;
  animation-delay: 1.6s;
}

.ai-node-4 {
  width: 80px;
  height: 80px;
  background: rgba(57, 197, 207, 0.2);
  top: 35%;
  right: 25%;
  animation-delay: 2.4s;
}

.ai-node-5 {
  width: 140px;
  height: 140px;
  background: rgba(88, 166, 255, 0.12);
  bottom: 15%;
  right: 8%;
  animation-delay: 3.2s;
}

@media (prefers-reduced-motion: reduce) {
  .ai-node {
    animation: none;
    opacity: 0.5;
  }
}

/* ===== 页面与背景 ===== */
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  margin: 0;
  padding: 20px;
  min-height: 100vh;
  background: var(--bg-deep);
  background-color: var(--bg-deep);
  background-image:
    /* 网格线 */
    linear-gradient(rgba(88, 166, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(88, 166, 255, 0.04) 1px, transparent 1px),
    /* 网格交点光点 */
    radial-gradient(circle at center, rgba(57, 197, 207, 0.08) 1px, transparent 1px),
    /* 主光晕 */
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(88, 166, 255, 0.12), transparent 45%),
    radial-gradient(ellipse 60% 40% at 100% 50%, rgba(57, 197, 207, 0.08), transparent 45%),
    radial-gradient(ellipse 60% 40% at 0% 80%, rgba(88, 166, 255, 0.06), transparent 45%);
  background-size:
    28px 28px,
    28px 28px,
    28px 28px,
    auto,
    auto,
    auto;
  background-position: 0 0, 0 0, 0 0, 0 0, 0 0, 0 0;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    /* 对角线科技纹 */
    repeating-linear-gradient(
      105deg,
      transparent,
      transparent 2px,
      rgba(88, 166, 255, 0.02) 2px,
      rgba(88, 166, 255, 0.02) 4px
    ),
    repeating-linear-gradient(
      -105deg,
      transparent,
      transparent 2px,
      rgba(57, 197, 207, 0.02) 2px,
      rgba(57, 197, 207, 0.02) 4px
    );
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(
    ellipse 100% 100% at 50% 50%,
    transparent 40%,
    rgba(0, 0, 0, 0.15) 100%
  );
  pointer-events: none;
  z-index: 0;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  background: rgba(22, 27, 34, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 36px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(88, 166, 255, 0.05);
}

/* ===== 页头 ===== */
header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0 0 10px;
  color: var(--text);
  letter-spacing: 0.02em;
}

header h1::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 1.1em;
  background: linear-gradient(180deg, var(--accent), var(--accent-cyan));
  border-radius: 2px;
  margin-right: 10px;
  vertical-align: -0.15em;
}

header h1 .ai-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55em;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--accent-cyan);
  background: linear-gradient(135deg, rgba(88, 166, 255, 0.15) 0%, rgba(57, 197, 207, 0.12) 100%);
  border: 1px solid rgba(57, 197, 207, 0.4);
  border-radius: 4px;
  padding: 0.2em 0.5em;
  margin-right: 10px;
  vertical-align: 0.2em;
  box-shadow: 0 0 12px rgba(57, 197, 207, 0.2);
  text-shadow: 0 0 8px rgba(57, 197, 207, 0.4);
}

.subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

/* ===== 区块 ===== */
.panel {
  margin-bottom: 28px;
}

.panel h2 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel h2::before {
  content: "";
  width: 3px;
  height: 1em;
  background: var(--accent);
  border-radius: 2px;
}

/* ===== 表单网格 ===== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 22px;
  margin-bottom: 18px;
}

@media (max-width: 560px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-grid label.full-width {
  grid-column: 1 / -1;
}

.form-grid label > span:first-of-type {
  font-weight: 500;
  color: var(--text);
  font-size: 13px;
}

.input-hint {
  font-size: 12px;
  color: var(--text-dim);
  margin: -2px 0 4px;
  grid-column: 1 / -1;
}

.form-grid input,
.form-grid select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--bg-deep);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-grid input::placeholder {
  color: var(--text-dim);
}

.form-grid input:focus,
.form-grid select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-grid select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238b949e' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ===== 评卷场景勾选 ===== */
.score-custom-fieldset {
  margin: 14px 0 18px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-deep);
}

.score-custom-fieldset legend {
  font-weight: 500;
  color: var(--text);
  padding: 0 8px;
  font-size: 13px;
}

.checkbox-group {
  margin-bottom: 12px;
}

.checkbox-group:last-child {
  margin-bottom: 0;
}

.checkbox-group-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: normal;
  cursor: pointer;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 13px;
}

.checkbox-label input {
  margin: 0;
  accent-color: var(--accent);
}

/* ===== 按钮 ===== */
.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.btn:hover {
  background: var(--border);
  border-color: var(--text-dim);
}

.btn.primary {
  background: linear-gradient(135deg, #1f6feb 0%, #388bfd 100%);
  border-color: #58a6ff;
  color: #fff;
}

.btn.primary:hover {
  background: linear-gradient(135deg, #388bfd 0%, #58a6ff 100%);
  box-shadow: 0 0 20px var(--accent-glow);
}

/* ===== 规则配置 ===== */
.config-panel h2 {
  margin-bottom: 0;
}

.config-panel h2::before {
  display: none;
}

.config-toggle {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-align: left;
  text-underline-offset: 3px;
  text-decoration: underline;
  text-decoration-color: var(--border);
  transition: color 0.2s;
}

.config-toggle:hover {
  color: var(--accent-cyan);
  text-decoration-color: var(--accent-cyan);
}

.config-content {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.config-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 10px;
}

.custom-rules-textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  resize: vertical;
  background: var(--bg-deep);
  color: var(--text);
}

.custom-rules-textarea::placeholder {
  color: var(--text-dim);
}

.custom-rules-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.config-error {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--error);
}

/* ===== 结果区 ===== */
.result-panel {
  padding-top: 10px;
}

.result-panel h2 {
  margin-bottom: 12px;
}

.result-content {
  min-height: 64px;
  overflow-x: auto;
  padding: 4px 0;
}

.result-content .placeholder {
  color: var(--text-dim);
  margin: 0;
}

.result-content .error {
  color: var(--error);
  margin: 0;
}

.result-table {
  width: 100%;
  min-width: 280px;
  border-collapse: collapse;
  margin-bottom: 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.result-table th,
.result-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.result-table thead {
  background: var(--bg-elevated);
  font-weight: 600;
  color: var(--text);
}

.result-table thead th {
  border-bottom: 1px solid var(--border);
}

.result-table tbody tr {
  background: var(--bg-card);
  transition: background 0.15s;
}

.result-table tbody tr:hover {
  background: var(--bg-elevated);
}

.result-table tbody tr:last-child td {
  border-bottom: none;
}

.result-content .note {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.result-content .note strong {
  color: var(--accent-cyan);
}

.result-detail {
  margin-top: 14px;
  padding: 16px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
}

.result-detail p {
  margin: 0 0 10px;
}

.result-detail p:last-child {
  margin-bottom: 0;
}

.result-detail table {
  margin: 10px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.result-detail .result-table thead {
  background: var(--bg-elevated);
}

.hidden {
  display: none !important;
}

/* ===== 页脚 ===== */
.text-muted {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
}

.text-muted p {
  margin: 0;
}

.text-muted code {
  background: var(--bg-elevated);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ===== 响应式 ===== */
@media (max-width: 600px) {
  body {
    padding: 12px;
  }
  .container {
    padding: 18px 20px;
    border-radius: 10px;
  }
  header h1 {
    font-size: 1.3rem;
  }
  header h1::before {
    height: 1em;
    margin-right: 8px;
  }
  .subtitle {
    font-size: 12px;
  }
  .panel h2 {
    font-size: 1rem;
  }
}
