/* 博客页面通用样式 */
:root {
  --bg: #0a0e17;
  --neon-cyan: #00f5ff;
  --neon-pink: #ff2d95;
  --neon-purple: #b44dff;
  --neon-green: #39ff14;
  --neon-yellow: #ffe600;
  --text-dim: #5a6a8a;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  min-height: 100%;
  background: var(--bg);
  color: #e0e6f0;
  font-family: "JetBrains Mono", "Fira Code", Consolas, monospace;
}

.blog-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.2rem;
  border-bottom: 1px solid rgba(0, 245, 255, 0.15);
  background: rgba(10, 14, 23, 0.92);
  backdrop-filter: blur(10px);
}

.blog-logo {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--neon-cyan);
  text-decoration: none;
  letter-spacing: 0.1em;
}

.blog-nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.78rem;
  margin-left: 1rem;
  letter-spacing: 0.08em;
}

.blog-nav a:hover,
.blog-nav a.active {
  color: var(--neon-pink);
}

.blog-main {
  width: min(92vw, 820px);
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
}

.blog-hero {
  margin-bottom: 1.8rem;
}

.blog-hero h1 {
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.blog-hero p {
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 1.6;
}

.article-grid {
  display: grid;
  gap: 1rem;
}

.article-card {
  display: block;
  padding: 1.1rem 1.2rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.article-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.article-card h2 {
  font-size: 1rem;
  margin-bottom: 0.45rem;
  color: #fff;
}

.article-card p {
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.55;
  margin-bottom: 0.7rem;
}

.article-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--text-dim);
}

.article-read {
  color: var(--neon-cyan);
}

.article-empty {
  text-align: center;
  color: var(--text-dim);
  padding: 3rem 1rem;
  font-size: 0.85rem;
}

/* 文章详情 */
.article-detail h1 {
  font-size: clamp(1.4rem, 5vw, 2.1rem);
  line-height: 1.35;
  margin-bottom: 0.6rem;
}

.article-detail .article-meta {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.article-body {
  font-size: 0.88rem;
  line-height: 1.75;
  color: #d5dceb;
}

.article-body h2 {
  font-size: 1.05rem;
  color: var(--neon-cyan);
  margin: 1.4rem 0 0.6rem;
}

.article-body h3 {
  font-size: 0.95rem;
  color: var(--neon-pink);
  margin: 1rem 0 0.5rem;
}

.article-body p {
  margin-bottom: 0.85rem;
}

.article-body ul, .article-body ol {
  margin: 0.5rem 0 1rem 1.2rem;
}

.article-body li {
  margin-bottom: 0.35rem;
}

.article-body code {
  background: rgba(0, 245, 255, 0.08);
  color: var(--neon-cyan);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.82em;
}

.article-body pre {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(0, 245, 255, 0.15);
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
  margin: 1rem 0;
  font-size: 0.78rem;
  line-height: 1.5;
}

.article-body pre code {
  background: none;
  padding: 0;
  color: #e0e6f0;
}

.article-body blockquote {
  border-left: 3px solid var(--neon-yellow);
  padding: 0.5rem 0 0.5rem 1rem;
  margin: 1rem 0;
  color: var(--neon-yellow);
  background: rgba(255, 230, 0, 0.05);
  border-radius: 0 8px 8px 0;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.78rem;
}

.article-body th, .article-body td {
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.45rem 0.6rem;
  text-align: left;
}

.article-body th {
  color: var(--neon-cyan);
}

.article-loading, .article-error {
  text-align: center;
  color: var(--text-dim);
  padding: 4rem 1rem;
}

/* 代码块弹奏 */
.code-block-wrap {
  position: relative;
  margin: 1rem 0;
}

.code-block-wrap pre {
  margin: 0;
}

.code-piano-btn {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  z-index: 2;
  width: 2rem;
  height: 2rem;
  border: 1px solid rgba(255, 230, 0, 0.35);
  border-radius: 8px;
  background: rgba(10, 14, 23, 0.85);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: transform 0.15s, box-shadow 0.15s;
}

.code-piano-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 0 16px rgba(255, 230, 0, 0.25);
}

.code-piano-btn.playing {
  animation: piano-pulse 0.35s ease;
}

@keyframes piano-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); box-shadow: 0 0 20px rgba(0, 245, 255, 0.35); }
}

/* 读完 victory 舞者 */
.article-end-sentinel {
  width: 100%;
  height: 1px;
  pointer-events: none;
}

.article-victory {
  position: fixed;
  right: 1rem;
  bottom: 1.2rem;
  z-index: 30;
  width: min(88vw, 220px);
  padding: 0.85rem 0.95rem;
  border-radius: 14px;
  border: 1px solid rgba(57, 255, 20, 0.35);
  background: rgba(10, 14, 23, 0.94);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 24px rgba(57, 255, 20, 0.12);
  text-align: center;
  opacity: 0;
  transform: translateY(16px) scale(0.92);
  pointer-events: none;
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.article-victory.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.article-victory.hidden:not(.show) {
  visibility: hidden;
}

.victory-dancer {
  display: flex;
  justify-content: center;
  margin-bottom: 0.35rem;
}

.victory-svg {
  width: 52px;
  height: 78px;
  animation: victory-bounce 0.7s ease-in-out infinite;
}

@keyframes victory-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.victory-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--neon-green);
  margin-bottom: 0.2rem;
}

.victory-hint {
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-bottom: 0.65rem;
  line-height: 1.45;
}

.victory-share-btn {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid rgba(0, 245, 255, 0.35);
  border-radius: 8px;
  background: rgba(0, 245, 255, 0.08);
  color: var(--neon-cyan);
  font-family: inherit;
  font-size: 0.72rem;
  cursor: pointer;
  letter-spacing: 0.04em;
}

.victory-share-btn:hover {
  background: rgba(0, 245, 255, 0.16);
}

/* 404 迷路舞者 */
.not-found-page {
  min-height: 100vh;
}

.not-found-main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 4rem);
  padding: 1.5rem 1rem 3rem;
}

.lost-stage {
  width: min(92vw, 520px);
  text-align: center;
}

.lost-dancer {
  position: relative;
  display: inline-block;
  margin-bottom: 0.5rem;
}

.lost-svg {
  width: 88px;
  height: 132px;
  filter: drop-shadow(0 4px 12px rgba(255, 45, 149, 0.25));
  animation: lost-wander 2.4s ease-in-out infinite;
}

.lost-dancer.dancing .lost-svg {
  animation: lost-jump 0.5s ease-in-out 2;
}

.lost-dancer.tea-time .lost-bubble {
  content: '🍵';
}

.lost-dancer.tea-time .lost-bubble::after {
  content: ' 🍵';
}

@keyframes lost-wander {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  25% { transform: translateX(-8px) rotate(-3deg); }
  75% { transform: translateX(8px) rotate(3deg); }
}

@keyframes lost-jump {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-18px); }
}

.lost-bubble {
  position: absolute;
  top: -0.2rem;
  right: -4.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  background: rgba(255, 45, 149, 0.15);
  border: 1px solid rgba(255, 45, 149, 0.35);
  font-size: 0.65rem;
  color: var(--neon-pink);
  white-space: nowrap;
}

.lost-title {
  font-size: clamp(3rem, 12vw, 4.5rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--neon-pink), var(--neon-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 0.35rem;
}

.lost-subtitle {
  color: var(--text-dim);
  font-size: 0.82rem;
  margin-bottom: 1.2rem;
}

.lost-terminal {
  text-align: left;
  border: 1px solid rgba(0, 245, 255, 0.2);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
  margin-bottom: 1rem;
}

.lost-term-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.68rem;
  color: var(--text-dim);
}

.lost-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}
.lost-dot.red { background: #ff5f57; }
.lost-dot.yellow { background: #febc2e; }
.lost-dot.green { background: #28c840; }

.lost-output {
  min-height: 120px;
  max-height: 180px;
  overflow-y: auto;
  padding: 0.65rem 0.75rem;
  font-size: 0.72rem;
  line-height: 1.55;
  color: var(--neon-cyan);
}

.lost-output .lost-echo {
  color: #fff;
  margin-top: 0.35rem;
}

.lost-output .lost-reply {
  color: var(--neon-green);
  padding-left: 0.5rem;
}

.lost-output .lost-error {
  color: var(--neon-pink);
  margin-top: 0.35rem;
}

.lost-form {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.lost-prompt {
  color: var(--neon-green);
  font-size: 0.78rem;
}

.lost-form input {
  flex: 1;
  border: none;
  background: transparent;
  color: #e0e6f0;
  font-family: inherit;
  font-size: 0.78rem;
  outline: none;
}

.lost-map-btn {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 245, 255, 0.35);
  background: rgba(0, 245, 255, 0.08);
  color: var(--neon-cyan);
  text-decoration: none;
  font-size: 0.78rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.lost-map-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 245, 255, 0.2);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* 全站备案号页脚 */
.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 5;
  padding: 0.35rem 0.75rem;
  text-align: center;
  font-size: 0.62rem;
  color: var(--text-dim);
  background: rgba(10, 14, 23, 0.85);
  border-top: 1px solid rgba(90, 106, 138, 0.15);
  pointer-events: auto;
}

.site-footer a {
  color: var(--text-dim);
  text-decoration: none;
  letter-spacing: 0.04em;
}

.site-footer a:hover {
  color: var(--neon-cyan);
}

body {
  padding-bottom: 1.6rem;
}

/* 视频上传与 ASCII 解码 */
.video-upload-section {
  margin-top: 0;
  margin-bottom: 2rem;
  padding: 1.2rem 1.25rem;
  border: 1px solid rgba(180, 77, 255, 0.2);
  border-radius: 12px;
  background: rgba(180, 77, 255, 0.04);
}

.video-upload-section h2 {
  font-size: 1rem;
  color: var(--neon-purple);
  margin-bottom: 0.5rem;
}

.video-upload-desc {
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.video-upload-form {
  display: grid;
  gap: 0.45rem;
  max-width: 420px;
}

.video-upload-form label {
  font-size: 0.68rem;
  color: var(--text-dim);
}

.video-upload-form input[type="text"],
.video-upload-form input[type="file"] {
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  border: 1px solid rgba(0, 245, 255, 0.2);
  background: rgba(10, 14, 23, 0.8);
  color: #e0e6f0;
  font-family: inherit;
  font-size: 0.75rem;
}

.video-upload-form button {
  margin-top: 0.3rem;
  padding: 0.5rem 1rem;
  border: 1px solid rgba(180, 77, 255, 0.4);
  border-radius: 999px;
  background: rgba(180, 77, 255, 0.12);
  color: var(--neon-purple);
  font-family: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.video-upload-form button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(180, 77, 255, 0.2);
}

.video-upload-status {
  margin-top: 0.6rem;
  font-size: 0.72rem;
  color: var(--neon-green);
  min-height: 1.2em;
}

.video-upload-status.error {
  color: #ff6b8a;
}

.video-upload-progress {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.video-upload-track {
  flex: 1;
  height: 4px;
  background: rgba(90, 106, 138, 0.25);
  border-radius: 2px;
  overflow: hidden;
}

.video-upload-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--neon-purple), var(--neon-cyan));
  transition: width 0.15s;
}

.video-upload-pct {
  font-size: 0.68rem;
  color: var(--text-dim);
  min-width: 2.5rem;
}

.video-list {
  margin-top: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.video-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  border: 1px solid rgba(0, 245, 255, 0.12);
  background: rgba(10, 14, 23, 0.6);
}

.video-item-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.video-item-info strong {
  font-size: 0.78rem;
  color: #e0e6f0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-item-meta {
  font-size: 0.65rem;
  color: var(--text-dim);
}

.video-decode-btn {
  flex-shrink: 0;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 245, 255, 0.35);
  background: rgba(0, 245, 255, 0.08);
  color: var(--neon-cyan);
  font-family: inherit;
  font-size: 0.68rem;
  cursor: pointer;
  white-space: nowrap;
}

.video-decode-btn:hover {
  background: rgba(0, 245, 255, 0.16);
}

.video-item.is-processing {
  border-color: rgba(255, 200, 50, 0.25);
}

.video-item.is-failed {
  border-color: rgba(255, 80, 80, 0.25);
}

.video-status-badge {
  flex-shrink: 0;
  font-size: 0.65rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  white-space: nowrap;
}

.video-status-badge.processing {
  color: #ffc832;
  border: 1px solid rgba(255, 200, 50, 0.35);
  background: rgba(255, 200, 50, 0.08);
}

.video-status-badge.failed {
  color: #ff8080;
  border: 1px solid rgba(255, 80, 80, 0.35);
  background: rgba(255, 80, 80, 0.08);
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-empty {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* ASCII 解码弹窗 */
.video-decode-modal[hidden] {
  display: none;
}

.video-decode-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-decode-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 16, 0.88);
}

.video-decode-panel {
  position: relative;
  width: min(92vw, 760px);
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid rgba(0, 245, 255, 0.25);
  background: #0a0e17;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
}

.video-decode-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.video-decode-header h3 {
  font-size: 0.85rem;
  color: var(--neon-cyan);
}

.video-decode-close {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
}

.video-decode-canvas {
  display: block;
  width: 100%;
  border-radius: 8px;
  background: #050810;
}

.video-decode-source {
  display: none;
}

.video-decode-hint {
  margin-top: 0.6rem;
  font-size: 0.65rem;
  color: var(--text-dim);
  text-align: center;
}

body.video-decode-open {
  overflow: hidden;
}

@media (max-width: 768px) {
  .blog-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 0.75rem 1rem;
  }

  .blog-nav a {
    margin-left: 0;
    margin-right: 0.8rem;
  }

  .blog-main {
    padding: 1rem 0 2.5rem;
  }

  .article-card {
    padding: 0.9rem 1rem;
  }

  .article-body {
    font-size: 0.82rem;
  }

  .article-body pre {
    font-size: 0.72rem;
  }

  .article-victory {
    right: 0.65rem;
    bottom: 0.65rem;
    width: min(88vw, 200px);
  }

  .lost-bubble {
    right: -3rem;
    font-size: 0.58rem;
  }

  .video-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .video-decode-btn {
    align-self: flex-end;
  }
}

/* ── Admin ── */
.admin-main {
  max-width: 720px;
}

.admin-nav-label {
  font-size: 0.72rem;
  color: var(--neon-cyan);
  opacity: 0.85;
}

.admin-panel h1 {
  font-size: 1.25rem;
  margin-bottom: 0.4rem;
}

.admin-desc,
.admin-panel-desc {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
}

.admin-login-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 320px;
}

.admin-login-form label {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.admin-login-form input {
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid rgba(0, 245, 255, 0.2);
  background: rgba(10, 14, 23, 0.8);
  color: #e0e6f0;
  font-family: inherit;
}

.admin-login-form button {
  margin-top: 0.3rem;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(0, 245, 255, 0.35);
  background: rgba(0, 245, 255, 0.1);
  color: var(--neon-cyan);
  font-family: inherit;
  cursor: pointer;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.admin-logout-btn {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.68rem;
  cursor: pointer;
}

.admin-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.admin-tab {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 245, 255, 0.2);
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.68rem;
  cursor: pointer;
}

.admin-tab.active {
  border-color: rgba(0, 245, 255, 0.45);
  background: rgba(0, 245, 255, 0.1);
  color: var(--neon-cyan);
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  border: 1px solid rgba(0, 245, 255, 0.12);
  background: rgba(10, 14, 23, 0.55);
}

.admin-row-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.admin-row-info strong {
  font-size: 0.76rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-row-meta {
  font-size: 0.65rem;
  color: var(--text-dim);
  word-break: break-word;
}

.admin-delete-btn {
  flex-shrink: 0;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 80, 80, 0.4);
  background: rgba(255, 80, 80, 0.08);
  color: #ff8080;
  font-family: inherit;
  font-size: 0.65rem;
  cursor: pointer;
}

.admin-delete-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
