:root {
  --white: #ffffff;
  --bg: #f6f7f9;
  --sakura: #f2a7b8;
  --sakura-deep: #e58ba0;
  --sakura-light: #fdeef2;
  --sakura-pale: #faf4f5;
  --text: #3a3a3a;
  --text-muted: #8a8a8a;
  --border: #e8eaed;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--sakura-deep); text-decoration: none; }
a:hover { color: var(--sakura-deep); }

/* header */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  max-width: 1100px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-logo { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; }
.brand-name { font-size: 1.3rem; font-weight: 700; color: var(--text); letter-spacing: 1px; }
.top-nav { display: flex; gap: 18px; align-items: center; }
.top-nav a { color: var(--text-muted); font-size: 0.95rem; }
.top-nav a:hover { color: var(--sakura-deep); }

.container { max-width: 1100px; margin: 0 auto; padding: 30px 20px; flex: 1; width: 100%; }

/* flash */
.flash-area { margin-bottom: 20px; }
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 8px; font-size: 0.9rem; }
.flash-ok { background: #e9f7ef; color: #2e7d4f; border: 1px solid #c5e8d2; }
.flash-error { background: #fdecea; color: #c0392b; border: 1px solid #f5c6c6; }

/* notes grid */
.page-head { text-align: center; margin-bottom: 32px; }
.page-head h1 { font-size: 1.9rem; color: var(--text); margin-bottom: 8px; }
.page-head p { color: var(--text-muted); }

.notes-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
}
.note-card {
  background: var(--white); border-radius: 14px; overflow: hidden;
  border: 1px solid var(--border); transition: transform .2s, box-shadow .2s;
  display: flex; flex-direction: column;
}
.note-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.10);
}
.note-cover { width: 100%; height: 170px; object-fit: cover; background: var(--bg); }
.note-cover-logo { object-fit: contain; padding: 30px; }
.note-body { padding: 16px 18px; display: flex; flex-direction: column; flex: 1; }
.note-title { font-size: 1.12rem; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.note-excerpt { color: var(--text-muted); font-size: 0.88rem; flex: 1; margin-bottom: 12px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.note-meta { display: flex; justify-content: space-between; align-items: center;
  font-size: 0.8rem; color: var(--text-muted); }
.note-clicks { display: inline-flex; align-items: center; gap: 4px; color: var(--sakura-deep); }
.note-clicks svg { width: 15px; height: 15px; }

.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 32px; }
.pagination a, .pagination span {
  padding: 8px 14px; border-radius: 8px; background: var(--white);
  border: 1px solid var(--border); color: var(--text-muted); font-size: 0.9rem;
}
.pagination a:hover { border-color: var(--sakura); color: var(--sakura-deep); }
.pagination .current { background: var(--sakura); color: #fff; border-color: var(--sakura); }

/* detail */
.detail-card { background: var(--white); border-radius: 16px; padding: 36px;
  border: 1px solid var(--border); }
.detail-cover { width: 100%; max-height: 420px; object-fit: cover; border-radius: 12px; margin-bottom: 24px; }
.detail-title { font-size: 1.7rem; color: var(--text); margin-bottom: 14px; }
.detail-meta { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 24px;
  display: flex; gap: 20px; align-items: center; }
.detail-content { font-size: 1rem; line-height: 1.9; color: var(--text); }
.detail-content img { max-width: 100%; border-radius: 10px; margin: 12px 0; }
.detail-content p { margin-bottom: 14px; }
.detail-content h1,.detail-content h2,.detail-content h3 { margin: 18px 0 10px; color: var(--text); }
.detail-content ul,.detail-content ol { margin: 0 0 14px 22px; }
.detail-content blockquote { border-left: 3px solid var(--sakura); padding-left: 14px; color: var(--text-muted); margin-bottom: 14px; }
.detail-content pre { background: var(--bg); padding: 14px; border-radius: 8px; overflow-x: auto; margin-bottom: 14px; }
.detail-content code { font-family: "SFMono-Regular", Consolas, monospace; font-size: 0.9rem; }
.detail-content a { text-decoration: underline; }
.back-link { display: inline-block; margin-bottom: 20px; font-size: 0.9rem; }

/* auth */
.auth-wrap { display: flex; justify-content: center; align-items: center; min-height: 60vh; }
.auth-card { background: var(--white); border-radius: 16px; padding: 40px 36px;
  width: 100%; max-width: 400px; border: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06); }
.auth-card h2 { text-align: center; color: var(--text); margin-bottom: 8px; }
.auth-card .sub { text-align: center; color: var(--text-muted); font-size: 0.85rem; margin-bottom: 24px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 0.88rem; margin-bottom: 6px; color: var(--text); }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 0.95rem; font-family: inherit; background: #fff;
  transition: border .2s;
}
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--sakura); }
.form-group textarea { min-height: 120px; resize: vertical; }

.btn {
  display: inline-block; padding: 11px 22px; border: none; border-radius: 10px;
  background: var(--sakura); color: #fff; font-size: 0.95rem; cursor: pointer;
  transition: background .2s; text-align: center; font-family: inherit;
}
.btn:hover { background: var(--sakura-deep); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 0.85rem; }
.btn-ghost { background: transparent; color: var(--sakura-deep); border: 1px solid var(--sakura); }
.btn-ghost:hover { background: var(--sakura-light); }
.btn-danger { background: #f0f0f0; color: #c0392b; }
.btn-danger:hover { background: #fdecea; color: #c0392b; }

/* admin */
.admin-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.admin-toolbar h1 { font-size: 1.5rem; color: var(--text); }
.stats-row { display: flex; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.stat-box { background: var(--white); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px 24px; flex: 1; min-width: 140px; }
.stat-box .num { font-size: 1.7rem; font-weight: 700; color: var(--sakura-deep); }
.stat-box .lbl { color: var(--text-muted); font-size: 0.85rem; }

.admin-table { width: 100%; border-collapse: collapse; background: var(--white);
  border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.admin-table th, .admin-table td { padding: 12px 14px; text-align: left; font-size: 0.9rem; border-bottom: 1px solid var(--border); }
.admin-table th { background: var(--sakura-pale); color: var(--text); font-weight: 600; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table .actions { display: flex; gap: 8px; }

/* editor */
.editor-wrap { background: var(--white); border-radius: 16px; padding: 32px; border: 1px solid var(--border); }
.editor-wrap h1 { color: var(--text); margin-bottom: 24px; }
.editor-toolbar { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.editor-toolbar button {
  border: 1px solid var(--border); background: #fff; color: var(--text);
  padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 0.85rem;
}
.editor-toolbar button:hover { background: var(--sakura-light); }
#content { min-height: 320px; font-family: inherit; }

.cover-row { display: flex; gap: 8px; align-items: center; }
.cover-row input { flex: 1; }
.cover-preview { position: relative; margin-top: 10px; display: inline-block; }
.cover-preview img { max-width: 240px; max-height: 160px; border-radius: 10px; border: 1px solid var(--border); display: block; }
.cover-remove {
  position: absolute; top: -8px; right: -8px; width: 24px; height: 24px;
  border-radius: 50%; border: 1px solid var(--border); background: #fff;
  color: var(--text-muted); cursor: pointer; font-size: 0.9rem; line-height: 1;
}
.cover-remove:hover { background: var(--sakura-light); }

/* probe */
.probe-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 10px; }
.probe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.probe-card { background: var(--white); border-radius: 14px; border: 1px solid var(--border); padding: 20px 22px; }
.probe-card h3 { font-size: 1rem; color: var(--text); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.probe-item { display: flex; justify-content: space-between; padding: 7px 0; font-size: 0.88rem; border-bottom: 1px dashed var(--border); }
.probe-item:last-child { border-bottom: none; }
.probe-item .k { color: var(--text-muted); }
.probe-item .v { font-weight: 500; }
.bar { height: 10px; background: var(--sakura-light); border-radius: 6px; overflow: hidden; margin-top: 4px; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--sakura), var(--sakura-deep)); border-radius: 6px; transition: width .5s; }
.bar-label { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 4px; }
.bar-label span:last-child { color: var(--sakura-deep); font-weight: 600; }

.empty { text-align: center; color: var(--text-muted); padding: 60px 20px; }
.empty .big { font-size: 3rem; margin-bottom: 12px; }

@media (max-width: 600px) {
  .detail-card { padding: 22px; }
  .admin-table { font-size: 0.8rem; }
  .notes-grid { grid-template-columns: 1fr; }
}
