:root {
  --bg: #0b0d10; --panel: #14171c; --line: #252a31; --text: #e8eaed; --muted: #9aa3ad; --accent: #4f9cff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }

.top { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: rgba(11, 13, 16, .92); backdrop-filter: blur(8px); z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; }
.brand:hover { text-decoration: none; }
.logo { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; background: var(--text); color: var(--bg);
  font-weight: 800; font-size: 13px; }
.top nav { display: flex; gap: 18px; font-size: 14px; }
.top nav a { color: var(--muted); }

.list { max-width: 1180px; margin: 0 auto; padding: 28px 20px 40px; }
.intro h1 { margin: 0 0 8px; font-size: 26px; }
.intro p { margin: 0 0 24px; color: var(--muted); max-width: 760px; line-height: 1.55; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.card { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; color: var(--text); transition: border-color .15s, transform .15s; }
.card:hover { text-decoration: none; border-color: #3a4350; transform: translateY(-2px); }
.card .thumb { position: relative; aspect-ratio: 1; background: #000; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .thumb .badge { position: absolute; left: 10px; top: 10px; font-size: 12px; padding: 3px 8px; border-radius: 99px;
  background: rgba(0, 0, 0, .65); color: #fff; }
.card .body { padding: 14px 16px 16px; }
.card h3 { margin: 0 0 6px; font-size: 17px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.card .meta { margin-top: 10px; font-size: 12.5px; color: var(--muted); }

.viewer { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 0; min-height: calc(100vh - 55px - 46px); }
.stage { position: relative; background: #000; display: grid; place-items: center; overflow: hidden; touch-action: none;
  cursor: ew-resize; user-select: none; }
.stage canvas { width: min(100%, calc(100vh - 110px)); aspect-ratio: 1; height: auto; image-rendering: auto; display: block; }
.overlay { position: absolute; font: 13px/1.35 ui-monospace, Menlo, Consolas, monospace; color: #e6e6e6;
  text-shadow: 0 0 3px #000, 0 0 2px #000; pointer-events: none; padding: 10px 12px; white-space: pre; }
.overlay.tl { left: 0; top: 0; } .overlay.tr { right: 0; top: 0; text-align: right; }
.overlay.bl { left: 0; bottom: 0; } .overlay.br { right: 0; bottom: 0; color: #9aa3ad; }
.loading { position: absolute; inset: 0; display: grid; place-content: center; gap: 10px; justify-items: center; background: #000;
  color: var(--muted); font-size: 14px; }
.loading .bar { width: 220px; height: 4px; background: #222; border-radius: 4px; overflow: hidden; }
.loading .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .1s; }

.side { border-left: 1px solid var(--line); background: var(--panel); padding: 18px 18px 24px; display: flex; flex-direction: column; gap: 14px; }
.back { font-size: 14px; }
.side h2 { margin: 0; font-size: 19px; }
.summary { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.controls { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { background: #1d2229; color: var(--text); border: 1px solid var(--line); border-radius: 8px; height: 38px; min-width: 42px;
  padding: 0 12px; font-size: 15px; cursor: pointer; }
.btn:hover { border-color: #3a4350; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; min-width: 56px; }
.btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.slider { width: 100%; accent-color: var(--accent); }
.info { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: 13.5px; }
.info dt { color: var(--muted); } .info dd { margin: 0; }
.links { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.foot { border-top: 1px solid var(--line); padding: 14px 20px; color: var(--muted); font-size: 12.5px; text-align: center; }

@media (max-width: 860px) {
  .viewer { grid-template-columns: 1fr; }
  .stage canvas { width: 100%; }
  .side { border-left: 0; border-top: 1px solid var(--line); }
  .overlay { font-size: 11px; padding: 6px 8px; }
  .overlay.tr { top: 24px; left: 0; text-align: left; white-space: normal; }
  .overlay.br { display: none; }
}
