:root {
  --bg: #0a0a0f;
  --bg-elev: #12121c;
  --card: #161622;
  --card-hover: #1c1c2a;
  --border: #2a2a3a;
  --border-strong: #3a3a4f;
  --text: #e8e8f0;
  --text-muted: #8a8aa0;
  --text-dim: #5c5c70;
  --accent: #b388ff;
  --accent-hover: #c9a8ff;
  --accent-dim: rgba(179, 136, 255, 0.12);
  --up: #4ade80;
  --down: #f87171;
  --warn: #fbbf24;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 0 0 1px var(--border);
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

::selection { background: var(--accent-dim); color: var(--text); }

/* ── Header ────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.5rem;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.brand::before {
  content: "▲";
  color: var(--accent);
  font-size: 0.8em;
}
.brand .dot { color: var(--text-dim); }

.site-header nav { display: flex; align-items: center; gap: 1rem; font-size: 0.9rem; }
.site-header nav .user {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.8rem;
}

/* ── Main layout ───────────────────────────────────── */
main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

h1, h2, h3 { letter-spacing: -0.02em; line-height: 1.2; }
h1 { font-size: 2.25rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.5rem; margin: 2rem 0 1rem; }
h3 { font-size: 1.1rem; margin: 1.5rem 0 0.75rem; }

p { color: var(--text); margin: 0 0 1rem; }
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.mono { font-family: var(--mono); }

/* ── Landing ───────────────────────────────────────── */
.landing {
  padding: 2.5rem 0 3rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}

.landing h1 {
  font-size: 2.75rem;
  background: linear-gradient(180deg, var(--text) 0%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.landing .tagline {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 56ch;
  margin-bottom: 1.5rem;
}

.notice {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.85rem;
  font-family: var(--mono);
}
.notice::before { content: "●"; color: var(--accent); }

/* ── Project grid ──────────────────────────────────── */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 120ms, transform 120ms;
}
.project-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.project-card .name { font-weight: 600; color: var(--text); }
.project-card .desc { color: var(--text-muted); font-size: 0.9rem; }

.project-card .header-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.project-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.project-logo.lg { width: 64px; height: 64px; border-radius: var(--radius); }

/* ── Idea cards (list view) ────────────────────────── */
.idea-list { display: flex; flex-direction: column; gap: 0.75rem; }

.idea-card {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 1rem;
  padding: 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 120ms, background 120ms;
}
.idea-card:hover { background: var(--card-hover); border-color: var(--border-strong); }

.idea-thumb {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-elev);
  border: 1px solid var(--border);
}

.idea-body { min-width: 0; }
.idea-title {
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.25rem;
  line-height: 1.3;
}
.idea-summary {
  color: var(--text-muted);
  font-size: 0.9rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.idea-meta {
  display: flex;
  gap: 0.85rem;
  margin-top: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-dim);
  font-family: var(--mono);
}
.idea-meta .author { color: var(--text-muted); }
.idea-meta .cat {
  padding: 0.1rem 0.5rem;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 999px;
  font-size: 0.72rem;
}

/* ── Vote box ──────────────────────────────────────── */
.vote-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  min-width: 56px;
}
.vote-btn {
  width: 32px;
  height: 28px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 100ms;
}
.vote-btn:hover { border-color: var(--border-strong); color: var(--text); }
.vote-btn.up:hover, .vote-btn.up.active { color: var(--up); border-color: var(--up); }
.vote-btn.down:hover, .vote-btn.down.active { color: var(--down); border-color: var(--down); }
.vote-btn[disabled] { opacity: 0.4; cursor: not-allowed; }

.vote-count {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}
.vote-count.positive { color: var(--up); }
.vote-count.negative { color: var(--down); }

/* ── Tabs (Today / Latest / Top / Popular / Hot) ──── */
.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  margin: 0 0 1.5rem;
  overflow-x: auto;
}
.tabs a {
  padding: 0.65rem 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 100ms, border-color 100ms;
}
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Buttons / forms ───────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: all 120ms;
}
.btn:hover { background: var(--card-hover); border-color: var(--accent); color: var(--accent); }
.btn-primary {
  background: var(--accent);
  color: #0a0a0f;
  border-color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #0a0a0f; }

input[type="email"], input[type="text"], textarea, select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
label { display: block; margin: 0 0 0.4rem; font-size: 0.85rem; color: var(--text-muted); }

.field { margin-top: 1.25rem; }
.field-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}
.char-counter {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-dim);
}
.char-counter.over { color: var(--down); font-weight: 600; }

.md-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.4rem;
}
.md-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  padding: 0.35rem 0.75rem;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}
.md-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.md-preview {
  min-height: 8rem;
  padding: 0.75rem 0.85rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  line-height: 1.5;
}
.md-preview p:last-child { margin-bottom: 0; }

.btn[disabled], .btn.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Footer ────────────────────────────────────────── */
footer {
  margin-top: 5rem;
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-family: var(--mono);
}
footer a { color: var(--text-muted); margin: 0 0.5rem; }
