:root {
  --bg: #0d1017;
  --bg-elev: #151a24;
  --bg-elev-2: #1c2330;
  --border: #262f3d;
  --border-strong: #33405230;
  --text: #e8ecf2;
  --text-dim: #9aa6b8;
  --text-faint: #6b7688;
  --accent: #ff7a1a;
  --accent-hi: #ff9440;
  --accent-dim: #ff7a1a22;
  --green: #34d399;
  --blue: #5b9dff;
  --purple: #a78bfa;
  --red: #f87171;
  --yellow: #fbbf24;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: radial-gradient(
      1200px 600px at 50% -10%,
      #1a2130 0%,
      var(--bg) 55%
    )
    no-repeat;
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

input,
textarea,
select {
  font-family: inherit;
}

/* ---------- Layout ---------- */
.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 20px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(10px);
  background: rgba(13, 16, 23, 0.72);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 18px;
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), #ff5722);
  box-shadow: 0 4px 14px var(--accent-dim);
  font-size: 18px;
}

.brand small {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  letter-spacing: 0.02em;
}

.spacer {
  flex: 1;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  transition: border-color 0.15s, background 0.15s, transform 0.05s;
}

.btn:hover {
  border-color: #3a4658;
  background: var(--bg-elev-2);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #ff5f12);
  border-color: transparent;
  color: #17110a;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-hi), var(--accent));
  border-color: transparent;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-dim);
}

.btn-ghost:hover {
  background: var(--bg-elev);
  color: var(--text);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 13px;
}

/* ---------- Hero ---------- */
.hero {
  padding: 40px 0 24px;
}

.hero h1 {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 8px;
}

.hero p {
  color: var(--text-dim);
  font-size: 16px;
  margin: 0;
  max-width: 560px;
  line-height: 1.5;
}

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 22px 0 18px;
}

.tabs {
  display: inline-flex;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  gap: 2px;
}

.tab {
  border: none;
  background: transparent;
  color: var(--text-dim);
  padding: 7px 14px;
  border-radius: 7px;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}

.tab.active {
  background: var(--bg-elev-2);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border);
}

.tab .count {
  color: var(--text-faint);
  font-weight: 700;
  margin-left: 6px;
  font-size: 12px;
}

.search {
  position: relative;
  flex: 1;
  min-width: 160px;
}

.search input {
  width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 9px 13px 9px 36px;
  font-size: 14px;
  outline: none;
}

.search input:focus {
  border-color: var(--accent);
}

.search svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
}

select.sort {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 14px;
  font-weight: 600;
  outline: none;
}

/* ---------- Post list / card ---------- */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 60px;
}

.card {
  display: flex;
  gap: 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color 0.15s, transform 0.08s;
}

.card:hover {
  border-color: #35435780;
}

.vote {
  flex: 0 0 auto;
  width: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 0;
  background: var(--bg);
  color: var(--text-dim);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  align-self: flex-start;
}

.vote:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.vote.voted {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent-hi);
}

.vote .num {
  font-weight: 800;
  font-size: 16px;
  color: var(--text);
}

.vote.voted .num {
  color: var(--accent-hi);
}

.card-body {
  flex: 1;
  min-width: 0;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 5px;
  line-height: 1.35;
}

.card-title:hover {
  color: var(--accent-hi);
}

.card-excerpt {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-faint);
}

.card-meta .dot {
  opacity: 0.5;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-feature {
  color: var(--blue);
  background: #5b9dff18;
  border-color: #5b9dff33;
}

.badge-bug {
  color: var(--red);
  background: #f8717118;
  border-color: #f8717133;
}

.badge-status {
  text-transform: capitalize;
}

.status-open {
  color: var(--text-dim);
  background: #ffffff0a;
  border-color: var(--border);
}
.status-planned {
  color: var(--purple);
  background: #a78bfa18;
  border-color: #a78bfa33;
}
.status-in-progress {
  color: var(--yellow);
  background: #fbbf2418;
  border-color: #fbbf2433;
}
.status-done {
  color: var(--green);
  background: #34d39918;
  border-color: #34d39933;
}
.status-declined {
  color: var(--text-faint);
  background: #ffffff08;
  border-color: var(--border);
  text-decoration: line-through;
}

/* ---------- Empty state ---------- */
.empty {
  text-align: center;
  padding: 70px 20px;
  color: var(--text-faint);
}

.empty .big {
  font-size: 40px;
  margin-bottom: 12px;
}

/* ---------- Modal ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 11, 0.72);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 20px;
  animation: fade 0.15s ease;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.modal {
  width: 100%;
  max-width: 480px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 24px;
  animation: pop 0.16s ease;
}

@keyframes pop {
  from {
    transform: translateY(8px) scale(0.98);
    opacity: 0;
  }
}

.modal h2 {
  margin: 0 0 4px;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.modal .sub {
  color: var(--text-dim);
  font-size: 14px;
  margin: 0 0 20px;
  line-height: 1.5;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 7px;
}

.field input,
.field textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 11px 13px;
  font-size: 14.5px;
  outline: none;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--accent);
}

.type-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.type-opt {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 10px;
  padding: 13px;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}

.type-opt .t {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 2px;
}

.type-opt .d {
  font-size: 12px;
  color: var(--text-faint);
}

.type-opt.sel-feature {
  border-color: var(--blue);
  background: #5b9dff12;
}

.type-opt.sel-bug {
  border-color: var(--red);
  background: #f8717112;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 22px;
}

/* ---------- Verify flow ---------- */
.code-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 18px 0;
}

.code-char {
  width: 44px;
  height: 56px;
  display: grid;
  place-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0;
  color: var(--accent-hi);
  font-family: "SF Mono", "JetBrains Mono", ui-monospace, monospace;
}

.cmd {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 4px 0 8px;
}

.cmd code {
  color: var(--accent-hi);
  font-weight: 600;
}

.waiting {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-dim);
  font-size: 14px;
  justify-content: center;
  margin-top: 6px;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.success-check {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #34d39920;
  color: var(--green);
  display: grid;
  place-items: center;
  margin: 4px auto 14px;
  font-size: 28px;
}

/* ---------- User chip ---------- */
.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 5px 4px 12px;
}

.user-chip .avatar {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  image-rendering: pixelated;
  background: var(--bg-elev-2);
}

.user-chip .name {
  font-size: 13.5px;
  font-weight: 600;
}

.error-text {
  color: var(--red);
  font-size: 13px;
  margin-top: 10px;
}

/* ---------- Detail page ---------- */
.detail-head {
  display: flex;
  gap: 16px;
  margin: 26px 0 20px;
}

.detail-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
  line-height: 1.25;
}

.detail-body {
  color: var(--text);
  font-size: 15.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.comment {
  border-top: 1px solid var(--border);
  padding: 16px 0;
}

.comment-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 6px;
}

.comment-head .avatar {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  image-rendering: pixelated;
}

.comment-author {
  font-weight: 700;
}

.comment-body {
  color: var(--text-dim);
  font-size: 14.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  margin-top: 24px;
}

.back-link:hover {
  color: var(--text);
}

.admin-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 18px 0;
  font-size: 13px;
}

.admin-bar select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 6px 10px;
  font-weight: 600;
}

.loading-page {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-faint);
}

@media (max-width: 560px) {
  .hero h1 {
    font-size: 27px;
  }
  .brand small {
    display: none;
  }
}
