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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f5f6f8;
  color: #222;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

.float-logout {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 13px;
  z-index: 10;
}
.float-logout a { color: #94a3b8; }
.float-logout a:hover { color: #1e293b; }

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px 12px 60px;
}

.controls { margin-bottom: 14px; }
.sort-options {
  margin-bottom: 8px;
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 13px;
  flex-wrap: wrap;
}
.sort-options span { color: #64748b; }
.sort-options a, .topic-counts a {
  padding: 3px 10px;
  border-radius: 4px;
  background: #e2e8f0;
  color: #475569;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.sort-options a:hover, .topic-counts a:hover { text-decoration: none; }
.sort-options a.active, .topic-counts a.active { background: #3b82f6; color: #fff; }
.topic-counts { display: flex; gap: 4px; flex-wrap: wrap; }
.topic-counts .count {
  background: rgba(255,255,255,0.3);
  padding: 1px 5px;
  border-radius: 10px;
  font-size: 11px;
}

.count-info { font-size: 12px; color: #64748b; margin-bottom: 10px; }

.question-card {
  background: #fff;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.q-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11px;
  color: #64748b;
  margin-bottom: 4px;
  align-items: center;
}
.topic-tag {
  background: #dbeafe;
  color: #1e40af;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 500;
}
.q-title {
  font-size: 15px;
  line-height: 1.4;
  margin-bottom: 4px;
}
.q-title a { color: #1e293b; }
.q-title a:hover { color: #2563eb; }
.q-author { font-size: 12px; color: #64748b; margin-bottom: 4px; }
.q-summary {
  font-size: 13px;
  color: #475569;
  line-height: 1.5;
  margin-bottom: 6px;
  max-height: 120px;
  overflow: hidden;
}
.q-footer {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #94a3b8;
}
.detail-link { font-size: 12px; }

.read-indicator {
  background: #fef3c7;
  color: #92400e;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 500;
}
.question-card.read { opacity: 0.65; }
.question-card.read .read-indicator {
  background: #d1fae5;
  color: #065f46;
}
.q-footer-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}
.toggle-form { display: inline; }
.toggle-btn {
  background: none;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  color: #64748b;
  cursor: pointer;
}
.toggle-btn:hover { border-color: #22c55e; color: #22c55e; }
.toggle-btn.read { border-color: #d1fae5; color: #065f46; }
.toggle-btn.read:hover { border-color: #94a3b8; color: #475569; }
.unread-toggle { background: #fef3c7!important; color: #92400e!important; }
.unread-toggle.active { background: #f59e0b!important; color: #fff!important; }

.pagination {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  margin-top: 16px;
  font-size: 13px;
}
.pagination a {
  padding: 8px 16px;
  background: #e2e8f0;
  border-radius: 4px;
  min-width: 72px;
  text-align: center;
}
.pagination a:hover { background: #cbd5e1; text-decoration: none; }

.question-detail h1 { font-size: 20px; margin-bottom: 8px; }
.question-detail .breadcrumb { font-size: 12px; color: #94a3b8; margin-bottom: 10px; }
.original-link { margin: 8px 0 14px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.original-link a { font-size: 13px; }
.se-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; }
.se-tag {
  background: #e2e8f0;
  padding: 1px 7px;
  border-radius: 3px;
  font-size: 11px;
  color: #475569;
}
.question-body, .answers-section { margin-top: 18px; }
.question-body h2, .answers-section h2 {
  font-size: 15px;
  margin-bottom: 8px;
  color: #334155;
}
.body-content, .answer-body {
  background: #fff;
  padding: 14px 16px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.7;
  word-break: break-word;
  overflow-x: auto;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.body-content img, .answer-body img { max-width: 100%; height: auto; }
.body-content pre, .answer-body pre { overflow-x: auto; white-space: pre-wrap; }
.body-content blockquote, .answer-body blockquote {
  border-left: 3px solid #93c5fd;
  margin: 8px 0;
  padding: 4px 12px;
  color: #475569;
  background: #f8fafc;
}
.answer-card {
  margin-bottom: 10px;
  padding: 14px 16px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.answer-card.accepted { border-left: 3px solid #22c55e; }
.answer-header {
  display: flex;
  gap: 8px;
  font-size: 12px;
  color: #64748b;
  margin-bottom: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.accepted-badge {
  background: #22c55e;
  color: #fff;
  padding: 1px 7px;
  border-radius: 3px;
  font-size: 11px;
}
.answer-original { font-size: 11px; }

.copy-btn {
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 4px;
  padding: 4px 12px;
  font-size: 12px;
  color: #166534;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.copy-btn:hover { background: #dcfce7; border-color: #22c55e; }

.empty {
  text-align: center;
  padding: 60px 16px;
  color: #94a3b8;
  font-size: 15px;
}
.error { color: #dc2626; font-size: 13px; margin-bottom: 8px; }

.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: #f0f4f8;
  padding: 16px;
}
.login-box {
  background: #fff;
  padding: 36px 28px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  width: 360px;
  max-width: 100%;
}
.login-box h1 {
  text-align: center;
  font-size: 20px;
  margin-bottom: 20px;
  color: #1e293b;
}
.login-box label {
  display: block;
  font-size: 13px;
  color: #475569;
  margin-bottom: 3px;
}
.login-box input[type="text"],
.login-box input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 15px;
  margin-bottom: 14px;
  -webkit-appearance: none;
}
.login-box button {
  width: 100%;
  padding: 11px;
  background: #3b82f6;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
}
.login-box button:hover { background: #2563eb; }

.big-search {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}
.big-search input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 15px;
  min-width: 0;
}
.big-search button {
  padding: 10px 20px;
  background: #3b82f6;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
  white-space: nowrap;
}

.page-title { font-size: 18px; margin-bottom: 14px; }

@media (max-width: 600px) {
  .float-logout { top: 8px; right: 10px; font-size: 12px; }

  main { padding: 12px 8px 50px; }

  .question-card { padding: 12px 14px; }

  .q-title { font-size: 14px; }
  .q-summary { font-size: 12px; max-height: 80px; }

  .question-detail h1 { font-size: 18px; }

  .body-content, .answer-body {
    padding: 12px;
    font-size: 13px;
  }

  .big-search { gap: 6px; }
  .big-search input { font-size: 14px; padding: 8px 10px; }
  .big-search button { font-size: 14px; padding: 8px 14px; }

  .pagination a { padding: 8px 14px; min-width: 64px; }

  .login-box { padding: 28px 20px; }
}
