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

:root {
  --bg: #f8f9fa;
  --card: #ffffff;
  --text: #2c3e50;
  --text-light: #6b7280;
  --red: #e74c3c;
  --green: #27ae60;
  --accent: #e74c3c;
  --border: #e5e7eb;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --radius: 12px;
}

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

/* Header */
.header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 24px 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.logo p {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 2px;
}

.nav a {
  color: var(--text-light);
  text-decoration: none;
  margin-left: 20px;
  font-size: 0.9rem;
  transition: color 0.2s;
}

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

/* Market Ticker */
.market-ticker {
  max-width: 720px;
  margin: 16px auto 0;
  padding: 0 20px;
}

.ticker-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 0.9rem;
}

.ticker-label { color: var(--text-light); font-size: 0.8rem; }
.ticker-value { font-weight: 600; font-size: 1.05rem; }
.ticker-chg { font-size: 0.85rem; font-weight: 600; }
.ticker-chg.up { color: var(--red); }
.ticker-chg.down { color: var(--green); }

/* Main Content */
.main {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

/* Posts */
.post-list { display: flex; flex-direction: column; gap: 16px; }

.post-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.15s;
}

.post-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

.post-date {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-bottom: 6px;
}

.post-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.post-summary {
  font-size: 0.92rem;
  color: var(--text-light);
  line-height: 1.6;
  margin-bottom: 10px;
}

.post-tags { display: flex; gap: 8px; }

.tag {
  font-size: 0.75rem;
  padding: 2px 10px;
  background: #fef2f2;
  color: var(--red);
  border-radius: 20px;
  font-weight: 500;
}

/* Post Detail Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 100;
  justify-content: center;
  align-items: flex-start;
  padding: 60px 20px;
  overflow-y: auto;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--card);
  border-radius: var(--radius);
  max-width: 680px;
  width: 100%;
  padding: 32px;
  position: relative;
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  border: none;
  background: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text-light);
  padding: 4px 8px;
  border-radius: 6px;
}

.modal-close:hover { background: var(--bg); }

.modal-date {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 8px;
}

.modal-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}

.modal-content {
  font-size: 0.95rem;
  line-height: 1.85;
  color: var(--text);
  white-space: pre-wrap;
}

.modal-content strong {
  color: var(--text);
}

.modal-tags {
  margin-top: 20px;
  display: flex;
  gap: 8px;
}

/* Add Post Button */
.add-post {
  margin-top: 24px;
  text-align: center;
}

.add-btn {
  padding: 10px 24px;
  border: 2px dashed var(--border);
  background: var(--card);
  border-radius: var(--radius);
  color: var(--text-light);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

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

.tools-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 12px;
}

.tool-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 8px;
  color: var(--text-light);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

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

/* Footer */
.footer {
  text-align: center;
  padding: 24px;
  color: var(--text-light);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

/* Code block for demo */
.highlight {
  background: #fef2f2;
  padding: 12px 16px;
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  margin: 12px 0;
  line-height: 1.5;
  overflow-x: auto;
}

/* Editor */
.editor-heading {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text);
}

.editor-field { margin-bottom: 16px; }

.editor-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 6px;
  font-weight: 500;
}

.editor-input, .editor-input-date {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.2s;
}

.editor-input:focus, .editor-textarea:focus, .editor-input-date:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--card);
}

.editor-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  resize: vertical;
  line-height: 1.7;
  transition: border-color 0.2s;
}

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

.btn-save, .btn-save-to-file, .btn-copy {
  padding: 10px 6px;
  border: none;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  text-align: center;
}

.btn-save {
  flex: 1.2;
  background: var(--accent);
  color: #fff;
}

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

.btn-save-to-file {
  flex: 1.2;
  background: #2563eb;
  color: #fff;
}

.btn-save-to-file:hover { opacity: 0.9; }

.btn-copy {
  flex: 0.8;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-copy:hover { background: var(--border); }

.editor-hint {
  margin-top: 16px;
  padding: 12px 14px;
  background: #fefce8;
  border-radius: 8px;
  font-size: 0.82rem;
  color: #92400e;
  line-height: 1.7;
}

.editor-hint code {
  background: #fef3c7;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
}

.editor-msg {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
}

.editor-msg.success { background: #ecfdf5; color: #065f46; }
.editor-msg.info { background: #eff6ff; color: #1e40af; }

/* Post detail actions */
.modal-actions {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.btn-edit, .btn-delete {
  padding: 8px 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-edit {
  background: var(--card);
  color: var(--text);
}

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

.btn-delete {
  background: var(--card);
  color: #ef4444;
  border-color: #fecaca;
}

.btn-delete:hover { background: #fef2f2; }

/* Password Modal */
.password-modal h2 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.password-desc {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 16px;
}

/* Responsive */
@media (max-width: 600px) {
  .header-inner { flex-direction: column; gap: 8px; }
  .nav a { margin: 0 10px; }
  .ticker-card { gap: 12px; flex-wrap: wrap; }
  .modal { padding: 20px; margin-top: 20px; }
}
