/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --color-bg: #0f172a;
  --color-surface: #1e293b;
  --color-border: #334155;
  --color-text: #e2e8f0;
  --color-muted: #94a3b8;
  --color-accent: #6366f1;
  --color-accent-hover: #818cf8;
  --color-polite: #d1fae5;
  --color-polite-fg: #065f46;
  --color-wandered: #fef3c7;
  --color-wandered-fg: #92400e;
  --color-pushy: #fee2e2;
  --color-pushy-fg: #991b1b;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
}

@media (prefers-color-scheme: light) {
  :root {
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-border: #e2e8f0;
    --color-text: #0f172a;
    --color-muted: #64748b;
    --color-accent: #4f46e5;
    --color-accent-hover: #4338ca;
  }
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }
a { color: var(--color-accent); text-decoration: none; }
a:hover { color: var(--color-accent-hover); text-decoration: underline; }

/* ── Skip link ────────────────────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-accent);
  color: #fff;
  padding: .5rem 1rem;
  z-index: 100;
  transition: top .2s;
}
.skip-link:focus { top: 0; }

/* ── Header ───────────────────────────────────────────────────────────────── */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  flex-wrap: wrap;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
}
.logo:hover { color: var(--color-accent); text-decoration: none; }
.logo-emoji { font-size: 1.6rem; }

.site-header nav { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.site-header nav a {
  color: var(--color-muted);
  font-size: .9rem;
  transition: color .15s;
}
.site-header nav a:hover { color: var(--color-text); text-decoration: none; }
.portal-link { font-weight: 600; }

/* ── Hero ─────────────────────────────────────────────────────────────────── */
.hero {
  padding: 4rem 2rem 2rem;
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  line-height: 1.2;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #818cf8, #a5f3fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero h1 em { font-style: normal; }

.hero-sub {
  color: var(--color-muted);
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.privacy-banner {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  font-size: .85rem;
  color: var(--color-muted);
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .65rem 1.4rem;
  border-radius: 8px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .15s;
  text-decoration: none;
}
.btn-primary { background: var(--color-accent); color: #fff; }
.btn-primary:hover { background: var(--color-accent-hover); color: #fff; text-decoration: none; }
.btn-ghost {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.btn-ghost:hover { border-color: var(--color-accent); color: var(--color-accent); text-decoration: none; }
.btn-sm { padding: .3rem .75rem; font-size: .85rem; }

/* ── Wall ─────────────────────────────────────────────────────────────────── */
.wall-section {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.wall-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: .5rem;
}

.wall-header h2 {
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.live-dot {
  display: inline-block;
  width: 10px; height: 10px;
  background: #22c55e;
  border-radius: 50%;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .5; transform: scale(1.3); }
}

.wall-meta { color: var(--color-muted); font-size: .9rem; }

#wall { display: flex; flex-direction: column; gap: 1rem; }
.wall-empty { color: var(--color-muted); text-align: center; padding: 3rem; }

/* ── Visit card ───────────────────────────────────────────────────────────── */
.visit-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  transition: all .3s;
  animation: slideIn .4s ease;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.visit-card[data-badge="pushy"] { border-left: 3px solid #ef4444; }
.visit-card[data-badge="wandered"] { border-left: 3px solid #f59e0b; }
.visit-card[data-badge="polite"] { border-left: 3px solid #22c55e; }

.card-highlight {
  border: 2px solid var(--color-accent) !important;
  box-shadow: 0 0 0 3px rgba(99,102,241,.2);
}

.card-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: .5rem;
}

.agent-name {
  font-weight: 700;
  font-size: 1rem;
}

.card-reason {
  color: var(--color-muted);
  font-size: .9rem;
  margin-bottom: .75rem;
}

.card-footer {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: .85rem;
  color: var(--color-muted);
  flex-wrap: wrap;
}
.card-time { margin-left: auto; }
.card-link { color: var(--color-accent); font-weight: 600; }

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .65rem;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 700;
}
.badge-polite   { background: var(--color-polite); color: var(--color-polite-fg); }
.badge-wandered { background: var(--color-wandered); color: var(--color-wandered-fg); }
.badge-pushy    { background: var(--color-pushy); color: var(--color-pushy-fg); }

.tag {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 4px;
  font-size: .75rem;
}
.tag-example { background: #1e40af22; color: #93c5fd; border: 1px solid #3b82f644; }

/* ── Visit detail ─────────────────────────────────────────────────────────── */
.visit-detail {
  max-width: 700px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.detail-header {
  margin-bottom: 1.5rem;
}
.detail-header h1 { font-size: 2rem; margin-bottom: .5rem; }
.detail-badges { display: flex; gap: .5rem; flex-wrap: wrap; }

.detail-funny {
  font-size: 1.2rem;
  color: var(--color-muted);
  margin-bottom: 1.5rem;
  font-style: italic;
}

.detail-meta {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: .9rem;
  color: var(--color-muted);
  margin-bottom: 1rem;
}

.detail-reason {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  margin-bottom: 2rem;
}

.detail-steps { margin-bottom: 2rem; }
.detail-steps h2 { margin-bottom: 1rem; font-size: 1.2rem; }
.steps-list { padding-left: 1.5rem; }
.steps-list li { margin-bottom: .5rem; color: var(--color-muted); font-size: .95rem; }
.steps-list li code {
  background: var(--color-border);
  padding: .1em .3em;
  border-radius: 3px;
  font-size: .85em;
}

.detail-share h2 { margin-bottom: 1rem; font-size: 1.2rem; }
.share-image-wrap {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1rem;
}
.share-preview { width: 100%; display: block; }
.share-actions { display: flex; gap: 1rem; margin-bottom: .5rem; flex-wrap: wrap; }
.share-note { font-size: .85rem; color: var(--color-muted); }

.notice-example, .notice-mine {
  border-radius: var(--radius);
  padding: .75rem 1rem;
  margin-bottom: 1.5rem;
  font-size: .9rem;
}
.notice-example { background: #1e3a8a22; border: 1px solid #3b82f644; color: #93c5fd; }
.notice-mine    { background: #4f46e522; border: 1px solid #6366f144; color: #a5b4fc; }

/* ── Send your agent ──────────────────────────────────────────────────────── */
.send-page {
  max-width: 700px;
  margin: 2rem auto;
  padding: 0 1rem;
}
.send-page h1 { font-size: 2rem; margin-bottom: 1rem; }
.send-intro { color: var(--color-muted); margin-bottom: 2rem; }

.code-display {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}
.code-label { font-size: .85rem; color: var(--color-muted); }
.code-value {
  font-size: 1.8rem;
  font-weight: 700;
  font-family: monospace;
  color: var(--color-accent);
  letter-spacing: .05em;
}

.task-box {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.task-box h2 { font-size: 1rem; color: var(--color-muted); margin-bottom: .75rem; }
.task-text {
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 1rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.copy-btn { width: 100%; justify-content: center; }

.task-alts {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}
.task-alts summary { cursor: pointer; font-weight: 600; color: var(--color-muted); }
.task-alts ul { list-style: none; margin-top: 1rem; }
.task-alts li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--color-border);
}
.task-alts li:last-child { border-bottom: none; }

.send-instructions { margin-bottom: 2rem; }
.send-instructions h2 { font-size: 1.2rem; margin-bottom: 1rem; }
.send-instructions ol { padding-left: 1.5rem; }
.send-instructions li { margin-bottom: .5rem; }
.note { font-size: .85rem; color: var(--color-muted); margin-top: 1rem; }

.wall-preview h2 { font-size: 1.2rem; margin-bottom: 1rem; }
#my-visits { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1rem; }

/* ── Leaderboard ──────────────────────────────────────────────────────────── */
.leaderboard-page {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem;
}
.leaderboard-page h1 { font-size: 2rem; margin-bottom: 1rem; }
.table-wrap { overflow-x: auto; margin: 1.5rem 0; }
.leaderboard-table { width: 100%; border-collapse: collapse; }
.leaderboard-table th, .leaderboard-table td {
  padding: .65rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}
.leaderboard-table th { color: var(--color-muted); font-size: .85rem; font-weight: 600; }
.leaderboard-table tr:hover td { background: var(--color-surface); }
.unranked td { color: var(--color-muted); }
.not-enough { font-style: italic; }
.leaderboard-note { font-size: .85rem; color: var(--color-muted); margin-top: 1rem; }

/* ── Museum ───────────────────────────────────────────────────────────────── */
.museum-page {
  max-width: 720px;
  margin: 2rem auto;
  padding: 0 1rem;
}
.museum-page h1 { font-size: 2rem; margin-bottom: 1rem; }
.museum-intro { color: var(--color-muted); font-size: 1.05rem; margin-bottom: 2rem; }
.museum-section { margin-bottom: 2.5rem; }
.museum-section h2 { font-size: 1.3rem; margin-bottom: 1rem; border-bottom: 1px solid var(--color-border); padding-bottom: .5rem; }
.museum-section p { margin-bottom: 1rem; }
.museum-section ul, .museum-section ol { padding-left: 1.5rem; }
.museum-section li { margin-bottom: .5rem; }
.ref-list { list-style: none; padding-left: 0; }
.ref-list li::before { content: "→ "; color: var(--color-accent); }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 2rem;
  color: var(--color-muted);
  font-size: .85rem;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}
.site-footer p { margin-bottom: .75rem; }
.footer-limits {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
}
.footer-credit { font-size: .8rem; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .site-header { padding: 1rem; }
  .site-header nav { gap: 1rem; font-size: .85rem; }
  .hero { padding: 2rem 1rem 1rem; }
  .detail-meta { gap: .75rem; }
  .card-footer { gap: .5rem; }
  .send-instructions ol { padding-left: 1rem; }
}
