/* ============================================
   Animal-Island style — 动森风格设计规范
   Inspired by animal-island-ui (guokaigdg)
   ============================================ */

/* Google Fonts loaded via <link> in HTML for graceful fallback in China */

/* ---------- Design Tokens ---------- */
:root {
  --bg-warm: #f8f8f0;
  --bg-card: rgb(247, 243, 223);
  --text-body: #725d42;
  --text-heading: #794f27;
  --text-secondary: #9f927d;
  --text-muted: #8a7b66;
  --text-disabled: #c4b89e;
  --border-standard: #9f927d;
  --border-input: #c4b89e;
  --accent: #19c8b9;
  --accent-hover: #3dd4c6;
  --accent-active: #11a89b;
  --focus-yellow: #ffcc00;
  --shadow-btn: #bdaea0;
  --shadow-input: #d4c9b4;
  --success: #6fba2c;
  --warning: #f5c31c;
  --error: #e05a5a;
  --switch-on: #86d67a;
  --switch-off: #d4c9b4;
  --code-bg: #2b2118;
  --code-border: #3d3028;
  --code-text: #e8d5bc;
  --sidebar-active: #B7C6E5;
  --sidebar-hover: #d6dff0;
  --radius-btn: 50px;
  --radius-card: 20px;
  --radius-input: 50px;
  --radius-code: 20px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font: Nunito, 'Noto Sans SC', 'Zen Maru Gothic', -apple-system, 'PingFang SC', sans-serif;

  /* ---- NookPhone card palette ---- */
  --card-default: rgb(247, 243, 223);
  --app-pink: #f8a6b2;
  --purple: #b77dee;
  --app-blue: #889df0;
  --app-yellow: #f7cd67;
  --app-orange: #e59266;
  --app-teal: #82d5bb;
  --app-green: #8ac68a;
  --app-red: #fc736d;
  --lime-green: #d1da49;
  --yellow-green: #ecdf52;
  --brown: #9a835a;
  --warm-peach-pink: #e18c6f;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  font-weight: 500;
  background-color: #e8f0e0;
  background-image:
    /* dot pattern — subtle grass texture */
    radial-gradient(circle at 20% 50%, rgba(122, 175, 110, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(138, 198, 106, 0.10) 0%, transparent 50%),
    radial-gradient(circle at 50% 80%, rgba(130, 213, 187, 0.10) 0%, transparent 50%),
    /* subtle grid dots */
    radial-gradient(circle at 12px 12px, rgba(114, 93, 66, 0.06) 1px, transparent 1px);
  background-size:
    100% 100%,
    100% 100%,
    100% 100%,
    24px 24px;
  color: var(--text-body);
  line-height: 1.7;
  letter-spacing: 0.01em;
  min-height: 100vh;
}

/* subtle leaf silhouette via pseudo-element */
body::before {
  content: '';
  position: fixed;
  top: -60px; right: -80px;
  width: 300px; height: 300px;
  background: radial-gradient(ellipse at 40% 60%, rgba(138, 198, 106, 0.10) 0%, transparent 70%);
  border-radius: 0 0 0 80%;
  pointer-events: none;
  z-index: 0;
}
body::after {
  content: '';
  position: fixed;
  bottom: -100px; left: -60px;
  width: 400px; height: 400px;
  background: radial-gradient(ellipse at 60% 40%, rgba(130, 213, 187, 0.08) 0%, transparent 70%);
  border-radius: 0 70% 0 0;
  pointer-events: none;
  z-index: 0;
}

a { color: var(--accent); text-decoration: none; font-weight: 600; }
a:hover { color: var(--accent-hover); }

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-heading);
  font-weight: 700;
  letter-spacing: 0.01em;
}
h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
h4 { font-size: 15px; }

/* ---------- Navigation Bar (capsule) ---------- */
.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--bg-card);
  border: 2px solid var(--border-standard);
  border-radius: var(--radius-btn);
  box-shadow: 0 4px 0 0 var(--shadow-btn);
  margin: 20px auto;
  max-width: 960px;
  gap: 16px;
}
.nav-brand {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-heading);
  white-space: nowrap;
}
.nav-links {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.nav-links a {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: color var(--transition);
}
.nav-links a:hover { color: var(--accent); }

/* ---------- Container ---------- */
.container { max-width: 960px; margin: 0 auto; padding: 0 20px; }

/* ---------- Button (Nintendo press style) ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 45px;
  padding: 0 24px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  border: 2px solid var(--border-standard);
  border-radius: var(--radius-btn);
  background: var(--bg-card);
  color: var(--text-body);
  cursor: pointer;
  box-shadow: 0 5px 0 0 var(--shadow-btn);
  transition: all var(--transition);
  text-decoration: none;
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 0 0 var(--shadow-btn);
}
.btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 0 var(--shadow-btn);
}
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent-active);
  box-shadow: 0 5px 0 0 var(--accent-active);
}
.btn-primary:hover { box-shadow: 0 6px 0 0 var(--accent-active); }
.btn-primary:active { box-shadow: 0 1px 0 0 var(--accent-active); }
.btn-sm { height: 32px; padding: 0 16px; font-size: 12px; border-radius: 12px; }
.btn-lg { height: 48px; padding: 0 32px; font-size: 16px; border-radius: 24px; }

/* ---------- Card ---------- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  padding: 20px 24px;
  box-shadow: 0 4px 10px rgba(107, 92, 67, 0.42);
  transition: all var(--transition);
  border: 2px solid transparent;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(114, 93, 66, 0.15);
}
.card-clickable { cursor: pointer; }
.card-title {
  border-radius: 40px 35px 45px 38px / 38px 45px 35px 40px;
  display: inline-block;
  padding: 8px 18px;
  font-weight: 700;
  font-size: 13px;
}

/* Card color variants */
.card-app-blue    { background: var(--app-blue); }
.card-app-green   { background: var(--app-green); }
.card-app-orange  { background: var(--app-orange); }
.card-app-pink    { background: var(--app-pink); }
.card-purple      { background: var(--purple); }
.card-app-teal    { background: var(--app-teal); }
.card-brown       { background: var(--brown); }
.card-lime-green  { background: var(--lime-green); }
.card-yellow-green{ background: var(--yellow-green); }
.card-app-yellow  { background: var(--app-yellow); }
.card-warm-peach-pink { background: var(--warm-peach-pink); }
.card-app-red     { background: var(--app-red); }

/* ---------- Input ---------- */
.input {
  width: 100%;
  height: 40px;
  padding: 0 18px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text-body);
  background: var(--bg-warm);
  border: 2.5px solid var(--border-input);
  border-radius: var(--radius-input);
  box-shadow: 0 3px 0 0 var(--shadow-input);
  outline: none;
  transition: all var(--transition);
}
.input:hover { border-color: #a89878; }
.input:focus {
  border-color: var(--focus-yellow);
  box-shadow: 0 3px 0 0 #e0b800, 0 0 0 3px rgba(255, 204, 0, 0.15);
}
.input-lg { height: 48px; padding: 0 22px; font-size: 16px; border: 3px; box-shadow: 0 4px 0 0 var(--shadow-input); }
.input-sm { height: 32px; padding: 0 14px; font-size: 12px; box-shadow: 0 2px 0 0 var(--shadow-input); }

/* ---------- Textarea ---------- */
.textarea {
  width: 100%;
  min-height: 200px;
  padding: 16px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-body);
  background: var(--bg-warm);
  border: 2.5px solid var(--border-input);
  border-radius: var(--radius-card);
  box-shadow: 0 3px 0 0 var(--shadow-input);
  outline: none;
  resize: vertical;
  transition: all var(--transition);
}
.textarea:focus {
  border-color: var(--focus-yellow);
  box-shadow: 0 3px 0 0 #e0b800, 0 0 0 3px rgba(255, 204, 0, 0.15);
}

/* ---------- Select ---------- */
.select {
  height: 40px;
  padding: 0 18px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-body);
  background: var(--bg-warm);
  border: 2.5px solid var(--border-input);
  border-radius: var(--radius-input);
  box-shadow: 0 3px 0 0 var(--shadow-input);
  outline: none;
  cursor: pointer;
  transition: all var(--transition);
}
.select:focus {
  border-color: var(--focus-yellow);
  box-shadow: 0 3px 0 0 #e0b800, 0 0 0 3px rgba(255, 204, 0, 0.15);
}

/* ---------- Tag Badge ---------- */
.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.5px;
}

/* ---------- Code Block ---------- */
.code-block {
  background: var(--code-bg);
  color: var(--code-text);
  border: 1px solid var(--code-border);
  border-radius: var(--radius-code);
  padding: 20px 24px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.8;
  overflow-x: auto;
  white-space: pre;
  tab-size: 4;
  margin: 12px 0;
}

/* Inline code */
:not(.code-block) > code {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 12px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
}

/* ---------- Post List Card ---------- */
.post-card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: 0 4px 10px rgba(107, 92, 67, 0.2);
  transition: all var(--transition);
  display: block;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
}
.post-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
}
.post-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(114, 93, 66, 0.2);
}
.post-card .post-tag { margin-bottom: 4px; }
.post-card .post-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-heading);
  margin: 4px 0;
}
.post-card .post-excerpt {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.post-card .post-meta {
  font-size: 11px;
  color: var(--text-disabled);
  margin-top: 10px;
  display: flex;
  gap: 16px;
}

/* ---------- Note Card (organic shape) ---------- */
.note-card {
  padding: 16px 18px;
  margin-bottom: 12px;
  border-radius: 32px 28px 38px 30px / 30px 38px 28px 32px;
  font-size: 13px;
  color: var(--text-body);
  line-height: 1.5;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 3px 0 0 rgba(0,0,0,0.12);
  text-decoration: none;
  display: block;
}
.note-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 0 0 rgba(0,0,0,0.15);
}
.note-card .note-date {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 8px;
  opacity: 0.7;
}

/* ---------- Article Body ---------- */
.article-body {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  padding: 28px 32px;
  box-shadow: 0 4px 10px rgba(107, 92, 67, 0.2);
  font-size: 15px;
  line-height: 1.9;
}
.article-body h1, .article-body h2, .article-body h3 { margin: 24px 0 10px; }
.article-body h1:first-child, .article-body h2:first-child { margin-top: 0; }
.article-body p { margin-bottom: 14px; }
.article-body ul, .article-body ol { margin: 8px 0 14px 20px; }
.article-body li { margin-bottom: 4px; }
.article-body blockquote {
  border-left: 4px solid var(--accent);
  padding: 8px 16px;
  margin: 12px 0;
  color: var(--text-secondary);
  background: rgba(25, 200, 185, 0.06);
  border-radius: 0 12px 12px 0;
}
.article-body img { max-width: 100%; border-radius: 12px; }
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
}
.article-body th, .article-body td {
  padding: 8px 12px;
  border: 1px solid var(--border-input);
  text-align: left;
}
.article-body th { background: rgba(25, 200, 185, 0.1); font-weight: 700; color: var(--text-heading); }

/* ---------- Hero Banner ---------- */
.hero-banner {
  position: relative;
  background: linear-gradient(135deg, #c8e6b4 0%, #a8d8c8 30%, #b8d8e8 60%, #d4e8c0 100%);
  border-radius: 32px;
  padding: 48px 40px 36px;
  margin-top: 8px;
  overflow: hidden;
  z-index: 1;
}
.hero-banner::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
  border-radius: 50%;
  z-index: 0;
}
.hero-banner::after {
  content: '';
  position: absolute;
  bottom: -40px; left: 20%;
  width: 200px; height: 100px;
  background: radial-gradient(ellipse, rgba(138, 198, 106, 0.2) 0%, transparent 70%);
  z-index: 0;
}
.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
}
.hero-content h1 {
  font-family: 'Press Start 2P', var(--font);
  font-size: 28px;
  font-weight: 400;
  color: #5a3e28;
  letter-spacing: 0.08em;
  text-shadow: 3px 3px 0 rgba(138, 198, 106, 0.4), 0 0 2px rgba(0,0,0,0.1);
  image-rendering: pixelated;
}
.hero-content .subtitle {
  color: #6b8a5e;
  font-size: 15px;
  margin-top: 6px;
}
.hero-decor {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
  opacity: 0.6;
}

/* ---------- Avatar ---------- */
.avatar-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto 20px;
  border: 4px solid var(--accent);
  box-shadow: 0 5px 0 0 var(--accent-active), 0 8px 20px rgba(0,0,0,0.15);
  background: var(--app-teal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 60px;
  transition: all var(--transition);
}
.avatar-circle:hover {
  transform: translateY(-3px);
  box-shadow: 0 7px 0 0 var(--accent-active), 0 12px 28px rgba(0,0,0,0.2);
}
.avatar-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- Section Strip ---------- */
.section-strip {
  position: relative;
  z-index: 1;
}

/* ---------- Page Layout ---------- */
.page-header {
  text-align: center;
  padding: 30px 0 10px;
}
.page-header h1 { font-size: 24px; }
.page-header .subtitle { color: var(--text-secondary); font-size: 14px; }

.main-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.posts-area { flex: 1; min-width: 0; }
.notes-sidebar { width: 280px; flex-shrink: 0; }

.section-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 16px;
}

/* ---------- Footer ---------- */
.footer {
  margin-top: 48px;
  padding: 24px 0 32px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}
.footer-wave {
  height: 80px;
  background: linear-gradient(180deg, #98D2E3 0%, #327A93 100%);
  border-radius: var(--radius-card);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  max-width: 960px;
  margin: 40px auto 0;
}

/* ---------- Divider ---------- */
.divider {
  height: 12px;
  max-width: 960px;
  margin: 24px auto;
  border-radius: 6px;
  opacity: 0.5;
}
.divider-teal { background: var(--accent); }
.divider-brown { background: #d8d0c3; }
.divider-yellow { background: var(--app-yellow); }

/* ---------- Preview Box ---------- */
.preview-box {
  padding: 16px;
  border: 2px dashed var(--border-input);
  border-radius: var(--radius-card);
  min-height: 80px;
  font-size: 14px;
  color: var(--text-body);
  background: var(--bg-warm);
}

/* ---------- Dark Mode ---------- */
body.dark {
  background-color: #1a1a2e;
  background-image:
    radial-gradient(circle at 20% 50%, rgba(40, 60, 80, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(50, 70, 90, 0.25) 0%, transparent 50%),
    radial-gradient(circle at 50% 80%, rgba(30, 50, 70, 0.25) 0%, transparent 50%),
    radial-gradient(circle at 12px 12px, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 100% 100%, 24px 24px;
}
body.dark::before,
body.dark::after { opacity: 0.3; }

body.dark,
body.dark .card,
body.dark .post-card,
body.dark .article-body,
body.dark .input,
body.dark .textarea,
body.dark .select {
  --bg-card: #252540;
  --bg-warm: #1e1e35;
  --text-body: #c8c8d8;
  --text-heading: #d8d8e8;
  --text-secondary: #9090a8;
  --text-muted: #7878a0;
  --text-disabled: #606080;
  --border-standard: #4a4a6a;
  --border-input: #3a3a5a;
  --shadow-btn: #1a1a2e;
  --shadow-input: #1a1a2e;
}

body.dark .nav-bar { background: #252540; border-color: #4a4a6a; box-shadow: 0 4px 0 0 #1a1a2e; }
body.dark .card { box-shadow: 0 4px 10px rgba(0,0,0,0.3); }
body.dark .post-card { box-shadow: 0 4px 10px rgba(0,0,0,0.3); }
body.dark .hero-banner {
  background: linear-gradient(135deg, #2a3a2a 0%, #2a3a3a 30%, #2a2a3a 60%, #2a3a2a 100%);
}
body.dark .hero-content h1 { color: #c8d8c8; }
body.dark .hero-content .subtitle { color: #8a9a8a; }
body.dark .section-strip { background: rgba(255,255,255,0.03) !important; }
body.dark .footer-wave { background: linear-gradient(180deg, #2a4a5a 0%, #1a2a3a 100%); }
body.dark .note-card { box-shadow: 0 3px 0 0 rgba(0,0,0,0.25); }

/* Dark mode toggle switch */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  font-family: var(--font);
  padding: 4px 10px;
  border-radius: var(--radius-btn);
  transition: all var(--transition);
}
.theme-toggle:hover { color: var(--accent); }

/* ---------- Tag Filter ---------- */
.tag-filter {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.tag-filter-btn {
  display: inline-block;
  padding: 6px 18px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 2px solid var(--border-input);
  border-radius: var(--radius-btn);
  cursor: pointer;
  box-shadow: 0 2px 0 0 var(--shadow-input);
  transition: all var(--transition);
  text-decoration: none;
}
.tag-filter-btn:hover { color: var(--accent); border-color: var(--accent); }
.tag-filter-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent-active);
  box-shadow: 0 2px 0 0 var(--accent-active);
}

/* ---------- Back to Top ---------- */
.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 20px;
  font-weight: 700;
  box-shadow: 0 4px 0 0 var(--accent-active);
  transition: all var(--transition);
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.back-to-top:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 0 var(--accent-active);
}
.back-to-top:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 0 var(--accent-active);
}

/* ---------- Helpers ---------- */
.flex-row { display: flex; gap: 12px; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-12 { margin-top: 12px; }
.mt-20 { margin-top: 20px; }
.mt-32 { margin-top: 32px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); }

/* ---------- Post Layout (with TOC sidebar) ---------- */
.post-layout {
  display: flex;
  gap: 28px;
  align-items: flex-start;
}
.post-layout .article-body { flex: 1; min-width: 0; }

/* ---------- TOC Sidebar ---------- */
.toc-sidebar { width: 220px; flex-shrink: 0; }
.toc-sticky { position: sticky; top: 20px; }
.toc-content { font-size: 13px; line-height: 1.8; }
.toc-content ul { list-style: none; padding: 0; }
.toc-content li { margin: 4px 0; }
.toc-content a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition);
  display: block;
  padding: 3px 8px;
  border-radius: 8px;
}
.toc-content a:hover { color: var(--accent); background: rgba(25,200,185,0.06); }

/* ---------- Search ---------- */
.search-trigger {
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
  transition: color var(--transition);
}
.search-trigger:hover { color: var(--accent); }

.search-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
}
.search-overlay.open { display: flex; }

.search-modal {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  padding: 28px;
  width: 90%;
  max-width: 560px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
}

.search-results {
  max-height: 50vh;
  overflow-y: auto;
}
.search-result-item {
  display: block;
  padding: 12px 16px;
  border-radius: 12px;
  color: var(--text-body);
  text-decoration: none;
  transition: background var(--transition);
  margin-bottom: 4px;
  border: 1px solid transparent;
}
.search-result-item:hover { background: rgba(25,200,185,0.06); border-color: var(--accent); }

/* ---------- Welcome Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-box {
  background: var(--bg-card);
  border-radius: 40px 35px 45px 38px / 38px 45px 35px 40px;
  padding: 40px 36px 32px;
  max-width: 460px;
  width: 90%;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.3);
  position: relative;
  animation: modalPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modalPop {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.modal-box .modal-icon { font-size: 48px; margin-bottom: 12px; }
.modal-box h3 { font-size: 20px; color: var(--text-heading); margin-bottom: 8px; }
.modal-box p { font-size: 14px; color: var(--text-secondary); line-height: 1.8; min-height: 50px; }

/* ---------- Click Leaf Effect ---------- */
.click-leaf {
  position: fixed;
  pointer-events: none;
  z-index: 99999;
  font-size: 20px;
  animation: leafFloat 1s ease-out forwards;
}
@keyframes leafFloat {
  0%   { opacity: 1; transform: translate(0, 0) rotate(0deg) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(0.3); }
}

/* ---------- Random Visitor ---------- */
.visitor {
  position: fixed;
  bottom: -60px;
  z-index: 100;
  font-size: 40px;
  cursor: pointer;
  animation: visitorPeek 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
             visitorBounce 2s ease-in-out 0.6s infinite;
  transition: opacity 0.3s;
}
.visitor:hover { transform: scale(1.2); }
@keyframes visitorPeek {
  0%   { transform: translateY(0); }
  100% { transform: translateY(-70px); }
}
@keyframes visitorBounce {
  0%, 100% { transform: translateY(-70px); }
  50%      { transform: translateY(-80px); }
}
.visitor-leaving {
  animation: visitorLeave 0.5s ease-in forwards;
}
@keyframes visitorLeave {
  0%   { transform: translateY(-70px); opacity: 1; }
  100% { transform: translateY(0); opacity: 0; }
}
.visitor-speech {
  position: fixed;
  background: var(--bg-card);
  border: 2px solid var(--border-standard);
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-heading);
  z-index: 101;
  animation: speechPop 0.3s ease-out;
  box-shadow: 0 3px 0 0 var(--shadow-btn);
}
@keyframes speechPop {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ---------- Scroll Reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Reading Progress Bar ---------- */
.progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  background: var(--accent);
  z-index: 10000;
  transition: width 0.1s linear;
  border-radius: 0 2px 2px 0;
}

/* ---------- Random Article Button ---------- */
.nav-dice {
  cursor: pointer;
  font-size: 15px;
  transition: transform 0.3s;
  display: inline-flex;
}
.nav-dice:hover { transform: rotate(180deg); }
.nav-dice.spinning { animation: diceSpin 0.6s ease-out; }
@keyframes diceSpin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(720deg); }
}

/* ---------- Fortune Widget ---------- */
.fortune-widget {
  position: fixed;
  bottom: 100px;
  right: 24px;
  z-index: 99;
}
.fortune-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--app-yellow);
  border: 3px solid #dba90e;
  cursor: pointer;
  font-size: 24px;
  box-shadow: 0 4px 0 0 #dba90e, 0 4px 12px rgba(0,0,0,0.15);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.fortune-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 0 0 #dba90e, 0 6px 16px rgba(0,0,0,0.2); }
.fortune-btn.shaking { animation: fortuneShake 0.5s ease-out; }
@keyframes fortuneShake {
  0%, 100% { transform: rotate(0deg); }
  15% { transform: rotate(-15deg); }
  30% { transform: rotate(13deg); }
  45% { transform: rotate(-10deg); }
  60% { transform: rotate(8deg); }
  75% { transform: rotate(-4deg); }
  90% { transform: rotate(2deg); }
}

.fortune-popup {
  position: fixed;
  bottom: 170px;
  right: 20px;
  background: var(--bg-card);
  border: 2px solid var(--border-standard);
  border-radius: 20px;
  padding: 20px 24px;
  max-width: 260px;
  box-shadow: 0 6px 0 0 var(--shadow-btn), 0 8px 24px rgba(0,0,0,0.2);
  z-index: 100;
  animation: fortunePop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
}
@keyframes fortunePop {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.fortune-popup .fortune-icon { font-size: 32px; margin-bottom: 8px; }
.fortune-popup .fortune-text { font-size: 13px; color: var(--text-body); line-height: 1.6; margin: 8px 0; }
.fortune-popup .fortune-date { font-size: 10px; color: var(--text-disabled); }

/* ---------- Island Clock ---------- */
.island-clock {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 99;
  background: var(--bg-card);
  border: 3px solid #d4cfc3;
  border-radius: 18px;
  padding: 12px 24px;
  box-shadow: 0 3px 0 0 #d4cfc3;
  text-align: center;
  transition: all var(--transition);
}
.island-clock .clock-date {
  font-size: 10px;
  font-weight: 700;
  color: var(--success);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.island-clock .clock-time {
  font-size: 28px;
  font-weight: 900;
  color: #8b7355;
  letter-spacing: 2px;
  line-height: 1;
}
.island-clock .clock-label {
  font-size: 9px;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 2px;
  letter-spacing: 0.5px;
}
body.dark .island-clock {
  background: #252540;
  border-color: #4a4a6a;
  box-shadow: 0 3px 0 0 #1a1a2e;
}
body.dark .island-clock .clock-time { color: #c8d8c8; }

/* ---------- Code Copy Button ---------- */
.code-block-wrap {
  position: relative;
}
.code-copy-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  padding: 4px 12px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  color: #c8d8c8;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}
.code-block-wrap:hover .code-copy-btn { opacity: 1; }
.code-copy-btn.copied { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .main-layout, .post-layout { flex-direction: column; }
  .notes-sidebar, .toc-sidebar { width: 100%; }
  .nav-bar { flex-direction: column; gap: 8px; border-radius: 24px; }
  .nav-links { justify-content: center; }
  .container { padding: 0 12px; }
}
