* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f4f8;
  color: #333;
  min-height: 100vh;
}
.container { max-width: 900px; margin: 0 auto; padding: 20px; }

/* Header */
header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  padding: 40px 0;
  text-align: center;
}
header h1 { font-size: 2em; margin-bottom: 8px; }
header p { opacity: 0.9; font-size: 1.1em; }
header .nav-link {
  display: inline-block;
  margin-top: 12px;
  color: #fff;
  text-decoration: none;
  padding: 6px 18px;
  border: 1px solid rgba(255,255,255,0.5);
  border-radius: 20px;
  font-size: 0.9em;
  transition: background 0.2s;
}
header .nav-link:hover { background: rgba(255,255,255,0.15); }

/* Card */
.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  padding: 24px;
  margin-bottom: 20px;
}

/* Form */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.95em;
  color: #555;
}
.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1em;
  transition: border-color 0.2s;
  font-family: inherit;
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
}
.form-group textarea { resize: vertical; min-height: 100px; }
.form-row { display: flex; gap: 12px; align-items: flex-end; }
.form-row .form-group { flex: 1; }

/* CAPTCHA */
.captcha-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.captcha-wrapper svg {
  border-radius: 8px;
  border: 1px solid #ddd;
  cursor: pointer;
  background: #f9f9f9;
}
.captcha-wrapper input { flex: 1; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 28px;
  border: none;
  border-radius: 8px;
  font-size: 1em;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
}
.btn-primary {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 15px rgba(102,126,234,0.4); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-success { background: #48bb78; color: #fff; }
.btn-success:hover { background: #38a169; }
.btn-warning { background: #ecc94b; color: #744210; }
.btn-warning:hover { background: #d69e2e; }
.btn-danger { background: #f56565; color: #fff; }
.btn-danger:hover { background: #e53e3e; }
.btn-sm { padding: 5px 14px; font-size: 0.85em; }

/* Messages List */
.message-item {
  padding: 20px 0;
  border-bottom: 1px solid #eee;
}
.message-item:last-child { border-bottom: none; }
.message-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}
.message-name { font-weight: 700; color: #667eea; }
.message-time { color: #999; font-size: 0.85em; }
.message-content {
  line-height: 1.7;
  color: #444;
  white-space: pre-wrap;
  word-break: break-word;
}
.message-reply {
  margin-top: 12px;
  padding: 12px 16px;
  background: #f0f7ff;
  border-left: 3px solid #667eea;
  border-radius: 6px;
}
.message-reply-label { font-size: 0.85em; color: #667eea; font-weight: 600; }
.message-reply-content { margin-top: 4px; color: #555; white-space: pre-wrap; }

/* Vote buttons */
.message-votes {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.vote-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid #ddd;
  border-radius: 20px;
  background: #fff;
  color: #888;
  font-size: 0.85em;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  line-height: 1;
}
.vote-btn:hover { background: #f5f5f5; }
.vote-btn.active { border-color: currentColor; }
.vote-up.active { color: #48bb78; background: #f0fff4; border-color: #48bb78; }
.vote-down.active { color: #f56565; background: #fff5f5; border-color: #f56565; }
.vote-btn:active { transform: scale(0.92); }
.no-messages {
  text-align: center;
  padding: 40px;
  color: #999;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
}
.pagination button {
  padding: 6px 16px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s;
}
.pagination button:hover:not(:disabled) {
  background: #667eea;
  color: #fff;
  border-color: #667eea;
}
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }
.pagination span { color: #666; font-size: 0.9em; }

/* Alert */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  display: none;
}
.alert-success { background: #c6f6d5; color: #22543d; display: block; }
.alert-error { background: #fed7d7; color: #822727; display: block; }

/* Admin Login */
.login-wrapper {
  max-width: 400px;
  margin: 60px auto;
}
.login-wrapper h2 { text-align: center; margin-bottom: 24px; color: #555; }

/* Admin Table */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
}
.admin-table th, .admin-table td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid #eee;
  vertical-align: top;
}
.admin-table th {
  background: #f7f8fc;
  font-weight: 600;
  color: #555;
  position: sticky;
  top: 0;
}
.admin-table tr:hover { background: #fafbff; }
.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.8em;
  font-weight: 600;
}
.status-pending { background: #fefcbf; color: #744210; }
.status-shown { background: #c6f6d5; color: #22543d; }
.status-hidden { background: #e2e8f0; color: #4a5568; }
.admin-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-reply-input {
  width: 100%;
  min-height: 60px;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9em;
  resize: vertical;
}

/* Top bar */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.top-bar h2 { color: #555; }
.admin-filters { display: flex; gap: 8px; margin-bottom: 16px; }
.admin-filters button { flex: 1; }

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-content {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  padding: 32px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.25s ease;
}
@keyframes modalIn {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.modal-header h2 { color: #555; font-size: 1.3em; }
.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: #999;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.modal-close:hover { color: #333; }

.btn-lg {
  padding: 14px 40px;
  font-size: 1.1em;
}

/* Loading */
.loading { text-align: center; padding: 40px; color: #999; }

/* Responsive */
@media (max-width: 640px) {
  .container { padding: 12px; }
  header { padding: 24px 0; }
  header h1 { font-size: 1.5em; }
  .form-row { flex-direction: column; gap: 0; }
  .captcha-wrapper { flex-direction: column; }
  .admin-table { font-size: 0.8em; }
  .admin-table th, .admin-table td { padding: 8px 6px; }
}
