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

:root {
  --bg:      #080810;
  --surface: #0e0e1a;
  --surface2:#13131f;
  --border:  #1e1e30;
  --accent:  #00e5a0;
  --text:    #e2e2f0;
  --muted:   #666;
  --muted2:  #999;
  --radius:  10px;
  --max-w:   780px;
  --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,16,.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;
}
.nav-left { display: flex; align-items: center; gap: 8px; }
.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; }
.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 { border-color: var(--accent); color: var(--accent); }
.admin-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(0,229,160,.08); }

/* ─── Hero ─── */
.hero {
  padding: calc(var(--nav-h) + 60px) 28px 60px;
  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, 56px);
  font-weight: 700;
  letter-spacing: -2px;
  margin-bottom: 12px;
  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;
}

/* ─── Post List ─── */
.post-list { display: flex; flex-direction: column; gap: 2px; }

.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;
  justify-content: space-between;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .2s;
  gap: 16px;
  background: var(--surface);
  margin-bottom: 10px;
}
.post-card:hover {
  border-color: rgba(0,229,160,.35);
  transform: translateX(4px);
  background: var(--surface2);
}
.post-card-left { flex: 1; min-width: 0; }
.post-card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
  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;
}
.post-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  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: 4px;
}
.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: #ff6b6b; color: #ff6b6b; }

.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: 40px;
  padding: 0;
  transition: color .2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.back-btn:hover { color: var(--accent); }

article .post-meta {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
article .post-meta h1 {
  font-size: clamp(24px, 4vw, 36px);
  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);
}

/* Markdown body */
.post-body { line-height: 1.9; color: #c8c8d8; }
.post-body h1, .post-body h2, .post-body h3 {
  color: var(--text);
  font-weight: 600;
  margin: 32px 0 12px;
  letter-spacing: -.5px;
}
.post-body h2 { font-size: 22px; }
.post-body h3 { font-size: 18px; }
.post-body p  { margin-bottom: 16px; }
.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: 20px;
  overflow-x: auto;
  margin: 20px 0;
}
.post-body pre code {
  background: none;
  border: none;
  padding: 0;
  color: #c8c8d8;
}
.post-body ul, .post-body ol {
  padding-left: 24px;
  margin-bottom: 16px;
}
.post-body li { margin-bottom: 4px; }
.post-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 8px 16px;
  color: var(--muted2);
  margin: 16px 0;
  background: var(--surface);
  border-radius: 0 6px 6px 0;
}
.post-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}
.post-body img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin: 16px 0;
}

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

.write-input-title {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 18px;
  font-weight: 600;
  outline: none;
  margin-bottom: 16px;
  transition: border-color .2s;
}
.write-input-title:focus { border-color: var(--accent); }
.write-input-title::placeholder { color: var(--muted); }

.editor-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.editor-tabs {
  display: flex;
  align-items: center;
  gap: 0;
  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: 420px;
  background: var(--surface);
  border: none;
  padding: 20px;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  line-height: 1.8;
  resize: vertical;
  outline: none;
  display: block;
}
.write-textarea::placeholder { color: var(--muted); }

.write-preview {
  min-height: 420px;
  padding: 20px;
  background: var(--surface);
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 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 Panel ─── */
.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: 260px;
  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 { display: flex; flex-direction: column; gap: 8px; }
#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: 600px) {
  .write-header { flex-direction: column; align-items: flex-start; }
  .footer-inner { flex-direction: column; gap: 6px; text-align: center; align-items: center; }
}
