:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --text: #e0e0e0;
  --muted: #888;
  --accent: #4a9eff;
  --danger: #ff4a4a;
  --border: #333;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

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

a:hover {
  text-decoration: underline;
}

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

header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 20px;
  margin-bottom: 40px;
}

header h1 {
  font-size: 1.8rem;
  margin-bottom: 10px;
}

header nav a {
  margin-right: 20px;
  font-size: 0.9rem;
  color: var(--muted);
}

header nav a:hover {
  color: var(--text);
}

.search-bar {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 30px;
  outline: none;
}

.search-bar:focus {
  border-color: var(--accent);
}

.post-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.post-card:hover {
  border-color: var(--accent);
}

.post-card h2 {
  font-size: 1.3rem;
  margin-bottom: 8px;
}

.post-card .date {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.post-card .excerpt {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.post-card .excerpt:empty {
  display: none;
}

/* Blog view */
.back-link {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--muted);
}

.back-link:hover {
  color: var(--text);
}

.post-title {
  font-size: 2rem;
  margin-bottom: 10px;
  line-height: 1.3;
}

.post-meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.post-content {
  font-size: 1.05rem;
  line-height: 1.8;
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 10px 0;
}

.post-content p {
  margin-bottom: 16px;
}

.post-content a {
  color: var(--accent);
}

.post-actions {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
}

.btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: none;
  display: inline-block;
}

.btn:hover {
  border-color: var(--accent);
}

.btn-danger {
  border-color: var(--danger);
  color: var(--danger);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.btn-primary:hover {
  opacity: 0.9;
}

/* Editor */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
}

.toolbar button {
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
}

.toolbar button:hover {
  border-color: var(--accent);
}

.toolbar .separator {
  width: 1px;
  background: var(--border);
  margin: 0 4px;
}

#title-input {
  width: 100%;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  color: var(--text);
  font-size: 1.5rem;
  outline: none;
}

#title-input:focus {
  border-color: var(--accent);
}

#editor {
  min-height: 400px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 8px 8px;
  outline: none;
  line-height: 1.8;
  font-size: 1rem;
}

#editor:empty:before {
  content: 'Start writing...';
  color: var(--muted);
}

#editor img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 4px 0;
  cursor: grab;
}

#editor img.resizable {
  resize: both;
  overflow: hidden;
  display: inline-block;
  min-width: 50px;
  min-height: 50px;
  border: 2px solid transparent;
}

#editor img.resizable:focus {
  border-color: var(--accent);
  outline: none;
}

#editor img.float-left {
  float: left;
  margin-right: 16px;
  margin-bottom: 8px;
}

#editor img.float-right {
  float: right;
  margin-left: 16px;
  margin-bottom: 8px;
}

#editor a {
  color: var(--accent);
}

.editor-actions {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

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

.auth-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 360px;
}

.auth-box h2 {
  margin-bottom: 20px;
  font-size: 1.3rem;
}

.auth-box input {
  width: 100%;
  padding: 12px;
  margin-bottom: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 1rem;
  outline: none;
}

.auth-box input:focus {
  border-color: var(--accent);
}

.auth-box button {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: white;
  font-size: 1rem;
  cursor: pointer;
}

.auth-box button:hover {
  opacity: 0.9;
}

.auth-box .error {
  color: var(--danger);
  font-size: 0.9rem;
  margin-top: 12px;
  text-align: center;
}

/* Drag and drop zone */
#editor.drag-over {
  background: #1e2a1e;
  border-color: var(--accent);
}

.hidden {
  display: none !important;
}
