:root {
  --paper-bg: #f6f1e7;
  --paper-bg2: #f1eadb;
  --paper-bg3: #eae1cf;
  --paper-bg4: #e0d4bf;
  --paper-surface: #faf6ee;
  --paper-surface2: #f4eee1;
  --paper-surface3: #ece3d2;
  --paper-border: rgba(90, 75, 50, .10);
  --paper-border2: rgba(90, 75, 50, .14);
  --paper-ink: #2b2419;
  --paper-ink-soft: #6b5f4e;
  --paper-ink-faint: #9a8d78;
  --paper-seal: #a8533a;
  --paper-seal-hv: #bd6447;
  --paper-gold: #b3925a;
  --paper-shadow: 0 1px 3px rgba(90, 75, 50, .06), inset 0 1px 0 rgba(255, 255, 255, .6);
}

html[data-theme='dark'] {
  --paper-bg: #211d18;
  --paper-bg2: #28231d;
  --paper-bg3: #332c23;
  --paper-bg4: #40372b;
  --paper-surface: #2b251e;
  --paper-surface2: #362e24;
  --paper-surface3: #42382b;
  --paper-border: rgba(255, 235, 205, .10);
  --paper-border2: rgba(255, 235, 205, .16);
  --paper-ink: #efe4d3;
  --paper-ink-soft: #b8a992;
  --paper-ink-faint: #877a67;
  --paper-seal: #c66a4b;
  --paper-seal-hv: #d97b5b;
  --paper-gold: #c6a564;
  --paper-shadow: 0 1px 3px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .04);
}

body,
button,
input,
select,
textarea {
  font-family: 'Noto Serif SC', 'Songti SC', 'SimSun', 'Source Han Serif SC', serif;
}

#web_bg {
  background: var(--paper-bg) !important;
  filter: none !important;
  transform: none !important;
}

#web_bg::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(rgba(90, 86, 82, .04) .8px, transparent .8px),
    repeating-linear-gradient(90deg, transparent 0 9px, rgba(140, 120, 90, .012) 9px 10px);
  background-size: 4px 4px, auto;
}

.card-widget,
.recent-post-item,
.post-toc,
.post-block,
#footer,
.layout > div {
  background: var(--paper-surface) !important;
  border: 1px solid var(--paper-border) !important;
  border-radius: 10px;
  box-shadow: var(--paper-shadow);
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

#nav {
  background: var(--paper-surface) !important;
  border: 1px solid var(--paper-border2) !important;
  border-radius: 12px;
  box-shadow: var(--paper-shadow);
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

a,
.post-title,
.post-meta a {
  color: var(--paper-seal) !important;
}

a:hover,
.post-title:hover {
  color: var(--paper-seal-hv) !important;
}

h1,
h2,
h3,
.site-name,
#site-title,
.card-widget .item-headline,
.aside-title {
  font-family: 'Noto Serif SC', 'Songti SC', 'SimSun', 'Source Han Serif SC', serif;
  letter-spacing: .08em;
  color: var(--paper-ink) !important;
}

#site-title {
  letter-spacing: .18em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .55);
}

.card-widget .item-headline,
.aside-title {
  border-bottom: 1px solid var(--paper-border);
}

pre,
code {
  background: var(--paper-surface2) !important;
  border: 1px solid var(--paper-border2) !important;
  color: var(--paper-ink-soft) !important;
}

::selection {
  background: rgba(168, 83, 58, .18);
  color: var(--paper-ink);
}

/* Paper splash */
.paper-splash {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: #f6f1e7;
  color: #2b2419;
  transition: opacity .4s ease;
}

.paper-splash::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(rgba(90, 86, 82, .05) .8px, transparent .8px),
    repeating-linear-gradient(90deg, transparent 0 9px, rgba(140, 120, 90, .015) 9px 10px);
  background-size: 4px 4px, auto;
  pointer-events: none;
}

.paper-splash .ink-phase {
  width: 110px;
  height: 110px;
  position: relative;
  margin-bottom: 26px;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 38% 34%, #fbf8f2, #efe9df);
  box-shadow:
    inset 0 0 0 1px rgba(120, 100, 70, .14),
    inset 0 2px 6px rgba(120, 100, 70, .06),
    0 6px 24px rgba(90, 86, 82, .10);
}

.paper-splash .ink-body::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background-image: radial-gradient(rgba(120, 100, 70, .05) .7px, transparent .7px);
  background-size: 5px 5px;
}

.paper-splash .ink-shadow {
  position: absolute;
  inset: -80%;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #5a544d, #332f2b 68%, #221f1c);
  animation: paperInkScan 7s linear infinite;
}

@keyframes paperInkScan {
  0% { transform: translate(-80%, 0); }
  50% { transform: translate(30%, 0); }
  100% { transform: translate(130%, 0); }
}

.paper-splash .ink-dots {
  position: absolute;
  inset: -46px;
  border-radius: 50%;
  pointer-events: none;
}

.paper-splash .ink-dots i {
  position: absolute;
  border-radius: 50%;
  background: rgba(90, 86, 82, .32);
  animation: paperDotDrift 5s ease-in-out infinite;
}

.paper-splash .ink-dots i:nth-child(1) { width: 4px; height: 4px; top: 18%; left: 8%; }
.paper-splash .ink-dots i:nth-child(2) { width: 2.5px; height: 2.5px; top: 74%; left: 82%; animation-delay: -1.6s; }
.paper-splash .ink-dots i:nth-child(3) { width: 3px; height: 3px; top: 86%; left: 22%; animation-delay: -3.2s; background: rgba(194, 117, 90, .4); }
.paper-splash .ink-dots i:nth-child(4) { width: 2px; height: 2px; top: 30%; left: 90%; animation-delay: -2.4s; }

@keyframes paperDotDrift {
  0%, 100% { transform: translate(0, 0); opacity: .5; }
  50% { transform: translate(3px, -4px); opacity: 1; }
}

.paper-splash .paper-brand {
  position: relative;
  z-index: 1;
  font-family: 'Songti SC', 'Noto Serif SC', 'STSong', 'SimSun', serif;
  font-size: 44px;
  font-weight: 600;
  letter-spacing: 24px;
  text-indent: 24px;
  color: #4a443e;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .55);
  margin-bottom: 10px;
  animation: paperWrite 1.8s ease .3s both;
}

@keyframes paperWrite {
  0% { opacity: 0; letter-spacing: 48px; filter: blur(7px); }
  60% { opacity: 1; letter-spacing: 24px; filter: blur(0); }
  100% { opacity: 1; letter-spacing: 24px; }
}

.paper-splash .paper-brand-sub {
  position: relative;
  z-index: 1;
  font-size: 10px;
  letter-spacing: 6px;
  color: #a89f8e;
  margin-bottom: 22px;
  animation: paperFadeUp 1.2s ease .8s both;
}

.paper-splash .paper-seal {
  position: relative;
  z-index: 1;
  width: 34px;
  height: 34px;
  background: #a8533a;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f7f3ec;
  font-size: 11px;
  box-shadow: 0 2px 8px rgba(168, 83, 58, .28);
  animation: paperSealPop 1s cubic-bezier(.2, 1.6, .4, 1) 1.2s both;
}

@keyframes paperFadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes paperSealPop {
  from { opacity: 0; transform: scale(1.7) rotate(8deg); }
  to { opacity: 1; transform: scale(1) rotate(0); }
}

.paper-splash .paper-curtain {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 100%;
  z-index: 200;
  background: #faf6ef;
  background-image:
    radial-gradient(rgba(90, 86, 82, .045) .7px, transparent .7px),
    repeating-linear-gradient(0deg, transparent 0 4px, rgba(140, 120, 90, .012) 4px 5px);
  background-size: 4px 4px, auto;
  border-left: 1px solid rgba(120, 100, 70, .14);
  box-shadow: -10px 0 30px rgba(90, 86, 82, .07);
  transform: translateX(100%);
  animation: paperCurtainIn 1s ease .8s forwards;
}

.paper-splash .paper-curtain::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: linear-gradient(180deg, transparent, rgba(60, 55, 50, .16) 30%, rgba(60, 55, 50, .16) 70%, transparent);
}

.paper-splash .paper-curtain::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, rgba(194, 117, 90, .5), rgba(194, 117, 90, .08) 40%, transparent);
}

@keyframes paperCurtainIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.paper-splash.done .paper-curtain {
  animation: paperCurtainOut 1s ease 0s forwards !important;
}

@keyframes paperCurtainOut {
  from { transform: translateX(0); }
  to { transform: translateX(100%); }
}

/* Paper splash curtain no longer covers the brand text */
.paper-splash .paper-curtain {
  display: none !important;
}

/* Avatar ripple, no rotation */
.avatar-img {
  animation: none !important;
  transform: none !important;
  position: relative;
}

.avatar-img::before,
.avatar-img::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(168, 83, 58, .35);
  animation: paperRipple 2.4s ease-out infinite;
  pointer-events: none;
}

.avatar-img::after {
  animation-delay: 1.2s;
}

@keyframes paperRipple {
  from { transform: scale(1); opacity: .8; }
  to { transform: scale(1.8); opacity: 0; }
}

/* Compact top bar + main + sidebar layout */
#page-header.full_page {
  min-height: 0 !important;
  padding: 12px 20px !important;
  background: var(--paper-surface) !important;
  position: relative;
}

#page-header.full_page #site-info {
  display: none !important;
}

#nav {
  position: sticky;
  top: 0;
  z-index: 100;
  max-width: 1280px;
  margin: 0 auto;
}

#body-wrap {
  background: transparent !important;
}

.layout {
  max-width: 1280px;
  margin: 20px auto 40px;
  padding: 0 20px;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 320px !important;
  gap: 20px !important;
  align-items: start;
}

#aside-content {
  position: sticky;
  top: 76px;
}

#aside-content .card-widget {
  margin-bottom: 16px;
}

.card-music #music-player {
  margin-top: 12px;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr !important;
  }
  #aside-content {
    position: static;
  }
}
