/* 杠精分析仪 · Sophist Detector - Apple-style clean design */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --accent: #1976D2;
  --accent-hover: #1565C0;
  --accent-light: #E3F2FD;
  --accent-bg: rgba(25, 118, 210, 0.06);
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #aeaeb2;
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f7;
  --bg-hover: #e8e8ed;
  --border: #d2d2d7;
  --border-strong: #b8b8be;
  --score-low-bg: #E8F5E9;
  --score-low-color: #2E7D32;
  --score-mid-bg: #FFF3E0;
  --score-mid-color: #E65100;
  --score-high-bg: #FFEBEE;
  --score-high-color: #C62828;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

/* Header */
.header {
  text-align: center;
  padding-bottom: 36px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.logo {
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 4px;
}

.logo-en {
  font-size: 15px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.subtitle {
  font-size: 17px;
  color: var(--text-secondary);
  font-weight: 400;
}

.nav-links {
  margin-top: 18px;
}

.nav-links a {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: opacity 0.2s;
}

.nav-links a:hover {
  opacity: 0.7;
}

/* Input section */
.input-section {
  margin-bottom: 24px;
}

.input-box {
  background: var(--bg-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: border-color 0.2s;
}

.input-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.08);
}

.input-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

#inputText {
  width: 100%;
  min-height: 180px;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  border: none;
  background: transparent;
  color: var(--text-primary);
  resize: vertical;
  outline: none;
}

#inputText::placeholder {
  color: var(--text-tertiary);
}

.char-count {
  text-align: right;
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 8px;
}

/* Examples */
.examples {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.example-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.example-btn {
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-primary);
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.18s;
  font-family: inherit;
}

.example-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

/* Actions */
.actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 18px;
}

.btn-primary, .btn-secondary {
  padding: 11px 28px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-sm);
}

.btn-primary:disabled {
  background: #90CAF9;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-hover);
}

/* Loading */
.loading-section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
  color: var(--text-secondary);
  font-size: 14px;
}

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(25, 118, 210, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.btn-primary.loading::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 8px;
}

/* Error */
.error-section {
  margin-top: 16px;
}

.error-message {
  background: #FFF0F0;
  border: 1px solid #FFCCCC;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: #C73838;
  font-size: 14px;
}

/* Result */
.result-section {
  margin-top: 20px;
  animation: fadeIn 0.35s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.result-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Score badge */
.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.score-badge.score-low {
  background: var(--score-low-bg);
  color: var(--score-low-color);
}

.score-badge.score-mid {
  background: var(--score-mid-bg);
  color: var(--score-mid-color);
}

.score-badge.score-high {
  background: var(--score-high-bg);
  color: var(--score-high-color);
}

.score-badge:empty {
  display: none;
}

/* Markdown rendered content */
.markdown-body {
  font-size: 15px;
  line-height: 1.75;
  color: var(--text-primary);
}

.markdown-body h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 28px 0 14px;
  color: var(--text-primary);
}

.markdown-body h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 22px 0 10px;
  color: var(--text-primary);
}

.markdown-body h2:first-child,
.markdown-body h3:first-child {
  margin-top: 0;
}

.markdown-body strong {
  font-weight: 600;
  color: var(--text-primary);
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 20px;
  font-size: 14px;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.markdown-body tr:first-child td {
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-secondary);
  border-bottom: 2px solid var(--border-strong);
  padding: 12px 14px;
  text-align: left;
  white-space: nowrap;
}

.markdown-body td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: top;
  line-height: 1.6;
}

.markdown-body tr:last-child td {
  border-bottom: none;
}

.markdown-body hr {
  display: none;
}

.markdown-body br {
  display: none;
}

.markdown-body br:first-of-type {
  display: none;
}

/* Footer */
.footer {
  text-align: center;
  padding-top: 60px;
  color: var(--text-tertiary);
  font-size: 13px;
}

/* Responsive */
@media (max-width: 720px) {
  .container { padding: 32px 16px 48px; }
  .logo { font-size: 34px; }
  .actions { flex-direction: column; align-items: stretch; }
  .actions button { width: 100%; }
  .result-header { flex-direction: column; align-items: flex-start; gap: 10px; }
}

@media (max-width: 480px) {
  .logo { font-size: 28px; }
  #inputText { min-height: 140px; }
}
