:root {
  --bg: #f0f2f5;
  --card: #ffffff;
  --text: #050505;
  --text-2: #65676b;
  --line: #ced0d4;
  --hover: #f2f2f2;
  --input: #f0f2f5;
  --accent: #0866ff;
  --accent-soft: #ebf5ff;
  --bubble: #f0f2f5;
  --shadow: 0 1px 2px rgba(0, 0, 0, .2);
  --placeholder: #e4e6eb;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #18191a; --card: #242526; --text: #e4e6eb; --text-2: #b0b3b8; --line: #3e4042;
    --hover: #3a3b3c; --input: #3a3b3c; --accent: #4599ff; --accent-soft: #263951; --bubble: #3a3b3c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5); --placeholder: #3a3b3c; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #18191a; --card: #242526; --text: #e4e6eb; --text-2: #b0b3b8; --line: #3e4042;
  --hover: #3a3b3c; --input: #3a3b3c; --accent: #4599ff; --accent-soft: #263951; --bubble: #3a3b3c;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5); --placeholder: #3a3b3c; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.34 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; height: 56px; display: flex; align-items: center; gap: 12px;
  padding: 0 16px; background: var(--card); box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; font: 700 30px/1 Helvetica, Arial, sans-serif; padding-top: 6px;
}
.search {
  flex: 0 1 280px; display: flex; align-items: center; gap: 6px; background: var(--input);
  border-radius: 20px; padding: 0 12px; height: 40px; margin-left: auto;
}
.search > svg { width: 16px; height: 16px; fill: var(--text-2); flex: none; }
.search > input { border: 0; background: transparent; color: var(--text); font: inherit; width: 100%; outline: none; }
.search { position: relative; }
.search-opts {
  border: 0; background: transparent; cursor: pointer; padding: 4px; border-radius: 50%; display: grid; place-items: center; flex: none;
}
.search-opts:hover, .search-opts[aria-expanded="true"], .search-opts.on { background: var(--hover); }
.search-opts.on svg { fill: var(--accent); }
.search .search-opts svg { width: 18px; height: 18px; }
.search-panel {
  position: absolute; top: calc(100% + 8px); right: 0; width: min(360px, calc(100vw - 24px)); z-index: 30;
  padding: 14px 16px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); display: flex; flex-direction: column; gap: 10px;
}
.search-panel[hidden] { display: none; }
.sp-title { font-weight: 700; font-size: 17px; }
.sp-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--text-2); flex: 1; min-width: 0; }
.sp-field input {
  font: inherit; font-size: 15px; font-weight: 400; color: var(--text); background: var(--input); border: 1px solid transparent;
  border-radius: 6px; padding: 7px 10px; width: 100%;
}
.sp-field input:focus { outline: none; border-color: var(--accent); }
.sp-scope { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.sp-scope legend { font-size: 13px; font-weight: 600; color: var(--text-2); padding: 0; margin-bottom: 4px; }
.sp-scope label { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.sp-scope input { margin: 0; accent-color: var(--accent); }
.sp-dates { display: flex; gap: 8px; }
.sp-hint { font-size: 12px; color: var(--text-2); }
.sp-actions { display: flex; justify-content: flex-end; gap: 8px; }
.btn-primary, .btn-plain { border: 0; border-radius: 6px; padding: 8px 14px; font-weight: 600; cursor: pointer; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-plain { background: var(--input); }
.chip-sub { font-weight: 400; }
mark.hl { background: #ffe066; color: #000; border-radius: 2px; padding: 0 1px; }
.match-note { font-size: 13px; color: var(--accent); font-weight: 600; padding: 0 16px 8px; }
.c-bubble.hit { box-shadow: 0 0 0 2px var(--accent); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--input); cursor: pointer;
  display: grid; place-items: center; flex: none;
}
.icon-btn svg { width: 20px; height: 20px; fill: var(--text); }
@media (max-width: 600px) { .brand-text { display: none; } }

/* ---------- profile header ---------- */
.profile-header { background: var(--card); box-shadow: var(--shadow); }
.cover {
  max-width: 1100px; margin: 0 auto; aspect-ratio: 851 / 315; max-height: 400px; width: 100%;
  background: var(--placeholder) center / cover no-repeat; border-radius: 0 0 8px 8px;
}
.profile-row {
  max-width: 1030px; margin: 0 auto; padding: 0 16px; display: flex; align-items: flex-end; gap: 16px;
  margin-top: -40px; position: relative;
}
.avatar {
  width: 168px; height: 168px; border-radius: 50%; border: 4px solid var(--card); flex: none;
  background: var(--placeholder) center / cover no-repeat;
}
.profile-meta { padding-bottom: 16px; min-width: 0; }
.profile-meta h1 { margin: 0; font-size: 32px; line-height: 1.2; }
.profile-sub { color: var(--text-2); font-weight: 600; }
.tabs {
  max-width: 1030px; margin: 12px auto 0; padding: 0 16px; display: flex; gap: 4px;
  border-top: 1px solid var(--line);
}
.tabs a {
  padding: 16px 16px 14px; color: var(--text-2); font-weight: 600; border-bottom: 3px solid transparent;
}
.tabs a:hover { text-decoration: none; background: var(--hover); border-radius: 6px 6px 0 0; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
@media (max-width: 700px) {
  .profile-row { flex-direction: column; align-items: center; text-align: center; margin-top: -60px; }
  .avatar { width: 128px; height: 128px; }
  .profile-meta h1 { font-size: 26px; }
}

/* ---------- layout ---------- */
main { max-width: 1030px; margin: 16px auto; padding: 0 16px; }
.layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
.layout > aside { position: sticky; top: 72px; max-height: calc(100vh - 88px); overflow: auto; }
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .layout > aside { position: static; max-height: none; }
  .info-box { display: none; }
  /* telefon/tablet: lata jako kafelki w kilku rzędach, miesiące pod wybranym rokiem */
  .layout .timeline { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .layout .tl-year { grid-template-columns: auto auto; gap: 6px; padding: 7px 12px; border-radius: 18px; background: var(--input); }
  .layout .tl-year .bar { display: none; }
  .layout .tl-year.open, .layout .tl-year.active { background: var(--accent); color: #fff; }
  .layout .tl-year.open .c, .layout .tl-year.active .c { color: #fff; opacity: .85; }
  .layout .tl-all { margin-bottom: 0; border-bottom: 0; }
  .layout .tl-months { flex-basis: 100%; grid-template-columns: repeat(6, 1fr); margin: 2px 0 4px; }
}
.card { background: var(--card); border-radius: 8px; box-shadow: var(--shadow); }
.box { padding: 12px 16px; margin-bottom: 16px; }
.box h2 { font-size: 20px; margin: 0 0 8px; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }

/* timeline filter */
.timeline { display: flex; flex-direction: column; gap: 2px; }
.tl-year {
  display: grid; grid-template-columns: 76px 1fr 40px; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 8px; color: var(--text); font-weight: 600; font-size: 15px;
}
.tl-year:hover { background: var(--hover); text-decoration: none; }
.tl-year .c { text-align: right; color: var(--text-2); font-weight: 500; font-size: 13px; font-variant-numeric: tabular-nums; }
.tl-year .bar { height: 6px; border-radius: 3px; background: var(--input); overflow: hidden; }
.tl-year .bar > span { display: block; height: 100%; border-radius: 3px; background: var(--text-2); opacity: .45; }
.tl-year.open { background: var(--accent-soft); color: var(--accent); }
.tl-year.open .bar > span, .tl-year.active .bar > span { background: var(--accent); opacity: 1; }
.tl-year.active { background: var(--accent); color: #fff; }
.tl-year.active .c { color: #fff; opacity: .85; }
.tl-year.active .bar { background: rgba(255, 255, 255, .3); }
.tl-year.active .bar > span { background: #fff; }
.tl-all { grid-template-columns: 1fr auto; margin-bottom: 6px; padding-bottom: 9px; border-bottom: 1px solid var(--line); border-radius: 8px 8px 0 0; }
.tl-all.active { border-radius: 8px; border-bottom-color: transparent; }
.tl-months { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 4px 0 10px; }
.tl-month {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  padding: 6px 2px; border-radius: 8px; border: 1px solid var(--line); color: var(--text); line-height: 1.15;
}
.tl-month .m { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
.tl-month .c { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
a.tl-month:hover { background: var(--hover); text-decoration: none; border-color: var(--accent); }
.tl-month.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tl-month.active .m { color: #fff; opacity: .85; }
.tl-month.empty { opacity: .4; border-style: dashed; }
.tl-month.empty .c { font-weight: 400; }
.filter-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px; margin-bottom: 16px;
}
.chip {
  display: inline-flex; align-items: center; gap: 6px; background: var(--accent-soft); color: var(--accent);
  border-radius: 16px; padding: 4px 6px 4px 12px; font-weight: 600; font-size: 14px;
}
.chip button { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 16px; line-height: 1; }

/* ---------- post ---------- */
.post { margin-bottom: 16px; }
.post-head { display: flex; gap: 8px; align-items: center; padding: 12px 16px 0; }
.post-head .av { width: 40px; height: 40px; border-radius: 50%; background: var(--placeholder) center / cover; flex: none; }
.post-head .who { font-weight: 600; color: var(--text); }
.post-head .when { font-size: 13px; color: var(--text-2); }
.post-head .when a { color: inherit; }
.post-text { padding: 8px 16px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.post-text.short { font-size: 24px; line-height: 1.25; }
.post-text a, .c-text a { overflow-wrap: anywhere; }
.see-more { border: 0; background: none; padding: 0; color: var(--text); font-weight: 600; cursor: pointer; }
.shared {
  margin: 0 16px 12px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px;
}
.shared .lbl { font-size: 12px; color: var(--text-2); font-weight: 600; margin-bottom: 4px; white-space: normal; }
.attach {
  margin: 0 16px 12px; display: block; border: 1px solid var(--line); border-radius: 8px; background: var(--bubble);
  padding: 10px 12px; color: var(--text);
}
.attach:hover { text-decoration: none; filter: brightness(.97); }
.attach .host { font-size: 12px; text-transform: uppercase; color: var(--text-2); }
.attach .title { font-weight: 600; overflow-wrap: anywhere; }
.attach.has-thumb { padding: 0; overflow: hidden; }
.attach.has-thumb .attach-body { padding: 10px 12px; }
.embed-player { margin: 0 0 12px; background: var(--bubble); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.embed-frame { position: relative; aspect-ratio: 16 / 9; background: #000; }
.embed-player.audio .embed-frame { aspect-ratio: auto; height: 352px; background: transparent; }
.embed-player.audio-short .embed-frame { aspect-ratio: auto; height: 152px; background: transparent; }
.embed-player.audio-tall .embed-frame { aspect-ratio: auto; height: 300px; background: transparent; }
.embed-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.embed-caption { display: block; padding: 8px 16px 10px; color: var(--text); }
.embed-caption:hover { text-decoration: none; filter: brightness(.97); }
.embed-caption .host { display: block; font-size: 12px; text-transform: uppercase; color: var(--text-2); }
.embed-caption .title { display: block; font-weight: 600; overflow-wrap: anywhere; }
.attach-thumb { position: relative; aspect-ratio: 16 / 9; background: #000; overflow: hidden; }
.attach-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-thumb.noimg { background: #c4302b; }
.attach-thumb.noimg::before {
  content: "YouTube"; position: absolute; left: 12px; top: 10px; color: #fff; font-weight: 700; font-size: 18px;
}
.attach + .attach { margin-top: -4px; }
.post-head .ctx { font-weight: 400; color: var(--text-2); }
.shared-link { display: block; margin-top: 6px; white-space: normal; overflow-wrap: anywhere; }
.video-blank { width: 100%; aspect-ratio: 16 / 9; background: #111; }

/* photo grid */
.grid { display: grid; gap: 3px; background: var(--card); }
.grid .cell {
  position: relative; overflow: hidden; background: var(--placeholder); cursor: pointer; border: 0; padding: 0;
  display: block; min-height: 0;
}
.grid .cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.grid.n1 .cell img { height: auto; max-height: 720px; object-fit: contain; background: #000; }
.grid.n2 { grid-template-columns: 1fr 1fr; }
.grid.n2 .cell { aspect-ratio: 1 / 1; }
.grid.n3 { grid-template-columns: 1fr 1fr; }
.grid.n3 .cell:first-child { grid-column: 1 / 3; aspect-ratio: 2 / 1; }
.grid.n3 .cell { aspect-ratio: 1 / 1; }
.grid.n4 { grid-template-columns: 1fr 1fr; }
.grid.n4 .cell { aspect-ratio: 1 / 1; }
.grid.n5 { grid-template-columns: repeat(6, 1fr); }
.grid.n5 .cell { grid-column: span 2; aspect-ratio: 1 / 1; }
.grid.n5 .cell:nth-child(-n+2) { grid-column: span 3; }
.grid .video-cell { cursor: default; }
.grid .video-cell video { display: block; width: 100%; height: auto; max-height: 92vh; background: #000; }
.more-overlay {
  position: absolute; inset: 0; background: rgba(0, 0, 0, .45); color: #fff; display: grid; place-items: center;
  font-size: 32px; font-weight: 700;
}
.play {
  position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; transform: translate(-50%, -50%);
  border-radius: 50%; background: rgba(0, 0, 0, .55); border: 3px solid #fff; display: grid; place-items: center;
}
.play::after { content: ""; border-style: solid; border-width: 12px 0 12px 20px; border-color: transparent transparent transparent #fff; margin-left: 5px; }
.video-label {
  position: absolute; left: 8px; bottom: 8px; background: rgba(0, 0, 0, .65); color: #fff; font-size: 12px;
  padding: 3px 8px; border-radius: 4px;
}
.img-missing {
  width: 100%; height: 100%; min-height: 160px; display: grid; place-items: center; color: var(--text-2);
  font-size: 13px; background: var(--placeholder); text-align: center; padding: 12px;
}
.img-missing svg { width: 40px; height: 40px; fill: currentColor; opacity: .6; display: block; margin: 0 auto 4px; }

/* stats + actions */
.stats { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 16px; color: var(--text-2); }
.rx-summary { position: relative; display: flex; align-items: center; gap: 6px; cursor: pointer; border: 0; background: none; color: inherit; padding: 0; }
.rx-summary:hover .rx-count { text-decoration: underline; }
.rx-icons { display: flex; }
.rx-icon {
  width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px;
  border: 2px solid var(--card); margin-left: -4px; line-height: 1;
}
.rx-icons .rx-icon:first-child { margin-left: 0; }
.rx-like { background: linear-gradient(#18afff, #0866ff); }
.rx-love { background: linear-gradient(#ff6680, #e61739); }
.rx-care, .rx-haha, .rx-wow, .rx-sad, .rx-angry, .rx-other { background: #fcd34d; }
.rx-angry { background: linear-gradient(#f7b125, #e9710f); }
.rx-icon svg { width: 11px; height: 11px; fill: #fff; }
.rx-pop {
  position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 5; background: var(--card); color: var(--text);
  border-radius: 8px; box-shadow: 0 4px 16px rgba(0, 0, 0, .25); padding: 8px 10px; min-width: 170px;
  display: none; text-align: left; cursor: default;
}
.rx-summary:hover .rx-pop, .rx-summary.open .rx-pop { display: block; }
.rx-pop .row { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 14px; }
.rx-pop .row b { margin-left: auto; padding-left: 12px; }
.rx-pop .rx-icon { margin: 0; }
.counts { display: flex; gap: 14px; }
.counts button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0; }
.counts button:hover { text-decoration: underline; }
.actions {
  display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 16px; border-top: 1px solid var(--line);
  padding: 4px 0;
}
.actions button, .actions a {
  border: 0; background: none; padding: 8px; border-radius: 4px; color: var(--text-2); font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.actions button:hover, .actions a:hover { background: var(--hover); text-decoration: none; }
.actions svg { width: 18px; height: 18px; fill: currentColor; }

/* comments */
.comments { padding: 4px 16px 12px; border-top: 1px solid var(--line); margin: 0; }
.comments[hidden] { display: none; }
.c { display: flex; gap: 6px; margin-top: 8px; }
.c-av {
  width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700;
  font-size: 13px; color: #fff;
}
.c-body { min-width: 0; flex: 1; }
.c-bubble {
  position: relative; display: inline-block; max-width: 100%; background: var(--bubble); border-radius: 18px;
  padding: 8px 12px;
}
.c-author { font-weight: 600; font-size: 13px; color: var(--text); }
.c-author.page { color: var(--text); }
.c-author.page::after { content: " · Autor"; color: var(--text-2); font-weight: 400; }
.c-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; }
.c-meta { font-size: 12px; color: var(--text-2); padding: 2px 12px; display: flex; gap: 12px; }
.c-rx {
  position: absolute; right: -6px; bottom: -10px; background: var(--card); border-radius: 10px; padding: 1px 4px 1px 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25); font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 2px;
}
.c-rx .rx-icon { width: 16px; height: 16px; border: 0; margin: 0; }
.c-rx .rx-icon svg { width: 9px; height: 9px; }
.c-replies { margin-left: 38px; position: relative; }
.c-depth-0 > .c-body > .c-replies { border-left: 0; }
.replies-toggle {
  border: 0; background: none; padding: 4px 0 0; color: var(--text-2); font-weight: 600; font-size: 14px; cursor: pointer;
}
.replies-toggle:hover { text-decoration: underline; }
.comments-note { font-size: 13px; color: var(--text-2); margin-top: 10px; }

/* ---------- photos tab ---------- */
.ph-card { padding: 16px; }
.ph-card h2 { margin: 0 0 4px; font-size: 20px; }
.subtabs { display: flex; gap: 4px; margin: 8px 0 16px; }
.subtabs a { padding: 8px 12px; border-radius: 6px; font-weight: 600; color: var(--text-2); }
.subtabs a.active { color: var(--accent); background: var(--accent-soft); }
.subtabs a:hover { text-decoration: none; background: var(--hover); }
.albums { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.album { color: var(--text); display: block; }
.album:hover { text-decoration: none; }
.album .thumb { aspect-ratio: 1 / 1; border-radius: 8px; overflow: hidden; background: var(--placeholder); }
.album .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: filter .15s; }
.album:hover .thumb img { filter: brightness(.9); }
.album .t { font-weight: 600; margin-top: 6px; overflow-wrap: anywhere; }
.album .n { color: var(--text-2); font-size: 13px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.photos .cell { aspect-ratio: 1 / 1; border-radius: 6px; overflow: hidden; background: var(--placeholder); border: 0; padding: 0; cursor: pointer; }
.photos .cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photos .cell .img-missing { min-height: 0; }
.back { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; margin-bottom: 8px; }

.loading, .end { text-align: center; color: var(--text-2); padding: 20px; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin .8s linear infinite; margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.actions > * { min-width: 0; }

/* wąskie ekrany: karty od krawędzi do krawędzi, jak w mobilnym FB */
@media (max-width: 520px) {
  main { padding: 0; margin-top: 8px; }
  .card { border-radius: 0; }
  .ph-card { padding: 12px; }
  .actions { margin: 0 8px; }
  .actions button, .actions a { font-size: 13px; padding: 8px 2px; gap: 4px; white-space: nowrap; }
  .stats { padding: 10px 12px; }
  .counts { gap: 8px; font-size: 13px; text-align: right; }
  .search { flex-basis: 160px; }
  .grid.n5 .cell { aspect-ratio: 1 / 1; }
  .grid.n5 .cell:nth-child(-n+2) { aspect-ratio: 1 / 1; }
}

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100; display: grid; grid-template-columns: minmax(0, 1fr) 360px; background: #000;
}
.lightbox[hidden] { display: none; }
.lb-stage { position: relative; display: grid; place-items: center; min-height: 0; overflow: hidden; }
.lb-img { max-width: 100%; max-height: 100vh; object-fit: contain; display: block; }
.lb-video { max-width: 100%; max-height: 100vh; width: 100%; display: block; background: #000; }
.lb-close, .lb-nav {
  position: absolute; border: 0; background: rgba(255, 255, 255, .15); color: #fff; cursor: pointer; border-radius: 50%;
  display: grid; place-items: center;
}
.lb-close:hover, .lb-nav:hover { background: rgba(255, 255, 255, .3); }
.lb-close { top: 12px; left: 12px; width: 40px; height: 40px; font-size: 28px; line-height: 1; }
.lb-nav { top: 50%; transform: translateY(-50%); width: 48px; height: 48px; font-size: 34px; line-height: 1; padding-bottom: 4px; }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
.lb-nav[disabled] { display: none; }
.lb-counter { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); color: #ddd; font-size: 13px; }
.lb-side { background: var(--card); color: var(--text); padding: 16px; overflow: auto; }
.lb-side .when { color: var(--text-2); font-size: 13px; margin: 2px 0 12px; }
.lb-side .cap { white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 12px; }
.lb-side .alt { color: var(--text-2); font-size: 13px; font-style: italic; margin-bottom: 12px; }
.lb-side .btn {
  display: inline-block; background: var(--accent-soft); color: var(--accent); padding: 8px 12px; border-radius: 6px; font-weight: 600;
}
.lb-side .btn:hover { text-decoration: none; filter: brightness(.95); }
.lb-missing { color: #aaa; text-align: center; }
.lb-missing svg { width: 64px; height: 64px; fill: currentColor; }
@media (max-width: 800px) {
  .lightbox { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .lb-side { max-height: 35vh; }
  .lb-img, .lb-video { max-height: 65vh; }
}
