:root {
  --bg: #06142b; --panel: #0e2447; --text: #f1f5ff; --muted: #9fb3d1; --accent: #1fb6ff; --line: #1b3563;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #fff; --panel: #f2f2f2; --text: #0f0f0f; --muted: #606060; --line: #e5e5e5; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; }

.topbar { position: sticky; top: 0; z-index: 10; display: flex; gap: 12px; align-items: center; padding: 10px 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; text-decoration: none; white-space: nowrap; }
.logo { width: 36px; height: 36px; border-radius: 50%; display: block; }
#search { flex: 1; min-width: 0; max-width: 560px; margin: 0 auto; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; }
#sort, #lang { padding: 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; }
.btn { background: var(--accent); color: #06142b; padding: 8px 16px; border-radius: 999px; text-decoration: none; font-weight: 600; white-space: nowrap; }

main { max-width: 1400px; margin: 0 auto; padding: 20px 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 28px 16px; }
.card { cursor: pointer; text-decoration: none; display: block; border-radius: 14px; transition: transform .25s ease; }
.card:hover, .card:focus-visible { transform: translateY(-4px); outline: none; }
.thumb { position: relative; aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; background: var(--panel); transition: box-shadow .25s ease; }
.card:hover .thumb, .card:focus-visible .thumb { box-shadow: 0 0 0 2px var(--accent), 0 12px 32px -8px rgba(31, 182, 255, .55); }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease, filter .25s; }
.card:hover .thumb img { transform: scale(1.06); filter: brightness(.7); }
.thumb::after { content: ""; position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 5v14l11-7z' fill='%2306142b'/%3E%3C/svg%3E") center/28px no-repeat;
  opacity: 0; transform: scale(.6); transition: opacity .25s, transform .25s; }
.card:hover .thumb::after, .card:focus-visible .thumb::after { opacity: 1; transform: scale(1); }
.card h3 { transition: color .2s; }
.card:hover h3 { color: var(--accent); }
.dur { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.8); color: #fff; font-size: 12px; font-weight: 600; padding: 1px 5px; border-radius: 4px; }
.card h3 { margin: 10px 0 4px; font-size: 15px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { color: var(--muted); font-size: 13px; margin: 0; }
.card.active { opacity: .45; }

.player-wrap { aspect-ratio: 16/9; background: #000; border-radius: 12px; overflow: hidden; }
.player-wrap iframe { width: 100%; height: 100%; border: 0; }
.player-info h1 { font-size: 20px; margin: 14px 0 4px; }
.desc { white-space: pre-wrap; background: var(--panel); padding: 12px; border-radius: 12px; margin-top: 12px; max-height: 180px; overflow: auto; }
.up-next { font-size: 18px; margin: 28px 0 16px; }
.status { color: var(--muted); text-align: center; padding: 40px 0; }
footer { color: var(--muted); font-size: 13px; text-align: center; padding: 30px 16px; }

@media (max-width: 640px) {
  .brand span:last-child, #sort { display: none; }
  #lang { max-width: 110px; }
  .btn { padding: 8px 12px; }
}

.tabs { position: sticky; top: 57px; z-index: 9; display: flex; gap: 10px; padding: 10px 16px; overflow-x: auto; background: var(--bg); scrollbar-width: none; }
.tabs a { flex: none; padding: 6px 14px; border-radius: 8px; background: var(--panel); text-decoration: none; font-size: 14px; font-weight: 500; }
.tabs a.on { background: var(--text); color: var(--bg); }
.section { margin-bottom: 40px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2 { font-size: 20px; margin: 0; }
.section-head a { color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.section-head a:hover { color: var(--text); }
.page-title { font-size: 24px; margin: 0 0 18px; }
.page-title small { color: var(--muted); font-size: 14px; font-weight: 400; margin-left: 8px; }
.lang-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 0 5px; margin-right: 6px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); }
.banner { max-width: 1400px; margin: 16px auto 0; padding: 0 16px; }
.banner img { display: block; width: 100%; aspect-ratio: 1920/397; object-fit: cover; border-radius: 16px; }
.tabs a.on { background: var(--accent); color: #06142b; }

.pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.5;
  background: rgba(31, 182, 255, .12); color: var(--accent); border: 1px solid rgba(31, 182, 255, .3); text-decoration: none; cursor: pointer; transition: background .2s, color .2s; }
.pill:hover, .pill.on { background: var(--accent); color: #06142b; }
.card .pills { margin-top: 8px; }
.card .pill { font-size: 11px; padding: 1px 8px; }
.desc a { color: var(--accent); font-weight: 600; text-decoration: none; border-bottom: 1px solid rgba(31, 182, 255, .4); }
.desc a:hover { border-bottom-color: var(--accent); background: rgba(31, 182, 255, .12); }
.clear-tag { margin-left: 10px; font-size: 13px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .card, .thumb, .thumb img, .thumb::after { transition: none; } .card:hover { transform: none; } }

/* Blog */
.thumb-fallback { display: grid; place-items: center; height: 100%; font: 700 40px ui-monospace, monospace; color: var(--accent); background: linear-gradient(135deg, var(--panel), var(--bg)); }
.excerpt { color: var(--muted); font-size: 14px; margin: 0 0 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post { max-width: 760px; margin: 0 auto; }
.post h1 { font-size: clamp(26px, 5vw, 38px); line-height: 1.2; margin: 12px 0 8px; }
.post .pills { margin-bottom: 20px; }
.post-cover { width: 100%; border-radius: 16px; margin-bottom: 24px; }
.post .player-wrap { margin-bottom: 24px; }
.back { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; }
.back:hover { color: var(--accent); }
.prose { font-size: 17px; line-height: 1.75; }
.prose h2 { font-size: 26px; margin: 36px 0 12px; }
.prose h3 { font-size: 21px; margin: 28px 0 10px; }
.prose img { max-width: 100%; border-radius: 12px; }
.prose a { color: var(--accent); font-weight: 600; text-decoration: none; border-bottom: 1px solid rgba(31, 182, 255, .4); }
.prose a:hover { border-bottom-color: var(--accent); background: rgba(31, 182, 255, .12); }
.prose code { font: 0.9em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--panel); padding: 2px 6px; border-radius: 6px; }
.prose pre { background: #030b1a; color: #e6edf7; padding: 16px; border-radius: 12px; overflow-x: auto; border: 1px solid var(--line); }
.prose pre code { background: none; padding: 0; color: inherit; }
.prose blockquote { margin: 20px 0; padding: 4px 18px; border-left: 4px solid var(--accent); color: var(--muted); background: var(--panel); border-radius: 0 10px 10px 0; }
.prose table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.prose iframe { width: 100%; aspect-ratio: 16/9; border: 0; border-radius: 12px; }

/* Admin */
.admin { max-width: 1200px; margin: 0 auto; }
.admin-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.admin-list { width: 100%; border-collapse: collapse; }
.admin-list th, .admin-list td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
.admin-list td:last-child { text-align: right; white-space: nowrap; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; }
.badge.published { background: rgba(52, 211, 153, .15); color: #34d399; }
.badge.draft { background: rgba(250, 204, 21, .15); color: #facc15; }
.btn-ghost { background: var(--panel); color: var(--text); border: 1px solid var(--line); padding: 7px 14px; border-radius: 999px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger:hover { border-color: #f87171; color: #f87171; }
button.btn { border: 0; font: inherit; font-weight: 600; cursor: pointer; }
.editor { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.editor label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 12px 0 4px; }
.editor input, .editor select, .editor textarea { width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; }
.editor input:focus, .editor select:focus, .editor textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.editor textarea#f-content { min-height: 420px; font: 14px/1.6 ui-monospace, Menlo, monospace; resize: vertical; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.preview { background: var(--panel); border-radius: 12px; padding: 4px 20px 20px; max-height: 80vh; overflow: auto; position: sticky; top: 80px; }
.msg { font-size: 14px; color: var(--muted); }
.msg.err { color: #f87171; }
@media (max-width: 860px) { .editor { grid-template-columns: 1fr; } .preview { position: static; } }

/* Code windows (mac dark) */
.code-window { margin: 22px 0; border-radius: 12px; overflow: hidden; background: #282c34; border: 1px solid #3a3f4b; box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .7); }
.code-head { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: #21252b; border-bottom: 1px solid #3a3f4b; }
.dots { display: flex; gap: 8px; }
.dots i { width: 12px; height: 12px; border-radius: 50%; background: #ff5f57; }
.dots i:nth-child(2) { background: #febc2e; }
.dots i:nth-child(3) { background: #28c840; }
.code-title { flex: 1; text-align: center; color: #9da5b4; font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy-btn { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 6px; border: 1px solid #3a3f4b; background: transparent; color: #9da5b4; font: 600 12px system-ui, sans-serif; cursor: pointer; transition: all .2s; }
.copy-btn:hover { color: #fff; border-color: var(--accent); }
.copy-btn.copied { color: #28c840; border-color: #28c840; }
.code-body { display: flex; font: 13.5px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; }
.gutter { flex: none; padding: 14px 12px 14px 16px; text-align: right; color: #5c6370; user-select: none; white-space: pre; border-right: 1px solid #3a3f4b; background: #252931; }
.prose .code-body pre { flex: 1; margin: 0; padding: 14px 16px; border: 0; border-radius: 0; background: transparent; overflow-x: auto; font: inherit; }
.prose .code-body pre code.hljs { padding: 0; background: transparent; font: inherit; color: #abb2bf; }

/* Blog: topics, authors, comments */
.announcement { max-width: 1400px; margin: 12px auto 0; padding: 0 16px; }
.announcement > * { margin: 0; }
.announcement p { background: rgba(31, 182, 255, .12); border: 1px solid rgba(31, 182, 255, .3); color: var(--text); padding: 10px 16px; border-radius: 12px; font-size: 14px; }
.announcement a { color: var(--accent); font-weight: 600; }
.tagline { color: var(--muted); margin: -10px 0 18px; }
.topics { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 24px; scrollbar-width: thin; }
.topic { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; text-decoration: none; background: var(--panel); border: 1px solid var(--line); transition: all .2s; }
.topic b { font-size: 11px; font-weight: 700; color: var(--muted); background: var(--bg); border-radius: 999px; padding: 0 6px; }
.topic:hover { border-color: var(--accent); color: var(--accent); }
.topic.on { background: var(--accent); border-color: var(--accent); color: #06142b; }
.topic.on b { background: rgba(6, 20, 43, .15); color: #06142b; }
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none; background: var(--panel); }
.avatar.sm { width: 22px; height: 22px; }
.avatar.lg { width: 72px; height: 72px; }
.avatar-fallback { display: inline-grid; place-items: center; font-weight: 700; font-size: 15px; color: #06142b; background: var(--accent); }
.avatar.sm.avatar-fallback { font-size: 9px; }
.byline { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.byline .dot { opacity: .6; }
.lead { font-size: 19px; color: var(--muted); margin: 0 0 18px; }
.author-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.author-name { font-weight: 700; }
.author-name a { text-decoration: none; }
.author-name a:hover { color: var(--accent); }
.author-box { display: flex; gap: 18px; align-items: flex-start; margin: 40px 0; padding: 22px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); }
.author-box p { margin: 6px 0 0; color: var(--muted); }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 700; }
.card-cat { display: block; margin-top: 10px; }
.card-cat:hover, .post-cat:hover { text-decoration: underline; }
.post-cat { display: block; margin-top: 18px; text-decoration: none; }
.topics.categories { margin-bottom: 12px; }
.comments { margin: 40px 0 20px; padding-top: 28px; border-top: 1px solid var(--line); }
.comments h2 small { color: var(--muted); font-size: 16px; font-weight: 500; }
.comment-form, .comment { display: flex; gap: 12px; }
.comment-form { margin-bottom: 24px; }
.grow { flex: 1; min-width: 0; }
.comment-form textarea { width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; resize: vertical; }
.comment-form textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.comment-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.comment-actions a { color: var(--accent); }
.comment-login { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-radius: 14px; background: var(--panel); border: 1px dashed var(--line); margin-bottom: 24px; flex-wrap: wrap; }
.comment-login p { margin: 0; }
.comment-list { list-style: none; padding: 0; margin: 0; }
.comment { padding: 14px 0; border-bottom: 1px solid var(--line); }
.comment .avatar { width: 36px; height: 36px; }
.comment p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-head { display: flex; gap: 10px; align-items: baseline; }
.link-btn { margin-left: auto; background: none; border: 0; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.link-btn:hover { color: #f87171; }
