* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background-color: #050508;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  color: #c8b8de;
  font-family: 'MS Gothic', 'MS PGothic', 'DotGothic16', monospace;
  cursor: crosshair;
  min-height: 100vh;
  overflow-x: hidden;
  font-size: 13px;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.65) 60%, rgba(0,0,0,0.96) 100%);
  z-index: 1;
  pointer-events: none;
}
a, button { cursor: crosshair; }

/* ── scanlines ───────────────────────────────────────────────────── */
.scanlines {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(0deg, transparent 0px, transparent 2px, rgba(192,132,252,0.025) 3px, transparent 4px);
  pointer-events: none;
  z-index: 6;
  mix-blend-mode: screen;
}

/* ── candle procession ───────────────────────────────────────────── */
.candle-row {
  position: fixed;
  left: 0;
  right: 0;
  bottom: -9px;
  z-index: 10;
  pointer-events: none;
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  padding: 0 2vw;
}

.candle {
  width: clamp(110px, 14vw, 180px);
  height: auto;
  flex: 0 1 auto;
  opacity: .72;
  mix-blend-mode: screen;
  filter: brightness(.82) saturate(.9) drop-shadow(0 0 9px rgba(255,96,40,.2));
  animation: candle-float 5.8s ease-in-out infinite;
  transform-origin: 50% 100%;
}
.candle:nth-child(2) { animation-delay: -1.4s; }
.candle:nth-child(3) { animation-delay: -2.9s; }
.candle:nth-child(4) { animation-delay: -4.3s; }
.candle:nth-child(5) { animation-delay: -2.1s; }

@keyframes candle-float {
  0%, 100% { transform: translateY(3px); }
  50% { transform: translateY(-5px); }
}

@media (max-width: 560px) {
  .candle-row { padding: 0; }
  .candle { width: 19vw; }
}

@media (prefers-reduced-motion: reduce) {
  .candle { animation: none; }
}

/* ── loading screen ──────────────────────────────────────────────── */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #050508;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'MS Gothic', 'DotGothic16', monospace;
  color: #4a3c58;
  font-size: .85rem;
  letter-spacing: 2px;
}

/* ── auth overlay ────────────────────────────────────────────────── */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.94);
}

.auth-box {
  background: #07050b;
  border: 1px solid #2a1a3a;
  padding: 24px 28px;
  width: 100%;
  max-width: 340px;
}

.auth-logo {
  font-family: 'MS Gothic', 'DotGothic16', monospace;
  color: #C084FC;
  font-size: .95rem;
  text-align: center;
  margin-bottom: 4px;
  letter-spacing: 2px;
  border-bottom: 1px solid #2a1a3a;
  padding-bottom: 12px;
}
.auth-sub {
  text-align: center;
  color: #4a3c58;
  font-size: .72rem;
  margin: 8px 0 16px;
  letter-spacing: 1px;
}

.auth-tabs {
  display: flex;
  border-bottom: 1px solid #2a1a3a;
  margin-bottom: 14px;
}
.auth-tab {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: #5a4c68;
  font-family: 'MS Gothic', 'DotGothic16', monospace;
  font-size: .85rem;
  padding: 7px 0;
  transition: color .15s;
}
.auth-tab.active { color: #C084FC; border-bottom-color: #C084FC; }
.auth-tab:hover  { color: #C084FC; }

.auth-form input {
  display: block;
  width: 100%;
  background: #07050b;
  border: 1px solid #2a1a3a;
  color: #C084FC;
  padding: 7px 9px;
  font-family: 'MS Gothic', 'DotGothic16', monospace;
  font-size: .82rem;
  outline: none;
  margin-bottom: 8px;
}
.auth-form input:focus { border-color: #7a4fa8; }
.auth-submit { width: 100%; margin-top: 2px; }

.auth-error {
  color: #6b2e2e;
  font-size: .75rem;
  min-height: 1em;
  margin-bottom: 6px;
}

/* ── main layout ─────────────────────────────────────────────────── */
.wrap {
  position: relative;
  z-index: 2;
  max-width: 1060px;
  margin: 0 auto;
  padding: 14px 12px 50px;
}

header { text-align: center; margin-bottom: 14px; }

.board-header {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  margin: 6px 0 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid #2a1a3a;
  font-weight: normal;
}
.board-id   { color: #8e7d9b; font-size: .95rem; letter-spacing: 1px; }
.board-sep  { color: #5a4c68; font-size: .85rem; }
.board-name { color: #C084FC; font-size: .95rem; letter-spacing: 1px; }

.user-bar {
  font-size: .78rem;
  color: #7a6888;
  margin-bottom: 8px;
}
.user-bar span { color: #a890c0; margin-right: 8px; }
.btn-inline {
  background: none;
  border: none;
  color: #7a6888;
  font-family: 'MS Gothic', 'DotGothic16', monospace;
  font-size: .78rem;
  padding: 0;
  transition: color .15s;
}
.btn-inline:hover { color: #C084FC; }

nav { margin-bottom: 16px; border-bottom: 1px solid #1a0f24; padding-bottom: 10px; }
.nav-link {
  color: #9a88ac;
  text-decoration: none;
  margin: 0 6px;
  font-size: .85rem;
  transition: color .15s;
  display: inline-block;
}
.nav-link:hover { color: #baadd0; }
.nav-link.active { color: #C084FC; }

/* ── grid ────────────────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 14px;
  align-items: start;
}
@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { order: -1; }
  #irc-log { height: 380px; }
}

.main-box {
  background: rgba(5,3,8,.9);
  border: 1px solid #1d1129;
  min-height: 500px;
}
.sidebar {
  background: rgba(5,3,8,.9);
  border: 1px solid #1d1129;
  padding: 12px;
}

/* ── sidebar ─────────────────────────────────────────────────────── */
.sidebar h2 {
  color: #9a88ac;
  font-size: .78rem;
  margin: 0 0 8px;
  letter-spacing: 1px;
  border-bottom: 1px solid #1d1129;
  padding-bottom: 6px;
  text-transform: uppercase;
}
.user {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #a898c0;
  font-size: .82rem;
  padding: 3px 0;
  border-bottom: 1px solid #160e20;
}
.user:last-child { border-bottom: none; }
.user:hover { color: #C084FC; }
.presence-glyph {
  color: #7a4f8a;
  font-size: .8rem;
  flex-shrink: 0;
}
#sidebar-count {
  margin-top: 8px;
  color: #6a5877;
  font-size: .72rem;
  border-top: 1px solid #1d1129;
  padding-top: 8px;
  text-align: center;
}

/* ── pages ───────────────────────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from {opacity:0} to {opacity:1} }

/* ── chan board (chat) ────────────────────────────────────────────── */
#irc-log {
  height: 460px;
  overflow-y: auto;
  background: rgba(0,0,0,.5);
}
#irc-log::-webkit-scrollbar { width: 5px; }
#irc-log::-webkit-scrollbar-thumb { background: #2a1a3a; }

.chan-post {
  padding: 6px 12px 7px;
  border-bottom: 1px solid #110819;
}
.chan-post:hover { background: rgba(192,132,252,.03); }
.chan-post:first-child { border-top: none; }

.chan-meta {
  margin-bottom: 3px;
  font-size: .77rem;
  line-height: 1.3;
}
.chan-name  { color: #C084FC; margin-right: 8px; }
.chan-stamp { color: #4a3a58; margin-right: 6px; }
.chan-num   { color: #5a4a6a; }
.chan-body  {
  color: #baadd0;
  font-size: .88rem;
  line-height: 1.5;
  word-break: break-word;
}

/* ── chan post form ───────────────────────────────────────────────── */
.chan-form {
  background: rgba(0,0,0,.35);
  border-top: 1px solid #120a1a;
  padding: 8px 10px;
}
.chan-form-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0;
}
.chan-form-label {
  color: #5a4c68;
  font-size: .75rem;
  width: 32px;
  flex-shrink: 0;
}
.chan-field {
  background: #07050b;
  border: 1px solid #2a1a3a;
  color: #C084FC;
  padding: 5px 7px;
  font-family: 'MS Gothic', 'DotGothic16', monospace;
  font-size: .82rem;
  outline: none;
}
.chan-field:focus { border-color: #6a3a8a; }
.chan-field-name { width: 140px; flex-shrink: 0; }
.chan-field-msg  { flex: 1; }

.chan-btn {
  background: #0e0914;
  border: 1px solid #2a1a3a;
  color: #9a80b0;
  padding: 5px 10px;
  font-family: 'MS Gothic', 'DotGothic16', monospace;
  font-size: .82rem;
  transition: all .15s;
  white-space: nowrap;
}
.chan-btn:hover { color: #C084FC; border-color: #5a3a7a; }

/* ── shared btn ──────────────────────────────────────────────────── */
.btn {
  background: #0e0914;
  border: 1px solid #2a1a3a;
  color: #9a80b0;
  padding: 5px 11px;
  font-family: 'MS Gothic', 'DotGothic16', monospace;
  font-size: .82rem;
  transition: all .15s;
}
.btn:hover { color: #C084FC; border-color: #5a3a7a; }

/* ── forum ───────────────────────────────────────────────────────── */
.forum-list-wrap { padding: 12px 14px; }
.forum-title {
  color: #9a80b0;
  font-size: .9rem;
  text-align: center;
  margin: 0 0 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  border-bottom: 1px solid #1d1129;
  padding-bottom: 8px;
}

.category {
  margin-bottom: 18px;
  border: 1px solid #1a0f24;
}
.cat-head {
  padding: 6px 10px;
  background: rgba(10,6,16,.9);
  border-bottom: 1px solid #1a0f24;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.cat-head h3 {
  margin: 0;
  color: #C084FC;
  font-size: .85rem;
  font-weight: normal;
  letter-spacing: 1px;
}
.cat-head p { margin: 0; color: #4a3c58; font-size: .72rem; }

.forum-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.forum-table th {
  text-align: left;
  padding: 5px 10px;
  color: #5a4c68;
  font-weight: normal;
  border-bottom: 1px solid #1d1129;
  background: rgba(0,0,0,.3);
}
.forum-table td { padding: 7px 10px; border-bottom: 1px solid #100a18; }
.forum-table tr:last-child td { border-bottom: none; }
.forum-table tr:hover td { background: rgba(192,132,252,.025); }

.topic-link {
  color: #C084FC;
  text-decoration: none;
}
.topic-link:hover { text-decoration: underline; text-decoration-color: #5a3a7a; }
.meta        { color: #5a4c68; }
.empty-row   { color: #4a3c58; font-style: italic; font-size: .78rem; text-align: center; padding: 10px; }
.loading-row { color: #4a3c58; font-style: italic; font-size: .78rem; padding: 8px 10px; }

/* ── thread view ─────────────────────────────────────────────────── */
.thread-view-wrap { padding: 12px 14px; }
.thread-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 8px;
  flex-wrap: wrap;
  border-bottom: 1px solid #1d1129;
  padding-bottom: 8px;
}
#thread-title { color: #C084FC; font-size: .9rem; }

.reply-area { margin-top: 10px; border-top: 1px solid #1d1129; padding-top: 10px; }
.reply-area textarea {
  width: 100%;
  background: #07050b;
  border: 1px solid #2a1a3a;
  color: #C084FC;
  padding: 7px 8px;
  font-family: 'MS Gothic', 'DotGothic16', monospace;
  font-size: .82rem;
  outline: none;
  min-height: 70px;
  resize: vertical;
}
.reply-area textarea:focus { border-color: #6a3a8a; }

/* ── new topic modal ─────────────────────────────────────────────── */
#new-topic-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.9);
  z-index: 50;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-box {
  background: #07050b;
  border: 1px solid #2a1a3a;
  padding: 18px;
  width: 100%;
  max-width: 460px;
}
.modal-box h3 {
  margin: 0 0 14px;
  color: #9a80b0;
  font-size: .88rem;
  font-weight: normal;
  letter-spacing: 1px;
  text-transform: uppercase;
  border-bottom: 1px solid #1d1129;
  padding-bottom: 8px;
}

.form-row { margin-bottom: 8px; }
.form-input, .form-textarea, .form-select {
  width: 100%;
  background: #07050b;
  border: 1px solid #2a1a3a;
  color: #C084FC;
  padding: 6px 8px;
  font-family: 'MS Gothic', 'DotGothic16', monospace;
  font-size: .82rem;
  outline: none;
}
.form-textarea { min-height: 90px; resize: vertical; }
.form-input:focus, .form-textarea:focus, .form-select:focus { border-color: #6a3a8a; }

/* ── about ───────────────────────────────────────────────────────── */
.about-wrap { padding: 16px 18px; }
.about-content { color: #a898c0; line-height: 1.7; max-width: 600px; margin: 0 auto; font-size: .88rem; }
.about-content h2 { color: #C084FC; font-size: .9rem; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 14px; }

/* ── links (graves) ──────────────────────────────────────────────── */
.links-wrap { padding: 16px 18px; }
.graves { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; margin-top: 14px; }
.grave-link {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 120px;
  height: 100px;
  background: #07050b;
  border: 1px solid #2a1a3a;
  border-radius: 60px 60px 8px 8px / 40px 40px 8px 8px;
  color: #9a80b0;
  text-decoration: none;
  font-size: .75rem;
  padding: 10px;
  line-height: 1.3;
  transition: all .2s;
}
.grave-link:hover {
  border-color: #5a3a7a;
  color: #C084FC;
  transform: translateY(-3px);
}

/* ── footer ──────────────────────────────────────────────────────── */
footer {
  text-align: center;
  margin-top: 22px;
  color: #3a2e48;
  font-size: .72rem;
  letter-spacing: 1px;
}

.scene-btn {
  display: block;
  margin: 7px auto 0;
  padding: 2px 5px;
  border: 0;
  background: transparent;
  color: #625170;
  font: inherit;
  letter-spacing: inherit;
}
.scene-btn:hover,
.scene-btn:focus-visible {
  color: #C084FC;
  outline: 1px dotted #7a4fa8;
  outline-offset: 2px;
}
