/* Paper Blog — Components */

/* ── Music Player ──────────────────────────────── */

.paper-player {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin: 20px 0;
  box-shadow: 0 2px 8px var(--shadow);
}

.pp-inner {
  display: flex;
  gap: 16px;
  align-items: center;
}

.pp-cover {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--code-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}
.pp-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pp-body {
  flex: 1;
  min-width: 0;
}

.pp-info { margin-bottom: 8px; }
.pp-title { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-artist { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pp-progress-wrap { margin-bottom: 8px; }

.pp-progress {
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.pp-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0;
  transition: width .1s linear;
}

.pp-time {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.pp-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pp-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all .15s;
}
.pp-btn:hover { color: var(--ink); background: var(--code-bg); }
.pp-btn.active { color: var(--accent); }

.pp-play { color: var(--ink); }
.pp-play:hover { color: var(--accent); }

.pp-volume {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.pp-vol-slider {
  width: 70px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--line);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.pp-vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}
.pp-vol-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

@media (max-width: 480px) {
  .pp-inner { flex-direction: column; align-items: stretch; }
  .pp-cover { width: 100%; height: 120px; border-radius: 8px; }
  .pp-vol-slider { width: 50px; }
}

/* ── Cards ─────────────────────────────────────── */

.paper-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  margin: 20px 0;
  box-shadow: 0 2px 12px var(--shadow);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.paper-card.card-left { text-align: left; }
.paper-card.card-right { text-align: right; }

.paper-card .card-icon { font-size: 40px; margin-bottom: 12px; }
.paper-card .card-title { font-size: 22px; font-weight: 600; margin: 0 0 6px; }
.paper-card .card-subtitle { font-size: 14px; color: var(--muted); margin: 0 0 4px; }
.paper-card .card-text { font-size: 13px; color: var(--muted); font-style: italic; margin: 0 0 6px; }
.paper-card .card-divider { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
.paper-card .card-footer { padding-top: 4px; }

/* ── Counter Button ────────────────────────────── */

.paper-counter-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
}

.pcb-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 24px;
  cursor: pointer;
  color: var(--ink);
  font-size: 15px;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all .2s;
}
.pcb-btn:hover { border-color: var(--accent); color: var(--accent); }
.pcb-btn.clicked { opacity: .6; cursor: default; border-color: var(--accent); color: var(--accent); }

.pcb-icon { font-size: 18px; }

.pcb-count {
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
}

/* ── Buttons ───────────────────────────────────── */

.paper-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: none;
  color: var(--ink);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
  margin: 4px;
}
.paper-btn:hover { border-color: var(--accent); color: var(--accent); }
.paper-btn.btn-primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.paper-btn.btn-primary:hover { opacity: .85; }
.paper-btn.btn-accent { background: var(--accent); color: var(--paper); border-color: var(--accent); }
.paper-btn.btn-accent:hover { opacity: .85; }
.paper-btn.btn-sm { padding: 4px 12px; font-size: 12px; }
.paper-btn.btn-lg { padding: 12px 28px; font-size: 16px; }

/* ── Diagnosis Card ────────────────────────────── */

.paper-diagnosis {
  border: 2px solid #c0392b;
  border-radius: 4px;
  padding: 0;
  margin: 24px 0;
  font-family: 'Courier New', 'SimSun', monospace;
  background: #fffef5;
  max-width: 480px;
  box-shadow: 2px 2px 6px rgba(0,0,0,.1);
  position: relative;
  overflow: hidden;
}
[data-theme="dark"] .paper-diagnosis { background: #2a2420; border-color: #8b3a3a; }

.paper-diagnosis .diag-header {
  background: #c0392b;
  color: #fff;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  text-align: center;
  text-transform: uppercase;
}
[data-theme="dark"] .paper-diagnosis .diag-header { background: #8b3a3a; }

.paper-diagnosis .diag-stamp {
  position: absolute;
  top: 44px;
  right: 20px;
  width: 64px;
  height: 64px;
  border: 3px solid #c0392b;
  border-radius: 50%;
  color: #c0392b;
  font-size: 16px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(-15deg);
  opacity: .3;
  pointer-events: none;
  letter-spacing: 2px;
}
[data-theme="dark"] .paper-diagnosis .diag-stamp { color: #c07878; border-color: #c07878; }

.paper-diagnosis .diag-body {
  padding: 16px;
}
.paper-diagnosis .diag-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.6;
}
.paper-diagnosis .diag-label {
  color: var(--muted);
  white-space: nowrap;
  min-width: 70px;
}
.paper-diagnosis .diag-value {
  color: var(--ink);
  font-weight: 600;
}
.paper-diagnosis .diag-divider {
  border: none;
  border-top: 1px dashed var(--line);
  margin: 10px 0;
}
.paper-diagnosis .diag-result {
  font-size: 15px;
  font-weight: 700;
  color: #c0392b;
  text-align: center;
  padding: 8px;
  border: 1px dashed #c0392b;
  margin-top: 8px;
}
[data-theme="dark"] .paper-diagnosis .diag-result { color: #e07878; border-color: #e07878; }

.paper-diagnosis .diag-footer {
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  padding: 6px 16px 10px;
  border-top: 1px solid var(--line);
}

/* ── Tombstone ─────────────────────────────────── */

.paper-tombstone {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 32px auto;
  max-width: 300px;
  user-select: none;
}

.paper-tombstone .tomb-stone {
  position: relative;
  background: linear-gradient(180deg, #9e9e9e 0%, #757575 40%, #616161 100%);
  border-radius: 50% 50% 4px 4px / 30% 30% 4px 4px;
  padding: 32px 28px 24px;
  text-align: center;
  color: #e0e0e0;
  min-width: 200px;
  box-shadow: 0 4px 12px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.15);
  border: 1px solid #555;
}
[data-theme="dark"] .paper-tombstone .tomb-stone {
  background: linear-gradient(180deg, #5a5a5a 0%, #3e3e3e 40%, #2e2e2e 100%);
  border-color: #444;
}

.paper-tombstone .tomb-stone::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 2px;
  background: rgba(255,255,255,.1);
  border-radius: 1px;
}

.paper-tombstone .tomb-cross {
  font-size: 22px;
  margin-bottom: 6px;
  opacity: .7;
}

.paper-tombstone .tomb-rip {
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 4px;
  margin-bottom: 8px;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}

.paper-tombstone .tomb-name {
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
  text-shadow: 0 1px 2px rgba(0,0,0,.3);
}

.paper-tombstone .tomb-dates {
  font-size: 12px;
  opacity: .7;
  margin-bottom: 8px;
}

.paper-tombstone .tomb-epitaph {
  font-size: 12px;
  font-style: italic;
  opacity: .8;
  line-height: 1.4;
  max-width: 180px;
  margin: 0 auto;
}

.paper-tombstone .tomb-base {
  width: 110%;
  height: 14px;
  background: linear-gradient(180deg, #6d6d6d 0%, #4a4a4a 100%);
  border-radius: 0 0 2px 2px;
  box-shadow: 0 2px 4px rgba(0,0,0,.3);
}
[data-theme="dark"] .paper-tombstone .tomb-base {
  background: linear-gradient(180deg, #3a3a3a 0%, #252525 100%);
}

.paper-tombstone .tomb-ground {
  width: 140%;
  height: 20px;
  background: linear-gradient(180deg, #5d7a3e 0%, #4a6b2e 50%, #3d5a25 100%);
  border-radius: 50%;
  margin-top: -6px;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
[data-theme="dark"] .paper-tombstone .tomb-ground {
  background: linear-gradient(180deg, #3a4f28 0%, #2d3f1e 50%, #223018 100%);
}

.paper-tombstone .tomb-incense-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 8px;
  min-height: 80px;
}

.paper-tombstone .tomb-incense-btn {
  background: none;
  border: 1px solid var(--muted);
  color: var(--muted);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all .3s;
  font-family: inherit;
}
.paper-tombstone .tomb-incense-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.paper-tombstone .tomb-incense-btn.burning {
  opacity: .4;
  pointer-events: none;
}

.paper-tombstone .tomb-incense-holder {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 8px;
  height: 70px;
  align-items: flex-end;
}

.paper-tombstone .tomb-stick {
  position: relative;
  width: 2px;
  height: 50px;
  background: linear-gradient(180deg, #d4a017 0%, #8b6914 100%);
  border-radius: 1px;
  transform-origin: bottom center;
  animation: incense-burn 8s linear forwards;
}
.paper-tombstone .tomb-stick:nth-child(1) { animation-delay: 0s; }
.paper-tombstone .tomb-stick:nth-child(2) { animation-delay: .3s; }
.paper-tombstone .tomb-stick:nth-child(3) { animation-delay: .6s; }

@keyframes incense-burn {
  0%   { height: 50px; opacity: 1; }
  80%  { height: 6px; opacity: .8; }
  100% { height: 0px; opacity: 0; }
}

.paper-tombstone .tomb-stick::before {
  content: '';
  position: absolute;
  top: -3px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: #e74c3c;
  border-radius: 50%;
  box-shadow: 0 0 4px #e74c3c, 0 0 8px #ff6b35;
  animation: ember-glow 1s ease-in-out infinite alternate;
}

@keyframes ember-glow {
  0%   { box-shadow: 0 0 3px #e74c3c, 0 0 6px #ff6b35; }
  100% { box-shadow: 0 0 6px #e74c3c, 0 0 12px #ff6b35, 0 0 18px rgba(255,107,53,.3); }
}

.paper-tombstone .tomb-smoke {
  position: absolute;
  top: -8px;
  left: 50%;
  width: 6px;
  height: 6px;
  background: rgba(180,180,180,.5);
  border-radius: 50%;
  animation: smoke-rise 2.5s ease-out infinite;
}
.paper-tombstone .tomb-stick:nth-child(1) .tomb-smoke { animation-delay: 0s; }
.paper-tombstone .tomb-stick:nth-child(2) .tomb-smoke { animation-delay: .8s; }
.paper-tombstone .tomb-stick:nth-child(3) .tomb-smoke { animation-delay: 1.6s; }

@keyframes smoke-rise {
  0%   { transform: translate(-50%, 0) scale(1); opacity: .6; }
  50%  { transform: translate(calc(-50% + 8px), -30px) scale(2); opacity: .3; }
  100% { transform: translate(calc(-50% - 4px), -60px) scale(3); opacity: 0; }
}

.paper-tombstone .tomb-incense-count {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

/* ── Last Words (遗书) ─────────────────────────── */

.paper-lastwords {
  position: relative;
  max-width: 460px;
  margin: 24px auto;
  padding: 28px 24px 20px;
  background: #fffef5;
  border: 1px solid #d4c5a0;
  border-radius: 2px;
  font-family: 'STKaiti', 'KaiTi', 'Noto Serif SC', 'Georgia', serif;
  box-shadow: 2px 3px 8px rgba(0,0,0,.08);
  transform: rotate(-0.5deg);
}
[data-theme="dark"] .paper-lastwords {
  background: #2a2620;
  border-color: #5a4f3a;
}

.paper-lastwords::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    transparent,
    transparent 27px,
    rgba(180,160,120,.15) 27px,
    rgba(180,160,120,.15) 28px
  );
  pointer-events: none;
}

.paper-lastwords .lw-title {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 16px;
  letter-spacing: 6px;
}

.paper-lastwords .lw-body {
  font-size: 15px;
  line-height: 28px;
  color: var(--ink);
  text-indent: 2em;
  position: relative;
  z-index: 1;
}

.paper-lastwords .lw-body p {
  margin: 0 0 8px;
  text-indent: 2em;
}

.paper-lastwords .lw-sign {
  text-align: right;
  margin-top: 20px;
  font-size: 14px;
  color: var(--ink);
  position: relative;
  z-index: 1;
}

.paper-lastwords .lw-date {
  text-align: right;
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
  position: relative;
  z-index: 1;
}

.paper-lastwords .lw-stain {
  position: absolute;
  bottom: 30px;
  right: 40px;
  width: 40px;
  height: 50px;
  background: radial-gradient(ellipse, rgba(160,120,80,.12) 0%, transparent 70%);
  border-radius: 50%;
  transform: rotate(20deg);
  pointer-events: none;
}

/* ── Image Skeleton ────────────────────────────── */

.paper-img-wrap {
  position: relative;
  margin: 16px 0;
}

.paper-img-wrap img {
  display: block;
  width: 100%;
  border-radius: 8px;
}

.paper-img-skeleton {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--code-bg);
  border-radius: 8px;
  min-height: 200px;
  width: 100%;
  color: var(--muted);
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.paper-img-skeleton.error {
  animation: none;
  color: var(--muted);
  min-height: 160px;
}

@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}
