:root {
  --orange: #ff9000;
  --orange-hi: #ffa733;
  --bg: #000;
  --panel: #1b1b1b;
  --panel-2: #262626;
  --line: #2f2f2f;
  --text: #fff;
  --text-2: #c6c6c6;
  --muted: #8f8f8f;
  --heart: #ff3040;
  --radius: 4px;
  --gutter: 16px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 Arial, Helvetica, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Heiti TC", sans-serif;
  overflow-x: hidden;
}
:lang(zh-Hant-TW) body, html:lang(zh-Hant-TW) { letter-spacing: .02em; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--orange); }
img, video { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }
.icon { flex-shrink: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.wrap { max-width: 1460px; margin: 0 auto; padding: 0 var(--gutter); }
.page { padding-top: 20px; padding-bottom: 48px; min-height: 60vh; }
.narrow { max-width: 680px; margin: 0 auto; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

/* ---------- header ---------- */
.topbar { background: var(--bg); position: sticky; top: 0; z-index: 20; }
.topbar-inner { display: flex; align-items: center; gap: 20px; height: 64px; }
.logo { display: inline-flex; align-items: center; font-weight: 900; font-size: 28px; letter-spacing: -0.5px; white-space: nowrap; }
.logo:hover { color: inherit; }
.logo-a { color: #fff; padding-right: 3px; }
.logo-b { background: var(--orange); color: #000; border-radius: 5px; padding: 0 6px; line-height: 1.2; }
/* Comfortaa Light (SIL OFL, see fonts/Comfortaa-OFL.txt), self-hosted so no visitor is sent to a font CDN. */
@font-face {
  font-family: 'Comfortaa'; src: url('/fonts/comfortaa-light.woff2') format('woff2');
  font-weight: 300; font-style: normal; font-display: swap;
}
.logo-tag { margin-left: 12px; font-family: 'Comfortaa', sans-serif; font-weight: 300; letter-spacing: 0; color: #fff; }
.search { flex: 1; display: flex; max-width: 640px; margin: 0 auto; }
.search input {
  flex: 1; min-width: 0; height: 40px; padding: 0 14px; font-size: 15px;
  background: #fff; color: #000; border: 0; border-radius: var(--radius) 0 0 var(--radius);
}
.search input::placeholder { color: #777; }
.search button {
  width: 52px; border: 0; background: var(--orange); color: #000;
  border-radius: 0 var(--radius) var(--radius) 0; cursor: pointer; display: grid; place-items: center;
}
.search button:hover { background: var(--orange-hi); }
.top-actions { display: flex; gap: 8px; align-items: center; }
.mainnav { background: var(--panel); border-top: 1px solid #111; }
.mainnav .wrap { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.mainnav .wrap::-webkit-scrollbar { display: none; }
.mainnav a {
  padding: 12px 14px; font-weight: 700; text-transform: uppercase; font-size: 13px; letter-spacing: .3px;
  white-space: nowrap; border-bottom: 3px solid transparent;
}
.mainnav a.on { border-bottom-color: var(--orange); color: #fff; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px; border: 0; border-radius: var(--radius);
  font-weight: 700; cursor: pointer; white-space: nowrap; touch-action: manipulation;
}
.btn-orange { background: var(--orange); color: #000; }
.btn-orange:hover { background: var(--orange-hi); color: #000; }
.btn-dark { background: var(--panel-2); color: #fff; }
.btn-dark:hover { background: #333; color: #fff; }
.btn-ghost { background: none; color: var(--text-2); padding: 0 10px; }
.btn-ghost:hover { background: var(--panel-2); color: #fff; }
.btn-danger { background: #c62828; color: #fff; }
.btn-danger:hover { background: #e53935; color: #fff; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 48px; font-size: 16px; }
.inbox-btn { position: relative; padding: 0 11px; }
.inbox-btn.on { background: var(--orange); color: #000; }
.unread-count {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--heart); color: #fff; font-size: 11px; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--bg);
}
.btn:disabled { opacity: .6; cursor: progress; }

/* ---------- section heads, grids ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.section-head h1 { font-size: 22px; }
.seg { display: inline-flex; background: var(--panel); border-radius: var(--radius); padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; }
.seg a { padding: 6px 12px; border-radius: 3px; font-weight: 700; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.seg a.on { background: var(--orange); color: #000; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 22px 14px; }
.card { display: block; min-width: 0; }
.thumb { position: relative; aspect-ratio: 16 / 9; background: #111; border-radius: var(--radius); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.card:hover .thumb img { transform: scale(1.04); }
.thumb-ph {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 6px;
  background: linear-gradient(135deg, #2a1a00, #141414 65%); color: var(--orange); font-weight: 700;
}
.thumb-ph span { color: var(--text-2); font-size: 13px; }
.badge {
  position: absolute; right: 6px; bottom: 6px; display: inline-flex; align-items: center; gap: 4px;
  background: rgba(0, 0, 0, .8); color: #fff; font-size: 12px; font-weight: 700; padding: 2px 6px; border-radius: 3px;
}
.badge + .badge { right: auto; left: 6px; }
.card-title {
  margin-top: 8px; font-weight: 700; font-size: 14px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word;
}
.card:hover .card-title { color: var(--orange); }
.card-meta { display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: 12px; margin-top: 4px; flex-wrap: wrap; }
.card-meta span { display: inline-flex; align-items: center; gap: 4px; }
.card-meta .rating { color: var(--text-2); }
.card-meta .rating .icon { color: var(--orange); }
/* Shorts shelf: a swipeable row of 9:16 videos after the first post. Phones only (see the 640px query). */
.shorts { display: none; grid-column: 1 / -1; }
.shorts h2 { display: flex; align-items: center; gap: 8px; font-size: 17px; margin-bottom: 10px; }
.shorts h2 .icon { color: var(--orange); }
.shorts-track {
  display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
  margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); scroll-padding: 0 var(--gutter);
}
.shorts-track::-webkit-scrollbar { display: none; }
.short { flex: 0 0 42%; min-width: 0; scroll-snap-align: start; }
.short-thumb { position: relative; aspect-ratio: 9 / 16; background: #111; border-radius: 8px; overflow: hidden; }
.short-thumb img { width: 100%; height: 100%; object-fit: cover; }
.short-title {
  margin-top: 6px; font-weight: 700; font-size: 13px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word;
}
.short-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.empty { padding: 60px 0; text-align: center; color: var(--muted); font-size: 16px; }
.empty a { color: var(--orange); }

.pager { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 32px 0 8px; }
.pager a, .pager span {
  min-width: 40px; height: 40px; padding: 0 12px; display: grid; place-items: center;
  background: var(--panel-2); border-radius: var(--radius); font-weight: 700;
}
.pager .on { background: var(--orange); color: #000; }

.tag-cloud { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.tag-tile {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 14px 16px;
  background: var(--panel); border-radius: var(--radius); font-weight: 700; font-size: 15px; min-width: 0;
}
.tag-tile span { color: var(--muted); font-size: 12px; }
.tag-tile:hover { background: var(--panel-2); }

/* ---------- post page ---------- */
.post-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; }
.post-main { min-width: 0; }
.media { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.media > * { min-width: 0; }

/* Threads-style image carousel: equal-height slides in a swipeable row, next one peeking in. */
.carousel { position: relative; --car-h: clamp(280px, 52vw, 520px); }
.car-track {
  display: flex; gap: 6px; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-padding: 0 var(--car-pad, 0px);
  padding: 0 var(--car-pad, 0px);
}
.car-track::-webkit-scrollbar { display: none; }
.car-slide {
  flex: 0 0 auto; height: var(--car-h); max-width: calc(100% - 48px); scroll-snap-align: start;
  border-radius: 10px; overflow: hidden; background: #111; cursor: zoom-in;
}
.car-slide img { width: 100%; height: 100%; object-fit: cover; }
.carousel.single .car-slide { height: auto; max-height: 80vh; max-width: 100%; width: 100%; background: #0b0b0b; }
.carousel.single .car-slide img { height: auto; max-height: 80vh; width: auto; max-width: 100%; margin: 0 auto; object-fit: contain; }
.car-btn {
  position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: rgba(0, 0, 0, .7); color: #fff; display: grid; place-items: center; cursor: pointer;
  opacity: 0; transition: opacity .15s;
}
.carousel:hover .car-btn { opacity: 1; }
.car-btn:hover { background: var(--orange); color: #000; }
.car-btn.prev { left: 10px; }
.car-btn.next { right: 10px; }
.car-count {
  position: absolute; top: 10px; right: 10px; background: rgba(0, 0, 0, .7); color: #fff;
  font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; pointer-events: none;
}
@media (hover: none) { .car-btn { display: none; } }

/* Full-screen viewer */
.lightbox { position: fixed; inset: 0; z-index: 100; background: #000; display: flex; flex-direction: column; }
.lb-track { flex: 1; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior: contain; }
.lb-track::-webkit-scrollbar { display: none; }
.lb-slide { flex: 0 0 100%; scroll-snap-align: center; display: grid; place-items: center; padding: 56px 8px calc(16px + env(safe-area-inset-bottom)); }
.lb-slide img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lb-bar { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: calc(8px + env(safe-area-inset-top)) 12px 8px; }
.lb-count { font-weight: 700; color: var(--text-2); }
.lb-close { width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .12); color: #fff; display: grid; place-items: center; cursor: pointer; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .12); color: #fff; display: grid; place-items: center; cursor: pointer; }
.lb-nav.prev { left: 16px; }
.lb-nav.next { right: 16px; }
@media (hover: none) { .lb-nav { display: none; } }
body.no-scroll { overflow: hidden; }

.embed { background: #0b0b0b; border-radius: 10px; overflow: hidden; }
.embed iframe { width: 100%; border: 0; display: block; background: #0b0b0b; }
.embed-video iframe { aspect-ratio: 16 / 9; }
.embed-vertical iframe { aspect-ratio: 9 / 16; max-height: 80vh; width: auto; height: min(80vh, 820px); max-width: 100%; margin: 0 auto; }
.embed-post iframe { height: 640px; max-width: 560px; margin: 0 auto; }
.embed-audio iframe { height: 152px; }
.embed-audio-tall iframe { height: 352px; }
.embed-file video { width: 100%; max-height: 80vh; background: #000; }
.embed-file.audio { padding: 16px; display: grid; gap: 12px; justify-items: center; }
.embed-file.audio img { max-height: 280px; border-radius: 8px; }
.embed-file audio { width: 100%; }
.embed-src { display: block; padding: 8px 12px; font-size: 12px; color: var(--muted); text-align: right; }

.link-card { display: grid; grid-template-columns: 200px minmax(0, 1fr); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.link-card:hover { color: inherit; border-color: var(--orange); }
.link-card img { width: 100%; height: 100%; object-fit: cover; min-height: 140px; }
.link-card-body { padding: 14px 16px; display: grid; gap: 4px; align-content: start; min-width: 0; }
.link-card-site { font-size: 12px; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.link-card strong { font-size: 16px; line-height: 1.35; word-break: break-word; }
.link-card p { margin: 0; color: var(--text-2); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.link-card-open { color: var(--orange); font-size: 13px; font-weight: 700; margin-top: 4px; }

.post-title { font-size: 22px; line-height: 1.35; margin: 16px 0 10px; word-wrap: break-word; }
.post-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.post-stats { display: flex; gap: 16px; align-items: center; color: var(--text-2); }
.rating-big { color: var(--orange); font-weight: 900; font-size: 18px; }
.votes { display: flex; gap: 6px; }
.vote-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 16px; touch-action: manipulation;
  border: 0; border-radius: var(--radius); background: var(--panel-2); color: #fff; cursor: pointer; font-weight: 700;
}
.vote-btn:hover { background: #333; }
.vote-btn.on { background: var(--orange); color: #000; }
.rating-bar { height: 3px; background: #444; margin: 10px 0 16px; border-radius: 2px; overflow: hidden; }
.rating-bar span { display: block; height: 100%; background: var(--orange); }

.post-author { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.post-author .menu { margin-left: auto; }
.post-body { font-size: 15px; line-height: 1.7; white-space: pre-wrap; word-wrap: break-word; padding: 4px 0 14px; color: #eee; }
.post-body a, .citem-body a { color: var(--orange); word-break: break-all; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.pill { background: var(--panel-2); padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--text-2); }
.pill:hover { background: var(--orange); color: #000; }

.share { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--panel); border-radius: var(--radius); margin-bottom: 24px; }
.share-label { font-weight: 700; text-transform: uppercase; font-size: 12px; color: var(--muted); flex-shrink: 0; }
.share-row { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.share-btn {
  display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 12px; border-radius: 999px;
  border: 0; font-size: 13px; font-weight: 700; color: #fff; cursor: pointer; white-space: nowrap; flex-shrink: 0;
}
.share-btn:hover { color: #fff; filter: brightness(1.15); }
.s-x, .s-threads { background: #000; box-shadow: inset 0 0 0 1px #444; }
.s-line { background: #06c755; }
.s-facebook { background: #1877f2; }
.s-whatsapp { background: #1fa855; }
.s-telegram { background: #229ed9; }
.s-copy { background: var(--orange); color: #000; }
.s-copy:hover { color: #000; }

.sidebar h3 { font-size: 15px; text-transform: uppercase; margin-bottom: 12px; color: var(--text-2); }
.sidebar .grid { grid-template-columns: 1fr; gap: 16px; }

/* ---------- threads-style replies ---------- */
.thread { margin-top: 8px; }
.thread-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.thread-head h2 { font-size: 18px; }
.cgroup { border-bottom: 1px solid var(--line); padding: 14px 0 8px; }
.citem { display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 12px; position: relative; }
.citem-rail { display: flex; flex-direction: column; align-items: center; }
.rail-line { flex: 1; width: 2px; background: #3a3a3a; border-radius: 1px; margin: 6px 0 -2px; min-height: 12px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; flex-shrink: 0;
  background: hsl(var(--h, 30) 45% 28%); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}
.avatar.sm { width: 32px; height: 32px; font-size: 17px; }
.citem-main { padding-bottom: 12px; min-width: 0; }
.citem-head { display: flex; align-items: center; gap: 8px; min-height: 24px; }
.citem-head .menu { margin-left: auto; }
.anon-name { font-weight: 700; display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; min-width: 0; }
.anon-tag { color: var(--muted); font-weight: 400; font-size: 12px; }
.op { background: var(--orange); color: #000; font-size: 10px; font-weight: 900; padding: 1px 5px; border-radius: 3px; margin-left: 2px; letter-spacing: 0; }
.time { font-size: 13px; white-space: nowrap; }
.citem-body { margin: 2px 0 0; font-size: 15px; white-space: pre-wrap; word-wrap: break-word; }
.citem-body.deleted { color: var(--muted); font-style: italic; }
.focal .citem-body { font-size: 17px; margin-top: 6px; }
.focal { padding-bottom: 6px; }
.actions { display: flex; gap: 2px; margin: 4px 0 0 -10px; }
.act {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 36px; padding: 0 10px; min-width: 40px;
  border: 0; border-radius: 999px; background: none; color: var(--text-2); cursor: pointer; font-size: 13px; touch-action: manipulation;
}
.act:hover { background: var(--panel-2); color: #fff; }
.act.on { color: var(--heart); }
.act.on .icon { fill: currentColor; }
.more-replies { display: inline-block; margin: 0 0 8px 52px; color: var(--muted); font-size: 13px; font-weight: 700; padding: 4px 0; }
.more-replies::before { content: ''; display: inline-block; width: 18px; height: 1px; background: #555; vertical-align: middle; margin-right: 8px; }
.thread-divider {
  margin: 8px 0 0; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  font-weight: 700; color: var(--text-2);
}
.reply-box { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; padding: 10px 0; }
/* Turnstile only takes up room when Cloudflare asks for a click. */
.reply-box .cf-turnstile { flex-basis: 100%; }
.reply-box .cf-turnstile:empty { display: none; }
.reply-box textarea {
  flex: 1; min-width: 0; resize: none; min-height: 40px; max-height: 300px; padding: 9px 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; outline: none;
}
.reply-box textarea:focus { border-color: var(--orange); }
.reply-box .btn { margin-top: 4px; }
/* Without JS the native file picker shows; with it, the image icon stands in for it. */
.reply-attach { position: relative; flex-wrap: wrap; height: auto; min-height: 40px; margin-top: 0; }
.reply-attach input { max-width: 180px; font-size: 12px; }
.js .reply-attach input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.reply-attach:focus-within { outline: 2px solid var(--orange); }
.reply-box.drag { outline: 2px dashed var(--orange); outline-offset: 2px; border-radius: 12px; }
.reply-preview { flex-basis: 100%; padding-left: 42px; }
.reply-preview:empty { display: none; }
.reply-preview .preview { width: 88px; }
.citem-img { display: block; max-width: 100%; margin-top: 8px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #111; }
.citem-img img { display: block; width: 100%; height: auto; }
.reply-slot:empty { display: none; }
.back { display: inline-block; margin-bottom: 12px; color: var(--muted); font-weight: 700; padding: 4px 0; }
.post-ref { display: flex; gap: 10px; align-items: center; padding: 12px; background: var(--panel); border-radius: 10px; margin-bottom: 12px; min-width: 0; }
.post-ref-title { font-weight: 700; color: var(--text-2); word-break: break-word; }

/* ---------- menus ---------- */
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; color: var(--muted); width: 36px; height: 32px; border-radius: 999px; display: grid; place-items: center; }
.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover { background: var(--panel-2); color: #fff; }
.menu-pop {
  position: absolute; right: 0; top: 100%; z-index: 10; width: 240px; max-width: calc(100vw - 32px); margin-top: 4px; padding: 12px;
  background: #222; border: 1px solid #383838; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .6);
  display: grid; gap: 10px;
}
.menu-pop form { display: grid; gap: 8px; }
.menu-pop label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.menu-pop select { background: var(--panel); border: 1px solid #444; border-radius: var(--radius); padding: 8px; }

/* ---------- forms ---------- */
.form { display: grid; gap: 18px; margin-top: 12px; }
.form > label { display: grid; gap: 6px; font-weight: 700; }
.form label .muted { font-weight: 400; }
.form input:not([type=file]):not([type=radio]), .form textarea {
  width: 100%; padding: 11px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; outline: none;
}
.form input:focus, .form textarea:focus { border-color: var(--orange); }
/* Categories: pills inside a box that looks like the other inputs (built by app.js). */
.tag-field {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 46px; padding: 6px 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px; cursor: text;
}
.tag-field:focus-within { border-color: var(--orange); }
.form .tag-field input.tag-typing { flex: 1; min-width: 7em; width: auto; padding: 5px 4px; border: 0; background: transparent; }
.tag-pill {
  display: inline-flex; align-items: center; gap: 2px; height: 30px; padding: 0 3px 0 10px;
  color: var(--orange-hi); border: 1px solid transparent;
  /* A dashed outline with set dash and gap lengths (CSS "dashed" picks its own): 6px dashes, 4px gaps.
     The stroke is centred on the edge and its outer half clipped, so 2 here draws 1px. rx is half
     the fixed 30px height, so the ends are round. */
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='100%25' height='100%25' rx='15' fill='none' stroke='%23ff9000' stroke-opacity='.55' stroke-width='2' stroke-dasharray='6 4'/%3E%3C/svg%3E") center / 100% 100% no-repeat border-box,
    rgba(255, 144, 0, 0.16);
  border-radius: 999px; font-size: 13px; font-weight: 700;
}
.tag-pill button {
  display: grid; place-items: center; width: 22px; height: 22px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--orange); cursor: pointer;
}
.tag-pill button svg { width: 14px; height: 14px; }
.tag-pill button:hover { background: var(--orange); color: #000; }
.tag-wrap { position: relative; }
.tag-suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 15; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.tag-option { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; cursor: pointer; }
.tag-option:hover, .tag-option[aria-selected=true] { background: rgba(255, 144, 0, 0.16); color: var(--orange-hi); }
.alert { background: #3a1a00; border: 1px solid var(--orange); color: #ffd7a8; padding: 10px 14px; border-radius: var(--radius); margin: 12px 0; }

/* Composer: images-or-link tabs driven by radio buttons, so they work without JS too. */
.mode > input[type=radio] { position: absolute; opacity: 0; pointer-events: none; }
.mode-tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--panel); border-radius: 8px; padding: 4px; gap: 4px; }
.mode-tabs label {
  display: flex; align-items: center; justify-content: center; gap: 6px; height: 42px; border-radius: 6px;
  font-weight: 700; color: var(--text-2); cursor: pointer; user-select: none;
}
#mode-images:checked ~ .mode-tabs [for=mode-images],
#mode-link:checked ~ .mode-tabs [for=mode-link] { background: var(--orange); color: #000; }
#mode-images:focus-visible ~ .mode-tabs [for=mode-images],
#mode-link:focus-visible ~ .mode-tabs [for=mode-link] { outline: 2px solid var(--orange); outline-offset: 2px; }
.mode-panel { display: none; gap: 10px; margin-top: 12px; }
#mode-images:checked ~ .panel-images, #mode-link:checked ~ .panel-link { display: grid; }
.dropzone {
  position: relative; display: grid; justify-items: center; gap: 4px; padding: 26px 16px; text-align: center;
  border: 2px dashed #444; border-radius: 10px; background: var(--panel); cursor: pointer; font-weight: 700;
}
.dropzone:hover, .dropzone.drag { border-color: var(--orange); color: var(--orange); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.js .dropzone input[type=file] { width: 1px; height: 1px; inset: auto; }
.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.previews:empty { display: none; }
.preview { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #111; }
.preview img { width: 100%; height: 100%; object-fit: cover; }
.preview button {
  position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, .75); color: #fff; display: grid; place-items: center; cursor: pointer;
}
.preview .num { position: absolute; left: 4px; bottom: 4px; background: rgba(0, 0, 0, .75); font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 999px; }
.link-preview:empty { display: none; }
.link-preview .status { color: var(--muted); padding: 8px 0; }
.link-preview .status.bad { color: #ffb36b; }

.p-google { background: #fff; color: #1f1f1f; }
.p-google:hover { color: #1f1f1f; }
.p-github { background: #24292f; }
.p-discord { background: #5865f2; }
.p-twitter { background: #000; box-shadow: inset 0 0 0 1px #444; }
.p-reddit { background: #ff4500; }
.p-facebook { background: #1877f2; }

.plain-list { list-style: none; padding: 0; display: grid; gap: 10px; word-break: break-word; }
.inbox { list-style: none; padding: 0; margin: 0; }
.inbox-item { display: flex; gap: 12px; padding: 14px 10px; border-bottom: 1px solid var(--line); min-width: 0; }
.inbox-item:hover { color: inherit; background: var(--panel); }
.inbox-item.unread { background: rgba(255, 144, 0, 0.08); box-shadow: inset 3px 0 0 var(--orange); }
.inbox-main { min-width: 0; flex: 1; }
.inbox-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.inbox-body { margin: 4px 0; color: var(--text-2); word-break: break-word; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.push-card { background: var(--panel); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 16px; }
.push-state { margin: 0; }
div.push-state { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; }
div.push-state p { margin: 0; flex: 1 1 220px; }
.new-tag { background: var(--orange); color: #000; font-size: 10px; font-weight: 900; padding: 1px 5px; border-radius: 3px; }
.narrow h2 { font-size: 17px; margin: 28px 0 12px; }
.report { background: var(--panel); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; word-break: break-word; }
.report p { margin: 6px 0 10px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- admin stats ---------- */
.stats { max-width: 1100px; margin: 0 auto; }
.stats-panel { background: var(--panel); border-radius: var(--radius); padding: 16px; margin-top: 16px; }
.stats-panel h2 { font-size: 17px; }
.stats-panel > .muted { margin: 2px 0 14px; }
.stats-msg { color: var(--text-2); word-break: break-word; }
.stats-sub { font-size: 14px; margin: 4px 0 8px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-bottom: 16px; }
.tile { background: var(--panel-2); border-radius: var(--radius); padding: 10px 12px; }
.tile-v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile-l { color: var(--text-2); font-size: 12px; }
.tile-s { color: var(--muted); font-size: 12px; }
.chart { margin: 0 0 20px; }
.chart figcaption { font-weight: 700; margin-bottom: 6px; }
.chart-plot svg { display: block; width: 100%; height: 120px; overflow: visible; }
.chart-y { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-base { stroke: var(--muted); stroke-width: 1; }
.chart-hit { fill: transparent; }
.chart-col:hover .chart-hit { fill: rgba(255, 255, 255, 0.06); }
.chart-bar { fill: var(--orange); }
.chart-col:hover .chart-bar { fill: var(--orange-hi); }
.chart-line { fill: none; stroke: var(--orange); stroke-width: 2; stroke-linejoin: round; pointer-events: none; }
.chart-x { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }
.chart-table { margin-top: 6px; font-size: 12px; color: var(--text-2); }
.chart-table summary { cursor: pointer; color: var(--muted); }
.chart-table table, .rank table { width: 100%; border-collapse: collapse; }
.chart-table td, .chart-table th { padding: 3px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.stats .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ranks { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px 24px; }
.rank h3 { font-size: 14px; margin-bottom: 6px; }
/* Fixed layout: every list's bars line up, and long paths end in an ellipsis instead of widening the table. */
.rank table { table-layout: fixed; }
.rank th { width: 45%; font-weight: 400; text-align: left; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 3px 8px 3px 0; }
.rank td { padding: 3px 0; }
.rank td.num { width: 76px; }
.rank-bar span { display: block; height: 8px; min-width: 2px; background: var(--orange); border-radius: 0 4px 4px 0; }
.rank .num { padding-left: 8px; }

.prose { font-size: 15px; line-height: 1.8; color: var(--text-2); }
.prose h2 { color: #fff; }
.prose ol { padding-left: 1.4em; }
.error-page { padding: 60px 0; }
.error-code { font-size: 80px; font-weight: 900; color: var(--orange); line-height: 1; }

/* ---------- home page gate ---------- */
.gate {
  width: min(420px, calc(100vw - 32px)); padding: 28px 24px; text-align: center;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
}
.gate::backdrop { background: rgba(0, 0, 0, .85); }
.gate-q { margin: 0 0 22px; font-size: 20px; font-weight: 800; line-height: 1.4; }
.gate-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.gate-actions form { display: contents; }
.gate-actions .btn { flex: 1 1 140px; }
.gate-no { padding: 16px; }
.gate-no img { display: block; width: 100%; height: auto; max-height: calc(100dvh - 150px); object-fit: contain; margin-bottom: 14px; border-radius: 4px; }
.gate-no .btn { width: 100%; }

/* ---------- footer, toast ---------- */
.footer { border-top: 1px solid var(--line); padding: 28px 0 calc(40px + env(safe-area-inset-bottom)); text-align: center; color: var(--muted); }
.footer .logo { font-size: 22px; }
.footer nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 20px; margin: 14px 0; font-weight: 700; color: var(--text-2); }
#toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #fff; color: #000; font-weight: 700; padding: 10px 18px; border-radius: 999px; transition: .2s; z-index: 150;
  max-width: calc(100vw - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .post-layout { grid-template-columns: 1fr; }
  .sidebar .grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}
@media (max-width: 760px) {
  .lang span { display: none; }
}
@media (max-width: 640px) {
  .topbar { position: static; }
  .topbar-inner { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; gap: 10px; }
  .logo { font-size: 24px; }
  /* Room for the wordmark: it shrinks, and Post and Me become bare icons (the wordmark keeps one header row from 375px up). */
  .logo-tag { font-size: 0.62em; margin-left: 8px; }
  .top-actions .btn.post-btn, .top-actions .btn.inbox-btn, .top-actions .btn.me-btn { padding: 0 10px; }
  .post-btn span, .me-btn span { display: none; }
  .top-actions { margin-left: auto; gap: 6px; }
  .top-actions .btn { height: 36px; padding: 0 12px; }
  .top-actions .lang { padding: 0 8px; }
  /* With an identity the bar also holds the inbox and Me, so the language switch lives in the footer only. */
  .top-actions.signed-in .lang { display: none; }
  .search { order: 3; flex-basis: 100%; }
  .mainnav a { padding: 11px 12px; }
  .page { padding-top: 14px; }
  .section-head h1 { font-size: 19px; }
  /* One post per row, YouTube style: thumbnails run edge to edge, the title and stats sit on the gutter. */
  .grid, .sidebar .grid { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .card .thumb { margin: 0 calc(-1 * var(--gutter)); border-radius: 0; }
  .card-title { font-size: 15px; margin-top: 10px; }
  .card-meta { gap: 10px; }
  .shorts { display: block; padding: 4px 0 6px; }

  /* Media runs edge to edge like a native app; the carousel keeps the first slide on the gutter. */
  .media { margin: -14px calc(-1 * var(--gutter)) 0; }
  .carousel { --car-h: 300px; --car-pad: var(--gutter); }
  .carousel.single { --car-pad: 0px; }
  .carousel.single .car-slide, .embed, .link-card { border-radius: 0; }
  .link-card { grid-template-columns: 1fr; border-left: 0; border-right: 0; }
  .link-card img { aspect-ratio: 1.91 / 1; min-height: 0; }
  .embed-post iframe { height: 560px; }
  .embed-vertical iframe { height: min(78vh, 700px); }
  .car-count { right: calc(var(--gutter) + 8px); }

  .post-title { font-size: 19px; }
  .post-bar { gap: 8px; }
  .vote-btn { padding: 0 14px; }
  /* Share buttons become one swipeable row instead of a tall wrapped block. */
  .share { margin: 0 calc(-1 * var(--gutter)) 20px; border-radius: 0; padding: 12px var(--gutter); }
  .share-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: calc(-1 * var(--gutter)); padding-right: var(--gutter); }
  .share-row::-webkit-scrollbar { display: none; }
  .more-replies { margin-left: 52px; }
  .error-code { font-size: 64px; }
  /* 16px stops iOS Safari from zooming the page when a field is focused. */
  input, textarea, select, .search input { font-size: 16px !important; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
