:root {
  --bg: #1d1e21;
  --bg-2: #232428;
  --card: rgba(255, 255, 255, 0.018);
  --line: #393b40;
  --line-hi: #56585f;
  --text: #d4d5d8;
  --dim: #8a8c92;
  --faint: #5f6167;
  --well: #17181a;
  --radius: 14px;
  --bw: 1.5px;
  --head: 50px;
  --col: 600px;
  --maxh: calc(100svh - var(--head) - 120px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100svh; color: var(--text);
  font: 15px/1.4 ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
  background:
    radial-gradient(1200px 600px at 50% -200px, #2a2b30 0%, transparent 70%),
    var(--bg);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}
/* a little grain so the grey has some character */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
::selection { background: #4a4c52; }

/* header */
header {
  position: sticky; top: 0; z-index: 20; height: var(--head);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 max(16px, env(safe-area-inset-left)); padding-top: env(safe-area-inset-top);
  box-sizing: content-box;
  background: rgba(29, 30, 33, .82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: var(--bw) solid rgba(57, 59, 64, .55);
  transition: transform .25s ease;
}
header.hidden { transform: translateY(calc(-100% - 2px)); }
body.anon #add { display: none; }
body.anon #me { width: auto; height: auto; border: 0; border-radius: 0; padding: 0 4px; text-transform: none; color: var(--faint); font-size: 14px; }
body.anon #me:hover { color: var(--text); }
span.chip { cursor: default; }
.logo { font-weight: 700; letter-spacing: .5px; text-decoration: none; color: var(--dim); font-size: 17px; }
.sort { display: flex; gap: 4px; position: absolute; left: 50%; transform: translateX(-50%); }
.sort a { text-decoration: none; color: var(--faint); padding: 5px 12px; border-radius: 99px; border: var(--bw) solid transparent; font-size: 14px; }
.sort a.on { color: var(--text); border-color: var(--line); }
.right { display: flex; gap: 10px; align-items: center; }
.icon { width: 34px; height: 34px; border-radius: 10px; border: var(--bw) solid var(--line); color: var(--dim); display: grid; place-items: center; }
.icon:hover { border-color: var(--line-hi); color: var(--text); }
.avatar { width: 34px; height: 34px; border-radius: 50%; border: var(--bw) solid var(--line); display: grid; place-items: center; text-decoration: none; color: var(--dim); font-size: 14px; text-transform: uppercase; }
.avatar:hover { border-color: var(--line-hi); }

main { position: relative; z-index: 1; max-width: var(--col); margin: 0 auto; padding: 18px 12px 40vh; }

/* global volume: just the icon; the slider slides out on hover */
.vol { display: flex; align-items: center; }
.vol-btn { width: 30px; height: 34px; display: grid; place-items: center; color: var(--dim); transition: color .15s; }
.vol-btn:hover, .vol:hover .vol-btn { color: var(--text); }
.vol.hint .vol-btn { animation: nudge 1.2s ease 2; color: var(--text); }
@keyframes nudge { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.25); } }
.vol input {
  -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer;
  width: 0; opacity: 0; margin: 0; height: 24px;
  transition: width .28s cubic-bezier(.3, .7, .2, 1), opacity .2s ease, margin .28s ease;
}
.vol:hover input, .vol:focus-within input, .vol.open input { width: 86px; opacity: 1; margin-right: 4px; }
.vol input::-webkit-slider-runnable-track { height: 3px; border-radius: 2px; background: linear-gradient(to right, var(--text) var(--v, 100%), var(--line-hi) var(--v, 100%)); }
.vol input::-moz-range-track { height: 3px; border-radius: 2px; background: var(--line-hi); }
.vol input::-moz-range-progress { height: 3px; border-radius: 2px; background: var(--text); }
.vol input::-webkit-slider-thumb { -webkit-appearance: none; width: 11px; height: 11px; margin-top: -4px; border-radius: 50%; background: var(--text); border: 0; }
.vol input::-moz-range-thumb { width: 11px; height: 11px; border-radius: 50%; background: var(--text); border: 0; }
.touch .vol input { display: none; }

/* posts */
.post { margin: 0 0 26px; border: var(--bw) solid var(--line); border-radius: var(--radius); background: var(--card); overflow: hidden; scroll-margin-top: calc(var(--head) + 12px); }
.post.current { border-color: #44464c; }
.frame { background: var(--well); display: flex; justify-content: center; }
.media { position: relative; aspect-ratio: var(--ar); width: min(100%, calc(var(--maxh) * var(--ar))); max-height: var(--maxh); }
.media img, .media video, .media iframe { display: block; width: 100%; height: 100%; object-fit: contain; border: 0; }
.media.tall { width: 100%; aspect-ratio: auto; max-height: var(--maxh); overflow: hidden; }
.media.tall img { height: auto; }
.media.tall::after { content: ""; position: absolute; inset: auto 0 0; height: 90px; background: linear-gradient(transparent, var(--well)); pointer-events: none; }
.media.tall.open { max-height: none; }
.media.tall.open::after { display: none; }
.expand { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); z-index: 2; padding: 5px 14px; border-radius: 99px; border: var(--bw) solid var(--line-hi); background: rgba(23, 24, 26, .8); color: var(--dim); font-size: 13px; }
.media.tall.open .expand { display: none; }

/* video player */
.video { cursor: pointer; }
.video video { background: #000; }
.v-ui { position: absolute; inset: 0; pointer-events: none; }
.v-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 18px; pointer-events: auto; cursor: pointer; touch-action: none; }
.v-bar::before, .v-buf, .v-prog { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; transition: height .15s; }
.v-bar::before { right: 0; background: rgba(255, 255, 255, .12); }
.v-buf { background: rgba(255, 255, 255, .18); width: 0; }
.v-prog { background: rgba(230, 231, 234, .85); width: 0; }
.video:hover .v-bar::before, .video:hover .v-buf, .video:hover .v-prog, .v-bar.drag::before, .v-bar.drag .v-buf, .v-bar.drag .v-prog { height: 6px; }
.v-btn { position: absolute; pointer-events: auto; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #e8e8ea; background: rgba(20, 20, 22, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: .0; transition: opacity .2s; }
.v-full { right: 10px; bottom: 14px; }
.video:hover .v-btn, .video.paused .v-btn { opacity: .9; }
.touch .video .v-full { opacity: 0; pointer-events: none; }
.v-time { position: absolute; left: 10px; bottom: 14px; font-size: 12px; font-variant-numeric: tabular-nums; color: #e8e8ea; background: rgba(20, 20, 22, .55); padding: 2px 7px; border-radius: 99px; opacity: 0; transition: opacity .2s; }
.video:hover .v-time, .video.long .v-time, .video.paused .v-time { opacity: .85; }
.v-big { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px; border-radius: 50%; display: grid; place-items: center; background: rgba(20, 20, 22, .5); color: #eee; opacity: 0; transition: opacity .2s; }
.video.paused .v-big { opacity: .9; }
.video:fullscreen { width: 100%; max-height: none; background: #000; }
.video:fullscreen video { object-fit: contain; }

/* embeds and cards */
.lite { cursor: pointer; background: #000 center / cover no-repeat; }
.lite .v-big { opacity: .9; }
.card { display: block; padding: 22px 20px; text-decoration: none; width: 100%; }
.card b { display: block; font-weight: 600; margin-bottom: 4px; }
.card span { color: var(--faint); font-size: 13px; }
.placeholder { aspect-ratio: 4 / 3; width: 100%; display: grid; place-items: center; color: var(--faint); font-size: 14px; text-align: center; padding: 20px; }
.placeholder.busy { background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.03) 50%, transparent 70%) var(--well); background-size: 200% 100%; animation: shimmer 1.4s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* reactions bar */
.bar { display: flex; align-items: center; gap: 6px; padding: 8px 10px 6px; min-height: 44px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 9px; border-radius: 99px; border: var(--bw) solid var(--line); font-size: 15px; line-height: 1; }
.chip span { font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; }
.chip.mine { border-color: #75777e; background: rgba(255, 255, 255, .05); }
.chip.mine span { color: var(--text); }
.chip:hover { border-color: var(--line-hi); }
.chip.ghost { border-style: dashed; opacity: 0; transition: opacity .15s; }
.post:hover .chip.ghost { opacity: .45; }
.chip.ghost:hover { opacity: 1 !important; }
.touch .chip.ghost { display: none; }
.add-react { color: var(--faint); width: 28px; justify-content: center; padding: 0; }
.add-react:hover { color: var(--text); }
.spacer { flex: 1; }
.more { color: var(--faint); width: 30px; height: 28px; border-radius: 8px; font-size: 18px; letter-spacing: 1px; opacity: .6; }
.more:hover, .more.on { opacity: 1; color: var(--text); }

/* comments */
.comments { padding: 0 12px 8px; font-size: 14px; }
.cm { position: relative; padding: 3px 54px 3px 0; color: #b9bbbf; word-wrap: break-word; border-radius: 6px; }
.cm b { color: var(--dim); font-weight: 600; margin-right: 6px; }
.cm i { color: var(--faint); font-style: normal; font-size: 12px; }
.cm-act { position: absolute; right: 0; top: 2px; display: none; gap: 2px; }
.cm.mine:hover .cm-act, .cm.mine:focus-within .cm-act, .touch .cm.mine.tap .cm-act { display: flex; }
.cm-act button { color: var(--faint); width: 24px; height: 22px; border-radius: 6px; font-size: 13px; }
.cm-act button:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
.cin { display: block; width: 100%; margin-top: 4px; padding: 8px 2px 4px; background: none; border: 0; border-top: var(--bw) solid rgba(57, 59, 64, .6); outline: none; color: var(--text); font-size: 14px; }
.cin::placeholder { color: transparent; }
.post:hover .cin::placeholder, .cin:focus::placeholder, .touch .cin::placeholder { color: var(--faint); }
.cin:focus { border-top-color: var(--line-hi); }
.cm input { width: 100%; background: none; border: 0; border-bottom: var(--bw) solid var(--line-hi); outline: none; padding: 0 0 2px; font-size: 14px; }

/* popovers */
.pop { position: fixed; z-index: 50; background: #26272b; border: var(--bw) solid var(--line-hi); border-radius: 12px; padding: 8px; box-shadow: 0 12px 40px rgba(0, 0, 0, .5); }
.picker { width: 296px; }
.picker .row { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.picker .row + .row { margin-top: 6px; padding-top: 6px; border-top: var(--bw) solid var(--line); }
.picker button { font-size: 21px; height: 34px; border-radius: 8px; }
.picker button:hover, .picker button:focus { background: rgba(255, 255, 255, .07); outline: none; }
.picker input { width: 100%; margin-top: 8px; background: var(--well); border: var(--bw) solid var(--line); border-radius: 8px; padding: 6px 9px; outline: none; font-size: 14px; }
.menu { min-width: 190px; padding: 6px; }
.menu .who { color: var(--faint); font-size: 13px; padding: 6px 10px 8px; border-bottom: var(--bw) solid var(--line); margin-bottom: 4px; }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 8px; text-decoration: none; font-size: 14px; color: var(--text); }
.menu a:hover, .menu button:hover { background: rgba(255, 255, 255, .06); }
.menu .danger { color: #d9897f; }

/* forms and pages */
.page { max-width: 380px; margin: 8vh auto 0; }
.page.wide { max-width: var(--col); margin-top: 10px; }
.page h1 { font-size: 20px; font-weight: 600; color: var(--dim); margin: 0 0 18px; }
.page h2 { font-size: 13px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: 1px; margin: 34px 0 10px; }
.box { border: var(--bw) solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--card); }
.field { display: block; width: 100%; margin: 0 0 10px; padding: 10px 12px; background: var(--well); border: var(--bw) solid var(--line); border-radius: 10px; outline: none; }
.field:focus { border-color: var(--line-hi); }
.btn { display: inline-block; padding: 9px 16px; border-radius: 10px; border: var(--bw) solid var(--line-hi); color: var(--text); text-decoration: none; font-size: 14px; }
.btn:hover { background: rgba(255, 255, 255, .05); }
.btn.quiet { border-color: var(--line); color: var(--dim); }
.err { color: #d9897f; font-size: 14px; min-height: 20px; margin: 4px 0 8px; }
.muted { color: var(--faint); font-size: 13px; }
pre.code { background: var(--well); border: var(--bw) solid var(--line); border-radius: 10px; padding: 10px 12px; overflow-x: auto; font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; color: #b9bbbf; white-space: pre; }
.inv { display: flex; gap: 10px; align-items: center; padding: 6px 0; font-size: 14px; border-bottom: var(--bw) solid rgba(57, 59, 64, .5); }
.inv code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); font-size: 12.5px; }
.end { text-align: center; color: var(--faint); font-size: 13px; padding: 20px; }
.back { display: inline-block; margin: 0 0 14px; color: var(--faint); text-decoration: none; font-size: 14px; }

/* upload sheet */
.sheet-bg { position: fixed; inset: 0; z-index: 40; background: rgba(10, 10, 12, .6); display: grid; place-items: center; padding: 16px; }
.sheet { width: min(460px, 100%); background: #232428; border: var(--bw) solid var(--line-hi); border-radius: 18px; padding: 16px; }
.dz { display: grid; place-items: center; text-align: center; height: 170px; border: 2px dashed var(--line); border-radius: 14px; color: var(--dim); cursor: pointer; font-size: 15px; }
.dz:hover, .dz.over { border-color: var(--line-hi); color: var(--text); }
.dz small { display: block; color: var(--faint); margin-top: 4px; font-size: 12.5px; }
.or { display: flex; gap: 8px; margin-top: 12px; }
.or .field { margin: 0; }

#drop { position: fixed; inset: 0; z-index: 60; display: none; place-items: center; background: rgba(15, 15, 17, .75); pointer-events: none; }
#drop div { border: 2px dashed var(--line-hi); border-radius: 20px; padding: 50px 70px; color: var(--text); font-size: 18px; }
body.dragging #drop { display: grid; }

#toasts { position: fixed; z-index: 70; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { pointer-events: auto; background: #2a2b2f; border: var(--bw) solid var(--line-hi); border-radius: 12px; padding: 9px 13px; font-size: 14px; max-width: min(360px, calc(100vw - 28px)); box-shadow: 0 8px 30px rgba(0, 0, 0, .4); }
.toast .pbar { height: 3px; background: var(--line); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.toast .pbar i { display: block; height: 100%; width: 0; background: var(--text); transition: width .2s; }
.toast.err { border-color: #7a4a44; }

.help { width: min(340px, calc(100vw - 32px)); font-size: 14px; }
.help div { display: flex; justify-content: space-between; padding: 4px 6px; }
.help kbd { font: 12px ui-monospace, Menlo, monospace; border: var(--bw) solid var(--line); border-radius: 6px; padding: 1px 6px; color: var(--dim); }

@media (max-width: 640px) {
  main { padding: 10px 0 40vh; }
  .post { border-radius: 0; border-left: 0; border-right: 0; margin-bottom: 14px; }
  :root { --maxh: calc(100svh - var(--head) - 110px); }
  .sort { position: static; transform: none; }
  .page { padding: 0 16px; }
}
