
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0d1117; --surface: #161b22; --surface2: #21262d;
  --border: #30363d; --text: #c9d1d9; --text2: #8b949e;
  --accent: #58a6ff; --accent2: #238636; --tag: #388bfd33;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.6; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 1400px; margin: 0 auto; padding: 0 20px; }

header { background: var(--surface); border-bottom: 1px solid var(--border); padding: 20px 0; position: sticky; top: 0; z-index: 100; }
header .container { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.logo { font-size: 1.4rem; font-weight: 700; color: #fff; }
.logo span { color: var(--accent); }

.main { display: grid; grid-template-columns: 260px 1fr; gap: 24px; padding: 24px 0; }
@media (max-width: 900px) { .main { grid-template-columns: 1fr; } }

.sidebar { position: sticky; top: 90px; height: fit-content; }
.sidebar-section { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 16px; overflow: hidden; }
.sidebar-header { padding: 12px 16px; background: var(--surface2); font-weight: 600; font-size: 13px; color: #fff; border-bottom: 1px solid var(--border); }
.sidebar-list { padding: 8px 0; max-height: 400px; overflow-y: auto; }
.sidebar-item { display: flex; justify-content: space-between; align-items: center; padding: 6px 16px; font-size: 13px; color: var(--text2); transition: all 0.15s; }
.sidebar-item:hover { background: var(--surface2); color: var(--text); }
.sidebar-item a { color: inherit; flex: 1; }
.sidebar-item .count { background: var(--surface2); padding: 1px 6px; border-radius: 10px; font-size: 11px; }
.sidebar-item:hover .count { background: var(--border); }

.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.theme-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; transition: transform 0.2s, border-color 0.2s; }
.theme-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.preview-wrap { position: relative; aspect-ratio: 16/10; overflow: hidden; background: var(--surface2); }
.preview-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.theme-card:hover .preview-wrap img { transform: scale(1.03); }
.card-body { padding: 14px; }
.card-body h3 { font-size: 15px; font-weight: 600; color: #fff; margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-body h3 a { color: #fff; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { display: inline-block; padding: 5px 12px; border-radius: 6px; font-size: 12px; font-weight: 500; cursor: pointer; border: none; transition: all 0.2s; }
.btn-sm { padding: 4px 10px; font-size: 11px; }
a.btn { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
a.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn-download { background: var(--accent2); color: #fff; border-color: var(--accent2); }
.btn-download:hover { background: #2ea043; color: #fff; text-decoration: none; }
.btn-disabled { background: var(--surface2); color: var(--text2); border: 1px solid var(--border); cursor: not-allowed; opacity: 0.6; }

.detail-header { background: var(--surface); border-bottom: 1px solid var(--border); padding: 24px 0; }
.back { color: var(--accent); font-size: 13px; }
.detail-header h1 { color: #fff; font-size: 1.8rem; margin-top: 8px; }
.breadcrumb-bar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 8px 0; }
.breadcrumb-bar .container { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text2); }
.breadcrumb-bar a { color: var(--accent); }
.detail-body { padding: 24px 0; }
.detail-grid { display: table; width: 100%; }
.detail-preview-cell { display: table-cell; vertical-align: top; padding-right: 32px; }
.detail-preview { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.detail-preview img { width: 100%; display: block; }
.detail-sidebar-cell { display: table-cell; vertical-align: top; width: 320px; min-width: 280px; }
.detail-sidebar { display: flex; flex-direction: column; gap: 16px; }
.info-box { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 20px; }
.info-box h4 { color: #fff; margin-bottom: 12px; font-size: 14px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.desc-box { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 20px; margin-top: 24px; }
.desc-box h4 { color: #fff; margin-bottom: 12px; font-size: 14px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.desc-box p { font-size: 14px; line-height: 1.8; color: var(--text); }

footer { text-align: center; padding: 24px; color: var(--text2); font-size: 12px; border-top: 1px solid var(--border); margin-top: 40px; }
.search-bar { flex: 1; max-width: 400px; }
.search-bar input { width: 100%; padding: 8px 14px; background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 13px; }
.search-bar input:focus { outline: none; border-color: var(--accent); }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.section-header h2 { color: #fff; font-size: 1.2rem; }
.section-header span { color: var(--text2); font-size: 13px; }

@media (max-width: 900px) {
  .detail-grid { display: block; }
  .detail-preview-cell { display: block; padding-right: 0; margin-bottom: 24px; }
  .detail-sidebar-cell { display: block; width: 100%; }
}

/* Detail page layout (replaces older .detail-grid rules above) */
.detail-body { padding: 24px 0; }
.detail-top { display: table; width: 100%; margin-bottom: 24px; }
.detail-preview-cell { display: table-cell; vertical-align: top; padding-right: 32px; width: 65%; }
.detail-sidebar-cell { display: table-cell; vertical-align: top; width: 35%; min-width: 280px; }
.detail-preview { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.detail-preview img { width: 100%; display: block; }
.detail-sidebar { display: flex; flex-direction: column; gap: 16px; }
.desc-section { margin-top: 16px; }
.desc-section h4 { color: var(--text2); margin-bottom: 12px; font-size: 13px; font-weight: 600; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.desc-section p { font-size: 14px; line-height: 1.8; color: var(--text); margin-bottom: 12px; }
.desc-section p:last-child { margin-bottom: 0; }
@media (max-width: 900px) {
  .detail-top { display: block; }
  .detail-preview-cell { display: block; width: 100%; padding-right: 0; margin-bottom: 24px; }
  .detail-sidebar-cell { display: block; width: 100%; }
}