* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --success: #16a34a;
  --warning: #ea580c;
  --danger: #dc2626;
}

html { font-size: 16px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  padding-bottom: 72px;
}

/* Nav */
.nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
  z-index: 100;
}

.nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 4px 12px;
  min-width: 64px;
  min-height: 48px;
  justify-content: center;
}

.nav a.active { color: var(--primary); }
.nav a svg { width: 24px; height: 24px; margin-bottom: 2px; }

/* Header */
.header {
  background: var(--primary);
  color: white;
  padding: 16px 20px;
  font-size: 1.25rem;
  font-weight: 600;
}

/* Container */
.container { padding: 16px 20px; max-width: 600px; margin: 0 auto; }

/* Cards */
.card {
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}

/* Buttons */
.btn {
  display: block;
  width: 100%;
  padding: 14px 24px;
  border: none;
  border-radius: 12px;
  font-size: 1.125rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  min-height: 48px;
  transition: background 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { background: #94a3b8; cursor: not-allowed; }

.btn-secondary {
  background: var(--card);
  color: var(--primary);
  border: 2px solid var(--primary);
}

/* Forms */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1.125rem;
  font-family: inherit;
  line-height: 1.5;
  background: var(--card);
}

.form-group textarea {
  min-height: 140px;
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Thread list */
.thread-item {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
}

.thread-item:active { background: #f1f5f9; }

.thread-question {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.thread-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-pending { background: #fef3c7; color: #92400e; }
.badge-fast { background: #dbeafe; color: #1e40af; }
.badge-full { background: #dcfce7; color: #166534; }

/* Answer sections */
.answer-section {
  margin-top: 16px;
  padding: 16px;
  border-radius: 12px;
}

.answer-label {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.answer-fast {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.answer-fast .answer-label { color: #1e40af; }

.answer-detailed {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.answer-detailed .answer-label { color: #166534; }

.answer-text {
  font-size: 1.0625rem;
  line-height: 1.7;
  white-space: pre-wrap;
}

.answer-pending {
  color: var(--text-secondary);
  font-style: italic;
  padding: 12px 0;
}

/* Question display */
.question-text {
  font-size: 1.125rem;
  line-height: 1.7;
  padding: 16px;
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--border);
  white-space: pre-wrap;
}

/* Loading */
.loading {
  display: none;
  text-align: center;
  padding: 24px;
  color: var(--text-secondary);
  font-size: 1rem;
}

.loading.active { display: block; }

.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 8px;
}

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

/* Login page */
.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-page h1 {
  font-size: 1.75rem;
  margin-bottom: 8px;
}

.login-page .subtitle {
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.login-box {
  width: 100%;
  max-width: 360px;
}

.login-error {
  background: #fef2f2;
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 0.875rem;
  display: none;
}

/* Greeting */
.greeting {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 20px;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
  margin-top: 24px;
}

/* Logout */
.logout-link {
  display: inline-block;
  color: var(--text-secondary);
  font-size: 0.875rem;
  text-decoration: none;
  margin-top: 16px;
}

/* Timestamp */
.timestamp {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

/* Empty state */
.empty-state {
  text-align: center;
  color: var(--text-secondary);
  padding: 40px 20px;
  font-size: 1rem;
}
