/* 码农日报 · CSDN-ish 摸鱼博客样式 */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --csdn-red: #fc5531;
  --csdn-red-hover: #e14a2a;
  --page-bg: #f2f5f7;
  --card-bg: #ffffff;
  --border: #e8e8e8;
  --border-light: #f0f0f0;
  --text: #222226;
  --text-secondary: #555666;
  --text-muted: #999aaa;
  --link: #3a7afe;
  --nav-h: 48px;
}

html { font-size: 14px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Helvetica Neue", Arial, sans-serif;
  background: var(--page-bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--csdn-red); }

/* ===== Top Nav ===== */
.top-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  display: flex;
  align-items: center;
  padding: 0 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 32px;
  flex-shrink: 0;
}
.nav-logo {
  width: 28px; height: 28px;
  background: var(--csdn-red);
  border-radius: 4px;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
.nav-brand-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.nav-brand-name span { color: var(--csdn-red); }
.nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
  flex: 1;
}
.nav-links a {
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 14px;
}
.nav-links a:hover, .nav-links a.active {
  color: var(--csdn-red);
  background: #fff5f2;
}
.nav-search {
  display: flex;
  align-items: center;
  margin-left: auto;
}
.nav-search input {
  width: 200px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0 14px;
  font-size: 13px;
  outline: none;
  background: #f5f6f7;
}
.nav-search input:focus {
  border-color: var(--csdn-red);
  background: #fff;
}
.nav-user {
  margin-left: 16px;
  color: var(--text-secondary);
  font-size: 13px;
}

/* ===== Layout ===== */
.page-wrap {
  max-width: 1380px;
  margin: 0 auto;
  padding: calc(var(--nav-h) + 16px) 16px 40px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

/* ===== Left Column ===== */
.col-left {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: calc(var(--nav-h) + 16px);
  max-height: calc(100vh - var(--nav-h) - 32px);
  overflow-y: auto;
}

.author-card, .ad-portal, .side-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.author-card { padding: 20px 16px; text-align: center; }
.author-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fc5531, #ff8a65);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 10px;
}
.author-name { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.author-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.author-stats {
  display: flex;
  justify-content: space-around;
  padding: 10px 0;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 12px;
}
.author-stats .stat strong { display: block; font-size: 16px; color: var(--text); }
.author-stats .stat span { font-size: 12px; color: var(--text-muted); }
.btn-follow {
  display: inline-block;
  width: 100%;
  height: 32px;
  line-height: 32px;
  background: var(--csdn-red);
  color: #fff !important;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  text-align: center;
}
.btn-follow:hover { background: var(--csdn-red-hover); }

/* Ad / Video Portal */
.ad-portal-header {
  background: linear-gradient(90deg, #fff5f2, #fff);
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}
.ad-badge {
  background: var(--csdn-red);
  color: #fff;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 2px;
  margin-right: 6px;
}
.ad-portal-body { padding: 10px; }
.portal-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.portal-url {
  flex: 1;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 8px;
  font-size: 12px;
  outline: none;
  min-width: 0;
}
.portal-url:focus { border-color: var(--csdn-red); }
.btn-load {
  height: 30px;
  padding: 0 12px;
  background: var(--csdn-red);
  color: #fff;
  border: none;
  border-radius: 3px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-load:hover { background: var(--csdn-red-hover); }
.quick-btns {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.quick-btn {
  flex: 1;
  min-width: 0;
  height: 28px;
  border: 1px solid var(--border);
  background: #fafafa;
  border-radius: 3px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-secondary);
}
.quick-btn:hover {
  border-color: var(--csdn-red);
  color: var(--csdn-red);
  background: #fff5f2;
}
.video-frame-wrap {
  position: relative;
  width: 100%;
  background: #111;
  border-radius: 3px;
  overflow: hidden;
  aspect-ratio: 9 / 16;
  max-height: 420px;
}
.video-frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: #111;
}
.iframe-fallback {
  display: none;
  position: absolute;
  inset: 0;
  background: #1a1a1a;
  color: #eee;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  z-index: 2;
}
.iframe-fallback.show { display: flex; }
.iframe-fallback p { margin-bottom: 10px; color: #bbb; }
.iframe-fallback .btn-open-tab {
  display: inline-block;
  padding: 6px 14px;
  background: var(--csdn-red);
  color: #fff !important;
  border-radius: 3px;
  font-size: 12px;
}
.portal-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.5;
}

.side-card { padding: 12px; }
.side-card h4 {
  font-size: 14px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}
.side-card ul { list-style: none; }
.side-card li {
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px dashed var(--border-light);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.side-card li:last-child { border-bottom: none; }
.side-card li a { color: var(--text-secondary); }
.side-card li a:hover { color: var(--csdn-red); }

/* ===== Center Article ===== */
.col-center {
  flex: 1;
  min-width: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 24px 32px 40px;
}

.breadcrumb {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--csdn-red); }
.breadcrumb .sep { margin: 0 6px; }

.article-title {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.4;
  color: #18191a;
  margin-bottom: 16px;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 24px;
}
.meta-author { color: var(--csdn-red); font-weight: 500; }
.meta-tag {
  background: #f2f5f7;
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: 2px;
  font-size: 12px;
}
.btn-follow-sm {
  background: var(--csdn-red);
  color: #fff !important;
  border: none;
  border-radius: 3px;
  padding: 2px 10px;
  font-size: 12px;
  cursor: pointer;
}

.article-body h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 28px 0 14px;
  padding-left: 10px;
  border-left: 4px solid var(--csdn-red);
  line-height: 1.4;
}
.article-body h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 22px 0 10px;
  color: #333;
}
.article-body p {
  margin-bottom: 14px;
  font-size: 15px;
  color: var(--text);
  text-align: justify;
}
.article-body ul, .article-body ol {
  margin: 0 0 14px 1.6em;
  font-size: 15px;
}
.article-body li { margin-bottom: 6px; }
.article-body code {
  background: #f6f8fa;
  border: 1px solid #eaecef;
  border-radius: 3px;
  padding: 1px 5px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  color: #c7254e;
}
.article-body pre {
  background: #282c34;
  color: #abb2bf;
  border-radius: 4px;
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.6;
}
.article-body pre code {
  background: none;
  border: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 16px;
  font-size: 14px;
}
.article-body th, .article-body td {
  border: 1px solid #e0e0e0;
  padding: 8px 12px;
  text-align: left;
}
.article-body th {
  background: #f7f8fa;
  font-weight: 600;
}
.article-body blockquote {
  border-left: 4px solid #ddd;
  margin: 0 0 16px;
  padding: 10px 16px;
  background: #f9fafb;
  color: var(--text-secondary);
}

.article-tags {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.article-tags .label { color: var(--text-muted); font-size: 13px; }
.tag-item {
  background: #f2f5f7;
  color: var(--text-secondary);
  padding: 3px 10px;
  border-radius: 3px;
  font-size: 12px;
}
.tag-item:hover { background: #fff5f2; color: var(--csdn-red); }

.article-actions {
  margin-top: 24px;
  display: flex;
  gap: 12px;
  justify-content: center;
  padding: 20px 0;
  border-top: 1px solid var(--border-light);
}
.action-btn {
  min-width: 90px;
  height: 36px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 18px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.action-btn:hover {
  border-color: var(--csdn-red);
  color: var(--csdn-red);
}
.action-btn.primary {
  background: var(--csdn-red);
  border-color: var(--csdn-red);
  color: #fff;
}
.action-btn.primary:hover { background: var(--csdn-red-hover); }

.comment-area {
  margin-top: 8px;
  padding: 20px;
  background: #fafbfc;
  border: 1px solid var(--border-light);
  border-radius: 4px;
}
.comment-area h4 { font-size: 15px; margin-bottom: 12px; }
.comment-input {
  width: 100%;
  height: 80px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px;
  font-size: 13px;
  resize: vertical;
  font-family: inherit;
  outline: none;
}
.comment-input:focus { border-color: var(--csdn-red); }
.comment-bar {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}
.btn-comment {
  background: var(--csdn-red);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 6px 20px;
  font-size: 13px;
  cursor: pointer;
}
.btn-comment:hover { background: var(--csdn-red-hover); }

/* ===== Right Column ===== */
.col-right {
  width: 64px;
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--nav-h) + 16px);
}
.float-toolbar {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.float-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 11px;
  text-align: center;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
  width: 100%;
}
.float-item:last-child { border-bottom: none; }
.float-item:hover { color: var(--csdn-red); background: #fff5f2; }
.float-item .ico { font-size: 18px; margin-bottom: 2px; }
.float-ad {
  margin-top: 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 4px;
  text-align: center;
  font-size: 10px;
  color: var(--text-muted);
  writing-mode: vertical-rl;
  min-height: 120px;
  letter-spacing: 2px;
}

/* ===== Footer ===== */
.site-footer {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
  background: #fff;
}

/* Responsive */
@media (max-width: 1100px) {
  .col-right { display: none; }
}
@media (max-width: 900px) {
  .col-left {
    position: static;
    width: 100%;
    max-height: none;
  }
  .page-wrap { flex-direction: column; }
  .video-frame-wrap { max-height: 360px; aspect-ratio: 16 / 9; }
  .col-center { padding: 16px; }
  .article-title { font-size: 22px; }
}


.iframe-fallback .btn-float {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 14px;
  background: #333;
  color: #fff !important;
  border: 1px solid #666;
  border-radius: 3px;
  font-size: 12px;
  cursor: pointer;
}
.iframe-fallback .btn-float:hover { background: #444; }
