:root {
  --bg: #05060f;
  --bg-soft: #0c1024;
  --panel: #11163180;
  --panel-solid: #121734;
  --line: #2a3470;
  --cyan: #38e1ff;
  --magenta: #ff4fd8;
  --violet: #9b6bff;
  --text: #e8ecff;
  --muted: #8b93c7;
  --good: #4dff9b;
  --danger: #ff6b8a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  min-height: 100%;
}

#starfield {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.container, .site-header, .site-footer {
  position: relative;
  z-index: 1;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 26px;
  background: linear-gradient(180deg, #0a0e22ee, #0a0e2288);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
}
.brand { display: flex; align-items: baseline; gap: 8px; cursor: pointer; }
.logo { color: var(--cyan); font-size: 22px; text-shadow: 0 0 12px var(--cyan); }
.brand-name { font-size: 22px; font-weight: 700; letter-spacing: 2px; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: 1px; }

.top-nav { display: flex; gap: 6px; flex: 1; overflow-x: auto; }
.top-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
}
.top-nav a:hover { color: var(--cyan); background: #38e1ff14; }

.user-box { display: flex; align-items: center; gap: 10px; }
.user-box .uname { color: var(--cyan); font-size: 13px; }

/* Buttons */
.btn {
  border: 1px solid var(--line);
  background: #ffffff08;
  color: var(--text);
  padding: 8px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  transition: .15s;
}
.btn:hover { border-color: var(--cyan); }
.btn.primary { background: linear-gradient(135deg, var(--cyan), var(--violet)); color: #04111f; border: none; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Layout */
.container { max-width: 980px; margin: 24px auto; padding: 0 18px 60px; }
.loading { color: var(--muted); text-align: center; padding: 60px; }

/* Headings */
.page-title { font-size: 22px; letter-spacing: 1px; margin: 6px 0 4px; }
.page-desc { color: var(--muted); font-size: 13px; margin-bottom: 20px; }

/* Board cards */
.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.board-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  transition: .15s;
  position: relative;
  overflow: hidden;
}
.board-card:hover { border-color: var(--cyan); transform: translateY(-3px); box-shadow: 0 0 26px #38e1ff33; }
.board-cover {
  height: 162px;
  background-size: cover;
  background-position: center;
  position: relative;
  display: flex;
  align-items: flex-end;
}
.board-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, #05060ff2 4%, #05060f66 52%, #05060f00 100%);
}
.board-cover-title {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 12px 16px 14px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #fff;
  text-shadow: 0 2px 10px #000c;
}
.board-body { padding: 12px 16px 16px; }
.board-card .desc { color: var(--muted); font-size: 13px; min-height: 34px; line-height: 1.5; }
.board-card .meta { margin-top: 12px; font-size: 12px; color: var(--cyan); }

/* Board hero (detail page) */
.board-hero {
  height: 200px;
  border-radius: 14px;
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
  margin-bottom: 14px;
  border: 1px solid var(--line);
}
.board-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, #05060ff2 6%, #05060f33 60%, #05060f00 100%);
}
.board-hero-title {
  position: absolute;
  z-index: 1;
  left: 18px;
  bottom: 14px;
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 12px #000d;
}

/* Lists */
.list { display: flex; flex-direction: column; gap: 10px; }
.row {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  transition: .15s;
}
.row:hover { border-color: var(--cyan); }
.row .title { font-size: 15px; font-weight: 600; }
.row .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.row .stat { text-align: right; color: var(--muted); font-size: 12px; white-space: nowrap; }

/* Topic view */
.topic-head { border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 16px; }
.topic-head h2 { margin: 0 0 8px; font-size: 20px; }
.post {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}
.post .who { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--violet), var(--cyan)); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: #04111f; }
.post .name { font-weight: 600; }
.post .time { color: var(--muted); font-size: 12px; }
.post .body { line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.reply-form { margin-top: 18px; }
textarea {
  width: 100%;
  min-height: 90px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 12px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}
textarea:focus { outline: none; border-color: var(--cyan); }
.replies-title { margin: 22px 0 10px; font-size: 15px; color: var(--muted); }

/* Forms / modal */
.modal-mask { position: fixed; inset: 0; background: #000a; display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-mask[hidden] { display: none; }
.modal { background: var(--panel-solid); border: 1px solid var(--line); border-radius: 16px; padding: 24px; width: 340px; position: relative; box-shadow: 0 0 40px #38e1ff22; }
.modal-close { position: absolute; top: 12px; right: 14px; background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer; }
.modal-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab { flex: 1; padding: 8px; background: none; border: none; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tab.active { color: var(--cyan); border-bottom-color: var(--cyan); }
.auth-form label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.auth-form label[hidden] { display: none; }
.auth-form input { width: 100%; margin-top: 6px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 9px; padding: 10px; color: var(--text); font-size: 14px; }
.auth-form input:focus { outline: none; border-color: var(--cyan); }
.form-msg { font-size: 12px; min-height: 16px; margin-bottom: 8px; }
.form-msg.err { color: var(--danger); }
.form-msg.ok { color: var(--good); }

/* Toast */
.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: var(--panel-solid); border: 1px solid var(--cyan); color: var(--text); padding: 10px 18px; border-radius: 10px; z-index: 60; font-size: 13px; box-shadow: 0 0 20px #38e1ff33; }

.muted { color: var(--muted); }
.tag { display: inline-block; font-size: 11px; color: var(--cyan); border: 1px solid var(--line); border-radius: 6px; padding: 1px 8px; margin-right: 6px; }
.site-footer { display: flex; justify-content: space-between; padding: 18px 26px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; flex-wrap: wrap; gap: 8px; }
.empty { color: var(--muted); text-align: center; padding: 40px; }
