:root {
  --bg: #12151c;
  --panel: #1b2029;
  --panel2: #232a36;
  --line: #2e3745;
  --text: #e8ecf2;
  --muted: #8d99ab;
  --accent: #5bd16b;
  --accent-dark: #3a9b49;
  --up: #ff7a3d;
  --down: #6a8dff;
  --danger: #ff6b6b;
  --radius: 6px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", "Noto Sans SC", "Noto Sans Devanagari", sans-serif;
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: var(--panel); border-bottom: 2px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 22px; color: var(--text); letter-spacing: .5px; }
.logo:hover { text-decoration: none; }
.logo-block {
  width: 22px; height: 22px; background: var(--accent);
  border: 2px solid var(--accent-dark); box-shadow: inset -4px -4px 0 rgba(0,0,0,.2), inset 3px 3px 0 rgba(255,255,255,.25);
}
.topbar-right { display: flex; align-items: center; gap: 10px; }
#userbox { display: flex; align-items: center; gap: 8px; font-size: 14px; }

.layout { max-width: 1020px; margin: 0 auto; padding: 16px; display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; }
@media (max-width: 800px) { .layout { grid-template-columns: 1fr; } #side { order: 2; } }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.card h2, .card h3 { margin: 0 0 8px; }
.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--danger); font-size: 14px; margin: 6px 0; min-height: 1em; }

input, textarea, select {
  width: 100%; background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 8px 10px; font: inherit; margin-bottom: 8px;
}
select#lang { width: auto; margin: 0; padding: 4px 8px; }
textarea { min-height: 90px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent-dark); }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 2px; }

button, .btn {
  background: var(--accent); color: #0c1a0f; border: 0; border-radius: var(--radius);
  padding: 8px 14px; font: inherit; font-weight: 700; cursor: pointer; display: inline-block;
}
button:hover, .btn:hover { background: #74e083; text-decoration: none; }
button.ghost, .btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
button.ghost:hover { background: var(--panel2); }
button.small { padding: 3px 8px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }

.tabs { display: flex; gap: 6px; margin-bottom: 12px; align-items: center; flex-wrap: wrap; }
.tabs .spacer { flex: 1; }
.tab { padding: 6px 12px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); color: var(--text); font-size: 14px; }
.tab.active { background: var(--accent); color: #0c1a0f; border-color: var(--accent); font-weight: 700; }
.tab:hover { text-decoration: none; }

.post { display: flex; gap: 12px; }
.votes { display: flex; flex-direction: column; align-items: center; min-width: 36px; user-select: none; }
.votes button { background: none; border: 0; color: var(--muted); font-size: 18px; padding: 0 4px; line-height: 1.2; cursor: pointer; }
.votes button:hover { color: var(--text); background: none; }
.votes button.up.on { color: var(--up); }
.votes button.down.on { color: var(--down); }
.votes .score { font-weight: 700; font-size: 14px; }
.votes.small button { font-size: 14px; }
.post-main { flex: 1; min-width: 0; }
.post-title { font-size: 18px; font-weight: 700; color: var(--text); word-break: break-word; }
.post-meta { color: var(--muted); font-size: 12.5px; margin-bottom: 4px; }
.post-body { white-space: pre-wrap; word-break: break-word; margin: 6px 0; }
.post-img { max-width: 100%; max-height: 420px; border-radius: var(--radius); border: 1px solid var(--line); display: block; margin: 8px 0; }
.post-foot { font-size: 13px; color: var(--muted); }

.comment { margin-top: 10px; display: flex; gap: 8px; }
.comment-main { flex: 1; min-width: 0; }
.children { border-left: 2px solid var(--line); margin-left: 4px; padding-left: 12px; }
.comment-body { white-space: pre-wrap; word-break: break-word; }
.comment-actions { font-size: 12.5px; margin-top: 2px; }
.comment-actions button { background: none; color: var(--muted); padding: 0 6px 0 0; font-weight: 600; font-size: 12.5px; }
.comment-actions button:hover { color: var(--text); background: none; }
.reply-form { margin-top: 6px; }

.side-list a { display: flex; justify-content: space-between; padding: 5px 0; color: var(--text); border-bottom: 1px solid var(--line); }
.side-list a:last-child { border-bottom: 0; }
.side-list a:hover { color: var(--accent); text-decoration: none; }
.badge { background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; font-size: 12px; color: var(--muted); }
.bloxd-tag { color: var(--accent); }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--panel2); border: 1px solid var(--line); padding: 10px 16px; border-radius: var(--radius); z-index: 20;
}
