:root {
  --bg: #0f1220;
  --bg-card: #171b2e;
  --border: #2a2f45;
  --text: #e7e9f5;
  --text-dim: #9aa0c0;
  --accent: #6c5ce7;
  --accent-hover: #5849c9;
  --danger: #e74c3c;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
}
.logo { font-weight: 700; font-size: 1.2rem; color: var(--text); }
.site-header nav { display: flex; gap: 18px; align-items: center; }

/* Page head */
.page-head { padding: 32px 0 16px; }
.page-head h1 { margin: 0 0 6px; }
.subtitle { color: var(--text-dim); margin: 0 0 20px; }
.admin-head { display: flex; justify-content: space-between; align-items: center; }

.search-form { display: flex; gap: 8px; max-width: 420px; }
.search-form input {
  flex: 1;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
}
.search-form button, button, .button {
  padding: 10px 16px;
  border-radius: var(--radius);
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}
.search-form button:hover, button:hover, .button:hover { background: var(--accent-hover); }
.button.secondary { background: transparent; border: 1px solid var(--border); color: var(--text); }

/* Article list */
.article-list { padding: 10px 0 40px; display: flex; flex-direction: column; gap: 18px; }
.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.article-card h2 { margin: 0 0 6px; font-size: 1.25rem; }
.meta { color: var(--text-dim); font-size: 0.85rem; margin: 0 0 10px; }
.excerpt { color: var(--text-dim); margin: 0 0 10px; white-space: pre-line; }
.read-more { font-weight: 600; }
.empty { color: var(--text-dim); padding: 30px 0; }

/* Article detail */
.article-detail { padding: 10px 0 50px; }
.article-detail h1 { margin-bottom: 6px; }
.content { white-space: pre-line; margin: 20px 0; }

/* Script box */
.script-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 24px 0;
  background: #0a0c17;
}
.script-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.9rem;
}
.copy-btn {
  padding: 6px 14px;
  font-size: 0.85rem;
}
.copy-btn.copied { background: #2ecc71; }
.script-box pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
}
.script-box code {
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.9rem;
  white-space: pre;
}

/* Forms */
.auth-form, .article-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin: 20px 0 50px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 520px;
}
.article-form { max-width: 100%; }
.auth-form label, .article-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  font-size: 0.9rem;
}
.auth-form input, .article-form input, .article-form textarea {
  font-family: inherit;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-weight: 400;
}
.code-textarea { font-family: 'Consolas', 'Courier New', monospace; }
.form-actions { display: flex; gap: 10px; }
.error {
  background: rgba(231, 76, 60, 0.15);
  border: 1px solid var(--danger);
  color: #ff8a80;
  padding: 10px 14px;
  border-radius: 8px;
}

/* Admin table */
.admin-table-wrap { padding: 10px 0 50px; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.admin-table .actions { display: flex; gap: 14px; }

.inline-form { display: inline; }
.link-button {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
  cursor: pointer;
  font-weight: 600;
}
.link-button:hover { color: var(--accent-hover); text-decoration: underline; }
.link-button.danger { color: var(--danger); }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.85rem;
  padding: 20px 0;
  margin-top: 40px;
}

@media (max-width: 600px) {
  .header-inner { flex-direction: column; gap: 10px; align-items: flex-start; }
}
