:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: rgba(255,255,255,.86);
  --surface-strong: #ffffff;
  --text: #17171b;
  --muted: #73737c;
  --line: rgba(25,25,30,.09);
  --line-strong: rgba(25,25,30,.16);
  --accent: #6f57e8;
  --accent-soft: #eeeafd;
  --green: #1f8a54;
  --red: #c54a58;
  --shadow: 0 18px 45px rgba(30,30,40,.08);
  --radius: 22px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% -10%, rgba(111,87,232,.10), transparent 28rem),
    radial-gradient(circle at 94% 12%, rgba(78,170,255,.08), transparent 25rem),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
.is-hidden { display: none !important; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 68px;
  padding: 0 max(20px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(245,245,247,.78);
  backdrop-filter: blur(22px);
}
.brand {
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.topnav { display: flex; align-items: center; gap: 8px; }
.topnav a {
  padding: 8px 11px;
  border-radius: 10px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 650;
}
.topnav a:hover, .topnav a.active { background: rgba(255,255,255,.7); color: var(--text); }

.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 38px;
  align-items: end;
  padding: 88px 0 46px;
}
.kicker, .section-kicker {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .19em;
}
h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(3rem, 7vw, 6.4rem);
  line-height: .94;
  letter-spacing: -.065em;
}
.lead {
  max-width: 680px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.7vw, 1.18rem);
  line-height: 1.62;
}
.primary-button {
  border: 0;
  border-radius: 14px;
  background: var(--text);
  color: #fff;
  padding: 13px 18px;
  font-weight: 760;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(15,15,20,.12);
  transition: transform 150ms ease, opacity 150ms ease;
}
.primary-button:hover { transform: translateY(-1px); }
.primary-button:disabled { opacity: .45; cursor: default; transform: none; }

.toolbar {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}
.search-box {
  display: grid;
  grid-template-columns: 28px 1fr 32px;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 0 12px 0 16px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(30,30,40,.035);
}
.search-icon { color: var(--muted); font-size: 1.4rem; transform: rotate(-18deg); }
.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}
.search-box input::placeholder { color: #9a9aa2; }
.clear-search, .icon-button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 1.25rem;
  cursor: pointer;
}
.clear-search:hover, .icon-button:hover { background: rgba(20,20,25,.06); color: var(--text); }
.sort-switch {
  display: flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
}
.sort-switch button {
  border: 0;
  border-radius: 11px;
  background: transparent;
  padding: 10px 14px;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}
.sort-switch button.is-active { background: var(--surface-strong); color: var(--text); box-shadow: 0 3px 11px rgba(20,20,25,.08); }

.catalog-panel {
  margin-bottom: 36px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.55);
}
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 18px; }
.section-heading h2 { margin: 0; font-size: 1.55rem; letter-spacing: -.035em; }
.section-kicker { margin-bottom: 5px; color: #91919a; font-size: .6rem; }
.text-button { border: 0; background: transparent; color: var(--muted); font-weight: 680; cursor: pointer; }
.text-button:hover { color: var(--text); }
.plugin-chips, .kind-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.kind-chips { margin-top: 10px; }
.chip, .mini-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 9px 13px;
  color: #686872;
  font-size: .82rem;
  font-weight: 680;
  cursor: pointer;
}
.mini-chip { padding: 7px 11px; background: transparent; font-size: .76rem; }
.chip:hover, .mini-chip:hover { border-color: var(--line-strong); color: var(--text); }
.chip.is-active, .mini-chip.is-active { border-color: transparent; background: var(--text); color: #fff; }

.ideas-section { padding-bottom: 64px; }
.ideas-heading { margin-bottom: 16px; }
.result-count {
  display: inline-grid;
  min-width: 34px;
  height: 30px;
  place-items: center;
  border-radius: 999px;
  background: #e9e9ed;
  color: #666670;
  font-size: .78rem;
  font-weight: 800;
}
.ideas-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.idea-card {
  display: flex;
  flex-direction: column;
  min-height: 250px;
  padding: 23px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  box-shadow: 0 12px 35px rgba(30,30,40,.045);
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.idea-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.idea-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #5f49d1;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.badge.is-new { background: #e8f6ee; color: #24724d; }
.date { color: #a0a0a7; font-size: .72rem; }
.idea-card h3 { margin: 19px 0 10px; font-size: 1.32rem; line-height: 1.15; letter-spacing: -.035em; }
.idea-description {
  margin: 0;
  color: #66666f;
  line-height: 1.58;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.vote-row { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 24px; }
.vote-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafafc;
  padding: 0 11px;
  color: #73737c;
  font-weight: 760;
  cursor: pointer;
}
.vote-button:hover { border-color: var(--line-strong); color: var(--text); }
.vote-button.is-like.is-active { border-color: rgba(31,138,84,.18); background: #edf8f2; color: var(--green); }
.vote-button.is-dislike.is-active { border-color: rgba(197,74,88,.18); background: #fff0f2; color: var(--red); }
.score { margin-left: auto; color: #9999a1; font-size: .76rem; font-weight: 700; }
.status-card {
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}
.status-card strong, .status-card span { display: block; }
.status-card strong { margin-bottom: 6px; color: var(--text); }
.status-card.is-error { color: var(--red); }

.modal-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  overflow-y: auto;
  padding: 24px;
  background: rgba(20,20,25,.42);
  backdrop-filter: blur(12px);
}
.idea-modal {
  width: min(620px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 26px;
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 26px;
  background: #fbfbfc;
  box-shadow: 0 30px 80px rgba(20,20,30,.24);
}
.modal-head { display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.modal-head h2 { margin: 0; font-size: 1.7rem; }
.type-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.type-picker label { position: relative; cursor: pointer; }
.type-picker input { position: absolute; opacity: 0; pointer-events: none; }
.type-picker span {
  display: flex;
  min-height: 84px;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}
.type-picker strong { font-size: .9rem; }
.type-picker small { color: var(--muted); line-height: 1.35; }
.type-picker input:checked + span { border-color: rgba(111,87,232,.35); background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgba(111,87,232,.08); }
.field-label { display: block; margin: 17px 0 8px; font-size: .77rem; font-weight: 800; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  outline: none;
  background: #fff;
  padding: 12px 13px;
  color: var(--text);
}
textarea { resize: vertical; min-height: 132px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: rgba(111,87,232,.5); box-shadow: 0 0 0 3px rgba(111,87,232,.08); }
.field-hint { margin: 8px 0 0; color: var(--red); font-size: .76rem; }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 22px; }
.form-message { min-height: 20px; color: var(--muted); font-size: .78rem; }
.form-message.is-error { color: var(--red); }
.form-message.is-ok { color: var(--green); }
.footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 22px 0 30px;
  border-top: 1px solid var(--line);
  color: #9b9ba3;
  font-size: .72rem;
}
.footer a:hover { color: var(--text); }

@media (max-width: 760px) {
  .topbar { position: relative; min-height: auto; flex-direction: column; align-items: flex-start; padding: 18px 20px; }
  .topnav { width: 100%; overflow-x: auto; }
  .topnav a { white-space: nowrap; }
  .shell { width: min(100% - 28px, 1180px); }
  .hero { grid-template-columns: 1fr; padding: 56px 0 32px; }
  .hero .primary-button { width: 100%; }
  h1 { font-size: clamp(3rem, 17vw, 4.8rem); }
  .toolbar { grid-template-columns: 1fr; }
  .sort-switch { width: 100%; }
  .sort-switch button { flex: 1; }
  .catalog-panel { padding: 18px; }
  .ideas-grid { grid-template-columns: 1fr; }
  .idea-card { min-height: 220px; }
  .type-picker { grid-template-columns: 1fr; }
  .form-footer { align-items: stretch; flex-direction: column; }
  .form-footer .primary-button { width: 100%; }
}

/* v3: admin tags + public comments */
.tag-filter { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.tag-filter-title { margin: 0; color: #8f8f98; font-size: .65rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.idea-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 15px; }
.idea-tag { border: 0; border-radius: 999px; background: var(--accent-soft); padding: 6px 9px; color: #604ad1; font-size: .7rem; font-weight: 760; cursor: pointer; }
.idea-tag:hover { filter: brightness(.97); }
.comment-toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; border: 1px solid var(--line); border-radius: 12px; background: #fafafc; padding: 0 11px; color: #73737c; font-weight: 760; cursor: pointer; }
.comment-toggle:hover, .comment-toggle.is-active { border-color: var(--line-strong); color: var(--text); background: #f2f2f6; }
.comment-section { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; }
.comments-list { display: grid; gap: 9px; }
.comment-item { padding: 11px 12px; border: 1px solid var(--line); border-radius: 13px; background: #fafafd; }
.comment-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.comment-head strong { color: var(--text); font-size: .76rem; }
.comment-head span { color: #a1a1a9; font-size: .65rem; }
.comment-item p { margin: 7px 0 0; color: #62626b; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.comments-empty { margin: 0; padding: 5px 0 8px; color: #9797a0; }
.comment-form { display: grid; grid-template-columns: minmax(120px,.36fr) minmax(0,1fr); gap: 8px; margin-top: 11px; }
.comment-form textarea { grid-column: 1/-1; min-height: 80px; }
.comment-form-footer { grid-column: 1/-1; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.comment-message { color: var(--muted); font-size: .7rem; }
.comment-message.is-error { color: var(--red); }
.comment-submit { border: 0; border-radius: 10px; background: var(--text); padding: 9px 12px; color: #fff; font-size: .72rem; font-weight: 760; cursor: pointer; }
.comment-submit:disabled { opacity: .5; cursor: default; }
@media (max-width: 600px) {
  .vote-row { flex-wrap: wrap; }
  .score { width: 100%; margin-left: 0; }
  .comment-form { grid-template-columns: 1fr; }
  .comment-form textarea, .comment-form-footer { grid-column: auto; }
}

/* v4: admin replies in public comments */
.comment-author { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.admin-comment-badge { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 999px; background: #17171b; color: #fff; font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.comment-item.is-admin-comment { border-color: rgba(23, 23, 27, .22); background: rgba(23, 23, 27, .035); }
