*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:      #08080f;
  --surface: #0d0d1a;
  --surface2:#111120;
  --border:  #1c1c30;
  --accent:  #818cf8;
  --accent2: #a78bfa;
  --text:    #e2e2f0;
  --muted:   #555;
  --muted2:  #888;
  --radius:  10px;
  --max-w:   860px;
  --nav-h:   58px;
}

html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
.mono   { font-family: 'JetBrains Mono', monospace; }
.accent { color: var(--accent); }
.muted  { color: var(--muted2); }

/* ─── Nav ─── */
#nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 100;
  background: rgba(8,8,15,.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  height: 100%;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.nav-left { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-home { font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--muted2); transition: color .2s; }
.nav-home:hover { color: var(--text); }
.nav-sep { color: var(--muted); font-size: 14px; }
.nav-logo { font-family: 'JetBrains Mono', monospace; font-size: 15px; font-weight: 600; }

.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  transition: border-color .2s;
  color: var(--muted2);
}
.search-wrap:focus-within { border-color: var(--accent); color: var(--accent); }
.search-wrap input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  width: 160px;
}
.search-wrap input::placeholder { color: var(--muted2); }

.admin-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted2);
  cursor: pointer;
  border-radius: 8px;
  padding: 6px 10px;
  transition: all .2s;
  display: flex; align-items: center;
}
.admin-btn:hover, .admin-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(129,140,248,.08); }

/* ─── Hero ─── */
.hero {
  padding: calc(var(--nav-h) + 60px) 28px 48px;
  max-width: var(--max-w);
  margin: 0 auto;
}
.hero-tag { font-size: 12px; letter-spacing: .1em; margin-bottom: 16px; opacity: .7; }
.hero h1 {
  font-size: clamp(32px, 6vw, 52px);
  font-weight: 700;
  letter-spacing: -2px;
  margin-bottom: 10px;
  background: linear-gradient(135deg, #fff 30%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p { color: var(--muted2); font-size: 15px; }

/* ─── Container ─── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 28px 80px;
}

/* ─── Category Tabs ─── */
.cat-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}
.cat-tab {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted2);
  font-size: 13px;
  padding: 6px 16px;
  border-radius: 100px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all .2s;
}
.cat-tab:hover { border-color: var(--accent); color: var(--accent); }
.cat-tab.active { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }

/* ─── Post List ─── */
.post-list { display: flex; flex-direction: column; gap: 10px; }
.loading { padding: 60px 0; text-align: center; color: var(--muted2); font-size: 13px; }
.dots { animation: blink 1s steps(3) infinite; }
@keyframes blink { to { opacity: 0; } }

.post-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .2s;
}
.post-card:hover {
  border-color: rgba(129,140,248,.4);
  transform: translateX(4px);
  background: var(--surface2);
}
.post-card-left { flex: 1; min-width: 0; }
.post-card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.post-card-title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-card-excerpt { font-size: 13px; color: var(--muted2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
  background: rgba(129,140,248,.12);
  color: var(--accent);
  border: 1px solid rgba(129,140,248,.25);
  white-space: nowrap;
  flex-shrink: 0;
}
.post-card-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.post-card-date { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--muted); }
.post-card-arrow { color: var(--muted); font-size: 14px; transition: color .2s; }
.post-card:hover .post-card-arrow { color: var(--accent); }

.post-card-actions { display: flex; gap: 6px; margin-top: 6px; }
.post-action-btn {
  background: none; border: 1px solid var(--border); color: var(--muted2);
  font-size: 11px; padding: 2px 10px; border-radius: 6px; cursor: pointer;
  font-family: 'Inter', sans-serif; transition: all .2s;
}
.post-action-btn:hover { border-color: var(--accent); color: var(--accent); }
.post-action-btn.del:hover { border-color: #f87171; color: #f87171; }

.empty-state {
  text-align: center; padding: 80px 0; color: var(--muted2);
  font-family: 'JetBrains Mono', monospace; font-size: 13px;
  border: 1px dashed var(--border); border-radius: var(--radius);
}

/* ─── Post Detail ─── */
.post-container { padding-top: calc(var(--nav-h) + 40px); }
.back-btn {
  background: none; border: none; color: var(--muted2); font-size: 13px;
  cursor: pointer; font-family: 'Inter', sans-serif; margin-bottom: 36px;
  padding: 0; transition: color .2s;
}
.back-btn:hover { color: var(--accent); }

article .post-meta { margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
article .post-meta-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
article .post-meta h1 { font-size: clamp(22px, 4vw, 34px); font-weight: 700; letter-spacing: -1px; margin-bottom: 10px; line-height: 1.2; }
article .post-meta-date { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted2); }

.post-body { line-height: 1.9; color: #c0c0d8; }
.post-body h1,.post-body h2,.post-body h3 { color: var(--text); font-weight: 600; margin: 28px 0 10px; letter-spacing: -.5px; }
.post-body h2 { font-size: 20px; }
.post-body h3 { font-size: 17px; }
.post-body p  { margin-bottom: 14px; }
.post-body a  { color: var(--accent); text-decoration: underline; }
.post-body strong { color: var(--text); }
.post-body code {
  font-family: 'JetBrains Mono', monospace; font-size: 13px;
  background: var(--surface2); border: 1px solid var(--border);
  padding: 2px 6px; border-radius: 4px; color: var(--accent);
}
.post-body pre {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 18px; overflow-x: auto; margin: 16px 0;
}
.post-body pre code { background: none; border: none; padding: 0; color: #c0c0d8; }
.post-body ul,.post-body ol { padding-left: 22px; margin-bottom: 14px; }
.post-body li { margin-bottom: 4px; }
.post-body blockquote { border-left: 3px solid var(--accent); padding: 8px 16px; color: var(--muted2); margin: 14px 0; background: var(--surface); border-radius: 0 6px 6px 0; }
.post-body hr { border: none; border-top: 1px solid var(--border); margin: 28px 0; }
.post-body img { max-width: 100%; border-radius: 8px; border: 1px solid var(--border); margin: 14px 0; }

/* ─── Links & Files ─── */
.section-divider { height: 1px; background: var(--border); margin: 40px 0 28px; }
.section-label { font-size: 13px; color: var(--accent); margin-bottom: 16px; }

.links-list { display: flex; flex-direction: column; gap: 8px; }
.link-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; transition: all .2s; color: var(--text);
}
.link-item:hover { border-color: var(--accent); color: var(--accent); }
.link-item svg { flex-shrink: 0; }
.link-item-label { font-size: 14px; font-weight: 500; flex: 1; }
.link-item-url { font-size: 12px; color: var(--muted2); font-family: 'JetBrains Mono', monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }

.files-list { display: flex; flex-wrap: wrap; gap: 10px; }
.file-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; transition: all .2s; color: var(--text); font-size: 13px;
}
.file-item:hover { border-color: var(--accent); color: var(--accent); }

/* ─── Comments ─── */
.comment-form { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.comment-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.comment-input {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 13px; color: var(--text);
  font-family: 'Inter', sans-serif; font-size: 14px; outline: none; transition: border-color .2s;
}
.comment-input:focus { border-color: var(--accent); }
.comment-input::placeholder { color: var(--muted2); }
textarea.comment-input { resize: vertical; min-height: 80px; margin-bottom: 10px; }

.comment-list { display: flex; flex-direction: column; gap: 12px; }
.comment-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.comment-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.comment-author { font-size: 14px; font-weight: 600; }
.comment-right { display: flex; align-items: center; gap: 10px; }
.comment-date { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--muted2); }
.comment-del { background: none; border: none; color: var(--muted); font-size: 11px; cursor: pointer; padding: 2px 6px; border-radius: 4px; transition: color .2s; }
.comment-del:hover { color: #f87171; }
.comment-body { font-size: 14px; color: var(--muted2); line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.comment-empty { text-align: center; padding: 30px; color: var(--muted2); font-family: 'JetBrains Mono', monospace; font-size: 12px; border: 1px dashed var(--border); border-radius: var(--radius); }

/* ─── Write ─── */
.write-container { padding-top: calc(var(--nav-h) + 40px); }
.write-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; gap: 16px; }
.write-header h2 { font-size: 22px; font-weight: 600; }
.write-actions { display: flex; gap: 10px; }

.write-top-row { display: grid; grid-template-columns: 1fr 160px; gap: 12px; margin-bottom: 16px; }
.write-input-title {
  width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px; color: var(--text);
  font-family: 'Inter', sans-serif; font-size: 17px; font-weight: 600;
  outline: none; transition: border-color .2s;
}
.write-input-title:focus { border-color: var(--accent); }
.write-input-title::placeholder { color: var(--muted); }

.write-select {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px; color: var(--text);
  font-family: 'Inter', sans-serif; font-size: 14px; outline: none;
  cursor: pointer; transition: border-color .2s;
}
.write-select:focus { border-color: var(--accent); }

.editor-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; }
.editor-tabs { display: flex; align-items: center; background: var(--surface2); border-bottom: 1px solid var(--border); padding: 0 4px; }
.editor-tab { background: none; border: none; color: var(--muted2); font-size: 13px; padding: 10px 16px; cursor: pointer; font-family: 'Inter', sans-serif; transition: color .2s; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.editor-tab.active { color: var(--accent); border-color: var(--accent); }
.editor-hint { margin-left: auto; font-size: 11px; color: var(--muted); padding-right: 12px; }
.write-textarea { width: 100%; min-height: 360px; background: var(--surface); border: none; padding: 18px; color: var(--text); font-family: 'JetBrains Mono', monospace; font-size: 13px; line-height: 1.8; resize: vertical; outline: none; display: block; }
.write-textarea::placeholder { color: var(--muted); }
.write-preview { min-height: 360px; padding: 18px; background: var(--surface); }

.write-section { margin-top: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.write-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.btn-add { background: none; border: 1px solid var(--border); color: var(--accent); font-size: 12px; padding: 4px 12px; border-radius: 6px; cursor: pointer; font-family: 'Inter', sans-serif; transition: all .2s; }
.btn-add:hover { background: rgba(129,140,248,.1); }

.link-input-row { display: grid; grid-template-columns: 1fr 2fr auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.link-input {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; color: var(--text); font-size: 13px; font-family: 'Inter', sans-serif;
  outline: none; transition: border-color .2s; width: 100%;
}
.link-input:focus { border-color: var(--accent); }
.link-input::placeholder { color: var(--muted); }
.link-remove { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 16px; padding: 4px; transition: color .2s; }
.link-remove:hover { color: #f87171; }

.file-upload-area { border: 1px dashed var(--border); border-radius: 8px; transition: border-color .2s; }
.file-upload-area:hover { border-color: var(--accent); }
.file-upload-label { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 24px; cursor: pointer; color: var(--muted2); font-size: 13px; }
.file-upload-label svg { color: var(--accent); }
.file-preview-list { padding: 0 16px 12px; display: flex; flex-direction: column; gap: 6px; }
.file-preview-item { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; background: var(--bg); border-radius: 6px; font-size: 12px; color: var(--muted2); }

/* ─── Buttons ─── */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 20px; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; border: 1px solid transparent; font-family: 'Inter', sans-serif; transition: all .2s; }
.btn-primary { background: var(--accent); color: #000; font-weight: 600; }
.btn-primary:hover { opacity: .85; }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* ─── Admin ─── */
.admin-panel { position: fixed; top: var(--nav-h); right: 16px; z-index: 99; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; min-width: 240px; box-shadow: 0 16px 48px rgba(0,0,0,.5); animation: slideDown .2s ease; }
@keyframes slideDown { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:translateY(0); } }
.admin-inner { display: flex; flex-direction: column; gap: 12px; }
.admin-title { font-size: 12px; letter-spacing: .06em; color: var(--muted2); }
.admin-input { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; color: var(--text); font-size: 14px; font-family: 'Inter', sans-serif; outline: none; transition: border-color .2s; }
.admin-input:focus { border-color: var(--accent); }
#adminLoginArea,#adminLoggedArea { display: flex; flex-direction: column; gap: 8px; }

/* ─── Footer ─── */
footer { border-top: 1px solid var(--border); padding: 24px 0; }
.footer-inner { max-width: var(--max-w); margin: 0 auto; padding: 0 28px; display: flex; justify-content: space-between; font-size: 12px; }
.footer-inner a:hover { color: var(--accent); }

@media (max-width: 640px) {
  .write-top-row { grid-template-columns: 1fr; }
  .comment-row { grid-template-columns: 1fr; }
  .link-input-row { grid-template-columns: 1fr auto; }
  .link-input-row .link-input:last-of-type { grid-column: 1 / -1; }
  .search-wrap input { width: 100px; }
}
