:root {
    --bg1: #eef4ff;
    --bg2: #f7faff;
    --bg3: #e9ecff;
    --text: #10203a;
    --muted: rgba(16, 32, 58, 0.62);
    --line: rgba(255, 255, 255, 0.42);
    --glass: rgba(255, 255, 255, 0.40);
    --glass-strong: rgba(255, 255, 255, 0.58);
    --shadow: 0 18px 50px rgba(112, 144, 176, 0.18);
    --shadow-soft: 0 10px 30px rgba(112, 144, 176, 0.12);
    --blue: #2f6bff;
    --blue-deep: #2457d6;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
        "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: var(--text);
    line-height: 1.72;
    min-height: 100vh;
    background:
        radial-gradient(circle at 12% 18%, rgba(170, 200, 255, 0.65), transparent 28%),
        radial-gradient(circle at 85% 12%, rgba(255, 255, 255, 0.9), transparent 22%),
        radial-gradient(circle at 70% 78%, rgba(208, 223, 255, 0.8), transparent 26%),
        linear-gradient(180deg, var(--bg1) 0%, var(--bg2) 48%, var(--bg3) 100%);
    background-attachment: fixed;
}

.page-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    backdrop-filter: saturate(110%);
}

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

a:hover {
    text-decoration: none;
    opacity: 0.88;
}

.container {
    width: min(980px, 92%);
    margin: 0 auto;
}

.glass-panel {
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.52) 0%,
        rgba(255, 255, 255, 0.30) 100%
    );
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px) saturate(130%);
    -webkit-backdrop-filter: blur(20px) saturate(130%);
}

.site-header {
    margin: 18px auto 28px;
    padding: 22px 0 20px;
    border-radius: 32px;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
}

.site-title {
    margin: 0;
    font-size: 34px;
    letter-spacing: -0.03em;
}

.site-title a {
    color: var(--text);
}

.site-subtitle {
    margin-top: 8px;
    color: var(--muted);
    font-size: 15px;
}

.top-nav {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.pill-link,
.pill-button,
.subtle-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 999px;
    transition: all 0.22s ease;
    font-size: 14px;
}

.pill-link,
.subtle-pill,
.ghost-button {
    background: rgba(255, 255, 255, 0.34);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.46);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.strong-pill,
.primary-button,
.search-form button,
.custom-form button {
    background: linear-gradient(180deg, rgba(255,255,255,0.88), rgba(255,255,255,0.62));
    color: #12305d;
    border: 1px solid rgba(255,255,255,0.75);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.85),
        0 10px 24px rgba(74, 121, 255, 0.18);
}

.primary-button:hover,
.strong-pill:hover,
.pill-link:hover,
.subtle-pill:hover,
.search-form button:hover,
.custom-form button:hover,
.ghost-button:hover {
    transform: translateY(-1px);
}

.inline-form {
    display: inline;
}

.ghost-button {
    cursor: pointer;
    font: inherit;
}

.search-form {
    margin-top: 18px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.search-form input,
.custom-form input,
.custom-form textarea,
.custom-form select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.58);
    background: rgba(255, 255, 255, 0.46);
    color: var(--text);
    outline: none;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.search-form input {
    flex: 1;
    min-width: 260px;
}

main.container {
    padding-bottom: 40px;
}

.post-card,
.post-detail,
.auth-card,
.comment-section,
.comment-form-section,
.editor-card {
    border-radius: 30px;
    padding: 24px;
    margin-bottom: 20px;
}

.post-card h3,
.post-detail h2,
.auth-card h2,
.editor-card h2 {
    margin-top: 0;
    letter-spacing: -0.025em;
}

.post-meta,
.comment-meta,
.muted-text {
    color: var(--muted);
    font-size: 14px;
}

.post-summary {
    background: rgba(255, 255, 255, 0.34);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 22px;
    padding: 14px 16px;
    margin: 16px 0;
    box-shadow: var(--shadow-soft);
}

.post-content {
    margin-top: 18px;
}

.read-more {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 14px;
    margin-top: 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.34);
    border: 1px solid rgba(255,255,255,0.5);
    box-shadow: var(--shadow-soft);
}

.tag-list {
    margin-top: 10px;
}

.tag-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    margin-right: 8px;
    margin-bottom: 6px;
    font-size: 13px;
    color: #1f3f76;
    background: rgba(255, 255, 255, 0.42);
    border: 1px solid rgba(255, 255, 255, 0.58);
    box-shadow: var(--shadow-soft);
}

.comment-card {
    border-top: 1px solid rgba(255,255,255,0.42);
    padding: 14px 0;
}

.comment-card:first-of-type {
    border-top: none;
    padding-top: 0;
}

.custom-form p {
    margin-bottom: 14px;
}

.custom-form textarea {
    border-radius: 24px;
}

.pagination {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    margin: 30px 0;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.34);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow-soft);
}

.auth-shell {
    display: flex;
    justify-content: center;
}

.auth-card {
    width: min(560px, 100%);
}

.auth-switch {
    margin-top: 12px;
}

.guest-entry {
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.36);
}

.guest-entry summary {
    cursor: pointer;
    color: var(--muted);
    user-select: none;
}

.guest-entry-body {
    margin-top: 12px;
}

.editor-head,
.post-head-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

@media (max-width: 640px) {
    .site-header {
        border-radius: 24px;
    }

    .post-card,
    .post-detail,
    .auth-card,
    .comment-section,
    .comment-form-section,
    .editor-card {
        border-radius: 24px;
        padding: 20px;
    }

    .site-title {
        font-size: 28px;
    }
}

/* Markdown */
.markdown-body pre {
    overflow: auto;
    padding: 16px;
    border-radius: 18px;
    background: rgba(0,0,0,0.82);
    color: rgba(255,255,255,0.92);
    box-shadow: 0 10px 24px rgba(0,0,0,0.16);
}

.markdown-body code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.95em;
}

.markdown-body p code {
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.42);
    border: 1px solid rgba(255,255,255,0.58);
}

.markdown-body h1, .markdown-body h2, .markdown-body h3 {
    letter-spacing: -0.02em;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
    border-radius: 18px;
}

.markdown-body th, .markdown-body td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.35);
}

/* Word-like editor shell */
.editor-shell {
  display: grid;
  gap: 14px;
}

.editor-toolbar {
  border-radius: 26px;
  padding: 14px 18px;
  display:flex;
  justify-content: space-between;
  align-items:center;
  gap: 14px;
  flex-wrap: wrap;
}

.toolbar-title {
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-right: 12px;
}

.paper {
  border-radius: 30px;
  padding: 26px;
}

/* A4 paper feel */
.paper form {
  max-width: 820px;
  margin: 0 auto;
}

.field-row label {
  display:block;
  margin: 10px 0 8px;
  font-weight: 600;
}

.actions-row {
  margin-top: 18px;
  display:flex;
  justify-content: flex-end;
}

/* EasyMDE blending into glass */
.editor-toolbar + .paper .EasyMDEContainer {
  border-radius: 24px;
  overflow: hidden;
}

.EasyMDEContainer .CodeMirror {
  border-radius: 24px;
  background: rgba(255,255,255,0.46);
  border: 1px solid rgba(255,255,255,0.58);
  padding: 10px;
  font-size: 15px;
  line-height: 1.7;
}

.EasyMDEContainer .editor-toolbar {
  border: 0;
  background: rgba(255,255,255,0.35);
  border-bottom: 1px solid rgba(255,255,255,0.45);
}

.EasyMDEContainer .editor-statusbar {
  color: rgba(16, 32, 58, 0.62);
}

.markdown-body pre {
  overflow: auto;
  padding: 16px;
  border-radius: 18px;
  background: rgba(0,0,0,0.84);
  color: rgba(255,255,255,0.92);
}

/* 修复 EasyMDE 工具栏被裁切/遮挡 */
.EasyMDEContainer {
  overflow: visible !important;
}

.EasyMDEContainer .editor-toolbar {
  overflow: visible !important;
}

/* 之前如果你写过 overflow:hidden 的那条，等效“反杀” */
.editor-shell .EasyMDEContainer {
  overflow: visible !important;
}

/* 提升层级，避免被玻璃层/背景层吃点击 */
.editor-toolbar {
  position: relative;
  z-index: 5;
}

.paper {
  position: relative;
  z-index: 1;
}

.EasyMDEContainer { overflow: visible !important; }
.EasyMDEContainer .editor-toolbar { overflow: visible !important; }
.editor-toolbar { position: relative; z-index: 5; }
.paper { position: relative; z-index: 1; }