:root {
  --bg: #f5f6fa; --surface: #ffffff; --surface-2: #eef0f6; --text: #151a2c; --muted: #636b83;
  --border: #dfe3ee; --accent: #4f46e5; --accent-2: #0891b2; --accent-text: #ffffff;
  --shadow: 0 1px 2px rgba(20,24,50,.06), 0 8px 24px rgba(20,24,50,.06);
  --radius: 14px; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1120; --surface: #171b2e; --surface-2: #1f2440; --text: #e8eaf6; --muted: #969cb8;
    --border: #2a3050; --accent: #7c83ff; --accent-2: #22d3ee; --accent-text: #0b0e1c;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1120; --surface: #171b2e; --surface-2: #1f2440; --text: #e8eaf6; --muted: #969cb8;
  --border: #2a3050; --accent: #7c83ff; --accent-2: #22d3ee; --accent-text: #0b0e1c;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3); color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); line-height: 1.5;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface-2); padding: .1em .4em; border-radius: 6px; font-size: .9em; }
pre { background: var(--surface-2); padding: 12px 14px; border-radius: 10px; overflow: auto; }
pre code { background: none; padding: 0; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); } .small { font-size: .875rem; }

.topbar { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.topbar-in { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.theme-btn { border: 1px solid var(--border); background: var(--surface); color: var(--text); width: 38px; height: 38px; border-radius: 10px; font-size: 18px; cursor: pointer; }
.theme-btn:hover { border-color: var(--accent); }

.hero { padding: 44px 0 20px; }
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin-bottom: .2em; letter-spacing: -.02em; background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); font-size: 1.1rem; margin: 0; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0 8px; }
.input { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; font: inherit; min-height: 44px; }
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
#q { flex: 1 1 280px; }
.count { color: var(--muted); font-size: .9rem; margin: 6px 0 14px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; padding-bottom: 40px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; min-width: 0; transition: transform .15s, border-color .15s; }
.card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.card[hidden] { display: none; }
.card-head { display: flex; align-items: center; gap: 14px; color: var(--text); min-width: 0; }
.card-head:hover { text-decoration: none; }
.card-head:hover h2 { color: var(--accent); }
.card-title { min-width: 0; }
.card h2 { font-size: 1.15rem; margin: 0; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; font-size: .82rem; }
.ver { font-weight: 600; color: var(--accent); }
.cat { background: var(--surface-2); color: var(--muted); padding: 1px 9px; border-radius: 999px; }
.desc { margin: 0; color: var(--text); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); margin-right: 4px; letter-spacing: .02em; }
.badge-accent { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.card .badge { margin: 0; }

.icon { flex: none; border-radius: 16px; object-fit: cover; background: var(--surface-2); }
.icon-md { width: 56px; height: 56px; } .icon-lg { width: 84px; height: 84px; border-radius: 20px; }
.ph { display: grid; place-items: center; color: #fff; font-weight: 700; background: hsl(var(--h, 230) 62% 52%); }
.icon-md.ph { font-size: 26px; } .icon-lg.ph { font-size: 38px; }
.hue-0{--h:0}.hue-1{--h:30}.hue-2{--h:55}.hue-3{--h:90}.hue-4{--h:140}.hue-5{--h:170}
.hue-6{--h:195}.hue-7{--h:215}.hue-8{--h:245}.hue-9{--h:275}.hue-10{--h:310}.hue-11{--h:340}

.files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.files li { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border-radius: 10px; padding: 7px 8px 7px 12px; }
.fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.fsize { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.more { font-size: .88rem; }
.card-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: .82rem; }

.btn { display: inline-block; background: var(--accent); color: var(--accent-text); font-weight: 600; border-radius: 10px; padding: 9px 18px; border: 0; cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; filter: brightness(1.1); }
.btn-sm { padding: 5px 12px; font-size: .85rem; border-radius: 8px; }

.empty, .empty-state { text-align: center; color: var(--muted); padding: 60px 0; }
.empty-state h1, .empty-state h2 { color: var(--text); }

.crumbs { padding: 22px 0 10px; }
.prog-head { display: flex; gap: 20px; align-items: center; margin: 8px 0 20px; }
.prog-head h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin: 0 0 6px; overflow-wrap: anywhere; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 0 0 20px; }
.facts > div { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; min-width: 0; }
.facts dt { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
.facts dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 20px; box-shadow: var(--shadow); }
.panel h2 { font-size: 1.2rem; }
.prose { overflow-wrap: anywhere; } .prose p { margin: 0 0 .9em; } .prose h3, .prose h4, .prose h5 { margin: 1.2em 0 .4em; }
.prose ul, .prose ol { padding-left: 1.4em; } .prose blockquote { margin: 0 0 1em; padding: .2em 1em; border-left: 3px solid var(--accent); color: var(--muted); }
.table-wrap { overflow-x: auto; }
.ftable { width: 100%; border-collapse: collapse; }
.ftable th { text-align: left; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; padding: 6px 10px; border-bottom: 1px solid var(--border); }
.ftable td { padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.ftable tr:last-child td { border-bottom: 0; }
.c-size { white-space: nowrap; text-align: right; } .c-act { text-align: right; width: 1%; }
.fname-full { overflow-wrap: anywhere; font-weight: 500; }
.note { display: block; color: var(--muted); font-size: .85rem; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.shot { display: block; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.shot img { display: block; width: 100%; height: auto; aspect-ratio: 16/10; object-fit: cover; }

.footer { border-top: 1px solid var(--border); color: var(--muted); font-size: .85rem; padding: 22px 0; text-align: center; }

@media (max-width: 640px) {
  .grid { grid-template-columns: 1fr; }
  .prog-head { flex-direction: column; align-items: flex-start; }
  .ftable thead { display: none; }
  .ftable tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
  .ftable td { border: 0; padding: 0; } .c-name { grid-column: 1 / -1; } .c-size { text-align: left; } .c-act { width: auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
