:root {
  --paper:      #F4F1FB;
  --paper-2:    #ECE7F8;
  --card:       #FFFFFF;
  --ink:        #1B1530;
  --ink-soft:   #4A4360;
  --muted:      #7A7391;
  --line:       #E2DCF1;
  --brand:      #6C3CE0;
  --brand-press:#5A2EC4;
  --brand-tint: #EFE9FC;
  --rise:       #109E63;
  --rise-tint:  #E2F4EC;
  --fall:       #E03E3E;
  --fall-tint:  #FBE7E7;
  --shadow:     0 1px 0 rgba(27,21,48,.04), 0 10px 30px -18px rgba(54,33,120,.35);
  --radius:     16px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Hanken Grotesque", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1100px 520px at 82% -8%, #E8DEFB 0%, rgba(232,222,251,0) 60%),
    radial-gradient(900px 480px at 8% 4%, #F3E4F4 0%, rgba(243,228,244,0) 55%),
    var(--paper);
  min-height: 100vh;
  line-height: 1.5;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px clamp(16px, 5vw, 48px);
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: baseline;
  text-decoration: none;
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 800;
  font-size: clamp(22px, 3.4vw, 30px);
  letter-spacing: -0.03em;
  color: var(--ink);
}
.brand-mark { color: var(--brand); }
.brand-rest { color: var(--ink); }
.brand-cursor {
  width: 3px;
  height: 1.05em;
  margin-left: 5px;
  background: var(--brand);
  display: inline-block;
  transform: translateY(2px);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.topbar-actions { display: flex; align-items: center; gap: 10px; }

/* ---------- buttons ---------- */
.btn {
  font: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  background: transparent;
  color: var(--ink);
  transition: transform .08s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 8px 18px -10px var(--brand); }
.btn-primary:hover { background: var(--brand-press); }
.btn-ghost { border-color: var(--line); background: var(--card); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-block { width: 100%; padding: 13px; margin-top: 6px; }

/* notification bell */
.bell {
  position: relative;
  width: 42px; height: 42px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  display: grid; place-items: center;
  cursor: pointer;
  font-size: 18px;
}
.bell:hover { border-color: var(--brand); }
.bell-badge {
  position: absolute;
  top: -5px; right: -5px;
  min-width: 20px; height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--fall);
  color: #fff;
  font-family: "Space Mono", monospace;
  font-size: 11px;
  display: grid; place-items: center;
  border: 2px solid var(--paper);
}

.who {
  font-size: 13px;
  color: var(--muted);
  max-width: 38vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- layout ---------- */
.wrap { max-width: 760px; margin: 0 auto; padding: 0 clamp(16px, 5vw, 24px) 120px; }

/* ---------- hero ---------- */
.hero { padding: clamp(28px, 6vw, 56px) 0 22px; }
.eyebrow {
  font-family: "Space Mono", monospace;
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: 12px;
  color: var(--brand);
  margin: 0 0 10px;
}
.hero-title {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 800;
  font-size: clamp(40px, 9vw, 76px);
  line-height: .95;
  letter-spacing: -0.04em;
  margin: 0;
}
.hero-title em {
  font-style: italic;
  font-weight: 500;
  color: var(--brand);
}
.hero-sub {
  margin: 16px 0 0;
  max-width: 46ch;
  color: var(--ink-soft);
  font-size: clamp(15px, 2.4vw, 18px);
}

/* ---------- board switch ---------- */
.board-switch {
  display: flex;
  gap: 6px;
  margin: 26px 0 14px;
  background: var(--paper-2);
  padding: 5px;
  border-radius: 999px;
  border: 1px solid var(--line);
}
.board-tab {
  flex: 1;
  font: inherit;
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: clamp(15px, 3vw, 18px);
  padding: 11px 8px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s, background .2s, box-shadow .2s;
}
.board-tab.is-active {
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow);
}

/* ---------- filter bar ---------- */
.filterbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.filter-label { font-size: 13px; color: var(--muted); }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-soft);
  cursor: pointer;
  transition: all .14s ease;
}
.chip:hover { border-color: var(--brand); }
.chip.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }

.live-pip {
  margin-left: auto;
  font-family: "Space Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--rise);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.live-pip .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--rise);
  box-shadow: 0 0 0 0 rgba(16,158,99,.5);
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(16,158,99,.45); }
  70% { box-shadow: 0 0 0 7px rgba(16,158,99,0); }
  100% { box-shadow: 0 0 0 0 rgba(16,158,99,0); }
}

/* ---------- board ---------- */
.board { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.row {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 14px 14px 10px;
  box-shadow: var(--shadow);
  will-change: transform;
}
.row.row-enter { animation: rowIn .45s cubic-bezier(.2,.8,.2,1) both; }
@keyframes rowIn { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* rank + movement */
.rank {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.rank-num {
  font-family: "Space Mono", monospace;
  font-weight: 700;
  font-size: 20px;
  color: var(--ink);
  line-height: 1;
}
.rank-num.top { color: var(--brand); }
.delta {
  font-family: "Space Mono", monospace;
  font-size: 11px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 1px;
  min-height: 12px;
}
.delta.up { color: var(--rise); }
.delta.down { color: var(--fall); }
.delta.flat { color: transparent; }
.delta.new {
  color: var(--brand);
  font-size: 9px;
  letter-spacing: .08em;
}

.ick-main { min-width: 0; }
.ick-body {
  font-size: clamp(15px, 2.6vw, 17px);
  font-weight: 500;
  margin: 0 0 5px;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.ick-meta {
  font-size: 12.5px;
  color: var(--muted);
}
.ick-meta .mine-tag {
  color: var(--brand);
  font-weight: 600;
}

/* vote cluster */
.votes {
  display: flex;
  align-items: center;
  gap: 4px;
}
.vote {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  cursor: pointer;
  display: grid; place-items: center;
  font-size: 15px;
  color: var(--ink-soft);
  transition: all .12s ease;
}
.vote:hover { border-color: var(--brand); }
.vote.up.on { background: var(--rise); border-color: var(--rise); color: #fff; }
.vote.down.on { background: var(--fall); border-color: var(--fall); color: #fff; }
.vote:disabled { opacity: .4; cursor: not-allowed; }
.score {
  font-family: "Space Mono", monospace;
  font-weight: 700;
  font-size: 17px;
  min-width: 2.4ch;
  text-align: center;
}
.score.pos { color: var(--rise); }
.score.neg { color: var(--fall); }

.board-empty, .notif-empty {
  text-align: center;
  color: var(--muted);
  padding: 48px 16px;
  font-size: 16px;
}

/* ---------- floating suggest button ---------- */
.fab {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  background: var(--brand);
  border: 0;
  border-radius: 999px;
  padding: 14px 24px;
  cursor: pointer;
  box-shadow: 0 14px 34px -12px var(--brand);
  transition: transform .12s ease, background .15s ease;
}
.fab:hover { background: var(--brand-press); transform: translateX(-50%) translateY(-2px); }
.fab:active { transform: translateX(-50%) translateY(0); }

/* ---------- footer ---------- */
.footer {
  text-align: center;
  padding: 30px 16px 40px;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- modals ---------- */
.modal-scrim[hidden] { display: none; }
.modal-scrim {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(27,21,48,.42);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 16px;
  animation: fade .15s ease both;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--card);
  border-radius: 22px;
  padding: 26px;
  box-shadow: 0 30px 80px -30px rgba(34,18,80,.6);
  animation: pop .2s cubic-bezier(.2,.8,.2,1) both;
  max-height: 92vh;
  overflow-y: auto;
}
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.modal-sheet { max-width: 420px; }
.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 32px; height: 32px;
  border-radius: 999px;
  border: 0;
  background: var(--paper-2);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-soft);
}
.modal-close:hover { background: var(--line); }
.modal-title {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 26px;
  margin: 4px 0 14px;
}

.modal-tabs { display: flex; gap: 4px; background: var(--paper-2); padding: 4px; border-radius: 12px; margin-bottom: 18px; }
.modal-tab {
  flex: 1; border: 0; background: transparent; font: inherit; font-weight: 600;
  padding: 9px; border-radius: 9px; cursor: pointer; color: var(--muted);
}
.modal-tab.is-active { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

/* forms */
.form { display: flex; flex-direction: column; gap: 13px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.field > span small { font-weight: 400; color: var(--muted); }
.field input, .field select, .field textarea {
  font: inherit;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
  width: 100%;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-tint);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.counter { align-self: flex-end; font-family: "Space Mono", monospace; font-size: 11px; color: var(--muted); }
.form-hint { font-size: 13px; color: var(--muted); margin: -4px 0 4px; }
.form-error {
  background: var(--fall-tint);
  color: var(--fall);
  font-size: 13.5px;
  font-weight: 500;
  padding: 9px 12px;
  border-radius: 10px;
  margin: 0;
}

.field-legend { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.seg { display: flex; gap: 6px; background: var(--paper-2); padding: 4px; border-radius: 12px; }
.seg-btn {
  flex: 1; border: 0; background: transparent; font: inherit; font-weight: 600;
  padding: 10px; border-radius: 9px; cursor: pointer; color: var(--muted);
}
.seg-btn.is-active { background: var(--brand); color: #fff; }
.preview {
  font-size: 13px;
  color: var(--ink-soft);
  background: var(--brand-tint);
  border-radius: 11px;
  padding: 11px 13px;
  margin: 0;
}
.preview strong { color: var(--brand); }

/* notifications */
.notif-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.notif-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper);
}
.notif-heart { font-size: 20px; }
.notif-count { font-family: "Bricolage Grotesque", sans-serif; font-weight: 800; color: var(--brand); }
.notif-body { font-size: 13.5px; color: var(--ink-soft); }
.notif-body .quote { color: var(--ink); font-weight: 500; }

/* toast */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  z-index: 60;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 12px 18px;
  border-radius: 999px;
  box-shadow: 0 16px 40px -16px rgba(0,0,0,.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--fall); }

@media (max-width: 480px) {
  .field-row { grid-template-columns: 1fr; }
  .who { display: none; }
  .row { grid-template-columns: 40px 1fr auto; padding-left: 8px; gap: 9px; }
  .vote { width: 33px; height: 33px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .brand-cursor { animation: none; }
}
