* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(180deg, #ebf2fa 0%, #fff8d6 100%);
  background-attachment: fixed;
  min-height: 100vh;
  color: #1f2937;
}
a { color: inherit; text-decoration: none; }
.muted { color: #6b7280; font-size: 12px; }
.hidden { display: none !important; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 24px; background: #fff; border-bottom: 1px solid #e5e7eb;
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 600; font-size: 16px; color: #1f2937; }

.user-pill {
  display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px;
  border: 1px solid #e5e7eb; border-radius: 999px; background: #f9fafb;
  min-width: 180px; max-width: 280px;
}
.user-pill.ok { border-color: #10b981; background: #ecfdf5; }
.user-pill.fail { border-color: #ef4444; background: #fef2f2; }
.user-pill-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: #d1d5db center/cover no-repeat;
  flex-shrink: 0;
}
.user-pill-text { line-height: 1.2; min-width: 0; }
.user-pill-name { font-size: 12px; font-weight: 600; color: #1f2937; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-pill-uid { font-size: 10px; color: #6b7280; font-family: ui-monospace, Menlo, Consolas, monospace; }

.container { max-width: 1100px; margin: 0 auto; padding: 24px; }
h1 { font-size: 22px; margin: 8px 0 4px; }

.tool-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(260px,1fr)); gap: 16px; margin-top: 24px; }
.tool-card { display: block; padding: 16px; background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; transition: all .15s; }
.tool-card:hover { border-color: #3b82f6; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(59,130,246,.15); }
.tool-card.disabled { opacity: .5; pointer-events: none; }
.tool-card h3 { margin: 0 0 6px; font-size: 15px; }
.tool-card p { margin: 0; font-size: 12px; color: #4b5563; }

.urlbar {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  background: #1a2332; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.urlbar-icon { color: #9ca3af; font-size: 14px; }
.urlbar input {
  flex: 1; background: transparent; border: none; color: #fff;
  font: 14px/1.4 -apple-system, monospace; outline: none; padding: 6px 0;
}
.urlbar input::placeholder { color: #6b7280; }

.btn-primary {
  background: #3b82f6; color: #fff; border: none; border-radius: 6px;
  padding: 8px 18px; font-weight: 600; cursor: pointer; font-size: 13px;
}
.btn-primary:hover { background: #2563eb; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-secondary { background: #6b7280; color: #fff; border: none; border-radius: 6px; padding: 8px 14px; cursor: pointer; }
.btn-export { background: #22c55e; color: #fff; border: none; border-radius: 6px; padding: 8px 18px; font-weight: 600; cursor: pointer; }
.btn-export:hover { background: #16a34a; }

.filterbar {
  margin-top: 12px; padding: 12px 16px; background: #fffbe5;
  border: 1px solid #fde68a; border-radius: 8px;
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center;
}
.filter-row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: 12px; }
.filter-row label { display: inline-flex; gap: 4px; align-items: center; cursor: pointer; }
.filter-row input { margin: 0; }
.filter-row strong { font-size: 12px; color: #374151; }
.filter-row .ml { margin-left: 12px; }

.counters { display: flex; gap: 6px; }
.badge { padding: 4px 10px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.badge-loaded { background: #fbbf24; color: #78350f; }
.badge-showing { background: #e5e7eb; color: #374151; }

.group-card {
  margin-top: 12px; background: #fff; border: 1px solid #e5e7eb; border-radius: 8px;
  overflow: hidden;
}
.gc-cover {
  height: 140px; background: #1f2937 center/cover no-repeat;
  background-image: linear-gradient(135deg, #3b82f6 0%, #1e3a8a 100%);
}
.gc-body { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; }
.gc-avatar {
  width: 64px; height: 64px; border-radius: 50%; background: #e5e7eb center/cover no-repeat;
  flex-shrink: 0; margin-top: -38px; border: 4px solid #fff; box-shadow: 0 2px 4px rgba(0,0,0,.1);
}
.gc-meta { flex: 1; }
.gc-meta h3 { margin: 0 0 4px; font-size: 15px; color: #2563eb; }

.phase {
  margin-top: 8px; padding: 8px 12px; background: #fff; border: 1px solid #e5e7eb;
  border-radius: 6px; font-size: 12px;
}

.results {
  margin-top: 12px; background: #fff; border: 1px dashed #d1d5db; border-radius: 8px;
  min-height: 200px; padding: 0;
}
.empty-state { padding: 60px 20px; text-align: center; color: #9ca3af; font-size: 13px; }

.post {
  display: grid; grid-template-columns: 60px 1fr 80px; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid #f3f4f6; align-items: start;
}
.post:last-child { border-bottom: none; }
.post-rank { font-size: 18px; font-weight: 700; color: #6b7280; text-align: center; padding-top: 4px; }
.post-body { min-width: 0; }
.post-author { font-weight: 600; font-size: 13px; color: #1f2937; }
.post-time { font-size: 11px; color: #6b7280; margin-left: 6px; }
.post-msg { margin-top: 4px; font-size: 13px; color: #374151; line-height: 1.5; word-wrap: break-word; white-space: pre-wrap; }
.post-msg .show-more { color: #3b82f6; font-size: 12px; }
.post-imgs {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 4px;
  max-width: 520px;
}
.post-imgs img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 4px;
  background: #f3f4f6;
  cursor: pointer;
  transition: transform 0.1s;
}
.post-imgs img:hover { transform: scale(1.02); }
.post-head { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.post-stats { margin-top: 6px; display: flex; gap: 12px; font-size: 12px; color: #6b7280; }
.post-stats span { display: inline-flex; gap: 3px; align-items: center; }
.post-stats .num { font-weight: 600; color: #1f2937; }
.post-actions { text-align: right; }
.post-actions a { font-size: 12px; color: #3b82f6; text-decoration: underline; }
.post-type-badge {
  display: inline-block; padding: 1px 6px; background: #e5e7eb; color: #374151;
  border-radius: 3px; font-size: 10px; margin-right: 6px; text-transform: uppercase;
}

.footer { padding: 24px; text-align: center; }
