:root {
  --bg: #0e1116;
  --bg-soft: #161b22;
  --bg-card: #1a2029;
  --bg-card-hover: #20283340;
  --border: #2a323d;
  --border-strong: #3a4452;
  --text: #e6edf3;
  --text-dim: #9aa7b4;
  --text-faint: #6e7b89;
  --accent: #4f9cf9;
  --accent-soft: #1f3b5c;
  --ok: #3fb950;
  --warn: #d29922;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 8px 30px rgba(0,0,0,.35);
  --mono: ui-monospace, "Cascadia Code", "Consolas", "D2Coding", monospace;
  --sans: -apple-system, "Segoe UI", "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  background: radial-gradient(1200px 600px at 70% -10%, #16243a 0%, var(--bg) 55%);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
.wrap { width: min(1180px, 92vw); margin: 0 auto; }
a { color: var(--accent); }

/* Header */
.site-header { border-bottom: 1px solid var(--border); background: rgba(14,17,22,.6); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark { font-size: 34px; line-height: 1; }
.site-header h1 { margin: 0; font-size: 20px; letter-spacing: -.01em; }
.tagline { margin: 2px 0 0; color: var(--text-dim); font-size: 13.5px; }
.stat { color: var(--text-dim); font-size: 13px; white-space: nowrap; }
.stat strong { color: var(--text); }

/* Toolbar */
.toolbar { margin: 28px 0 22px; display: flex; flex-direction: column; gap: 14px; }
.search input {
  width: 100%; padding: 13px 16px; font-size: 15px;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s;
}
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,156,249,.15); }
.search input::placeholder { color: var(--text-faint); }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.filter-group { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  padding: 6px 13px; font-size: 13px; border-radius: 999px; cursor: pointer;
  background: var(--bg-soft); border: 1px solid var(--border); color: var(--text-dim);
  transition: all .14s; user-select: none; white-space: nowrap;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.active { background: var(--accent-soft); border-color: var(--accent); color: #cfe4ff; }
.chip .ct { color: var(--text-faint); margin-left: 5px; font-size: 11.5px; }
.chip.active .ct { color: #9cc4f5; }

.filter-tools { display: flex; flex-wrap: wrap; gap: 7px; }
.reset-btn {
  margin-left: auto; padding: 6px 12px; font-size: 12.5px; cursor: pointer;
  background: transparent; border: 1px solid var(--border-strong); color: var(--text-dim);
  border-radius: 999px; transition: all .14s;
}
.reset-btn:hover { color: var(--text); border-color: var(--accent); }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; padding-bottom: 40px; }
.card {
  display: flex; flex-direction: column; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  transition: transform .16s, border-color .16s, box-shadow .16s;
}
.card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.card-thumb {
  height: 132px; background: linear-gradient(135deg, #1d2738, #131922); position: relative;
  display: flex; align-items: center; justify-content: center; overflow: hidden; border-bottom: 1px solid var(--border);
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; opacity: .9; }
.card-thumb .ph { font-size: 44px; opacity: .55; }
.card-os {
  position: absolute; top: 10px; left: 10px; padding: 3px 10px; font-size: 11.5px; font-weight: 600;
  background: rgba(14,17,22,.78); border: 1px solid var(--border-strong); border-radius: 999px; backdrop-filter: blur(4px);
}
.card-body { padding: 16px 17px 6px; flex: 1; display: flex; flex-direction: column; }
.card-title { margin: 0 0 6px; font-size: 16.5px; letter-spacing: -.01em; }
.card-summary { margin: 0 0 13px; font-size: 13.5px; color: var(--text-dim); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.tool-badge { font-size: 11.5px; padding: 3px 9px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 6px; color: var(--text-dim); }
.tool-badge b { color: var(--text); font-weight: 600; }
.card-meta { display: flex; align-items: center; gap: 8px; padding: 11px 17px; color: var(--text-faint); font-size: 12px; border-top: 1px solid var(--border); margin-top: 14px; }
.card-meta .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.card-actions { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--border); }
.card-actions button, .card-actions a {
  appearance: none; border: none; background: transparent; color: var(--text-dim);
  padding: 12px 6px; font-size: 12.5px; font-family: inherit; cursor: pointer; text-align: center;
  border-right: 1px solid var(--border); transition: background .14s, color .14s; text-decoration: none;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.card-actions > *:last-child { border-right: none; }
.card-actions button:hover, .card-actions a:hover { background: var(--accent-soft); color: #cfe4ff; }
.card-actions .ico { font-size: 14px; }

.empty { text-align: center; color: var(--text-faint); padding: 60px 0; font-size: 15px; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); margin-top: 30px; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 12px; padding: 22px 0; color: var(--text-faint); font-size: 12.5px; flex-wrap: wrap; }

/* Detail slide-over */
.detail-overlay { position: fixed; inset: 0; background: rgba(5,7,10,.6); backdrop-filter: blur(3px); z-index: 50; display: flex; justify-content: flex-end; }
.detail-overlay[hidden] { display: none; }
.detail-panel {
  width: min(920px, 100%); height: 100%; background: var(--bg); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; box-shadow: -20px 0 60px rgba(0,0,0,.5); animation: slidein .22s ease;
}
@keyframes slidein { from { transform: translateX(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.detail-head { display: flex; align-items: flex-start; gap: 14px; padding: 22px 26px 16px; border-bottom: 1px solid var(--border); }
.detail-titlewrap { flex: 1; min-width: 0; }
.detail-head h2 { margin: 0 0 5px; font-size: 21px; letter-spacing: -.01em; }
.detail-head p { margin: 0 0 10px; color: var(--text-dim); font-size: 14px; }
.detail-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-badges .b { font-size: 11.5px; padding: 3px 9px; border-radius: 6px; background: var(--bg-soft); border: 1px solid var(--border); color: var(--text-dim); }
.close-btn { background: var(--bg-soft); border: 1px solid var(--border); color: var(--text-dim); width: 36px; height: 36px; border-radius: 9px; cursor: pointer; font-size: 15px; flex-shrink: 0; transition: all .14s; }
.close-btn:hover { color: var(--text); border-color: var(--accent); }

.tabs { display: flex; gap: 2px; padding: 0 26px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { padding: 13px 16px; font-size: 14px; color: var(--text-dim); cursor: pointer; border: none; background: none; font-family: inherit; border-bottom: 2px solid transparent; white-space: nowrap; transition: color .14s; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.detail-body { flex: 1; overflow-y: auto; padding: 26px; }
.detail-body iframe { width: 100%; height: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
.pdf-wrap { height: calc(100vh - 230px); display: flex; flex-direction: column; gap: 12px; }
.pdf-actions { display: flex; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; font-size: 13.5px;
  background: var(--accent); color: #fff; border: none; border-radius: var(--radius-sm); cursor: pointer;
  text-decoration: none; font-family: inherit; transition: filter .14s;
}
.btn:hover { filter: brightness(1.1); }
.btn.ghost { background: var(--bg-soft); border: 1px solid var(--border-strong); color: var(--text); }
.script-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.script-head .meta { color: var(--text-dim); font-size: 13px; }
pre.code { background: #0b0e13; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px 18px; overflow-x: auto; font-family: var(--mono); font-size: 12.5px; line-height: 1.65; color: #c9d4e0; }
.captures-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.captures-grid figure { margin: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-soft); }
.captures-grid img { width: 100%; display: block; }
.captures-grid figcaption { padding: 9px 11px; font-size: 12px; color: var(--text-dim); }

/* Markdown rendering */
.md { max-width: 760px; }
.md h1 { font-size: 25px; margin: 8px 0 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.md h2 { font-size: 20px; margin: 30px 0 12px; padding-bottom: 7px; border-bottom: 1px solid var(--border); }
.md h3 { font-size: 16.5px; margin: 24px 0 10px; }
.md p, .md li { font-size: 14.5px; color: #d7e0ea; }
.md code { background: #0b0e13; border: 1px solid var(--border); border-radius: 5px; padding: 1.5px 6px; font-family: var(--mono); font-size: 12.5px; color: #e6b673; }
.md pre { background: #0b0e13; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; overflow-x: auto; }
.md pre code { background: none; border: none; padding: 0; color: #c9d4e0; }
.md a { text-decoration: none; }
.md a:hover { text-decoration: underline; }
.md table { border-collapse: collapse; width: 100%; margin: 14px 0; font-size: 13.5px; }
.md th, .md td { border: 1px solid var(--border); padding: 8px 11px; text-align: left; }
.md th { background: var(--bg-soft); }
.md blockquote { margin: 14px 0; padding: 4px 16px; border-left: 3px solid var(--accent); color: var(--text-dim); background: var(--bg-soft); border-radius: 0 8px 8px 0; }
.md img { max-width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.md hr { border: none; border-top: 1px solid var(--border); margin: 26px 0; }

.md.notes { max-width: none; margin-bottom: 22px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.md.notes h1 { font-size: 19px; border-bottom: none; padding-bottom: 0; margin-top: 0; }
.md.notes h2 { font-size: 16px; }

.loading { color: var(--text-faint); padding: 40px 0; text-align: center; }

@media (max-width: 640px) {
  .cards { grid-template-columns: 1fr; }
  .detail-head { padding: 18px; }
  .detail-body { padding: 18px; }
  .tabs { padding: 0 14px; }
}
