/* pr0klon – dark image-board layout.
   Measurements taken from REA screenshots of the reference site: 52px black header,
   128px thumbnails with 4px gutters, 8 columns = 1052px page, #161618 page background. */

:root {
  --bg: #161618;
  --bg-head: #000;
  --bg-panel: #1e1e21;
  --bg-input: #2a2e31;
  --bg-hover: #333438;
  --text: #f2f5f4;
  --text-dim: #888;
  --text-faint: #5a5a5f;
  --accent: #ee4d2e;
  --accent-hover: #ff6a4d;
  --good: #5bb91c;
  --bad: #d23c22;
  --link: #75c0c7;
  --thumb: 128px;
  --gap: 4px;
  --page-width: 1052px;
  --head-h: 52px;
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-padding-top: var(--head-h); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select {
  font: inherit; color: var(--text); background: var(--bg-input);
  border: 1px solid transparent; border-radius: 2px; padding: 6px 8px;
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); }
[hidden] { display: none !important; }

.icon { width: 18px; height: 18px; fill: currentColor; display: block; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; color: var(--text); }
.icon-btn:hover { color: var(--accent); }
.action { color: var(--text-dim); cursor: pointer; }
.action:hover { color: var(--accent); }

body.guest .user-only, body.user .guest-only { display: none !important; }

.primary-button {
  background: var(--accent); color: #fff; border: 0; border-radius: 3px;
  padding: 8px 16px; font-weight: 700; cursor: pointer;
}
.primary-button:hover { background: var(--accent-hover); }
.primary-button:disabled { opacity: .5; cursor: default; }
.secondary-button {
  background: var(--bg-input); color: var(--text); border: 0; border-radius: 3px; padding: 8px 14px; cursor: pointer;
}
.secondary-button:hover { background: var(--bg-hover); }

/* ---------- header ---------- */

#page { width: var(--page-width); margin: 0 auto; }
#head {
  position: sticky; top: 0; z-index: 100;
  height: var(--head-h); background: var(--bg-head);
}
#head::before { /* full-bleed black bar behind the centered page */
  content: ""; position: absolute; inset: 0 calc(50% - 50vw); background: var(--bg-head); z-index: -1;
}
#head-content { display: flex; align-items: center; height: 100%; gap: 18px; }

#logo-link { display: flex; align-items: center; gap: 6px; color: var(--accent); flex-shrink: 0; }
#logo-link .logo-icon { width: 22px; height: 22px; }
#logo-link .logo-text { color: #fff; font-weight: 500; font-size: 19px; letter-spacing: .5px; }

#head-menu { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; padding-top: 6px; }
.head-tab { font-size: 16px; color: var(--text); }
.head-tab.active { color: var(--accent); }
#more-link .icon { width: 16px; }
.head-link { color: var(--text); font-size: 15px; }
#filter-link { color: var(--text-dim); font-size: 13px; border: 1px solid #333; border-radius: 3px; padding: 1px 6px; }
#filter-link:hover { color: var(--accent); border-color: var(--accent); }

#search-form { display: flex; align-items: center; gap: 10px; margin-left: 24px; }
#search-input { width: 248px; height: 26px; padding: 3px 6px; background: #3b3d40; border-radius: 0; font-size: 14px; }
#search-input::placeholder { color: #8a8a8a; }
#search-form .icon { width: 15px; height: 15px; }

#user-area { display: flex; align-items: center; gap: 14px; flex-shrink: 0; font-size: 15px; }
.login-btn { display: inline-flex; align-items: center; gap: 4px; font-weight: 500; }
.login-btn .star { fill: #f7c600; width: 18px; height: 18px; }
#user-profile-name { font-weight: 700; }
#logout-link { color: var(--text-dim); font-size: 13px; }

/* dropdown menus */
.tip-menu {
  position: absolute; top: calc(var(--head-h) - 4px); z-index: 120;
  background: var(--bg-panel); border: 1px solid #2c2c30; border-radius: 3px;
  box-shadow: 0 8px 24px rgba(0,0,0,.6); min-width: 220px;
}
.tip-menu-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.tip-menu-footer { padding: 10px 14px; border-top: 1px solid #2c2c30; text-align: right; }
.tip-menu a { color: var(--text); }
.tip-menu a:hover { color: var(--accent); }
.filter-setting { display: grid; grid-template-columns: 20px 1fr; column-gap: 6px; cursor: pointer; }
.filter-setting input { grid-row: span 2; margin: 3px 0 0; accent-color: var(--accent); }
.filter-name { font-weight: 700; }
.filter-desc { color: var(--text-dim); font-size: 12px; }
.filter-setting.disabled { opacity: .45; cursor: not-allowed; }
.bookmarks-head { color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; }
#bookmarks-list { display: flex; flex-direction: column; gap: 4px; }
.bookmark-row { display: flex; justify-content: space-between; gap: 10px; }
.bookmark-row .remove { color: var(--text-faint); }
.bookmark-row .remove:hover { color: var(--bad); }
#bookmark-add { text-align: left; font-size: 13px; }

/* ---------- stream ---------- */

#main-view { padding-bottom: 80px; min-height: calc(100vh - var(--head-h)); }
.stream-row { display: flex; gap: var(--gap); margin-bottom: var(--gap); }
.thumb {
  position: relative; display: block; width: var(--thumb); height: var(--thumb);
  flex: 0 0 var(--thumb); background: #222; overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity .15s; }
.thumb:hover img { opacity: .78; }
.thumb.seen::after { /* subtle marker for already viewed items */
  content: ""; position: absolute; right: 4px; bottom: 4px; width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,.55);
}
.thumb.active { outline: 2px solid var(--accent); outline-offset: -2px; }
.thumb .badge {
  position: absolute; left: 4px; top: 4px; font-size: 10px; font-weight: 700; padding: 1px 4px;
  background: rgba(0,0,0,.7); border-radius: 2px; color: #fff;
}
.stream-status { color: var(--text-dim); text-align: center; padding: 30px 0; }
.spinner {
  display: inline-block; width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid #333; border-top-color: var(--accent); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.stream-head { padding: 18px 0 14px; display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.stream-head h1 { margin: 0; font-size: 22px; font-weight: 500; }
.stream-head .sub { color: var(--text-dim); }

/* ---------- item view (inline, between rows) ---------- */

.item-container {
  position: relative; margin: 0 0 var(--gap); padding: 4px 0 24px;
  background: var(--bg);
}
.item-container::before { /* arrow pointing at the opened thumbnail */
  content: ""; position: absolute; top: -9px; left: var(--arrow-x, 50%);
  border: 9px solid transparent; border-top: 0; border-bottom-color: var(--bg);
  transform: translateX(-50%);
}
.item-image-wrapper { position: relative; display: flex; justify-content: center; min-height: 200px; }
.item-image { display: block; max-width: 100%; background: #0c0c0d; }
.item-image-wrapper video.item-image { outline: none; }
.stream-prev, .stream-next {
  position: absolute; top: 0; bottom: 0; width: 90px; display: flex; align-items: center;
  color: #555; cursor: pointer; user-select: none;
}
.stream-prev { left: 0; justify-content: flex-start; }
.stream-next { right: 0; justify-content: flex-end; }
.stream-prev:hover, .stream-next:hover { color: #fff; }
.stream-prev svg, .stream-next svg { width: 28px; height: 60px; stroke: currentColor; fill: none; stroke-width: 2; position: sticky; top: 45%; }
.item-close {
  position: absolute; right: 8px; top: 10px; z-index: 2; color: #777; font-size: 22px; line-height: 1;
  background: rgba(0,0,0,.4); border-radius: 50%; width: 30px; height: 30px;
}
.item-close:hover { color: #fff; }

.item-info { padding: 14px 4px 6px; display: grid; grid-template-columns: auto 1fr; column-gap: 18px; row-gap: 10px; }
.item-vote { display: flex; align-items: center; gap: 2px; grid-row: span 2; align-self: start; }
.vote-btn {
  width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  color: #555; font-size: 26px; font-weight: 700; line-height: 1;
}
.vote-btn:hover { color: #999; }
.vote-btn.up.voted { color: var(--accent); }
.vote-btn.down.voted { color: #fff; }
.vote-btn.fav { font-size: 22px; }
.vote-btn.fav.voted { color: #f7c600; }
.item-vote .score { font-size: 26px; font-weight: 700; min-width: 54px; padding: 0 10px 0 6px; }

.item-details { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; color: var(--text-dim); font-size: 13px; }
.item-details .user { font-weight: 700; }
.item-details a.time:hover { color: var(--accent); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag {
  display: inline-flex; align-items: center; gap: 2px; background: var(--bg-input);
  border-radius: 2px; padding: 3px 4px 3px 8px; font-size: 13px;
}
.tag .tag-link { color: #ddd; }
.tag.tag-bad .tag-link { color: #888; }
.tag.tag-good .tag-link { color: #fff; }
.tag .tag-link:hover { color: var(--accent); }
.tag .tvote { color: #555; width: 16px; text-align: center; visibility: hidden; font-weight: 700; }
.tag:hover .tvote, .tag .tvote.voted { visibility: visible; }
.tag .tvote.up.voted { color: var(--accent); }
.tag .tvote.down.voted { color: #fff; }
.tag.hidden-tag { display: none; }
.tags.expanded .tag.hidden-tag { display: inline-flex; }
.tag-form { display: flex; gap: 6px; margin-top: 8px; }
.tag-form input[type=text] { flex: 1; }

/* ---------- comments ---------- */

.item-comments { margin-top: 18px; padding: 0 4px; max-width: 760px; }
.comments-head { font-size: 15px; color: var(--text-dim); margin-bottom: 10px; display: flex; gap: 12px; align-items: baseline; }
.comments-head .sort { margin-left: auto; font-size: 12px; }
.comments-head .sort .active { color: var(--accent); }
.comment-form textarea, .reply-form textarea { width: 100%; min-height: 70px; resize: vertical; display: block; }
.comment-form .row, .reply-form .row { display: flex; gap: 8px; margin: 6px 0 14px; }
.comment-login {
  background: var(--bg-panel); border-radius: 3px; padding: 18px; text-align: center; margin-bottom: 14px; color: var(--text-dim);
}
.comment-login h3 { margin: 0 0 4px; color: var(--text); font-size: 16px; }
.comment { padding: 6px 0 6px; }
.comment-box { border-left: 1px solid #2d2d31; padding-left: 14px; margin-left: 2px; }
.comments > .comment-box { border-left: 0; padding-left: 0; margin-left: 0; }
.comment-content { white-space: pre-wrap; word-wrap: break-word; color: #eee; }
.comment-content a { color: var(--link); }
.comment-content .greentext { color: #8ba446; }
.comment-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12px; color: var(--text-dim); margin-top: 3px; }
.comment-foot .user { font-weight: 700; }
.comment-foot .op { background: var(--accent); color: #fff; border-radius: 2px; padding: 0 3px; font-size: 10px; font-weight: 700; }
.comment-foot .cvote { color: #555; font-weight: 700; font-size: 15px; width: 14px; text-align: center; }
.comment-foot .cvote:hover { color: #999; }
.comment-foot .cvote.up.voted { color: var(--accent); }
.comment-foot .cvote.down.voted { color: #fff; }
.comment-foot .score { color: #bbb; }
.comment.highlight .comment-content { background: rgba(238,77,46,.12); }
.comment-box.folded > .comment-children { display: none; }
.folded-note { color: var(--text-faint); }

/* user marks (rank colors) */
.um0 { color: #fff !important; } .um1 { color: #e108e9 !important; } .um2 { color: #5bb91c !important; }
.um3 { color: #ff9900 !important; } .um4 { color: #444 !important; } .um5 { color: #008fff !important; }
.um6 { color: #6c432b !important; } .um7 { color: #1cb992 !important; } .um8 { color: #d23c22 !important; }
.um9 { color: #1cb992 !important; }

/* ---------- fediverse ---------- */

.um-fedi { color: #9a8cff !important; }
.user-host { color: var(--text-faint); font-weight: 400; }
a:hover .user-host { color: inherit; }
.thumb .badge.fedi { background: rgba(110, 90, 255, .85); }
.fedi-link { color: #9a8cff; }
.item-caption { grid-column: 2; color: #ddd; white-space: pre-wrap; word-wrap: break-word; max-width: 760px; }
.item-caption a { color: var(--link); }
.user-head .handle { margin: 2px 0 4px; }
.user-head .handle .action { color: #9a8cff; font-size: 14px; }
.user-head .bio { color: #ccc; max-width: 560px; margin: 8px 0 0; white-space: pre-wrap; }
.user-side { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.follow-btn { min-width: 120px; }
#overlay-box input[type=password] { width: 100%; margin-bottom: 12px; }
textarea { resize: vertical; }

/* ---------- feeds (Reiter) ---------- */

#feed-tabs { display: contents; }
#feeds-link { color: #777; }
#feeds-link:hover { color: var(--accent); }
#feeds-link .icon { width: 17px; height: 17px; }
a.primary-button, a.secondary-button { display: inline-block; text-decoration: none; }
a.primary-button:hover { color: #fff; }
a.secondary-button:hover { color: var(--text); }
.stream-head .feed-edit-link { margin-left: auto; font-size: 13px; }

.feeds-page { max-width: 760px; padding: 26px 0; }
.feeds-page h1 { font-weight: 500; font-size: 26px; margin: 0 0 8px; }
.feeds-page .sub { color: var(--text-dim); margin: 0 0 18px; }
.feeds-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.feed-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.feed-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  background: var(--bg-panel); border-radius: 3px; padding: 10px 14px;
}
.feed-row.is-hidden .feed-main { opacity: .45; }
.feed-order { display: flex; flex-direction: column; gap: 2px; }
.feed-order .move { color: #666; font-size: 11px; width: 22px; height: 16px; }
.feed-order .move:hover:not(:disabled) { color: var(--accent); }
.feed-order .move:disabled { opacity: .25; cursor: default; }
.feed-name { font-size: 17px; font-weight: 700; }
.feed-badge { margin-left: 8px; font-size: 11px; color: var(--text-dim); border: 1px solid #333; border-radius: 2px; padding: 0 5px; vertical-align: 2px; }
.feed-desc { color: var(--text-dim); font-size: 13px; margin-top: 2px; }
.feed-actions { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--text-dim); }
.feed-actions input { accent-color: var(--accent); vertical-align: -2px; }

.feed-form .form-row { margin-top: 18px; }
.feed-form .form-row > label:first-child { color: var(--text); font-weight: 700; font-size: 14px; }
.feed-form .hint { color: var(--text-dim); font-size: 12px; }
.choice-group { display: flex; flex-wrap: wrap; gap: 6px; }
.choice {
  position: relative; padding: 6px 12px; border-radius: 3px; background: var(--bg-input); cursor: pointer; color: #ccc;
  border: 1px solid transparent; user-select: none;
}
.choice:hover { background: var(--bg-hover); }
.choice.checked { border-color: var(--accent); color: #fff; background: rgba(238, 77, 46, .14); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.benis-range { display: flex; align-items: center; gap: 10px; color: var(--text-dim); }
.benis-range input { width: 120px; }
.feed-preview { margin-top: 22px; padding: 12px 14px; background: var(--bg-panel); border-left: 3px solid var(--accent); color: #ccc; }
.feed-preview b { color: #fff; }
.feed-form-buttons { display: flex; align-items: center; gap: 10px; margin-top: 18px; }
.feed-form-buttons .spacer { flex: 1; }

/* ---------- moderation ---------- */

.mod-link { color: #f7c600; font-size: 13px; font-weight: 700; }
.count-badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; text-align: center; line-height: 18px; }
.notices-link { color: #4ade80; font-size: 13px; }
.mod-action { color: #f7c600; }
.mod-action:hover { color: #ffd84d; }
.profile-actions { display: flex; gap: 14px; font-size: 13px; }
.banned-note { color: var(--bad); margin: 8px 0 0; }
.hidden-comment { color: var(--text-faint); font-style: italic; }
.primary-button.danger { background: var(--bad); }
.primary-button.danger:hover { background: #e8573c; }

.dialog-form { display: flex; flex-direction: column; gap: 10px; }
.dialog-form textarea, .dialog-form select { width: 100%; }
.radio-list { display: flex; flex-direction: column; gap: 6px; }
.radio-list label, .check { display: flex; gap: 8px; align-items: baseline; cursor: pointer; color: #ddd; }
.radio-list input, .check input { accent-color: var(--accent); }
#overlay-box { max-height: 86vh; overflow: auto; }
#overlay-box:has(.dialog-form) { width: min(460px, calc(100vw - 32px)); }

.mod-page { padding: 22px 0; max-width: 900px; }
.mod-page h1 { font-weight: 500; margin: 0 0 12px; }
.mod-page h2 { font-size: 17px; font-weight: 500; margin: 24px 0 6px; }
.mod-filter { color: var(--text-dim); }
.mod-filter a.active { color: var(--accent); }
.mod-card { background: var(--bg-panel); border-radius: 3px; padding: 12px 14px; margin-bottom: 8px; }
.mod-card-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.mod-note { white-space: pre-wrap; margin: 8px 0; }
.mod-target { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.mod-target .hint { flex-basis: 100%; }
.mod-thumb img { width: 72px; height: 72px; object-fit: cover; display: block; border-radius: 2px; }
.mod-actions { margin-top: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mod-actions .spacer, .mod-page .row .spacer { flex: 1; }
.mod-page .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.mod-row { display: flex; gap: 12px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid #222; }
.mod-row .hint { flex: 1; }
.mod-page .hint, .feeds-page .hint { color: var(--text-dim); font-size: 12px; }
.mod-page blockquote { margin: 6px 0; padding: 6px 10px; border-left: 3px solid #333; color: #ccc; white-space: pre-wrap; flex-basis: 100%; }
.mod-log { border-collapse: collapse; width: 100%; font-size: 13px; }
.mod-log td { padding: 5px 10px 5px 0; border-bottom: 1px solid #222; vertical-align: top; }
.notice { background: var(--bg-panel); border-radius: 3px; padding: 12px 16px; margin-bottom: 10px; }
.notice.unread { border-left: 3px solid #4ade80; }
.notice h2 { margin: 0 0 2px !important; }
.notice-body { white-space: pre-wrap; }

/* ---------- settings ---------- */

#settings-link { color: #777; }
#settings-link:hover { color: var(--accent); }
#settings-link .icon { width: 17px; height: 17px; }
.settings-page { max-width: 720px; padding: 22px 0; }
.settings-page h1 { font-weight: 500; margin: 0 0 6px; }
.settings-page section { background: var(--bg-panel); border-radius: 3px; padding: 14px 18px; margin-top: 14px; }
.settings-page h2 { font-size: 17px; font-weight: 500; margin: 0 0 8px; }
.settings-page p { color: #ccc; margin: 0 0 10px; }
.settings-page .hint { color: var(--text-dim); font-size: 12px; }
.settings-page .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.settings-page .error { color: var(--bad); font-size: 13px; }
.settings-page .mod-row { display: flex; gap: 12px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid #2a2a2e; }
.settings-page .mod-row .hint { flex: 1; }
.this-device { color: #4ade80; }
.danger-zone { border-left: 3px solid var(--bad); }

.syncing { font-size: 12px; color: #9a8cff; display: inline-flex; align-items: center; gap: 6px; }
.spinner.small { width: 12px; height: 12px; border-width: 2px; }

.stalking-page .user-tabs { margin: 6px 0 14px; }
.stalking-page #stalk-form { display: flex; gap: 8px; margin-bottom: 12px; }
.stalking-page #stalk-form input { flex: 1; }
.stalk-row .stalk-name { min-width: 180px; }
.stalk-row .pending { color: #f7c600; font-weight: 400; }
.user-stats a { color: var(--text-dim); }
.user-stats a b { color: #fff; display: block; font-size: 20px; }
.user-stats a:hover, .user-stats a:hover b { color: var(--accent); }

/* ---------- source code page ---------- */

.source-page { padding: 22px 0 40px; }
.source-page h1 { font-weight: 500; font-size: 26px; margin: 0 0 8px; }
.source-page .lead { color: #ccc; max-width: 760px; }
.source-page a { color: var(--accent); }
.source-page a.primary-button { color: #fff; }
.source-page .hint { color: var(--text-dim); font-size: 12px; }
.source-download { background: var(--bg-panel); border-radius: 3px; padding: 14px 16px; margin: 16px 0 20px; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.source-download .sha { flex-basis: 100%; word-break: break-all; }
.source-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 24px; align-items: start; }
.source-tree { background: var(--bg-panel); border-radius: 3px; padding: 12px 14px; position: sticky; top: calc(var(--head-h) + 10px); max-height: calc(100vh - var(--head-h) - 30px); overflow: auto; }
.source-tree h2 { font-size: 15px; margin: 0 0 8px; }
.source-dir { margin-bottom: 8px; }
.source-dir-name { color: #fff; font-weight: 700; font-size: 13px; }
.source-dir-name + .source-file, .source-dir-name ~ .source-file { padding-left: 12px; }
.source-file { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; padding: 1px 0; }
.source-file-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-bottom: 10px; }
.source-file-head h1 { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 20px; margin: 0; }
.source-code { counter-reset: line; background: #111113; border-radius: 3px; padding: 10px 0; overflow: auto; font: 12.5px/1.5 ui-monospace, Menlo, Consolas, monospace; color: #ddd; }
.source-code span { display: block; padding: 0 14px 0 0; white-space: pre; }
.source-code span::before { counter-increment: line; content: counter(line); display: inline-block; width: 46px; padding-right: 12px; text-align: right; color: #555; user-select: none; }
.md { color: #ddd; max-width: 820px; }
.md h2 { font-size: 22px; font-weight: 500; margin: 26px 0 8px; color: #fff; }
.md h3 { font-size: 17px; margin: 20px 0 6px; color: #fff; }
.md h4, .md h5 { font-size: 15px; margin: 16px 0 6px; color: #fff; }
.md code { background: var(--bg-input); border-radius: 3px; padding: 1px 5px; font: 12.5px ui-monospace, Menlo, Consolas, monospace; }
.md .md-code { background: #111113; border-radius: 3px; padding: 10px 14px; overflow: auto; }
.md .md-code code { background: none; padding: 0; }
.md ul, .md ol { padding-left: 22px; }
.md li { margin: 3px 0; }
.md-table { overflow-x: auto; margin: 10px 0; }
.md table { border-collapse: collapse; font-size: 13px; }
.md th, .md td { border: 1px solid #2c2c30; padding: 5px 9px; text-align: left; vertical-align: top; }
.md th { background: var(--bg-panel); }
@media (max-width: 820px) {
  .source-layout { grid-template-columns: 1fr; }
  .source-tree { position: static; max-height: none; }
}

/* ---------- pages ---------- */

.static-page { max-width: 720px; padding: 26px 0; color: #ddd; }
.static-page h1 { font-weight: 500; font-size: 26px; margin: 0 0 16px; color: #fff; }
.static-page h2 { font-size: 17px; margin: 24px 0 6px; color: #fff; }
.static-page a { color: var(--accent); }
.static-page kbd { background: var(--bg-input); border-radius: 3px; padding: 1px 6px; font-family: inherit; }
.static-page table td { padding: 3px 14px 3px 0; }

.user-head {
  display: grid; grid-template-columns: 1fr auto; gap: 8px 20px; padding: 22px 0 16px; border-bottom: 1px solid #262629; margin-bottom: 14px;
}
.user-head h1 { margin: 0; font-size: 28px; font-weight: 700; }
.user-head .rank { color: var(--text-dim); }
.user-stats { display: flex; gap: 24px; color: var(--text-dim); }
.user-stats b { display: block; color: #fff; font-size: 20px; }
.user-tabs { display: flex; gap: 18px; margin: 0 0 14px; font-size: 15px; }
.user-tabs a.active { color: var(--accent); }
.user-comments { margin-top: 26px; }
.user-comments h2 { font-size: 17px; font-weight: 500; }
.user-comment { padding: 8px 0; border-bottom: 1px solid #222; }
.user-comment .meta { color: var(--text-dim); font-size: 12px; margin-top: 3px; }

.upload-page { max-width: 640px; padding: 26px 0; }
.upload-page h1 { font-weight: 500; }
.dropzone {
  border: 2px dashed #3a3a3e; border-radius: 6px; padding: 40px 20px; text-align: center; color: var(--text-dim); cursor: pointer;
}
.dropzone.drag { border-color: var(--accent); color: var(--text); }
.dropzone img, .dropzone video { max-width: 100%; max-height: 380px; display: block; margin: 0 auto 10px; }
.form-row { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.form-row label { color: var(--text-dim); font-size: 13px; }
.form-row.inline { flex-direction: row; align-items: center; gap: 8px; }

/* ---------- overlay / login ---------- */

#overlay {
  position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.75);
  display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh;
}
#overlay-box {
  background: var(--bg-panel); border-radius: 4px; padding: 24px 26px; width: min(380px, calc(100vw - 32px));
  box-shadow: 0 12px 40px rgba(0,0,0,.6);
}
#overlay-box h2 { margin: 0 0 6px; font-weight: 500; }
#overlay-box p { color: var(--text-dim); margin: 0 0 14px; font-size: 13px; }
#overlay-box input[type=text] { width: 100%; margin-bottom: 12px; }
#overlay-box .row { display: flex; gap: 8px; justify-content: flex-end; }
#overlay-box .error { color: var(--bad); font-size: 13px; margin: -6px 0 10px; }

#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 1100;
  background: #2a2a2e; color: #fff; padding: 9px 16px; border-radius: 3px; box-shadow: 0 6px 20px rgba(0,0,0,.5);
}

/* ---------- footer + cookie notice ---------- */

#footer-links {
  position: fixed; left: 0; bottom: 0; z-index: 50; padding: 4px; background: var(--bg);
  font-size: 12px; line-height: 1.35; max-width: 225px;
}
#footer-links a { color: #8c8c8c; margin-right: 6px; }
#footer-links a:hover { color: var(--accent); }

.cookie-notice {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 1002; background: #1a1a1a;
  box-shadow: 0 -2px 10px rgba(0,0,0,.5); animation: slide-up .3s ease-out;
}
@keyframes slide-up { from { transform: translateY(100%); opacity: 0; } }
.cookie-notice-content { display: flex; align-items: center; gap: 16px; padding: 16px; max-width: 1200px; margin: 0 auto; }
.cookie-notice-icon { width: 16px; height: 16px; fill: #e8850c; color: #e8850c; flex-shrink: 0; }
.cookie-notice-text { flex: 1; min-width: 0; }
.cookie-notice-highlight { margin: 0 0 6px; font-size: 16px; font-weight: 700; color: #4ade80; }
.cookie-notice-main { margin: 0; font-size: 13px; color: #b0b0b0; }
.cookie-notice-main a { color: #ee6911; text-decoration: underline; }

/* ---------- narrow screens ---------- */

@media (max-width: 1140px) {
  #footer-links { display: none; }
}
@media (max-width: 820px) {
  :root { --head-h: 92px; }
  #head-content { flex-wrap: wrap; gap: 6px 14px; padding: 8px 0; height: auto; }
  #head { height: auto; min-height: var(--head-h); }
  #head-menu { order: 3; flex-basis: 100%; padding-top: 0; }
  #user-area { margin-left: auto; }
  #search-form { margin-left: auto; }
  #search-input { width: 140px; }
  .item-info { grid-template-columns: 1fr; }
  .item-caption { grid-column: 1; }
  .user-head { grid-template-columns: 1fr; }
  .user-side { align-items: flex-start; }
  .feed-row { grid-template-columns: auto 1fr; }
  .feed-actions { grid-column: 2; }
  .stream-prev, .stream-next { width: 44px; }
}
@media (max-width: 640px) {
  .cookie-notice-content { flex-wrap: wrap; justify-content: center; text-align: center; }
  .cookie-notice-icon { display: none; }
  .head-tab { font-size: 15px; }
  #search-input { width: 100px; }
}
