.search-page {
  padding: 2rem;
  border-radius: 16px;
}
/* Keep images at their original brightness in both color themes. */
[data-theme='dark'] img {
  filter: none;
}
@keyframes blur-darken {
  from {
    filter: blur(10px);
  }
  to {
    filter: blur(0);
  }
}
.post-categories .post-categories-cover img.lazyloaded,
.post-categories-wrap .post-categories-cover img.lazyloaded,
.post-categories-wrap:hover .post-categories-cover img.lazyloaded {
  opacity: 1 !important;
}
.article-nav-link-wrap a,
.article-nav-link-wrap img {
  filter: none;
}
@font-face {
  font-family: iconfont;
  src: url('/fonts/site-icons.woff2') format('woff2');
  font-display: swap;
}
#site-search {
  box-sizing: border-box;
  width: 100%;
  padding: 14px;
  margin: 16px 0;
  font: inherit;
  border: 1px solid #888;
  border-radius: 8px;
  color: inherit;
  background: transparent;
}
[data-theme='dark'] #header-nav:hover {
  background: #222;
}
.search-page input {
  box-sizing: border-box;
  width: 100%;
  padding: 14px;
  margin: 16px 0;
  font: inherit;
  border: 1px solid #888;
  border-radius: 8px;
  color: inherit;
  background: transparent;
}
#search-results section {
  padding: 20px 0;
  border-bottom: 1px solid #9995;
}
#search-results a {
  font-size: 1.25rem;
}
:focus-visible {
  outline: 3px solid #b92948;
  outline-offset: 4px;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  #header-title,
  [data-aos] {
    opacity: 1 !important;
    filter: none !important;
    transform: none !important;
  }
  #loader {
    display: none !important;
  }
  .firework {
    display: none !important;
  }
}
/* Waline custom Chinese delete-confirm dialog */
.wl-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
}
.wl-confirm-custom {
  min-width: 280px;
  max-width: 90vw;
  padding: 24px 28px;
  border-radius: 12px;
  background: #fff;
  color: #333;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}
.wl-confirm-custom .wl-confirm-title {
  margin: 0;
  font-size: 1.05rem;
}
.wl-confirm-custom .wl-confirm-buttons {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}
.wl-confirm-custom .wl-btn {
  padding: 6px 18px;
  border-radius: 8px;
  border: 1px solid #bbb;
  background: transparent;
  color: inherit;
  font-size: calc(14px * var(--site-text-scale, 1));
  cursor: pointer;
}
.wl-confirm-custom .wl-confirm-ok {
  background: #e53e52;
  border-color: #e53e52;
  color: #fff;
}
[data-theme='dark'] .wl-confirm-custom {
  background: #1d1f20;
  color: #e5e5e5;
}
[data-theme='dark'] .wl-confirm-custom .wl-btn {
  border-color: #555;
}
/* Waline: more space between like and reply buttons */
.wl-comment-actions .wl-like {
  margin-right: 16px;
}
/* Article section separators: short gray solid line like the original site */
.article-entry hr {
  width: 100px;
  height: 2px;
  margin: 40px auto;
  background: #9c9c9c;
  background-image: none;
  border: 0;
  opacity: 0.55;
  filter: none;
}
[data-theme='dark'] .article-entry hr {
  background: #8a8a8a;
}
/* Meta chips (date / reading time) side by side */
.article-meta {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
}
/* Post sidebar: TOC card on top, menu (home button) card below; both always visible, no toggle */
#sidebar .sidebar-wrap {
  background: transparent;
  justify-content: flex-start;
  overflow: hidden;
}
[data-theme='dark'] #sidebar .sidebar-wrap {
  box-shadow: none;
}
#sidebar .sidebar-wrapper .aos-animate:hover {
  box-shadow: none;
}
#sidebar .sidebar-btn-wrapper {
  display: none;
}
#sidebar .sidebar-toc-sidebar,
#sidebar .sidebar-common-sidebar {
  background: var(--color-wrap);
  border-radius: 12px;
  box-sizing: border-box;
}
[data-theme='dark'] #sidebar .sidebar-toc-sidebar,
[data-theme='dark'] #sidebar .sidebar-common-sidebar {
  box-shadow: var(--shadow-card);
}
#sidebar .sidebar-toc-sidebar {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding: 14px 20px 16px;
  margin-bottom: 12px;
}
#sidebar .sidebar-common-sidebar {
  flex: 0 0 auto;
  display: flex;
  padding: 16px 0;
}
#sidebar .sidebar-toc-sidebar:not(:has(.toc-title)) {
  display: none;
}

/* Sidebar widgets: transparent, match sidebar sections */
#sidebar .widget-wrap {
  background: transparent;
  box-shadow: none;
  margin-top: 16px;
}
#sidebar .widget-wrapper .aos-animate:hover {
  box-shadow: none;
}
/* Align widget block with the menu column (70% / max 200px, centered) */
#sidebar .sidebar-widget {
  width: 70%;
  max-width: 200px;
  margin: 0 auto;
}
#sidebar .widget-title {
  padding: 12px 0 6px;
}
#sidebar .widget {
  padding: 0 0 8px;
}

/* 404 page */
body:has(.page-404) #header-title {
  display: none;
}
.page-404 {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 60px 20px 80px;
}
.glitch-404 {
  position: relative;
  font-size: calc(110px * var(--site-text-scale, 1));
  font-weight: 800;
  letter-spacing: 6px;
  color: var(--red-0);
  line-height: 1;
  text-shadow: 0 0 24px var(--color-red-6-shadow);
  animation: glitch-jitter 3.2s infinite;
}
.glitch-404::before,
.glitch-404::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  opacity: 0;
}
.glitch-404::before {
  color: #16e0e0;
  animation: glitch-layer-a 3.2s infinite;
}
.glitch-404::after {
  color: #ff2fb2;
  animation: glitch-layer-b 3.2s infinite;
}
@keyframes glitch-jitter {
  0%,
  87%,
  100% {
    transform: none;
  }
  89% {
    transform: translate(3px, -1px) skewX(3deg);
  }
  91% {
    transform: translate(-3px, 1px);
  }
  93% {
    transform: translate(2px, 1px) skewX(-3deg);
  }
  95% {
    transform: translate(-1px, 0);
  }
  97% {
    transform: none;
  }
}
@keyframes glitch-layer-a {
  0%,
  87%,
  100% {
    opacity: 0;
    clip-path: inset(0 0 100% 0);
    transform: none;
  }
  88% {
    opacity: 0.85;
    clip-path: inset(12% 0 58% 0);
    transform: translate(-7px, 0);
  }
  90% {
    opacity: 0.85;
    clip-path: inset(58% 0 12% 0);
    transform: translate(7px, 0);
  }
  92% {
    opacity: 0.85;
    clip-path: inset(34% 0 42% 0);
    transform: translate(-5px, 0);
  }
  94% {
    opacity: 0.85;
    clip-path: inset(72% 0 4% 0);
    transform: translate(4px, 0);
  }
  96% {
    opacity: 0;
    clip-path: inset(0 0 100% 0);
  }
}
@keyframes glitch-layer-b {
  0%,
  86%,
  100% {
    opacity: 0;
    clip-path: inset(100% 0 0 0);
    transform: none;
  }
  88% {
    opacity: 0.85;
    clip-path: inset(48% 0 22% 0);
    transform: translate(6px, 0);
  }
  90% {
    opacity: 0.85;
    clip-path: inset(8% 0 74% 0);
    transform: translate(-6px, 0);
  }
  92% {
    opacity: 0.85;
    clip-path: inset(66% 0 10% 0);
    transform: translate(5px, 0);
  }
  94% {
    opacity: 0.85;
    clip-path: inset(24% 0 52% 0);
    transform: translate(-4px, 0);
  }
  96% {
    opacity: 0;
    clip-path: inset(100% 0 0 0);
  }
}
.page-404-text {
  color: var(--grey-7);
  font-size: calc(16px * var(--site-text-scale, 1));
}
.page-404-back {
  color: var(--color-link);
  text-decoration: none;
  border: 1px solid var(--color-red-3-shadow);
  padding: 8px 22px;
  border-radius: 8px;
  transition: 0.3s;
}
.page-404-back:hover {
  border-color: var(--color-h2-after);
  background: var(--color-red-3-shadow);
}

/* Reading progress bar (top of page, article pages only) */
#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10001;
  height: 3px;
  width: 0;
  background: var(--red-0);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px var(--color-red-6-shadow);
  transition: width 0.15s linear;
  pointer-events: none;
}

/* Tools entry cards: always image-left / text-right, even on narrow screens */
@media (max-width: 767px) {
  body:has(.post-categories-wrapper) .post-categories-wrapper {
    display: none;
  }
  #header {
    min-height: 240px;
    height: 240px;
  }
  #logo {
    font-size: calc(26px * var(--site-text-scale, 1));
  }
}
.home-banner-color {
  background: linear-gradient(
    to bottom,
    var(--home-banner-color) 0%,
    var(--home-banner-color) 65%,
    var(--color-background) 100%
  );
}
.home-banner-color #logo,
.home-banner-color #subtitle {
  color: var(--home-banner-text);
}
.tools-cards .post-wrap {
  flex-direction: row !important;
  height: auto;
  min-height: 240px;
}
.tools-cards .post-cover {
  width: 40%;
  height: auto;
}
.tools-cards .post-cover.left {
  border-radius: 12px 0 0 12px;
  -webkit-clip-path: polygon(0 0, 92% 0%, 100% 100%, 0% 100%);
  clip-path: polygon(0 0, 92% 0%, 100% 100%, 0% 100%);
}

/* Tool chips: tag + runtime-type pills, icon follows the tag (mask = currentColor) */
.chip-ico {
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 6px;
  flex: 0 0 auto;
  background: currentColor;
  -webkit-mask: var(--chip-mask) center / contain no-repeat;
  mask: var(--chip-mask) center / contain no-repeat;
}
.chip-ico.tag-game {
  --chip-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 11h4M8 9v4M15 12h.01M18 10h.01'/%3E%3Cpath d='M17.32 5H6.68a4 4 0 0 0-3.98 3.55L2 15.5A3.5 3.5 0 0 0 5.5 19c1.1 0 2.1-.5 2.8-1.3L10 15h4l1.7 2.7c.7.8 1.7 1.3 2.8 1.3a3.5 3.5 0 0 0 3.5-3.5l-.7-6.95A4 4 0 0 0 17.32 5z'/%3E%3C/svg%3E");
}
.chip-ico.tag-utility {
  --chip-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z'/%3E%3C/svg%3E");
}
.chip-ico.tag-media {
  --chip-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'/%3E%3Cpath d='M21 15l-5-5L5 21'/%3E%3C/svg%3E");
}
.chip-ico.tag-dev {
  --chip-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 18l6-6-6-6M8 6l-6 6 6 6'/%3E%3C/svg%3E");
}
.chip-ico.type-embed {
  --chip-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z'/%3E%3C/svg%3E");
}
.chip-ico.type-download {
  --chip-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3'/%3E%3C/svg%3E");
}
.tool-chip {
  display: inline-flex;
  align-items: center;
  font-size: calc(11px * var(--site-text-scale, 1));
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--color-red-3-shadow);
  color: var(--red-0);
}
.tool-emoji {
  font-size: calc(20px * var(--site-text-scale, 1));
  margin-right: 4px;
}
.tool-cover-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: calc(64px * var(--site-text-scale, 1));
  background: linear-gradient(135deg, var(--color-red-3-shadow), transparent);
}

/* Download-type tool pages */
.tool-downloads {
  background: var(--color-wrap);
  border-radius: 12px;
  padding: 20px 24px;
  margin-top: 16px;
  box-shadow: var(--shadow-card);
}
.tool-downloads h3 {
  display: flex;
  align-items: center;
  margin: 0 0 14px;
  color: var(--red-0);
  font-size: calc(20px * var(--site-text-scale, 1));
}
.tool-dl {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 20px;
  min-height: 88px;
  box-sizing: border-box;
  padding: 20px 24px;
  margin-top: 10px;
  border: 1px solid var(--color-red-3-shadow);
  border-radius: 10px;
  text-decoration: none;
  color: var(--grey-9);
  transition:
    transform 0.2s,
    border-color 0.2s,
    box-shadow 0.2s;
}
.tool-dl:hover {
  transform: translateY(-2px);
  border-color: var(--red-0);
  box-shadow: 0 6px 16px var(--color-red-6-shadow);
}
.tool-dl-name {
  font-weight: 700;
  font-size: calc(20px * var(--site-text-scale, 1));
  overflow-wrap: anywhere;
  margin-right: auto;
}
.tool-dl small {
  font-size: calc(16px * var(--site-text-scale, 1));
  color: var(--grey-7);
  white-space: nowrap;
}
.tool-dl.locked {
  border-style: dashed;
}
.tool-dl-lock {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: calc(14px * var(--site-text-scale, 1));
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--color-red-3-shadow);
  color: var(--red-0);
  white-space: nowrap;
}
@media (max-width: 600px) {
  .tool-dl {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    padding: 18px;
  }
  .tool-dl-name {
    grid-column: 1 / -1;
    font-size: calc(18px * var(--site-text-scale, 1));
  }
  .tool-dl small {
    white-space: normal;
  }
}
/* De-brand: hide the chibi character background in the search / 404 popup */
.site-bg {
  display: none !important;
}
.post-link-card-cover-wrap.site-icon {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  padding: 7px;
  margin-right: 14px;
  background: var(--color-background);
  border-radius: 8px;
}
.post-link-card-cover-wrap.site-icon img {
  object-fit: contain;
  box-shadow: none;
}
.post-link-card-cover-wrap.site-icon [hidden] {
  display: none !important;
}
.search-result-kind {
  display: inline-block;
  font-size: calc(11px * var(--site-text-scale, 1));
  color: var(--red-1);
  background: var(--color-red-3-shadow);
  padding: 2px 8px;
  margin-right: 8px;
  border-radius: 8px;
}
.download-dialog {
  width: min(420px, calc(100vw - 32px));
  box-sizing: border-box;
  padding: 28px;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background: var(--color-wrap);
  color: var(--color-default);
  font: inherit;
  box-shadow: var(--shadow-card-hover);
}
.download-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}
.download-dialog form {
  display: grid;
  gap: 14px;
}
.download-dialog h2 {
  margin: 0;
  color: var(--red-1);
  font-size: calc(22px * var(--site-text-scale, 1));
}
.download-filename {
  margin: 0;
  color: var(--grey-9);
  overflow-wrap: anywhere;
}
.download-dialog input[name='password'] {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  color: inherit;
  padding: 12px;
  border: 1px solid var(--color-border);
  background: var(--color-code-background);
  border-radius: 8px;
}
.download-show {
  display: flex;
  gap: 8px;
  align-items: center;
}
.download-error {
  min-height: 20px;
  margin: 0;
  color: var(--red-1);
  font-size: calc(14px * var(--site-text-scale, 1));
}
.download-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.download-dialog button {
  font: inherit;
  cursor: pointer;
  padding: 10px 16px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-code-background);
  color: inherit;
}
.download-dialog .download-confirm {
  color: #fff;
  background: var(--red-1);
  border-color: var(--red-1);
}
.download-dialog .download-close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: 0;
  background: transparent;
  font-size: calc(24px * var(--site-text-scale, 1));
  padding: 4px 10px;
}
.download-dialog button:disabled {
  opacity: 0.6;
  cursor: wait;
}
.kofi-link {
  text-decoration: none;
}
.kofi-link:focus-visible {
  outline: 3px solid var(--red-1);
  outline-offset: 4px;
}
button.sponsor-button {
  background: transparent;
  padding: 0;
  font: inherit;
}
button.sponsor-button:focus-visible {
  outline: 3px solid var(--red-1);
  outline-offset: 4px;
}
.sponsor-qr[hidden] {
  display: none;
}
.article-entry iframe.web-tool-frame {
  display: block;
  width: 100%;
  height: min(900px, 80vh);
  min-height: 480px;
  border: 0;
  border-radius: 10px;
  background: transparent;
}

.download-dialog .download-confirm,
#anime-search button:not(.secondary),
#calculator-example button[type='submit'],
#wuwa-app .btn-primary {
  color: var(--color-on-accent, #fff);
}

.image-caption {
  text-align: center;
  font-size: 0.9em;
  color: var(--color-default);
  margin-top: -8px !important;
}
.main-nav-link,
.sidebar-menu-link {
  color: var(--color-link);
}
