/* ===== CSS Variables ===== */
:root {
  --background-color: #fafafa;
  --background-dark-color: #020617;
  --text-content-color: #24292e;
  --text-content-dark-color: #d1d5db;
  --text-title-color: #111827;
  --text-title-dark-color: #e5e7eb;
  --text-highlight-color: #696565;
  --frame-dark-color: #1f2933;
  --frame-color: #eee;
  --at-color-bg: #fff;
  --at-color-border: #eee;
  --link-color-light: #374151;
  --link-hover-color-light: #111827;
  --link-color-dark: #e5e7eb;
  --link-hover-color-dark: #d1d5db;
  --card-shadow-light: 0 10px 20px 0 rgba(236, 236, 236, 0.86);
  --card-shadow-dark: 0 18px 45px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(148, 163, 184, 0.45);
}

/* ===== Scroll Behavior ===== */
html { scroll-behavior: smooth; }

/* ===== Custom Font ===== */
@font-face {
  font-family: 'zql';
  src: url('/font/zql-v2-subset.woff2') format('woff2'),
       url('/font/zql-v2-subset.woff') format('woff');
  font-display: swap;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 13px; }
::-webkit-scrollbar-button { display: none; }
::-webkit-scrollbar-thumb {
  min-height: 16px;
  background-color: #999;
  background-clip: padding-box;
  border: 3px solid #fdfdfd;
  border-radius: 5px;
}
::selection { background: #444; color: #fff; }

/* ===== Base ===== */
body {
  font-family: 'zql', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--text-content-color);
  line-height: 1.6;
  font-size: 16px;
  background: var(--background-color);
  background-image: url('../image/background/deno.webp');
  background-size: contain;
  background-repeat: round;
  background-position: 50%;
  background-attachment: fixed;
  z-index: 5;
  transition: background-color .3s ease, color .3s ease;
}

[data-theme=dark] body {
  color: var(--text-content-dark-color);
  background-color: var(--background-dark-color);
  background-image: url('../image/background/deno.webp');
  background-repeat: round;
  background-size: contain;
  background-attachment: fixed;
}

[data-theme=dark] body::before {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  pointer-events: none;
  z-index: -1;
}

hr {
  display: block;
  height: 1px;
  border: 0;
  border-top: 1px solid #ccc;
  margin: 1rem 0;
  padding: 0;
}
[data-theme=dark] hr { border-top-color: rgba(255, 255, 255, 0.2); }

img {
  max-width: 100%;
  border-radius: 5px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  vertical-align: middle;
}

a img { border: none; }

pre, code {
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
  font-size: 14px;
  border-radius: 4px;
  background-color: #f6f8fa;
  color: #24292e;
  border: 1px solid #d0d7de;
}

[data-theme=dark] pre, [data-theme=dark] code {
  background-color: #282a36;
  color: #f8f8f2;
  border-color: #44475a;
}

code { padding: 2px 6px; word-break: break-all; }
pre { padding: 10px; overflow-x: auto; max-width: 100%; }
pre > code { background-color: initial; color: inherit; padding: 0; border: 0; word-break: normal; }

table { border-collapse: collapse; border-spacing: 0; word-break: break-all; }
table th { background-color: #f6f8fa; }
table th, table td { padding: 10px 20px; border: 1px solid #dfe2e5; }

blockquote {
  position: relative;
  margin: 1.2rem 0;
  padding: 14px 17px 14px 20px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-left: 4px solid rgba(0, 0, 0, 0.72);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0.01));
  color: rgba(30, 30, 30, 0.92);
  font-size: 0.95em;
  font-weight: 400;
  line-height: 1.68;
  word-break: break-word;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

blockquote::before {
  content: "\201C";
  position: absolute;
  top: -8px; left: 13px;
  color: rgba(0, 0, 0, 0.08);
  font-size: 42px;
  line-height: 1;
  font-family: Georgia, serif;
  pointer-events: none;
}

blockquote p { position: relative; margin: 0.25rem 0 !important; }

[data-theme=dark] blockquote {
  border-color: rgba(148, 163, 184, 0.18);
  border-left-color: rgba(168, 181, 205, 0.82);
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.78));
  color: rgba(226, 232, 240, 0.96);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}
[data-theme=dark] blockquote::before { color: rgba(203, 213, 225, 0.16); }

/* ===== Links ===== */
a {
  color: var(--link-color-light);
  text-decoration: none;
  transition: color .35s ease;
  touch-action: manipulation;
}
a:hover { color: var(--link-hover-color-light); text-decoration: underline; }
[data-theme=dark] a { color: var(--link-color-dark); }
[data-theme=dark] a:hover { color: var(--link-hover-color-dark); }

/* ===== Headings ===== */
h1, h2, h3, h4, h5, h6 { line-height: 1.2; font-weight: 400; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.25rem; }
h4, h5, h6 { font-size: 1.125rem; }
ul { padding-left: 0; list-style-type: disc; list-style: none; }

/* ===== Main Container (Glassmorphism Card) ===== */
.main {
  max-width: 618px;
  overflow: hidden;
  margin: 60px auto;
  padding: 50px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: var(--card-shadow-light);
  border-radius: 8px;
  z-index: 10;
  position: relative;
  text-align: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background-color .5s cubic-bezier(.4, 0, .2, 1), color .5s cubic-bezier(.4, 0, .2, 1);
  will-change: transform;
}

@media (min-width: 768px) {
  .main {
    background: rgba(255, 255, 255, 0.88);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
  }
}

[data-theme=dark] .main {
  background: rgba(15, 23, 42, 0.99);
  box-shadow: var(--card-shadow-dark);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* ===== Header ===== */
.header {
  margin-bottom: 10px;
  padding-bottom: 10px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  text-align: left;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-right: 16px;
  padding: 8px 10px 8px 0;
  border-radius: 999px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.header-avatar img {
  border-radius: 50%;
  width: 75px !important;
  height: 75px !important;
}

.avatar-theme-tip {
  margin-left: 0;
  pointer-events: none;
  padding: 4px 12px;
  border-radius: 999px;
  background: #111827;
  color: #f9fafb;
  font-size: 11px;
  white-space: nowrap;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.25);
  opacity: 0;
  transform: translateY(2px) scale(0.98);
  transition: opacity .4s ease;
}

.avatar-theme-tip.is-visible {
  opacity: 1;
  animation: avatar-tip-float 2.2s ease-in-out infinite;
}

.avatar-theme-tip.is-hidden {
  opacity: 0;
  transform: translateY(-4px) scale(0.96);
  animation: none;
  pointer-events: none;
}

[data-theme=dark] .avatar-theme-tip {
  background: #f9fafb;
  color: #111827;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.6);
}

@keyframes avatar-tip-float {
  0% { transform: translateY(2px) scale(0.98); }
  50% { transform: translateY(-2px) scale(1); }
  100% { transform: translateY(2px) scale(0.98); }
}

.header-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin-top: 0;
}

.header-social {
  margin: 0; padding: 0;
  border: none;
  min-width: 50px;
  margin-bottom: 0;
  text-align: center;
  gap: 2;
}

.header-social a {
  display: inline-block;
  margin: 0 5px;
  text-decoration: none;
  transition: all .2s ease;
}

.header-social a i {
  font-size: 1.15rem;
  vertical-align: middle;
}

.header-social a:hover {
  color: #24292e;
  transform: scale(1.2);
}

.header-bio {
  display: block;
  font-size: 0.85rem;
  line-height: 24px;
  min-height: 24px;
  margin: 0;
  opacity: 0.8;
}

.header h1, .header h2 {
  margin: 0; padding: 0;
  font-size: 1.6rem;
  margin-bottom: 10px;
}
.header h2 {
  font-size: 0.9rem;
  line-height: 2rem;
  margin-bottom: 0;
}

/* ===== Navigation Menu ===== */
.header-menu {
  border-top: 1px solid #f4f4f4;
  transition: border-color .35s ease;
}

[data-theme=dark] .header-menu { border-top-color: #1f2933; }

.header-menu ul, .header-menu li { margin: 0; }

.header-menu ul.flat {
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
}

.header-menu ul.flat li {
  display: block;
  list-style: none;
  margin: 10px 0 0;
  text-transform: capitalize;
}

.header-menu ul.flat li.active a { color: #24292e; }
.header-menu ul.flat li a { color: #586069; }
.header-menu ul.flat li a:hover { color: #646464; text-decoration: none; }

[data-theme=dark] .header-menu ul.flat li a { color: #9ca3af; }
[data-theme=dark] .header-menu ul.flat li.active a { color: #e5e7eb; }

/* ===== Section Headers & Search ===== */
.searchable-header-container {
  position: relative;
  margin-bottom: 15px;
  height: 40px;
  display: flex;
  align-items: center;
}

.section-header.normal-mode {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: all .3s ease;
  margin: 0;
  position: relative;
}

.section .section-header {
  font-size: 0.88rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #999;
  margin-bottom: 15px;
  letter-spacing: 1px;
}

.search-hint-wrapper {
  position: absolute;
  left: 100%; top: 50%;
  transform: translateY(-50%) translateX(10px);
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  visibility: hidden;
  transition: all .4s cubic-bezier(.34, 1.56, .64, 1);
  pointer-events: none;
  z-index: 10;
  white-space: nowrap;
  margin-left: 10px;
}

.search-hint-wrapper.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(10px);
}

.section-header.normal-mode:hover .search-hint-wrapper {
  opacity: 1;
  visibility: visible;
}

.search-mascot {
  width: 32px; height: 32px;
  object-fit: contain;
  border: none;
  box-shadow: none;
  filter: none;
  animation: mascot-shake 2.5s infinite ease-in-out;
  transform-origin: bottom center;
}

@keyframes mascot-shake {
  0%, 100% { transform: rotate(0); }
  10% { transform: rotate(5deg); }
  20% { transform: rotate(-5deg); }
  30% { transform: rotate(3deg); }
  40% { transform: rotate(-3deg); }
  50% { transform: rotate(0); }
}

.search-hint {
  background: #000;
  color: #fff;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  position: relative;
}

.search-hint::before {
  content: '';
  position: absolute;
  top: 50%; left: -5px;
  margin-top: -5px;
  width: 0; height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-right: 5px solid #000;
}

[data-theme=dark] .search-hint {
  background: #fff;
  color: #000;
}
[data-theme=dark] .search-hint::before { border-right-color: #fff; }

/* Search Mode Input */
.search-mode { width: 100%; animation: fadeIn .3s ease; }

.search-input-group {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 300px;
  border: none;
  border-bottom: 1px solid #000;
  border-radius: 0;
  padding: 0 4px 6px 0;
  transition: all .3s ease;
}

.search-input-group input {
  width: 100%;
  border: none !important;
  border-radius: 0 !important;
  background: transparent;
  padding: 0 4px !important;
  padding-left: 8px !important;
  padding-right: 20px !important;
  font-size: 1rem;
  color: #000;
  outline: none;
  height: 24px;
  font-weight: 500;
}

[data-theme=dark] .search-input-group {
  border-bottom-color: #fff;
}
[data-theme=dark] .search-input-group input { color: #fff; }

.search-icon { color: #000; font-size: 1.1rem; }
[data-theme=dark] .search-icon { color: #fff; }

.close-icon {
  position: absolute;
  right: 0;
  font-size: 1rem;
  color: #999;
  cursor: pointer;
  transition: all .2s;
}
.close-icon:hover { color: #000; }
[data-theme=dark] .close-icon { color: #aaa; }
[data-theme=dark] .close-icon:hover { color: #fff; }

/* Search Dropdown */
.search-dropdown {
  position: absolute;
  top: 100%; left: 0; right: 0;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  border: 1px solid #f0f0f0;
  margin-top: 8px;
  overflow: hidden;
  z-index: 100;
  opacity: 0;
  transform: translateY(5px);
  visibility: hidden;
  transition: all .2s ease;
}

.search-dropdown.show {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
}

[data-theme=dark] .search-dropdown {
  background: #2a2a2a;
  border: 1px solid #444;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.search-result-item {
  padding: 10px 14px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  flex-direction: column;
  transition: background-color .2s;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: #f5f5f5; }
[data-theme=dark] .search-result-item { border-bottom: 1px solid #333; }
[data-theme=dark] .search-result-item:hover { background: #1a1a1a; }

.search-result-title {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  color: #000;
}
[data-theme=dark] .search-result-title { color: #fff; }

.search-result-date { font-size: 0.75rem; color: #666; }
.search-result-summary {
  font-size: 0.85rem;
  color: #444;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 4px;
}
[data-theme=dark] .search-result-summary { color: #ccc; }
.no-result { text-align: left; color: #666; padding: 12px 16px; }
[data-theme=dark] .no-result { color: #aaa; }

/* ===== Posts List ===== */
.recent-posts .posts .post {
  margin-bottom: 20px;
  margin-top: 20px;
}

.recent-posts .posts .post .time,
.post .post-header .time {
  font-size: 0.725rem;
  color: #bec8d2;
  margin-bottom: 2px;
}

.post-header { margin-bottom: 32px; text-align: left; }
.post-title {
  color: var(--text-title-color);
  font-size: 1.5rem;
  font-weight: 400;
  margin: 0 0 10px;
}
[data-theme=dark] .post-title { color: var(--text-title-dark-color); }

.meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 10px;
  margin-bottom: 20px;
  color: #999;
  font-size: 0.9rem;
  line-height: 1.6;
}
.meta-item { white-space: nowrap; }
[data-theme=dark] .meta { color: #9ca3af; }

.post-content {
  text-align: left;
  line-height: 1.8;
}
[data-theme=dark] .post-content { color: var(--text-content-dark-color); }

.post-content img {
  display: block;
  max-width: 100%;
  height: auto;
}

.post-tags { margin-top: 20px; text-align: left; }
.post-tags .tags { margin-top: 40px; }
.post-tags .tags a {
  display: inline-block;
  border-radius: 2px;
  padding: 0.1rem 0.4rem;
  color: #fff;
  line-height: 20px;
  font-size: 12px;
  text-decoration: none;
  margin: 0 1px;
  border: 1px solid #41464b;
  background-color: #41464b;
}

/* ===== Pagination ===== */
.pagination {
  margin: 0;
  padding: 10px 0 0;
  text-align: left;
  display: flex;
  justify-content: space-between;
}
.pagination li { list-style: none; display: inline-block; margin: 0; padding: 0; }
.pagination .page-item.page-next { text-align: right; }
.pagination .page-item.page-previous { text-align: right; }

/* ===== Footer ===== */
.footer {
  text-align: right;
  font-size: 0.75em;
  color: #999;
  border-top: 1px solid #f4f4f4;
  padding-top: 10px;
  margin-top: 10px;
}
[data-theme=dark] .footer {
  border-top-color: #1f2933;
  color: #6b7280;
}

/* ===== Post Content Tables ===== */
.post-content table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 1.5em 0;
  font-size: 0.95em;
  line-height: 1.6;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.post-content th {
  padding: 14px 20px;
  text-align: left;
  font-weight: 600;
  color: rgba(30, 30, 30, 0.92);
  border-bottom: 2px solid rgba(0, 0, 0, 0.1);
}
.post-content td {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  color: rgba(30, 30, 30, 0.85);
}
.post-content tbody tr:hover { background-color: rgba(0, 0, 0, 0.04); }

[data-theme=dark] .post-content table {
  background: rgba(15, 23, 42, 0.95);
  border-color: rgba(148, 163, 184, 0.18);
}
[data-theme=dark] .post-content th {
  color: rgba(203, 213, 225, 0.85);
  border-bottom-color: rgba(148, 163, 184, 0.15);
}
[data-theme=dark] .post-content td {
  border-bottom-color: rgba(148, 163, 184, 0.08);
  color: rgba(203, 213, 225, 0.8);
}
[data-theme=dark] .post-content tbody tr:hover {
  background-color: rgba(30, 41, 59, 0.8);
}

/* ===== Code Blocks with macOS Dots ===== */
.highlight {
  background: #f6f8fa;
  color: #24292e;
  border-radius: 10px;
  border: 1px solid #d0d7de;
  margin: 20px 0;
  overflow: hidden;
  position: relative;
  transition: background-color .3s ease, color .3s ease, border-color .3s ease;
}

.highlight::before {
  content: " ";
  display: block;
  height: 12px; width: 12px;
  margin: 15px;
  background: #ff5f56;
  border-radius: 50%;
  box-shadow: 20px 0 #ffbd2e, 40px 0 #27c93f;
  position: absolute;
  top: 0; left: 0;
  z-index: 2;
}

.highlight pre {
  margin: 0;
  padding: 45px 15px 15px;
  overflow: auto;
  background-color: initial !important;
  border: none !important;
  border-radius: 0 !important;
}

[data-theme=dark] .highlight {
  background: #282a36;
  color: #f8f8f2;
  border: 1px solid #44475a;
}

/* ===== Code Copy Button ===== */
.copy-code-btn {
  position: absolute;
  top: 10px; right: 10px;
  background: rgba(0, 0, 0, 0.05);
  border: none;
  border-radius: 4px;
  color: #555;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 16px;
  transition: all .2s;
  opacity: 0;
  z-index: 10;
}
.highlight:hover .copy-code-btn { opacity: 1; }
.copy-code-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  transform: scale(1.1);
}
[data-theme=dark] .copy-code-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #f8f8f2;
}

/* ===== Barrage (Danmaku) ===== */
.barrager {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
  contain: layout style paint;
  content-visibility: auto;
}

.barrage-item {
  position: absolute;
  display: inline-flex;
  align-items: flex-start;
  white-space: nowrap;
  will-change: transform;
  pointer-events: auto;
  user-select: none;
  transform: translateX(-100%);
  z-index: 10;
  opacity: 0.9;
  transform-origin: left top;
  backface-visibility: hidden;
}

.barrage-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  margin-right: 8px;
  object-fit: cover;
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
  background: #fff;
}

.barrage-bubble {
  background: #fff;
  color: #1f1f1f;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.4;
  position: relative;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.08);
  max-width: 260px;
  white-space: normal;
  word-break: break-all;
}

.barrage-bubble::before {
  content: '';
  position: absolute;
  top: 10px; left: -5px;
  width: 0; height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-right: 5px solid #fff;
}

[data-theme=dark] .barrage-avatar {
  border-color: #444;
  background: #222;
}
[data-theme=dark] .barrage-bubble {
  background: #262626;
  color: #e5e5e5;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: none;
}
[data-theme=dark] .barrage-bubble::before { border-right-color: #262626; }

.barrage-item:hover .barrage-bubble { background: #f0f0f0; }
.barrage-item:hover .barrage-bubble::before { border-right-color: #f0f0f0; }
[data-theme=dark] .barrage-item:hover .barrage-bubble { background: #333; }

@keyframes barrage-slide-right {
  0% { transform: translateX(-100%); opacity: 0; }
  5% { opacity: 1; }
  95% { opacity: 1; }
  100% { transform: translateX(100vw); opacity: 0; }
}

/* ===== Floating Tools ===== */
.floating-tools {
  position: fixed;
  bottom: 24px; right: 16px;
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: 9px;
  align-items: center;
  opacity: 1;
  visibility: visible;
  transition: opacity .2s ease, visibility .2s ease;
}

.floating-tools.hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.floating-tools a {
  width: 40px; height: 40px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: rgba(24, 24, 27, 0.75);
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  transition: all .2s ease;
}

.floating-tools a:hover {
  background: rgba(255, 255, 255, 0.85);
  color: rgba(24, 24, 27, 0.95);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}

[data-theme=dark] .floating-tools a {
  background: rgba(30, 41, 59, 0.6);
  color: rgba(241, 245, 249, 0.75);
  border-color: rgba(148, 163, 184, 0.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-theme=dark] .floating-tools a:hover {
  background: rgba(30, 41, 59, 0.85);
  color: rgba(241, 245, 249, 0.95);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

#back-to-top {
  opacity: 0;
  visibility: hidden;
  height: 0;
  overflow: hidden;
  transform: translate3d(0, 10px, 0) scale(0.8);
  pointer-events: none;
  transition: opacity .3s ease, transform .3s ease, visibility .3s, height .3s ease;
}

#back-to-top.show {
  opacity: 1;
  visibility: visible;
  height: 42px;
  transform: translate3d(0, 0, 0) scale(1);
  pointer-events: auto;
}

#back-to-top.show:hover {
  transform: translate3d(0, -3px, 0) scale(1);
}

/* ===== Theme Toggle Animation ===== */
#theme-toggle i {
  transition: transform .5s cubic-bezier(.4, 0, .2, 1);
}
#theme-toggle.rotate i {
  transform: rotate(360deg);
}

/* ===== Search Modal ===== */
.search-modal {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.28);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .28s ease, visibility .28s ease;
}

.search-modal.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.search-modal-content {
  background: rgba(255, 255, 255, 0.94);
  margin: auto;
  padding: 24px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  width: 86%;
  max-width: 540px;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transform: translateY(18px) scale(0.97);
  transition: opacity .28s .04s ease, transform .32s .04s cubic-bezier(.22, .61, .36, 1);
}

.search-modal.show .search-modal-content {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.search-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}

.search-header h3 {
  margin: 0;
  font-size: 1.2rem;
  color: #333;
}

.close-search {
  color: #aaa;
  font-size: 28px;
  font-weight: 700;
  cursor: pointer;
}
.close-search:hover { color: #000; }

.search-input-wrapper {
  display: flex;
  align-items: center;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  margin-bottom: 16px;
  padding: 5px 10px;
  background: rgba(0, 0, 0, 0.025);
  transition: border-color .2s ease, box-shadow .2s ease;
}

.search-input-wrapper:focus-within {
  border-color: rgba(0, 0, 0, 0.18);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.04);
}

.search-input-wrapper input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px;
  font-size: 16px;
  outline: none;
}

.search-input-wrapper button {
  background: transparent;
  border: none;
  cursor: pointer;
  color: #666;
  padding: 0 10px;
}

.search-results { max-height: 400px; overflow-y: auto; }

[data-theme=dark] .search-modal { background: rgba(0, 0, 0, 0.48); }
[data-theme=dark] .search-modal-content {
  background: rgba(30, 33, 40, 0.94);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
[data-theme=dark] .search-header { border-bottom-color: rgba(255, 255, 255, 0.08); }
[data-theme=dark] .search-header h3 { color: #e5e7eb; }
[data-theme=dark] .close-search { color: #888; }
[data-theme=dark] .close-search:hover { color: #fff; }
[data-theme=dark] .search-input-wrapper {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pjax-fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pjax-fade-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-10px); }
}

.pjax-leave {
  position: absolute;
  top: 0; width: 100%;
  animation: pjax-fade-out .3s ease-in forwards;
  z-index: 0;
}

.pjax-enter {
  animation: pjax-fade-in .3s ease-out forwards;
  z-index: 1;
  position: relative;
}

/* ===== Skeleton Loading ===== */
.skeleton-line {
  background: #e0e0e0;
  border-radius: 4px;
  background-image: linear-gradient(90deg, #e0e0e0 0px, #f5f5f5 40px, #e0e0e0 80px);
  background-size: 600px;
  animation: skeleton-loading 1.6s infinite ease-out;
}

@keyframes skeleton-loading {
  0% { background-position: -100px; }
  100% { background-position: 140px; }
}

[data-theme=dark] .skeleton-line {
  background: #1f2937;
  background-image: linear-gradient(90deg, #1f2937 0px, #374151 40px, #1f2937 80px);
}

/* ===== Links Page ===== */
.link-title {
  text-align: center;
  margin-top: 20px;
  margin-bottom: 14px;
}

.link-title span {
  display: inline-block;
  margin-top: 6px; margin-bottom: 6px;
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  color: #4b5563;
}
[data-theme=dark] .link-title span { color: #e5e7eb; }

.links-item {
  position: relative;
  padding: 10px 10px 15px 0;
  font-size: 14px;
  width: 135px;
  box-sizing: border-box;
  display: inline-block;
  vertical-align: top;
  background: #fafafa;
  border-radius: 4px;
}

.links-item img {
  border-radius: 4px;
  float: left;
  width: 45px; height: 45px;
  background: #fff;
}

.links-item a {
  display: block;
  padding: 0 14px;
  margin-top: 13px;
  margin-left: 44px;
  word-break: keep-all;
  height: 32px;
}

/* ===== Archives Page ===== */
.a-archives {
  margin-top: 6px;
  display: inline-block;
  color: #374151;
  font-size: 0.95rem;
}
[data-theme=dark] .a-archives { color: #e5e7eb; }

.articles_date_time {
  padding: 3px 5px;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
  background-color: rgba(52, 58, 64, 0.1);
  color: #324b64;
  margin-right: 5px;
  border-radius: 999px;
}
[data-theme=dark] .articles_date_time {
  background-color: rgba(148, 163, 184, 0.25);
  color: #e5e7eb;
}

/* ===== About Page ===== */
.about-card {
  background-color: initial;
  border-radius: 0;
  padding: 0;
  box-shadow: none !important;
  margin-bottom: 30px;
}

/* ===== Skills Section ===== */
.skills-section { margin-top: 2.5rem; }

.section-title {
  font-size: 0.9rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #9ca3af;
  margin-bottom: 1.25rem;
}

.skills-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow: hidden;
}

.skills-row { position: relative; overflow: hidden; }

.skills-track {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  white-space: nowrap;
  animation: skills-scroll 26s linear infinite;
}

.skills-track-reverse { animation-direction: reverse; }

.skill-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: rgba(255, 255, 255, 0.86);
  font-size: 0.8rem;
  color: #374151;
}

@keyframes skills-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

[data-theme=dark] .section-title { color: #6b7280; }
[data-theme=dark] .skill-tag {
  border-color: rgba(31, 41, 55, 0.85);
  background: rgba(15, 23, 42, 0.96);
  color: #e5e7eb;
}

/* ===== Link Card ===== */
a.link-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin: 1rem 0;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  text-decoration: none !important;
  color: #1a1a1a;
  font-size: 14px;
  line-height: 1.5;
  transition: all .25s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

a.link-card:hover {
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

a.link-card .link-card-icon {
  width: 28px; height: 28px;
  border-radius: 8px;
  flex-shrink: 0;
  object-fit: cover;
  background: #f5f5f5;
  padding: 4px;
}

a.link-card .link-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

a.link-card .link-card-title {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
  color: #1a1a1a;
}

a.link-card .link-card-url {
  font-size: 11px;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Mono', Monaco, monospace;
}

a.link-card .link-card-arrow {
  flex-shrink: 0;
  color: #999;
  font-size: 14px;
  transition: all .25s ease;
}

a.link-card:hover .link-card-arrow {
  color: #333;
  transform: translateX(2px);
}

[data-theme=dark] a.link-card {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(30, 30, 30, 0.85);
  color: #e5e5e5;
}
[data-theme=dark] a.link-card .link-card-title { color: #e5e5e5; }
[data-theme=dark] a.link-card .link-card-url { color: #888; }
[data-theme=dark] a.link-card .link-card-icon { background: #2a2a2a; }

/* ===== Selection Popup ===== */
#selection-popup {
  position: fixed;
  display: none;
  background: rgba(30, 30, 30, 0.9);
  color: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  z-index: 2147483647;
  transform: translate(-50%, -100%);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: opacity .2s, transform .2s;
  font-weight: 500;
  animation: popIn .2s cubic-bezier(.18, .89, .32, 1.28);
}

@keyframes popIn {
  0% { transform: translate(-50%, -80%) scale(0.9); opacity: 0; }
  100% { transform: translate(-50%, -100%) scale(1); opacity: 1; }
}

#selection-popup::after {
  content: '';
  position: absolute;
  top: 100%; left: 50%;
  margin-left: -6px;
  border-width: 6px;
  border-style: solid;
  border-color: rgba(30, 30, 30, 0.9) transparent transparent transparent;
}

[data-theme=dark] #selection-popup {
  background: rgba(255, 255, 255, 0.95);
  color: #000;
}
[data-theme=dark] #selection-popup::after {
  border-color: rgba(255, 255, 255, 0.95) transparent transparent transparent;
}

/* ===== Image Grid ===== */
.img-grid {
  display: grid;
  gap: 4px;
  margin: 0.2rem 0;
}
.img-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.img-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.img-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  body {
    background-attachment: scroll !important;
  }
  h1 { font-size: 1.375rem; }
  h2 { font-size: 1.25rem; }
  h3 { font-size: 1.125rem; }
  h4, h5, h6 { font-size: 1rem; }

  .main {
    padding: 20px;
    margin: 0 auto;
    box-shadow: none;
  }

  .header-top { justify-content: flex-start; }
  .header-avatar { margin-right: 0; justify-content: flex-start; }

  .header-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-left: 10px;
    width: calc(100vw - 140px);
  }

  .header-social {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 2px;
    width: 100%;
    justify-content: center;
    height: 24px;
  }

  .header-bio {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    text-align: center;
  }

  .header-menu {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-left: -20px;
    margin-right: -20px;
    padding-left: 20px;
    border-top: none;
  }

  .header-menu::-webkit-scrollbar { display: none; }

  .header-menu ul.flat {
    flex-wrap: nowrap;
    white-space: nowrap;
    padding-right: 20px;
  }

  .header-menu ul.flat li { flex: none; }

  .searchable-header-container {
    flex-wrap: wrap;
    height: auto;
    min-height: 40px;
  }

  .search-hint-wrapper {
    position: relative;
    left: auto; top: auto;
    transform: none !important;
    margin-left: 8px;
    opacity: 1;
  }

  .search-mascot { width: 28px; height: 28px; }

  .search-hint {
    font-size: 12px;
    padding: 5px 10px;
    white-space: normal;
    max-width: 200px;
  }

  .img-grid.cols-3, .img-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 767px) {
  .mobile-hide { display: none !important; }
  .container { margin-top: 10px; }
}

/* ===== Chroma Syntax Highlighting (Light) ===== */
.chroma { color: #24292e; background-color: #fff; }
.chroma .err { color: #a61717; background-color: #e3d2d2; }
.chroma .k { color: #000; font-weight: 700; }
.chroma .kc, .chroma .kd, .chroma .kn, .chroma .kp, .chroma .kr { color: #000; font-weight: 700; }
.chroma .kt { color: #458; font-weight: 700; }
.chroma .na { color: teal; }
.chroma .nb { color: #0086b3; }
.chroma .nc { color: #458; font-weight: 700; }
.chroma .ne { color: #900; font-weight: 700; }
.chroma .nf { color: #900; font-weight: 700; }
.chroma .nt { color: navy; }
.chroma .nv { color: teal; }
.chroma .s, .chroma .sa, .chroma .sb, .chroma .sc, .chroma .dl,
.chroma .sd, .chroma .s2, .chroma .se, .chroma .sh, .chroma .si,
.chroma .sx, .chroma .s1 { color: #d14; }
.chroma .sr { color: #009926; }
.chroma .ss { color: #990073; }
.chroma .m, .chroma .mb, .chroma .mf, .chroma .mh, .chroma .mi,
.chroma .il, .chroma .mo { color: #099; }
.chroma .o, .chroma .ow { color: #000; font-weight: 700; }
.chroma .c, .chroma .ch, .chroma .cm, .chroma .c1 { color: #998; font-style: italic; }
.chroma .cs { color: #999; font-weight: 700; font-style: italic; }
.chroma .cp, .chroma .cpf { color: #999; font-weight: 700; font-style: italic; }
.chroma .gd { color: #000; background-color: #fdd; }
.chroma .ge { color: #000; font-style: italic; }
.chroma .gr { color: #a00; }
.chroma .gh { color: #999; }
.chroma .gi { color: #000; background-color: #dfd; }
.chroma .go { color: #888; }
.chroma .gp { color: #555; }
.chroma .gs { font-weight: 700; }
.chroma .gu { color: #aaa; }
.chroma .gt { color: #a00; }
.chroma .gl { text-decoration: underline; }
.chroma .w { color: #bbb; }

/* ===== Chroma Syntax Highlighting (Dark) ===== */
[data-theme=dark] .chroma { color: #f8f8f2; background-color: #282a36; }
[data-theme=dark] .chroma .k { color: #ff79c6; }
[data-theme=dark] .chroma .kc, [data-theme=dark] .chroma .kn,
[data-theme=dark] .chroma .kp, [data-theme=dark] .chroma .kr { color: #ff79c6; }
[data-theme=dark] .chroma .kd { color: #8be9fd; font-style: italic; }
[data-theme=dark] .chroma .kt { color: #8be9fd; }
[data-theme=dark] .chroma .na { color: #50fa7b; }
[data-theme=dark] .chroma .nb { color: #8be9fd; font-style: italic; }
[data-theme=dark] .chroma .nc { color: #50fa7b; }
[data-theme=dark] .chroma .nf { color: #50fa7b; }
[data-theme=dark] .chroma .nt { color: #ff79c6; }
[data-theme=dark] .chroma .nv { color: #8be9fd; font-style: italic; }
[data-theme=dark] .chroma .s, [data-theme=dark] .chroma .sa,
[data-theme=dark] .chroma .sb, [data-theme=dark] .chroma .sc,
[data-theme=dark] .chroma .dl, [data-theme=dark] .chroma .sd,
[data-theme=dark] .chroma .s2, [data-theme=dark] .chroma .se,
[data-theme=dark] .chroma .sh, [data-theme=dark] .chroma .si,
[data-theme=dark] .chroma .sx, [data-theme=dark] .chroma .sr,
[data-theme=dark] .chroma .s1, [data-theme=dark] .chroma .ss { color: #f1fa8c; }
[data-theme=dark] .chroma .m, [data-theme=dark] .chroma .mb,
[data-theme=dark] .chroma .mf, [data-theme=dark] .chroma .mh,
[data-theme=dark] .chroma .mi, [data-theme=dark] .chroma .il,
[data-theme=dark] .chroma .mo { color: #bd93f9; }
[data-theme=dark] .chroma .o, [data-theme=dark] .chroma .ow { color: #ff79c6; }
[data-theme=dark] .chroma .c, [data-theme=dark] .chroma .ch,
[data-theme=dark] .chroma .cm, [data-theme=dark] .chroma .c1 { color: #6272a4; }
[data-theme=dark] .chroma .cs { color: #6272a4; }
[data-theme=dark] .chroma .cp, [data-theme=dark] .chroma .cpf { color: #ff79c6; }
[data-theme=dark] .chroma .gd { color: #f55; }
[data-theme=dark] .chroma .gi { color: #50fa7b; font-weight: 700; }
[data-theme=dark] .chroma .go { color: #44475a; }
[data-theme=dark] .chroma .gu { font-weight: 700; }

/* ===== Dark Scrollbar ===== */
[data-theme=dark] ::-webkit-scrollbar { width: 13px; background: rgba(15, 23, 42, 0.5); }
[data-theme=dark] ::-webkit-scrollbar-track { background: rgba(30, 41, 59, 0.3); border-radius: 6px; }
[data-theme=dark] ::-webkit-scrollbar-thumb {
  min-height: 16px;
  background-color: rgba(148, 163, 184, 0.4);
  background-clip: padding-box;
  border: 3px solid rgba(30, 41, 59, 0.8);
  border-radius: 6px;
}
[data-theme=dark] ::-webkit-scrollbar-thumb:hover { background-color: rgba(148, 163, 184, 0.6); }
[data-theme=dark] * {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.4) rgba(30, 41, 59, 0.3);
}

/* ===== Global Theme Transition ===== */
body, .main, .header, .footer, .post-content, .post-title,
.floating-tools a, .meta, hr, [data-theme] {
  transition: background-color .5s cubic-bezier(.4, 0, .2, 1),
              color .5s cubic-bezier(.4, 0, .2, 1),
              border-color .5s cubic-bezier(.4, 0, .2, 1) !important;
}

/* ===== Container alignment ===== */
.container { text-align: initial !important; }
